
Ask HN: How to learn Functional programming using a small language? - philonoist
I have a strong preference to SML&#x2F;family than LISP&#x2F;family or others.<p>Haskell, Scala, Ocaml, F# and the likes are big and take intimidatingly long time to get a grip over functional way of thinking. I need a small language to make me dive into functional paradigm and concepts as deeply as possible, which rivals maybe even Haskell&#x27;s depth.<p>My method of learning requires a resource that provides solving huge number of problems that take a considerably good load on cognitive and mathematical abstractions( like math theories, algorithms and puzzles) as against building something in applied sense. I am opposed to &quot;hit the ground real world with practical projects&quot; as a way of learning for now.<p>I have strong preference to expressively statically typed compiled languages and a resource that forces me to think functionally. I have dabbled Python and C only superficially. I will return to them after I am comfortable with functional paradigm.<p>Does any of this mean I have to avoid languages that compile to Javascript? If not, I am open to them as well.<p>I am frustrated and helpless to come to terms with the fact that many universities can get to teach Standard ML through all helpful resources like gotchas, problem sets, and assignments along with solutions discussed in class at mere introductory year of the curriculum, but none of them being available outside of it online readily if not for free. No MOOCs by them as well.<p>It would be helpful if the language has enough presence in terms of tooling, documentation and discussion online so that I would be able to progress easily if at all I am stuck anywhere.<p>All I need is a good resource and please guide me if my approach of problem solving or anything else for being functionally proficient is wrong.
======
rs86
I don't think those kinds of exercises will teach you about functional
programming... Here's why. You can understand imperative programming as a
sequence of operations. But functional programming is more like a composition
of transformations. It really requires study because you need to think
differently.

I would suggest rewriting the standard library of a functional language....
Read the standard functions on lists, maps, tuples, folds, maps, and
reimplement them...

------
galfarragem
Elm.

I'm more or less in the same position as you and that's my conclusion. Haskell
is a behemoth, Purescript is still intimidating. F# and Scala, I don't want to
mess up with .Net or JVM. Clojure and Elixir are interesting but don't have a
rich type system. Elm is the one that seems to remain. Maybe Reason also.

[https://elm-lang.org/](https://elm-lang.org/)

------
krat0sprakhar
If you know Python, you might like coconut [http://coconut-
lang.org/](http://coconut-lang.org/)

> Coconut is a functional programming language that compiles to Python. Since
> all valid Python is valid Coconut, using Coconut will only extend and
> enhance what you're already capable of in Python.

Why use Coconut? Coconut is built to be useful. Coconut enhances the
repertoire of Python programmers to include the tools of modern functional
programming, in such a way that those tools are easy to use and immensely
powerful; that is, Coconut does to functional programming what Python did to
imperative programming. And Coconut code runs the same on any Python version,
making the Python 2/3 split a thing of the past.

------
nikonyrh
I would strongly recommend Clojure, which is dynamically but strongly typed
LISP on JVM. The best part is the REPL, which is only true if you use a well-
tuned IDE. Personally I still use NightCode but there are many others out
there.

For me the biggest selling points were immutable data structures by default,
nice core library (reduce, reductions, iterate, map with multiple arguments,
...) and super simple syntax. Being a LISP after all.

And to extend to the client side you can turn onto ClojureScript, which is
almost the same language which compiles to JS instead of JVM bytecode.

------
agbell
Haskell 98 is a quite small language and most learn Haskell resources focus on
Haskell 98 and not on various extensions to the language.

------
kazinator
Why do you have strong preferences about type systems if you've only dabbled
in Python and C.

