Skip to content

Commit 31532e6

Browse files
author
duchier
committed
documentation for the stdlib
git-svn-id: https://gforge.info.ucl.ac.be/svn/mozart@15945 ada56829-ad1f-0410-b00f-83cda6628aec
1 parent e895a45 commit 31532e6

29 files changed

+1473
-36
lines changed

adt/cell.html

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2+
<HTML>
3+
<HEAD>
4+
<!-- EDIT -->
5+
<TITLE>Mozart Standard Library: Functional Cells</TITLE>
6+
<STYLE>
7+
BODY {
8+
background-color: white;
9+
margin-left : 2cm;
10+
margin-right : 2cm;
11+
font-family : tahoma,arial,helvetica,sans-serif;
12+
}
13+
H1 {
14+
text-align : center;
15+
color : #9B0000;
16+
}
17+
H2 { color : #FF9933; }
18+
H4 { color : slateblue; }
19+
H3 { color : #881155; }
20+
H5 { color : darkslateblue; }
21+
CODE { color : #663366; }
22+
CODE,TT {
23+
font-family : "lucida console",courier,monospace;
24+
}
25+
CODE.DISPLAY {
26+
display : block;
27+
white-space : pre;
28+
margin-left : 2cm;
29+
margin-top : 1em;
30+
margin-bottom : 1em;
31+
}
32+
P.AUTHOR {
33+
text-align : center;
34+
font-weight : bold;
35+
}
36+
SPAN.MODULE {
37+
color : steelblue;
38+
}
39+
A { color : steelblue; }
40+
SPAN.COMMENT { color: #B22222; }
41+
SPAN.KEYWORD { color: #A020F0; }
42+
SPAN.STRING { color: #BC8F8F; }
43+
SPAN.FUNCTIONNAME { color: #0000FF; }
44+
SPAN.TYPE { color: #228B22; }
45+
SPAN.VARIABLENAME { color: #B8860B; }
46+
SPAN.REFERENCE { color: #5F9EA0; }
47+
SPAN.BUILTIN { color: #DA70D6; }
48+
</STYLE>
49+
</HEAD>
50+
<BODY>
51+
<!-- EDIT -->
52+
<H1>Functional Cells</H1>
53+
<P CLASS="AUTHOR">Denys Duchier</P>
54+
<DL>
55+
<DT><B>module</B>
56+
<DD><SPAN CLASS="MODULE">x-oz://system/adt/Cell.ozf</SPAN>
57+
</DL>
58+
<HR>
59+
60+
<P>This is a functional wrapper around the standard cell datatype.
61+
62+
<H2>Exports</H2>
63+
64+
<P>The module exports only one function: a <CODE>New</CODE> constructor
65+
66+
<DL>
67+
<DT><CODE>{Cell.new V}</CODE>
68+
<DD>creates a new instance of a functional cell, initialized with
69+
value <CODE>V</CODE>.
70+
</DL>
71+
72+
<H2>Instance API</H2>
73+
74+
<P>Each functional cell instance <CODE>C</CODE> has the following features:
75+
<DL>
76+
<DT><CODE>{C.get ?V}</CODE>
77+
<DD>return the current value <CODE>V</CODE> of <CODE>C</CODE>
78+
<DT><CODE>{C.put V}</CODE>
79+
<DD>set the current value of <CODE>C</CODE> to <CODE>V</CODE>
80+
<DT><CODE>{C.getPut Old New}</CODE>
81+
<DD>atomically, gets the current value <CODE>Old</CODE> of <CODE>C</CODE>
82+
and replaces it with <CODE>New</CODE>
83+
<DT><CODE>{C.clone ?C2}</CODE>
84+
<DD>returns a new functional cell instance, initialized with <CODE>C</CODE>'s
85+
current value
86+
</DL>
87+
88+
<HR>
89+
</BODY>
90+
</HTML>

adt/counter.html

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2+
<HTML>
3+
<HEAD>
4+
<!-- EDIT -->
5+
<TITLE>Mozart Standard Library: Functional Counters</TITLE>
6+
<STYLE>
7+
BODY {
8+
background-color: white;
9+
margin-left : 2cm;
10+
margin-right : 2cm;
11+
font-family : tahoma,arial,helvetica,sans-serif;
12+
}
13+
H1 {
14+
text-align : center;
15+
color : #9B0000;
16+
}
17+
H2 { color : #FF9933; }
18+
H4 { color : slateblue; }
19+
H3 { color : #881155; }
20+
H5 { color : darkslateblue; }
21+
CODE { color : #663366; }
22+
CODE,TT {
23+
font-family : "lucida console",courier,monospace;
24+
}
25+
CODE.DISPLAY {
26+
display : block;
27+
white-space : pre;
28+
margin-left : 2cm;
29+
margin-top : 1em;
30+
margin-bottom : 1em;
31+
}
32+
P.AUTHOR {
33+
text-align : center;
34+
font-weight : bold;
35+
}
36+
SPAN.MODULE {
37+
color : steelblue;
38+
}
39+
A { color : steelblue; }
40+
SPAN.COMMENT { color: #B22222; }
41+
SPAN.KEYWORD { color: #A020F0; }
42+
SPAN.STRING { color: #BC8F8F; }
43+
SPAN.FUNCTIONNAME { color: #0000FF; }
44+
SPAN.TYPE { color: #228B22; }
45+
SPAN.VARIABLENAME { color: #B8860B; }
46+
SPAN.REFERENCE { color: #5F9EA0; }
47+
SPAN.BUILTIN { color: #DA70D6; }
48+
</STYLE>
49+
</HEAD>
50+
<BODY>
51+
<!-- EDIT -->
52+
<H1>Functional Counters</H1>
53+
<P CLASS="AUTHOR">Denys Duchier</P>
54+
<DL>
55+
<DT><B>module</B>
56+
<DD><SPAN CLASS="MODULE">x-oz://system/adt/Counter.ozf</SPAN>
57+
</DL>
58+
<HR>
59+
60+
<P>This module provides a functional interface for counters
61+
62+
<H2>Exports</H2>
63+
<P>The modules exports 2 constructors:
64+
<DL>
65+
<DT><CODE>{Counter.newFromInt +I ?C}</CODE>
66+
<DD>returns a new functional counter instance, initialized to
67+
integer value <CODE>I</CODE>
68+
<DT><CODE>{Counter.new ?C}</CODE>
69+
<DD>return a new functional counter instance, initialized to 1
70+
</DL>
71+
72+
<H2>Instance API</H2>
73+
74+
<P>Each functional counter instance <CODE>C</CODE> has the following
75+
features:
76+
<DL>
77+
<DT><CODE>{C.get ?I}</CODE>
78+
<DD>returns the current value <CODE>I</CODE> of <CODE>C</CODE>
79+
<DT><CODE>{C.put +I}</CODE>
80+
<DD>sets the current value of <CODE>C</CODE> to <CODE>I</CODE>
81+
<DT><CODE>{C.getPut Old New}</CODE>
82+
<DD>atomically gets the current value <CODE>Old</CODE> of <CODE>C</CODE>
83+
and sets it to the new value <CODE>New</CODE>
84+
<DT><CODE>{C.next ?I}</CODE>
85+
<DD>returns the current value <CODE>I</CODE> of <CODE>C</CODE> and
86+
increments the counter
87+
<DT><CODE>{C.plus +N}</CODE>
88+
<DD>increments <CODE>C</CODE> by <CODE>N</CODE>
89+
<DT><CODE>{C.times +N}</CODE>
90+
<DD>multiplies the content of <CODE>C</CODE> by <CODE>N</CODE>
91+
<DT><CODE>{C.clone ?C2}</CODE>
92+
<DD>returns a new counter <CODE>C2</CODE> currently holding the same
93+
integer value as <CODE>C</CODE>
94+
</DL>
95+
96+
<HR>
97+
</BODY>
98+
</HTML>

adt/dictionary.html

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2+
<HTML>
3+
<HEAD>
4+
<!-- EDIT -->
5+
<TITLE>Mozart Standard Library: Functional Dictionaries</TITLE>
6+
<STYLE>
7+
BODY {
8+
background-color: white;
9+
margin-left : 2cm;
10+
margin-right : 2cm;
11+
font-family : tahoma,arial,helvetica,sans-serif;
12+
}
13+
H1 {
14+
text-align : center;
15+
color : #9B0000;
16+
}
17+
H2 { color : #FF9933; }
18+
H4 { color : slateblue; }
19+
H3 { color : #881155; }
20+
H5 { color : darkslateblue; }
21+
CODE { color : #663366; }
22+
CODE,TT {
23+
font-family : "lucida console",courier,monospace;
24+
}
25+
CODE.DISPLAY {
26+
display : block;
27+
white-space : pre;
28+
margin-left : 2cm;
29+
margin-top : 1em;
30+
margin-bottom : 1em;
31+
}
32+
P.AUTHOR {
33+
text-align : center;
34+
font-weight : bold;
35+
}
36+
SPAN.MODULE {
37+
color : steelblue;
38+
}
39+
A { color : steelblue; }
40+
SPAN.COMMENT { color: #B22222; }
41+
SPAN.KEYWORD { color: #A020F0; }
42+
SPAN.STRING { color: #BC8F8F; }
43+
SPAN.FUNCTIONNAME { color: #0000FF; }
44+
SPAN.TYPE { color: #228B22; }
45+
SPAN.VARIABLENAME { color: #B8860B; }
46+
SPAN.REFERENCE { color: #5F9EA0; }
47+
SPAN.BUILTIN { color: #DA70D6; }
48+
</STYLE>
49+
</HEAD>
50+
<BODY>
51+
<!-- EDIT -->
52+
<H1>Functional Dictionaries</H1>
53+
<P CLASS="AUTHOR">Denys Duchier</P>
54+
<DL>
55+
<DT><B>module</B>
56+
<DD><SPAN CLASS="MODULE">x-oz://system/adt/Dictionary.ozf</SPAN>
57+
</DL>
58+
<HR>
59+
60+
<P>This module provides functional interface for dictionaries
61+
62+
<H2>Exports</H2>
63+
<P>The module exports the following constructors:
64+
<DL>
65+
<DT><CODE>{Dictionary.new ?D}</CODE>
66+
<DD>returns a new empty functional dictionary <CODE>D</CODE>
67+
<DT><CODE>{Dictionary.newFromRecord +R ?D}</CODE>
68+
<DD>returns a new functional dictionary <CODE>D</CODE> initialized
69+
using the key/value mapping provided by record <CODE>R</CODE>
70+
</DL>
71+
72+
<H2>Instance API</H2>
73+
74+
<P>Each functional dictionary instance <CODE>D</CODE> has the following
75+
features:
76+
<DL>
77+
<DT><CODE>{D.get +Key ?Value}</CODE>
78+
<DD>returns the <CODE>Value</CODE> for the given <CODE>Key</CODE>,
79+
or raises an exception if none
80+
<DT><CODE>{D.put +Key +Value}</CODE>
81+
<DD>sets the <CODE>Value</CODE> for the given <CODE>Key</CODE>
82+
<DT><CODE>{D.condGet +Key +Default ?Value}</CODE>
83+
<DD>returns the <CODE>Value</CODE> for the given <CODE>Key</CODE>, or
84+
the <CODE>Default</CODE> if none
85+
<DT><CODE>{D.reset}</CODE>
86+
<DD>remove all entries
87+
<DT><CODE>{D.keys ?L}</CODE>
88+
<DD>returns the list <CODE>L</CODE> of all keys in <CODE>D</CODE>
89+
<DT><CODE>{D.items ?L}</CODE>
90+
<DD>returns the list <CODE>L</CODE> of all values in <CODE>D</CODE>
91+
<DT><CODE>{D.entries ?L}</CODE>
92+
<DD>returns the list <CODE>L</CODE> of all pairs <CODE>Key#Values</CODE>
93+
for entries in <CODE>D</CODE>
94+
<DT><CODE>{D.isEmpty ?B}</CODE>
95+
<DD>returns true iff <CODE>D</CODE> is empty
96+
<DT><CODE>{D.remove +Key}</CODE>
97+
<DD>remove the entry for <CODE>Key</CODE> if any
98+
<DT><CODE>{D.member +Key ?B}</CODE>
99+
<DD>returns true iff there is an entry for <CODE>Key</CODE>
100+
<DT><CODE>{D.clone ?D2}</CODE>
101+
<DD>returns a new functional dictionary instance <CODE>D2</CODE>
102+
that is a clone of <CODE>D</CODE>
103+
<DT><CODE>{D.toRecord ?R}</CODE>
104+
<DD>return the current entries in <CODE>D</CODE> in the form of
105+
a record <CODE>R</CODE>
106+
</DL>
107+
108+
<HR>
109+
</BODY>
110+
</HTML>

adt/generator.html

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2+
<HTML>
3+
<HEAD>
4+
<!-- EDIT -->
5+
<TITLE>Mozart Standard Library: Generators</TITLE>
6+
<STYLE>
7+
BODY {
8+
background-color: white;
9+
margin-left : 2cm;
10+
margin-right : 2cm;
11+
font-family : tahoma,arial,helvetica,sans-serif;
12+
}
13+
H1 {
14+
text-align : center;
15+
color : #9B0000;
16+
}
17+
H2 { color : #FF9933; }
18+
H4 { color : slateblue; }
19+
H3 { color : #881155; }
20+
H5 { color : darkslateblue; }
21+
CODE { color : #663366; }
22+
CODE,TT {
23+
font-family : "lucida console",courier,monospace;
24+
}
25+
CODE.DISPLAY {
26+
display : block;
27+
white-space : pre;
28+
margin-left : 2cm;
29+
margin-top : 1em;
30+
margin-bottom : 1em;
31+
}
32+
P.AUTHOR {
33+
text-align : center;
34+
font-weight : bold;
35+
}
36+
SPAN.MODULE {
37+
color : steelblue;
38+
}
39+
A { color : steelblue; }
40+
SPAN.COMMENT { color: #B22222; }
41+
SPAN.KEYWORD { color: #A020F0; }
42+
SPAN.STRING { color: #BC8F8F; }
43+
SPAN.FUNCTIONNAME { color: #0000FF; }
44+
SPAN.TYPE { color: #228B22; }
45+
SPAN.VARIABLENAME { color: #B8860B; }
46+
SPAN.REFERENCE { color: #5F9EA0; }
47+
SPAN.BUILTIN { color: #DA70D6; }
48+
</STYLE>
49+
</HEAD>
50+
<BODY>
51+
<!-- EDIT -->
52+
<H1>Generators</H1>
53+
<P CLASS="AUTHOR">Denys Duchier</P>
54+
<DL>
55+
<DT><B>module</B>
56+
<DD><SPAN CLASS="MODULE">x-oz://system/adt/Generators.ozf</SPAN>
57+
</DL>
58+
<HR>
59+
60+
<P>This module provides very experimental support for generators. Generators
61+
can be used in the <CODE>for</CODE> loop with the <CODE>from</CODE>
62+
keywords. Be warned that this design could very well change in the future.
63+
64+
<H2>Exports</H2>
65+
<DL>
66+
<DT><CODE>{Generator.concat [G1 ... Gn] ?G}</CODE>
67+
<DD>creates a new generator <CODE>G</CODE> which is the concatenation of generators
68+
<CODE>G1</CODE> through <CODE>Gn</CODE>
69+
<DT><CODE>{Generator.tails +L ?G}</CODE>
70+
<DD>creates a generator <CODE>G</CODE> that produces all non-empty tails
71+
of list <CODE>L</CODE>
72+
<DT><CODE>{Generator.count +From +To +By ?G}</CODE>
73+
<DD>creates a generator <CODE>G</CODE> that produces all integers
74+
starting at <CODE>From<CODE> and ending at most at <CODE>To</CODE>
75+
by steps of <CODE>By</CODE>. Whether we count up or down depends on
76+
the sign of <CODE>By</CODE>
77+
<DT><CODE>{Generator.member +L ?G}</CODE>
78+
<DD>creates a generator <CODE>G</CODE> that produces the elements
79+
of list <CODE>L</CODE>
80+
<DT><CODE>{Generator.keys +M ?G}</CODE>
81+
<DD>creates a generator <CODE>G</CODE> that produces the keys of mapping
82+
<CODE>M</CODE>. The latter can be a record, an array, or a dictionary.
83+
<DT><CODE>{Generator.items +M ?G}</CODE>
84+
<DD>creates a generator <CODE>G</CODE> that produces the values of mapping
85+
<CODE>M</CODE>. The latter can be a record, an array, or a dictionary.
86+
<DT><CODE>{Generator.entries +M ?G}</CODE>
87+
<DD>creates a generator <CODE>G</CODE> that produces the entries of mapping
88+
<CODE>M</CODE>. The latter can be a record, an array, or a dictionary.
89+
</DL>
90+
91+
<HR>
92+
</BODY>
93+
</HTML>

0 commit comments

Comments
 (0)