File: print_list.doc

package info (click to toggle)
hol88 2.02.19940316dfsg-5
  • links: PTS
  • area: main
  • in suites:
  • 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 (53 lines) | stat: -rw-r--r-- 1,207 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
46
47
48
49
50
51
52
53
\DOC print_list

\TYPE {print_list : (bool -> string -> (* -> **) -> * list -> void)}

\SYNOPSIS
Prints a list to the terminal in a specific format.

\DESCRIBE
{print_list incon name prfn l} returns {():void} with the side-effect of
printing the elements of {l} to the terminal using the print function {prfn}.
The string {name} is also displayed and the flag {incon} specifies whether
line breaking between elements of the list is to be inconsistent ({incon} is
{true}) or consistent ({incon} is {false}). If the list {l} is empty, no text
is displayed. When {l} is not empty, the elements of the list are printed in
reverse order.

The format of the output is illustrated in the example. {print_list} is used
within the HOL system for printing theories. It is unlikely to be of use in
general.

\FAILURE
Fails if the print function {prfn} fails on any of the arguments of the
list {l}.

\EXAMPLE
{
#set_margin 15;;
72 : int
}
{
#print_list true `Test1:` print_int [1;2;3;4;5;6];;
Test1: --
  6     5
  4     3
  2     1
() : void
}
{
#print_list false `Test2:` print_int [1;2;3;4;5;6];;
Test2: --
  6
  5
  4
  3
  2
  1

() : void
}
\SEEALSO
print_theory, print_begin, print_end, print_newline.

\ENDDOC