I haven't tried Gleam yet, though. I'm interested in the focus on simplicity but a little wary because I understand they sacrificed niceties to minimize the language footprint, e.g., pattern matching in function heads. I intend to give it a shot the next time I'm greenfielding something.
Edit: pure* functional
Odd, but I believe you, lol. Elixir's list comprehensions take a `:reduce` option which makes accumulating values a bit more "familiar" and I often use over `reduce`:
for a <- list, reduce: []
acc ->
[a | acc]
end
Not sure if there is something like that in Erlang (or Gleam for that matter).Also tbh, I don't like reduce either. I agree with that article posted on HN a while back about devs not liking reduce. Just want to insert into my list or whatever, not have to check how exactly reduce works in this particular language.
Ya, I was saying as an alternative to a more dynamic-looking loop. And of course, `for` is confusing in Elixir it is not a for loop, it's a list comprehension and `<-` is actually a match operator.
But yes, I don't hate reduce, but I do try and avoid it for a higher level version for what I'm doing. My only real problem with reduce is that I sometimes forget the parameter order, which is why I like using list comprehensions since the accumulator gets labelled.
https://gleam.run/frequently-asked-questions/#How-does-Gleam...
> I'd say if you know and like Rust, then Gleam should be easy to pick up
And you think that:
> a Rust programmer is more likely to prefer Gleam to Elixir
Are we maybe splitting hairs here?
This is way too strong and narrow statement. Gleam is statically typed garbage collected language, closer to OCaml than Rust. Elixir if you like dynamically typed instead.
The languages that Gleam is most like might be Standard ML, OCaml, Elm, and F#.
That is: they aren't similar languages on a technical level, but if you know Rust, you should be able to make the jump to Gleam pretty quickly.
It can take a moment to understand that things are done quite differently in the two languages due to being so different: https://gleam.run/frequently-asked-questions/#How-does-Gleam...
And guess which languages inspired several things in Rust.
I think by sentiments like this, people mean if you know unions, records, and pattern matching then you'll more easily pick up another language that has unions, records, and pattern matching.