0521F |
&COMP
|
( comp comp' → comp" )
Concatenates two composites.
|
052FA |
>TCOMP
|
( comp ob → comp+ob )
Adds ob to tail (end) of composite.
|
052C6 |
>HCOMP
|
( comp ob → ob+comp )
Adds ob to head (beginning) of composite.
|
1AC93 |
(SWAP>HCOMP)
|
( ob comp → ob+comp )
Does SWAP then >HCOMP .
|
05089 |
CARCOMP
|
( comp → ob_head )
( comp_null → comp_null )
Returns first object of the composite, or a
null composite if the argument is a null
composite.
|
6317D |
?CARCOMP
|
( comp T → ob )
( comp F → comp )
If the flag is TRUE , does CARCOMP .
|
05153 |
CDRCOMP
|
( comp → comp-ob_head )
( comp_null → comp_null )
Returns the composite minus its first object,
or a null composite if the argument is a null
composite.
|
0567B |
LENCOMP
|
( comp → #n )
Returns length of composite (number of
objects).
|
63231 |
DUPLENCOMP
|
( comp → comp #n )
Does DUP then <REF>LENCOMP.
|
1CA3A |
(LENCOMP>%)
|
( comp → %n )
Returns length of composite as a real number.
|
055B7 |
NULLCOMP?
|
( comp → flag )
If the composite is empty, returns TRUE .
|
6321D |
DUPNULLCOMP?
|
( comp → comp flag )
Does DUP then <REF>NULLCOMP?.
|
056B6 |
NTHELCOMP
|
( comp #i → ob T )
( comp #i → F )
Returns specified element of composite and
TRUE , or just FALSE if it could not be found.
|
62B9C |
NTHCOMPDROP
|
( comp #i → ob )
Does <REF>NTHELCOMP then DROP .
|
62D1D |
NTHCOMDDUP
|
( comp #i → ob ob )
Does <REF>NTHCOMPDROP then DUP .
|
71C3B |
rNTHELCOMP
|
( romptr #i → ob T )
( romptr #i → F )
Returns specified element of composite
referenced by the romptr, and TRUE , or just
FALSE if it could not be found.
|
64426 |
POSCOMP
|
( comp ob pred → #i )
( comp ob pred → #0 )
(eg: pred = ' %< )
Evaluates pred for all elements of composite
and ob, and returns index of first object for
which the pred is TRUE . If no one returned
TRUE , returns #0. For example, the program
below returns #4:
:: { %1 %2 %3 %-4 %-5 %6 %7 } %0
' %< POSCOMP ;
|
644A3 |
EQUALPOSCOMP
|
( comp ob → #pos )
( comp ob → #0 )
POSCOMP with EQUAL as test.
|
644BC |
NTHOF
|
( ob comp → #i )
( ob comp → #0 )
Does SWAP then <REF>EQUALPOSCOMP.
|
6448A |
#=POSCOMP
|
( comp # → #i )
( comp # → #0 )
POSCOMP with #= as test.
|
05821 |
SUBCOMP
|
( comp #m #n → comp' )
Returns a sub-composite. Makes all index
checks first.
|
643EF |
matchob?
|
( ob comp → T )
( ob comp → ob F )
Returns TRUE if ob is EQUAL to any element of
the composite.
|
64127 |
Embedded?
|
( ob1 ob2 → flag )
Returns TRUE if ob2 is embedded in, or is the
same as, ob1. Otherwise returns FALSE .
|
644D0 |
Find1stTrue
|
( comp test → ob T )
( comp test → F )
Tests every element for test. The first one
that returns TRUE is put into the stack along
with TRUE . If no object returned TRUE , FALSE
is put into the stack. For example, the
program below returns %-4 and TRUE .
:: { %1 %2 %2 %-4 %-5 %6 } ' %0<
Find1stTrue ;
|
644EE |
Find1stT.1
|
Recursive internal function for Find1stTrue .
|
6452F |
Lookup
|
( ob test comp → nextob T )
( ob test comp → ob F )
Tests every odd element (1,3,...) in the
composite. If a test returns TRUE , the
object after the tested one is returned,
along with TRUE . If no object tests TRUE ,
FALSE is returned. For example, the program
below returns %6 and TRUE .
:: %0 ' %<
{ %1 %2 %3 %-4 %-5 %6 }
Lookup ;
|
64548 |
Lookup.1
|
( ob test → nextob T )
( ob test → ob F )
Return Stack:
( comp → )
Lookup with the composite already pushed
(with >R ) onto the runstream. Called by
Lookup .
|
64593 |
EQLookup
|
( ob comp → nextob T )
( ob comp → ob F )
Lookup with EQ as test.
|
6480B |
NEXTCOMPOB
|
( comp #ofs → comp #ofs' ob T )
( comp #ofs → comp F )
Returns object at specified nibble offset
from start. If the object is SEMI (i.e., the
end of the composite has been reached)
returns FALSE . To get the first element, use
FIVE as offset value (to skip the prolog).
ZERO works as well.
|