HELP ALLBUTCUT Steve Leach Nov 99 allbutcut( A, B, S:seq ) -> T:seq This procedure returns a sequence with the A'th to B'th elements removed. It takes a pair of indices A and B and a sequence S and returns a sequence of the same type T. A sequence is any word list or vectorclass object, such as a string or a vector. The name "allbutcut" comes from the fact that it is a kind of inverse to the "cut" procedure. "Cut" returns the subsequence from the A'th to B'th element whereas "allbutcut" chops them out. (Note that you can use HELP * SPLICE to put T back where you found it!) For example : allbutcut( 2, 3, [ a b c d e ] ) => ** [a d e] : allbutcut( 5, 7, 'alpha beta' ) => ** alpheta : allbutcut( 1, 3, { foo bar gort trog } ) => ** {foo bar gort} Just as in HELP * CUT, a special feature is that A and B may be negative, representing indexes from the END of the sequence. i.e. -1 is the last element, -2 is the second to last element, and so on up to -length( S ) which is the first element! (This handy idiom is adapted from the language Python, incidentally.) To learn more about the range of indices allowed, you should read the details in HELP * CUT. Here are some examples :- : allbutcut( 2, -1, [ a b c d e ] ) => ** [a] : allbutcut( 5, -2, 'alpha beta' ) => ** alpha : allbutcut( 1, -3, { foo bar gort trog } ) => ** {gort trog} Lastly, A or B can be . They default to 1 and -1 respectively. : allbutcut( 2, false, [ a b c d e ] ) => ** [a] : allbutcut( false, false, 'alpha beta' ) => ** : allbutcut( false, -3, { foo bar gort trog } ) => ** {gort trog} Expert programmers should note that -allbutcut- does not always return a copy. In fact it often returns a shared object. -- See Also ------------------------------------------------------------- HELP * ALLBUTFIRST HELP * ALLBUTLAST HELP * CUT HELP * SPLICE HELP * SUBSTRING