File: do.doc

package info (click to toggle)
hol88 2.02.19940316dfsg-5
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 65,816 kB
  • sloc: ml: 199,939; ansic: 9,666; sh: 6,913; makefile: 6,032; lisp: 2,747; yacc: 894; sed: 201; cpp: 87; awk: 5
file content (45 lines) | stat: -rw-r--r-- 891 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
\DOC do

\TYPE {$do : (* -> void)}

\SYNOPSIS
Evaluates an expression for its side-effects.

\DESCRIBE
The function {do} evaluates its argument (presumably for its side-effects)
and returns the value {(): void}.

\FAILURE
Fails iff the evaluation of its argument fails.

\EXAMPLE
The following shows how an assignment can be evaluated for its
side-effects:
{
   #letref x = 1;;
   x = 1 : int

   #x := x + 1;;
   2 : int

   #do (x := x + 1);;
   () : void

   #x := x + 1;;
   4 : int
}
\COMMENTS
The use of {do} as if it were a normal ML function should not be confused with
its role as a syntactic construct in a while loop. For example, following on
from the above example, consider the following:
{
   #while x > 0 do do (x := x - 1);;
   () : void

   #x;;
   0 : int
}
\noindent In the above, the first {do} is part of the {while} loop, whereas the
second is function-like.

\ENDDOC