Open julianhyde opened 1 year ago
The follow is more concise. Is it better?
from (x, y, exists z) suchthat isEdge(x, z) andalso isEdge(z, y);
Following #202, the syntax would be
from x, y, z
where isEdge (x, y) andalso isEdge (z, y)
That seems better. No exists
keyword necessary.
In
suchthat
expressions you often need to declare a variable in an "exists". But it can be a little verbose. Suppose you have a list of edges and a function:To compute a list of nodes that are two steps apart, you could write:
Using the
in
paradigm you generate two temporary variablesz
andz2
that need to be eliminated usinggroup x, y
:Leveraging #184 this becomes slightly more concise but you still need a
group
to eliminatez
:We propose a variant of
exists
:In Datalog, any variable that does not appear on the left-side of the rule becomes an "exists variable", for example
Z
in the following:Morel cannot compete with Datalog's terseness. Morel is a typed language, and that means that its variables need to be declared, in a pattern, at exactly one point, so that their type can be specified. (Usually the type is inferred, but that point needs to exist.) The
exists variable suchthat
sugar seems to be about as terse as we can get.