1 ( = Type predicates = )
3 :noname ( args -- boolobj )
4 2dup 1 ensure-arg-count
6 car nil objeq? boolean-type
9 :noname ( args -- boolobj )
10 2dup 1 ensure-arg-count
12 car boolean-type istype? -rot 2drop boolean-type
13 ; make-primitive boolean?
15 :noname ( args -- boolobj )
16 2dup 1 ensure-arg-count
18 car symbol-type istype? -rot 2drop boolean-type
19 ; make-primitive symbol?
21 :noname ( args -- boolobj )
22 2dup 1 ensure-arg-count
24 car fixnum-type istype? -rot 2drop boolean-type
25 ; make-primitive integer?
27 :noname ( args -- boolobj )
28 2dup 1 ensure-arg-count
30 car character-type istype? -rot 2drop boolean-type
31 ; make-primitive char?
33 :noname ( args -- boolobj )
34 2dup 1 ensure-arg-count
36 car string-type istype? -rot 2drop boolean-type
37 ; make-primitive string?
39 :noname ( args -- boolobj )
40 2dup 1 ensure-arg-count
42 car pair-type istype? -rot 2drop boolean-type
43 ; make-primitive pair?
45 :noname ( args -- boolobj )
46 2dup 1 ensure-arg-count
48 car primitive-type istype? -rot 2drop boolean-type
49 ; make-primitive procedure?
51 ( = Type conversions = )
53 :noname ( args -- fixnum )
54 2dup 1 ensure-arg-count
55 car character-type ensure-arg-type
58 ; make-primitive char->integer
60 :noname ( args -- char )
61 2dup 1 ensure-arg-count
62 car fixnum-type ensure-arg-type
65 ; make-primitive integer->char
67 : build-fixnum-charlist ( num )
72 rot 10 mod [char] 0 + character-type 2swap
76 :noname ( args -- string )
77 2dup 1 ensure-arg-count
78 car fixnum-type ensure-arg-type
82 dup 0< swap abs ( bool num )
86 [char] - character-type 2swap cons
90 ; make-primitive number->string
94 : add-prim ( args -- fixnum )
100 -rot cdr recurse drop
104 ' add-prim make-primitive +
106 :noname ( args -- fixnum )
112 -rot cdr add-prim drop
117 :noname ( args -- fixnum )
123 -rot cdr recurse drop