I do really wonder what it would be like to learn to program for the first time with OCaml.
I remember learning to use OCaml in a properly functional way after so long writing code in C and it was really miserably painful trying to change how I thought about algorithms. I eventually got over the hill and it changed how I write code in C (for the better?), but I do wonder if it would have been easier to have learned OCaml as a first language instead.
Michael Clarkson teaches OCaml at Cornell. I highly recommend his free course materials [1]. He’s an excellent educator. Learning functional programming paradigms had a major influence on how I design programs. Clarkson also taught snippets from the Pragmatic Programmer, which was equally influential (as it has been for many many others) [2].
My experience with OCaml has transformed how I think about programming and complex system design. This may also be true if you learn any other functional programming language, but OCaml is easy and flexible which makes it good imo as a door towards the more formal part of comp sci. Even for steering an LLM I think this might help.
My experience with lisp was exactly that: it completely changed how I think about programming, but much more, how I think about systems and engineering. (I learned it through SICP)
You can also learn for your own amusement, and solely for the fun of comprehension; a lot of mathematician were driven by this. It's a shame current social value places so much utilitariaism on learning.
As always, it is good to be aware that many people are too anxious about more existential issues to comfortably an consistently expend effort on intellectually-taxing tasks that aren't perceived as directly related to their survival. If it's an issue with social values, it's less of one related to learning as it is to perpetuating artificial scarcity.
>to comfortably an consistently expend effort on intellectually-taxing tasks that aren't perceived as directly related to their survival.
the average person spends 6(!) hours a day on their smartphone, the average TikTok user spends 100 minutes on the app alone. This isn't about artificial scarcity, it's about the average person looking like the Wall-E people
This. The other comments ignore the fact that we're humans and can't just learn things for the joy of it unless all our needs are taken care of (which is never).
You could have asked this question 10 years ago, long before llms. It's not like you'd realistically would get an ocaml job back then when there's so few of them, so why bother?
The answer is still the same as well, people learn ocaml either because they enjoy it, or because learning a functional language makes them a better programmer overall and teaches your brain to approach a problem in a different way.
Cultural inertia: until recently, you couldn't just press play and get even a wide selection of music: for most of history, if you wanted music, you had to make it or hire someone to do it for you.
More recently, you had to go to the store and buy it, which meant you didn't have much variety.
Today, learning an instrument is for social status, inheriting the shine of the past, where music was rare and costly. The reason to learn an instrument today is because the former situation was romanticized.
It'll probably take a generation before people ease into guilt-free enjoying infinite, fully generated music.
Sure, I guess. But today, something like 30% of people play music or sing. Even a couple of generations ago, it was much higher. It's not going to die out, but I think a lot of people are asking themselves if they want to bother.
Seeing that you already know programming, I'd say it'd be less risky for you. But the only reason you're able to pilot an LLM to do programming for you, is because you understand programming and architecture.
But what about the future generations skipping the step of learning the OCaml's, the C's, the Python's...? It's quite concerning.
Both force the model to reason about types too much. The more constrained type system plus global inference merely holds them to what they already wrote, with very fast feedback.
Rust is fine if you need it but most things don’t and ocaml has more convenient abstractions for “regular” work. If you need rust you need rust but ocaml isn’t that far off in perf.
Haskell type system is too expressive, it itself becomes a place for the agent to make mistakes and get bogged down.
Yes I contributed code to a paper on it this spring. It’s hard to measure and “studying” it just means feeding money into frontier models. If anyone has a few billion tokens for a couple masters students hmu so they can get it published.
Tangentially, a great interview with the creator of OCaml, Xavier Leroy [1].
[1] https://www.youtube.com/watch?v=9Cswiqrq6So
I do really wonder what it would be like to learn to program for the first time with OCaml.
I remember learning to use OCaml in a properly functional way after so long writing code in C and it was really miserably painful trying to change how I thought about algorithms. I eventually got over the hill and it changed how I write code in C (for the better?), but I do wonder if it would have been easier to have learned OCaml as a first language instead.
> Learn Programming with OCaml
Lately, I keep asking myself, do I need to learn this new thing, should I force myself to learn this thing, LLMs know it anyways and so on.
So (asking genuinely), should we learn these things?
Michael Clarkson teaches OCaml at Cornell. I highly recommend his free course materials [1]. He’s an excellent educator. Learning functional programming paradigms had a major influence on how I design programs. Clarkson also taught snippets from the Pragmatic Programmer, which was equally influential (as it has been for many many others) [2].
[1] https://www.cs.cornell.edu/courses/cs3110/2025sp/
[2] https://pragprog.com/titles/tpp20/the-pragmatic-programmer-2...
My experience with OCaml has transformed how I think about programming and complex system design. This may also be true if you learn any other functional programming language, but OCaml is easy and flexible which makes it good imo as a door towards the more formal part of comp sci. Even for steering an LLM I think this might help.
My experience with lisp was exactly that: it completely changed how I think about programming, but much more, how I think about systems and engineering. (I learned it through SICP)
You can also learn for your own amusement, and solely for the fun of comprehension; a lot of mathematician were driven by this. It's a shame current social value places so much utilitariaism on learning.
This. The question can be seen like “should I learn to solve sodoku, if a computer can do it better?”
As always, it is good to be aware that many people are too anxious about more existential issues to comfortably an consistently expend effort on intellectually-taxing tasks that aren't perceived as directly related to their survival. If it's an issue with social values, it's less of one related to learning as it is to perpetuating artificial scarcity.
>to comfortably an consistently expend effort on intellectually-taxing tasks that aren't perceived as directly related to their survival.
the average person spends 6(!) hours a day on their smartphone, the average TikTok user spends 100 minutes on the app alone. This isn't about artificial scarcity, it's about the average person looking like the Wall-E people
This. The other comments ignore the fact that we're humans and can't just learn things for the joy of it unless all our needs are taken care of (which is never).
This ^
You could have asked this question 10 years ago, long before llms. It's not like you'd realistically would get an ocaml job back then when there's so few of them, so why bother?
The answer is still the same as well, people learn ocaml either because they enjoy it, or because learning a functional language makes them a better programmer overall and teaches your brain to approach a problem in a different way.
Should you learn history if it is already written in a book? Should you live if others are already living?
For most people, history is trivia.
If you ignore history everything is perfect, or at least a controlled slight deviation.
Why learn an instrument when you can just press play?
Why does anyone have any hobbies?
Cultural inertia: until recently, you couldn't just press play and get even a wide selection of music: for most of history, if you wanted music, you had to make it or hire someone to do it for you.
More recently, you had to go to the store and buy it, which meant you didn't have much variety.
Today, learning an instrument is for social status, inheriting the shine of the past, where music was rare and costly. The reason to learn an instrument today is because the former situation was romanticized.
It'll probably take a generation before people ease into guilt-free enjoying infinite, fully generated music.
These theories sound vaguely plausible.
I would rate them as about 5% true and 95% false, as explanation of the past and prediction of the future.
The satisfaction of learning to do something difficult isn't going away, and the social status associated with it won't either.
Sure, I guess. But today, something like 30% of people play music or sing. Even a couple of generations ago, it was much higher. It's not going to die out, but I think a lot of people are asking themselves if they want to bother.
your body needs exercise or you end up an obese couch potato. Your mind is similar: it needs exercise or you end up a dunce.
Outsourcing all the thinking to machines may have consequences you might not like.
An oblique explanation: https://croissanthology.com/earring
LLMs know it anyways?
Hhhmmmmm
I would sharpen my software engineering skills rather than coding / programming skills.
Seeing that you already know programming, I'd say it'd be less risky for you. But the only reason you're able to pilot an LLM to do programming for you, is because you understand programming and architecture.
But what about the future generations skipping the step of learning the OCaml's, the C's, the Python's...? It's quite concerning.
Oh by the way, yes. Learn OCaml!
I mean if you want to let llms do everything for you go ahead. Wall-e implications aside, it seems like a great self centric life.
What the hell else do you have to do?!
Why is the PDF smaller than the Epub file?
OCaml is the LLM secret weapon right now. They are better at writing it than they are any other language.* That’s all I have to say about it.
* Other “pure” hindley-milner languages are tied but among them ocaml has some particular strengths that I’m sure others will discuss.
Two genuine questions. (1) Why not Rust? (2) Why not Haskell?
(I have my own answers, but I'd love to hear yours, too.)
Both force the model to reason about types too much. The more constrained type system plus global inference merely holds them to what they already wrote, with very fast feedback.
Rust is fine if you need it but most things don’t and ocaml has more convenient abstractions for “regular” work. If you need rust you need rust but ocaml isn’t that far off in perf.
Haskell type system is too expressive, it itself becomes a place for the agent to make mistakes and get bogged down.
(1) complexity
(2) performance
Flamebait aside, has this been studied for real ? Curious how you would rate that...
Yes I contributed code to a paper on it this spring. It’s hard to measure and “studying” it just means feeding money into frontier models. If anyone has a few billion tokens for a couple masters students hmu so they can get it published.
Did you also compare F#?