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

Contents of /skandha4/info/slisp-6

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: char>=, Next: characterp, Prev: char>, Up: Xlisp Language Reference
12
13 char>=
14 ======
15
16 char>=
17 type: function (subr)
18 location: built-in
19 source file: xlstr.c
20 Common LISP compatible: yes
21 supported on: all machines
22
23 SYNTAX
24
25 (char>= <char1> <charN> ... )
26 <char1> - a character expression
27 <charN> - character expression(s) to compare
28
29 DESCRIPTION
30
31 The CHAR>= (character-GREATER-THAN-OR-EQUAL) function takes one or
32 more character arguments. It checks to see if all the character
33 arguments are monotonically non-increasing. T is returned if the
34 arguments are of monotonically non-increasing ASCII value. In the case
35 of two arguments, this has the effect of testing if <char1> is greater
36 than or equal to <char2>. This test is case sensitive - the character
37 #\a is different (and of greater ASCII value) than #\A.
38
39 EXAMPLES
40
41 (char>= #\a #\b) ; returns NIL
42 (char>= #\b #\a) ; returns T
43 (char>= #\c #\b #\a) ; returns T
44 (char>= #\a #\a) ; returns T
45 (char>= #\c #\a #\b) ; returns NIL
46 (char>= #\A #\a) ; returns NIL
47 (char>= #\a #\A) ; returns T
48
49
50
51 
52 File: slisp, Node: characterp, Next: char-code, Prev: char>=, Up: Xlisp Language Reference
53
54 characterp
55 ==========
56
57 characterp
58 type: predicate function (subr)
59 location: built-in
60 source file: xlbfun.c
61 Common LISP compatible: yes
62 supported on: all machines
63
64 SYNTAX
65
66 (characterp <expr> )
67 <expr> - the expression to check
68
69 DESCRIPTION
70
71 The CHARACTERP predicate checks if an <expr> is a character. T is
72 returned if <expr> is a character, NIL is returned otherwise.
73
74 EXAMPLES
75
76 (characterp #\a) ; returns T - character
77 (setq a #\b) ;
78 (characterp a) ; returns T - evaluates to char
79 (characterp "a") ; returns NIL - string
80 (characterp '(a b c)) ; returns NIL - list
81 (characterp 1) ; returns NIL - integer
82 (characterp 1.2) ; returns NIL - float
83 (characterp 'a) ; returns NIL - symbol
84 (characterp #(0 1 2)) ; returns NIL - array
85 (characterp NIL) ; returns NIL - NIL
86
87
88
89 
90 File: slisp, Node: char-code, Next: char-downcase, Prev: characterp, Up: Xlisp Language Reference
91
92 char-code
93 =========
94
95 char-code
96 type: function (subr)
97 location: built-in
98 source file: xlstr.c
99 Common LISP compatible: similar
100 versions: all machines
101
102 SYNTAX
103
104 (char-code <char> )
105 <char> - a character expression
106
107 DESCRIPTION
108
109 The CHAR-CODE function returns the value of the <char> expression.
110
111 EXAMPLES
112
113 (char-code #\0) ; returns 48
114 (char-code #\A) ; returns 65
115 (char-code #\a) ; returns 97
116 (char-code #\[) ; returns 91
117 (char-code #\newline) ; returns 10
118 (char-code (code-char 127)) ; returns 127
119 (char-code (int-char 255)) ; returns 255
120
121 COMMON LISP COMPATIBILITY: Common LISP supports the concept of a
122 complex character that includes not only the ASCII code value, but also
123 fonts and bits. The bits allow for more than 8 bits per character (16
124 bits is especially useful in oriental languages). The fonts allow for
125 up to 128 different fonts. This is interesting and neat stuff,
126 however, XLISP does not support fonts and bits.
127
128 NOTE: Because XLISP does not support fonts and bits (as discussed
129 above), CHAR-CODE and CHAR-INT are identical in use.
130
131
132
133 
134 File: slisp, Node: char-downcase, Next: char-equal, Prev: char-code, Up: Xlisp Language Reference
135
136 char-downcase
137 =============
138
139 char-downcase
140 type: function (subr)
141 location: built-in
142 source file: xlstr.c
143 Common LISP compatible: yes
144 versions: all machines
145
146 SYNTAX
147
148 (char-downcase <char> )
149 <char> - a character expression
150
151 DESCRIPTION
152
153 The CHAR-DOWNCASE function converts the <char> expression to lower
154 case. The lower case equivalent of <char> is returned. If the <char>
155 is not alphabetic ('a' thru 'z' or 'A' thru 'Z'), the character is
156 returned unchanged.
157
158 EXAMPLES
159
160 (char-downcase #\0) ; returns #\0
161 (char-downcase #\A) ; returns #\a
162 (char-downcase #\a) ; returns #\a
163 (char-downcase #\[) ; returns #\[
164 (char-downcase #\+) ; returns #\+
165
166
167
168 
169 File: slisp, Node: char-equal, Next: char-greaterp, Prev: char-downcase, Up: Xlisp Language Reference
170
171 char-equal
172 ==========
173
174 char-equal
175 type: function (subr)
176 location: built-in
177 source file: xlstr.c
178 Common LISP compatible: yes
179 supported on: all machines
180
181 SYNTAX
182
183 (char-equal <char1> <charN> ... )
184 <char1> - a character expression
185 <charN> - character expression(s) to compare
186
187 DESCRIPTION
188
189 The CHAR-EQUAL function takes one or more character arguments. It
190 checks to see if all the character arguments are equivalent. T is
191 returned if the arguments are of the same ASCII value. In the case of
192 two arguments, this has the effect of testing if <char1> is equal to
193 <char2>. This test is case insensitive - the character #\a is
194 considered to be the same ASCII value as #\A.
195
196 EXAMPLES
197
198 (char-equal #\a #\b) ; returns NIL
199 (char-equal #\b #\a) ; returns NIL
200 (char-equal #\a #\b #\c) ; returns NIL
201 (char-equal #\a #\a) ; returns T
202 (char-equal #\a #\a #\a) ; returns T
203 (char-equal #\a #\a #\b) ; returns NIL
204 (char-equal #\A #\a) ; returns T
205 (char-equal #\a #\A) ; returns T
206
207 NOTE: The CHAR-EQUAL function is listed in the documentation that
208 comes with XLISP as CHAR-EQUALP.
209
210
211
212 
213 File: slisp, Node: char-greaterp, Next: char-int, Prev: char-equal, Up: Xlisp Language Reference
214
215 char-greaterp
216 =============
217
218 char-greaterp
219 type: predicate function (subr)
220 location: built-in
221 source file: xlstr.c
222 Common LISP compatible: yes
223 supported on: all machines
224
225 SYNTAX
226
227 (char-greaterp <char1> <charN> ... )
228 <char1> - a character expression
229 <charN> - character expression(s) to compare
230
231 DESCRIPTION
232
233 The CHAR-GREATERP function takes one or more character arguments. It
234 checks to see if all the character arguments are monotonically
235 decreasing. T is returned if the arguments are of monotonically
236 decreasing ASCII value. In the case of two arguments, this has the
237 effect of testing if <char1> is greater than <char2>. This test is case
238 insensitive - the character #\a is considered to be the same ASCII value
239 as #\A.
240
241 EXAMPLES
242
243 (char-greaterp #\a #\b) ; returns NIL
244 (char-greaterp #\b #\a) ; returns T
245 (char-greaterp #\c #\b #\a) ; returns T
246 (char-greaterp #\a #\a) ; returns NIL
247 (char-greaterp #\c #\a #\b) ; returns NIL
248 (char-greaterp #\A #\a) ; returns NIL
249 (char-greaterp #\a #\A) ; returns NIL
250
251
252
253 
254 File: slisp, Node: char-int, Next: char-lessp, Prev: char-greaterp, Up: Xlisp Language Reference
255
256 char-int
257 ========
258
259 char-int
260 type: function (subr)
261 location: built-in
262 source file: xlstr.c
263 Common LISP compatible: yes
264 versions: all machines
265
266 SYNTAX
267
268 (char-int <char> )
269 <char> - a character expression
270
271 DESCRIPTION
272
273 The CHAR-INT function returns the ASCII value of the <char>
274 expression.
275
276 EXAMPLES
277
278 (char-int #\0) ; returns 48
279 (char-int #\A) ; returns 65
280 (char-int #\a) ; returns 97
281 (char-int #\[) ; returns 91
282 (char-int #\newline) ; returns 10
283 (char-int (code-char 127)) ; returns 127
284 (char-int (int-char 255)) ; returns 255
285
286 NOTE: CHAR-CODE and CHAR-INT are identical in use. See CHAR-CODE for
287 additional information.
288
289
290
291 
292 File: slisp, Node: char-lessp, Next: char-not-equal, Prev: char-int, Up: Xlisp Language Reference
293
294 char-lessp
295 ==========
296
297 char-lessp
298 type: predicate function (subr)
299 location: built-in
300 source file: xlstr.c
301 Common LISP compatible: yes
302 supported on: all machines
303
304 SYNTAX
305
306 (char-lessp <char1> <charN> ... )
307 <char1> - a character expression
308 <charN> - character expression(s) to compare
309
310 DESCRIPTION
311
312 The CHAR-LESSP function takes one or more character arguments. It
313 checks to see if all the character arguments are monotonically
314 increasing. T is returned if the arguments are of increasing ASCII
315 value. In the case of two arguments, this has the effect of testing if
316 <char1> is less than <char2>. This test is case insensitive - the
317 character #\a is considered to be the same ASCII value as #\A.
318
319 EXAMPLES
320
321 (char-lessp #\a #\b) ; returns T
322 (char-lessp #\b #\a) ; returns NIL
323 (char-lessp #\a #\b #\c) ; returns T
324 (char-lessp #\a #\a) ; returns NIL
325 (char-lessp #\a #\b #\b) ; returns NIL
326 (char-lessp #\A #\a) ; returns NIL
327 (char-lessp #\a #\A) ; returns NIL
328
329
330
331 
332 File: slisp, Node: char-not-equal, Next: char-not-greaterp, Prev: char-lessp, Up: Xlisp Language Reference
333
334 char-not-equal
335 ==============
336
337 char-not-equal
338 type: function (subr)
339 location: built-in
340 source file: xlstr.c
341 Common LISP compatible: yes
342 supported on: all machines
343
344 SYNTAX
345
346 (char-not-equal <char1> <charN> ... )
347 <char1> - a character expression
348 <charN> - character expression(s) to compare
349
350 DESCRIPTION
351
352 The CHAR-NOT-EQUAL function takes one or more character arguments.
353 It checks to see if all the character arguments are different values.
354 T is returned if the arguments are of different ASCII value. In the
355 case of two arguments, this has the effect of testing if <char1> is not
356 equal to <char2>. This test is case insensitive - the character #\a is
357 considered to be the same ASCII value as #\A.
358
359 EXAMPLES
360
361 (char-not-equal #\a #\b) ; returns T
362 (char-not-equal #\a #\b #\c) ; returns T
363 (char-not-equal #\a #\a) ; returns NIL
364 (char-not-equal #\a #\b #\b) ; returns NIL
365 (char-not-equal #\A #\a) ; returns NIL
366 (char-not-equal #\a #\A) ; returns NIL
367
368 NOTE: The CHAR-NOT-EQUAL function is listed in the documentation
369 that comes with XLISP as CHAR-NOT-EQUALP. It functions properly in the
370 XLISP code as CHAR-NOT-EQUAL.
371
372
373
374 
375 File: slisp, Node: char-not-greaterp, Next: char-not-lessp, Prev: char-not-equal, Up: Xlisp Language Reference
376
377 char-not-greaterp
378 =================
379
380 char-not-greaterp
381 type: predicate function (subr)
382 location: built-in
383 source file: xlstr.c
384 Common LISP compatible: yes
385 supported on: all machines
386
387 SYNTAX
388
389 (char-not-greaterp <char1> <charN> ... )
390 <char1> - a character expression
391 <charN> - character expression(s) to compare
392
393 DESCRIPTION
394
395 The CHAR-NOT-GREATERP function takes one or more character arguments.
396 It checks to see if all the character arguments are monotonically
397 non-decreasing. T is returned if the arguments are of non-decreasing
398 ASCII value. In the case of two arguments, this has the effect of
399 testing if <char1> is less than or equal to <char2>. This test is case
400 insensitive - the character #\a is considered to be the same ASCII value
401 as #\A.
402
403 EXAMPLES
404
405 (char-not-greaterp #\a #\b) ; returns T
406 (char-not-greaterp #\b #\a) ; returns NIL
407 (char-not-greaterp #\a #\b #\c) ; returns T
408 (char-not-greaterp #\a #\a) ; returns T
409 (char-not-greaterp #\a #\b #\b) ; returns T
410 (char-not-greaterp #\A #\a) ; returns T
411 (char-not-greaterp #\a #\A) ; returns T
412
413
414
415 
416 File: slisp, Node: char-not-lessp, Next: char-upcase, Prev: char-not-greaterp, Up: Xlisp Language Reference
417
418 char-not-lessp
419 ==============
420
421 char-not-lessp
422 type: predicate function (subr)
423 location: built-in
424 source file: xlstr.c
425 Common LISP compatible: yes
426 supported on: all machines
427
428 SYNTAX
429
430 (char-not-lessp <char1> <charN> ... )
431 <char1> - a character expression
432 <charN> - character expression(s) to compare
433
434 DESCRIPTION
435
436 The CHAR-NOT-LESSP function takes one or more character arguments.
437 It checks to see if all the character arguments are monotonically
438 non-increasing. T is returned if the arguments are of monotonically
439 non-increasing ASCII value. In the case of two arguments, this has the
440 effect of testing if <char1> is greater than or equal to <char2>. This
441 test is case insensitive - the character #\a is considered to be the
442 same ASCII value as #\A.
443
444 EXAMPLES
445
446 (char-not-lessp #\a #\b) ; returns NIL
447 (char-not-lessp #\b #\a) ; returns T
448 (char-not-lessp #\c #\b #\a) ; returns T
449 (char-not-lessp #\a #\a) ; returns T
450 (char-not-lessp #\c #\a #\b) ; returns NIL
451 (char-not-lessp #\A #\a) ; returns T
452 (char-not-lessp #\a #\A) ; returns T
453
454
455
456 
457 File: slisp, Node: char-upcase, Next: class, Prev: char-not-lessp, Up: Xlisp Language Reference
458
459 char-upcase
460 ===========
461
462 char-upcase
463 type: function (subr)
464 location: built-in
465 source file: xlstr.c
466 Common LISP compatible: yes
467 versions: all machines
468
469 SYNTAX
470
471 (char-upcase <char> )
472 <char> - a character expression
473
474 DESCRIPTION
475
476 The CHAR-UPCASE function converts the <char> expression to upper
477 case. The upper case equivalent of <char> is returned. If the <char>
478 is not alphabetic ('a' thru 'z' or 'A' thru 'Z'), the character is
479 returned unchanged.
480
481 EXAMPLES
482
483 (char-upcase #\0) ; returns #\0
484 (char-upcase #\A) ; returns #\A
485 (char-upcase #\a) ; returns #\A
486 (char-upcase #\[) ; returns #\[
487 (char-upcase #\+) ; returns #\+
488
489
490
491 
492 File: slisp, Node: class, Next: ;class, Prev: char-upcase, Up: Xlisp Language Reference
493
494 class
495 =====
496
497 class
498 type: object
499 location: built-in
500 source file: xlobj.c
501 Common LISP compatible: no
502 supported on: all machines
503
504 SYNTAX
505
506 class
507
508 DESCRIPTION
509
510 CLASS is the built-in object class that is used to build other
511 classes. Classes are, essentially, the template for defining object
512 instances.
513
514 EXAMPLES
515
516 (setq myclass (send class :new '(var))) ; create MYCLASS with VAR
517 (send myclass :answer :isnew '() ; set up initialization
518 '((setq var nil) self))
519 (send myclass :answer :set-it '(value) ; create :SET-IT message
520 '((setq var value)))
521 (setq my-obj (send myclass :new)) ; create MY-OBJ of MYCLASS
522 (send my-obj :set-it 5) ; VAR is set to 5
523
524 CLASS DEFINITION: The internal definition of the CLASS object
525 instance looks like:
526
527 Object is #<Object: #23fe2>, Class is #<Object: #23fe2>
528 MESSAGES = ((:ANSWER . #<Subr-: #23e48>)
529 (:ISNEW . #<Subr-: #23e84>)
530 (:NEW . #<Subr-: #23ea2>))
531 IVARS = (MESSAGES IVARS CVARS CVALS SUPERCLASS IVARCNT IVARTOTAL)
532 CVARS = NIL
533 CVALS = NIL
534 SUPERCLASS = #<Object: #23fd8>
535 IVARCNT = 7
536 IVARTOTAL = 7
537 #<Object: #23fe2>
538
539 The class of CLASS is CLASS, itself. The superclass of CLASS is
540 OBJECT. Remember that the location information (like #23fe2) varies
541 from system to system, yours will probably look different.
542
543 BUILT-IN METHODS: The built in methods in XLISP include:
544
545 <message> operation
546 -------------------------------------------------------
547 :ANSWER Add a method to an object.
548 :CLASS Return the object's class.
549 :ISNEW Run initialization code on object.
550 :NEW Create a new object (instance or class).
551 :SHOW Show the internal state of the object.
552
553 MESSAGE STRUCTURE: The normal XLISP convention for a <message> is to
554 have a valid symbol preceeded by a colon like :ISNEW or :MY-MESSAGE.
555 However, it is possible to define a <message> that is a symbol without
556 a colon, but this makes the code less readable.
557
558
559
560 
561 File: slisp, Node: ;class, Next: clean-up, Prev: class, Up: Xlisp Language Reference
562
563 :class
564 ======
565
566 :class
567 type: message selector
568 location: built-in
569 source file: xlobj.c
570 Common LISP compatible: no
571 supported on: all machines
572
573 SYNTAX
574
575 (send <object> :class)
576 <object> - an existing object
577
578 DESCRIPTION
579
580 The :CLASS message selector will cause a method to run that will
581 return the object which is the class of the specified <object>. Note
582 that the returned value is an object which will look like "#<Object:
583 #18d8c>". The <object> must exist or an error will be generated -
584 "error: bad argument type".
585
586 EXAMPLES
587
588 (send object :class) ; returns the CLASS object
589 (send class :class) ; returns the CLASS object
590 (setq new-cls (send class :new '(var))) ; create NEW-CLS
591 (setq new-obj (send new-cls :new)) ; create NEW-OBJ of NEW-CLS
592 (send new-obj :class) ; returns the NEW-CLS object
593 (send new-cls :class) ; returns the CLASS object
594
595
596
597 
598 File: slisp, Node: clean-up, Next: close, Prev: ;class, Up: Xlisp Language Reference
599
600 clean-up
601 ========
602
603 clean-up
604 type: function (subr)
605 location: built-in
606 source file: xlbfun.c and xldbug.c
607 Common LISP compatible: no
608 supported on: all machines
609
610 SYNTAX
611
612 (clean-up)
613
614 DESCRIPTION
615
616 The CLEAN-UP function aborts one level of the break loop. This is
617 valid for BREAKs, ERRORs and CERRORs (continuable errors). If CLEAN-UP
618 is evaluated while not in a break loop, an error is generated - "error:
619 not in a break loop". This error does not cause XLISP to go into a
620 break loop. CLEAN-UP never actually returns a value.
621
622 EXAMPLES
623
624 (clean-up) ; [back to previous break level]
625 (break "out") ; break: out
626 (clean-up) ; to exit out of break loop
627
628 KEYSTROKE EQUIVALENT: In the IBM PC and MS-DOS versions of XLISP, a
629 CTRL-g key sequence has the same effect as doing a (CLEAN-UP). On a
630 Macintosh, this can be accomplished by a pull-down menu or a COMMAND-g.
631
632
633
634 
635 File: slisp, Node: close, Next: code-char, Prev: clean-up, Up: Xlisp Language Reference
636
637 close
638 =====
639
640 close
641 type: function (subr)
642 location: built-in
643 source file: xlfio.c
644 Common LISP compatible: similar
645 supported on: all machines
646
647 SYNTAX
648
649 (close <file-ptr> )
650 <file-ptr> - a file pointer expression
651
652 DESCRIPTION
653
654 The CLOSE function closes the file specified through <file-ptr>. If
655 the file close was successful, then a NIL is returned as the result.
656 For the file close to be successful, the <file-ptr> has to point to a
657 valid file. If the file close was not successful, an error is
658 generated - "error: file not open").
659
660 EXAMPLES
661
662 (close (open 'f :direction :output)) ; returns NIL
663 (setq myfile ; create MYFILE
664 (open 'mine :direction :output)) ;
665 (print "hi" myfile) ; returns "hi"
666 (close myfile) ; returns NIL
667 ; file contains <hi> <NL>
668 (setq myfile ; open MYFILE for input
669 (open 'mine :direction :input)) ;
670 (read myfile) ; returns "hi"
671 (close myfile) ; returns NIL
672
673 COMMON LISP COMPATIBILITY: Common LISP has an XLISP compatible CLOSE
674 function. Common LISP does support an :ABORT keyword, which is not
675 supported in XLISP.
676
677
678
679 
680 File: slisp, Node: code-char, Next: comma, Prev: close, Up: Xlisp Language Reference
681
682 code-char
683 =========
684
685 code-char
686 type: function (subr)
687 location: built-in
688 source file: xlstr.c
689 Common LISP compatible: similar
690 versions: all machines
691
692 SYNTAX
693
694 (code-char <code> )
695 <code> - a numeric expression
696
697 DESCRIPTION
698
699 The CODE-CHAR function returns a character which is the result of
700 turning <code> expression into a character. If a <code> cannot be made
701 into a character, NIL is returned. The range that <code> produces a
702 valid character is 0 through 127.
703
704 EXAMPLES
705
706 (code-char 48) ; returns #\0
707 (code-char 65) ; returns #\A
708 (code-char 97) ; returns #\a
709 (code-char 91) ; returns #\[
710 (code-char 10) ; returns #\Newline
711 (code-char 128) ; returns NIL
712 (code-char 999) ; returns NIL
713
714 COMMON LISP COMPATIBILITY: Common LISP allows for some optional
715 arguments in CODE-CHAR because it supports the concept of a complex
716 character that includes not only the ASCII code value, but also fonts
717 and bits. The bits allow for more than 8 bits per character (16 bits
718 is especially useful in oriental languages). The fonts allow for up to
719 128 different fonts. This is interesting and neat stuff, however,
720 XLISP does not support fonts and bits or the optional parameters
721 associated with them.
722
723 NOTE: Unlike the CHAR-CODE and CHAR-INT functions, CODE-CHAR and
724 INT-CHAR are not identical in use. CODE-CHAR accepts 0..127 for its
725 range and then produces NIL results. INT-CHAR accepts 0..255 for its
726 range and then produces errors.
727
728
729
730 
731 File: slisp, Node: comma, Next: comma-at, Prev: code-char, Up: Xlisp Language Reference
732
733 comma
734 =====
735
736 comma
737 type: reader expansion
738 location: built-in
739 source file: xlcont.c and xlread.c
740 Common LISP compatible: yes
741 supported on: all machines
742
743 SYNTAX
744
745 (comma <expr> )
746 <expr> - an expression which is evaluated within
747 a BACKQUOTEd expression
748
749 DESCRIPTION
750
751 A BACKQUOTE special form returns an expression unevaluated, except
752 that portions of the expression may be evaluated when they are
753 preceeded by a COMMA (,) or COMMA-AT (,@). COMMA will evaluate the
754 portion of the expression the comma preceeds. If the portion is an
755 atom or a list, it is placed as is within the expression.
756
757 EXAMPLES
758
759 (setq box 'stuff-inside) ; BOX contains STUFF-INSIDE
760 (print box) ; prints STUFF-INSIDE
761 (quote (i have the box)) ; returns (I HAVE THE BOX)
762 (backquote (i have the box)) ; returns (I HAVE THE BOX)
763 (backquote (I have (comma box))) ; returns (I HAVE STUFF-INSIDE)
764 (backquote (I have the ,@box)) ; returns (I HAVE THE)
765 (setq automobile '(a van)) ; set up AUTOMOBILE
766 (backquote (I have automobile)) ; returns (I HAVE AUTOMOBILE)
767 (backquote (I have ,automobile)) ; returns (I HAVE (A VAN))
768 (backquote (I have ,@automobile)) ; returns (I HAVE A VAN)
769 `(I have ,@automobile) ; returns (I HAVE A VAN)
770
771 READ MACRO: XLISP supports the normal read macro of a comma (,)
772 as a short-hand method of writing the COMMA read-expansion.
773
774 NOTE: BACKQUOTE and COMMA and COMMA-AT are very useful in defining
775 macros via DEFMACRO.
776
777
778
779 
780 File: slisp, Node: comma-at, Next: cond, Prev: comma, Up: Xlisp Language Reference
781
782 comma-at
783 ========
784
785 comma-at
786 type: reader expansion
787 location: built-in
788 source file: xlcont.c and xlread.c
789 Common LISP compatible: yes
790 supported on: all machines
791
792 SYNTAX
793
794 (comma-at <expr> )
795 <expr> - an expression which is evaluated within
796 a BACKQUOTEd expression
797
798 DESCRIPTION
799
800 A BACKQUOTE special form returns an expression unevaluated, except
801 that portions of the expression may be evaluated when they are
802 preceeded by a COMMA (,) or COMMA-AT (,@). COMMA-AT will evaluate the
803 portion of the expression that the comma-at preceeds. The portion
804 needs to be a list. The list is spliced into the expression. If the
805 portion is not a list, COMMA-AT will splice in nothing.
806
807 EXAMPLES
808
809 (setq box 'stuff-inside) ; BOX contains STUFF-INSIDE
810 (print box) ; prints STUFF-INSIDE
811 (quote (i have the box)) ; returns (I HAVE THE BOX)
812 (backquote (i have the box)) ; returns (I HAVE THE BOX)
813 (backquote (I have (comma box))) ; returns (I HAVE STUFF-INSIDE)
814 (backquote (I have the ,@box)) ; returns (I HAVE THE)
815 (setq automobile '(a van)) ; set up AUTOMOBILE
816 (backquote (I have automobile)) ; returns (I HAVE AUTOMOBILE)
817 (backquote (I have (comma automobile))) ; returns (I HAVE (A VAN))
818 (backquote (I have ,@automobile)) ; returns (I HAVE A VAN)
819 `(I have ,@automobile) ; returns (I HAVE A VAN)
820
821 READ MACRO: XLISP supports the normal read macro of a comma (,@) as
822 a short-hand method of writing the COMMA-AT read-expansion.
823
824 NOTE: BACKQUOTE and COMMA and COMMA-AT are very useful in defining
825 macros via DEFMACRO.
826
827
828
829 
830 File: slisp, Node: cond, Next: cons, Prev: comma-at, Up: Xlisp Language Reference
831
832 cond
833 ====
834
835 cond
836 type: special form (fsubr)
837 location: built-in
838 source file: xlcont.c
839 Common LISP compatible: yes
840 supported on: all machines
841
842 SYNTAX
843
844 (cond [ ( <pred1> <expr1> ) [ ( <pred2> <expr2> ) ... ] ] )
845 <predN> - a predicate (NIL/non-NIL) expression
846 <exprN> - an expression
847
848 DESCRIPTION
849
850 The COND special form evaluates a series of predicate / expression
851 pairs. COND will evaluate each predicate in sequential order until it
852 finds one that returns a non-NIL value. The expression that is
853 associated with the non-NIL value is evaluated. The resulting value of
854 the evaluated expression is returned by COND. If there are no
855 predicates that return a non-NIL value, NIL is returned by COND. Only
856 one expression is evaluated - the first one with a non-NIL predicate.
857 Note that the predicate can be a symbol or expression.
858
859 EXAMPLES
860
861 (cond ; sample CONDitional
862 ((not T) (print "this won't print")) ;
863 ( NIL (print "neither will this")) ;
864 ( T (print "this will print")) ;
865 ( T (print "won't get here"))) ; prints "this will print"
866 (defun print-what (parm)
867 (cond ; start of COND
868 ((numberp parm) (print "numeric")) ; check for number
869 ((consp parm) (print "list")) ; check for list
870 ((null parm) (print "nil")) ; check for NIL
871 (T (print "something"))) ; catch-all
872 NIL) ; always return
873 ;
874 (print-what 'a) ; prints "something"
875 (print-what 12) ; prints "numeric"
876 (print-what NIL) ; prints "nil"
877 (print-what '(a b)) ; prints "list"
878
879
880
881 
882 File: slisp, Node: cons, Next: consp, Prev: cond, Up: Xlisp Language Reference
883
884 cons
885 ====
886
887 cons
888 type: function (subr)
889 location: built-in
890 source file: xllist.c
891 Common LISP compatible: yes
892 supported on: all machines
893
894 SYNTAX
895
896 (cons <expr-car> <expr-cdr> )
897 <arg> - description
898 <expr-car> - an expression
899 <expr-cdr> - an expression
900
901 DESCRIPTION
902
903 The CONS function takes two expressions and constructs a new list
904 from them. If the <expr-cdr> is not a list, then the result will be a
905 'dotted-pair'.
906
907 EXAMPLES
908
909 (cons 'a 'b) ; returns (A . B)
910 (cons 'a nil) ; returns (A)
911 (cons 'a '(b)) ; returns (A B)
912 (cons '(a b) '(c d)) ; returns ((A B) C D)
913 (cons '(a b) 'c) ; returns ((A B) . C)
914 (cons (- 4 3) '(2 3)) ; returns (1 2 3)
915
916
917
918 
919 File: slisp, Node: consp, Next: ;constituent, Prev: cons, Up: Xlisp Language Reference
920
921 consp
922 =====
923
924 consp
925 type: predicate function (subr)
926 location: built-in
927 source file: xlbfun.c
928 Common LISP compatible: yes
929 supported on: all machines
930
931 SYNTAX
932
933 (consp <expr> )
934 <expr> - the expression to check
935
936 DESCRIPTION
937
938 The CONSP predicate checks if the <expr> is a non-empty list. T is
939 returned if <expr> is a list, NIL is returned otherwise. Note that if
940 the <expr> is NIL, NIL is returned.
941
942 EXAMPLES
943
944 (consp '(a b)) ; returns T - list
945 (consp '(a . b)) ; returns T - dotted pair list
946 (consp #'defvar) ; returns NIL - closure - macro
947 (consp (lambda (x) (print x))) ; returns NIL - closure - lambda
948 (consp NIL) ; returns NIL - NIL
949 (consp #(1 2 3)) ; returns NIL - array
950 (consp *standard-output*) ; returns NIL - stream
951 (consp 1.2) ; returns NIL - float
952 (consp #'quote) ; returns NIL - fsubr
953 (consp 1) ; returns NIL - integer
954 (consp object) ; returns NIL - object
955 (consp "str") ; returns NIL - string
956 (consp #'car) ; returns NIL - subr
957 (consp 'a) ; returns NIL - symbol
958
959 NOTE: When applied to CONSP, NIL - the empty list - returns a NIL.
960 NIL or '() is used in many places as a list-class or atom-class
961 expression. Both ATOM and LISTP, when applied to NIL, return T. If
962 you wish to check for a list where an empty list is still considered a
963 valid list, use the LISTP predicate.
964
965
966
967 
968 File: slisp, Node: ;constituent, Next: continue, Prev: consp, Up: Xlisp Language Reference
969
970 :constituent
971 ============
972
973 :constituent
974 type: keyword
975 location: built-in
976 source file: xlread.c
977 Common LISP compatible: no
978 supported on: all machines
979
980 SYNTAX
981
982 :constituent
983
984 DESCRIPTION
985
986 :CONSTITUENT is an entry that is used in the *READTABLE*.
987 *READTABLE* is a system variable that contains XLISP's data structures
988 relating to the processing of characters from the user (or files) and
989 read-macro expansions. The existance of the :CONSTITUENT keyword means
990 that the specified character is to be used, as is, with no further
991 processing. The system defines that the following characters are
992 :CONSTITUENT characters:
993
994 0123456789 !$%&*+-./ :<=>?@[]^_{}~
995 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
996
997 EXAMPLES
998
999 (defun look-at (table) ; define a function to
1000 (dotimes (ch 127) ; look in a table
1001 (prog ( (entry (aref table ch)) ) ; and print out any
1002 (case entry ; entries with a function
1003 (:CONSTITUENT ;
1004 (princ (int-char ch))) ;
1005 (T NIL)))) ;
1006 (terpri)) ;
1007 (look-at *readtable*) ; prints !$%&*+-./0123456789
1008 ; :<=>?@ABCDEFGHIJKLM
1009 ; NOPQRSTUVWXYZ[]^_ab
1010 ; cdefghijklmnopqrstu
1011 ; vwxyz{}~
1012
1013 CAUTION: If you experiment with *READTABLE*, it is useful to save
1014 the old value in a variable, so that you can restore the system state.
1015
1016
1017
1018 
1019 File: slisp, Node: continue, Next: cos, Prev: ;constituent, Up: Xlisp Language Reference
1020
1021 continue
1022 ========
1023
1024 continue
1025 type: function (subr)
1026 location: built-in
1027 source file: xlbfun.c and xldbug.c
1028 Common LISP compatible: no
1029 supported on: all machines
1030
1031 SYNTAX
1032
1033 (continue)
1034
1035 DESCRIPTION
1036
1037 The CONTINUE function attempts to continue from the break loop.
1038 This is valid only for CERRORs (continuable errors). If CONTINUE is
1039 evaluated while not in a break loop, an error is generated - "error:
1040 not in a break loop". This error does not cause XLISP to go into a
1041 break loop. CONTINUE never actually returns a value.
1042
1043 EXAMPLES
1044
1045 (continue) ; error: not in a break loop
1046 (break "out") ; break: out
1047 (continue) ; to continue from break loop
1048 ; BREAK returns NIL
1049
1050 KEYSTROKE EQUIVALENT: In the IBM PC and MS-DOS versions of XLISP, a
1051 CTRL-p key sequence has the same effect as doing a (CONTINUE). On a
1052 Macintosh, this can be accomplished by a pull-down menu or a COMMAND-p.
1053
1054
1055
1056 
1057 File: slisp, Node: cos, Next: debug, Prev: continue, Up: Xlisp Language Reference
1058
1059 cos
1060 ===
1061
1062 cos
1063 type: function (subr)
1064 location: built-in
1065 source file: xlmath.c
1066 Common LISP compatible: yes
1067 supported on: all machines
1068
1069 SYNTAX
1070
1071 (cos <expr> )
1072 <expr> - floating point number/expression
1073
1074 DESCRIPTION
1075
1076 The cos function returns the cosine of the <expr>. The <expr> is in
1077 radians.
1078
1079 EXAMPLES
1080
1081 (cos 0.0) ; returns 1
1082 (cos (/ 3.14159 2)) ; returns 1.32679e-06 (almost 0)
1083 (cos .5) ; returns 0.877583
1084 (cos 0) ; error: bad integer operation
1085 (cos 1.) ; error: bad integer operation
1086
1087
1088
1089 
1090 File: slisp, Node: debug, Next: *debug-io*, Prev: cos, Up: Xlisp Language Reference
1091
1092 debug
1093 =====
1094
1095 debug
1096 type: defined function (closure)
1097 location: extension
1098 source file: init.lsp
1099 Common LISP compatible: no
1100 supported on: all machines
1101
1102 SYNTAX
1103
1104 (debug)
1105
1106 DESCRIPTION
1107
1108 The DEBUG function sets *BREAKENABLE* to T. This has the effect of
1109 turning on the break loop for errors. DEBUG always returns T. The
1110 default is DEBUG enabled.
1111
1112 EXAMPLES
1113
1114 (debug) ; returns T
1115 (+ 1 "a") ; error: bad argument type
1116 ; enters break-loop
1117 (clean-up) ; from within the break-loop
1118 (nodebug) ; returns NIL
1119 (+ 1 "a") ; error: bad argument type
1120 ; but doesn't enter break-loop
1121
1122 NOTE: The functions DEBUG and NODEBUG are created in the INIT.LSP
1123 file. If they do not exist in your XLISP system, you might be having a
1124 problem with INIT.LSP. Before you start XLISP, look in the directory
1125 you are currently in, and check to see if there is an INIT.LSP.
1126
1127
1128
1129 
1130 File: slisp, Node: *debug-io*, Next: defconstant, Prev: debug, Up: Xlisp Language Reference
1131
1132 *debug-io*
1133 ==========
1134
1135 *debug-io*
1136 type: system variable
1137 location: built-in
1138 source file: xlinit.c xlio.c xldbug.c
1139 Common LISP compatible: yes
1140 supported on: all machines
1141
1142 SYNTAX
1143
1144 *debug-io*
1145
1146 DESCRIPTION
1147
1148 *DEBUG-IO* is a system variable that contains a file pointer that
1149 points to the stream where all debug input/output goes to and from. The
1150 default file for *DEBUG-IO* is the system standard error device -
1151 normally the keyboard and screen.
1152
1153 EXAMPLES
1154
1155 *debug-io* ; returns #<File-Stream: #243de>
1156
1157 NOTE: *TRACE-OUTPUT*, *DEBUG-IO* and *ERROR-OUTPUT* are normally all
1158 set to the same file stream - STDERR.
1159
1160
1161
1162 
1163 File: slisp, Node: defconstant, Next: defmacro, Prev: *debug-io*, Up: Xlisp Language Reference
1164
1165 defconstant
1166 ===========
1167
1168 defconstant
1169 type: defined macro (closure)
1170 location: extension
1171 source file: init.lsp
1172 Common LISP compatible: similar
1173 supported on: all machines
1174
1175 SYNTAX
1176
1177 (defconstant <symbol> <init-value> )
1178 <symbol> - an expression evaluating to a symbol
1179 <init-value> - an initial value expression
1180
1181 DESCRIPTION
1182
1183 The DEFCONSTANT macro defines a user constant with the name <symbol>.
1184 The <symbol> is created with the initial value <init-value> expression.
1185 If <symbol> did exist, its previous value will be overwritten.
1186 DEFCONSTANT returns the <symbol> as its result.
1187
1188 EXAMPLES
1189
1190 (boundp 'mvyar) ; returns NIL - doesn't exist
1191 (defconstant myvar 7) ; returns MYVAR
1192 (boundp 'myvar) ; returns T
1193 myvar ; returns 7
1194
1195 BUG: In Common LISP, the definition of DEFCONSTANT is such that
1196 it returns the <symbol> as its result. XLISP returns the value of
1197 <symbol>.
1198
1199 COMMON LISP COMPATIBILITY: In Common LISP, any change to the value
1200 of the DEFCONSTANT <symbol> is supposed to generate an error. XLISP
1201 treats it like any user symbol and allows it to change.
1202
1203 COMMON LISP COMPATIBILITY: Common LISP supports an additional
1204 optional parameter. This parameter is a documentation string. XLISP
1205 does not support this.
1206
1207 NOTE: The functions DEFVAR, DEFPARAMETER and DEFCONSTANT are created
1208 in the INIT.LSP file. If it does not exist in your XLISP system, you
1209 might be having a problem with INIT.LSP. Before you start XLISP, look
1210 in the directory you are currently in, and check to see if there is an
1211 INIT.LSP.
1212
1213
1214
1215 
1216 File: slisp, Node: defmacro, Next: defparameter, Prev: defconstant, Up: Xlisp Language Reference
1217
1218 defmacro
1219 ========
1220
1221 defmacro
1222 type: special form (fsubr)
1223 location: built-in
1224 source file: xlcont.c
1225 Common LISP compatible: yes
1226 supported on: all machines
1227
1228 SYNTAX
1229
1230 (defmacro <symbol> <arg-list> <body> )
1231 <symbol> - The name of the macro being defined
1232 <arg-list> - A list of the formal arguments to the macro
1233 of the form: ( [ <arg1> ... ]
1234 [ &optional <oarg1> ... ]
1235 [ &rest <rarg> ]
1236 [ &key ... ]
1237 [ &aux <aux1> ... ] )
1238 <body> - A series of LISP forms (expressions)
1239
1240 DESCRIPTION
1241
1242 DEFMACRO defines a macro expansion. When the <symbol> name of the
1243 macro expansion is encountered (similar to a function invocation), the
1244 <body> of code that was defined in the DEFMACRO is expanded and
1245 replaces the macro invocation.
1246
1247 All of the <argN> formal arguments that are defined are required to
1248 appear in the invocation of the macro expansion. If there are any
1249 &OPTIONAL arguments defined, they will be filled in order. If there is
1250 a &REST argument defined, and all the required formal arguments and
1251 &OPTIONAL arguments are filled, any and all further parameters will be
1252 passed into the function via the <rarg> argument. Note that there can
1253 be only one <rarg> argument for &REST. If there are insufficient
1254 parameters for any of the &OPTIONAL or &REST arguments, they will
1255 contain NIL. The &AUX variables are a mechanism for you to define
1256 variables local to the DEFMACRO execution. At the end of the function
1257 execution, these local symbols and their values are are removed.
1258
1259 EXAMPLES
1260
1261 (defmacro plus (num1 num2) ; define PLUS macro
1262 `(+ ,num1 ,num2)) ; which is a 2 number add
1263 (plus 1 2) ; returns 3
1264 (setq x 10) ; set x to 10
1265 (setq y 20) ; set y to 20
1266 (plus x y) ; returns 30
1267 (defmacro betterplus (num &rest nlist) ; define a BETTERPLUS macro
1268 `(+ ,num ,@nlist)) ; which can take many numbers
1269 (betterplus 1) ; returns 1
1270 (betterplus 1 2 3) ; returns 6
1271 (betterplus 1 2 3 4 5) ; returns 15
1272 (defmacro atest (x &optional y &rest z) ; define ATEST macro
1273 (princ " x: ") (princ x) ; \
1274 (princ " y: ") (princ y) ; print out the parameters
1275 (princ " z: ") (princ z) (terpri) ; / (un-evaluated)
1276 `(print (+ ,x ,y ,@z)) ) ; add them together (eval'ed)
1277 ;
1278 (atest 1) ; prints - x: 1 y: NIL z: NIL
1279 ; error: bad argument type
1280 ; because (+ 1 NIL) isn't valid
1281 (atest 1 2) ; prints - x: 1 y: 2 z: NIL
1282 ; returns 3
1283 (atest 1 2 3) ; prints - x: 1 y: 2 z: (3)
1284 ; returns 6
1285 (atest 1 2 3 4 5) ; prints - x: 1 y: 2 z: (3 4 5)
1286 ; returns 15
1287 ;
1288 (setq a 99) ; set A to 99
1289 (setq b 101) ; set B to 101
1290 (atest a b) ; prints - x: A y: B z: NIL
1291 ; returns 200
1292 (atest a b 9 10 11) ; prints - x: A y: B z: (9 10 11)
1293 ; returns 230
1294
1295 COMMON LISP COMPATIBILITY: Common LISP supports an optional
1296 documentation string as the first form in the <body> of a DEFMACRO or
1297 DEFUN. XLISP will accept this string as a valid form, but it will not
1298 do anything special with it.
1299
1300
1301
1302 
1303 File: slisp, Node: defparameter, Next: defun, Prev: defmacro, Up: Xlisp Language Reference
1304
1305 defparameter
1306 ============
1307
1308 defparameter
1309 type: defined macro (closure)
1310 location: extension
1311 source file: init.lsp
1312 Common LISP compatible: similar
1313 supported on: all machines
1314
1315 SYNTAX
1316
1317 (defparameter <symbol> <init-value> )
1318 <symbol> - an expression evaluating to a symbol
1319 <init-value> - an initial value expression
1320
1321 DESCRIPTION
1322
1323 The DEFPARAMETER macro defines a user parameter (variable) with the
1324 name <symbol>. A user parameter is supposed to be a variable that
1325 should not change but is allowed to change. The <symbol> is created
1326 with the initial value <init-value> expression. If <symbol> did exist,
1327 its previous value will be overwritten. DEFPARAMETER returns the
1328 <symbol> as its result.
1329
1330 EXAMPLES
1331
1332 (boundp 'mvyar) ; returns NIL - doesn't exist
1333 (defparameter myvar 7) ; returns MYVAR
1334 (boundp 'myvar) ; returns T
1335 myvar ; returns 7
1336
1337 BUG: In Common LISP, the definition of DEFPARAMETER is such that
1338 it returns the <symbol> as its result. XLISP returns the value of
1339 <symbol>.
1340
1341 COMMON LISP COMPATIBILITY: Common LISP supports an additional
1342 optional parameter. This parameter is a documentation string. XLISP
1343 does not support this.
1344
1345 NOTE: The functions DEFVAR, DEFPARAMETER and DEFCONSTANT are created
1346 in the INIT.LSP file. If it does not exist in your XLISP system, you
1347 might be having a problem with INIT.LSP. Before you start XLISP, look
1348 in the directory you are currently in, and check to see if there is an
1349 INIT.LSP.
1350
1351
1352
1353 
1354 File: slisp, Node: defun, Next: defvar, Prev: defparameter, Up: Xlisp Language Reference
1355
1356 defun
1357 =====
1358
1359 defun
1360 type: special form (fsubr)
1361 location: built-in
1362 source file: xlcont.c
1363 Common LISP compatible: yes
1364 supported on: all machines
1365
1366 SYNTAX
1367
1368 (defun <symbol> <arg-list> <body> )
1369 <symbol> - The name of the function being defined
1370 <arg-list> - A list of the formal arguments to the function
1371 of the form: ( [ <arg1> ... ]
1372 [ &optional <oarg1> ... ]
1373 [ &rest <rarg> ]
1374 [ &key ... ]
1375 [ &aux <aux1> ... ] )
1376 <body> - A series of LISP forms (expressions) that
1377 are executed in order.
1378
1379 DESCRIPTION
1380
1381 DEFUN defines a new function or re-defines an exisiting function.
1382 The last form in <body> that is evaluated is the value that is returned
1383 when the function is executed.
1384
1385 All of the <argN> formal arguments that are defined are required to
1386 appear in a call to the defined function. If there are any &OPTIONAL
1387 arguments defined, they will be filled in order. If there is a &REST
1388 argument defined, and all the required formal arguments and &OPTIONAL
1389 arguments are filled, any and all further parameters will be passed into
1390 the function via the <rarg> argument. Note that there can be only one
1391 <rarg> argument for &REST. If there are insufficient parameters for any
1392 of the &OPTIONAL or &REST arguments, they will contain NIL. The &AUX
1393 variables are a mechanism for you to define variables local to the
1394 function definition. At the end of the function execution, these local
1395 symbols and their values are are removed.
1396
1397 EXAMPLES
1398
1399 (defun my-add ; define function MY-ADD
1400 (num1 num2) ; with 2 formal parameters
1401 (+ num1 num2)) ; that adds the two paramters
1402 (my-add 1 2) ; returns 3
1403 (defun foo ; define function FOO
1404 (a b &optional c d &rest e) ; with some of each argument
1405 (print a) (print b) ;
1406 (print c) (print d) ; print out each
1407 (print e)) ;
1408 (foo) ; error: too few arguments
1409 (foo 1) ; error: too few arguments
1410 (foo 1 2) ; prints 1 2 NIL NIL NIL
1411 (foo 1 2 3) ; prints 1 2 3 NIL NIL
1412 (foo 1 2 3 4) ; prints 1 2 3 4 NIL
1413 (foo 1 2 3 4 5) ; prints 1 2 3 4 (5)
1414 (foo 1 2 3 4 5 6 7 8 9) ; prints 1 2 3 4 (5 6 7 8 9)
1415 (defun my-add ; define function MY-ADD
1416 (num1 &rest num-list &aux sum) ; with 1 arg, rest, 1 aux var
1417 (setq sum num1) ; clear SUM
1418 (dotimes (i (length num-list) ) ; loop through rest list
1419 (setq sum (+ sum (car num-list))) ; add the number to sum
1420 (setq num-list (cdr num-list))) ; and remove num from list
1421 sum) ; return sum when finished
1422 (my-add 1 2 3 4) ; returns 10
1423 (my-add 5 5 5 5 5) ; returns 25
1424
1425 COMMON LISP COMPATIBILITY: Common LISP supports an optional
1426 documentation string as the first form in the <body> of a DEFMACRO or
1427 DEFUN. XLISP will accept this string as a valid form, but it will not
1428 do anything special with it.
1429
1430
1431

brinkley@uw.edu
ViewVC Help
Powered by ViewVC 1.1.26