Commit b330f1fb authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-01-31 01:46:46 by beppe] Empty log message

Original author: beppe
Date: 2004-01-31 01:46:46+00:00
parent e14ae5f4
include Makefile.conf
VERSION = 0.2.0-pre3
VERSION = 0.2.0-pre4
PACKAGES = pxp-engine pxp-lex-iso88591 ulex camlp4 num cgi pcre netstring
ifeq ($(PXP_WLEX), true)
......
......@@ -54,6 +54,13 @@ img.icon {
border: 0;
}
div.note {
font: bold helvetica;
margin: 3ex 3em 3ex 3em;
padding: 1ex 1em 1ex 1em;
background: #EFFFFF;
}
div.abstract {
font: bold 80% helvetica;
margin: 1ex 1em 1ex 1em;
......
......@@ -46,6 +46,7 @@ type Content =
| <site-toc>[]
| <local-links href=String>[]
| <two-columns>[ <left>Content <right>Content ]
| <note> Content
| InlineText
)* ]
......@@ -188,12 +189,23 @@ div.code {
margin: 0.5ex 0.5em 0 0.5em;
padding: 0.2ex;
}
div.abstract {
font: bold helvetica;
margin: 1ex 1em 1ex 1em;
padding: 1ex 1em 1ex 1em;
background: #F0F0F0;
}
div.note {
font: bold helvetica;
margin: 1ex 3em 1ex 3em;
padding: 1ex 1em 1ex 1em;
background: #D0E2D2;
}
div.abstract p {
font: sans-serif;
}
......@@ -286,6 +298,7 @@ match page with
<tr>[
<td valign="top">(content x)
<td valign="top">(content y) ] ] ]
| <note> c -> [ <div class="note">[ <b>"Note: " !(content c) ]]
| t -> text [ t ]
in
......
......@@ -9,6 +9,7 @@
<include file="tutorial/overloading.xml"/>
<include file="tutorial/patterns.xml"/>
<include file="tutorial/errors.xml"/>
<include file="tutorial/higherorder.xml"/>
<left>
<p>
This tutorial is a step-by-step introduction to CDuce.
......
......@@ -79,6 +79,20 @@ let %%p%% = %%e%% in %%e'%%
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&amp;%%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 <a href="namespaces.html">namespaces</a>).
</box>
<box title="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
......
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