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

In from expression, allow in to assign to pattern #31

Closed
julianhyde opened this issue Apr 22, 2020 · 2 comments
Closed

In from expression, allow in to assign to pattern #31

julianhyde opened this issue Apr 22, 2020 · 2 comments

Comments

@julianhyde
Copy link
Collaborator

Currently, the left-hand side of in must be a variable. We should allow it to be a pattern, to deconstruct rows coming from the right-hand side.

For example, we currently allow

from e in emps yield e.deptno + e.sal

but we should also allow

from {deptno = deptno, sal = sal, ...} in emps yield deptno + sal

and we currently allow

from p in pairs yield let val (left, right) = p in left + right end

but we should also allow

from (left, right) in pairs yield left + right
@julianhyde
Copy link
Collaborator Author

If the pattern contains constant elements then rows that do not match are skipped. For example,

= from (left, 2) in [("a", 2), ("b", 4), ("c", 2)]
-   yield left;
val it = ["a","c"] : string list

@julianhyde
Copy link
Collaborator Author

Fixed in b1f5955.

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