Zulip Chat Archive

Stream: new members

Topic: unable to create new function


abaaba (Oct 21 2021 at 23:22):

have test: ℕ -> ℝ := λ(x:ℕ) ((1 / (x + 1)):ℝ), fails with invalid binder, identifier expected

Bryan Gin-ge Chen (Oct 21 2021 at 23:23):

You want something more like:

have test:  ->  := λ(x:), ((1 / (x + 1)):),

Note the extra comma.

abaaba (Oct 21 2021 at 23:24):

thanks! btw can I write in def grammar, where parameters appear at left hand side of equal sign?

Bryan Gin-ge Chen (Oct 21 2021 at 23:24):

You probably want to use let rather than have with this though. have will forget the definition and only keep the type.

Bryan Gin-ge Chen (Oct 21 2021 at 23:25):

Sorry, I don't know what you mean by "def grammar".

Eric Wieser (Oct 21 2021 at 23:30):

I think that's a request for:

have test (n : ) :  := ((1 / (x + 1)):),

to be valid syntax, which I agree is appealing

Mario Carneiro (Oct 21 2021 at 23:32):

let already supports it in term mode

Eric Wieser (Oct 21 2021 at 23:44):

I had no idea


Last updated: Dec 20 2023 at 11:08 UTC