where <code>%%p%%</code> is a pattern and <code>%%e%%</code>,
<code>%%e'%%</code> are expressions.
</p>
<note>
A small aside about the examples in this tutorial and their usage. The
first program that prints "Hello word" can be tried directly on the on-line
prototype: just select and copy it, click on the link to the on-line
interpreter in the side bar, paste it in the execution window and run it. The
second example instead cannot be run. This is visually signaled by the fact
that it contains text in italics. We use italics for meta notation, so
<code>%%e%%</code> and <code>%%e'%%</code> stand for generic expression, so it is useless to run
this could (you would just obtain an error signaling that <code>e</code> is
not bound or that the quote in <code>e'</code> is not closed). This is true also in general in what follows: code without
italicized text can be copy and pasted in the on-line prototype as they are
(sometime just after having pasted the declaration of the types they use);
this is not possible when the code contains italicized text.
</note>
<p>
Patterns are much more than simple variables. They can be used to decompose
values. For instance, if the words <tt>Hello</tt> and <tt>world</tt> are in the two elements of a pair, we can capture each of them and concatenate them as follows:
...
...
@@ -101,7 +115,7 @@ The form <code>let x&%%t%% = %%e%% in %%e'%%</code> is used so often that we
<sample><![CDATA[
let x : %%t%% = %%e%% in %%e'%%
]]></sample>
Note the blank spaces around the colon: this is because the XML recommendation allows colons to occur in identifiers (see the section on <ahref="namespaces.html">namespaces</a>).
</box>
<boxtitle="XML documents"link="xml">
...
...
@@ -222,7 +236,7 @@ usually allows earlier detection of type errors.
</p>
<p>
If the file XML on the left hand-side is stored in a file, say,
<tt>parents.xml</tt> then it can be loaded from the file by <code>{{load_xml}}
<tt>parents.xml</tt> then it can be loaded from the file by <code>%%load_xml%%
"parents.xml"</code> as the builtin function <code>load_xml</code> converts and
XML document stored in a file into the CDuce expression representing it. However
<code>load_xml</code> has type <code>String->Any</code>, where