754 lines
11 KiB
Factor
754 lines
11 KiB
Factor
|
|
IN: random-tester
|
||
|
|
USING: compiler errors inference interpreter io kernel math
|
||
|
|
memory namespaces prettyprint sequences tools words arrays
|
||
|
|
definitions generic graphs hashtables queues sbufs strings
|
||
|
|
vectors byte-arrays ;
|
||
|
|
|
||
|
|
: safe-words ( -- seq )
|
||
|
|
{
|
||
|
|
array
|
||
|
|
<array>
|
||
|
|
pair
|
||
|
|
byte-array
|
||
|
|
pair?
|
||
|
|
1array
|
||
|
|
2array
|
||
|
|
resize-array
|
||
|
|
3array
|
||
|
|
byte-array?
|
||
|
|
array?
|
||
|
|
>array
|
||
|
|
set-restart-continuation
|
||
|
|
error-hook
|
||
|
|
restart-name
|
||
|
|
restarts.
|
||
|
|
stack-underflow.
|
||
|
|
restart
|
||
|
|
restart?
|
||
|
|
(:help-none)
|
||
|
|
condition
|
||
|
|
<assert>
|
||
|
|
debug-help
|
||
|
|
:get
|
||
|
|
datastack-overflow.
|
||
|
|
set-condition-restarts
|
||
|
|
condition?
|
||
|
|
error.
|
||
|
|
objc-error.
|
||
|
|
print-error
|
||
|
|
assert
|
||
|
|
:res
|
||
|
|
rethrow
|
||
|
|
assert=
|
||
|
|
restart-obj
|
||
|
|
assert?
|
||
|
|
undefined-symbol-error.
|
||
|
|
retainstack-overflow.
|
||
|
|
restarts
|
||
|
|
error-help
|
||
|
|
divide-by-zero-error.
|
||
|
|
ffi-error.
|
||
|
|
(:help-multi)
|
||
|
|
xt.
|
||
|
|
memory-error.
|
||
|
|
retainstack-underflow.
|
||
|
|
set-condition-continuation
|
||
|
|
datastack-underflow.
|
||
|
|
try
|
||
|
|
error-continuation
|
||
|
|
error-stack-trace
|
||
|
|
assert-expect
|
||
|
|
recover
|
||
|
|
:edit
|
||
|
|
kernel-error?
|
||
|
|
error
|
||
|
|
callstack-overflow.
|
||
|
|
stack-overflow.
|
||
|
|
callstack-underflow.
|
||
|
|
set-assert-got
|
||
|
|
set-restart-name
|
||
|
|
restart-continuation
|
||
|
|
condition-restarts
|
||
|
|
heap-scan-error.
|
||
|
|
:help
|
||
|
|
type-check-error.
|
||
|
|
<condition>
|
||
|
|
assert-got
|
||
|
|
throw
|
||
|
|
:c
|
||
|
|
io-error.
|
||
|
|
parse-dump
|
||
|
|
<restart>
|
||
|
|
set-assert-expect
|
||
|
|
:r
|
||
|
|
:s
|
||
|
|
compute-restarts
|
||
|
|
restart.
|
||
|
|
(define-union-class)
|
||
|
|
(class-and)
|
||
|
|
class
|
||
|
|
generic-tags
|
||
|
|
(flatten-class)
|
||
|
|
no-method?
|
||
|
|
predicate-effect
|
||
|
|
tuple-class?
|
||
|
|
tuple-slots
|
||
|
|
math-class?
|
||
|
|
standard-generic
|
||
|
|
bootstrap-combination
|
||
|
|
(class-or)
|
||
|
|
delegate
|
||
|
|
set-members
|
||
|
|
set-method-loc
|
||
|
|
predicate-class
|
||
|
|
no-math-method-left
|
||
|
|
check-method-class
|
||
|
|
tuple-predicate
|
||
|
|
class<
|
||
|
|
reader-word
|
||
|
|
set-superclass
|
||
|
|
class?
|
||
|
|
<no-method>
|
||
|
|
default-constructor-quot
|
||
|
|
(delegates)
|
||
|
|
no-math-method-generic
|
||
|
|
pickers
|
||
|
|
math-method
|
||
|
|
set-no-math-method-left
|
||
|
|
writer-effect
|
||
|
|
(class<)
|
||
|
|
no-method-generic
|
||
|
|
classes-intersect?
|
||
|
|
math-vtable*
|
||
|
|
no-math-method
|
||
|
|
method-spec
|
||
|
|
bigger-classes
|
||
|
|
class-or
|
||
|
|
method
|
||
|
|
math-class-max
|
||
|
|
tuple>array
|
||
|
|
class-empty?
|
||
|
|
class<map
|
||
|
|
math-class
|
||
|
|
generic?
|
||
|
|
math-precedence
|
||
|
|
set-check-method-generic
|
||
|
|
delegate-slots
|
||
|
|
check-method
|
||
|
|
empty-generic?
|
||
|
|
(math-upgrade)
|
||
|
|
union-predicate-quot
|
||
|
|
typemap
|
||
|
|
check-tuple?
|
||
|
|
<method>
|
||
|
|
method?
|
||
|
|
2generic?
|
||
|
|
small-generic?
|
||
|
|
smaller-classes+
|
||
|
|
smaller-classes-
|
||
|
|
union-class
|
||
|
|
set-no-method-object
|
||
|
|
(types)
|
||
|
|
order
|
||
|
|
standard-combination
|
||
|
|
smaller-classes
|
||
|
|
lookup-union
|
||
|
|
check-shape
|
||
|
|
applicable-method
|
||
|
|
writer-word
|
||
|
|
no-method
|
||
|
|
check-tuple
|
||
|
|
<check-method>
|
||
|
|
class-compare
|
||
|
|
predicate-quot
|
||
|
|
<type-vtable>
|
||
|
|
set-check-tuple-class
|
||
|
|
generic
|
||
|
|
2generic
|
||
|
|
null
|
||
|
|
builtins
|
||
|
|
methods
|
||
|
|
build-type-vtable
|
||
|
|
no-math-method-right
|
||
|
|
<no-math-method>
|
||
|
|
math-upgrade
|
||
|
|
method-spec?
|
||
|
|
init-methods
|
||
|
|
sort-methods
|
||
|
|
no-method-object
|
||
|
|
simple-slot
|
||
|
|
default-constructor
|
||
|
|
<check-tuple>
|
||
|
|
>tuple
|
||
|
|
set-method-def
|
||
|
|
superclass<
|
||
|
|
superclass
|
||
|
|
no-math-method?
|
||
|
|
object
|
||
|
|
classes
|
||
|
|
bigger-classes+
|
||
|
|
bigger-classes-
|
||
|
|
implementors
|
||
|
|
class-and
|
||
|
|
set-no-method-generic
|
||
|
|
min-class
|
||
|
|
math-combination
|
||
|
|
types
|
||
|
|
members
|
||
|
|
reader-effect
|
||
|
|
object-method
|
||
|
|
delegates
|
||
|
|
unpickers
|
||
|
|
tag-generic?
|
||
|
|
standard-generic?
|
||
|
|
method-alist>quot
|
||
|
|
predicate-class?
|
||
|
|
flatten-class
|
||
|
|
simplify-alist
|
||
|
|
tuple-size
|
||
|
|
define-class
|
||
|
|
tuple-class
|
||
|
|
check-method-generic
|
||
|
|
check-tuple-class
|
||
|
|
check-method?
|
||
|
|
is?
|
||
|
|
union-class<
|
||
|
|
(closure)
|
||
|
|
(remove-vertex)
|
||
|
|
previous
|
||
|
|
if-graph
|
||
|
|
hash-subset-with
|
||
|
|
hash-intersect
|
||
|
|
hash>alist
|
||
|
|
hash-subset
|
||
|
|
hashtable-hashcode
|
||
|
|
hash-empty?
|
||
|
|
remove-hash
|
||
|
|
hash-stale?
|
||
|
|
hash-stack
|
||
|
|
hashtable=
|
||
|
|
hash-each
|
||
|
|
hash-values
|
||
|
|
hashtable?
|
||
|
|
cache
|
||
|
|
hash-all?
|
||
|
|
alist>hash
|
||
|
|
subhash?
|
||
|
|
hash-keys
|
||
|
|
hash-member?
|
||
|
|
hash-size
|
||
|
|
?grow-hash
|
||
|
|
hash-large?
|
||
|
|
grow-hash
|
||
|
|
hash-each-with
|
||
|
|
hash-map
|
||
|
|
map>hash
|
||
|
|
set-hash
|
||
|
|
hash-all-with?
|
||
|
|
associate
|
||
|
|
hashtable
|
||
|
|
hash-union
|
||
|
|
cwd
|
||
|
|
duplex-stream
|
||
|
|
pathname?
|
||
|
|
cr+
|
||
|
|
directory
|
||
|
|
duplex-stream-out
|
||
|
|
format
|
||
|
|
cr-
|
||
|
|
duplex-stream?
|
||
|
|
with-stream-style
|
||
|
|
c-stream-error?
|
||
|
|
line-reader?
|
||
|
|
set-duplex-stream-out
|
||
|
|
! server?
|
||
|
|
<check-closed>
|
||
|
|
directory?
|
||
|
|
format-column
|
||
|
|
<line-reader>
|
||
|
|
! <file-r/w>
|
||
|
|
set-timeout
|
||
|
|
write-pathname
|
||
|
|
duplex-stream-closed?
|
||
|
|
print
|
||
|
|
set-duplex-stream-closed?
|
||
|
|
pathname
|
||
|
|
line-reader
|
||
|
|
write-object
|
||
|
|
terpri
|
||
|
|
?resource-path
|
||
|
|
stream-terpri
|
||
|
|
sbuf-read-until
|
||
|
|
set-client-stream-host
|
||
|
|
line-ends/eof
|
||
|
|
<c-stream-error>
|
||
|
|
plain-writer?
|
||
|
|
resource-path
|
||
|
|
>be
|
||
|
|
find-last-sep
|
||
|
|
c-stream-error
|
||
|
|
fix\r
|
||
|
|
client-stream-host
|
||
|
|
plain-writer
|
||
|
|
<string-reader>
|
||
|
|
check-closed?
|
||
|
|
set-client-stream-port
|
||
|
|
write-outliner
|
||
|
|
write1
|
||
|
|
bl
|
||
|
|
cd
|
||
|
|
client-stream
|
||
|
|
nth-byte
|
||
|
|
accept
|
||
|
|
check-closed
|
||
|
|
client-stream-port
|
||
|
|
do-nested-quot
|
||
|
|
pathname-string
|
||
|
|
line-ends\n
|
||
|
|
line-ends\r
|
||
|
|
home
|
||
|
|
duplex-stream-out+
|
||
|
|
set-duplex-stream-in
|
||
|
|
line-reader-cr
|
||
|
|
>le
|
||
|
|
<pathname>
|
||
|
|
<string-writer>
|
||
|
|
(directory)
|
||
|
|
stream-print
|
||
|
|
exists?
|
||
|
|
<plain-writer>
|
||
|
|
handle-readln
|
||
|
|
string-lines
|
||
|
|
write
|
||
|
|
duplex-stream-in
|
||
|
|
client-stream?
|
||
|
|
duplex-stream-in+
|
||
|
|
continuation-name
|
||
|
|
set-datastack
|
||
|
|
wrapper
|
||
|
|
pick
|
||
|
|
2nip
|
||
|
|
tuple
|
||
|
|
set-boot
|
||
|
|
clone
|
||
|
|
with-datastack
|
||
|
|
cpu
|
||
|
|
tuck
|
||
|
|
-rot
|
||
|
|
(continue)
|
||
|
|
swapd
|
||
|
|
>boolean
|
||
|
|
wrapper?
|
||
|
|
dupd
|
||
|
|
3dup
|
||
|
|
dup
|
||
|
|
windows?
|
||
|
|
os-env
|
||
|
|
=
|
||
|
|
over
|
||
|
|
continuation
|
||
|
|
alist>quot
|
||
|
|
?
|
||
|
|
<wrapper>
|
||
|
|
2dup
|
||
|
|
cond
|
||
|
|
win64?
|
||
|
|
<quotation>
|
||
|
|
continue
|
||
|
|
3drop
|
||
|
|
hashcode
|
||
|
|
quotation
|
||
|
|
xor
|
||
|
|
when
|
||
|
|
unless
|
||
|
|
version
|
||
|
|
or
|
||
|
|
os
|
||
|
|
get-walker-hook
|
||
|
|
depth
|
||
|
|
equal?
|
||
|
|
no-cond?
|
||
|
|
if
|
||
|
|
tuple?
|
||
|
|
unix?
|
||
|
|
(continue-with)
|
||
|
|
general-t
|
||
|
|
continuation?
|
||
|
|
3slip
|
||
|
|
<no-cond>
|
||
|
|
macosx?
|
||
|
|
rot
|
||
|
|
win32?
|
||
|
|
>quotation
|
||
|
|
>continuation<
|
||
|
|
type
|
||
|
|
continuation-call
|
||
|
|
clear
|
||
|
|
drop
|
||
|
|
continuation-data
|
||
|
|
set-continuation-call
|
||
|
|
2drop
|
||
|
|
no-cond
|
||
|
|
unit
|
||
|
|
set-continuation-data
|
||
|
|
and
|
||
|
|
when*
|
||
|
|
quotation?
|
||
|
|
datastack
|
||
|
|
swap
|
||
|
|
unless*
|
||
|
|
set-continuation-catch
|
||
|
|
eq?
|
||
|
|
not
|
||
|
|
continuation-retain
|
||
|
|
make-dip
|
||
|
|
wrapped
|
||
|
|
if*
|
||
|
|
nip
|
||
|
|
sin
|
||
|
|
integer?
|
||
|
|
log2
|
||
|
|
cot
|
||
|
|
number>string
|
||
|
|
integer
|
||
|
|
sech
|
||
|
|
abs
|
||
|
|
tanh
|
||
|
|
real?
|
||
|
|
neg
|
||
|
|
between?
|
||
|
|
asech
|
||
|
|
>rect
|
||
|
|
bignum?
|
||
|
|
atanh
|
||
|
|
-i
|
||
|
|
*
|
||
|
|
+
|
||
|
|
fp-nan?
|
||
|
|
-
|
||
|
|
small
|
||
|
|
/
|
||
|
|
sqrt
|
||
|
|
cosech
|
||
|
|
even?
|
||
|
|
v*n
|
||
|
|
<
|
||
|
|
bits>double
|
||
|
|
>
|
||
|
|
^theta
|
||
|
|
numerator
|
||
|
|
>base
|
||
|
|
acosech
|
||
|
|
cosh
|
||
|
|
min
|
||
|
|
pi
|
||
|
|
number
|
||
|
|
zero?
|
||
|
|
digit>
|
||
|
|
rem
|
||
|
|
bitor
|
||
|
|
>polar
|
||
|
|
>fraction
|
||
|
|
acos
|
||
|
|
acot
|
||
|
|
asin
|
||
|
|
acosh
|
||
|
|
/f
|
||
|
|
ratio
|
||
|
|
e
|
||
|
|
fixnum?
|
||
|
|
/i
|
||
|
|
cis
|
||
|
|
coth
|
||
|
|
1+
|
||
|
|
1-
|
||
|
|
conjugate
|
||
|
|
sinh
|
||
|
|
acosec
|
||
|
|
i
|
||
|
|
number=
|
||
|
|
number?
|
||
|
|
epsilon
|
||
|
|
float
|
||
|
|
n/v
|
||
|
|
max
|
||
|
|
tan
|
||
|
|
acoth
|
||
|
|
absq
|
||
|
|
float?
|
||
|
|
asinh
|
||
|
|
denominator
|
||
|
|
rational?
|
||
|
|
fixnum
|
||
|
|
rect>
|
||
|
|
>fixnum
|
||
|
|
imaginary
|
||
|
|
exp
|
||
|
|
sec
|
||
|
|
bitxor
|
||
|
|
>bin
|
||
|
|
align
|
||
|
|
log
|
||
|
|
<=
|
||
|
|
[-]
|
||
|
|
sq
|
||
|
|
odd?
|
||
|
|
^mag
|
||
|
|
bitnot
|
||
|
|
ratio?
|
||
|
|
>digit
|
||
|
|
v*
|
||
|
|
v.
|
||
|
|
v/
|
||
|
|
>float
|
||
|
|
[-1,1]?
|
||
|
|
arg
|
||
|
|
small?
|
||
|
|
bitand
|
||
|
|
>oct
|
||
|
|
v/n
|
||
|
|
complex
|
||
|
|
rational
|
||
|
|
shift
|
||
|
|
polar>
|
||
|
|
cosec
|
||
|
|
>float-rect
|
||
|
|
atan
|
||
|
|
sgn
|
||
|
|
>=
|
||
|
|
real
|
||
|
|
complex?
|
||
|
|
mod
|
||
|
|
string>ratio
|
||
|
|
asec
|
||
|
|
n*v
|
||
|
|
>hex
|
||
|
|
bits>float
|
||
|
|
bignum
|
||
|
|
power-of-2?
|
||
|
|
/mod
|
||
|
|
cos
|
||
|
|
namespace-error-object
|
||
|
|
get-global
|
||
|
|
namespace-error?
|
||
|
|
namespace-error
|
||
|
|
#
|
||
|
|
%
|
||
|
|
,
|
||
|
|
building
|
||
|
|
<namespace-error>
|
||
|
|
set-namespace-error-object
|
||
|
|
get
|
||
|
|
set-entry-next
|
||
|
|
empty-queue
|
||
|
|
empty-queue?
|
||
|
|
deque
|
||
|
|
queue-each
|
||
|
|
queue-head
|
||
|
|
<entry>
|
||
|
|
(deque)
|
||
|
|
set-entry-obj
|
||
|
|
queue?
|
||
|
|
entry-next
|
||
|
|
queue-tail
|
||
|
|
queue
|
||
|
|
queue-empty?
|
||
|
|
entry
|
||
|
|
<queue>
|
||
|
|
set-queue-head
|
||
|
|
enque
|
||
|
|
<empty-queue>
|
||
|
|
entry-obj
|
||
|
|
(enque)
|
||
|
|
clear-queue
|
||
|
|
entry?
|
||
|
|
set-queue-tail
|
||
|
|
sbuf
|
||
|
|
ch>upper
|
||
|
|
string?
|
||
|
|
LETTER?
|
||
|
|
>sbuf
|
||
|
|
>lower
|
||
|
|
quotable?
|
||
|
|
string>sbuf
|
||
|
|
blank?
|
||
|
|
string
|
||
|
|
sbuf?
|
||
|
|
printable?
|
||
|
|
>string
|
||
|
|
letter?
|
||
|
|
resize-string
|
||
|
|
control?
|
||
|
|
alpha?
|
||
|
|
<string>
|
||
|
|
>upper
|
||
|
|
Letter?
|
||
|
|
ch>lower
|
||
|
|
digit?
|
||
|
|
<sbuf>
|
||
|
|
1string
|
||
|
|
sort-values
|
||
|
|
all-eq?
|
||
|
|
pop*
|
||
|
|
slice-error-reason
|
||
|
|
remove
|
||
|
|
slice-error
|
||
|
|
split*
|
||
|
|
split,
|
||
|
|
prune
|
||
|
|
diff
|
||
|
|
subset
|
||
|
|
split
|
||
|
|
padding
|
||
|
|
column?
|
||
|
|
column@
|
||
|
|
<column>
|
||
|
|
slice-from
|
||
|
|
<reversed>
|
||
|
|
<slice-error>
|
||
|
|
reversed-seq
|
||
|
|
empty?
|
||
|
|
((append))
|
||
|
|
reversed?
|
||
|
|
reversed@
|
||
|
|
map-with
|
||
|
|
set-slice-error-reason
|
||
|
|
set-column-col
|
||
|
|
natural-sort
|
||
|
|
(subst)
|
||
|
|
set-slice-seq
|
||
|
|
binsearch
|
||
|
|
slice-seq
|
||
|
|
3append
|
||
|
|
nsort
|
||
|
|
length
|
||
|
|
reversed
|
||
|
|
sequence=
|
||
|
|
sequence?
|
||
|
|
split-next,
|
||
|
|
subst
|
||
|
|
map
|
||
|
|
flip
|
||
|
|
set-reversed-seq
|
||
|
|
max-length
|
||
|
|
min-length
|
||
|
|
all-equal?
|
||
|
|
all?
|
||
|
|
pad-left
|
||
|
|
contains?
|
||
|
|
inject
|
||
|
|
slice
|
||
|
|
first4
|
||
|
|
bounds-check?
|
||
|
|
column-seq
|
||
|
|
pad-right
|
||
|
|
each
|
||
|
|
subset-with
|
||
|
|
interleave
|
||
|
|
sort
|
||
|
|
sequence
|
||
|
|
reduce
|
||
|
|
set-slice-from
|
||
|
|
set-slice-to
|
||
|
|
2map
|
||
|
|
(append)
|
||
|
|
sort-keys
|
||
|
|
2each
|
||
|
|
collapse-slice
|
||
|
|
column
|
||
|
|
(mismatch)
|
||
|
|
contains-with?
|
||
|
|
pop
|
||
|
|
tail?
|
||
|
|
head?
|
||
|
|
slice?
|
||
|
|
slice@
|
||
|
|
binsearch*
|
||
|
|
move
|
||
|
|
slice-to
|
||
|
|
like
|
||
|
|
slice-error?
|
||
|
|
set-column-seq
|
||
|
|
nappend
|
||
|
|
column-col
|
||
|
|
(split)
|
||
|
|
index
|
||
|
|
each-with
|
||
|
|
last-index
|
||
|
|
append
|
||
|
|
accumulate
|
||
|
|
drop-prefix
|
||
|
|
mismatch
|
||
|
|
all-with?
|
||
|
|
start
|
||
|
|
<vector>
|
||
|
|
>vector
|
||
|
|
array>vector
|
||
|
|
vector?
|
||
|
|
vector
|
||
|
|
bootstrapping?
|
||
|
|
effect-terminated?
|
||
|
|
primitive
|
||
|
|
reset-word
|
||
|
|
unxref-word*
|
||
|
|
words
|
||
|
|
effect-out
|
||
|
|
unchanged-word
|
||
|
|
effect>string
|
||
|
|
word-prop
|
||
|
|
vocab
|
||
|
|
compound
|
||
|
|
word-changed?
|
||
|
|
word-name
|
||
|
|
quot-uses
|
||
|
|
reset-props
|
||
|
|
effect
|
||
|
|
<effect>
|
||
|
|
stack-effect
|
||
|
|
primitive?
|
||
|
|
stack-picture
|
||
|
|
create-vocab
|
||
|
|
all-words
|
||
|
|
set-word-vocabulary
|
||
|
|
check-create-vocab
|
||
|
|
update-xt
|
||
|
|
check-create
|
||
|
|
effect-in
|
||
|
|
target-word
|
||
|
|
symbol?
|
||
|
|
word
|
||
|
|
set-effect-terminated?
|
||
|
|
reveal
|
||
|
|
interned?
|
||
|
|
undefined?
|
||
|
|
undefined
|
||
|
|
effect?
|
||
|
|
effect<=
|
||
|
|
compound?
|
||
|
|
set-effect-in
|
||
|
|
ensure-vocab
|
||
|
|
(quot-uses)
|
||
|
|
word-primitive
|
||
|
|
bootstrap-word
|
||
|
|
word-vocabulary
|
||
|
|
uses
|
||
|
|
word-props
|
||
|
|
compiled?
|
||
|
|
crossref
|
||
|
|
intern-symbol
|
||
|
|
execute
|
||
|
|
word?
|
||
|
|
symbol
|
||
|
|
xref-word
|
||
|
|
constructor-word
|
||
|
|
changed-word
|
||
|
|
effect-height
|
||
|
|
vocabs
|
||
|
|
words-named
|
||
|
|
check-create-name
|
||
|
|
definer
|
||
|
|
lookup
|
||
|
|
set-effect-out
|
||
|
|
word-xt
|
||
|
|
} ;
|