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

2.9.1 General Operations

0521F &COMP ( comp comp' → comp" )
Concatenates two composites.
052FA >TCOMP ( comp ob → comp+ob )
Adds ob to tail (end) of composite.
08E33 (#>TCOMP+1) ( comp # → comp&# #+1 )
Adds bint to tail of composite and increases bint by one
052C6 >HCOMP ( comp ob → ob+comp )
Adds ob to head (beginning) of composite.
2949D (!>HCOMP) ( comp ob → ob+comp )
Tries do to >HCOMP in place???
294CF (!>HCOMPcopy) ( comp ob → ob+comp )
Calls <REF>!PTR>HCOMP if <REF>INHARDROM?, otherwise does >TOPTEMP on both args and then <REF>!?HCOMP.
29501 (!&HCOMP) ( comp ob → ob+comp )
>HCOMP in place?
295BA (!PTR>HCOMP) ( comp PTR → PTR+comp )
Can be used if PTR is in HARDROM.
39C8B (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.
361C6 ?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.
2825E (TWONTHCOMPDROP) ( comp → ob2 )
Gets the second element of composite.
2BC006 ^LASTCOMP ( comp → ob )
Gets the last element of composite. Does <REF>DUPLENCOMP then <REF>NTHCOMPDROP.
0567B LENCOMP ( comp → #n )
Returns length of composite (number of objects).
3627A DUPLENCOMP ( comp → comp #n )
Does DUP then <REF>LENCOMP.
055B7 NULLCOMP? ( comp → flag )
If the composite is empty, returns TRUE.
36266 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.
35BC3 NTHCOMPDROP ( comp #i → ob )
Does <REF>NTHELCOMP then DROP.
35D58 NTHCOMDDUP ( comp #i → ob ob )
Does <REF>NTHCOMPDROP then DUP.
376EE 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 ;
3776B EQUALPOSCOMP ( comp ob → #pos )
( comp ob → #0 )
POSCOMP with EQUAL as test.
37784 NTHOF ( ob comp → #i )
( ob comp → #0 )
Does SWAP then <REF>EQUALPOSCOMP.
0FD006 ^ListPos ( ob {} → #i / #0 )
Equivalent to NTHOF, but faster. However, it only works for lists.
37752 #=POSCOMP ( comp # → #i )
( comp # → #0 )
POSCOMP with #= as test.
05821 SUBCOMP ( comp #m #n → comp' )
Returns a sub-composite. Makes all index checks first.
376B7 matchob? ( ob comp → T )
( ob comp → ob F )
Returns TRUE if ob is EQUAL to any element of the composite.
371B3 Embedded? ( ob1 ob2 → flag )
Returns TRUE if ob2 is embedded in, or is the same as, ob1. Otherwise returns FALSE.
37798 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 ;
25F2C Find1stT.1
Recursive internal function for Find1stTrue.
377C5 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 ;
377DE 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.
37829 EQLookup ( ob comp → nextob T )
( ob comp → ob F )
Lookup with EQ as test.
37B54 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