summaryrefslogtreecommitdiff
path: root/ipl/procs/gener.icn
blob: 5a060200975e3fbb4eb5db2fdf5e7d467d1ef74f (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
############################################################################
#
#	File:     gener.icn
#
#	Subject:  Procedures to generate miscellaneous sequences
#
#	Author:   Ralph E. Griswold
#
#	Date:     March 25, 2002
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#  
#  These procedures generate sequences of results.
#  
#	days()		days of the week.
#
#       hex()		sequence of hexadecimal codes for numbers
#			from 0 to 255
#  
#       label(s,i)	sequence of labels with prefix s starting at i
#
#	multii(i, j)	sequence of i * j i's
#
#	months()	months of the year
#
#	octal()		sequence of octal codes for numbers from 0 to 255
#  
#	star(s)		sequence consisting of the closure of s
#			starting with the empty string and continuing
#			in lexical order as given in s
#  
############################################################################

procedure days()

   suspend "Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" |
      "Friday" | "Saturday"

end

procedure hex()

   suspend !"0123456789abcdef" || !"0123456789abcdef"

end

procedure label(s,i)

   suspend s || (i | (i +:= |1))

end

procedure multii(i, j)

   suspend (i to i * j) & i

end

procedure months()

   suspend "January" | "February" | "March" | "April" | "May" | "June" |
      "July" | "August" | "September" | "October" | "November" | "December"

end

procedure octal()

   suspend (0 to 3) || (0 to 7) || (0 to 7)

end

procedure star(s)

   suspend "" | (star(s) || !s)

end