TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Functional Programming in OCaml

176 pointsby nochalmost 4 years ago

16 comments

yawaraminalmost 4 years ago
Learning OCaml will teach you the languages and concepts of the next 5 to 10 years of mainstream programming languages. E.g., here&#x27;s a TC39 proposal to add declarations to conditionals: <a href="https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-Declarations-in-Conditionals" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-Declarations-in-Conditional...</a><p>It says, in the &#x27;Future Work&#x27; section:<p>&gt; This could be extended to allowing multiple names to be initialized (such as through destructuring) with a &quot;normal&quot; conditional to be written after the assignment with a ; (similar to a for).<p><pre><code> if (let x = 1, y = 2; x || y) { &#x2F;* ... *&#x2F; } if (let {x, y} = data; x &amp;&amp; y) { &#x2F;* ... *&#x2F; } </code></pre> Meanwhile, OCaml from day one:<p><pre><code> if let x = true in let y = true in x || y then ... if let { x; y } = data in x &amp;&amp; y then ...</code></pre>
评论 #27977671 未加载
评论 #27978925 未加载
评论 #27978166 未加载
评论 #27981178 未加载
dangalmost 4 years ago
Past threads related to this book:<p><i>Functional Programming in OCaml</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=22408664" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=22408664</a> - Feb 2020 (58 comments)<p><i>Functional Programming in OCaml</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=22400233" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=22400233</a> - Feb 2020 (1 comment)<p><i>Functional Programming in OCaml</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=19292067" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=19292067</a> - March 2019 (144 comments)
评论 #27978411 未加载
2wristalmost 4 years ago
There is a video playlist by Michael Clarkson which has been released recently too.<p>He is a pretty good communicator!<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;playlist?list=PLre5AT9JnKShBOPeuiD9b-I4XROIJhkIU" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;playlist?list=PLre5AT9JnKShBOPeuiD9b...</a>
babyalmost 4 years ago
I’ve been working on an OCaml by example page. It’s not really ready for prime time but you can at least learn the basics with it and hell, even contribute if you want :)<p><a href="https:&#x2F;&#x2F;o1-labs.github.io&#x2F;ocamlbyexample&#x2F;" rel="nofollow">https:&#x2F;&#x2F;o1-labs.github.io&#x2F;ocamlbyexample&#x2F;</a>
评论 #27977885 未加载
评论 #27976590 未加载
评论 #27977512 未加载
cepheralmost 4 years ago
This book was my introduction to OCaml, and I followed it concurrently with the Nand2Tetris course. Project 6 of Nand2Tetris [1] has you write an assembler for their hack computer, and OCaml seemed like a perfect fit. Chapter 10 of this book introduces you to parsing and lexing, and it was really fun following along while writing the hack assembler.<p>Here&#x27;s an implementation for those interested: <a href="https:&#x2F;&#x2F;github.com&#x2F;senhorsolar&#x2F;hack-assembler" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;senhorsolar&#x2F;hack-assembler</a><p>[1] <a href="https:&#x2F;&#x2F;www.nand2tetris.org&#x2F;project06" rel="nofollow">https:&#x2F;&#x2F;www.nand2tetris.org&#x2F;project06</a>
ttymckalmost 4 years ago
(Inspired by this post,) I gave the official ocaml tutorial a whirl. I quite enjoyed the syntax, and the easy install (of opam).<p>However, I thought I should mention that I got _exactly_ as far as [0] (found while trying to google a solution) before giving up. The REPL is great, but if I can&#x27;t compile easily, it doesn&#x27;t inspire the confidence needed to go any further.<p>[0] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7418543" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7418543</a>
评论 #27980043 未加载
评论 #27981954 未加载
评论 #27985208 未加载
systemsalmost 4 years ago
If you want to learn OCaml, you should probably check <a href="https:&#x2F;&#x2F;dev.realworldocaml.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;dev.realworldocaml.org&#x2F;</a> (free to read online)<p>It is co authored by Yaron Minsky, I think Yaron plays a big role in making OCaml relevant<p>I think OCaml would have been a far less popular language, had Yaron chosen another language for jane street
评论 #27980018 未加载
tyrotoxismalmost 4 years ago
As a veteran of this class, I do believe it helped make me a better programmer. There&#x27;s a noticeable divide in terms of programming confidence&#x2F;flexibility&#x2F;efficiency among the Cornell CS students who do well in this class and enjoy it, and those who fear it or runaway from it. That said, a lot of the benefit came from this course gathering the brightest CS students as TAs. Without having access to those TAs and the challenges they posed in section or office hours, I&#x27;m not sure it has nearly as much value.
评论 #27978469 未加载
flowerladalmost 4 years ago
The intro page says this course is not about OCaml, but then the remaining pages go into detail about the various features of OCaml. The problem with this approach is that when you read about a feature, you don&#x27;t know if it is a OCaml-specific thing or whether it is a general functional programming concept.<p>I would like to see a course or textbook that explains functional programming in the abstract. Instead of going into the details of any one functional language, gives examples of how various functional languages implement the various core ideas of functional programming.<p>So, explain functional programming concepts such as pure functions, referential transparency, functors, monoids, monads, effects, lazy evaluation and so on, not in the context of any specific language, but giving examples from multiple functional languages.<p>In other words, focus on functional programming in general, instead of one specific implementation of it. I have been looking for such a textbook or course, but it doesn&#x27;t exist.
评论 #27976033 未加载
评论 #27981399 未加载
评论 #27975952 未加载
评论 #27975622 未加载
bvrmnalmost 4 years ago
&gt; This course is about making you a better programmer.<p>It is a very bold statement. There is nothing in course about how to fight complexity. Knowledge how to traverse an ADT tree helps a little unfortunately. But it is a great classic CS course though.
评论 #27980068 未加载
评论 #27979792 未加载
评论 #28017633 未加载
评论 #27978237 未加载
zz865almost 4 years ago
This looks great. I&#x27;ll add it to my list of 100 MOOCs I&#x27;d love to do but realistically will never get past the first session.
评论 #27974339 未加载
评论 #27978368 未加载
评论 #27974131 未加载
yawaraminalmost 4 years ago
Duplicate of <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=27966135" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=27966135</a>
评论 #27976525 未加载
ameliusalmost 4 years ago
How is the new OCaml multicore support going? Any benchmarks yet which compare it to e.g. GoLang&#x2F;Java&#x2F;...?
评论 #27977081 未加载
评论 #27978057 未加载
评论 #27981637 未加载
zerralmost 4 years ago
Any experiences teaching kids&#x2F;students programming with FP? Starting with FP that is.
评论 #27977696 未加载
评论 #27980081 未加载
评论 #27981336 未加载
评论 #27978762 未加载
chmaynardalmost 4 years ago
Apparently CS 3110 (Spring 2021) was only offered to students enrolled at Cornell. If true, why is this website of interest to HN readers? Just asking.
评论 #27966776 未加载
Blikkentrekkeralmost 4 years ago
So from what I understand from this the objective is to teach a “vastly different perspective” and thereby improve one&#x27;s programming productivity by idealistically a factor four, by being forced into a new way of thinking?<p>They could have certainly done something more radical than <i>OCaml</i> then such as, say, <i>Idris2</i> which is truly a challenge for those not used to it.