6 ms·
Multicore OCaml: September 2020
- dunefox 6y agoHow do the type systems of F# and Ocaml differ? I'm trying to decide which I should learn over the next months. I don't need many libraries or anything, the decision is rather made regarding the language and tools themselves.
- lowleveldesign 6y agoCan anyone point me to the tool they use to generate the concurrency graphs, such as this one https://user-images.githubusercontent.com/410484/93755338-ba1f7c00-fc20-11ea-85ee-25a77b4af2c9.png https://user-images.githubusercontent.com/410484/93755338-ba...? Is it something OCaml specific?
- sadiq 6y agoThat's the Chrome tracing tool: https://www.chromium.org/developers/how-tos/trace-event-profiling-tool https://www.chromium.org/developers/how-tos/trace-event-prof... It uses the event logging infrastructure in multicore which outputs json. Normal OCaml has integrated this since 4.11: https://ocaml.org/releases/4.11/htmlman/instrumented-runtime.html https://ocaml.org/releases/4.11/htmlman/instrumented-runtime... but switches to the Common Tracing Format (CTF) so you'll need an extra step to convert it to a format Chrome tracing can ingest.
- lowleveldesign 6y agoGreat thanks for the detailed answer.
- adenozine 6y agoLooks like 2021 is shaping up to be a fantastic year of Ocaml. I know I've been digging into it, trying to sharpen my skills in FP. I think Ocaml's learnability is a huge asset. I'm surely biased, my main skillset is in Python so of course the low friction to a new language is more important to me rather than say, a Haskell user, or a Scala user. The 2nd edition of Real World Ocaml on Yaron Minsky's site is a great resource for me, though once multicore is actually stable and fully activated there will be still more learning to do. It's a really nice change to embrace types so close to the top of the software process. Things like Mypy have been a godsend, and I've said in the past that Mypyc represents the biggest quantum leap that Python will ever make, but having such a mature and FAST compiler, with a syntax that's clean and consistent on top of a huge, mature ecosystem (not as huge as pypi, ofc) is just such a powerful value proposition. Aside from Multicore, I think OWL (ocaml.xyz) is a big leap forward for the ecosystem too. I can see some finance shops putting together Ocaml-Jupyter notebooks and that sort of thing. Maybe bio-tech researchers with FP backgrounds could get more into it. This is all just my opinion, but having leaned pretty heavy on Python's ecosystem for a pretty long period of time, I am VERY optimistic about finding ways to replace things with Ocaml for speed and correctness. I do enjoy Python, but I think the typed-Python renaissance is about 3 years too late now. It'll win more battles in the years to come, but I see war on the horizon, and not just with Ocaml either.
- as_keyof_typeof 6y agoYou might find this interesting > A conversation with Laurent Mazare about how your choice of programming language interacts with the kind of work you do, and in particular about the tradeoffs between Python and OCaml when doing machine learning and data analysis. Ron and Laurent discuss the tradeoffs between working in a text editor and a Jupyter Notebook, the importance of visualization and interactivity, how tools and practices vary between language ecosystems, and how language features like borrow-checking in Rust and ref-counting in Swift and Python can make machine learning easier. https://signalsandthreads.com/python-ocaml-and-machine-learning/ https://signalsandthreads.com/python-ocaml-and-machine-learn...
- adenozine 6y agoI actually read a good chunk of this today! My experience in software is pretty different than his, though I find his insights very welcome and quite valuable. I don't really have to build large systems, I work mainly with programs I'd describe as duct tape and wrenches. They're small and one-off, and the main goals are to compose them quickly and arrive at a stable behavior that I can write solid tests for. With ocaml, I think the way I'd write a lot of programs I use python for is roughly the same way, just piping a bunch of crap together and then cramming it into a test harness, but with ocaml I can have type safety and speed and a higher level of footgun to do work with. For me. I do weird work. If I was a more typical software guy, I'd be able to relate a lot more.
- jurip 6y agoSignals and Threads has been a fantastic podcast thus far, I've really enjoyed all the episodes.
- lmm 6y agoIf you're willing to be judicious about which libraries you use then you can absolutely pick up Scala directly from Python - a lot of things you'd write in Python translate directly into Scala, particularly if you were already writing map/filter style code. (I like OCaml too, don't get me wrong)
- wjsetzer 6y agoThis is unrelated to multicore, but Ocaml is a language I want to like. I wanted to learn OCaml with the make a lisp project. That is, until I realized it doesn't have Perl regex built in (yes, I have been spoiled by Python, which has practically everything in the standard library). The best way to get Perl regex was a rarely updated 3rd party library which was missing key features like lookahead and lookbehind.
- jlrubin 6y agohttps://ocaml.janestreet.com/ocaml-core/109.55.00/tmp/re2/Regex.html https://ocaml.janestreet.com/ocaml-core/109.55.00/tmp/re2/Re... should do the trick! ocaml core is well maintained AFAIK
- laylomo2 6y agoHere's a link to the latest documentation: https://ocaml.janestreet.com/ocaml-core/latest/doc/re2/Re2__/Regex_intf/module-type-S/index.html https://ocaml.janestreet.com/ocaml-core/latest/doc/re2/Re2__...
- Joker_vD 6y agoWere you going to parse S-expressions with regular expressions? I guess that saves you from learning how to write loops and conditionals, and what is substr() called (and what arguments it takes) in this new language, but is not that against the point of learning the new language?
- bgorman 6y agoThe make a lisp tutorial provides a PCRE regular expression to generate the tokens that are later fed into the reader.
- bjoli 6y agoNow, I am a grumpy old fart, but I would suggest to make a one-pass recursive descent lexer+reader. That should be trivial for the MAL lisp. WRiting an ocaml recursive descent parser should be amazingly straightforward, especially since you can just tailcall the different states.
- DanielBMarkham 6y agoAlgebraic Effects look awesome. Can't wait to play around with all the cool new stuff.
- yaseer 6y agoAwesome stuff. I'm an ocaml novice, but love the language. I've found its fusing of object oriented and functional styles far, far more elegant than scala.
- agambrahma 6y agoThe event tracing here is pretty cool; does Haskell have something equivalent in its runtime?
- horiz0n 6y agoHaskell has ThreadScope https://wiki.haskell.org/ThreadScope https://wiki.haskell.org/ThreadScope
- person_of_color 6y agoHas anyone learnt OCaml, just to improve their chances of getting a job at Jane Street?
- fractionalhare 6y agoThere's no point, they very explicitly don't expect candidates to know OCaml before joining. You can interview in just about any language you want.
- person_of_color 6y agoAny tips to crack a JS interview? You seem to be employed there.
- pjmlp 6y agoNot the OP, but I failed at a Jane Street interview for their UK office. Get updated on algorithms and data structures, Google interview style. I wasn't (having been around for a few decades), and while I still managed to swim, failed to impress.
- person_of_color 6y agoAre you going to keep trying?
- pjmlp 6y agoNope, it was a different phase of my life and I don't plan to go into UK any longer. Plus I am not keen in companies that follow Google hiring practices.
- person_of_color 6y agoThe ROI is worth it, probably.