zbasic.hlp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. ZBASIC contains 6 packages --
  2. (1) YLSTS -- useful functions for lists.
  3. (2) YNUMS -- useful functions for numbers.
  4. (3) YSTRS -- useful functions for strings.
  5. (4) YIO -- useful functions for user io.
  6. (5) YCNTRL -- useful functions for program control.
  7. (6) YRARE -- functions we use now, but may eliminate.
  8. YLSTS -- BASIC LIST UTILITIES
  9. CCAR ( X:any ):any
  10. CCDR ( X:any ):any
  11. LAST ( X:list ):any
  12. NTH-CDR ( L:list N:number ):list
  13. NTH-ELT ( L:list N:number ):elt of list
  14. NTH-TAIL( L:list N:number ):list
  15. TAIL-P ( X:list Y:list ):extra-boolean
  16. NCONS ( X:any ): (CONS X NIL)
  17. KWOTE ( X:any ): '<eval of #X>
  18. MKQUOTE ( X:any ): '<eval of #X>
  19. RPLACW ( X:list Y:list ):list
  20. DREMOVE ( X:any L:list ):list
  21. REMOVE ( X:any L:list ):list
  22. DSUBST ( X:any Y:any Z:list ):list
  23. LSUBST ( NEW:list OLD:list X:any ):list
  24. COPY ( X:list ):list
  25. TCONC ( P:list X:any ): tconc-ptr
  26. LCONC ( P:list X:list ):list
  27. CVSET ( X:list ):set
  28. ENTER ( ELT:element SET:list ):set
  29. ABSTRACT( FN:function L:list ):list
  30. EACH ( L:list FN:function ):extra-boolean
  31. SOME ( L:list FN:function ):extra-boolean
  32. INTERSECTION ( SET1:list SET2:list ):extra-boolean
  33. SETDIFFERENCE ( SET1:list SET2:list ):extra-boolean
  34. SUBSET ( SET1:any SET2:list ):extra boolean
  35. UNION ( X:list Y:list ):list
  36. SEQUAL ( X:list Y:list ):extra boolean
  37. MAP2C ( X:list Y:list FN:function ):NIL
  38. MAP2 ( X:list Y:list FN:function ):NIL
  39. ATSOC ( ALST:list, KEY:atom ):any
  40. CCAR( X:any ):any
  41. ----
  42. Careful Car. Returns car of x if x is a list, else NIL.
  43. CCDR( X:any ):any
  44. ----
  45. Careful Cdr. Returns cdr of x if x is a list, else NIL.
  46. LAST( X:list ):any
  47. ----
  48. Returns the last cell in X.
  49. E.g. (LAST '(A B C)) = (C), (LAST '(A B . C)) = C.
  50. NTH-CDR( L:list N:number ):list
  51. -------
  52. Returns the nth cdr of list--0 is the list, 1 the cdr ...
  53. NTH-ELT( L:list N:number ):list
  54. -------
  55. Returns the nth elt of list--1 is the car, 2 the cadr ...
  56. NTH-TAIL( L:list N:number ):list
  57. -------
  58. Returns the nth tail of list--1 is the list, 2 the cdr ...
  59. TAIL-P( X:list Y:list ):extra-boolean
  60. ------
  61. If X is a non-nil tail of Y (X eq cdr Y or cddr Y or...), return X.
  62. Renamed to avoid a conflict with TAILP in compiler
  63. NCONS( X:any ): (CONS X NIL)
  64. -----
  65. Returns (CONS X NIL)
  66. KWOTE( X:any ): '<eval of #X>
  67. MKQUOTE( X:any ): '<eval of #X>
  68. -------
  69. Returns the quoted value of its argument.
  70. RPLACW( X:list Y:list ):list
  71. ------
  72. Destructively replace the Whole list X by Y.
  73. DREMOVE( X:any L:list ):list
  74. -------
  75. Remove destructively all equal occurrances of X from L.
  76. REMOVE( X:any L:list ):list
  77. ------
  78. Return copy of L with all equal occurrences of X removed.
  79. COPY( X:list ):list
  80. ----
  81. Make a copy of X--EQUAL but not EQ (except for atoms).
  82. DSUBST( X:any Y:any Z:list ):list
  83. ------
  84. Destructively substitute copies(??) of X for Y in Z.
  85. LSUBST( NEW:list OLD:list X:any ):list
  86. ------
  87. Substitute elts of NEW (splicing) for the element old in X
  88. TCONC( P:list X:any ): tconc-ptr
  89. -----
  90. Pointer consists of (CONS LIST (LAST LIST)).
  91. Returns (and alters) pointer consisting of (CONS LIST1 (LAST LIST1)),
  92. where LIST1 = (NCONC1 LIST X).
  93. Avoids searching down the list as nconc1 does, by pointing at last elt
  94. of list for nconc1.
  95. To use, setq ptr to (NCONS NIL), tconc elts, return car of ptr.
  96. LCONC( P:list X:list ):list
  97. -----
  98. Same as TCONC, but NCONCs instead of NCONC1s.
  99. CVSET( X:list ):list
  100. --------------------
  101. Converts list to set, i.e., removes redundant elements.
  102. ENTER( ELT:element SET:list ):list
  103. -----
  104. Returns (ELT . SET) if ELT is not member of SET, else SET.
  105. ABSTRACT( FN:function L:list ):list
  106. --------
  107. Returns list of elts of list satisfying FN.
  108. EACH( L:list FN:function ):extra boolean
  109. ----
  110. Returns L if each elt satisfies FN, else NIL.
  111. SOME( L:list FN:function ):extra boolean
  112. ----
  113. Returns the first tail of the list whose CAR satisfies function.
  114. INTERSECTION( #SET1:list #SET2:list ):extra boolean
  115. ------------
  116. Returns list of elts in SET1 which are also members of SET2
  117. SETDIFFERENCE( #SET1:list #SET2:list ):extra boolean
  118. -------------
  119. Returns all elts of SET1 not members of SET2.
  120. SUBSET( #SET1:any #SET2:list ):extra boolean
  121. ------
  122. Returns SET1 if each element of SET1 is a member of SET2.
  123. UNION( X:list Y:list ):list
  124. -----
  125. Returns the union of lists X, Y
  126. SEQUAL( X:list Y:list ):extra boolean
  127. ------
  128. Returns X if X and Y are set-equal: same length and X subset of Y.
  129. MAP2( X:list Y:list FN:function ):NIL
  130. ------
  131. Applies FN (of two arguments) to successive paired tails of X and Y.
  132. MAP2C( X:list Y:list FN:function ):NIL
  133. ------
  134. Applies FN (of two arguments) to successive paired elts of X and Y.
  135. ATSOC( ALST:list, KEY:atom ):any
  136. -----
  137. Like ASSOC, except uses an EQ check. Returns first element of
  138. ALST whose CAR is KEY.
  139. YNUMS -- BASIC NUMBER UTILITIES
  140. ADD1 ( number ):number EXPR
  141. SUB1 ( number ):number EXPR
  142. ZEROP ( any ):boolean EXPR
  143. MINUSP ( number ):boolean EXPR
  144. PLUSP ( number ):boolean EXPR
  145. POSITIVE( X:any ):extra-boolean EXPR
  146. NEGATIVE( X:any ):extra-boolean EXPR
  147. NUMERAL ( X:number/digit/any ):boolean EXPR
  148. GREAT1 ( X:number Y:number ):extra-boolean EXPR
  149. LESS1 ( X:number Y:number ):extra-boolean EXPR
  150. GEQ ( X:number Y:number ):extra-boolean EXPR
  151. LEQ ( X:number Y:number ):extra-boolean EXPR
  152. ODD ( X:integer ):boolean EXPR
  153. SIGMA ( L:list FN:function ):integer EXPR
  154. RAND16 ( ):integer EXPR
  155. IRAND ( N:integer ):integer EXPR
  156. The DEC compiler may optimize calls to PLUS2, DIFFERENCE, EQUAL,
  157. LESSP, etc. by converting them to calls to ADD1, SUB1, ZEROP,
  158. MINUSP, etc. This will create circular defintions in the
  159. conditional defintions, about which the compiler will complain.
  160. Such complaints can be ignored.
  161. ADD1( number ):number EXPR
  162. ----
  163. Note: DEC compiler optimizes (PLUS2 N 1) into (ADD1 N).
  164. SUB1( number ):number EXPR
  165. ----
  166. Note: DEC compiler optimizes (DIFFERENCE N 1) into (SUB1 N).
  167. ZEROP( X:any ):boolean EXPR
  168. -----
  169. Returns non-nil iff X equals 0.
  170. MINUSP( N:number ):boolean EXPR
  171. ------
  172. Returns non-nil iff N is less than 0.
  173. PLUSP( N:number ):boolean EXPR
  174. -----
  175. Returns non-nil iff N is greater than 0.
  176. ODD( X:integer ):boolean EXPR
  177. ---
  178. Returns T if x is odd, else NIL.
  179. WARNING: EVENP is used by REDUCE to test if a list has even
  180. length. ODD and EVENP are thus highly distinct.
  181. POSITIVE( X:any ):boolean EXPR
  182. --------
  183. Returns non-nil iff X is a positive number.
  184. NEGATIVE( X:any ):boolean EXPR
  185. --------
  186. Returns non-nil iff X is a negative number.
  187. NUMERAL( X:any ): boolean EXPR
  188. -------
  189. Returns true for both numbers and digits. Some dialects
  190. had been treating the digits as numbers, and this fn is
  191. included as a replacement for NUMBERP where NUMBERP might
  192. really be checking for digits.
  193. N.B.: Digits are characters and thus ID's
  194. GREAT1( X:number Y:number ):extra-boolean EXPR
  195. ------
  196. Returns X if it is strictly greater than Y, else NIL.
  197. GREATERP is simpler if only T/NIL is needed.
  198. LESS1( X:number Y:number ):extra-boolean EXPR
  199. -----
  200. Returns X if it is strictly less than Y, else NIL
  201. LESSP is simpler if only T/NIL is needed.
  202. GEQ( X:number Y:number ):extra-boolean EXPR
  203. ---
  204. Returns X if it is greater than or equal to Y, else NIL.
  205. LEQ( X:number Y:number ):extra-boolean EXPR
  206. ---
  207. Returns X if it is less than or equal to Y, else NIL.
  208. SIGMA( L:list, FN:function ):integer EXPR
  209. -----
  210. Returns sum of results of applying FN to each elt of LST.
  211. RAND16( ):integer EXPR
  212. IRAND ( N:integer ):integer EXPR
  213. ------
  214. Linear-congruential random-number generator. To avoid dependence
  215. upon the big number package, we are forced to use 16-bit numbers,
  216. which means the generator will cycle after only 2^16.
  217. The randomness obtained should be sufficient for selecting choices
  218. in VOCAL, but not for monte-carlo experiments and other sensitive
  219. stuff.
  220. decimal 14933 = octal 35125, decimal 21749 = octal 52365
  221. Returns a new 16-bit unsigned random integer. Leftmost bits are
  222. most random so you shouldn't use REMAINDER to scale this to range
  223. Scale new random number to range 0 to N-1 with approximately equal
  224. probability. Uses times/quotient instead of remainder to make best
  225. use of high-order bits which are most random
  226. YSTRS -- BASIC STRING UTILITIES
  227. EXPLODEC ( X:any ):char-list EXPR
  228. EXPLODE2 ( X:any ):char-list EXPR
  229. FLATSIZE ( X:str ):integer EXPR
  230. FLATSIZE2( X:str ):integer EXPR
  231. NTHCHAR ( X:str N:number ):char-id EXPR
  232. ICOMPRESS( LST:lst ):<interned id> EXPR
  233. SUBSTR ( STR:str START:num LENGTH:num ):string EXPR
  234. CAT-DE ( L: list of strings ):string EXPR
  235. CAT-ID-DE( L: list of strings ):<uninterned id> EXPR
  236. SSEXPR ( S: string ):<interned id> EXPR
  237. EXPLODE2( X:any ):char-list EXPR
  238. EXPLODEC( X:any ):char-list EXPR
  239. --------
  240. List of characters which would appear in PRIN2 of X. If either
  241. is built into the interpreter, we will use that defintion for both.
  242. Otherwise, the definition below should work, but inefficiently.
  243. Note that this definition does not support vectors and lists.
  244. (The DEC and IBM interpreters support EXPLODE and EXPLODE2 by using
  245. the same internal algorithm that is used for PRIN1 (PRIN2), but put
  246. the chars generated into a list instead of printing them.
  247. Thus, they work on arbitrary s-expressions.)
  248. If either EXPLODEC or EXPLODE2 is defined, the CDE does nothing.
  249. Note: According to the STANDARD LISP REPORT, EXPLODE and EXPLODE2
  250. are only defined for atoms. If your interpreter does not support
  251. extended EXPLODE and EXPLODE2, then change the second CDE's below
  252. for FLATSIZE and FLATSIZE2 to get recursive versions of them.
  253. FLATSIZE( X:any ):integer EXPR
  254. --------
  255. Number of chars in a PRIN1 of X.
  256. Also equals length of list created by EXPLODE of X,
  257. assuming that EXPLODE extends to arbitrary s-expressions.
  258. DEC and IBM interpreters use the same internal algorithm that
  259. is used for PRIN1, but count chars instead of printing them.
  260. If your EXPLODE only works for atoms, comment out the above
  261. CDE and turn the CDE below into DE.
  262. FLATSIZE2( X:any ):integer EXPR
  263. ---------
  264. Number of chars in a PRIN2 of X.
  265. Also equals length of list created by EXPLODE2 of X,
  266. assuming that EXPLODE2 extends to arbitrary s-expressions.
  267. DEC and IBM interpreters use the same internal algorithm that
  268. is used for PRIN2, but count chars instead of printing them.
  269. FLATSIZE will often suffice for FLATSIZE2
  270. If your EXPLODE2 only works for atoms, comment out the CDE above
  271. and turn the CDE below into DE.
  272. NTHCHAR( X:any, N:number ):character-id EXPR
  273. -------
  274. Returns nth character of EXPLODE2 of X.
  275. ICOMPRESS( LST:list ):interned atom EXPR
  276. ---------
  277. Returns INTERN'ed atom made by COMPRESS.
  278. SUBSTR( STR:string START:number LENGTH:number ):string EXPR
  279. ------
  280. Returns a substring of the given LENGTH beginning with the
  281. character at location START in the string.
  282. NB: The first location of the string is 0.
  283. If START or LENGTH is negative, 0 is assumed.
  284. If the length given would exceed the end of the string, the
  285. subtring returned quietly goes to end of string, no error.
  286. CAT-DE( L: list of expressions ):string EXPR
  287. -------
  288. Returns a string made from the concatenation of the prin2 names
  289. of the expressions in the list. Usually called via CAT macro.
  290. CAT-ID-DE( L: list of any ):uninterned id EXPR
  291. -------
  292. Returns an id made from the concatenation of the prin2 names
  293. of the expressions in the list. Usually called via CAT-ID macro.
  294. SSEXPR( S: string ): id EXPR
  295. ------
  296. Returns ID `read' from string. Not very robust.
  297. YIO -- simple I/O utilities. All EXPR's.
  298. CONFIRM (#QUEST: string ):boolean
  299. EATEOL ():NIL
  300. TTY-DE (#L: list ):NIL
  301. TTY-TX-DE (#L: list ):NIL
  302. TTY-XT-DE (#L: list ):NIL
  303. TTY-TT-DE (#L: list ):NIL
  304. TTY-ELT (#X: elt ):NIL
  305. PRINA (#X: any ):NIL
  306. PRIN1SQ (#X: any ):NIL
  307. PRIN2SQ (#X: any ):NIL
  308. PRINCS (#X: single-char-id ):NIL
  309. --queue-code--
  310. SEND ():NIL
  311. SEND-1 (#EE)
  312. ENQUEUE (#FN #ARG)
  313. Q-PRIN1 (#E: any ):NIL
  314. Q-PRINT (#E: any ):NIL
  315. Q-PRIN2 (#E: any ):NIL
  316. Q-TERPRI ()
  317. ONEARG-TERPRI (#E: any ):NIL
  318. Q-TYO (#N: ascii-code ):NIL
  319. Q-PRINC (#C: single-char-id ):NIL
  320. * Q-TTY-DE (#CMDS: list ):NIL
  321. * Q-TTY-XT-DE (#CMDS: list ):NIL
  322. * Q-TTY-TX-DE (#CMDS: list ):NIL
  323. * Q-TTY-TT-DE (#CMDS: list ):NIL
  324. DE CONFIRM (!#QUEST) (PROG (!#ANS) LP0 (TTY!-XT !#QUEST) LP1 (SEND) (
  325. SETQ !#ANS (CAR (EXPLODEC (READ)))) (COND ((EQ !#ANS (QUOTE Y)) (PROGN (
  326. EATEOL) (RETURN T))) ((EQ !#ANS (QUOTE N)) (PROGN (EATEOL) (RETURN NIL))) ((
  327. EQ !#ANS (QUOTE !?)) (GO LP0)) (T (TTY!-XT Please type Y, N or ?.)) (GO
  328. LP1)))
  329. Eat (discard) text until $EOL$ or <ESC> seen.
  330. <ESC> meaningful only on PDP-10 systems.
  331. $EOL$ meaningful only on correctly-implemented Standard-LISP systems.
  332. An idea whose time has not yet come...
  333. DE TTY!-DE (EOLS!#BEFORE !#L EOLS!#AFTER) (PROG (OLD!#CHAN) (SETQ
  334. OLD!#CHAN (WRS NIL)) LP1 (COND ((ONEP EOLS!#BEFORE) (TTY!-ELT !$EOL!$)) ((
  335. ZEROP EOLS!#BEFORE) NIL) (T (PROGN (TTY!-ELT !$EOL!$) (SETQ EOLS!#BEFORE (
  336. SUB1 EOLS!#BEFORE)) (GO LP1)))) (MAPC !#L (FUNCTION TTY!-ELT)) LP1 (COND ((
  337. ONEP EOLS!#AFTER) (TTY!-ELT !$EOL!$)) ((ZEROP EOLS!#AFTER) NIL) (T (PROGN (
  338. TTY!-ELT !$EOL!$) (SETQ EOLS!#AFTER (SUB1 EOLS!#AFTER)) (GO LP2)))) (WRS
  339. OLD!#CHAN)))
  340. So, for now at least, ...
  341. PRINA( X:any ): any
  342. -----
  343. Prin2s expression, after TERPRIing if it is too big for line, or spacing
  344. if it is not at the beginning of a line. Returns the value of X.
  345. Except for the space, this is just PRIN2 in the IBM interpreter.
  346. CHRCT (): <number>
  347. -----
  348. CHaRacter CounT left in line.
  349. Also a CDE in YPP.LSP -- built into IMSSS DEC interpreter.
  350. BINARY (#X: boolean): old-value
  351. ------
  352. Stub for non-IMSSS interpreters.
  353. In IMSSS interpreter, will put terminal into binary mode or
  354. take it out, according to argument, and return old value.
  355. PRIN1SQ (#X: any)
  356. -------
  357. PRIN1, Safe, use apostrophe for Quoted expressions.
  358. This is essentially a PRIN1 which tries not to exceed the right margin.
  359. It exceeds it only in those cases where the pname of a single atom
  360. exceeds the entire linelength. In such cases, <big> is printed at the
  361. terminal as a warning.
  362. (QUOTE xxx) structures are printed in 'xxx form to save space.
  363. Again, this is a little superfluous for the IBM interpreter.
  364. PRIN2SQ (#X: any)
  365. -------
  366. PRIN2, Safe, use apostrophe for Quoted expressions.
  367. Just like PRIN1SQ, but uses PRIN2 as a basis.
  368. PRINCS (#X: single-character-atom)
  369. -------
  370. PRINC Safe. Does a PRINC, but first worries about right margin.
  371. 1980 Jul 24 -- New Queued-I/O routines.
  372. To interface other code to this new I/O method, the following changes
  373. must be made in other code:
  374. PRIN2 --> TTY
  375. TERPRI --> $EOL$ inside a TTY, which causes Q-TERPRI to be called
  376. TYO --> Q-TYO
  377. PRIN1, PRINT -- These are used only for debugging. Do a (SEND) just
  378. before starting to print things in realtime, or use Q-PRIN1 etc.
  379. TTY -- Ok, expands into TTY-DE which calls Q-PRIN2 and Q-TERPRI.
  380. SAY -- I don't know what to do with this crock. It seems to be
  381. a poor substitute for TTY. If so it can be changed to TTY
  382. with the arguments fixed to be correct. <!GRAM>LPARSE.LSP
  383. When *BATCHOUT is NIL, output is done in realtime and *BATCHQUEUE
  384. remains NIL. When *BATCHOUT is true, output is queued and SEND
  385. executes&dequeues it later.
  386. Initialize *BATCHQUEUE for TCONC operations.
  387. Initialize *BATCHMAX and *BATCHCNT
  388. These call PRIN2, so they would cause double-enqueuing.
  389. DE Q!-TTY!-DE (!#CMDS) (COND BATCHOUT (ENQUEUE (QUOTE TTY!-DE) !#CMDS)) (
  390. 1 (TTY!-DE !#CMDS))))
  391. DE Q!-TTY!-XT!-DE (!#CMDS) (COND BATCHOUT (ENQUEUE (QUOTE TTY!-XT!-DE)
  392. !#CMDS)) (1 (TTY!-XT!-DE !#CMDS))))
  393. DE Q!-TTY!-TX!-DE (!#CMDS) (COND BATCHOUT (ENQUEUE (QUOTE TTY!-TX!-DE)
  394. !#CMDS)) (1 (TTY!-TX!-DE !#CMDS))))
  395. DE Q!-TTY!-TT!-DE (!#CMDS) (COND BATCHOUT (ENQUEUE (QUOTE TTY!-TT!-DE)
  396. !#CMDS)) (1 (TTY!-TT!-DE !#CMDS))))
  397. YCNTRL -- ROUTINES INVOLVED WITH PROGRAM CONTROL STRUCTURES
  398. CATCH ( EXP:s-expression LABELS:id or idlist ):any EXPR
  399. THROW ( VALU:any LABEL:id ): error label EXPR
  400. ERRSET-DE ( #EXP #LBL ):any EXPR
  401. APPLY# ( ARG1: function ARG2: argument:list ):any EXPR
  402. BOUND ( X:any ):boolean EXPR
  403. MKPROG ( VARS:id-lst BODY:exp ):prog EXPR
  404. BUG-STOP (): any EXPR
  405. CATCH( EXP:s-expression LABELS:id or idlist ): any EXPR
  406. -----
  407. For use with throw. If no THROW occurs in expression, then
  408. returns value of expression. If thrown label is MEMQ or EQ to
  409. labels, then returns thrown value. OW, thrown label is passed
  410. up higher. Expression should be quoted, as in ERRORSET.
  411. THROW( VALU:any LABEL:id ): error label EXPR
  412. -----
  413. Throws value with label up to enclosing CATCH having label.
  414. If there is no such CATCH, causes error.
  415. ERRSET-DE ( EXP LBL ):any EXPR
  416. Named errset. If error matches label, then acts like errorset.
  417. Otherwise propagates error upward.
  418. Matching: Every label stops errors NIL, $EOF$.
  419. Label 'ERRORX stops any error.
  420. Other labels stop errors whose first arg is EQ to them.
  421. Usually called via ERRSET macro.
  422. APPLY#(ARG1: function ARG2: argument:list): any EXPR
  423. ------
  424. Like APPLY, but can use fexpr and macro functions.
  425. BOUND( X:any ): boolean EXPR
  426. -----
  427. Returns T if X is a bound id.
  428. MKPROG( VARS:id-lst BODY:exp ) EXPR
  429. ------
  430. Makes a prog around the body, binding the vars.
  431. BUGSTOP ():NIL EXPR
  432. -------
  433. Enter a read/eval/print loop, exit when OK is seen.
  434. YRARE -- ROUTINES WHICH ARE USED, BUT OF DUBIOUS USEFULNESS
  435. ?? DELETE THESE ??
  436. LOADV ( V:vector FN:function ):vector EXPR
  437. AMONG ( ALST KEY ITEM ) EXPR
  438. INSERT ( ITEM ALST KEY ) EXPR
  439. DCONS ( X:any Y:list ):list EXPR
  440. SUBLIST ( X:list P1:integer P2:integer ):list EXPR
  441. SUBLIST1( Y ) EXPR
  442. LDIFF ( X:list Y:list ):list EXPR used in editor/copy in ZEDIT
  443. MAPCAR# ( L:list FN:function ):any EXPR
  444. MAP# ( L:list FN:function ):any EXPR
  445. INITIALP( X:list Y:list ):boolean EXPR
  446. SUBLISTP( X:list Y:list ):list EXPR
  447. INITQ ( X:any Y:list R:fn ):boolean EXPR
  448. LOADV( V:vector FN:function ):vector EXPR
  449. -----
  450. Loads vector with values. Function should be 1-place numerical.
  451. V[I] _ FN( I ).
  452. If value of function is 'novalue, then doesn't change value. ??
  453. AMONG(ALST:association-list KEY:atom ITEM:atom):boolean EXPR
  454. -----
  455. Tests if item is found under key in association list.
  456. Uses EQUAL tests.
  457. INSERT (ITEM:item ALST:association:list KEY:any):association list
  458. ------
  459. EXPR (destructive operation on ALST)
  460. Inserts item in association list under key or if key not present
  461. adds (KEY ITEM) to the ALST.
  462. DCONS( X:any Y:list ):list EXPR
  463. -----
  464. Destructively cons x to list.
  465. SUBLIST( X:list P1:integer P2:integer ):list EXPR
  466. -------
  467. Returns sublist from p1 to p2 positions, negatives counting from end.
  468. I.e., (SUBLIST '(A B C D E) 2 -2) = (B C D)
  469. LDIFF( X:list Y:list ):list EXPR
  470. -----
  471. If X is a tail of Y, returns the list difference of X and Y,
  472. a list of the elements of Y preceeding X.
  473. MAPCAR#( L:list FN:function ):any EXPR
  474. -------
  475. Extends mapcar to work on general s-expressions as well as lists.
  476. The return is of same form, i.e.
  477. (MAPCAR# 'ATOM '(A B C . D)) = (T T T . T)
  478. Also, if for any member of list the variable SPLICE is set to
  479. true by function, then for that member the return from the
  480. function is spliced into the return.
  481. MAP#( L:list FN:function ):any EXPR
  482. ----
  483. Extends map to work on general s-expressions as well as lists.
  484. INITIALP( X:list Y:list ):boolean EXPR
  485. --------
  486. Returns T if X is EQUAL to some ldiff of Y.
  487. SUBLISTP( X:list Y:list ):list EXPR
  488. --------
  489. Returns a tail of Y (or T) if X is a sublist of Y.
  490. INITQ( X:any Y:list R:fn ):boolean EXPR
  491. -----
  492. Returns T if x is an initial portion of Y under the relation R.