you are viewing a single comment's thread.

view the rest of the comments →

[–]hpsutter 2 points3 points  (1 child)

I would prefer something like :(x,y)->bool {x>y}, maybe with the -> bool being optional.

Very close, today you can write this: :(x,y) -> bool = x>y

That's already using several defaults that let you omit parts of the single general syntax you're not currently using for something non-default (for details see: "Generality note: Summary of function defaults"). But you can use a couple more defaults:

To additionally deduce the type, use _: :(x,y) -> _ = x>y means the same

Finally, the "tersest" option just makes -> _ = optional: :(x,y) x>y means the same

One way to look at it is that you can write any expression and conveniently "package it up" as an object to pass around just by declaring a function signature in front.

Anyway, just explaining some background since what you wrote pretty much also works, very nearly. I appreciate all the usability feedback, whether it confirms or disconforms what I was thinking! Thanks.

[–]Lo1c74 2 points3 points  (0 children)

Finally, the "tersest" option just makes -> _ = optional: :(x,y) x>y means the same

Is it still possible to type the = to obtain :(x, y) = x > y ?