-
Notifications
You must be signed in to change notification settings - Fork 3
/
trivfunctions.lisp
199 lines (159 loc) · 3.96 KB
/
trivfunctions.lisp
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
;; -*- Mode:Lisp; Syntax:Common-Lisp; Package: (*SIM-I COMMON-LISP-GLOBAL); Muser: Yes -*-
(in-package :*sim-i)
;;;> *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
;;;>
;;;> The Thinking Machines *Lisp Simulator is in the public domain.
;;;> You are free to do whatever you like with it, including but
;;;> not limited to distributing, modifying, and copying.
;;;>
;;;> *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
;;; Author: JP Massar.
(progn
(def-trivial-one-arg-*lisp-functions (
(1+!! 1+)
(1-!! 1-)
(booleanp!! booleanp)
(floatp!! floatp)
(integerp!! integerp)
(complexp!! complexp)
(numberp!! numberp)
(characterp!! characterp)
(signum!! signum)
(zerop!! zerop)
(oddp!! oddp)
(evenp!! evenp)
(plusp!! plusp)
(minusp!! minusp)
(realpart!! realpart)
(imagpart!! imagpart)
(phase!! phase)
(conjugate!! conjugate)
(cis!! cis)
(not!! not)
(null!! null)
(isqrt!! isqrt)
(lognot!! lognot)
(random!! random)
(abs!! abs)
(sin!! sin)
(cos!! cos)
(tan!! tan)
(exp!! exp)
(logcount!! logcount)
(integer-length!! integer-length)
(standard-char-p!! standard-char-p)
(graphic-char-p!! graphic-char-p)
(string-char-p!! string-char-p)
(alpha-char-p!! alpha-char-p)
(upper-case-p!! upper-case-p)
(lower-case-p!! lower-case-p)
(both-case-p!! both-case-p)
(alphanumericp!! alphanumericp)
(char-code!! char-code)
(char-upcase!! char-upcase)
(char-downcase!! char-downcase)
(char-flipcase!! char-flipcase)
(character!! character)
(char-int!! char-int)
(sqrt!! starlisp-sqrt)
(asin!! starlisp-asin)
(acos!! starlisp-acos)
(acosh!! starlisp-acosh)
(atanh!! starlisp-atanh)
(sinh!! sinh)
(cosh!! cosh)
(tanh!! tanh)
(asinh!! asinh)
(byte-size!! byte-size)
(byte-position!! byte-position)
(gray-code-from-integer!! front-end-gray-code-from-integer)
(integer-from-gray-code!! front-end-integer-from-gray-code)
))
(def-trivial-two-arg-*lisp-functions (
(eq!! eq)
(eql!! eql)
(mod!! mod)
(rem!! rem)
(ash!! ash)
(expt!! starlisp-expt)
(lognand!! lognand)
(lognor!! lognor)
(logandc1!! logandc1)
(logandc2!! logandc2)
(logorc1!! logorc1)
(logorc2!! logorc2)
(logtest!! logtest)
(logbitp!! logbitp)
(mask-field!! mask-field)
(byte!! byte)
(ldb!! ldb)
(ldb-test!! ldb-test)
(scale-float!! scale-float)
(compare!! compare)
))
(def-trivial-optional-two-arg-*lisp-functions (
(float!! float)
(truncate!! truncate)
(ceiling!! ceiling)
(floor!! floor)
(round!! round)
(complex!! complex)
(atan!! atan)
(ffloor!! ffloor)
(fceiling!! fceiling)
(ftruncate!! ftruncate)
(fround!! fround)
(float-sign!! float-sign)
(digit-char-p!! digit-char-p)
(log!! starlisp-log)
))
(def-trivial-three-arg-*lisp-functions (
(load-byte!! load-byte)
(dpb!! dpb)
(deposit-field!! deposit-field)
(boole!! boole)
))
(def-trivial-nary-*lisp-functions (
(+!! + t 0)
(-!! - nil 0)
(*!! * t 1)
(internal-/!! / nil 0)
(logand!! logand t -1)
(logior!! logior t 0)
(logxor!! logxor t 0)
(logeqv!! logeqv t -1)
(min!! min nil nil)
(max!! max nil nil)
(gcd!! gcd t 0)
(lcm!! lcm nil 0)
))
(define-trivial-functions
def-trivial-*lisp-reduction-function-using-initial-value
'((*sum + 0 0)
(*logand logand -1 -1)
(*logior logior 0 0)
(*logxor logxor 0 0)
))
(define-trivial-functions
def-trivial-*lisp-reduction-function-using-first-element
'((*min min nil)
(*max max nil)
))
(def-trivial-*lisp-comparision-functions (
(=!! =)
(<!! <)
(>!! >)
(<=!! <=)
(>=!! >=)
(char=!! char=)
(char<!! char<)
(char>!! char>)
(char<=!! char<=)
(char>=!! char>=)
(char-equal!! char-equal)
(char-lessp!! char-lessp)
(char-greaterp!! char-greaterp)
(char-not-lessp!! char-not-lessp)
(char-not-greaterp!! char-not-greaterp)
))
)