r/functionalprogramming • u/Voxelman • Sep 30 '23
Question Is Gleam a good beginner language?
I'm not a fan of Python or JavaScript as good languages for beginners. I think both languages teach you bad programming habits (unless the tutorials avoid pitfalls like inheritance, global variables, etc., which most don't).
In my opinion, beginners should start with a functional programming language these days. Mainly because concepts like immutability and pure functions are becoming more and more important, and it's easier to learn these concepts in a language that really supports them by default.
Moreover, functional concepts are creeping more and more into almost every mainstream language.
So why not learn a functional programming language first?
The only question is: which language? Haskell is great, but in my opinion too complicated for beginners. Elm is much better, but limited to web frontends.
In my opinion, Gleam is a good mix of both. It's simple like Elm and has a similar friendly compiler, but it can run simple programs at the terminal and you don't have to learn HTML at the same time.
By the way, the second language someone should learn is C to learn the imperative side of paradigms and how computers work.
What do you guys think about this?
Edit: this is to learn programming and actual concepts, not to learn a specific language to get a job!
Maybe another addition: my main point is, that (at least one of) the first programming language nowadays should be a (pure) functional language to learn modern concepts (that are popping up in any Mainstream language) before your brain gets trashed with bad imperative and OOP habits.
15
u/editor_of_the_beast Sep 30 '23
I would use a more popular and more mature language first. Because it will have more documentation and more searchable articles when you get stuck.
7
u/Migeil Sep 30 '23
Why do you feel like Haskell is too difficult for beginners? Haskell can be intimidating for sure, but there are plenty of resources available to learn Haskell as a complete beginner.
Those don't go into all the advanced stuff, but stick to the basics.
This + the fact that the folks over at r/haskell are super friendly and helpful, means you get a great experience as a beginner in my opinion.
2
u/Important_Ad_9453 Sep 30 '23
Racket(scheme) is designed as a teaching language and embraces functional programming. Its pretty mature and is used in some CS programs. Though I second others opinions that the key thing is adoption and support.
I also think that “learning a programming language” should not be the goal for beginners. The goal should be to learn how to build useful solutions with software. I find that lots of people(even recent CS graduates) struggle with that.
2
u/GunpowderGuy Oct 09 '23
I am learning idris2 as my first functional language. It's More powerful than haskell in Many ways but lacks it heavy technical debts so i say it's More beginner friendly
12
u/mnbkp Sep 30 '23
I'd go with ocaml or F#, really. F# is probably the easiest way to introduce yourself to this kind of language, the only downside is that you'd be missing out on functors.
But really, there's nothing stopping you from starting with F# and then moving to ocaml as they are both very similar.
7
u/everything-narrative Sep 30 '23
F#
It's basically the .NET runtime, but with OCaml/SML syntax.
6
u/jmhimara Sep 30 '23
A lot of schools teach Scheme, or more specifically Racket. Excellent language for teaching, in fact it was primarily designed for that purpose.
3
u/nilsecc Sep 30 '23
Standard ML or OCaml. I think do a good job of teaching FP along with some other stuff.
(Gleam isn’t 1.0 yet.) other wise the functional semantics are there.
Rescript also might be a good candidate if you want to teach those functional semantics but have something that looks javascript-ish.
3
u/Flyyster Oct 01 '23
F# is very legit for beginners! But after you've learned a bit I would recommend Elixir or Scala as they more established in the industry.
1
u/Sacharon123 Sep 30 '23
I understand your intentions. However for a beginner, I would still recommend to start with a non-functional language like C++ to learn basics about typing, expressions, and can play around initially. The change to functional languages will come later automatically if the developer wants to learn better paradigms. But functional languages as entry work only for math-fascinated people in my opinion, which due to bad teaching in schools are far and few...
1
u/snarkuzoid Sep 30 '23
I can't comment about Gleam, but I really think that learning C is a waste of time and effort. If you want to learn procedural paradigm, use Go or something like that.
2
u/effinsky Sep 30 '23
definitely a more mature, stable language :)
1
u/BosonCollider Mar 12 '24
If this is in the context of a structured curriculum where you have tasks for them to do, then gleam is an acceptable option imo. It's a decent functional language to introduce many basic concepts in, and seems to have good compiler error messages.
If you don't have the constraint that they should learn a functional language first, then Go is fairly good imo, it's has a reasonably nice mix of small explicit language + good tooling + no OO baggage + large community, and the things a newbie would learn from it are complementary to what they would learn in Gleam. The Go type system is a mess but imperative programming with extensive use of functions & closures is a decent place to start.
1
u/dave_mays May 10 '24
I'm looking into it as well. It's interesting Gleam already has more starts on Github than F#, which is actually pretty crazy considering how long F# has been around.
-2
u/[deleted] Oct 02 '23
no