[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
What I've put in /Tools/T/UTILS
- To: T-Discussion at YALE
- Subject: What I've put in /Tools/T/UTILS
- From: Chris Riesbeck <Riesbeck at YALE>
- Date: Mon ,8 Jun 82 10:38:00 EDT
Here are the TLisp utility functions I've generated so far for T on
the Apollo. None have been compiled yet, due to problems with
readmacros and macro subfunctions, but I'll get around to it Real Soon
Now. None of this satisifies reasonable documentation standards, but
Meehan's New UCI Lisp Manual and TLISP:TLISP.DOC describe almost
everything.
Functions names are taken from TLisp, except when this led to conflict
with T. Suggestions for new names are welcome, but less than 20
characters and 4 non-alphabetics please!
In UTILS.T:
ADD1 and SUB1 -- until they appear in T for real
APPEND1 -- (APPEND1 list exp) = (APPEND list (LIST exp))
APPEND1! -- APPEND1! list exp) = (NCONC list (LIST exp))
ATCAT -- (ATCAT -exps-) returns an atom formed by concatenating the
print representations of all the -exps-.
CONSP -- (CONSP exp) = (AND (LIST? exp) exp)
:= -- a macro for assignment like SET but with user hooks for new data
structures; from Artificial Intelligence Programming
CONS! -- (CONS! exp list) = (PUSH list exp)
LDIFF -- (LDIFF list1 list2) returns the portion of list1 before
list2, if list2 is a tail of list1
LOOP -- (LOOP (INITIAL -(var val inc)-)
(BEFORE -exps-)
(WHILE exp)
(DO -exps-)
(NEXT -(var val)-)
(UNTIL exp)
(AFTER -exps-)
(RESULT exp)
We really need to resolve, at least with new names, the clash
between this LOOP and Nix's in NEWLOOP.
The syntax of of INITIAL and NEXT has changed, and the semantics
of INITIAL is now like MacLisp's DO. TLISP_TO_T is aware of
this and tries to do the safe thing when translating LOOPs.
PRELIST -- (PRELIST list n) returns first n elements of list.
SUFLIST -- (SUFLIST list n) drops the first n elements from list.
MSG -- (MSG -cmds-) is a general print utility, an alternative to FORMAT
In MORE_MAPS.T:
MAPCAN -- (MAPCAN fn -lists-) applies fn in parallel to elements of
the lists, splices the answers together with NCONC.
SUBSET -- (SUBSET fn -lists-) applies fn in parallel to elements of
the lists, returns all elements of the first list for which
fn returns true.
In FOR.T:
FOR -- (FOR -(var IN list)-
(WHEN -exps-)
(DO | FILTER | SAVE | SPLICE | UNTIL | WHILE -exps-)
This is the FOR used in CS 472. It expands into various
mapping functions, including MAPCAN and SUBSET. Multiples
expressions are implicitly BLOCKed.
-------