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

Contents of /skandha4/info/slisp-4

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: A More Realistic Example, Prev: Object And Class, Up: Xlisp Objects Tutorial
12
13 A More Realistic Example
14 ========================
15
16 The following is an example, using the idea of tools again. It
17 contains a hierarchy of tool classes. The top of the class hierarchy
18 is TOOLS. HAND-TOOLS and SHOP-TOOLS are sub-classes of TOOLS. The
19 example creates instances of these sub-classes. It is possible to
20 extend this example in various ways. One obvious extension would be to
21 create a third tier of classes under HAND-TOOLS that could contain
22 classes like drills, screwdrivers, pliers and so on.
23
24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25 ;
26 ; Define the superclasses and classes
27 ;
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29 ;
30 ; make TOOLS superclass
31 ; with a different :ISNEW method
32 ; added methods are :BORROW and :RETURN
33 ; class variables are NUMBER contains # of tool instances
34 ; ACTIVE-LIST contains list of current objects
35 ; instance variables are POWER list - (AC BATTERY HAND)
36 ; MOVEABLE CAN-CARRY or CAN-ROLL or FIXED
37 ; OPERATIONS list
38 ; MATERIAL list - (WOOD METAL PLASTIC ...)
39 ; PIECES list
40 ; LOCATION HOME or person's name
41 ;
42
43 (setq tools (send class :new '(power
44 moveable
45 operations
46 material
47 pieces
48 location)
49 '(number active-list)))
50
51 (send tools :answer :isnew '()
52 '((if (null number) (setq number 1)
53 (setq number (1+ number)))
54 (setq active-list (cons self active-list))
55 (setq location 'home)))
56
57 (send tools :answer :borrow '(by-who)
58 '((if (eq location 'home) (setq location by-who)
59 (print "you can't"))))
60
61 (send tools :answer :return '()
62 '((if (eq location 'home) (print "got it already")
63 (setq location 'home))))
64
65 ;
66 ; make HAND-TOOLS class
67 ; with a different :ISNEW method
68 ; new instance variable WEIGHT <number> of pounds
69 ; the rest is inherited from TOOLS
70 ;
71 (setq hand-tools (send class :new '(weight) '() tools))
72 (send hand-tools :answer :isnew '(pow op mat parts w-in)
73 '((setq power pow)
74 (setq moveable 'can-carry)
75 (setq operations op)
76 (setq material mat)
77 (setq pieces parts)
78 (setq weight w-in)
79 (send-super :isnew)))
80
81 ;
82 ; make SHOP-TOOLS class
83 ; with a different :ISNEW method
84 ; no new instance variables
85 ; the rest is inherited from TOOLS
86 ;
87 (setq shop-tools (send class :new '() '() tools))
88 (send shop-tools :answer :isnew '(pow mov op mat parts)
89 '((setq power pow)
90 (setq moveable mov)
91 (setq operations op)
92 (setq material mat)
93 (setq pieces parts)
94 (send-super :isnew)))
95
96 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
97 ;
98 ; Create instances of various tool classes
99 ;
100 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
101
102 (setq hand-drill (send hand-tools :new ; make an instance - HAND-DRILL
103 '(ac)
104 '(drill polish grind screw)
105 '(wood metal plastic)
106 '(drill drill-bits screw-bits buffer)
107 '2.5))
108
109 (setq table-saw (send shop-tools :new ; make an instance - TABLE-SAW
110 '(ac)
111 'fixed
112 '(rip cross-cut)
113 '(wood plastic)
114 '(saw blades fence)))
115
116 (setq radial-arm (send shop-tools :new ; make an instance = RADIAL-ARM
117 '(ac)
118 'can-roll
119 '(rip cross-cut)
120 '(wood plastic)
121 '(saw blades dust-bag)))
122
123 The following session shows how to use the tool definitions from this
124 better example. The example starts at the OS shell and brings up xlisp
125 running the file 'tools.lsp'.
126
127 ________________________________________________________________
128 |
129 | cmd? xlisp tools
130 | ; loading "init.lsp"
131 | ; loading "tools.lsp"
132 | > (send hand-drill :borrow 'fred)
133 | FRED
134 |
135 | > (send table-saw :return)
136 | "got it already"
137 | "got it already"
138 |
139 | > (send hand-drill :borrow 'joe)
140 | "you can't"
141 | "you can't"
142 |
143 | > (send hand-drill :return)
144 | HOME
145 |________________________________________________________________
146
147 So, Fred was able to borrow the HAND-DRILL. When an attempt was
148 made to return the TABLE-SAW, it was already at home. A second attempt
149 to borrow the HAND-DRILL indicated that "you can't" because it was
150 already lent out. Lastly, the HAND-DRILL was returned successfully.
151 (Note that the "got it already" and "you can't" strings show up twice
152 in the display because the methods both print and return the string.)
153
154 The following session shows the structure of the TOOLS object:
155
156 ________________________________________________________________
157 |
158 | > (send tools :show)
159 | Object is #<Object: #276fc>, Class is #<Object: #23fe2>
160 | MESSAGES = ((:RETURN . #<Closure-:RETURN: #2dbd0>)
161 | (:BORROW . #<Closure-:BORROW: #2ddba>)
162 | (:ISNEW . #<Closure-:ISNEW: #274a4>))
163 | IVARS = (POWER MOVEABLE OPERATIONS MATERIAL PIECES LOCATION)
164 | CVARS = (NUMBER ACTIVE-LIST)
165 | CVALS = #(3 (#<Object: #2cadc>
166 | #<Object: #2cda2>
167 | #<Object: #2d0e0>))
168 | SUPERCLASS = #<Object: #23fd8>
169 | IVARCNT = 6
170 | IVARTOTAL = 6
171 | #<Object: #276fc>
172 |________________________________________________________________
173
174 The two TOOLS sub-classes HAND-TOOLS and SHOP-TOOLS structure looks
175 like:
176
177 ________________________________________________________________
178 |
179 | > (send hand-tools :show)
180 | Object is #<Object: #2dab8>, Class is #<Object: #23fe2>
181 | MESSAGES = ((:ISNEW . #<Closure-:ISNEW: #2d7a2>))
182 | IVARS = (WEIGHT)
183 | CVARS = NIL
184 | CVALS = NIL
185 | SUPERCLASS = #<Object: #276fc>
186 | IVARCNT = 1
187 | IVARTOTAL = 7
188 | #<Object: #2dab8>
189 |
190 | > (send shop-tools :show)
191 | Object is #<Object: #2d680>, Class is #<Object: #23fe2>
192 | MESSAGES = ((:ISNEW . #<Closure-:ISNEW: #2d450>))
193 | IVARS = NIL
194 | CVARS = NIL
195 | CVALS = NIL
196 | SUPERCLASS = #<Object: #276fc>
197 | IVARCNT = 0
198 | IVARTOTAL = 6
199 | #<Object: #2d680>
200 |________________________________________________________________
201
202 The class HAND-TOOLS has an instance HAND-DRILL which looks like:
203
204 ________________________________________________________________
205 |
206 | > (send hand-drill :show)
207 | Object is #<Object: #2d0e0>, Class is #<Object: #2dab8>
208 | WEIGHT = 2.5
209 | POWER = (AC)
210 | MOVEABLE = CAN-CARRY
211 | OPERATIONS = (DRILL POLISH GRIND SCREW)
212 | MATERIAL = (WOOD METAL PLASTIC)
213 | PIECES = (DRILL DRILL-BITS SCREW-BITS BUFFER)
214 | LOCATION = HOME
215 | #<Object: #2d0e0>
216 |________________________________________________________________
217
218 
219 File: slisp, Node: Xlisp Language Reference, Next: Xlisp Internals, Prev: Xlisp Objects Tutorial, Up: Top
220
221 Xlisp Language Reference
222 ************************
223
224 Copyright
225 =========
226
227 This chapter is adapted from an 'XlispRef.doc' file with the
228 following copyright:
229
230 Xlisp 2.0 Language Reference
231
232 by
233
234 Tim I Mikkelsen
235
236 December 11, 1989
237
238 Copyright (c) 1989 by Tim I. Mikkelsen. All Rights Reserved. No
239 part of this document may be copied, reproduced or translated for
240 commercial use without prior written consent of the author.
241 Permission is granted for non-commercial use as long as this
242 notice is left intact.
243
244 This document is intended to serve as a reference for the XLISP 2.0
245 dialect of LISP. It includes a description of each symbol,
246 function, special form and keyword available in XLISP. This
247 reference is not a complete and extensive introduction to LISP
248 programming.
249
250 If you find problems with the reference or find that I have left
251 something out, drop me a line. If you find this useful, I would be
252 interested in hearing that as well. If you are into 'pretty'
253 looking documents (as opposed to plain ASCII text), I have a TeX
254 version of the reference.
255
256 Tim Mikkelsen
257
258 4316 Picadilly Drive
259
260 Fort Collins, Colorado 80526
261
262 * Menu:
263
264 Note: Node names with a leading ';' really should have a leading ':',
265 but info doesn't seem to allow this at present.
266 * Entry Format::
267 * fn *::
268 * var *::
269 * var **::
270 * var ***::
271 * fn +::
272 * +::
273 * ++::
274 * +++::
275 * fn -::
276 * -::
277 * /::
278 * /=::
279 * 1+::
280 * 1-::
281 * <::
282 * <=::
283 * =::
284 * >::
285 * >=::
286 * abs::
287 * acos::
288 * address-of::
289 * alloc::
290 * and::
291 * ;answer::
292 * append::
293 * apply::
294 * *applyhook*::
295 * aref::
296 * arrayp::
297 * asin::
298 * assoc::
299 * atan::
300 * atom::
301 * &aux::
302 * backquote::
303 * baktrace::
304 * block::
305 * both-case-p::
306 * boundp::
307 * break::
308 * *breakenable*::
309 * car::
310 * caar cadr::
311 * caaar caadr cadar caddr ::
312 * caaaar caaadr ... caddar cadddr::
313 * case::
314 * catch::
315 * cdr::
316 * cdar cddr::
317 * cdaar cdadr cddar cdddr cdar cddr::
318 * cdaaar cdaadr ... cdddar cddddr::
319 * cerror::
320 * char::
321 * char/=::
322 * char<::
323 * char<=::
324 * char=::
325 * char>::
326 * char>=::
327 * characterp::
328 * char-code::
329 * char-downcase::
330 * char-equal::
331 * char-greaterp::
332 * char-int::
333 * char-lessp::
334 * char-not-equal::
335 * char-not-greaterp::
336 * char-not-lessp::
337 * char-upcase::
338 * class::
339 * ;class::
340 * clean-up::
341 * close::
342 * code-char::
343 * comma::
344 * comma-at::
345 * cond::
346 * cons::
347 * consp::
348 * ;constituent::
349 * continue::
350 * cos::
351 * debug::
352 * *debug-io*::
353 * defconstant::
354 * defmacro::
355 * defparameter::
356 * defun::
357 * defvar::
358 * delete::
359 * delete-if::
360 * delete-if-not::
361 * digit-char::
362 * digit-char-p::
363 * do::
364 * do*::
365 * dolist::
366 * dotimes::
367 * dribble::
368 * endp::
369 * eq::
370 * eql::
371 * equal::
372 * error::
373 * *error-output*::
374 * errset::
375 * eval::
376 * evalhook::
377 * *evalhook*::
378 * evenp::
379 * exit::
380 * exp::
381 * expand::
382 * expt::
383 * fboundp::
384 * first::
385 * flatc::
386 * flatsize::
387 * flet::
388 * float::
389 * *float-format*::
390 * floatp::
391 * fmakunbound::
392 * format::
393 * fourth::
394 * funcall::
395 * function::
396 * gc::
397 * gcd::
398 * *gc-flag*::
399 * *gc-hook*::
400 * gensym::
401 * get::
402 * get-key::
403 * get-lambda-expression::
404 * get-macro-character::
405 * get-output-stream-list::
406 * get-output-stream-string::
407 * go::
408 * hash::
409 * if::
410 * int-char::
411 * *integer-format*::
412 * integerp::
413 * intern::
414 * ;isnew::
415 * &key::
416 * labels::
417 * lambda::
418 * last::
419 * length::
420 * let::
421 * let*::
422 * list::
423 * listp::
424 * load::
425 * logand::
426 * logior::
427 * lognot::
428 * logxor::
429 * loop::
430 * lower-case-p::
431 * macroexpand::
432 * macroexpand-1::
433 * macrolet::
434 * make-array::
435 * make-string-input-stream::
436 * make-string-output-stream::
437 * make-symbol::
438 * makunbound::
439 * mapc::
440 * mapcan::
441 * mapcar::
442 * mapcon::
443 * mapl::
444 * maplist::
445 * max::
446 * member::
447 * ;mescape::
448 * min::
449 * minusp::
450 * nconc::
451 * ;new::
452 * nil::
453 * ;nmacro::
454 * nodebug::
455 * not::
456 * nstring-downcase::
457 * nstring-upcase::
458 * nth::
459 * nthcdr::
460 * null::
461 * numberp::
462 * *obarray*::
463 * object::
464 * objectp::
465 * oddp::
466 * open::
467 * &optional::
468 * or::
469 * peek::
470 * peek-char::
471 * plusp::
472 * poke::
473 * pp::
474 * pprint::
475 * prin1::
476 * princ::
477 * print::
478 * *print-case*::
479 * prog::
480 * prog*::
481 * prog1::
482 * prog2::
483 * progn::
484 * progv::
485 * psetq::
486 * putprop::
487 * quote::
488 * random::
489 * read::
490 * read-byte::
491 * read-char::
492 * read-line::
493 * *readtable*::
494 * rem::
495 * remove::
496 * remove-if::
497 * remove-if-not::
498 * remprop::
499 * rest::
500 * &rest::
501 * restore::
502 * return::
503 * return-from::
504 * reverse::
505 * room::
506 * rplaca::
507 * rplacd::
508 * save::
509 * savefun::
510 * second::
511 * self::
512 * send::
513 * send-super::
514 * ;sescape::
515 * set::
516 * setf::
517 * set-macro-character::
518 * setq::
519 * ;show::
520 * sin::
521 * sort::
522 * sqrt::
523 * *standard-input*::
524 * *standard-output*::
525 * strcat::
526 * streamp::
527 * string::
528 * string/=::
529 * string<::
530 * string<=::
531 * string=::
532 * string>::
533 * string>=::
534 * stringp::
535 * string-downcase::
536 * string-equal::
537 * string-greaterp::
538 * string-left-trim::
539 * string-lessp::
540 * string-not-equal::
541 * string-not-greaterp::
542 * string-not-lessp::
543 * string-right-trim::
544 * string-trim::
545 * string-upcase::
546 * sublis::
547 * subseq::
548 * subst::
549 * symbol-name::
550 * symbol-plist::
551 * symbol-value::
552 * symbolp::
553 * system::
554 * t::
555 * tagbody::
556 * tan::
557 * terpri::
558 * third::
559 * throw::
560 * ;tmacro::
561 * top-level::
562 * trace::
563 * *tracelimit*::
564 * *tracelist*::
565 * *tracenable*::
566 * *trace-output*::
567 * truncate::
568 * type-of::
569 * *unbound*::
570 * unless::
571 * untrace::
572 * upper-case-p::
573 * unwind-protect::
574 * vector::
575 * when::
576 * ;white-space::
577 * write-byte::
578 * write-char::
579 * zerop::
580
581 
582 File: slisp, Node: Entry Format, Next: fn *, Prev: Xlisp Language Reference, Up: Xlisp Language Reference
583
584 Entry Format
585 ============
586
587 Each entry is a symbol of some variety that the XLISP system will
588 recognize. The parts of each reference entry include:
589
590 Name
591 This top line gives the name or symbol of the entry. The
592 reference has the entries in alphabetical order.
593
594 Type
595 The entry type may be one of the following:
596 - function (subr)
597 - predicate function (subr)
598 - special form (fsubr)
599 - reader expansion
600 - defined function (closure)
601 - defined macro (closure)
602 - system variable
603 - system constant
604 - keyword
605 - object
606 - message selector
607
608 Location
609 This line specifies if the entry is built-in to the system or an
610 extension.
611
612 Source file
613 This line specifies the source file where the routine or code
614 associated with the entry resides. If the entry is an extension,
615 it specifies the source file (usually "init.lsp").
616
617 Common LISP compatible
618 This line specifies whether the entry is compatible with the
619 defintion of Common LISP.
620
621 There are four levels:
622 yes - compatible with Common LISP.
623 similar - compatible, some differences.
624 related - related, major differences.
625 no - not compatible.
626
627 Supported on
628 This line specifies machine dependencies. A few features are
629 available only on PCs or on Macintoshes. (Note that I have not
630 included the Macintosh specific graphics commands.)
631
632 Syntax
633 This area defines the syntax or usage of the entry. It is also
634 used to specify the arguments. Items that are enclosed between a
635 < and a > are arguments. Items enclosed between [ and ] are
636 optional entries. Items that have ... (ellipses) indicate that
637 there can be one or many of the item. Items enclosed between {
638 and } which are separated by | indicate that one of the items
639 should be included.
640
641 Description
642 This defines the entry, necessary conditions, results, defaults,
643 etc.
644
645 Examples
646 This area shows example uses of the entry.
647
648 Comments
649 This area includes additional information such as compatibility
650 notes, bugs, usage notes, potential problems, keystroke
651 equivalences, etc.
652
653 
654 File: slisp, Node: fn *, Next: var *, Prev: Entry Format, Up: Xlisp Language Reference
655
656 fn *
657 ====
658
659 *
660 type: function (subr)
661 location: built-in
662 source file: xlmath.c
663 Common LISP compatible: yes
664 supported on: all machines
665
666 SYNTAX
667
668 (* <expr1> ... )
669 <exprN> - integer or floating point number/expression
670
671 DESCRIPTION
672
673 The multiply (*) function multiplies a list of numbers together and
674 returns the result.
675
676 EXAMPLES
677
678 (* 1) ; returns 1
679 (* 1 2) ; returns 2
680 (* 1 2 3) ; returns 6
681 (* 1 2 3 4) ; returns 24
682 (print (+ 1 2 (* 3.5 (/ 3.9 1.45)))) ; returns and prints 12.4138
683
684
685
686 
687 File: slisp, Node: var *, Next: var **, Prev: fn *, Up: Xlisp Language Reference
688
689 *
690 =
691
692 *
693 type: variable
694 location: built-in
695 source file: xlinit.c xlisp.c
696 Common LISP compatible: yes
697 supported on: all machines
698
699 SYNTAX
700
701 *
702
703 DESCRIPTION
704
705 The * variable is set to the result of the previously evaluated
706 expression.
707
708 EXAMPLES
709
710 (setq a 'b) ; returns B
711 * ; returns B
712 * ; returns B
713
714 NOTE: It is best not to use this variable in a program.
715
716
717
718 
719 File: slisp, Node: var **, Next: var ***, Prev: var *, Up: Xlisp Language Reference
720
721 **
722 ==
723
724 **
725 type: variable
726 location: built-in
727 source file: xlinit.c xlisp.c
728 Common LISP compatible: yes
729 supported on: all machines
730
731 SYNTAX
732
733 **
734
735 DESCRIPTION
736
737 The ** variable is set to the result of the next to the last
738 evaluated expression.
739
740 EXAMPLES
741
742 (setq fee 'fi) ; returns FI
743 (setq fo 'fum) ; returns FUM
744 ** ; returns FI
745 ** ; returns FUM
746 ** ; returns FI
747
748 NOTE: It is best not to use this variable in a program.
749
750
751
752 
753 File: slisp, Node: var ***, Next: fn +, Prev: var **, Up: Xlisp Language Reference
754
755 ***
756 ===
757
758 ***
759 type: variable
760 location: built-in
761 source file: xlinit.c xlisp.c
762 Common LISP compatible: yes
763 supported on: all machines
764
765 SYNTAX
766
767 ***
768
769 DESCRIPTION
770
771 The *** variable is set to the result of the second to the last
772 evaluated expression.
773
774 EXAMPLES
775
776 (setq a 'eenie) ; returns EENIE
777 (setq b 'meenie) ; returns MEENIE
778 (setq c 'beanie) ; returns BEANIE
779 *** ; returns EENIE
780 *** ; returns MEENIE
781 *** ; returns BEANIE
782 *** ; returns EENIE
783
784 NOTE: It is best not to use this variable in a program.
785
786
787
788 
789 File: slisp, Node: fn +, Next: +, Prev: var ***, Up: Xlisp Language Reference
790
791 fn +
792 ====
793
794 +
795 type: function (subr)
796 location: built-in
797 source file: xlmath.c
798 Common LISP compatible: yes
799 supported on: all machines
800
801 SYNTAX
802
803 (+ <expr1> ... )
804 <exprN> - integer or floating point number/expression
805
806 DESCRIPTION
807
808 The add (+) function adds a list of numbers together and returns the
809 result.
810
811 EXAMPLES
812
813 (+ 1) ; returns 1
814 (+ 1 2) ; returns 3
815 (+ 1 2 3) ; returns 6
816 (+ 1 2 3 4) ; returns 10
817 (print (+ 1 2 (* 3.5 (/ 3.9 1.45)))) ; returns and prints 12.4138
818
819
820
821 
822 File: slisp, Node: +, Next: ++, Prev: fn +, Up: Xlisp Language Reference
823
824 +
825 =
826
827 +
828 type: variable
829 location: built-in
830 source file: xlinit.c xlisp.c
831 Common LISP compatible: yes
832 supported on: all machines
833
834 SYNTAX
835
836 +
837
838 DESCRIPTION
839
840 The + variable is set to the most recent input expression.
841
842 EXAMPLES
843
844 (setq hi 'there) ;returns THERE
845 + ;returns (SETQ HI (QUOTE THERE))
846 + ;returns +
847
848 NOTE: It is best not to use this variable in a program.
849
850
851
852 
853 File: slisp, Node: ++, Next: +++, Prev: +, Up: Xlisp Language Reference
854
855 ++
856 ==
857
858 ++
859 type: variable
860 location: built-in
861 source file: xlinit.c xlisp.c
862 Common LISP compatible: yes
863 supported on: all machines
864
865 SYNTAX
866
867 ++
868
869 DESCRIPTION
870
871 The ++ variable is set to the next to the last input expression.
872
873 EXAMPLES
874
875 (setq fee 'fi) ; returns FI
876 (setq fo 'fum) ; returns FUM
877 ++ ; returns (SETQ FEE (QUOTE FI))
878 ++ ; returns (SETQ FO (QUOTE FUM))
879 ++ ; returns ++
880
881 NOTE: It is best not to use this variable in a program.
882
883
884
885 
886 File: slisp, Node: +++, Next: fn -, Prev: ++, Up: Xlisp Language Reference
887
888 +++
889 ===
890
891 +++
892 type: variable
893 location: built-in
894 source file: xlinit.c xlisp.c
895 Common LISP compatible: yes
896 supported on: all machines
897
898 SYNTAX
899
900 +++
901
902 DESCRIPTION
903
904 The +++ variable is set to the second to the last input expression.
905
906 EXAMPLES
907
908 (setq a 'eenie) ;returns EENIE
909 (setq b 'meenie) ;returns MEENIE
910 (setq c 'beanie) ;returns BEANIE
911 + ;returns (SETQ C (QUOTE BEANIE))
912 ++ ;returns (SETQ C (QUOTE BEANIE))
913 +++ ;returns (SETQ C (QUOTE BEANIE))
914 + ;returns +
915
916 NOTE: It is best not to use this variable in a program.
917
918
919
920 
921 File: slisp, Node: fn -, Next: -, Prev: +++, Up: Xlisp Language Reference
922
923 fn -
924 ====
925
926 -
927 type: function (subr)
928 location: built-in
929 source file: xlmath.c
930 Common LISP compatible: yes
931 supported on: all machines
932
933 SYNTAX
934
935 (- <expr1> ... )
936 <exprN> - integer or floating point number/expression
937
938 DESCRIPTION
939
940 The subtract (-) function subtracts a list of numbers from the first
941 number in the list and returns the result. If there is only one number
942 as an argument, it is negated.
943
944 EXAMPLES
945
946 (- 1) ; returns -1
947 (- 1 2) ; returns -1
948 (- 1 2 3) ; returns -4
949 (- 1 2 3 4) ; returns -8
950 (print (+ 1 2 (* 3.5 (/ 3.9 1.45)))) ; returns and prints 12.4138
951
952
953
954 
955 File: slisp, Node: -, Next: /, Prev: fn -, Up: Xlisp Language Reference
956
957 -
958 =
959
960 -
961 type: variable
962 location: built-in
963 source file: xlinit.c xlisp.c
964 Common LISP compatible: yes
965 supported on: all machines
966
967 SYNTAX
968
969 -
970
971 DESCRIPTION
972
973 The - variable is set to the expression currently being evaluated.
974
975 EXAMPLES
976
977 - ; returns -
978 (setq a -) ; returns (SETQ A -)
979 a ; returns (SETQ A -)
980
981 NOTE: It is best not to use this variable in a program.
982
983
984
985 
986 File: slisp, Node: /, Next: /=, Prev: -, Up: Xlisp Language Reference
987
988 /
989 =
990
991 /
992 type: function (subr)
993 location: built-in
994 source file: xlmath.c
995 Common LISP compatible: yes
996 supported on: all machines
997
998 SYNTAX
999
1000 (/ <expr1> ... )
1001 <exprN> - integer or floating point number/expression
1002
1003 DESCRIPTION
1004
1005 The divide (/) function divides the first number in the list by the
1006 rest of the numbers in the list and returns the result. If all the
1007 expressions are integers, the division is integer division. If any
1008 expression is a floating point number, then the division will be
1009 floating point division.
1010
1011 EXAMPLES
1012
1013 (/ 1) ; returns 1
1014 (/ 1 2) ; returns 0 (integer division)
1015 (float (/ 1 2)) ; returns 0 (integer division)
1016 (/ (float 1) 2) ; returns 0.5
1017 (/ 1 1.0 2) ; returns 0.5 (short cut)
1018 (/ (float 1) 2 3) ; returns 0.166667
1019 (/ 1 1.0 2 3 4) ; returns 0.0416667
1020 (print (+ 1 2 (* 3.5 (/ 3.9 1.45)))) ; returns and prints 12.4138
1021
1022 COMMON LISP COMPATIBILITY: Common LISP supports a ratio data type.
1023 This means that (/ 3 4 5) will result in the value 3/20. In XLISP (/ 3
1024 4 5) will result in 0 (because of integer values). (/ 3.0 4 5) will
1025 result in 0.15 for both XLISP and Common LISP.
1026
1027 NOTE: An easy way to force a sequence of integers to be divided as
1028 floating point numbers is to insert the number 1.0 after the first
1029 argument in the list of arguments to the divider function.
1030
1031
1032
1033 
1034 File: slisp, Node: /=, Next: 1+, Prev: /, Up: Xlisp Language Reference
1035
1036 /=
1037 ==
1038
1039 /=
1040 type: function (subr)
1041 location: built-in
1042 source file: xlmath.c
1043 Common LISP compatible: yes
1044 supported on: all machines
1045
1046 SYNTAX
1047
1048 (/= <expr1> <expr2> ... )
1049 <exprN> - a numeric expression
1050
1051 DESCRIPTION
1052
1053 The /= (NOT-EQUAL) operation takes an arbitrary number of numeric
1054 arguments. It checks to see if all the numeric arguments are different.
1055 T is returned if the arguments are numerically not equivalent, NIL is
1056 returned otherwise.
1057
1058 EXAMPLES
1059
1060 (/= 1 1) ; returns NIL
1061 (/= 1 2) ; returns T
1062 (/= 1 1.0) ; returns NIL
1063 (/= 1 2 3) ; returns T
1064 (/= 1 2 2) ; returns NIL
1065 (/= "a" "b") ; error: bad argument type
1066 (setq a 1) (setq b 12.4) ; set up A and B with values
1067 (/= a b) ; returns NIL
1068
1069 BUG: The XLISP /= (NOT-EQUAL) function checks to see if the each
1070 argument is different from the next in the list. This means that (/= 1
1071 2 3) returns T as it is supposed to, but that (/= 1 2 3 2 1) returns T
1072 when it should return NIL. This is only a problem for the /=
1073 (NOT-EQUAL) function.
1074
1075
1076
1077 
1078 File: slisp, Node: 1+, Next: 1-, Prev: /=, Up: Xlisp Language Reference
1079
1080 1+
1081 ==
1082
1083 1+
1084 type: function (subr)
1085 location: built-in
1086 source file: xlmath.c
1087 Common LISP compatible: yes
1088 supported on: all machines
1089
1090 SYNTAX
1091
1092 (1+ <expr> )
1093 <expr> - integer or floating point number/expression
1094
1095 DESCRIPTION
1096
1097 The increment (1+) function adds one to a number and returns the
1098 result.
1099
1100 EXAMPLES
1101
1102 (1+ 1) ; returns 2
1103 (1+ 99.1) ; returns 100.1
1104 (1+ 1 2) ; error: too many arguments
1105
1106
1107
1108 
1109 File: slisp, Node: 1-, Next: <, Prev: 1+, Up: Xlisp Language Reference
1110
1111 1-
1112 ==
1113
1114 1-
1115 type: function (subr)
1116 location: built-in
1117 source file: xlmath.c
1118 Common LISP compatible: yes
1119 supported on: all machines
1120
1121 SYNTAX
1122
1123 (1- <expr> )
1124 <expr> - integer or floating point number/expression
1125
1126 DESCRIPTION
1127
1128 The decrement (1-) function subtracts one from a number and returns
1129 the result.
1130
1131 EXAMPLES
1132
1133 (1- 1) ; returns 0
1134 (1- 99.6) ; returns 98.6
1135 (1- 1 2) ; error: too many arguments
1136
1137
1138
1139 
1140 File: slisp, Node: <, Next: <=, Prev: 1-, Up: Xlisp Language Reference
1141
1142 <
1143 =
1144
1145 <
1146 type: function (subr)
1147 location: built-in
1148 source file: xlmath.c
1149 Common LISP compatible: yes
1150 supported on: all machines
1151
1152 SYNTAX
1153
1154 (< <expr1> <expr2> ... )
1155 <exprN> - a numeric expression
1156
1157 DESCRIPTION
1158
1159 The < (LESS-THAN) operation takes an arbitrary number of numeric
1160 arguments. It checks to see if all the numbers are monotonically
1161 increasing. T is returned if the arguments are numerically,
1162 monotonically increasing, , NIL is returned otherwise. In the case of
1163 two arguments, this has the effect of testing if <expr1> is less than
1164 <expr2>.
1165
1166 EXAMPLES
1167
1168 (< 1 2) ; returns T
1169 (< 1 1) ; returns NIL
1170 (< -1.5 -1.4) ; returns T
1171 (< 1 2 3 4) ; returns T
1172 (< 1 2 3 2) ; returns NIL
1173 (< "a" "b") ; error: bad argument type
1174 (setq a 12) (setq b 13.99) ; set up A and B with values
1175 (< a b) ; returns T
1176 (< b a) ; returns NIL
1177
1178
1179
1180 
1181 File: slisp, Node: <=, Next: =, Prev: <, Up: Xlisp Language Reference
1182
1183 <=
1184 ==
1185
1186 <=
1187 type: function (subr)
1188 location: built-in
1189 source file: xlmath.c
1190 Common LISP compatible: yes
1191 supported on: all machines
1192
1193 SYNTAX
1194
1195 (<= <expr1> <expr2> ... )
1196 <exprN> - a numeric expression
1197
1198 DESCRIPTION
1199
1200 The <= (LESS-THAN-OR-EQUAL) operation takes an arbitrary number of
1201 numeric arguments. It checks to see if all the numbers are
1202 monotonically non-decreasing. T is returned if the arguments are
1203 numerically, monotonically non-decreasing, NIL is returned otherwise.
1204 For two arguments, this has the effect of testing if <expr1> is less
1205 than or equal to <expr2>.
1206
1207 EXAMPLES
1208
1209 (<= 1 1) ; returns T
1210 (<= 1 2) ; returns T
1211 (<= 2.0 1.99) ; returns NIL
1212 (<= 1 2 3 3) ; returns T
1213 (<= 1 2 3 3 2) ; returns NIL
1214 (<= "aa" "aa") ; error: bad argument type
1215 (setq a 12) (setq b 999.999) ; set up A and B with values
1216 (<= a b) ; returns T
1217 (<= b a) ; returns NIL
1218
1219
1220
1221 
1222 File: slisp, Node: =, Next: >, Prev: <=, Up: Xlisp Language Reference
1223
1224 =
1225 =
1226
1227 =
1228 type: function (subr)
1229 location: built-in
1230 source file: xlmath.c
1231 Common LISP compatible: yes
1232 supported on: all machines
1233
1234 SYNTAX
1235
1236 (= <expr1> <expr2> ... )
1237 <exprN> - a numeric expression
1238
1239 DESCRIPTION
1240
1241 The = (EQUALITY) operation takes an arbitrary number of numeric
1242 arguments. It checks to see if all the numbers are equal. T is
1243 returned if all of the arguments are numerically equal to each other,
1244 NIL is returned otherwise.
1245
1246 EXAMPLES
1247
1248 (= 1 1) ; returns T
1249 (= 1 2) ; returns NIL
1250 (= 1 1.0) ; returns T
1251 (= 1 1.0 1 (+ 0 1)) ; returns T
1252 (= 1 1.0 1.00001) ; returns NIL
1253 (= "a" "b") ; error: bad argument type
1254 (setq a 1) (setq b 1.0) ; set up A and B with values
1255 (= a b) ; returns T
1256
1257
1258
1259 
1260 File: slisp, Node: >, Next: >=, Prev: =, Up: Xlisp Language Reference
1261
1262 >
1263 =
1264
1265 >
1266 type: function (subr)
1267 location: built-in
1268 source file: xlmath.c
1269 Common LISP compatible: yes
1270 supported on: all machines
1271
1272 SYNTAX
1273
1274 (> <expr1> <expr2> ... )
1275 <exprN> - a numeric expression
1276
1277 DESCRIPTION
1278
1279 The > (GREATER-THAN) operation takes an arbitrary number of numeric
1280 arguments. It checks to see if all the numbers are monotonically
1281 decreasing. T is returned if the arguments are numerically,
1282 monotonically decreasing, NIL is returned otherwise. For two arguments,
1283 this has the effect of testing if <expr1> is greater than <expr2>.
1284
1285 EXAMPLES
1286
1287 (> 1 1) ; returns NIL
1288 (> 1 2) ; returns NIL
1289 (> 2.0 1.99) ; returns T
1290 (> 3 2 1) ; returns T
1291 (> 3 2 2) ; returns NIL
1292 (> "aa" "aa") ; error: bad argument type
1293 (setq a 12) (setq b 999.999) ; set up A and B with values
1294 (> a b) ; returns NIL
1295 (> b a) ; returns T
1296
1297
1298
1299 
1300 File: slisp, Node: >=, Next: abs, Prev: >, Up: Xlisp Language Reference
1301
1302 >=
1303 ==
1304
1305 >=
1306 type: function (subr)
1307 location: built-in
1308 source file: xlmath.c
1309 Common LISP compatible: yes
1310 supported on: all machines
1311
1312 SYNTAX
1313
1314 (>= <expr1> <expr2> ... )
1315 <exprN> - a numeric expression
1316
1317 DESCRIPTION
1318
1319 The >= (GREATER-THAN-OR-EQUAL) operation takes an arbitrary number of
1320 numeric arguments. It checks to see if all the numbers are
1321 monotonically non-increasing. T is returned if <expr1> is the arguments
1322 are numerically, monotonically non-increasing, NIL is returned
1323 otherwise. For two arguments, this has the effect of testing if <expr1>
1324 is greater than or equal to <expr2>.
1325
1326 EXAMPLES
1327
1328 (>= 1 2) ; returns NIL
1329 (>= 1 1) ; returns T
1330 (>= -1.5 -1.4) ; returns NIL
1331 (>= 3 2 1) ; returns T
1332 (>= 3 2 2) ; returns T
1333 (>= 3 2 3) ; returns NIL
1334 (>= "aa" "abc") ; error: bad argument type
1335 (setq a 12) (setq b 13.99) ; set up A and B with values
1336 (>= a b) ; returns NIL
1337 (>= b a) ; returns T
1338
1339
1340
1341 
1342 File: slisp, Node: abs, Next: acos, Prev: >=, Up: Xlisp Language Reference
1343
1344 abs
1345 ===
1346
1347 abs
1348 type: function (subr)
1349 location: built-in
1350 source file: xlmath.c
1351 Common LISP compatible: yes
1352 supported on: all machines
1353
1354 SYNTAX
1355
1356 (abs <expr> )
1357 <expr> - integer or floating point number/expression
1358
1359 DESCRIPTION
1360
1361 The ABS function finds the absolute value of a number and returns the
1362 result.
1363
1364 EXAMPLES
1365
1366 (abs 1) ; returns 1
1367 (abs -99) ; returns 99
1368 (abs -99.9) ; returns 99.9
1369 (abs -32768) ; returns 32768
1370
1371 COMMON LISP COMPATIBILITY: Common LISP supports a complex number
1372 data type which is not supported in XLISP.
1373
1374
1375
1376 
1377 File: slisp, Node: acos, Next: address-of, Prev: abs, Up: Xlisp Language Reference
1378
1379 acos
1380 ====
1381
1382 acos
1383 type: function (subr)
1384 location: built-in
1385 source file: xlmath.c
1386 Common LISP compatible: yes
1387 supported on: all machines
1388
1389 SYNTAX
1390
1391 (acos <expr> )
1392 <expr> - floating point number/expression
1393
1394 DESCRIPTION
1395
1396 The acos function returns the arc cosine of the <expr>. The result
1397 is in radians.
1398
1399 EXAMPLES
1400
1401 (acos 0.0) ; returns 1.5708
1402 (acos 1.0) ; returns 0.0
1403 (acos -1.0) ; returns 3.14159
1404 (acos 0) ; error: bad integer operation
1405
1406
1407
1408 
1409 File: slisp, Node: address-of, Next: alloc, Prev: acos, Up: Xlisp Language Reference
1410
1411 address-of
1412 ==========
1413
1414 address-of
1415 type: function (subr)
1416 location: built-in
1417 source file: xlsys.c
1418 Common LISP compatible: no
1419 supported on: all machines
1420
1421 SYNTAX
1422
1423 (address-of <expr> )
1424 <expr> - an expression
1425
1426 DESCRIPTION
1427
1428 The ADDRESS-OF function returns the internal memory address of the
1429 XLISP node that corresponds to <expr>. The value returned is an
1430 integer.
1431
1432 EXAMPLES
1433
1434 (setq var 0) ; set up VAR with 0
1435 (address-of var) ; returns 123224
1436 (address-of 'var) ; returns 182638
1437 (peek (address-of var)) ; returns 83951616
1438 (peek (1+ (address-of var))) ; returns 16777216
1439 (peek (+ 2 (address-of var))) ; returns 0 <-- value of VAR
1440 (setq var 14) ; change the value to 14
1441 (peek (+ 2 (address-of var))) ; returns 14
1442 (setq var 99) ; change the value to 99
1443 (peek (+ 2 (address-of var))) ; returns 99
1444
1445 CAUTION: Be careful when modifying the internal state of XLISP. If
1446 you have modified it, it would be a good idea to exit XLISP and
1447 re-enter before doing any work you really want to retain.
1448
1449
1450
1451 
1452 File: slisp, Node: alloc, Next: and, Prev: address-of, Up: Xlisp Language Reference
1453
1454 alloc
1455 =====
1456
1457 alloc
1458 type: function (subr)
1459 location: built-in
1460 source file: xldmem.c
1461 Common LISP compatible: no
1462 supported on: all machines
1463
1464 SYNTAX
1465
1466 (alloc <size> )
1467 <size> - an integer expression
1468
1469 DESCRIPTION
1470
1471 The ALLOC function changes the number of memory nodes allocated per
1472 segment whenever memory is expanded. The previous number of nodes
1473 allocated per segment is the value returned as the result. The power up
1474 default if 1000 nodes per segment. Note that ALLOC does not, itself,
1475 expand memory. You need to execute the EXPAND function to do the expand
1476 operation.
1477
1478 EXAMPLES
1479
1480 (room) ; prints Nodes: 4000
1481 ; Free nodes: 1669
1482 ; Segments: 4
1483 ; Allocate: 1000
1484 ; Total: 52570
1485 ; Collections: 8
1486 ; returns NIL
1487 (alloc 2000) ; returns 1000
1488 (room) ; prints Nodes: 4000
1489 ; Free nodes: 1655
1490 ; Segments: 4
1491 ; Allocate: 2000
1492 ; Total: 52570
1493 ; Collections: 8
1494 ; returns NIL
1495
1496
1497
1498 
1499 File: slisp, Node: and, Next: ;answer, Prev: alloc, Up: Xlisp Language Reference
1500
1501 and
1502 ===
1503
1504 and
1505 type: special form (fsubr)
1506 location: built-in
1507 source file: xlcont.c
1508 Common LISP compatible: yes
1509 supported on: all machines
1510
1511 SYNTAX
1512
1513 (and [ <expr1> ... ] )
1514 <exprN> - an expression
1515
1516 DESCRIPTION
1517
1518 The AND special form evaluates a sequence of expressions and returns
1519 the effect of a logical AND on the expressions. If, at any point, an
1520 expression is NIL, NIL is returned as AND's result. If all of the
1521 expressions have a non-NIL value, the last expression's value is
1522 returned as the result. Evaluation of the expressions will stop when an
1523 expression evaluates to NIL, none of the subsequent expressions will be
1524 evaluated. If there are no expressions, AND returns T as its result.
1525
1526 EXAMPLES
1527
1528 (and T "boo" "hiss" T "rah") ; returns "rah"
1529 (and T T T T) ; returns T
1530 (and) ; returns T
1531 (and (princ "hi") NIL (princ "ho")) ; prints hi and returns NIL
1532 (and (princ "hi") (princ " de ") ; prints hi de ho
1533 (princ "ho")) ; returns "ho"
1534 (setq a 5) (setq b 6) ; set up A and B
1535 (if (and (numberp a) ; if A is a number
1536 (numberp b) ; and B is a number
1537 (< a b) ) ; and A<B
1538 (print "A is less than B") ; THEN do this
1539 (print "something else happened")) ; ELSE do this
1540 ; prints "A is less than B"
1541
1542
1543
1544 
1545 File: slisp, Node: ;answer, Next: append, Prev: and, Up: Xlisp Language Reference
1546
1547 :answer
1548 =======
1549
1550 :answer
1551 type: message selector
1552 location: built-in
1553 source file: xlobj.c
1554 Common LISP compatible: no
1555 supported on: all machines
1556
1557 SYNTAX
1558
1559 (send <class> :answer <message> <args> <code> )
1560 <class> - an existing class
1561 <message> - the message symbol
1562 <args> - formal argument list to the <msg> method
1563 of the same form as a lambda argument list
1564 <code> - a list containing the method code
1565
1566 DESCRIPTION
1567
1568 The :ANSWER message selector adds or changes a method in the
1569 specified <class>. This method consists of the <message> selector
1570 symbol, the <arg> formal argument list and the executable code
1571 associated with the <message>.
1572
1573 EXAMPLES
1574
1575 (setq myclass (send class :new '(var))) ; create MYCLASS with VAR
1576 (send myclass :answer :isnew '() ; set up initialization
1577 '((setq var nil) self))
1578 (send myclass :answer :set-it '(value) ; create :SET-IT message
1579 '((setq var value)))
1580 (send myclass :answer :mine '() ; create :MINE message
1581 '((print "hi there")))
1582 (setq my-obj (send myclass :new)) ; create MY-OBJ of MYCLASS
1583 (send my-obj :set-it 5) ; VAR is set to 5
1584 (send my-obj :mine) ; prints "hi there"
1585
1586 NOTE: When you define a <message> in a <class>, the <message> is
1587 only valid for instances of the <class> or its sub-classes. You will
1588 get an error if you try to send the <message> to the <class> where it
1589 was first defined. If you wish to add a <message> to the <class>, you
1590 need to define it in the super-class of <class>.
1591
1592 MESSAGE STRUCTURE: The normal XLISP convention for a <message> is to
1593 have a valid symbol preceeded by a colon like :ISNEW or :MY-MESSAGE.
1594 However, it is possible to define a <message> that is a symbol without
1595 a colon, but this makes the code less readable.
1596
1597
1598
1599 
1600 File: slisp, Node: append, Next: apply, Prev: ;answer, Up: Xlisp Language Reference
1601
1602 append
1603 ======
1604
1605 append
1606 type: function (subr)
1607 location: built-in
1608 source file: xllist.c
1609 Common LISP compatible: yes
1610 supported on: all machines
1611
1612 SYNTAX
1613
1614 (append [ <expr1> ... ] )
1615 <exprN> - a list or list expression
1616
1617 DESCRIPTION
1618
1619 The APPEND function takes an arbitrary number of lists and splices
1620 them together into a single list. This single list is returned. If an
1621 empty list NIL is appended, it has no effect - it does not appear in
1622 the final list. (Remember that '(NIL) is not an empty list.) If an
1623 atom is is appended, it also has no effect and will not appear in the
1624 final list.
1625
1626 EXAMPLES
1627
1628 (append) ; returns NIL
1629 (append 'a 'b) ; returns B
1630 (append '(a) '(b)) ; returns (A B)
1631 (append 'a '(b)) ; returns (B)
1632 (append '(a) 'b) ; returns (A . B)
1633 (append '(a) nil) ; returns (A)
1634 (append (list 'a 'b) (list 'c 'd)) ; returns (A B C D)
1635 (append '(a (b)) '(c (d))) ; returns (A (B) C (D))
1636 (append '(a) nil nil nil '(b)) ; returns (A B)
1637 (append '(a) '(nil) '(b)) ; returns (A NIL B)
1638
1639
1640
1641 
1642 File: slisp, Node: apply, Next: *applyhook*, Prev: append, Up: Xlisp Language Reference
1643
1644 apply
1645 =====
1646
1647 apply
1648 type: function (subr)
1649 location: built-in
1650 source file: xlbfun.c
1651 Common LISP compatible: yes
1652 supported on: all machines
1653
1654 SYNTAX
1655
1656 (apply <function> <args> )
1657 <function> - the function or symbol to be applied to <args>
1658 <args> - a list that contains the arguments to be passed
1659 to <function>
1660
1661 DESCRIPTION
1662
1663 APPLY causes <function> to be evaluated with <args> as the
1664 parameters. APPLY returns the result of <function>. <args> must be in
1665 the form of a list.
1666
1667 EXAMPLES
1668
1669 (defun my-add (x y) ; create MY-ADD function
1670 (print "my add")
1671 (+ x y))
1672 (my-add 1 2) ; prints "my add" returns 3
1673 (apply 'my-add '(2 4)) ; prints "my add" returns 6
1674 (apply 'my-add 1 2) ; error: bad argument type
1675 (apply 'my-add '(1 2 3)) ; error: too many arguments
1676 (apply (function +) '(9 10)) ; returns 19
1677 (apply '+ '(4 6)) ; returns 10
1678 (apply 'print '("hello there")) ; prints/returns "hello there"
1679 (apply 'print "hello there") ; error: bad argument type
1680
1681 NOTE: Note that when using APPLY to cause the evaluation of a system
1682 function, you can use the quoted name of the function (like 'PRINT in
1683 the examples). You can also use the actual function (like (FUNCTION +)
1684 in the examples).
1685
1686
1687
1688 
1689 File: slisp, Node: *applyhook*, Next: aref, Prev: apply, Up: Xlisp Language Reference
1690
1691 *applyhook*
1692 ===========
1693
1694 *applyhook*
1695 type: system variable
1696 location: built-in
1697 source file: xlglob.c (not implemented)
1698 Common LISP compatible: similar
1699 supported on: all machines
1700
1701 SYNTAX
1702
1703 *applyhook*
1704
1705 DESCRIPTION
1706
1707 *APPLYHOOK* is a system variable that exists and is initialized to
1708 NIL. It is a hook that is intended to contain a user function that is
1709 to be called whenever a function is applied to a list of arguments. It
1710 is not, however, implemented in XLISP 2.0 - it only exists as a dummy
1711 hook.
1712
1713 EXAMPLES
1714
1715 *applyhook* ; returns NIL
1716
1717 COMMON LISP COMPATIBILITY: *APPLYHOOK* is defined in Common LISP and
1718 is often used to implement function stepping functionality in a
1719 debugger.
1720
1721
1722
1723 
1724 File: slisp, Node: aref, Next: arrayp, Prev: *applyhook*, Up: Xlisp Language Reference
1725
1726 aref
1727 ====
1728
1729 aref
1730 type: function (subr)
1731 location: built-in
1732 source file: xlbfun.c
1733 Common LISP compatible: similar
1734 supported on: all machines
1735
1736 SYNTAX
1737
1738 (aref <array> <element> )
1739 <array> - specified array
1740 <element> - the element number to be retrieved
1741
1742 DESCRIPTION
1743
1744 AREF returns the specified element out of a previously created array.
1745 Array elements may be any valid lisp data type - including lists or
1746 arrays. Arrays made by MAKE-ARRAY and accessed by AREF are base 0.
1747 This means the first element is accessed by element number 0 and the
1748 last element is accessed by element number n-1 (where n is the array
1749 size). Array elements are initialized to NIL.
1750
1751 EXAMPLES
1752
1753 (setq my-array '#(0 1 2 3 4)) ; make the array
1754 (aref my-array 0) ; return 0th (first) element
1755 (aref my-array 4) ; return 4th (last) element
1756 (aref my-array 5) ; error: non existant element
1757 my-array ; look at array
1758 (setq new (make-array 4)) ; make another array
1759 (setf (aref new 0) (make-array 4)) ; make new[0] an array of 4
1760 (setf (aref (aref new 0) 1) 'a) ; set new[0,1] = 'a
1761 (setf (aref new 2) '(a b c)) ; set new[2] = '(a b c)
1762 new ; look at array
1763
1764 READ MACRO: There is a built-in read-macro for arrays - # (the
1765 hash symbol). This allows you to create arbitrary arrays with initial
1766 values without going through a MAKE-ARRAY function.
1767
1768 NOTE: This function returns the value of an array element. However,
1769 there is no equivalent direct function to set the value of an array
1770 element to some value. To set an element value, you must use the SETF
1771 function. The SETF function is a generalized function that allows you
1772 to set the value of arbitrary lisp entities.
1773
1774 COMMON LISP COMPATIBILITY: XLISP only supports one-dimensional
1775 arrays. Common LISP supports multi-dimension arrays.
1776
1777
1778

brinkley@uw.edu
ViewVC Help
Powered by ViewVC 1.1.26