# list commands

Usage:

/REQUIRE lisp.tf

These commands operate on lists of words, and are similar to those in lisp. They all give their results with /echo, and are intended to be used in $(...) command substitution to capture the result.

/car list
  Echo first word. (Same as /first).
/cdr list
  Echo all words after first. (Same as /rest).
/cadr list
  Echo second word.
/cddr list
  Echo all words after second.
/caddr list
  Echo third word.
/cdddr list
  Echo all words after third.

/length list
  Echo number of words in list.

/reverse list
  Reverse the order of the words in list.

/mapcar cmd list
  Execute "cmd word" for each word in list.
/maplist cmd list
  Execute "cmd list" repeatedly, removing the first word from list each time, until list is empty.

/remove word list
  Echo list with all occurrences of word removed.

/unique list
  Remove all duplicate words from list. Note: /unique is very slow on long lists.

See: /nth

Back to index
Back to tf home page

Copyright © 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004 Ken Keys