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