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

Contents of /skandha4/info/slisp-14

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue May 25 09:39:14 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: subseq, Next: subst, Prev: sublis, Up: Xlisp Language Reference
12
13 subseq
14 ======
15
16 subseq
17 type: function (subr)
18 location: built-in
19 source file: xlstr.c
20 Common LISP compatible: similar
21 supported on: all machines
22
23 SYNTAX
24
25 (subseq <string> <start> [ <end> ] )
26 <string> - a string expression
27 <start> - an integer expression
28 <end> - an integer expression
29
30 DESCRIPTION
31
32 The SUBSEQ function extracts a substring from <string> starting with
33 the <start> offset and ending with the <end> offset. The <start>
34 offset has a origin or 0. The substring is returned.
35
36 EXAMPLES
37
38 (subseq "12345678" 0) ; returns "12345678"
39 (subseq "12345678" 2) ; returns "345678"
40 (subseq "12345678" 2 4) ; returns "34"
41 (subseq "1234" 3) ; returns "4"
42 ;
43 (subseq "1234" 4) ; returns ""
44 (subseq "1234" 4 2) ; returns ""
45 (subseq "1234" 5) ; error: string index out of
46 ; bounds - 5
47
48 COMMON LISP COMPATIBILITY: The SUBSEQ in Common LISP is intended to
49 return a portion of a sequence - a SUBSEQuence. This function operates
50 on lists and vectors (one-dimensional arrays of data) - basically
51 ordered data. Strings are just one of the valid types operated on by
52 SUBSEQ in Common LISP. The XLISP SUBSEQ function only operates on
53 strings.
54
55
56
57 
58 File: slisp, Node: subst, Next: symbol-name, Prev: subseq, Up: Xlisp Language Reference
59
60 subst
61 =====
62
63 subst
64 type: function (subr)
65 location: built-in
66 source file: xllist.c
67 Common LISP compatible: similar
68 supported on: all machines
69
70 SYNTAX
71
72 (subst <new-expr> <old-expr> <expr> [ { :test | :test-not } <test> ] )
73 <old-expr> - the expression to search for
74 <new-expr> - the expression to replace <old-expr> with
75 <expr> - the expression to substitute within - atom/list
76 <test> - optional test function (default is EQL)
77
78 DESCRIPTION
79
80 SUBST searches through an <expr> and replaces each of the <old-expr>
81 elements with the <new-expr>. The <expr> with the substitutions (if
82 any) is returned. You may specify your own test with the :TEST and
83 :TEST-NOT keywords followed by the test you which to perform.
84
85 EXAMPLES
86
87 (subst 'new 'old '(old mid dif)) ; returns (NEW MID DIF)
88 (subst '(a) 'old '(old mid dif)) ; returns ((A) MID DIF)
89 (subst "a" 'old '(old mid dif)) ; returns ("a" MID DIF)
90 ;
91 (defun mytest (x y) (princ x)(princ " "); define a test function
92 (princ y)(terpri) ; that prints the arguments
93 T ) ; and always returns TRUE
94 (subst 'a 'b '(a b c d) :test 'mytest) ; prints (A B C D) B returns A
95 (subst 'a 'b '(a b) :test-not 'mytest) ; prints (A B) B
96 ; A B
97 ; (B) B
98 ; B B
99 ; NIL B returns (A B)
100
101 NOTE: The SUBST function can work with a list or string as the
102 <expr>. However, the default EQL test does not work with lists or
103 strings, only symbols and numbers. To make this work, you need to use
104 the :TEST keyword along with EQUAL for <test>.
105
106 COMMON LISP COMPATIBILITY: Common LISP supports the use of the :KEY
107 keyword which specifies a function that is applied to each element of
108 <expr> before it is tested. XLISP does not support this.
109
110
111
112 
113 File: slisp, Node: symbol-name, Next: symbol-plist, Prev: subst, Up: Xlisp Language Reference
114
115 symbol-name
116 ===========
117
118 symbol-name
119 type: function (subr)
120 location: built-in
121 source file: xlbfun.c
122 Common LISP compatible: yes
123 supported on: all machines
124
125 SYNTAX
126
127 (symbol-name <symbol> )
128 <symbol> - an expression that evaluates to a symbol name
129
130 DESCRIPTION
131
132 The SYMBOL-NAME function takes the <symbol> expression and returns
133 the printable string of the <symbol>. If the <symbol> had not existed,
134 then it will be created and INTERNed into the system symbol table
135 *OBARRAY* - but with it's value unbound and an empty property list.
136
137 EXAMPLES
138
139 (symbol-name 'foo) ; returns "FOO"
140 (symbol-name 'gleep) ; returns "GLEEP"
141 ;
142 (setq my-symbol 'flop) ; define MY-SYMBOL
143 (symbol-name my-symbol) ; returns "FLOP"
144
145
146
147 
148 File: slisp, Node: symbol-plist, Next: symbol-value, Prev: symbol-name, Up: Xlisp Language Reference
149
150 symbol-plist
151 ============
152
153 symbol-plist
154 type: function (subr)
155 location: built-in
156 source file: xlbfun.c
157 Common LISP compatible: yes
158 supported on: all machines
159
160 SYNTAX
161
162 (symbol-plist <symbol> )
163 <symbol> - the symbol name with a property list
164
165 DESCRIPTION
166
167 SYMBOL-PLIST returns the actual property list from the <symbol>. The
168 <symbol> must be an existing, bound variable, but it does not need to
169 have anything in it's property list.
170
171 Property lists are lists attached to any user defined variables.
172 The lists are in the form of (name1 val1 name2 val2 ....). Any
173 number of properties may be attached to a single variable.
174
175 EXAMPLES
176
177 (setq person 'bobby) ; create a var with a value
178 (putprop person 'boogie 'last-name) ; add a LAST-NAME property
179 (putprop person 'disc-jockey 'job) ; add a JOB property
180 (putprop person '(10 20 30) 'stats) ; add a STATS list
181 (symbol-plist person) ; returns the property list:
182 ; (STATS (10 20 30)
183 ; JOB DISC-JOCKEY
184 ; LAST-NAME BOOGIE)
185
186
187
188 
189 File: slisp, Node: symbol-value, Next: symbolp, Prev: symbol-plist, Up: Xlisp Language Reference
190
191 symbol-value
192 ============
193
194 symbol-value
195 type: function (subr)
196 location: built-in
197 source file: xlbfun.c
198 Common LISP compatible: yes
199 supported on: all machines
200
201 SYNTAX
202
203 (symbol-value <symbol> )
204 <symbol> - an expression that evaluates to a symbol name
205
206 DESCRIPTION
207
208 The SYMBOL-VALUE function takes the <symbol> expression and returns
209 the current value of the <symbol>.
210
211 If the <symbol> had not existed, then it will be created and INTERNed
212 into the system symbol table *OBARRAY* - but with it's value unbound and
213 an empty property list. In this case of a previously non-existant
214 <symbol>, since it has no bound value, the SYMBOL-VALUE will still
215 report an error due to an unbound variable.
216
217 EXAMPLES
218
219 (setq myvar 55) ; set MYVAR to value 55
220 (symbol-value 'myvar) ; returns 55
221 ;
222 (symbol-value 'floop) ; error: unbound variable
223 ;
224 (setq my-symbol 'a) ; set MY-SYMBOL to A
225 (setq a '(contents of symbol a)) ; set A to value -
226 ; (CONTENTS OF SYMBOL A)
227 (symbol-value my-symbol) ; returns (CONTENTS OF SYMBOL A)
228
229
230
231 
232 File: slisp, Node: symbolp, Next: system, Prev: symbol-value, Up: Xlisp Language Reference
233
234 symbolp
235 =======
236
237 symbolp
238 type: predicate function (subr)
239 location: built-in
240 source file: xllist.c
241 Common LISP compatible: yes
242 supported on: all machines
243
244 SYNTAX
245
246 (symbolp <expr> )
247 <expr> - the expression to check
248
249 DESCRIPTION
250
251 The SYMBOLP predicate checks if an <expr> is a valid symbol. T is
252 returned if <expr> is a symbol, NIL is returned otherwise. An <expr>
253 that evaluates to an integer, function (subr or otherwise), and so on is
254 not a symbol. However, the quoted (un-evaluated) name of these objects
255 (like 'MYARRAY) is a valid symbol.
256
257 EXAMPLES
258
259 (symbolp (make-symbol "a")) ; returns T - symbol
260 (symbolp 'a) ; returns T - symbol
261 ;
262 (symbolp #(1 2 3)) ; returns NIL - array
263 (symbolp (lambda (x) (print x))) ; returns NIL - closure
264 (symbolp *standard-output*) ; returns NIL - stream
265 (symbolp 1.2) ; returns NIL - float
266 (symbolp 2) ; returns NIL - integer
267 (symbolp object) ; returns NIL - object
268 (symbolp "hi") ; returns NIL - string
269 ;
270 (symbolp #'car) ; returns NIL - subr
271 (symbolp 'car) ; returns T - it is a symbol now
272 (symbolp '2) ; returns NIL - not a symbol
273
274
275
276 
277 File: slisp, Node: system, Next: t, Prev: symbolp, Up: Xlisp Language Reference
278
279 system
280 ======
281
282 system
283 type: function (subr)
284 location: system extenstion
285 source file: msstuff.c and osdefs.h and osptrs.h
286 Common LISP compatible: no
287 supported on: MS-DOS compatibles
288
289 SYNTAX
290
291 (system <command> )
292 <command> - the OS command string to be executed
293
294 DESCRIPTION
295
296 The SYSTEM function will send the <command> string to the underlying
297 operating system for execution. After execution of the <command>, the
298 SYSTEM function will return a T result if the <command> was successful.
299 If the <command> was not successful, the numeric error code will be
300 returned. Any output from the <command> execution will not be put in
301 the transcript file.
302
303 EXAMPLES
304
305 (system "dir") ; do a PC directory listing
306 (system "mycmd") ; execute a special command
307
308 NOTE: This function is an extension of the XLISP system. It is
309 provided in the MSSTUFF.C source code file. If your XLISP system is
310 built for an IBM PC and compatibles or generic MS-DOS, this function
311 will work. If your system is built on UNIX or some other operating
312 system, it is unlikely that these functions will work unless you extend
313 the appropriate STUFF.C file (which may be called something different
314 like UNIXSTUFF.C). The source that could be put in the appropriate
315 STUFF.C file for this extension to work on a UNIX style system is:
316
317 /* xsystem - execute a system command */
318 LVAL xsystem()
319 {
320 char *cmd="COMMAND";
321 if (moreargs())
322 cmd = (char *)getstring(xlgastring());
323 xllastarg();
324 return (system(cmd) == 0 ? true : cvfixnum((FIXTYPE)errno));
325 }
326
327 The source that gets added to the OSDEFS.H file is:
328
329 extern LVAL xsystem();
330
331 The source that gets added to the OSPTRS.H file is:
332
333 { "SYSTEM", S, xsystem },
334
335
336
337 
338 File: slisp, Node: t, Next: tagbody, Prev: system, Up: Xlisp Language Reference
339
340 t
341 =
342
343 t
344 type: system constant
345 location: built-in
346 source file: xlinit.c
347 Common LISP compatible: yes
348 supported on: all machines
349
350 SYNTAX
351
352 t
353
354 DESCRIPTION
355
356 The T constant is built into XLISP. It represents True - as
357 oppossed to false (NIL).
358
359 EXAMPLES
360
361 (setq myvar T) ; set MYVAR to True
362 (setq myvar 'T) ; T and 'T both evaluate to T
363 (if t (print "this will print") ; if/then/else
364 (print "this won't print"))
365
366 NOTE: Be careful with the T value. It is possible to do a SETQ on T
367 and set it to other values (like NIL). Some operations will still
368 return proper T or NIL values, but the system will be in a bad state.
369
370
371
372 
373 File: slisp, Node: tagbody, Next: tan, Prev: t, Up: Xlisp Language Reference
374
375 tagbody
376 =======
377
378 tagbody
379 type: special form (fsubr)
380 location: built-in
381 source file: xlcont.c
382 Common LISP compatible: yes
383 supported on: all machines
384
385 SYNTAX
386
387 (tagbody [ <expr> ... ] )
388 <expr> - expressions comprising the body of the block
389 which may contain GOs or tags for GO
390
391 DESCRIPTION
392
393 The TAGBODY special form is basically a 'block' construct that
394 contains a block of code (expressions) to evaluate. After the
395 execution of the TAGBODY <expr>'s, NIL is returned. The TAGBODY
396 special form allows 'go-to' style branching within the 'block'
397 construct via the GO special form. To allow this, each <expr> may be a
398 tag or a form. The tag-symbol is the 'label' and must exist somewhere
399 within the 'block' that the GO occurs within.
400
401 EXAMPLES
402
403 (tagbody ; build the 'block'
404 start (print "begin") ; tag - start
405 (GO end) ;
406 (print "hello") ; won't ever be reached
407 end (print "done")) ; tag - END
408 ; prints "begin" "done"
409 ; returns NIL
410
411
412
413 
414 File: slisp, Node: tan, Next: terpri, Prev: tagbody, Up: Xlisp Language Reference
415
416 tan
417 ===
418
419 tan
420 type: function (subr)
421 location: built-in
422 source file: xlmath.c
423 Common LISP compatible: similar
424 supported on: all machines
425
426 SYNTAX
427
428 (tan <expr> )
429 <expr> - floating point number/expression
430
431 DESCRIPTION
432
433 The TAN function calculates the tangent of the <expr> and returns the
434 result. The <expr> is in radians.
435
436 EXAMPLES
437
438 (tan 0.0) ; returns 0
439 (tan 1.0) ; returns 1.55741
440 (tan (/ 3.14159 2)) ; returns 753696
441 (tan 2.0) ; returns -2.18504
442 (tan 3.0) ; returns -0.142547
443 (tan 3.14159) ; returns -2.65359e-06
444 (tan 4.5) ; returns 4.63733
445
446 COMMON LISP COMPATIBILITY: Common LISP allows for integer numbers,
447 which XLISP does not support for TAN.
448
449
450
451 
452 File: slisp, Node: terpri, Next: third, Prev: tan, Up: Xlisp Language Reference
453
454 terpri
455 ======
456
457 terpri
458 type: function (subr)
459 location: built-in
460 source file: xlfio.c and xlprin.c
461 Common LISP compatible: yes
462 supported on: all machines
463
464 SYNTAX
465
466 (terpri [ <destination> ] )
467 <destination> - an optional destination - must be a file pointer
468 or stream, the default is *standard-output*
469
470 DESCRIPTION
471
472 The TERPRI function prints a new-line to the specified <destination>.
473 This will terminate the current print line for <destination>. NIL is
474 always returned as the result. The <destination> may be a file pointer
475 or a stream. If there is no <destination>, *STANDARD-OUTPUT* is the
476 default.
477
478 EXAMPLES
479
480 (terpri) ; prints <NL>
481 ;
482 (setq f (open "pr" :direction :output )); create a file
483 (princ "hi" f) ; returns "hi"
484 (princ 727 f) ; returns 727
485 (princ "ho" f) ; returns "ho"
486 (terpri f) ; returns NIL
487 (close f) ; file contains hi727ho\n
488
489 COMMON LISP COMPATIBILITY: Common LISP specifies that print
490 operations with a <destination> of NIL, will go to *STANDARD-OUTPUT*.
491 XLISP does not send the output to *STANDARD-OUTPUT* with a
492 <destination> of NIL. Common LISP also specifies that a <destination>
493 of T will be sent to *TERMINAL-IO*. XLISP does not allow T as a valid
494 argument for <destination>.
495
496
497
498 
499 File: slisp, Node: third, Next: throw, Prev: terpri, Up: Xlisp Language Reference
500
501 third
502 =====
503
504 third
505 type: function (subr)
506 location: built-in
507 source file: xlinit.c
508 Common LISP compatible: yes
509 supported on: all machines
510
511 SYNTAX
512
513 (third <expr> )
514 <expr> - a list or list expression
515
516 DESCRIPTION
517
518 THIRD returns the third element of a list or list expression. If the
519 list is NIL, NIL is returned.
520
521 EXAMPLES
522
523 (third '(1 2 3 4)) ; returns 3
524 (third NIL) ; returns NIL
525 ;
526 (setq kids '(junie vickie cindy chris)) ; set up variable KIDS
527 (first kids) ; returns JUNIE
528 (second kids) ; returns VICKIE
529 (third kids) ; returns CINDY
530 (fourth kids) ; returns CHRIS
531 (rest kids) ; returns (VICKIE CINDY CHRIS)
532
533 NOTE: This function is set to the same code as CADDR.
534
535
536
537 
538 File: slisp, Node: throw, Next: ;tmacro, Prev: third, Up: Xlisp Language Reference
539
540 throw
541 =====
542
543 throw
544 type: special form (fsubr)
545 location: built-in
546 source file: xlcont.c and xljump.c
547 Common LISP compatible: yes
548 supported on: all machines
549
550 SYNTAX
551
552 (throw <tag-symbol> [ <expr> ] )
553 <tag-symbol> - an expression that evaluates to a symbol
554 <expr> - an optional expression to be returned
555
556 DESCRIPTION
557
558 The CATCH and THROW special forms allow for non-local exits and traps
559 without going through the intermediate evaluations and function returns.
560 The <expr> in THROW specifies what value is to be returned by the
561 corresponding CATCH. If there is no <expr>, a NIL is returned to the
562 corresponding CATCH. If a THROW is evaluated with no corresponding
563 CATCH, an error is generated - "error: no target for THROW". If, in the
564 calling process, more than one CATCH is set up for the same
565 <tag-symbol>, the most recently evaluated <tag-symbol> will be the one
566 that does the actual catching.
567
568 EXAMPLES
569
570 (catch 'mytag) ; returns NIL - no THROW
571 (catch 'mytag (+ 1 (+ 2 3))) ; returns 6 - no THROW
572 (catch 'mytag (+ 1 (throw 'mytag))) ; returns NIL - caught it
573 (catch 'mytag (+ 1 (throw 'mytag 55))) ; returns 55 - caught it
574 (catch 'mytag (throw 'foo)) ; error: no target for THROW
575 ;
576 (defun in (x) ; define IN
577 (if (numberp x) (+ x x) ; if number THEN double
578 (throw 'math 42))) ; ELSE throw 42
579 (defun out (x) ; define OUT
580 (princ "<") (princ (* (in x) 2)) ; double via multiply
581 (princ ">")) ;
582 (defun main (x) ; define MAIN
583 (catch 'math (out x))) ; with CATCH
584 (in 5) ; returns 10
585 (out 5) ; prints <20> returns ">"
586 (main 5) ; prints <20> returns ">"
587 (main 'a) ; prints < returns 42
588
589 NOTE: Although CATCH and THROW will accept a <tag-symbol> that is
590 not a symbol, it will not find this improper <tag-symbol>. An error
591 will be generated - "error: no target for THROW".
592
593
594
595 
596 File: slisp, Node: ;tmacro, Next: top-level, Prev: throw, Up: Xlisp Language Reference
597
598 :tmacro
599 =======
600
601 :tmacro
602 type: keyword
603 location: built-in
604 source file: xlread.c
605 Common LISP compatible: no
606 supported on: all machines
607
608 SYNTAX
609
610 (:tmacro . <function> )
611 <function> - a function
612
613 DESCRIPTION
614
615 :TMACRO is an entry that is used in the *READTABLE*. *READTABLE* is
616 a system variable that contains XLISP's data structures relating to the
617 processing of characters from the user (or files) and read-macro
618 expansions. The existance of the :TMACRO keyword means that the
619 specified character is a terminal read macro. For :TMACRO, the form of
620 the *READTABLE* entry is a dotted pair like (:TMACRO . <function> ).
621 The <function> can be a built-in read-macro function or a user defined
622 lambda expression. The <function> takes two parameters, an input stream
623 specification, and an integer that is the character value. The
624 <function> should return NIL if the character is 'white-space' or a
625 value CONSed with NIL to return the value. The <function> will probably
626 read additional characters from the input stream.
627
628 EXAMPLES
629
630 (defun look-at (table) ; define a function to
631 (dotimes (ch 127) ; look in a table
632 (prog ( (entry (aref table ch)) ) ; and print out any
633 (if (and (consp entry) ; :TMACRO entries
634 (equal (car entry) ;
635 ':TMACRO)) ;
636 (princ (int-char ch))))) ;
637 (terpri)) ;
638 ;
639 (look-at *readtable*) ; prints "'(),;`
640
641 NOTE: The system defines that the following are :TMACRO characters:
642
643 \ " ` , ( ) ;
644
645 CAUTION: If you experiment with *READTABLE*, it is useful to save
646 the old value in a variable, so that you can restore the system state.
647
648
649
650 
651 File: slisp, Node: top-level, Next: trace, Prev: ;tmacro, Up: Xlisp Language Reference
652
653 top-level
654 =========
655
656 top-level
657 type: function (subr)
658 location: built-in
659 source file: xlbfun.c and xldbug.c
660 Common LISP compatible: no
661 supported on: all machines
662
663 SYNTAX
664
665 (top-level)
666
667 DESCRIPTION
668
669 The TOP-LEVEL function aborts to the top level of XLISP. This may be
670 from within several levels of the break loop. This is valid for BREAKs,
671 ERRORs and CERRORs (continuable errors). If TOP-LEVEL is evaluated
672 while not in a break loop, a message is printed - "[ back to the top
673 level ]". This message does not cause XLISP to go into a break loop.
674 TOP-LEVEL never actually returns a value.
675
676 EXAMPLES
677
678 (top-level) ; [ back to the top level ]
679 ;
680 (break "out") ; break: out (1st)
681 (break "twice") ; break: twice (2nd)
682 (top-level) ; to exit out of break loop
683
684 KEYSTROKE EQUIVALENT: In the IBM PC and MS-DOS versions of XLISP, a
685 CTRL-c key sequence has the same effect as doing a (TOP-LEVEL). On a
686 Macintosh, this can be accomplished by a pull-down menu or a COMMAND-t.
687
688
689
690 
691 File: slisp, Node: trace, Next: *tracelimit*, Prev: top-level, Up: Xlisp Language Reference
692
693 trace
694 =====
695
696 trace
697 type: special form (fsubr)
698 location: built-in
699 source file: xlcont.c
700 Common LISP compatible: similar
701 supported on: all machines
702
703 SYNTAX
704
705 (trace <function> ... )
706 <function> - an unquoted function
707
708 DESCRIPTION
709
710 The TRACE special form allows the tracing of user or system
711 functions. TRACE returns a list containing the current set of
712 functions that are being traced. The <function> does not have to be
713 currently defined, it can be created as part of the execution. The
714 trace output consists of entry and exit information. At entry and exit
715 of a traced <function>, lines will be printed of the form:
716
717 Entering: <function>, Argument list: <arg-list>
718 .
719 .
720 .
721 Exiting: <function>, Value: <ret-value>
722
723 EXAMPLES
724
725 (defun foo (x) (print (car x))) ; define FOO
726 (trace 'foo) ; returns (FOO)
727 (trace 'car) ; returns (CAR FOO)
728 (foo '(a)) ; Entering: FOO, Argument list: ((A))
729 ; Entering: CAR, Argument list: ((A))
730 ; Exiting: CAR, Value: A
731 ; A
732 ; Exiting: FOO, Value: A
733 ; returns A
734
735 COMMON LISP COMPATIBILITY: The XLISP TRACE function does not support
736 any keyword options, which Common LISP allows.
737
738
739
740 
741 File: slisp, Node: *tracelimit*, Next: *tracelist*, Prev: trace, Up: Xlisp Language Reference
742
743 *tracelimit*
744 ============
745
746 *tracelimit*
747 type: system variable
748 location: built-in
749 source file: xlinit.c and xldbug.c
750 Common LISP compatible: no
751 supported on: all machines
752
753 SYNTAX
754
755 *tracelimit*
756
757 DESCRIPTION
758
759 *TRACELIMIT* is a system variable that controls the number of forms
760 printed on entry to the break loop. If *TRACELIMIT* is an integer, then
761 the integer is the maximum number of forms that will be printed. If
762 *TRACELIMIT* is NIL or a non-integer, then all of the forms will be
763 printed. Note that *TRACENABLE* needs to be set to a non-NIL value to
764 enable the printing of back-trace information on entry to the break
765 loop.
766
767 EXAMPLES
768
769 (defun foo (x) (fee x)) ; define FOO
770 (defun fee (y) (break)) ; define FEE
771 (setq *tracenable* T) ; enable the back trace
772 (setq *tracelimit* NIL) ; show all the entries
773 (foo 5) ; break: **BREAK**
774 ; prints Function:.....BREAK..
775 ; Function:.....FEE....
776 ; Arguments:
777 ; 5
778 ; Function:.....FOO....
779 ; Arguments:
780 ; 5
781 (clean-up) ; from break loop
782 (setq *tracelimit* 2) ; show only 2 entries
783 (foo 5) ; break: **BREAK**
784 ; prints Function:.....BREAK..
785 ; Function:.....FEE....
786 ; Arguments:
787 ; 5
788 (clean-up) ; from break loop
789
790 NOTE: *TRACENABLE* and *TRACELIMIT* have to do with back trace
791 information at entry to a break loop and have nothing to do with TRACE
792 and UNTRACE.
793
794
795
796 
797 File: slisp, Node: *tracelist*, Next: *tracenable*, Prev: *tracelimit*, Up: Xlisp Language Reference
798
799 *tracelist*
800 ===========
801
802 *tracelist*
803 type: system variable
804 location: built-in
805 source file: xlinit.c and xleval.c
806 Common LISP compatible: no
807 supported on: all machines
808
809 SYNTAX
810
811 *tracelist*
812
813 DESCRIPTION
814
815 *TRACELIST* is a system variable that contains a list of the current
816 functions being traced.
817
818 EXAMPLES
819
820 (defun foo (x) (print (car x))) ; define FOO
821 (trace foo) ; returns (FOO)
822 (trace car) ; returns (CAR FOO)
823 (print *tracelist*) ; prints (CAR FOO)
824 (untrace foo) ; returns (CAR)
825 (untrace car) ; returns NIL
826 (print *tracelist*) ; prints NIL
827
828
829
830 
831 File: slisp, Node: *tracenable*, Next: *trace-output*, Prev: *tracelist*, Up: Xlisp Language Reference
832
833 *tracenable*
834 ============
835
836 *tracenable*
837 type: system variable
838 location: built-in
839 source file: xlinit.c and xldbug.c
840 Common LISP compatible: no
841 supported on: all machines
842
843 SYNTAX
844
845 *tracenable*
846
847 DESCRIPTION
848
849 *TRACENABLE* is a system variable that controls whether or not the
850 break loop prints any back trace information on entry to the break
851 loop. If *TRACENABLE* is NIL, then there will be no information
852 printed on entry to the break loop. If *TRACENABLE* is non-NIL, then
853 information will be printed. The INIT.LSP initialization file sets
854 *TRACENABLE* to NIL, which suppresses the printing.
855
856 EXAMPLES
857
858 (defun foo (x) (fee x)) ; define FOO
859 (defun fee (y) (break)) ; define FEE
860 (setq *tracenable* T) ; enable the back trace
861 (setq *tracelimit* NIL) ; show all the entries
862 (foo 5) ; break: **BREAK**
863 ; prints Function:.....BREAK..
864 ; Function:.....FEE....
865 ; Arguments:
866 ; 5
867 ; Function:.....FOO....
868 ; Arguments:
869 ; 5
870 (clean-up) ; from break loop
871 (setq *tracelimit* 2) ; show only 2 entries
872 (foo 5) ; break: **BREAK**
873 ; prints Function:.....BREAK..
874 ; Function:.....FEE....
875 ; Arguments:
876 ; 5
877 (clean-up) ; from break loop
878
879 NOTE: *TRACENABLE* and *TRACELIMIT* have to do with back trace
880 information at entry to a break loop and have nothing to do with TRACE
881 and UNTRACE.
882
883
884
885 
886 File: slisp, Node: *trace-output*, Next: truncate, Prev: *tracenable*, Up: Xlisp Language Reference
887
888 *trace-output*
889 ==============
890
891 *trace-output*
892 type: system variable
893 location: built-in
894 source file: xlinit.c xlio.c
895 Common LISP compatible: yes
896 supported on: all machines
897
898 SYNTAX
899
900 *trace-output*
901
902 DESCRIPTION
903
904 *TRACE-OUTPUT* is a system variable that contains a file pointer that
905 points to the file where all trace output goes to. The default file for
906 *TRACE-OUTPUT* is the system standard error device - normally the
907 screen.
908
909 EXAMPLES
910
911 *trace-output* ; returns #<File-Stream: #243de>
912
913 NOTE: *TRACE-OUTPUT*, *DEBUG-IO* and *ERROR-OUTPUT* are normally all
914 set to the same file stream - STDERR.
915
916
917
918 
919 File: slisp, Node: truncate, Next: type-of, Prev: *trace-output*, Up: Xlisp Language Reference
920
921 truncate
922 ========
923
924 truncate
925 type: function (subr)
926 location: built-in
927 source file: xlmath.c
928 Common LISP compatible: similar
929 supported on: all machines
930
931 SYNTAX
932
933 (truncate <expr> )
934 <expr> - integer or floating point number/expression
935
936 DESCRIPTION
937
938 The TRUNCATE function takes the <expr> and truncates it to an integer
939 value and returns this result.
940
941 EXAMPLES
942
943 (truncate 123.456) ; returns 123
944 (truncate -1.49) ; returns -1
945 (truncate -1.59) ; returns -1
946 (truncate 123) ; returns 123
947 (truncate 123.999) ; returns 123
948
949 COMMON LISP COMPATIBILITY: Common LISP allows an optional division
950 parameter, which XLISP does not support.
951
952
953
954 
955 File: slisp, Node: type-of, Next: *unbound*, Prev: truncate, Up: Xlisp Language Reference
956
957 type-of
958 =======
959
960 type-of
961 type: function (subr)
962 location: built-in
963 source file: xlsys.c
964 Common LISP compatible: similar
965 supported on: all machines
966
967 SYNTAX
968
969 (type-of <expr> )
970 <expr> - an expression to check
971
972 DESCRIPTION
973
974 The TYPE-OF function returns the type of the expression.
975
976 EXAMPLES
977
978 (type-of NIL) ; returns NIL
979 (type-of '#(1 2 3)) ; returns ARRAY
980 (type-of (lambda (x) (print x))) ; returns CLOSURE
981 (type-of '(a b)) ; returns CONS
982 (type-of #'savefun) ; returns CLOSURE
983 (type-of '(a . b)) ; returns CONS
984 (type-of *standard-output*) ; returns FILE-STREAM
985 (type-of 1.2) ; returns FLONUM
986 (type-of #'do) ; returns FSUBR
987 (type-of 1) ; returns FIXNUM
988 (type-of object) ; returns OBJECT
989 (type-of "str") ; returns STRING
990 (type-of #'car) ; returns SUBR
991 (type-of 'a) ; returns SYMBOL
992 (type-of #\a) ; returns CHARACTER
993 (type-of (make-string-input-stream "a")); returns UNNAMED-STREAM
994
995 COMMON LISP COMPATIBILITY: The XLISP and Common LISP TYPE-OF
996 functions are basically the same. Differences between the two can
997 occur in what the types are called (like CHARACTER in XLISP and
998 STANDARD-CHAR in Common LISP). Also, Common LISP can give additional
999 information - for strings, it returns a list of the form (SIMPLE-STRING
1000 32) where the number 32 is the string size.
1001
1002
1003
1004 
1005 File: slisp, Node: *unbound*, Next: unless, Prev: type-of, Up: Xlisp Language Reference
1006
1007 *unbound*
1008 =========
1009
1010 *unbound*
1011 type: system constant
1012 location: built-in
1013 source file: xlinit.c and xlsym.c
1014 Common LISP compatible: no
1015 supported on: all machines
1016
1017 SYNTAX
1018
1019 *unbound*
1020
1021 DESCRIPTION
1022
1023 *UNBOUND* is a system constant that is used to indicate when a symbol
1024 has no value. *UNBOUND* is set to the value *UNBOUND*. This means that
1025 the system thinks the symbol *UNBOUND* has no value.
1026
1027 EXAMPLES
1028
1029 *unbound* ; error: unbound variable
1030 (setq a 5) ; returns 5
1031 a ; returns 5
1032 (setq a '*unbound*) ; returns *UNBOUND*
1033 a ; error: unbound variable
1034
1035
1036
1037 
1038 File: slisp, Node: unless, Next: untrace, Prev: *unbound*, Up: Xlisp Language Reference
1039
1040 unless
1041 ======
1042
1043 unless
1044 type: special form (fsubr)
1045 location: built-in
1046 source file: xlcont.c
1047 Common LISP compatible: yes
1048 supported on: all machines
1049
1050 SYNTAX
1051
1052 (unless <test> [ <expr> ... ] )
1053 <test> - an expression - NIL or non-NIL
1054 <expr> - expressions comprising a body of code
1055
1056 DESCRIPTION
1057
1058 The UNLESS macro executes the <expr> forms if <test> evaluates to a
1059 NIL value. If <test> is NIL, the value of the last <expr> is returned
1060 as the result. If <test> is non-NIL, NIL is returned with none of
1061 <expr> evaluated.
1062
1063 EXAMPLES
1064
1065 (unless NIL) ; returns NIL
1066 (unless T) ; returns NIL
1067 (unless NIL (print "hi") 'foo) ; prints "hi" returns FOO
1068 (unless (listp "a") ;
1069 (print "not a list")) ; prints "not a list"
1070 ; returns "not a list"
1071
1072
1073
1074 
1075 File: slisp, Node: untrace, Next: upper-case-p, Prev: unless, Up: Xlisp Language Reference
1076
1077 untrace
1078 =======
1079
1080 untrace
1081 type: special form (fsubr)
1082 location: built-in
1083 source file: xlcont.c
1084 Common LISP compatible: similar
1085 supported on: all machines
1086
1087 SYNTAX
1088
1089 (untrace <function> ... )
1090 <function> - a function name
1091
1092 DESCRIPTION
1093
1094 The UNTRACE special form removes <function> from the current list of
1095 traced functions. UNTRACE returns a list containing the current set of
1096 functions that are being traced. If the <function> does currently exist
1097 or is currently be traced, there will be no error reported. If there
1098 are no functions being traced, a NIL is returned.
1099
1100 EXAMPLES
1101
1102 (defun foo (x) (print (car x))) ; define FOO
1103 (trace 'foo) ; returns (FOO)
1104 (foo '(a)) ; Entering: FOO, Argument list: ((A))
1105 ; A
1106 ; Exiting: FOO, Value: A
1107 ; returns A
1108 (untrace 'foo) ; returns NIL
1109 (untrace 'glip) ; returns NIL
1110 (foo '(a)) ; prints A and returns A
1111
1112 COMMON LISP COMPATIBILITY: The XLISP UNTRACE function does not
1113 support any options, which Common LISP allows.
1114
1115
1116
1117 
1118 File: slisp, Node: upper-case-p, Next: unwind-protect, Prev: untrace, Up: Xlisp Language Reference
1119
1120 upper-case-p
1121 ============
1122
1123 upper-case-p
1124 type: predicate function (subr)
1125 location: built-in
1126 source file: xlstr.c
1127 Common LISP compatible: yes
1128 versions: all machines
1129
1130 SYNTAX
1131
1132 (upper-case-p <char> )
1133 <char> - a character expression
1134
1135 DESCRIPTION
1136
1137 The UPPER-CASE-P predicate checks if the <char> expression is an
1138 upper case character. If <char> is upper case a T is returned,
1139 otherwise a NIL is returned. Upper case characters are 'A' (ASCII
1140 decimal value 65) through 'Z' (ASCII decimal value 90).
1141
1142 EXAMPLES
1143
1144 (upper-case-p #\A) ; returns T
1145 (upper-case-p #\a) ; returns NIL
1146 (upper-case-p #\1) ; returns NIL
1147 (upper-case-p #\[) ; returns NIL
1148
1149
1150
1151 
1152 File: slisp, Node: unwind-protect, Next: vector, Prev: upper-case-p, Up: Xlisp Language Reference
1153
1154 unwind-protect
1155 ==============
1156
1157 unwind-protect
1158 type: special form (fsubr)
1159 location: built-in
1160 source file: xlcont.c
1161 Common LISP compatible: yes
1162 supported on: all machines
1163
1164 SYNTAX
1165
1166 (unwind-protect <protect-form> <clean-up-form> ... )
1167 <protect-form> - a form that is to be protected
1168 <clean-up-form> - a sequence forms to execute after <protect-form>
1169
1170 DESCRIPTION
1171
1172 The UNWIND-PROTECT special form allows the protecting (trapping) of
1173 all forms of exit from the <protect-form>. The exits that are trapped
1174 include errors, THROW, RETURN and GO. The <clean-up-form> will be
1175 executed in all cases - when there is an exit from <protect-form> and
1176 when the form does not have exit. UNWIND-PROTECT will return the result
1177 from the <protect-form>, not from the <clean-up-form>s. Errors or exits
1178 that occur in the <clean-up-form> are not protected. It is possible to
1179 trap these with another UNWIND-PROTECT.
1180
1181 EXAMPLES
1182
1183 (unwind-protect ;
1184 (+ 2 2) ; protected form
1185 (print "an exit")) ; clean up form
1186 ; prints "an exit"
1187 ; returns 4
1188 ;
1189 (nodebug) ; to turn off break loop traps
1190 (unwind-protect ;
1191 (+ 1 "2") ; protected form
1192 (print "something happened")) ; clean up form
1193 ; error: bad argument type - "2"
1194 ; prints "something happened"
1195 ;
1196 (catch 'mytag ;
1197 (unwind-protect ;
1198 (throw 'mytag) ; protected form
1199 (print "an exit") ) ) ; clean up form
1200 ; prints "an exit"
1201 ;
1202 (nodebug) ; to turn off break loop traps
1203 (unwind-protect ;
1204 (throw 'notag) ; protected form
1205 (print "an exit")) ; clean up form
1206 ; error: no target for THROW
1207 ; prints "an exit"
1208 ;
1209 (prog () ;
1210 (print "start") ;
1211 (unwind-protect ;
1212 (go end) ; protected form
1213 (print "an exit")) ; clean-up form
1214 end (print "end") ) ; prints "start"
1215 ; prints "an exit"
1216 ; prints "end"
1217 ;
1218 (prog () ;
1219 (print "start") ;
1220 (unwind-protect ;
1221 (return "I'm done") ; protected form
1222 (print "but first")) ; clean-up form
1223 (print "won't get here") ) ; prints "start"
1224 ; prints "but first"
1225 ; returns "I'm done"
1226
1227
1228
1229 
1230 File: slisp, Node: vector, Next: when, Prev: unwind-protect, Up: Xlisp Language Reference
1231
1232 vector
1233 ======
1234
1235 vector
1236 type: function (subr)
1237 location: built-in
1238 source file: xlbfun.c
1239 Common LISP compatible: yes
1240 supported on: all machines
1241
1242 SYNTAX
1243
1244 (vector [ <expr> ... ] )
1245 <expr> - an expression
1246
1247 DESCRIPTION
1248
1249 The VECTOR function creates an initialized vector and returns it as
1250 the result. VECTOR is essentially a fast method to do a one-dimensional
1251 MAKE-ARRAY with initial data in the vector.
1252
1253 EXAMPLES
1254
1255 (vector 'a 'b 'c) ; returns #(A B C)
1256 (vector '(a b) '(c d)) ; returns #((A B) (C D))
1257 (vector) ; returns #()
1258 (vector NIL) ; returns #(NIL)
1259 (vector 'a () 4 "s") ; returns #(A NIL 4 "s")
1260
1261
1262
1263 
1264 File: slisp, Node: when, Next: ;white-space, Prev: vector, Up: Xlisp Language Reference
1265
1266 when
1267 ====
1268
1269 when
1270 type: special form (fsubr)
1271 location: built-in
1272 source file: xlcont.c
1273 Common LISP compatible: yes
1274 supported on: all machines
1275
1276 SYNTAX
1277
1278 (when <test> [ <expr> ... ] )
1279 <test> - an expression - NIL or non-NIL
1280 <expr> - expressions comprising a body of code
1281
1282 DESCRIPTION
1283
1284 The WHEN macro executes the <expr> forms if <test> evaluates to a
1285 non-NIL value. If <test> is non-NIL, the value of the last <expr> is
1286 returned as the result. If <test> is NIL, NIL is returned with none of
1287 <expr> evaluated.
1288
1289 EXAMPLES
1290
1291 (when NIL) ; returns NIL
1292 (when T) ; returns T
1293 (when T (print "hi") 'foo) ; prints "hi" returns FOO
1294 (when (listp '(a)) ;
1295 (print "a list")) ; prints "a list"
1296 ; returns "a list"
1297
1298
1299
1300 
1301 File: slisp, Node: ;white-space, Next: write-byte, Prev: when, Up: Xlisp Language Reference
1302
1303 :white-space
1304 ============
1305
1306 :white-space
1307 type: keyword
1308 location: built-in
1309 source file: xlread.c
1310 Common LISP compatible: no
1311 supported on: all machines
1312
1313 SYNTAX
1314
1315 :white-space
1316
1317 DESCRIPTION
1318
1319 :WHITE-SPACE is an entry that is used in the *READTABLE*.
1320 *READTABLE* is a system variable that contains XLISP's data structures
1321 relating to the processing of characters from the user (or files) and
1322 read-macro expansions. The existance of the :WHITE-SPACE keyword means
1323 that the specified character may be skipped over. The system defines
1324 that tab, space, return and line-feed are :WHITE-SPACE characters.
1325
1326 EXAMPLES
1327
1328 (defun look-at (table) ; define a function to
1329 (dotimes (ch 127) ; look in a table
1330 (prog ( (entry (aref table ch)) ) ; and print out any
1331 (case entry ; entries with a function
1332 (NIL NIL) ;
1333 (:CONSTITUENT NIL) ;
1334 (:WHITE-SPACE (print ch)) ;
1335 (T NIL)))) ;
1336 (terpri)) ;
1337 (look-at *readtable*) ; prints 9 tab
1338 ; 10 newline
1339 ; 12 formfeed
1340 ; 13 return
1341 ; 32 space
1342
1343 CAUTION: If you experiment with *READTABLE*, it is useful to save
1344 the old value in a variable, so that you can restore the system state.
1345
1346
1347
1348 
1349 File: slisp, Node: write-byte, Next: write-char, Prev: ;white-space, Up: Xlisp Language Reference
1350
1351 write-byte
1352 ==========
1353
1354 write-byte
1355 type: function (subr)
1356 location: built-in
1357 source file: xlfio.c
1358 Common LISP compatible: yes
1359 supported on: all machines
1360
1361 SYNTAX
1362
1363 (write-byte <expr> [ <destination> ] )
1364 <expr> - an integer expression
1365 <destination> - an optional destination - must be a file pointer
1366 or stream, the default is *standard-output*
1367
1368 DESCRIPTION
1369
1370 The WRITE-BYTE function writes the <expr> as a single byte to the
1371 specified <destination>. Only the <expr> byte is written. The <expr>
1372 must be an integer expression. The <expr> is returned as the result.
1373 The <destination> may be a file pointer or a stream. If there is no
1374 <destination>, *STANDARD-OUTPUT* is the default.
1375
1376 EXAMPLES
1377
1378 (write-byte 67) ; prints C returns 67
1379 ;
1380 (setq fp (open "t" :direction :output)) ; create file
1381 (write-byte 65 fp) ; returns 65
1382 (write-byte 66 fp) ; returns 66
1383 (write-byte 10 fp) ; returns 10
1384 (close fp) ; returns NIL
1385 (read (open "t" :direction :input)) ; returns AB
1386
1387 COMMON LISP COMPATIBILITY: Common LISP specifies that print
1388 operations with a <destination> of NIL, will go to *STANDARD-OUTPUT*.
1389 XLISP does not send the output to *STANDARD-OUTPUT* with a
1390 <destination> of NIL. Common LISP also specifies that a <destination>
1391 of T will be sent to *TERMINAL-IO*. XLISP does not allow T as a valid
1392 argument for <destination>.
1393
1394
1395
1396 
1397 File: slisp, Node: write-char, Next: zerop, Prev: write-byte, Up: Xlisp Language Reference
1398
1399 write-char
1400 ==========
1401
1402 write-char
1403 type: function (subr)
1404 location: built-in
1405 source file: xlfio.c
1406 Common LISP compatible: yes
1407 supported on: all machines
1408
1409 SYNTAX
1410
1411 (write-char <char-expr> [ <destination> ] )
1412 <char-expr> - a character expression
1413 <destination> - an optional destination - must be a file pointer
1414 or stream, the default is *standard-output*
1415
1416 DESCRIPTION
1417
1418 The WRITE-CHAR function writes the <char-expr> to the specified
1419 <destination>. Only the <char-expr> is written. The <char-expr> must
1420 be a character expression. The <char-expr> is returned as the result.
1421 The <destination> may be a file pointer or a stream. If there is no
1422 <destination>, *STANDARD-OUTPUT* is the default.
1423
1424 EXAMPLES
1425
1426 (write-char #\C) ; prints C
1427 ;
1428 (setq fp (open "t" :direction :output)) ; create file
1429 (write-char #\A fp) ; returns #\A
1430 (write-char #\B fp) ; returns #\B
1431 (write-char #\Newline fp) ; returns #\Newline
1432 (close fp) ; returns NIL
1433 (read (open "t" :direction :input)) ; returns AB
1434
1435 COMMON LISP COMPATIBILITY: Common LISP specifies that print
1436 operations with a <destination> of NIL, will go to *STANDARD-OUTPUT*.
1437 XLISP does not send the output to *STANDARD-OUTPUT* with a
1438 <destination> of NIL. Common LISP also specifies that a <destination>
1439 of T will be sent to *TERMINAL-IO*. XLISP does not allow T as a valid
1440 argument for <destination>.
1441
1442
1443

brinkley@uw.edu
ViewVC Help
Powered by ViewVC 1.1.26