You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the from expression starts with several "scan" expressions of the form "id in list" or "id = list", separated by commas, and then a sequence of clauses including "join", "where", "group", "yield". "join" means pretty much the same as ",".
The following is currently illegal:
from x in list1 where x.a > 10,
y in list2
yield {x, y}
With this feature it would be legal. It is convenient to be able to add a where after a scan (x in list1) and to still be able to follow it with a comma and another scan (, y in list2).
The following is equivalent and is already legal:
from x in list1
where x.a > 10
join y in list2
yield {x, y}
As is the following:
from x in (from z in list1 where z.a > 10),
y in list2
yield {x, y}
But we cannot just enable the comma. The group and order clauses allow commas, and comma as the start of a clause would be ambiguous, as the following illustrate. Group:
from x in list1
group x.a, x.b,
y in list2
yield {x, y}
Group compute:
from x in list1
group x.a, x.b compute sum(x.c), sum(x.d),
y in list2
yield {x. y}
Order:
from x in list1
order x.a desc, x.b,
y in list2
yield {x, y}
To disambiguate, one option is to add parentheses to group and order syntax when there is more than one key/expression. Here are some examples with the new syntax:
group x.a
group (x.a, x.b)
group x.a compute (sum(x.c), sum(x.d))
order x.a desc
order (x.a desc, x.b)
Note that composite yield already requires parentheses.
The text was updated successfully, but these errors were encountered:
Currently the
from
expression starts with several "scan" expressions of the form "id in list" or "id = list", separated by commas, and then a sequence of clauses including "join", "where", "group", "yield". "join" means pretty much the same as ",".The following is currently illegal:
With this feature it would be legal. It is convenient to be able to add a
where
after a scan (x in list1
) and to still be able to follow it with a comma and another scan (, y in list2
).The following is equivalent and is already legal:
As is the following:
But we cannot just enable the comma. The
group
andorder
clauses allow commas, and comma as the start of a clause would be ambiguous, as the following illustrate. Group:Group compute:
Order:
To disambiguate, one option is to add parentheses to
group
andorder
syntax when there is more than one key/expression. Here are some examples with the new syntax:group x.a
group (x.a, x.b)
group x.a compute (sum(x.c), sum(x.d))
order x.a desc
order (x.a desc, x.b)
Note that composite
yield
already requires parentheses.The text was updated successfully, but these errors were encountered: