TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: What functional programming language should I learn?

2 点作者 xfax超过 8 年前
I&#x27;ve dabbled in functional programming languages over the years but never got around to getting good at any one of them. I want to change that this year and build up some expertise. The question is, what language should I pick?<p>Here&#x27;s what I have dabbled in in the past -<p>* Haskell * OCaml * Clojure * F# * Elixir * Scala<p>What would you recommend? I want to be able to build simple CLI programs as well as use it for web application development (for hobby projects).

6 条评论

brudgers超过 8 年前
I tend to think of functional Programming as an idiom. Sure some languages make it <i>harder</i> and some make location based programming nearly impossible...except that once you&#x27;re on the web making remote calls to REST API&#x27;s even the most functional friendly languages can&#x27;t do better than a saying the value is the warning-warning-could-be-anything-type...which means that from a functional perspective a function that calls a REST API always returns the same value regardless of input parameters or it&#x27;s not a function.<p>And that&#x27;s ok by me. Because the idiom of functional programming is a gestalt of figure <i>and</i> ground. The ground is knowing when to <i>explicitly</i> use place based methods -- Under the hood, so long as we have computers based on the Von Neumann architecture everything we do ultimately gets distilled into place based computing that mutates values. Functional programming is just a way of abstracting over that when it is productive to do so.<p>Functional programming, like object oriented programming, is a set of clever abstractions not magic. There aren&#x27;t functional programming computers (or object oriented computers) that are different from imperative mutating machines.<p>Anyway, I guess the point is that functional programming shares quite a bit with test driven development. It&#x27;s more a matter of programmer behavior than language. And thus my advice is to start writing functional code in whatever language is at hand: functional programmers who use PHP write functional code in PHP.<p>Of course it&#x27;s always fun to play with a new language which is orthogonal.<p>Good luck.
pmarreck超过 8 年前
Elixir is fantastic to work with and has a bright future (its conference attendance has doubled every year), although its libraries (as impressive as they are) might not be as mature as some of the older functional langs. The tooling is fantastic, though
yawaramin大约 8 年前
Are you a relative newbie at functional programming? Do you have about a month? Then I highly recommend Prof. Dan Grossman&#x27;s free online course: <a href="https:&#x2F;&#x2F;www.coursera.org&#x2F;learn&#x2F;programming-languages&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.coursera.org&#x2F;learn&#x2F;programming-languages&#x2F;</a><p>He teaches the syntax, semantics, and idioms of ML-style typed functional programming using the Standard ML language as a teaching vehicle. His explanations and course progression are really good. It will open your eyes to FP.
kirankn超过 8 年前
Elixir&#x2F;Phoenix &amp; Elm
nlander超过 8 年前
I strongly recommend that you learn Haskell.<p>I have some reasons to back up my endorsement of Haskell.<p>First and foremost, Haskell is the best language to learn if you want to learn about functional programming. Why? Because Haskell is the quintessential functional programming language. It is approaching 30 years of age and was originally developed back when functional programming was nowhere to be found in production settings. A bunch of academics who were all working on separate functional programming languages got together and said, “hey, how about we all work together and make the ultimate FP language rather than reinventing the wheel on our own?” And that’s exactly what they did. The result today is a very mature, feature rich and programmer-friendly language. If you really want to delve into the history of Haskell, check out this paper or watch the video based on it:<p><a href="https:&#x2F;&#x2F;www.microsoft.com&#x2F;en-us&#x2F;research&#x2F;publication&#x2F;a-history-of-haskell-being-lazy-with-class&#x2F;?from=http%3A%2F%2Fresearch.microsoft.com%2Fen-us%2Fum%2Fpeople%2Fsimonpj%2Fpapers%2Fhistory-of-haskell%2F" rel="nofollow">https:&#x2F;&#x2F;www.microsoft.com&#x2F;en-us&#x2F;research&#x2F;publication&#x2F;a-histo...</a><p>The second reason to learn Haskell is that it is a great language for doing the things you want to do. A prominent Haskeller, Gabriel Gonzalez, estimates that Haskell is mature in the domain of server-side web development. Check out his view on the state of the Haskell ecosystem:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Gabriel439&#x2F;post-rfc&#x2F;blob&#x2F;master&#x2F;sotu.md#server-side-programming" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Gabriel439&#x2F;post-rfc&#x2F;blob&#x2F;master&#x2F;sotu.md#s...</a><p>Writing CLI programs is also rated mature in the same article:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Gabriel439&#x2F;post-rfc&#x2F;blob&#x2F;master&#x2F;sotu.md#scripting--command-line-applications" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Gabriel439&#x2F;post-rfc&#x2F;blob&#x2F;master&#x2F;sotu.md#s...</a><p>If you want to do front end web programming, I highly recommend checking out PureScript:<p><a href="https:&#x2F;&#x2F;leanpub.com&#x2F;purescript&#x2F;read" rel="nofollow">https:&#x2F;&#x2F;leanpub.com&#x2F;purescript&#x2F;read</a><p>This might be an even better starting point for you if your background is in JavaScript (you don’t mention which languages you have experience with).<p>The third reason you should choose Haskell is that there are some great educational resources out there. Most notable among them is this book:<p>Haskell Programming from First Principles: <a href="http:&#x2F;&#x2F;haskellbook.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;haskellbook.com&#x2F;</a> This book is the most thorough, pedagogically sound, and practical book out there. It is what you should read if you have any interest in ever using Haskell in production.<p>For excellent exercises, check out Programming in Haskell: <a href="http:&#x2F;&#x2F;www.cs.nott.ac.uk&#x2F;~pszgmh&#x2F;pih.html" rel="nofollow">http:&#x2F;&#x2F;www.cs.nott.ac.uk&#x2F;~pszgmh&#x2F;pih.html</a><p>For something free but somewhat problematic (the author will call you fat) and not very in depth, check out Learn You a Haskell for Great Good: <a href="http:&#x2F;&#x2F;learnyouahaskell.com" rel="nofollow">http:&#x2F;&#x2F;learnyouahaskell.com</a><p>For blog posts that will expose you to some of the many libraries in the Haskell ecosystem, or some of the language extensions that are heavily used in production Haskell, check out the 24 Days of Hackage series: <a href="https:&#x2F;&#x2F;ocharles.org.uk&#x2F;blog&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ocharles.org.uk&#x2F;blog&#x2F;</a> <a href="http:&#x2F;&#x2F;conscientiousprogrammer.com&#x2F;blog&#x2F;2015&#x2F;11&#x2F;30&#x2F;haskell-tidbits-24-days-of-hackage-2015-day-1-introduction-and-stack&#x2F;" rel="nofollow">http:&#x2F;&#x2F;conscientiousprogrammer.com&#x2F;blog&#x2F;2015&#x2F;11&#x2F;30&#x2F;haskell-t...</a><p>The fourth reason you should learn Haskell is that the compiler makes everything easier. You don’t have to be super smart to program in Haskell because the compiler is smart for you. It will catch most of your mistakes and prevent so many errors. This could be an argument for many statically typed languages, but the fact is that Haskell has the most expressive type system of any language used in production.<p>The fifth reason you should learn Haskell is that it has a great tool for managing dependencies: <a href="https:&#x2F;&#x2F;docs.haskellstack.org&#x2F;en&#x2F;stable&#x2F;README&#x2F;" rel="nofollow">https:&#x2F;&#x2F;docs.haskellstack.org&#x2F;en&#x2F;stable&#x2F;README&#x2F;</a> This tool and other work done by the company FP Complete (<a href="https:&#x2F;&#x2F;www.fpcomplete.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.fpcomplete.com&#x2F;</a>) are the main reasons that Haskell is a great option for production applications and not just a research language like it used to be.<p>I hope this has convinced you. I love programming in Haskell and I am having a blast learning it. There is so much to learn about functional programming and I would still consider myself an advanced beginner, or maybe just barely intermediate. I hope you have as much fun learning Haskell as I have and continue to. Cheers and best of luck!<p><i>Disclaimer</i> Haskell is the first and only language that I have used in any kind of professional context, and I cannot even claim to be a beginner in any of the other languages you mentioned. I have recently begun coding in PureScript, but that’s basically the same language.
Learn2win超过 8 年前
Haskell has very mature libraries to build web and CLI programs.