News for hackers. Stuff that matters.
Re:Python, OCaml, and Machine Learning (2020) by dharmaturtle on Saturday August 07, 2021 @07:31PM (#28102834)
> Ron and Laurent discuss the tradeoffs between working in a text editor and a Jupyter Notebook

F#, basically OCaml on dotnet, has good support for notebooks: https://www.compositional-it.com/news-blog/a-brief-introduct...

I use it all the time when prototyping/scripting. Much more fun to use than the standard REPL.

A video of it in action: https://channel9.msdn.com/Shows/VS-Code-Livestreams/net-Inte...

Re:Python, OCaml, and Machine Learning (2020) by kodon on Sunday August 08, 2021 @12:28AM (#28104218)
F# has a lot more going for it than I expected. It is a great mix of the simplicity of python and type safety
Re:Python, OCaml, and Machine Learning (2020) by hurril on Sunday August 08, 2021 @06:49AM (#28105766)
It's a wonderful language. Been working full time in it for two years now.
Re:Python, OCaml, and Machine Learning (2020) by zmmmmm on Saturday August 07, 2021 @10:37PM (#28103794)
Yes it surprised me there was so much discussion of jupyter notebooks as if they only support Python but there is great support for all kinds of languages including very statically typed ones (Scala, etc).

I do lots of ML in Groovy using beakerx [0] which is pretty much the last thing anybody would expect but it works great.

[0] https://github.com/twosigma/beakerx

Re:Python, OCaml, and Machine Learning (2020) by agumonkey on Sunday August 08, 2021 @04:43AM (#28105152)
Some people were criticizing the unspecified notebook scope semantics. It was with python, I wonder if that affects other kernels though
Re:Python, OCaml, and Machine Learning (2020) by smabie on Saturday August 07, 2021 @07:24PM (#28102796)
Lack of ad-hoc polymorphism in OCaml really puts a damper on using it for research/scientific computing. However for large production systems, the simplicity and straightforwardness of the language is definitely a plus: engineers and even researchers of all experience levels can be productive pretty quickly.

I wanted to write a new low latency HFT system in OCaml at my firm, but we eventually decided to go with Rust. No real regrets there though, Rust feels a lot like a ML language, albeit a little more finicky and lower level. The fact that Rust seems blazing fast by default is a big advantage over OCaml imo, which in contrast can be slow (relatively) if you aren't thinking carefully about your memory allocations.

Re:Python, OCaml, and Machine Learning (2020) by neolog on Saturday August 07, 2021 @08:50PM (#28103226)
Is that really a contrast? You have to think carefully about allocation in Rust too. It's just that Rust forces you to do it.
Re:Python, OCaml, and Machine Learning (2020) by queuebert on Saturday August 07, 2021 @09:56PM (#28103604)
Rust forces you to think about memory access carefully, but mostly it handles the allocation/deallocation for you. Is that what you meant?
Re:Python, OCaml, and Machine Learning (2020) by wyager on Saturday August 07, 2021 @10:40PM (#28103814)
It only “handles allocation/deallocation for you” in the sense that the lifetime system forces you to write code that adheres to RAII. It handles a lot less than a language with a GC, for example.
Re:Python, OCaml, and Machine Learning (2020) by queuebert on Sunday August 08, 2021 @09:41AM (#28106622)
An interesting point. RAII makes you do work by forcing you to think a certain way. In Rust that manifests as borrow checker struggles, which are huge productivity sinks up front, but which we all hope saves work down the road. Time will tell, I suppose.
Re:Python, OCaml, and Machine Learning (2020) by pjmlp on Sunday August 08, 2021 @02:04AM (#28104549)
While a language with GC, can still allow for RAII and value allocations while handling lot more.
Re:Python, OCaml, and Machine Learning (2020) by dan-robertson on Sunday August 08, 2021 @03:53AM (#28104966)
I don’t really understand what you mean. The main reason people complain about gc is performance:

1. costs to average performance from doing gc

2. Jitter/increased tail latency from collections and (particularly) compaction which one can’t easily control.

I don’t believe that much in #1. Tracking memory with something like malloc can be slow and allocation with a typical gc is usually a few instructions bumping a pointer. If most of the minor heap is dead then deallocation is likely cheaper too. I think most of the differences are in programming style as when allocations are easy and cheap, programs tend to allocate a lot. #2 is still true though modern gcs can have very low pause times. And manual memory management can still lead to pauses waiting on the kernel (or in its page fault handler) for more memory.

Other issues for gc languages is that one generally doesn’t get data access patterns that are performant. C/C++/Rust objects generally get included in one another rather than referenced with pointers and most short-lived allocations happen on the stack which will very likely be in the cache.

If you write in a RAII style or with value allocations (note that in ocaml the only ‘value allocations’ are things that fit in a single 63 bit integer) with gc then, in a typical language, you still pay the cost of gc when you don’t use it.

Re:Python, OCaml, and Machine Learning (2020) by pjmlp on Sunday August 08, 2021 @04:14AM (#28105048)
The main reason people complain about gc is cargo cult about stuff they don't understand.

1. Then don't do GC, use the language features for stack allocation, native heap allocation, RAII

2. Just like most malloc()/free() implementations, where you don't control how they talk with the actual OS heap management APIs, as you mention

Naturally not all GC enabled languages provide such features, so one looks at Python or Java, and thinks all GC languages were born alike.

Examples of GC languages where you can do exactly the same stuff as in C/C++/Rust, Common Lisp, Oberon, Oberon-2, Component Pascal, Active Oberon, Modula-3, D, Nim, Eiffel, C#, F#, Swift.

Also note that on my earlier comment I wasn't referring to OCaml in particular, rather languages of the list above, yet Cisco might be relatively happy with their MirageOS research.

https://dl.acm.org/doi/abs/10.1145/3264560.3264561

Here is a little gem of what happens when the low level coding features of GC enabled languages are taken into the hands of people that actually know how to use them.

https://devblogs.microsoft.com/aspnet/grpc-performance-impro...

.NET 6 is bringing even more C++ like features into the managed world for .NET devs.

Re:Python, OCaml, and Machine Learning (2020) by bjoli on Sunday August 08, 2021 @09:01AM (#28106377)
I had to port a bit of ocaml code to rust a year or two back, and the lack of a switch to enable sibling recursion (tail calls, but LLVM limits it to equally-typed-finctions) in debug mode made me want to scream.

The code I ported was not complex, and ran on the first try. Except it only worked in release mode. So I had to rewrite it using loop which made my inner ocamler sad (and the code a lot uglier).

Re:Python, OCaml, and Machine Learning (2020) by shrx on Sunday August 08, 2021 @04:31PM (#28109835)
Is it just me or is the font rendering of the article text really bad (very inconsistent font thickness)? I'm using waterfox G3.2.4.1 on windows 10.