I like Gleam, but I am somewhat annoyed by the fact, that I don't have the full functional freedom in calling recursive (inner) functions wherever I want. I don't know, why new functional languages do not get this right all the way, straight from some rnrs document or implementation. Another thing is the separate operators like .> and . To me it felt less elegant than Scheme (GNU Guile) which I usually use (with nice…
I tried Gleam for Advent of Code
141–150 of 223 posts
Re: I tried Gleam for Advent of Code
#142I don’t know gleam, but surely list.map(fn(line) { line |> calculate_instruction }) Could be written list.map(calculate_instruction) ?
You're right, but loads of times I just left that there because I probably did something more involved in the map that I ended up deleting later without realising.
Re: I tried Gleam for Advent of Code
#143Gleam is a beautiful language, and what I wish Elixir would become (re:typing). For those that don't know its also built upon OTP, the erlang vm that makes concurrency and queues a trivial problem in my opinion. Absolutely wonderful ecosystem. I've been wanting to make Gleam my primary language, but I fear LLMs have frozen programming language advancement and adoption for anything past 2021. But I am hopeful that Gle…
Re: I tried Gleam for Advent of Code
#144Gleam is a beautiful language, and what I wish Elixir would become (re:typing). For those that don't know its also built upon OTP, the erlang vm that makes concurrency and queues a trivial problem in my opinion. Absolutely wonderful ecosystem. I've been wanting to make Gleam my primary language, but I fear LLMs have frozen programming language advancement and adoption for anything past 2021. But I am hopeful that Gle…
Elixir is slowly rolling out set-theoretic typing: https://hexdocs.pm/elixir/main/gradual-set-theoretic-types.h...
Re: I tried Gleam for Advent of Code
#145Earlier quoted context omitted.
There's a flywheel where programmers choose languages that LLMs already understand, but LLMs can only learn languages that programmers write a sufficient amount of code in. Because LLMs make it that much faster to develop software, any potential advantage you may get from adopting a very niche language is overshadowed by the fact that you can't use it with an LLM. This makes it that much harder for your new language…
I don't think this is actually true. LLMs have an impressive amount of ability to do knowledge-transfer between domains, it only makes sense that that would also apply to programming languages, since the basic underlying concepts (functions, data structures, etc.) exist nearly everywhere. If this does appear to become a problem, is it not hard to apply the same RLHF infrastructure that's used to get LLMs effective at…
That would make sense if LLMs understood the domains and the concepts. They don't. They need a lot of training data to "map" the "knowledge transfer".
Personal anecdote: Claude stopped writing Java-like Elixir only some time around summer this year (Elixir is 13 years old), and is still incapable of writing "modern HEEX" which changed some of the templaring syntax in Phoenix almost two years ago.
Re: I tried Gleam for Advent of Code
#146Earlier quoted context omitted.
Gleam has first class functions, so it has dynamic dispatch. Both of type classes and interfaces desugar to high order functions, so anything you write with them can be written with first class functions, though with a less concise API.
What you are saying is: no, it doesn't. Of course dynamic dispatch can be implemented in almost every language. The Linux kernel uses dynamic dispatch with C! But that's a hack, not a language feature.
PHP has interfaces and whatnot, but a lot of the time I do polymorphism by just having a class that has Closure members. When you can arbitrarily pass around functions like that, it's basically equivalent to an interface or abstract class, with a bit more flexibility.
Re: I tried Gleam for Advent of Code
#147Gleam is a great language. It didn't click for me when I was trying it out, but I'm glad to see more people enjoying it. And I wonder if Gleam + Lustre could become the new Elm.
I'm hoping it succeeds and gets bigger because I really like its ergonomics.
Re: I tried Gleam for Advent of Code
#148Earlier quoted context omitted.
That’s the worse is better philosophy which maybe doesn’t matter as much anymore especially with AI
What do you mean?
Codegen is more and more rare these days, because languages have so many tools to help you write less code - like generics. LLMs could, theoretically, help you crank out similar repetitive implementations of things.
Re: I tried Gleam for Advent of Code
#149Earlier quoted context omitted.
The answer I’ve seen is “just pass structs of functions around”, which is just one step more explicit than the implicit version we’re all use to, but honestly I kinda like it to free ourselves of all the ceremony around generics.
It’s discouraged to pass around structs of functions to replicate type classes in Gleam. Instead the preference is to not type class style patterns in your projects, favouring a concrete style instead.
Re: I tried Gleam for Advent of Code
#150Earlier quoted context omitted.
Hi, I’m the creator of Gleam! The comment you are replying to is correct, and you are incorrect. All OTP APIs are usable as normal within Gleam, the language is designed with it in mind, and there’s an additional set of Gleam specific additions to OTP (which you have linked there). Gleam does not have access to only a subset of OTP, and it does not have its own distinct OTP inspired OTP. It uses the OTP framework.
> Hi, I’m the creator of Gleam! What's the state of Gleam's JSON parsing / serialization capabilities right now? I find it to be a lovely little language, but having to essentially write every type three times (once for the type definition, once for the serializer, once for the deserializer) isn't something I'm looking forward to. A functional language that can run both on the backend (Beam) and frontend (JS) lets on…