newfx: append and prepend variants

db4
Eduardo Cavazos 2008-07-03 12:17:27 -05:00
parent ff3b1cf350
commit a1a252320a
1 changed files with 16 additions and 1 deletions

View File

@ -159,6 +159,11 @@ METHOD: as-mutate { object object assoc } set-at ;
: prefix-on ( elt seq -- seq ) swap prefix ;
: suffix-on ( elt seq -- seq ) swap suffix ;
: suffix! ( seq elt -- seq ) over sequences:push ;
: suffix-on! ( elt seq -- seq ) tuck sequences:push ;
: suffixed! ( seq elt -- ) swap sequences:push ;
: suffixed-on! ( elt seq -- ) sequences:push ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: subseq ( seq from to -- subseq ) rot sequences:subseq ;
@ -222,3 +227,13 @@ METHOD: as-mutate { object object assoc } set-at ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: invert-index ( seq i -- seq i ) >r dup length 1 - r> - ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: append! ( a b -- ab ) over sequences:push-all ;
: append-to! ( b a -- ab ) swap over sequences:push-all ;
: appended! ( a b -- ) swap sequences:push-all ;
: appended-to! ( b a -- ) sequences:push-all ;
: prepend! ( a b -- ba ) over append 0 pick copy ;
: prepended! ( a b -- ) over append 0 rot copy ;