Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow lambda (fn) to have multiple branches, similar to case #230

Closed
julianhyde opened this issue Nov 18, 2024 · 0 comments
Closed

Allow lambda (fn) to have multiple branches, similar to case #230

julianhyde opened this issue Nov 18, 2024 · 0 comments

Comments

@julianhyde
Copy link
Collaborator

Standard ML allows a lambda to have multiple branches, similar to case. Thus the following are equivalent

fn [] => 0 | x ::_ => x + 1;
fn list => case list of [] => 0 | x :: _ => x + 1;

but the second currently throws

Encountered " "|" "| "" at line 3, column 12.
Was expecting one of:
    <EOF> 
    "andalso" ...

There are more examples in https://smlhelp.github.io/book/docs/start/syntax/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant