Zulip Chat Archive

Stream: lean4

Topic: pattern in def arguments


James Gallicchio (Feb 23 2023 at 19:28):

has there been any discussion about allowing (total) patterns in def argument lists? It is some nice syntax sugar, but low priority and I suspect not straightforward to implement

Tomas Skrivan (Feb 23 2023 at 19:59):

Do you mean something like this?

def add  := λ ((x,y) : Nat×Nat) => x + y -- this work

def add' ((x,y) : Nat×Nat) := x + y      -- this does not

James Gallicchio (Feb 23 2023 at 20:00):

or better yet, ((x : Nat), (y : Nat)) since that is also a valid pattern

Tomas Skrivan (Feb 23 2023 at 20:01):

Oh yeah that would be great! But I'm not aware of anything in this direction.

James Gallicchio (Feb 23 2023 at 20:02):

another common one would be being able to write () instead of (_ : Unit), which is getting a bit annoying to me :joy:


Last updated: Dec 20 2023 at 11:08 UTC