Commit 9611c9cb authored by Pietro Abate's avatar Pietro Abate

[r2005-06-09 22:32:55 by beppe] explained select

Original author: beppe
Date: 2005-06-09 22:32:55+00:00
parent 3f3991c5
......@@ -838,8 +838,24 @@ a boolean expression, the <code>%%pi%%</code>'s are patterns, and the
<code>%%ei%%</code>'s are sequence expressions.
</p>
<p>
It works exactly as a standard SQL select expression, with the difference that relations (that is sequences of tuples) after the <code>in</code> keyword can here be generic sequences, and before the <code>in</code> generic patterns instead of just capture variables can be used. So the result is the sequence of all values obtained by calculating <code>%%e%%</code> in the sequence of environments in which the free variables of <code>%%e%%</code> are bounded by iteratively matching each pattern <code>%%pi%%</code> with every element of the sequence <code>%%ei%%</code>, provided that the condition <code>%%c%%</code> is satisfied.
In other words, the first element of the result is obtained by calculating <code>%%e%%</code> in the environment obtained by matching <code>%%p1%%</code> against the first element of <code>%%e1%%</code>, <code>%%p2%%</code> against the first element of <code>%%e2%%</code>, ...; the second element of the result is obtained by calculating <code>%%e%%</code> in the environment obtained by matching <code>%%p1%%</code> against the <i>second</i> element of <code>%%e1%%</code>, <code>%%p2%%</code> against the <i>first</i> element of <code>%%e2%%</code>,...; and so on.
It works exactly as a standard SQL select expression, with the difference that
relations (that is sequences of tuples) after the <code>in</code> keyword can
here be generic sequences, and before the <code>in</code> generic patterns
instead of just capture variables can be used. So the result is the sequence of
all values obtained by calculating <code>%%e%%</code> in the sequence of
environments in which the free variables of <code>%%e%%</code> are bounded by
iteratively matching each pattern <code>%%pi%%</code> with every element of the
sequence <code>%%ei%%</code>, provided that the condition <code>%%c%%</code> is
satisfied. In other words, the first element of the result is obtained by
calculating <code>%%e%%</code> in the environment obtained by matching
<code>%%p1%%</code> against the first element of <code>%%e1%%</code>,
<code>%%p2%%</code> against the first element of <code>%%e2%%</code>, ... , and
<code>%%pn%%</code> against the first element of <code>%%en%%</code>; the
second element of the result is obtained by calculating <code>%%e%%</code> in
the environment obtained by matching <code>%%p1%%</code> against the first
element of <code>%%e1%%</code>, <code>%%p2%%</code> against the first element of
<code>%%e2%%</code>, ..., and <code>%%pn%%</code> against the <i>second</i>
element of <code>%%en%%</code>, ... ; and so on.
</p>
<p>
Formally, the semantics of the select expression above is defined as:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment