Exhaustive documentation available?

For example, the language tour says about Guards:

Only a limited set of operators can be used in guards, and functions cannot be called at all.

Where is that limited set of operators documented?

Rationale: I’m trying to do this:

case n {
  m if m >= 10 * base -> do_convert(n - 10 * base, roman <> digits.0)
  ...

but the compiler is complaining:

error: Syntax error
   ┌─ src/roman_numerals.gleam:15:20
   │
15 │       m if m >= 10 * base -> do_convert(n - 10 * base, roman <> digits.0)
   │                    ^ I was not expecting this
Expected one of: 
"->"
Hint: Did you mean to wrap a multi line clause in curly braces?
1 Like

ref: glennj's solution for Roman Numerals in Gleam on Exercism

I’ve been struggling with this as well - I’m disappointed to see there hasn’t been a response in 25 d, hopefully this aspect improves with additional time/attention!

(cc @lpil)

I was advised in a mentoring session

the tour is the most complete reference for the language, if you have any questions or ideas on how that could be improved I would highly recommend you join Gleam’s Discord server The Gleam Programming Language, it’s a friendly bunch :)

There’s also the language tour repo: presumably it would be open for PRs

1 Like

It seems expanding guard expressions are in the works.

1 Like

I sort of wouldn’t expect the Gleam team to hang out here :slight_smile: @lpil sometimes does, but I think the right place to push on this is on the Gleam Discord server.

In this specific situation I guess the question is what the limited set of expressions are, and then the action is PRing the docs to fix that. So maybe asking on the Discord server would be the best first step to helping move this forward?

1 Like

Hello! I believe there’s issues for both of these, but no one has picked them up yet.

2 Likes

Absolutely - I don’t mean to imply that someone actually from Gleam should be regularly checking a learning forum!

I just see all of the posted answers to the exercises here, so I have to imagine that there are folks out there that understand a lot more about the language and could weigh in!

The documentation for the standard lib is really great, but I also appreciate learning from novel questions/answers, so hopefully that kind of resource will grow over time (here or elsewhere).

2 Likes

I’ll just add that Gleam is fantastic and the Gleam Discord is super helpful, but as a newbie to both FP and Gleam I am missing some basic language specifications. I’d love to see a companion to the Tour with a bit more information and examples on each of the language features. I’m frequently hitting details that aren’t covered in the Tour and then get stuck.

Thanks to @lpil and everyone who is making Gleam awesome! I really do enjoy the Gleam track, and learning FP ways of solving the problems is a mind-expanding exercise.

Hello! What bits of the language have you found to be missing? Thanks

Hi @lpil, thanks for popping in to this thread.
I’m the originator, and my observation was that “Only a limited set of operators can be used in guards, and functions cannot be called at all.” but the actual list of valid operators isn’t available.

Ah yes, that’s one of the few known issues. Someone picked up that ticket but they never opened a PR. Hopefully it’ll be done soon.

Yes, I was thinking of “guards” in particular, which I didn’t know the term for. I was just looking in the case expressions generally. I’ll revisit that section for sure and keep notes of any other places where I get stuck.