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
Note the similarity with the 'let' clause in XQuery ('let' is the 'L' in 'FLWOR'). Here is example 6-6 in XQuery by Priscilla Walmsley:
let $doc := doc("catalog.xml")
for $prod in $doc//product
let $prodDept := $prod/@dept
let $prodName := $prod/name
where $prodDept = "ACC" or $prodDept = "WMN"
return $prodName
In Morel, I think it makes sense to intermingle 'in' and '=' in the same from expression. In XQuery if you want a for followed by a let followed by a for you have to create a new query (for), which if nothing else increases the indentation.
In 'from' clause, allow 'variable = value'. For example,
It is syntactic sugar for iterating over a singleton collection:
But I think the syntax may be useful for users.
In this case you could rewrite to a
let
:But this would not be possible if
fullName
were used in a laterin
or awhere
clause.Further, now that #62 has implement the function only: α list → α (which throws if the list is empty or has more than one element), we can write
This is important in asserting that a sub-query returns precisely one row. The same effect as a scalar sub-query in SQL:
(SQL is a little more limited, because you are only allowed to return 1 column.)
The text was updated successfully, but these errors were encountered: