[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.8.1 General Operations

059D3 &COMP ( comp comp' → comp" )
Concatenates two composites.
05AAE >TCOMP ( comp ob → comp+ob )
Adds ob to tail (end) of composite.
05A7A >HCOMP ( comp ob → ob+comp )
Adds ob to head (beginning) of composite.
05842 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.
0FA65 ?CARCOMP ( comp T → ob )
( comp F → comp )
If the flag is TRUE, does CARCOMP.
0590C 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.
05E34 LENCOMP ( comp → #n )
Returns length of composite (number of objects).
0FB19 DUPLENCOMP ( comp → comp #n )
Does DUP then <REF>LENCOMP.
05D70 NULLCOMP? ( comp → flag )
If the composite is empty, returns TRUE.
0FB05 DUPNULLCOMP? ( comp → comp flag )
Does DUP then <REF>NULLCOMP?.
05E6F NTHELCOMP ( comp #i → ob T )
( comp #i → F )
Returns specified element of composite and TRUE, or just FALSE if it could not be found.
0F476 NTHCOMPDROP ( comp #i → ob )
Does <REF>NTHELCOMP then DROP.
0F5F7 NTHCOMDDUP ( comp #i → ob ob )
Does <REF>NTHCOMPDROP then DUP.
0ED0F 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 ;
108DF EQUALPOSCOMP ( comp ob → #pos )
( comp ob → #0 )
POSCOMP with EQUAL as test.
108DF EQUALPOSCMP ( comp ob → #pos )
( comp ob → #0 )
108F8 NTHOF ( ob comp → #i )
( ob comp → #0 )
Does SWAP then <REF>EQUALPOSCOMP.
108C6 #=POSCOMP ( comp # → #i )
( comp # → #0 )
POSCOMP with #= as test.
05FDA SUBCOMP ( comp #m #n → comp' )
Returns a sub-composite. Makes all index checks first.
0E8C2 Embedded? ( ob1 ob2 → flag )
Returns TRUE if ob2 is embedded in, or is the same as, ob1. Otherwise returns FALSE.
0EDF0 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 ;
0EE09 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.
1090C EQLookup ( ob comp → nextob T )
( ob comp → ob F )
Lookup with EQ as test.
0F15A 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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Carsten Dominik on May, 30 2005 using texi2html