/[cvsroot]/skandha4/info/slisp-7
ViewVC logotype

Contents of /skandha4/info/slisp-7

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue May 25 09:39:17 1999 UTC (21 years, 5 months ago) by jsp
Branch: biostr, MAIN
CVS Tags: skandha4, skandha4_1_6, dsg_1_0, HEAD
Branch point for: skandha4_pub, autoconf
Changes since 1.1: +0 -0 lines
ANSI C version of Skandha4


1 This is Info file slisp, produced by Makeinfo version 1.68 from the
2 input file slisp.texi.
3
4 This file documents slisp, (skandha-lisp), an extendable xlisp.
5
6 Copyright @copyright 1994 University of Washington Digital Anatomist
7 Program by Jeff Prothero (jsp@biostr.washington.edu) and Jim Brinkley
8 See slisp/SLISPCOPYING for details
9
10 
11 File: slisp, Node: defvar, Next: delete, Prev: defun, Up: Xlisp Language Reference
12
13 defvar
14 ======
15
16 defvar
17 type: defined macro (closure)
18 location: extension
19 source file: init.lsp
20 Common LISP compatible: similar
21 supported on: all machines
22
23 SYNTAX
24
25 (defvar <symbol> [ <init-value> ] )
26 <symbol> - an expression evaluating to a symbol
27 <init-value> - an optional initial value expression
28
29 DESCRIPTION
30
31 The DEFVAR macro defines a user variable with the name <symbol>. If
32 <symbol> did not already exist, the <symbol> is created with the initial
33 value NIL. If the optional <init-value> expression is present, the new
34 <symbol> will be set to the <init-value>. If <symbol> did exist, its
35 previous value will be left untouched. DEFVAR returns the <symbol> as
36 its result.
37
38 EXAMPLES
39
40 (boundp 'mvyar) ; returns NIL - doesn't exist
41 (defvar myvar) ; returns MYVAR
42 (boundp 'myvar) ; returns T
43 (setq myvar 7) ; returns 7
44 (defvar myvar) ; returns MYVAR
45 myvar ; returns 7 - was not initialized
46 (defvar myvar 99) ; returns MYVAR
47 myvar ; returns 7 - was not initialized
48
49 BUG: In Common LISP, the definition of DEFVAR is such that it
50 returns the <symbol> as its result. XLISP returns the value of
51 <symbol>.
52
53 COMMON LISP COMPATIBILITY: Common LISP supports an additional
54 optional parameter. This parameter is a documentation string. XLISP
55 does not support this.
56
57 NOTE: The functions DEFVAR, DEFPARAMETER and DEFCONSTANT are created
58 in the INIT.LSP file. If it does not exist in your XLISP system, you
59 might be having a problem with INIT.LSP. Before you start XLISP, look
60 in the directory you are currently in, and check to see if there is an
61 INIT.LSP.
62
63
64
65 
66 File: slisp, Node: delete, Next: delete-if, Prev: defvar, Up: Xlisp Language Reference
67
68 delete
69 ======
70
71 delete
72 type: function (subr)
73 location: built-in
74 source file: xllist.c
75 Common LISP compatible: similar
76 supported on: all machines
77
78 SYNTAX
79
80 (delete <expr> <list> [ { :test | :test-not } <test> ] )
81 <expr> - the expression to delete from <list>
82 <list> - the list to DESTRUCTIVELY modify
83 <test> - optional test function (default is EQL)
84
85 DESCRIPTION
86
87 DELETE destructively modifies the <list> by removing the <expr>. The
88 destructive aspect of this operation means that the actual symbol value
89 is used in the list-modifying operations - not a copy. If <expr>
90 appears multiple times in the <list>, all occurances will be removed.
91 <list> must evaluate to a valid list. An atom for <list> will result in
92 an error. Having NIL for <list> will return a NIL as the result. You
93 may specify your own test with the :TEST and :TEST-NOT keywords.
94
95 EXAMPLES
96
97 (delete 'b NIL) ; returns NIL
98 (delete 'b '(a b b c b)) ; returns (A C)
99 (setq a '(1 2 3)) (setq b a) ; set up A and B
100 (delete '2 a) ; returns (1 3)
101 (print a) ; prints (1 3) A IS MODIFIED!
102 (print b) ; prints (1 3) B IS MODIFIED!
103 (delete '(b) '((a)(b)(c))) ; returns ((A) (B) (C))
104 ; EQL doesn't work on lists
105 (delete '(b) '((a)(b)(c)) :test 'equal) ; returns ((A) (C))
106
107 NOTE: The DELETE function can work with a list or string as the
108 <expr>. However, the default EQL test does not work with lists or
109 strings, only symbols and numbers. To make this work, you need to use
110 the :TEST keyword along with EQUAL for <test>.
111
112 COMMON LISP COMPATIBILITY: XLISP does not support the :FROM-END,
113 :START, :END, :COUNT and :KEY keywords which Common LISP does.
114
115
116
117 
118 File: slisp, Node: delete-if, Next: delete-if-not, Prev: delete, Up: Xlisp Language Reference
119
120 delete-if
121 =========
122
123 delete-if
124 type: function (subr)
125 location: built-in
126 source file: xllist.c
127 Common LISP compatible: similar
128 supported on: all machines
129
130 SYNTAX
131
132 (delete-if <test> <list> )
133 <test> - the test function to be performed
134 <list> - the list to delete from
135
136 DESCRIPTION
137
138 DELETE-IF destructively modifies the <list> by removing the elements
139 of the <list> that pass the <test>. The destructive aspect of this
140 operation means that the actual symbol value is used in the
141 list-modifying operations - not a copy. <list> must evaluate to a valid
142 list. An atom for <list> will result in an error. Having NIL for
143 <list> will return a NIL as the result.
144
145 EXAMPLES
146
147 (setq mylist '(1 2 3 4 5 6 7 8)) ; set up a list
148 (delete-if 'oddp mylist) ; returns (2 4 6 8)
149 (print mylist) ; prints (2 4 6 8)
150 ; note that MYLIST is affected
151 (setq mylist '(a nil b nil c)) ; set up a list
152 (delete-if 'null mylist) ; returns (A B C)
153
154 BUG: DELETE-IF will return the proper value, but it does not always
155 properly modify the symbol containing the value. This seems to be
156 true if the first element of the <list> passes the test (and should be
157 deleted).
158
159 COMMON LISP COMPATIBILITY: XLISP does not support the :FROM-END,
160 :START, :END, :COUNT and :KEY keywords which Common LISP does.
161
162
163
164 
165 File: slisp, Node: delete-if-not, Next: digit-char, Prev: delete-if, Up: Xlisp Language Reference
166
167 delete-if-not
168 =============
169
170 delete-if-not
171 type: function (subr)
172 location: built-in
173 source file: xllist.c
174 Common LISP compatible: similar
175 supported on: all machines
176
177 SYNTAX
178
179 (delete-if-not <test> <list> )
180 <test> - the test function to be performed
181 <list> - the list to delete from
182
183 DESCRIPTION
184
185 DELETE-IF-NOT destructively modifies the <list> by removing the
186 elements of the <list> that fail the <test>. The destructive aspect of
187 this operation means that the actual symbol value is used in the
188 list-modifying operations - not a copy. <list> must evaluate to a valid
189 list. An atom for <list> will result in an error. Having NIL for
190 <list> will return a NIL as the result.
191
192 EXAMPLES
193
194 (setq mylist '(1 2 3 4 5 6 7 8)) ; set up a list
195 (delete-if-not 'oddp mylist) ; returns (1 3 5 7)
196 (print mylist) ; prints (1 3 5 7)
197 ; note that MYLIST is affected
198 (setq mylist '(a nil b nil c)) ; set up a list
199 (delete-if-not 'null mylist) ; returns (NIL NIL)
200
201 BUG: DELETE-IF-NOT will return the proper value, but it does not
202 always properly modify the symbol containing the value. This seems to
203 be true if the first element of the <list> fails the test (and should be
204 deleted).
205
206 COMMON LISP COMPATIBILITY: XLISP does not support the :FROM-END,
207 :START, :END, :COUNT and :KEY keywords which Common LISP does.
208
209
210
211 
212 File: slisp, Node: digit-char, Next: digit-char-p, Prev: delete-if-not, Up: Xlisp Language Reference
213
214 digit-char
215 ==========
216
217 digit-char
218 type: function (subr)
219 location: built-in
220 source file: xlstr.c
221 Common LISP compatible: similar
222 versions: all machines
223
224 SYNTAX
225
226 (digit-char <int> )
227 <int> - an integer expression
228
229 DESCRIPTION
230
231 The DIGIT-CHAR function takes an integer expression <int> and
232 converts it into a decimal digit character. So, an integer value of 0
233 produces the character #\0. An integer value of 1 produces the
234 character #\1 and so on. If a valid character can be produce it is
235 returned, otherwise a NIL is returned.
236
237 EXAMPLES
238
239 (digit-char 0) ; returns #\0
240 (digit-char 9) ; returns #\9
241 (digit-char 10) ; returns NIL
242
243 COMMON LISP COMPATIBILITY: Common LISP supports the use of an
244 optional radix parameter. This option specifies numeric base. This
245 allows the DIGIT-CHAR to function properly for hexadecimal digits (for
246 example). Common LISP supports up to base 36 radix systems. XLISP
247 does not support this radix parameter. Common LISP also supports a
248 font parameter which XLISP does not.
249
250
251
252 
253 File: slisp, Node: digit-char-p, Next: do, Prev: digit-char, Up: Xlisp Language Reference
254
255 digit-char-p
256 ============
257
258 digit-char-p
259 type: predicate function (subr)
260 location: built-in
261 source file: xlstr.c
262 Common LISP compatible: similar
263 versions: all machines
264
265 SYNTAX
266
267 (digit-char-p <char> )
268 <char> - a character expression
269
270 DESCRIPTION
271
272 The DIGIT-CHAR-P predicate checks if the <char> expression is a
273 numeric digit. If <char> is numeric digit a T is returned, otherwise a
274 NIL is returned. Decimal digits are '0' (ASCII decimal value 48)
275 through '9' (ASCII decimal value 57).
276
277 EXAMPLES
278
279 (digit-char-p #\0) ; returns T
280 (digit-char-p #\9) ; returns T
281 (digit-char-p #\A) ; returns NIL
282 (digit-char-p #\a) ; returns NIL
283 (digit-char-p #\.) ; returns NIL
284 (digit-char-p #\-) ; returns NIL
285 (digit-char-p #\+) ; returns NIL
286
287 NOTE: Other non-digit characters used in numbers are NOT included:
288 plus (+), minus (-), exponent (e or E) and decimal point (.).
289
290 COMMON LISP COMPATIBILITY: Common LISP supports the use of an
291 optional radix parameter. This option specifies numeric base. This
292 allows the DIGIT-CHAR-P to function properly for hexadecimal digits
293 (for example). Common LISP supports up to base 36 radix systems.
294 XLISP does not support this radix parameter.
295
296
297
298 
299 File: slisp, Node: do, Next: do*, Prev: digit-char-p, Up: Xlisp Language Reference
300
301 do
302 ==
303
304 do
305 type: special form (fsubr)
306 location: built-in
307 source file: xlcont.c
308 Common LISP compatible: yes
309 supported on: all machines
310
311 SYNTAX
312
313 (do ( [ <binding> ... ] ) ( <done-expr> [ <result> ] ) [ <expr> ... ] )
314 <binding> - a variable binding which is can take one of
315 the following forms:
316 <symbol>
317 ( <symbol> <init-expr> [<step-expr>] )
318 <symbol> - a symbol
319 <init-expr> - an initialization expression for <symbol>
320 <step-expr> - an expression that <symbol> symbol is updated
321 at the end of each loop
322 <done-expr> - iteration ends when this returns non-NIL value
323 <result> - an optional expression for the returned result
324 <expr> - expressions comprising the body of the loop
325 which may contain RETURNs, GOs or tags for GO
326
327 DESCRIPTION
328
329 The DO special form is basically a 'while' looping construct that
330 contains symbols (with optional initializations and updates), a loop
331 test (with an optional return value) and a block of code (expressions)
332 to evaluate. The DO form evaluates its initializations and updates in
333 no specified order (as opposed to DO* which does it in sequential
334 order). The sequence of these events is:
335
336 <init-expr> execution
337 while not <done-expr> do
338 loop code execution
339 <step-expr> execution
340 end-while
341 return <result>
342
343 The first form after the DO is the 'binding' form. It contains a
344 series of <symbol>'s or <binding>'s. The <binding> is a <symbol>
345 followed by an initialization expression <init-expr> and an optional
346 <step-expr>. If there is no <init-expr>, the <symbol> will be
347 initialized to NIL. There is no specification as to the order of
348 execution of the bindings or the step expressions - except that they
349 happen all together.
350
351 The DO form will go through and create and initialize the symbols.
352 This is followed by evaluating the <done-expr>. If <done-expr> returns
353 a non-NIL value, the loop will terminate. If <done-expr> returns a NIL
354 value then the DO will sequentially execute the <expr>'s. After
355 execution of the loop <expr>'s, the <symbol>'s are set to the
356 <step-expr>'s (if the <step-expr>'s exist). Then, the <done-expr> is
357 re-evaluated, and so on.... The value of the <result> expression is
358 evaluated and returned. If no <result> is specified, NIL is returned.
359 When the DO is finished execution, the <symbol>'s that were defined will
360 no longer exist or retain their values.
361
362 EXAMPLES
363
364 (do (i) ; DO loop with var I
365 ((eql i 0) "done") ; test and result
366 (print i) (setq i 0) (print i)) ; prints NIL 0
367 ; returns "done"
368 (do (i) ; DO loop with var I
369 ((eql i 0)) ; test but no result
370 (print i) (setq i 0) (print i)) ; prints NIL 0
371 ; returns NIL
372 (do ; DO loop
373 ((i 0 (setq i (1+ i))) ; var I=0 increment by 1
374 (j 10 (setq j (1- j))) ) ; var J=10 decrement by 1
375 ((eql i j) "met in the middle" ) ; test and result
376 (princ i) (princ " ") ; prints 0 10
377 (princ j) (terpri)) ; 1 9
378 ; 2 8
379 ; 3 7
380 ; 4 6
381 ; returns "met in the middle"
382
383
384
385 
386 File: slisp, Node: do*, Next: dolist, Prev: do, Up: Xlisp Language Reference
387
388 do*
389 ===
390
391 do*
392 type: special form (fsubr)
393 location: built-in
394 source file: xlcont.c
395 Common LISP compatible: yes
396 supported on: all machines
397
398 SYNTAX
399
400 (do* ( [ <binding> ... ] ) ( <test-expr> [ <result> ] ) [ <expr> ... ] )
401 <binding> - a variable binding which is can take one of
402 the following forms:
403 <symbol>
404 ( <symbol> <init-expr> [<step-expr>] )
405 <symbol> - a symbol
406 <init-expr> - an initialization expression for <symbol>
407 <step-expr> - an expression that <symbol> symbol is updated
408 at the end of each loop
409 <test-expr> - an expression to test for loop termination
410 <result> - an optional expression for the returned result
411 <expr> - expressions comprising the body of the loop
412 which may contain RETURNs, GOs or tags for GO
413
414 DESCRIPTION
415
416 The DO* special form is basically a 'while' looping construct that
417 contains symbols (with optional initializations and updates), a loop
418 test (with an optional return value) and a block of code (expressions)
419 to evaluate. The DO* form evaluates its initializations and updates in
420 sequential order (as opposed to DO which doesn't). The sequence of
421 these events is:
422
423 <init-expr> execution
424 while <test-expr> do
425 loop code execution
426 <step-expr> execution
427 end-while
428 return <result>
429
430 The first form after the DO* is the 'binding' form. It contains a
431 series of <symbol>'s or <binding>'s. The <binding> is a <symbol>
432 followed by an initialization expression <init-expr> and an optional
433 <step-expr>. If there is no <init-expr>, the <symbol> will be
434 initialized to NIL. There is no specification as to the order of
435 execution of the bindings or the step expressions - except that they
436 happen all together.
437
438 The DO* form will go through and create and initialize the symbols.
439 This is followed by evaluating the <test-expr>. If <test-expr> returns
440 a non-NIL value, the loop will terminate. If <test-expr> returns a NIL
441 value then the DO* will sequentially execute the <expr>'s. After
442 execution of the loop <expr>'s, the <symbol>'s are set to the
443 <step-expr>'s (if the <step-expr>'s exist). Then, the <test-expr> is
444 re-evaluated, and so on.... The value of the <result> expression is
445 evaluated and returned. If no <result> is specified, NIL is returned.
446 When the DO* is finished execution, the <symbol>'s that were defined
447 will no longer exist or retain their values.
448
449 EXAMPLES
450
451 (do ; DO example - won't work
452 ((i 0) ; var I=0
453 (j i) ) ; var J=I (won't work)
454 ( (eql i j) "done") ; test and result
455 (print "looping")) ; error: unbound variable - I
456 ;
457 (do* ; DO* example - will work
458 ((i 0) ; var I=0
459 (j i) ) ; var J=I (proper exec. order)
460 ( (eql i j) "done") ; test and result
461 (print "looping")) ; returns "done"
462 (do* (i) ; DO* loop with var I
463 ((eql i 0) "done") ; test and result
464 (print i) (setq i 0) (print i)) ; prints NIL 0
465 ; returns "done"
466 (do* (i) ; DO* loop with var I
467 ((eql i 0)) ; test but no result
468 (print i) (setq i 0) (print i)) ; prints NIL 0
469 ; returns NIL
470 (do* ; DO* loop
471 ((i 0 (setq i (1+ i))) ; var I=0 increment by 1
472 (j 10 (setq j (1- j))) ) ; var J=10 decrement by 1
473 ((eql i j) "met in the middle" ) ; test and result
474 (princ i) (princ " ") ; prints 0 10
475 (princ j) (terpri)) ; 1 9
476 ; 2 8
477 ; 3 7
478 ; 4 6
479 ; returns "met in the middle"
480
481
482
483 
484 File: slisp, Node: dolist, Next: dotimes, Prev: do*, Up: Xlisp Language Reference
485
486 dolist
487 ======
488
489 dolist
490 type: special form (fsubr)
491 location: built-in
492 source file: xlcont.c
493 Common LISP compatible: yes
494 supported on: all machines
495
496 SYNTAX
497
498 (dolist ( <symbol> <list-expr> [ <result> ] ) [ <expr> ... ] )
499 <symbol> - a symbol
500 <list-expr> - a list expression
501 <result> - an optional expression for the returned result
502 <expr> - expressions comprising the body of the loop
503 which may contain RETURNs, GOs or tags for GO
504
505 DESCRIPTION
506
507 The DOLIST special form is basically a list-oriented 'for' looping
508 construct that contains a loop <symbol>, a <list-expr> to draw values
509 from, an optional return value and a block of code (expressions) to
510 evaluate. The sequence of execution is:
511
512 <symbol> := CAR of <list-expr>
513 temp-list := CDR of <list-expr>
514 while temp-list is not empty
515 loop code execution
516 <symbol> := CAR of temp-list
517 temp-list := CDR of temp-list
518 end-while
519 return <result>
520
521 The main loop <symbol> will take on successive values from
522 <list-expr>. The DOLIST form will go through and create and initialize
523 the <symbol>. After execution of the loop <expr>'s, the <symbol> is
524 set to the next value in the <list-expr>. This continues until the
525 <list-expr> has been exhausted. The value of the <result> expression
526 is evaluated and returned. If no <result> is specified, NIL is
527 returned. When the DOLIST is finished execution, the <symbol> that was
528 defined will no longer exist or retain its value. If the <list-expr>
529 is an empty list, then no loop execution takes place and the <result>
530 is returned.
531
532 EXAMPLES
533
534 (dolist (i () "done") ; DOLIST with I loop variable
535 (print "here")) ; an empty list
536 ; and a return value
537 ; returns "done"
538 (dolist (x '(a b c) "fini") ; DOLIST with X loop variable
539 (princ x)) ; a list with (A B C)
540 ; and a return value
541 ; prints ABC returns "fini"
542 (dolist (y '(1 2 3)) ; DOLIST with Y loop variable
543 (princ (* y y))) ; a list with (1 2 3)
544 ; and no return value
545 ; prints 149 returns NIL
546 ; returns "met in the middle"
547
548
549
550 
551 File: slisp, Node: dotimes, Next: dribble, Prev: dolist, Up: Xlisp Language Reference
552
553 dotimes
554 =======
555
556 dotimes
557 type: special form (fsubr)
558 location: built-in
559 source file: xlcont.c
560 Common LISP compatible: yes
561 supported on: all machines
562
563 SYNTAX
564
565 (dotimes ( <symbol> <end-expr> [ <result> ] ) [ <expr> ... ] )
566 <symbol> - a symbol
567 <end-expr> - an integer expression
568 <result> - an optional expression for the returned result
569 <expr> - expressions comprising the body of the loop
570 which may contain RETURNs, GOs or tags for GO
571
572 DESCRIPTION
573
574 The DOTIMES special form is basically a 'for' looping construct that
575 contains a loop <symbol>, an <end-expr> to specify the final value for
576 <symbol>, an optional return value and a block of code (expressions) to
577 evaluate. The sequence of execution is:
578
579 <symbol> := 0
580 while <symbol> value is not equal to <end-expr> value
581 loop code execution
582 <symbol> := <symbol> + 1
583 end-while
584 return <result>
585
586 The main loop <symbol> will take on successive values from zero to
587 (<end-expr> - 1). The DOTIMES form will go through and create and
588 initialize the <symbol> to zero. After execution of the loop <expr>'s,
589 the <symbol> value is incremented. This continues until the <symbol>
590 value is equal to <end-expr>. The value of the <result> expression is
591 evaluated and returned. If no <result> is specified, NIL is returned.
592 When the DOTIMES is finished execution, the <symbol> that was defined
593 will no longer exist or retain its value. If the <end-expr> is zero or
594 less, then there will be no execution of the loop body's code.
595
596 EXAMPLES
597
598 (dotimes (i 4 "done") (princ i)) ; prints 0123 returns "done"
599 (dotimes (i 4) (princ i)) ; prints 0123 returns NIL
600 (dotimes (i 1) (princ i)) ; prints 0 returns NIL
601 (dotimes (i 0) (princ i)) ; returns NIL
602 (dotimes (i -9) (princ i)) ; returns NIL
603
604
605
606 
607 File: slisp, Node: dribble, Next: endp, Prev: dotimes, Up: Xlisp Language Reference
608
609 dribble
610 =======
611
612 dribble
613 type: function (subr)
614 location: built-in
615 source file: xlisp.c xlsys.c msstuff.c
616 Common LISP compatible: yes
617 supported on: all machines
618
619 SYNTAX
620
621 (transcript [ <file-str> ] )
622 <file-str> - a string expression for a file name
623
624 DESCRIPTION
625
626 The DRIBBLE function, when called with a <file-str> argument, opens
627 the specified file and records a transcript of the XLISP session. When
628 DRIBBLE is called with no <file-str> argument, it closes the current
629 transcript file (if any). DRIBBLE will return T if the specified
630 <file-str> was successfully opened. It will return a NIL if the
631 <file-str> was not opened successfully or if DRIBBLE was evaluated to
632 close a transcript.
633
634 EXAMPLES
635
636 (dribble "my-trans-file") ; open file "my-trans-file"
637 ; for a session transcript
638 (+ 2 2)
639 (dribble) ; close the transcript
640
641 NOTE: It is also possible to start a transcript when invoking XLISP.
642 To start xlisp with a transcript file of 'myfile' type in "xlisp
643 -tmyfile".
644
645 NOTE: The DRIBBLE function works in XLISP 2.0 for MS-DOS systems.
646 However, depending on the sources you use - or where you got XLISP 2.0,
647 the generic (non-DOS) systems might not have the appropriate code for
648 DRIBBLE to work properly.
649
650
651
652 
653 File: slisp, Node: endp, Next: eq, Prev: dribble, Up: Xlisp Language Reference
654
655 endp
656 ====
657
658 endp
659 type: predicate function (subr)
660 location: built-in
661 source file: xlbfun.c
662 Common LISP compatible: yes
663 supported on: all machines
664
665 SYNTAX
666
667 (endp <list> )
668 <list> - the list to check
669
670 DESCRIPTION
671
672 The ENDP predicate checks to see if <list> is an empty list. T is
673 returned if the list is empty, NIL is returned if the <list> is not
674 empty. The <list> has to be a valid list. An error is returned if it
675 is not a list.
676
677 EXAMPLES
678
679 (endp '()) ; returns T - empty list
680 (endp ()) ; returns T - still empty
681 (endp '(a b c)) ; returns NIL
682 (setq a NIL) ; set up a variable
683 (endp a) ; returns T - value = empty list
684 (endp "a") ; error: bad argument type - "a"
685 (endp 'a) ; error: bad argument type - A
686
687 NOTE: The ENDP predicate is different from the NULL and NOT
688 predicates in that it requires a valid list.
689
690
691
692 
693 File: slisp, Node: eq, Next: eql, Prev: endp, Up: Xlisp Language Reference
694
695 eq
696 ==
697
698 eq
699 type: predicate function (subr)
700 location: built-in
701 source file: xllist.c and xlsubr.c
702 Common LISP compatible: yes
703 supported on: all machines
704
705 SYNTAX
706
707 (eq <expr1> <expr2> )
708 <exprN> - an expression to compare
709
710 DESCRIPTION
711
712 The EQ predicate checks to see if <expr1> and <expr2> are identical.
713 T is returned if they are exactly the same internal value, NIL is
714 returned otherwise.
715
716 EXAMPLES
717
718 (eq 'a 'a) ; returns T
719 (eq 1 1) ; returns T
720 (eq 1 1.0) ; returns NIL
721 (eq 1.0 1.0) ; returns NIL
722 (eq "a" "a") ; returns NIL
723 (eq '(a b) '(a b)) ; returns NIL
724 (eq 'a 34) ; returns NIL
725 (setq a '(a b)) ; set value of A to (A B)
726 (setq b a) ; set B to point to A's value
727 (setq c '(a b)) ; set value of C to dif. (A B)
728 (eq a b) ; returns T
729 (eq a c) ; returns NIL
730
731
732
733 
734 File: slisp, Node: eql, Next: equal, Prev: eq, Up: Xlisp Language Reference
735
736 eql
737 ===
738
739 eql
740 type: predicate function (subr)
741 location: built-in
742 source file: xllist.c and xlsubr.c
743 Common LISP compatible: yes
744 supported on: all machines
745
746 SYNTAX
747
748 (eql <expr1> <expr2> )
749 <exprN> - an expression to compare
750
751 DESCRIPTION
752
753 The EQL predicate checks to see if <expr1> and <expr2> are identical
754 (in the EQ test sense - the expression values being the same exact
755 internal values) or if they have the same value when the expressions
756 are numbers. T is returned if they are identical or have the same
757 numeric value, NIL is returned otherwise.
758
759 EXAMPLES
760
761 (eql 'a 'a) ; returns T
762 (eql 1 1) ; returns T
763 (eql 1 1.0) ; returns NIL
764 (eql 1.0 1.0) ; returns T
765 (eql "a" "a") ; returns NIL
766 (eql '(a b) '(a b)) ; returns NIL
767 (eql 'a 34) ; returns NIL
768 (setq a '(a b)) ; set value of A to (A B)
769 (setq b a) ; set B to point to A's value
770 (setq c '(a b)) ; set value of C to dif. (A B)
771 (eql a b) ; returns T
772 (eql a c) ; returns NIL
773
774
775
776 
777 File: slisp, Node: equal, Next: error, Prev: eql, Up: Xlisp Language Reference
778
779 equal
780 =====
781
782 equal
783 type: predicate function (subr)
784 location: built-in
785 source file: xllist.c and xlsubr.c
786 Common LISP compatible: yes
787 supported on: all machines
788
789 SYNTAX
790
791 (equal <expr1> <expr2> )
792 <exprN> - an expression to compare
793
794 DESCRIPTION
795
796 The EQUAL predicate checks to see if <expr1> and <expr2> are
797 structurally equivalent. T is returned if they are equivalent, NIL is
798 returned otherwise.
799
800 EXAMPLES
801
802 (equal 'a 'a) ; returns T
803 (equal 1 1) ; returns T
804 (equal 1 1.0) ; returns NIL
805 (equal 1.0 1.0) ; returns T
806 (equal "a" "a") ; returns T
807 (equal '(a b) '(a b)) ; returns T
808 (equal 'a 34) ; returns NIL
809 (setq a '(a b)) ; set value of A to (A B)
810 (setq b a) ; set B to point to A's value
811 (setq c '(a b)) ; set value of C to dif. (A B)
812 (equal a b) ; returns T
813 (equal a c) ; returns T
814 (equal '(a b) '(A B)) ; returns T
815 (equal '(a b) '(c d)) ; returns NIL
816 (equal "a" "A") ; returns NIL
817 (equal "abc" "abcD") ; returns NIL
818
819 NOTE: A way to view EQUAL is that if <expr1> and <expr2> were
820 printed (via PRINT or PRINC), if they look the same, then EQUAL will
821 return T.
822
823
824
825 
826 File: slisp, Node: error, Next: *error-output*, Prev: equal, Up: Xlisp Language Reference
827
828 error
829 =====
830
831 error
832 type: function (subr)
833 location: built-in
834 source file: xlbfun.c and xldbug.c
835 Common LISP compatible: similar
836 supported on: all machines
837
838 SYNTAX
839
840 (error <err-msg> [ <arg> ] )
841 <err-msg> - a string expression for the error message
842 <arg> - an optional expression
843
844 DESCRIPTION
845
846 The ERROR function allows the generation of a non-correctable error.
847 A non-correctable error requires evaluation of a CLEAN-UP or TOP-LEVEL
848 function from within the XLISP break loop to return to normal execution.
849 The form of the message generated is:
850
851 error: <err-msg> - <arg>
852
853 From within the break-loop, if a CONTINUE function is evaluated then
854 a an error message is generated - "error: this error can't be
855 continued". There is no return from the ERROR function.
856
857 EXAMPLES
858
859 (error "fee" "fi") ; ERROR generates the message -
860 ; error: fee - "fi"
861 (error "can't get" "there") ; ERROR generates the message -
862 ; error: Can't get - "there"
863
864 COMMON LISP COMPATIBILITY: Common LISP and XLISP have the same basic
865 form and style for ERROR. However, the <err-msg> string in Common LISP
866 is sent to FORMAT. FORMAT is a output function that takes in format
867 strings that include control information. Although, XLISP does have
868 the FORMAT function, it is not used with error messages. Porting from
869 XLISP to Common LISP will work fine. When porting from Common LISP to
870 XLISP, you will need to check for this embedded control information in
871 the error messages.
872
873 NOTE: Remember that *BREAKENABLE* needs to non-NIL for ERROR and
874 CERROR and system errors to be caught by the normal system break loop.
875 If *BREAKENABLE* is NIL, ERROR and CERROR and system errors can be
876 caught by an ERRSET form. If there is no surrounding ERRSET, no error
877 message is generated and the break loop is not entered.
878
879
880
881 
882 File: slisp, Node: *error-output*, Next: errset, Prev: error, Up: Xlisp Language Reference
883
884 *error-output*
885 ==============
886
887 *error-output*
888 type: system variable
889 location: built-in
890 source file: xlinit.c xlio.c
891 Common LISP compatible: yes
892 supported on: all machines
893
894 SYNTAX
895
896 *error-output*
897
898 DESCRIPTION
899
900 *ERROR-OUTPUT* is a system variable that contains a file pointer that
901 points to the file where all error output goes to. The default file for
902 *ERROR-OUTPUT* is the system standard error device - normally the
903 screen.
904
905 EXAMPLES
906
907 *error-output* ; returns #<File-Stream: #243de>
908
909 NOTE: *TRACE-OUTPUT*, *DEBUG-IO* and *ERROR-OUTPUT* are normally all
910 set to the same file stream - STDERR.
911
912
913
914 
915 File: slisp, Node: errset, Next: eval, Prev: *error-output*, Up: Xlisp Language Reference
916
917 errset
918 ======
919
920 errset
921 type: special form (fsubr)
922 location: built-in
923 source file: xlcont.c
924 Common LISP compatible: no
925 supported on: all machines
926
927 SYNTAX
928
929 (errset <expr> [ <print-flag> ] )
930 <expr> - an expression to be evaluated
931 <print-flag> - an optional expression ( NIL or non-NIL )
932
933 DESCRIPTION
934
935 The ERRSET special form is a mechanism that allows the trapping of
936 errors within the execution of <expr>. *BREAKENABLE* must be set to NIL
937 for the ERRSET form to function. If *BREAKENABLE* is non-NIL, the
938 normal break loop will handle the error. For ERRSET, if no error occurs
939 within <expr>, the value of the last expression is CONSed with NIL. If
940 an error occurs within <expr>, the error is caught by ERRSET and a NIL
941 is returned from ERRSET. If <print-flag> is NIL, the error message
942 normally generated by <expr> will not be printed. If <print-flag> is
943 non-NIL or not present in the ERRSET form, the error message will be
944 printed.
945
946 Errors from ERROR and CERROR and system errors will be handled
947 by ERRSET. Note that the CERROR message will only include the
948 error message portion, not the continue message portion. BREAK
949 is not intercepted by ERRSET.
950
951 EXAMPLES
952
953 (nodebug) ; sets *BREAKENABLE* to NIL
954 (errset (error "hi" "ho")) ; prints error: hi - "ho"
955 ; returns NIL
956 (errset (cerror "hi" "ho" "he")) ; prints error: ho - "he"
957 ; returns NIL
958 (errset (error "hey" "ho") NIL) ; returns NIL
959 (errset (break "hey")) ; break: hey
960 (errset (+ 1 5) ) ; returns (6)
961 (errset (+ 1 "a") NIL ) ; returns NIL
962 (debug) ; re-enable break-loop on errors
963
964 NOTE: Be sure to set *BREAKENABLE* to NIL before using ERRSET and to
965 non-NIL after using ERRSET. If you don't reset *BREAKENABLE*, no
966 errors will be reported.
967
968
969
970 
971 File: slisp, Node: eval, Next: evalhook, Prev: errset, Up: Xlisp Language Reference
972
973 eval
974 ====
975
976 eval
977 type: function (subr)
978 location: built-in
979 source file: xlbfun.c and xleval.c
980 Common LISP compatible: yes
981 supported on: all machines
982
983 SYNTAX
984
985 (eval <expression> )
986 <expression> - An arbitrary expression
987
988 DESCRIPTION
989
990 EVAL evaluates the <expression> and returns the resulting value.
991
992 EXAMPLES
993
994 (eval '(+ 2 2)) ; returns 4
995 (eval (cons '+ '(2 2 2))) ; returns 6
996 (eval (list '+ '2 '3 )) ; returns 5
997 (setq a 10) ; set up A with value 10
998 (setq b 220) ; set up B with value 220
999 (eval (list '+ a b )) ; returns 230 because
1000 ; (list '+ a b) => '(+ 10 220)
1001 (eval (list '+ 'a b)) ; returns 230 because
1002 ; (list '+ 'a b) => '(+ A 220)
1003 ; and A has the value 10
1004
1005
1006
1007 
1008 File: slisp, Node: evalhook, Next: *evalhook*, Prev: eval, Up: Xlisp Language Reference
1009
1010 evalhook
1011 ========
1012
1013 evalhook
1014 type: function (subr)
1015 location: built-in
1016 source file: xlbfun.c and xleval.c
1017 Common LISP compatible: related
1018 supported on: all machines
1019
1020 SYNTAX
1021
1022 (evalhook <expr> <eval-expr> <apply-expr> [ <env> ] )
1023 <expr> - an expression to evaluate
1024 <eval-expr> - an expression for the evaluation routine
1025 <apply-expr> - an expression for APPLY - not used
1026 <env> - an environment expression - default is NIL
1027
1028 DESCRIPTION
1029
1030 EVALHOOK is a function that performs evaluation. The routine
1031 specified by <eval-expr> is called with the <expr> and <env>
1032 parameters. If <eval-expr> is NIL, then the normal system evaluator is
1033 called. The <apply-hook> is a dummy parameter that is not used in the
1034 current XLISP system. The <expr> contains the expression to be
1035 evaluated. If the <env> argument to EVALHOOK is not specified, NIL is
1036 used, which specifies to use the current global environment. The
1037 <env>, if specified, is a structure composed of dotted pairs
1038 constructed of the symbol and its value which have the form ((( (<sym1>
1039 . <val1> ) (<sym2> . <val2> ) ... ))).
1040
1041 EXAMPLES
1042
1043 (setq a 100) (setq b 200) ; set up global values
1044 (evalhook '(+ a b) NIL NIL) ; returns 300 - no <env>
1045 (evalhook '(+ a b) NIL NIL ; eval with a=1 and b=2
1046 '((((a . 1)(b . 2))))) ; returns 3
1047 (defun myeval (exp env) ; define MYEVAL routine
1048 (princ "exp: ") (print exp) ;
1049 (princ "env: ") (print env) ;
1050 (evalhook exp #'myeval NIL env)) ;
1051 (defun foo (a) (+ a a)) ; create simple function
1052 (setq *evalhook* #'myeval) ; and install MYEVAL as hook
1053 (foo 1) ; prints
1054 ; exp: (FOO 1) env:NIL
1055 ; exp: 1 env:NIL
1056 ; exp: (+ A A) env:((((A . 1))))
1057 ; exp: A env:((((A . 1))))
1058 ; exp: A env:((((A . 1))))
1059 ; returns 2
1060 (top-level) ; to clean up *evalhook*)
1061
1062 NOTE: The EVALHOOK function and *EVALHOOK* system variable are very
1063 useful in the construction of debugging facilities within XLISP. The
1064 TRACE and UNTRACE functions use EVALHOOK and *EVALHOOK* to implement
1065 their functionality. The other useful aspect of EVALHOOK and
1066 *EVALHOOK* is to help in understanding how XLISP works to see the
1067 expressions, their environment and how they are evaluated.
1068
1069 CAUTION: Be careful when using *EVALHOOK* and EVALHOOK. If you put
1070 in a 'bad' definition into *EVALHOOK*, you might not be able to do
1071 anything and will need to exit XLISP.
1072
1073 UNUSUAL BEHAVIOUR: The EVALHOOK function and *EVALHOOK* system
1074 variable, by their nature, cause some unusual things to happen. After
1075 you have set *EVALHOOK* to some non-NIL value, your function will be
1076 called. However, when you are all done and set *EVALHOOK* to NIL or
1077 some other new routine, it will never be set. This is because the
1078 XEVALHOOK function (in the xlbfun.c source file) saves the old value of
1079 *EVALHOOK* before calling your routine, and then restores it after the
1080 evaluation. The mechanism to reset *EVALHOOK* is to execute the
1081 TOP-LEVEL function, which sets *EVALHOOK* to NIL.
1082
1083
1084
1085 
1086 File: slisp, Node: *evalhook*, Next: evenp, Prev: evalhook, Up: Xlisp Language Reference
1087
1088 *evalhook*
1089 ==========
1090
1091 *evalhook*
1092 type: system variable
1093 location: built-in
1094 source file: xleval.c
1095 Common LISP compatible: related
1096 supported on: all machines
1097
1098 SYNTAX
1099
1100 *evalhook*
1101
1102 DESCRIPTION
1103
1104 *EVALHOOK* is a system variable whose value is user code that will
1105 intercept evaluations either through normal system evaluation or through
1106 calls to EVALHOOK. The default value for *EVALHOOK* is NIL, which
1107 specifies to use the built in system evaluator. If *EVALHOOK* is
1108 non-NIL, the routine is called with expression and environment
1109 parameters. If the environment argument is NIL, then the the current
1110 global environment is used. The environment, if non-NIL, is a structure
1111 composed of dotted pairs constructed of the symbol and its value which
1112 have the form ((( (<sym1> . <val1> ) (<sym2> . <val2> ) ... ))).
1113
1114 EXAMPLES
1115
1116 (defun myeval (exp env) ; define MYEVAL routine
1117 (princ "exp: ") (print exp) ;
1118 (princ "env: ") (print env) ;
1119 (evalhook exp #'myeval NIL env)) ;
1120 (defun foo (a) (+ a a)) ; create simple function
1121 (setq *evalhook* #'myeval) ; and install MYEVAL as hook
1122 (foo 1) ; prints
1123 ; exp: (FOO 1) env:NIL
1124 ; exp: 1 env:NIL
1125 ; exp: (+ A A) env:((((A . 1))))
1126 ; exp: A env:((((A . 1))))
1127 ; exp: A env:((((A . 1))))
1128 ; returns 2
1129 (top-level) ; to clean up *evalhook*)
1130
1131 NOTE: The EVALHOOK function and *EVALHOOK* system variable are very
1132 useful in the construction of debugging facilities within XLISP. The
1133 TRACE and UNTRACE functions use EVALHOOK and *EVALHOOK* to implement
1134 their functionality. The other useful aspect of EVALHOOK and
1135 *EVALHOOK* is to help in understanding how XLISP works to see the
1136 expressions, their environment and how they are evaluated.
1137
1138 CAUTION: Be careful when using *EVALHOOK* and EVALHOOK. If you put
1139 in a 'bad' definition into *EVALHOOK*, you might not be able to do
1140 anything and will need to exit XLISP.
1141
1142 UNUSUAL BEHAVIOUR: The EVALHOOK function and *EVALHOOK* system
1143 variable, by their nature, cause some unusual things to happen. After
1144 you have set *EVALHOOK* to some non-NIL value, your function will be
1145 called. However, when you are all done and set *EVALHOOK* to NIL or
1146 some other new routine, it will never be set. This is because the
1147 XEVALHOOK function (in the xlbfun.c source file) saves the old value of
1148 *EVALHOOK* before calling your routine, and then restores it after the
1149 evaluation. The mechanism to reset *EVALHOOK* is to execute the
1150 TOP-LEVEL function, which sets *EVALHOOK* to NIL.
1151
1152
1153
1154 
1155 File: slisp, Node: evenp, Next: exit, Prev: *evalhook*, Up: Xlisp Language Reference
1156
1157 evenp
1158 =====
1159
1160 evenp
1161 type: predicate function (subr)
1162 location: built-in
1163 source file: xlmath.c
1164 Common LISP compatible: yes
1165 supported on: all machines
1166
1167 SYNTAX
1168
1169 (evenp <expr> )
1170 <expr> - the integer numeric expression to check
1171
1172 DESCRIPTION
1173
1174 The EVENP predicate checks to see if the number <expr> is even. T is
1175 returned if the number is even, NIL is returned otherwise. A bad
1176 argument type error is generated if the <expr> is not a numeric
1177 expression. A bad floating point operation is generated if the <expr>
1178 is a floating point number. Zero is an even number.
1179
1180 EXAMPLES
1181
1182 (evenp 0) ; returns T
1183 (evenp 1) ; returns NIL
1184 (evenp 2) ; returns T
1185 (evenp -1) ; returns NIL
1186 (evenp -2) ; returns T
1187 (evenp 14.0) ; error: bad flt. pt. op.
1188 (evenp 'a) ; error: bad argument type
1189 (setq a 2) ; set value of A to 2
1190 (evenp a) ; returns T
1191
1192
1193
1194 
1195 File: slisp, Node: exit, Next: exp, Prev: evenp, Up: Xlisp Language Reference
1196
1197 exit
1198 ====
1199
1200 exit
1201 type: function (subr)
1202 location: built-in
1203 source file: xlsys.c
1204 Common LISP compatible: yes
1205 supported on: all machines
1206
1207 SYNTAX
1208
1209 (exit)
1210
1211 DESCRIPTION
1212
1213 The EXIT function causes the current XLISP session to be terminated.
1214 It never returns.
1215
1216 EXAMPLES
1217
1218 (exit) ; never returns
1219
1220 KEYSTROKE EQUIVALENT: In the IBM PC and MS-DOS versions of XLISP, a
1221 CTRL-z key sequence has the same effect as doing a (EXIT). On
1222 a Macintosh, this can be accomplished by a pull-down menu or a
1223 COMMAND-q.
1224
1225 NOTE: When XLISP is EXITed, any TRANSCRIPT file is automatically
1226 closed. However, other open files are not closed, and so may lose some
1227 information.
1228
1229
1230
1231 
1232 File: slisp, Node: exp, Next: expand, Prev: exit, Up: Xlisp Language Reference
1233
1234 exp
1235 ===
1236
1237 exp
1238 type: function (subr)
1239 location: built-in
1240 source file: xlmath.c
1241 Common LISP compatible: yes
1242 supported on: all machines
1243
1244 SYNTAX
1245
1246 (exp <power> )
1247 <power> - floating point number/expression
1248
1249 DESCRIPTION
1250
1251 The EXP function calculates e (2.7128) raised to the specified
1252 <power> and returns the result.
1253
1254 EXAMPLES
1255
1256 (exp 0.0) ; returns 1
1257 (exp 1.0) ; returns 2.71828 (e)
1258 (exp 2.0) ; returns 7.38906
1259 (exp 10.0) ; returns 22026.5
1260 (exp 0) ; error: bad integer operation
1261
1262 NOTE: EXP with a large <power> like 1000.0 causes an incorrect value
1263 to be generated, with no error. The returned value will be a very large
1264 floating point number near the computer's limit (something like
1265 1.79000e+308).
1266
1267
1268
1269 
1270 File: slisp, Node: expand, Next: expt, Prev: exp, Up: Xlisp Language Reference
1271
1272 expand
1273 ======
1274
1275 expand
1276 type: function (subr)
1277 location: built-in
1278 source file: xlsys.c and xldmem.c
1279 Common LISP compatible: no
1280 supported on: all machines
1281
1282 SYNTAX
1283
1284 (expand <segments> )
1285 <segments> - an integer expression
1286
1287 DESCRIPTION
1288
1289 The EXPAND function expands memory by the specified number of
1290 <segments>. The expression <segments> is returned as the result. The
1291 power up default is 1000 nodes per segment. Note that ALLOC allows you
1292 to change the number of nodes per segment.
1293
1294 EXAMPLES
1295
1296 (room) ; prints Nodes: 8000
1297 ; Free nodes: 5622
1298 ; Segments: 6
1299 ; Allocate: 1000
1300 ; Total: 92586
1301 ; Collections: 8
1302 ; returns NIL
1303 (expand 2) ; add more nodes
1304 (room) ; prints Nodes: 10000
1305 ; Free nodes: 7608
1306 ; Segments: 8
1307 ; Allocate: 1000
1308 ; Total: 112602
1309 ; Collections: 8
1310 ; returns NIL
1311
1312 NOTE: When GC is called or an automatic garbage collection occurs,
1313 if the amount of free memory is still low after the garbage collection,
1314 the system attempts to add more segments (an automatic EXPAND).
1315
1316
1317

brinkley@uw.edu
ViewVC Help
Powered by ViewVC 1.1.26