Live data from Hacker News

Learn Programming with OCaml

usr.lmf.cnrs.fr

101–110 of 150 posts

Re: Learn Programming with OCaml

#101

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 O…

Ooooh, the memories...

Caml was how I was taught computer science in prépa and first few years of engineering school, a mere 25 years ago.

(Ok, I had done bits of BASIC before, but I had time to recover.)

To be honest, the learning path was

1. Lots of maths. Then add some more.

2. Algos in pseudo code. (In "French", pseudo code, of course, because, why not ?)

3. Caml as "executable pseudo code". With all the warnings and a hints of disgust as the use of mutation and side effect. (And of course ":=" his completely different from "=", what are we, beasts ?)

4. Lots of exams where you have to write properly indented programs on paper on the first try to submit all sorts of recursive trees to all sorts of horrendous manipulations - and you can imagine the grader doing the mother of all code reviews

5. Re do that again in engineering school, because a third of the class had done zero computer science, and the other third had learn in Pascal

6. Then learn C and assembler, and get your mind blown in the exact opposite direction

7. See your teachers reluctantly say that "you should just learn java", because "that's what used in the industry", and "no one will ever get a job writing caml anyway"

...

25 years later : yup, some people managed to get jobs writing a dialect of caml for this small startup in a garage serving cat pictures and racist memes to billions of people

26 years later: "you should just learn to prompt LLMs anyway", because "that's what the industry needs, and no one will get a job programming any more"

Re: Learn Programming with OCaml

#102

Earlier quoted context omitted.

An ML is great for the theory or abstraction side of programming, but C is also hands down the best language to get a sense of how the computer is running your program. It’s still an abstraction, but at least being aware of memory management, copying vs referencing, etc are hugely important concepts that ML languages can hide.

> It’s still an abstraction C is still heavily abstracted. Modern OS evolved in conjunction with C s.t. it behaves like a C runtime simulating a PDP11 (I remember reading a nice article on that). To learn system, what you need is an OS course, not C. I'd say the current C-based stack is in a quite embarrassing state.

I think this PDP-11 meme is quite misleading. There is nothing really in the C programming model specific to the PDP-11 and C was used on systems much weirder than a PDP-11. C is also very successfully the basis of many parallel programs running on multi-processor systems with a memory model in the standard that was created much later than the PDP-11.

Also somehow the implied argument that computing hardware and operating systems simulate a PDP-11 for the sake of C is completely backwards. Historically, there were other approaches, e.g. processors designed for object-oriented programming or actors etc.. All those were not very successful.

Re: Learn Programming with OCaml

#103

I believe that an ML should be the First Language for Computer Scientists. It's much less clear which language we should teach people for whom it will likely be their Only Language, today Python is common, and for fields which care about stats often R is used, I've also seen Java used in this role. But for a First Language specifically I am in no doubt that an ML should be chosen, and this is despite the fact that th…

[deleted]

Re: Learn Programming with OCaml

#104
post #102

Earlier quoted context omitted.

> It’s still an abstraction C is still heavily abstracted. Modern OS evolved in conjunction with C s.t. it behaves like a C runtime simulating a PDP11 (I remember reading a nice article on that). To learn system, what you need is an OS course, not C. I'd say the current C-based stack is in a quite embarrassing state.

I think this PDP-11 meme is quite misleading. There is nothing really in the C programming model specific to the PDP-11 and C was used on systems much weirder than a PDP-11. C is also very successfully the basis of many parallel programs running on multi-processor systems with a memory model in the standard that was created much later than the PDP-11. Also somehow the implied argument that computing hardware and oper…

It's clear that the authors were either inspired by the PDP-11 ISA and/or designed the language to make porting UNIX from PDP-11 Assm to it easier.

UNIX for PDP-7 in Assm -> UNIX for PDP-11 in Assm -> UNIX for PDP-11 in C

https://news.ycombinator.com/item?id=42644851

and

https://news.ycombinator.com/item?id=43245166

Re: Learn Programming with OCaml

#105

> 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?

This mindset (i.e. LLMs are available so why do i need to learn anything?) is highly insidious and will destroy your brain/mind/future if you let it.

Humans are the ones who Understand, while LLMs only Know.

So inter-disciplinary/cross-disciplinary insights, new modes of thinking/reasoning, flashes of insight etc. are still in the purview of Humans only. AI/LLMs can help focus and short-circuit the study of various subjects but their understanding can only happen within a human "Mind". If you do not even have basic domain knowledge (i.e. unknown unknowns) how can you even prompt/query an LLM for answers?

A few illustrative examples; a) Newton came up with limits/calculus out of a need to measure continuous motion with varying speeds b) Kekule came up with the benzene ring from a dream where he saw a snake grab its own tail c) Descartes came up with the cartesian coordinates in an attempt to solve geometry via algebra etc. Each of these was a novel leap of insight bringing together various concepts to create entirely new knowledge domains.

So one should learn/study the core concepts/ideas in various domains and then push the tedious mechanical labour onto the machines. In this regard see also the concept of "Active Learning" - https://en.wikipedia.org/wiki/Active_learning

Re: Learn Programming with OCaml

#106

> 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?

Should I continue to walk, when technology can move me from place to place?

https://tenor.com/view/tf2-wall-e-team-fortress-2-autobalanc...

Re: Learn Programming with OCaml

#108

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 O…

Ooooh, the memories... Caml was how I was taught computer science in prépa and first few years of engineering school, a mere 25 years ago. (Ok, I had done bits of BASIC before, but I had time to recover.) To be honest, the learning path was 1. Lots of maths. Then add some more. 2. Algos in pseudo code. (In "French", pseudo code, of course, because, why not ?) 3. Caml as "executable pseudo code". With all the warnings…

Drawing cardioids in maple V while I had darkbasic pro at home and could write my own games and delve into quaternions since 3eme. :x

No wonder I failed this sht, kind of.

Re: Learn Programming with OCaml

#109
post #108

Earlier quoted context omitted.

Ooooh, the memories... Caml was how I was taught computer science in prépa and first few years of engineering school, a mere 25 years ago. (Ok, I had done bits of BASIC before, but I had time to recover.) To be honest, the learning path was 1. Lots of maths. Then add some more. 2. Algos in pseudo code. (In "French", pseudo code, of course, because, why not ?) 3. Caml as "executable pseudo code". With all the warnings…

Drawing cardioids in maple V while I had darkbasic pro at home and could write my own games and delve into quaternions since 3eme. :x No wonder I failed this sht, kind of.

Yup, I did not mention the classmates who were already fluent in c++ at 15 and were not that kind of pretending "loops" were mathematical wonder :D

Re: Learn Programming with OCaml

#110

Earlier quoted context omitted.

An ML is great for the theory or abstraction side of programming, but C is also hands down the best language to get a sense of how the computer is running your program. It’s still an abstraction, but at least being aware of memory management, copying vs referencing, etc are hugely important concepts that ML languages can hide.

> It’s still an abstraction C is still heavily abstracted. Modern OS evolved in conjunction with C s.t. it behaves like a C runtime simulating a PDP11 (I remember reading a nice article on that). To learn system, what you need is an OS course, not C. I'd say the current C-based stack is in a quite embarrassing state.

For someone just starting to learn CS, it should not matter whether they're on PDP-11 or x64 or ARM. You can't start teaching with pipelining and speculative branch execution. So C is good choice because there is a simple CPU architecture that it maps to well.
Post reply on HN