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
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:
from (x, y) suchthat exists (
from z suchthat isEdge(x, z) andalso isEdge(z, y));
Using the in paradigm you generate two temporary variables z and z2 that need to be eliminated using group x, y:
from (x, z) in edges,
(z2, y) in edges
where z = z2
group x, y;
Leveraging #184 this becomes slightly more concise but you still need a group to eliminate z:
from (x, z) in edges,
(same z, y) in edges
group x, y;
We propose a variant of exists:
from (x, y) exists z suchthat isEdge(x, z) andalso isEdge(z, y);
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:
is_step2 (X, Y) :- is_edge(X, Z), is_edge(Z, Y).
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.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: