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

Contents of /skandha4/info/slisp-10

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: makunbound, Next: mapc, Prev: make-symbol, Up: Xlisp Language Reference
12
13 makunbound
14 ==========
15
16 makunbound
17 type: defined function (closure)
18 location: extension
19 source file: init.lsp
20 Common LISP compatible: yes
21 supported on: all machines
22
23 SYNTAX
24
25 (makunbound <symbol> )
26 <symbol> - an expression evaluating to a symbol
27
28 DESCRIPTION
29
30 The MAKUNBOUND function makes a symbol's value unbound. The <symbol>
31 must be a valid symbol, but it does not need to have a value. The
32 MAKUNBOUND function returns the symbol as its result.
33
34 EXAMPLES
35
36 (makunbound 'florp) ; returns FLORP
37 (setq myvar "hi") ; setup MYVAR "hi"
38 myvar ; returns "hi"
39 (makunbound 'myvar) ; returns MYVAR
40 myvar ; error: unbound variable
41
42 NOTE: MAKUNBOUND is not misspelled - there is no 'e' in it.
43
44 NOTE: The FMAKUNBOUND works on functions (closures) in the same way
45 that MAKUNBOUND works on variables. Be sure to use the correct one for
46 what you are unbinding. These functions do not generate an error if
47 you try to unbind the wrong type. This is because of the definition of
48 these functions and the fact that the function and variable name spaces
49 are separate. You can have both a function called FOO and a variable
50 called FOO.
51
52 NOTE: The function MAKUNBOUND is created in the INIT.LSP file. If
53 it does not exist in your XLISP system, you might be having a problem
54 with INIT.LSP. Before you start XLISP, look in the directory you are
55 currently in, and check to see if there is an INIT.LSP.
56
57
58
59 
60 File: slisp, Node: mapc, Next: mapcan, Prev: makunbound, Up: Xlisp Language Reference
61
62 mapc
63 ====
64
65 mapc
66 type: function (subr)
67 location: built-in
68 source file: xllist.c
69 Common LISP compatible: yes
70 supported on: all machines
71
72 SYNTAX
73
74 (mapc <function> <list1> [ <list2> ... ] )
75 <function> - a function definition (like a LAMBDA)
76 or a function name
77 <listN> - a list or list expression
78
79 DESCRIPTION
80
81 MAPC applies the <function> to the succesive CARs of each of the
82 lists <listN>. Each of the lists supplies one of the arguments to
83 <function>. The MAPC function returns a list that is equivalent to the
84 first list <list1>. It's purpose is to perform operations that have
85 side-effects. If the lists are of different lengths, the shortest list
86 will determine the number of applications of <function>.
87
88 EXAMPLES
89
90 (mapc 'princ '(hi there bob)) ; prints HITHEREBOB
91 ; returns (HI THERE BOB)
92 ;
93 (mapc '+ '(1 2 3) '(1 2 3)) ; returns (1 2 3)
94 ; there were no side effects
95 ;
96 (mapc (lambda (x y) (print (+ x y))) ; define fun. with side effects
97 '(1 2 3) '(1 2 3)) ; prints 2 4 6
98 ; returns (1 2 3)
99
100 NOTE: The use of the <function> will work properly when it is a
101 quoted symbol (which is the name of the function), an unquoted symbol
102 (whose value is a function) or a closure object (like a LAMBDA).
103
104
105
106 
107 File: slisp, Node: mapcan, Next: mapcar, Prev: mapc, Up: Xlisp Language Reference
108
109 mapcan
110 ======
111
112 mapcan
113 type: defined macro (closure)
114 location: extension
115 source file: init.lsp
116 Common LISP compatible: yes
117 supported on: all machines
118
119 SYNTAX
120
121 (mapcan <function> <list1> [ <list2> ... ] )
122 <function> - a function definition (like a LAMBDA)
123 or a function name
124 <listN> - a list or list expression
125
126 DESCRIPTION
127
128 MAPCAN applies the <function> to the succesive CARs of each of the
129 lists <listN>. Each of the lists supplies one of the arguments to
130 <function>. MAPCAN is similar to MAPCAR, except that the MAPCAN macro
131 returns a list that is constructed via the destructive NCONC function
132 from the results of the <function> applications. If the lists are of
133 different lengths, the shortest list will determine the number of
134 applications of <function>.
135
136 EXAMPLES
137
138 (mapcar 'list '(1 2 3) '(a b c) ) ; returns ((1 A) (2 B) (3 C))
139 (mapcan 'list '(1 2 3) '(a b c) ) ; returns (1 A 2 B 3 C)
140 (mapcan 'list '(a b c) ; different length lists
141 '(1 2 3 4 5 6)) ; returns (A 1 B 2 C 3)
142
143 NOTE: Remember that MAPCAN uses NCONC and so it deals with its list
144 arguments destructively. It is often used when you want to remove NIL
145 entries from the resulting list - because NCONC will take out the NILs.
146
147 NOTE: The use of the <function> will work properly when it is a
148 quoted symbol (which is the name of the function), an unquoted symbol
149 (whose value is a function) or a closure object (like a LAMBDA).
150
151 NOTE: The macros MAPCAN and MAPCON are created in the INIT.LSP file.
152 If they do not exist in your XLISP system, you might be having a
153 problem with INIT.LSP. Before you start XLISP, look in the directory
154 you are currently in, and check to see if there is an INIT.LSP.
155
156
157
158 
159 File: slisp, Node: mapcar, Next: mapcon, Prev: mapcan, Up: Xlisp Language Reference
160
161 mapcar
162 ======
163
164 mapcar
165 type: function (subr)
166 location: built-in
167 source file: xllist.c
168 Common LISP compatible: yes
169 supported on: all machines
170
171 SYNTAX
172
173 (mapcar <function> <list1> [ <list2> ... ] )
174 <function> - a function definition (like a LAMBDA)
175 or a function name
176 <listN> - a list or list expression
177
178 DESCRIPTION
179
180 MAPCAR applies the <function> to the succesive CARs of each of the
181 lists <listN>. Each of the lists supplies one of the arguments to
182 <function>. The MAPCAR function returns a list that is constructed
183 from the results of the <function> applications. If the lists are of
184 different lengths, the shortest list will determine the number of
185 applications of <function>.
186
187 EXAMPLES
188
189 (mapcar '+ '(1 2 3) '(1 2 3)) ; returns (2 4 6)
190 (mapcar 'princ '(1 2 3)) ; prints 123
191 ; returns (1 2 3)
192 (mapcar '+ '(1 2 3) ; different length lists
193 '(1 2 3 4 5 6)) ; returns (2 4 6)
194
195 NOTE: The use of the <function> will work properly when it is a
196 quoted symbol (which is the name of the function), an unquoted symbol
197 (whose value is a function) or a closure object (like a LAMBDA).
198
199 BUG NOTE: The proper syntax for <function> when <function> is a
200 lambda expression is, for example (mapcar #'(lambda (arg1 arg2) (+
201 arg1 arg2)) '(1 2)), NOT (mapcar '(lambda (arg1 arg2) (+ arg1 arg2))
202 '(1 2)). That is, the #' read macro must be present. This error should
203 be caught by the xlisp interpreter, but it is not, with the result
204 that very obscure garbage collection bugs occur.
205
206
207
208 
209 File: slisp, Node: mapcon, Next: mapl, Prev: mapcar, Up: Xlisp Language Reference
210
211 mapcon
212 ======
213
214 mapcon
215 type: defined macro (closure)
216 location: extension
217 source file: init.lsp
218 Common LISP compatible: yes
219 supported on: all machines
220
221 SYNTAX
222
223 (mapcon <function> <list1> [ <list2> ... ] )
224 <function> - a function definition (like a LAMBDA)
225 or a function name
226 <listN> - a list or list expression
227
228 DESCRIPTION
229
230 MAPCON applies the <function> to the successive CDRs of each of the
231 lists <listN>. Each of the lists supplies one of the arguments to
232 <function>. The MAPCON macro is similar to the MAPLIST function, except
233 that MAPCON returns a list that is constructed via the destructive NCONC
234 function from the results of the <function> applications. If the lists
235 are of different lengths, the shortest list will determine the number of
236 applications of <function>.
237
238 EXAMPLES
239
240 (maplist 'list '(a b)) ; returns (((A B)) ((B)))
241 (mapcon 'list '(a b)) ; returns ((A B) (B))
242
243 NOTE: Remember that MAPCON uses NCONC and so it destructively deals
244 with its list arguments.
245
246 NOTE: The use of the <function> will work properly when it is a
247 quoted symbol (which is the name of the function), an unquoted symbol
248 (whose value is a function) or a closure object (like a LAMBDA).
249
250 NOTE: The macros MAPCAN and MAPCON are created in the INIT.LSP file.
251 If they do not exist in your XLISP system, you might be having a
252 problem with INIT.LSP. Before you start XLISP, look in the directory
253 you are currently in, and check to see if there is an INIT.LSP.
254
255
256
257 
258 File: slisp, Node: mapl, Next: maplist, Prev: mapcon, Up: Xlisp Language Reference
259
260 mapl
261 ====
262
263 mapl
264 type: function (subr)
265 location: built-in
266 source file: xllist.c
267 Common LISP compatible: yes
268 supported on: all machines
269
270 SYNTAX
271
272 (mapl <function> <list1> [ <list2> ... ] )
273 <function> - a function definition (like a LAMBDA)
274 or a function name
275 <listN> - a list or list expression
276
277 DESCRIPTION
278
279 MAPL applies the <function> to the successive CDRs of each of the
280 lists <listN>. Each of the lists supplies one of the arguments to
281 <function>. The MAPL function returns a list that is equivalent to the
282 first list <list1>. It's purpose is to perform operations that have
283 side-effects. If the lists are of different lengths, the shortest list
284 will determine the number of applications of <function>.
285
286 EXAMPLES
287
288 (mapl 'print '(a b c)) ; prints (A B C)
289 ; (B C)
290 ; (C)
291 ; returns (A B C)
292 ;
293 (mapl (lambda (x y) (princ x) (princ y) ; apply lambda fun. to list
294 (terpri)) ;
295 '(a b c) '(1 2 3)) ; prints (A B C)(1 2 3)
296 ; (B C)(2 3)
297 ; (C)(3)
298 ; returns (A B C)
299
300 NOTE: The use of the <function> will work properly when it is a
301 quoted symbol (which is the name of the function), an unquoted symbol
302 (whose value is a function) or a closure object (like a LAMBDA).
303
304
305
306 
307 File: slisp, Node: maplist, Next: max, Prev: mapl, Up: Xlisp Language Reference
308
309 maplist
310 =======
311
312 maplist
313 type: function (subr)
314 location: built-in
315 source file: xllist.c
316 Common LISP compatible: yes
317 supported on: all machines
318
319 SYNTAX
320
321 (maplist <function> <list1> [ <list2> ... ] )
322 <function> - a function definition (like a LAMBDA)
323 or a function name
324 <listN> - a list or list expression
325
326 DESCRIPTION
327
328 MAPLIST applies the <function> to the successive CDRs of each of the
329 lists <listN>. Each of the lists supplies one of the arguments to
330 <function>. The MAPLIST function returns a list that is constructed
331 from the results of the <function> applications. If the lists are of
332 different lengths, the shortest list will determine the number of
333 applications of <function>.
334
335 EXAMPLES
336
337 (maplist 'print '(a b c)) ; prints (A B C)
338 ; (B C)
339 ; (C)
340 ; returns ((A B C) (B C) (C))
341 ;
342 (maplist (lambda (x y) ; append the lists into one
343 (length (append x y))) ; list and find it's length
344 '(a b c d) '(1 2 3 4)) ; returns (8 6 4 2)
345
346 NOTE: The use of the <function> will work properly when it is a
347 quoted symbol (which is the name of the function), an unquoted symbol
348 (whose value is a function) or a closure object (like a LAMBDA).
349
350
351
352 
353 File: slisp, Node: max, Next: member, Prev: maplist, Up: Xlisp Language Reference
354
355 max
356 ===
357
358 max
359 type: function (subr)
360 location: built-in
361 source file: xlmath.c
362 Common LISP compatible: yes
363 supported on: all machines
364
365 SYNTAX
366
367 (max <expr1> ... )
368 <exprN> - integer or floating point number/expression
369
370 DESCRIPTION
371
372 The MAX function returns the largest numeric expression from the
373 list of arguments.
374
375 EXAMPLES
376
377 (max 1) ; returns 1
378 (max 1 -5 9) ; returns 9
379 ;
380 (setq a '( 9 3 5 2)) ; set up a list - (9 3 5 2)
381 (apply 'max a) ; returns 9
382 (apply #'max a) ; returns 9
383 (apply 'min a) ; returns 2
384
385
386
387 
388 File: slisp, Node: member, Next: ;mescape, Prev: max, Up: Xlisp Language Reference
389
390 member
391 ======
392
393 member
394 type: function (subr)
395 location: built-in
396 source file: xllist.c
397 Common LISP compatible: similar
398 supported on: all machines
399
400 SYNTAX
401
402 (member <expr> <list-expr> [ { :test | :test-not } <test> ] )
403 <expr> - the expression to find - an atom or list
404 <list-expr> - the list to search
405 <test> - optional test function (default is EQL)
406
407 DESCRIPTION
408
409 MEMBER searches through <list-expr> for <expr>. If found, MEMBER
410 returns the remainder of the <list-expr> starting with <expr>. If
411 <expr> is not found, a NIL is returned. You may specify your own test
412 with the :TEST and :TEST-NOT keywords followed by the test you which to
413 perform.
414
415 EXAMPLES
416
417 (member 'a '(1 2 3 4)) ; returns NIL
418 (member '2 '(1 2 3 4)) ; returns (2 3 4)
419 ;
420 (setq mylist '(2 4 8 16 32 64 128 256)) ; make a numeric list
421 (member 6 mylist :test '<) ; returns (8 16 32 64 128 256)
422 (member 6 (reverse mylist) :test-not '<); returns (4 2)
423 (member '20 '(60 40 20 10) :test '> ) ; returns (10)
424 ;
425 (member '(a) '((see) (a) (cat)) ; returns ((A) (CAT))
426 :test 'equal) ; note EQUAL as test
427 (member "hi" '("a" "hi" "c") ; returns ("hi" "c")
428 :test 'string= ) ; note STRING= as test
429
430 NOTE: The MEMBER function can work with a list or string as the
431 <expr>. However, the default EQL test does not work with lists or
432 strings, only symbols and numbers. To make this work, you need to use
433 the :TEST keyword along with EQUAL for <test>.
434
435 COMMON LISP COMPATIBILITY: Common LISP supports the use of the :KEY
436 keyword which specifies a function that is applied to each element of
437 <list-expr> before it is tested. XLISP does not support this.
438
439
440
441 
442 File: slisp, Node: ;mescape, Next: min, Prev: member, Up: Xlisp Language Reference
443
444 :mescape
445 ========
446
447 :mescape
448 type: keyword
449 location: built-in
450 source file: xlread.c
451 Common LISP compatible: no
452 supported on: all machines
453
454 SYNTAX
455
456 :mescape
457
458 DESCRIPTION
459
460 :MESCAPE is an entry that is used in the *READTABLE*. *READTABLE*
461 is a system variable that contains XLISP's data structures relating to
462 the processing of characters from the user (or files) and read-macro
463 expansions. The existance of the :MESCAPE keyword means that the
464 specified character is to be used as a multiple escape character. The
465 system defines that the the vertical bar character | is the only
466 :MESCAPE character.
467
468 EXAMPLES
469
470 (defun look-at (table) ; define a function to
471 (dotimes (ch 127) ; look in a table
472 (prog ( (entry (aref table ch)) ) ; and print out any
473 (case entry ; entries with a function
474 (:MESCAPE ;
475 (princ (int-char ch))) ;
476 (T NIL)))) ;
477 (terpri)) ;
478 (look-at *readtable*) ; prints |
479
480 CAUTION: If you experiment with *READTABLE*, it is useful to save
481 the old value in a variable, so that you can restore the system state.
482
483
484
485 
486 File: slisp, Node: min, Next: minusp, Prev: ;mescape, Up: Xlisp Language Reference
487
488 min
489 ===
490
491 min
492 type: function (subr)
493 location: built-in
494 source file: xlmath.c
495 Common LISP compatible: yes
496 supported on: all machines
497
498 SYNTAX
499
500 (min <expr1> ... )
501 <exprN> - integer or floating point number/expression
502
503 DESCRIPTION
504
505 The MIN function returns the minimum (most negative or most nearly
506 negative) numeric expression from the list of arguments.
507
508 EXAMPLES
509
510 (min 1) ; returns 1
511 (min 8 7 4 2) ; returns 2
512 (min 2 3 -1 -99) ; returns -99
513 (setq a '( 9 3 5 2)) ; make a numeric list - (9 3 5 2)
514 (apply 'min a) ; returns 2
515 (apply #'min a) ; returns 2
516 (apply 'max a) ; returns 9
517
518
519
520 
521 File: slisp, Node: minusp, Next: nconc, Prev: min, Up: Xlisp Language Reference
522
523 minusp
524 ======
525
526 minusp
527 type: predicate function (subr)
528 location: built-in
529 source file: xlmath.c
530 Common LISP compatible: yes
531 supported on: all machines
532
533 SYNTAX
534
535 (minusp <expr> )
536 <expr> - the numeric expression to check
537
538 DESCRIPTION
539
540 The MINUSP predicate checks to see if the number <expr> is negative.
541 T is returned if the number is negative (less than zero), NIL is
542 returned otherwise. A bad argument type error is generated if the
543 <expr> is not a numeric expression.
544
545 EXAMPLES
546
547 (minusp 1) ; returns NIL
548 (minusp 0) ; returns NIL
549 (minusp -1) ; returns T
550 (minusp -.000000005) ; returns T
551 (minusp #xFFFFFFFF) ; returns T
552 (minusp #x01) ; returns NIL
553 ;
554 (minusp 'a) ; error: bad argument type
555 (setq a -3.5) ; set A to -3.5
556 (minusp a) ; returns T
557
558
559
560 
561 File: slisp, Node: nconc, Next: ;new, Prev: minusp, Up: Xlisp Language Reference
562
563 nconc
564 =====
565
566 nconc
567 type: function (subr)
568 location: built-in
569 source file: xllist.c
570 Common LISP compatible: yes
571 supported on: all machines
572
573 SYNTAX
574
575 (nconc [ <list1> ... ] )
576 <listN> - a list to DESTRUCTIVELY concatenate
577
578 DESCRIPTION
579
580 NCONC destructively concatenates a sequence of lists and returns the
581 result of this concatentation. The destructive aspect of this operation
582 means that the actual symbol values are used in the list-modifying
583 operations - not copies. This means, for NCONC, that the lists are
584 spliced together. <listN> must evaluate to a valid list. An atom for
585 <listN> will result in an error. NIL is a valid <listN>.
586
587 EXAMPLES
588
589 (setq a '(1 2 3)) ; set up A with (1 2 3)
590 (setq b '(4 5 6)) ; set up B with (4 5 6)
591 (setq c '(7 8 9)) ; set up C with (7 8 9)
592 (NCONC a b c) ; returns (1 2 3 4 5 6 7 8 9)
593 (setf (nth 8 a) 'end) ; change last element of A
594 (print a) ; prints (1 2 3 4 5 6 7 8 END)
595 (print b) ; prints (4 5 6 7 8 END)
596 (print c) ; prints (7 8 END)
597
598
599
600 
601 File: slisp, Node: ;new, Next: nil, Prev: nconc, Up: Xlisp Language Reference
602
603 :new
604 ====
605
606 :new
607 type: message selector
608 location: built-in
609 source file: xlobj.c
610 Common LISP compatible: no
611 supported on: all machines
612
613 SYNTAX
614
615 (send <class> :new <args> )
616 <class> - an existing XLISP class except for 'CLASS'
617 <args> - the init. args for the new instance
618 (send class :new <ivars> [ <cvars> [ <superclass> ] ] )
619 <ivars> - list of instance variables for new class
620 <cvars> - list of class variable symbols for new class
621 <superclass> - superclass for new object
622 (the default is 'OBJECT')
623
624 DESCRIPTION
625
626 The :NEW message selector exhibits 2 different behaviors. When you
627 are creating an instance of a class you only need the :NEW message
628 (consisting of the message selector and any data). When you are
629 creating a new class with :NEW, you need to specify instance variables
630 and optionally the class variables and superclass.
631
632 EXAMPLES
633
634 (setq new-class ; create NEW-CLASS with STATE
635 (send class :new '(state))) ;
636 (setq new-obj (send new-class :new)) ; create NEW-OBJ of NEW-CLASS
637 (send new-obj :show) ; shows the object
638 (setq sub-class ; create SUB-CLASS of NEW-CLASS
639 (send class :new '(sub-state) ;
640 '() new-class));
641 (send sub-class :show) ; show the SUB-CLASS
642
643
644
645 
646 File: slisp, Node: nil, Next: ;nmacro, Prev: ;new, Up: Xlisp Language Reference
647
648 nil
649 ===
650
651 nil
652 type: system constant
653 location: built-in
654 source file: xlsym.c
655 Common LISP compatible: yes
656 supported on: all machines
657
658 SYNTAX
659
660 nil
661
662 DESCRIPTION
663
664 The NIL constant represents the empty list or the false value - as
665 oppossed to the true value (the symbol T). NIL can be writen as the 3
666 character symbol NIL or as the empty list ().
667
668 EXAMPLES
669
670 (setq myvar NIL) ; set MYVAR to False
671 (setq myvar 'NIL) ; NIL and 'NIL evaluate to NIL
672 (setq myvar ()) ; () is the empty list = NIL
673 (setq myvar '()) ; () and '() evaluate to NIL
674 (if nil (print "this won't print") ; if/then/else
675 (print "this will print"))
676
677 NOTE: You can not change the value of NIL.
678
679
680
681 
682 File: slisp, Node: ;nmacro, Next: nodebug, Prev: nil, Up: Xlisp Language Reference
683
684 :nmacro
685 =======
686
687 :nmacro
688 type: keyword
689 location: built-in
690 source file: xlread.c
691 Common LISP compatible: no
692 supported on: all machines
693
694 SYNTAX
695
696 (:nmacro . <function> )
697 <function> - a function
698
699 DESCRIPTION
700
701 :NMACRO is an entry that is used in the *READTABLE*. *READTABLE* is
702 a system variable that contains XLISP's data structures relating to the
703 processing of characters from the user (or files) and read-macro
704 expansions. The existance of the :NMACRO keyword means that the
705 specified character is the start of a non-terminal macro. For :NMACRO,
706 the form of the *READTABLE* entry is a dotted pair like (:NMACRO .
707 <function> ). The <function> can be a built-in read-macro function or a
708 user defined lambda expression. The <function> takes two parameters, an
709 input stream specification, and an integer that is the character value.
710 The <function> should return NIL if the character is 'white-space' or a
711 value CONSed with NIL to return the value. The <function> will probably
712 read additional characters from the input stream.
713
714 EXAMPLES
715
716 (defun look-at (table) ; define a function to
717 (dotimes (ch 127) ; look in a table
718 (prog ( (entry (aref table ch)) ) ; and print out any
719 (if (and (consp entry) ; :NMACRO entries
720 (equal (car entry) ;
721 ':NMACRO)) ;
722 (princ (int-char ch))))) ;
723 (terpri)) ;
724 ;
725 (look-at *readtable*) ; prints #
726
727 NOTE: The system defines that the hash (#) character is a
728 non-terminal. This is because the hash is used for a variety of 'read
729 macro expansions' including FUNCTION, an ASCII code, and hexadecimal
730 numbers.
731
732 CAUTION: If you experiment with *READTABLE*, it is useful to save
733 the old value in a variable, so that you can restore the system state.
734
735
736
737 
738 File: slisp, Node: nodebug, Next: not, Prev: ;nmacro, Up: Xlisp Language Reference
739
740 nodebug
741 =======
742
743 nodebug
744 type: defined function (closure)
745 location: extension
746 source file: init.lsp
747 Common LISP compatible: no
748 supported on: all machines
749
750 SYNTAX
751
752 (nodebug)
753
754 DESCRIPTION
755
756 The NODEBUG function sets *BREAKENABLE* to NIL. This has the effect
757 of turning off the break loop for errors. NODEBUG always returns NIL.
758 The default is DEBUG enabled.
759
760 EXAMPLES
761
762 (nodebug) ; returns NIL
763 (+ 1 "a") ; error: bad argument type
764 ; but doesn't enter break-loop
765 (debug) ; returns T
766 (+ 1 "a") ; error: bad argument type
767 ; enters break-loop
768 (clean-up) ; from within the break-loop
769
770 NOTE: The functions DEBUG and NODEBUG are created in the INIT.LSP
771 file. If they do not exist in your XLISP system, you might be having a
772 problem with INIT.LSP. Before you start XLISP, look in the directory
773 you are currently in, and check to see if there is an INIT.LSP.
774
775
776
777 
778 File: slisp, Node: not, Next: nstring-downcase, Prev: nodebug, Up: Xlisp Language Reference
779
780 not
781 ===
782
783 not
784 type: predicate function (subr)
785 location: built-in
786 source file: xlbfun.c
787 Common LISP compatible: yes
788 supported on: all machines
789
790 SYNTAX
791
792 (not <expr> )
793 <expr> - the expression to check
794
795 DESCRIPTION
796
797 The NOT predicate checks to see if the <expr> is false. T is
798 returned if the expression is NIL, NIL is returned otherwise.
799
800 EXAMPLES
801
802 (not '()) ; returns T - empty list
803 (not ()) ; returns T - still empty
804 (setq a NIL) ; set up a variable
805 (not a) ; returns T - value = empty list
806 ;
807 (not "a") ; returns NIL - not a list
808 (not 'a) ; returns NIL - not a list
809
810 NOTE: The NOT predicate is the same function as the NULL predicate.
811
812
813
814 
815 File: slisp, Node: nstring-downcase, Next: nstring-upcase, Prev: not, Up: Xlisp Language Reference
816
817 nstring-downcase
818 ================
819
820 nstring-downcase
821 type: function (subr)
822 location: built-in
823 source file: xlstr.c
824 Common LISP compatible: yes
825 supported on: all machines
826
827 SYNTAX
828
829 (nstring-downcase <string> [ { :start | :end } <offset> ] ... )
830 <string> - a string expression
831 <offset> - an optional integer expression (for a keyword)
832
833 DESCRIPTION
834
835 The NSTRING-DOWNCASE function takes a string argument and makes it
836 lower case. This function modifies the string (or string variable
837 itself) - it does not just make a copy. The lower case string is
838 returned.
839
840 The keyword arguments allow for accessing substrings within <string>.
841 The keyword arguments require a keyword (:START or :END) first and a
842 single integer expression second. The :START keyword specifies the
843 starting offset for the NSTRING-DOWNCASE operation on <string>. A value
844 of 0 starts the string at the beginning (no offset). The :END keyword
845 specifies the end offset for the operation on <string>.
846
847 EXAMPLES
848
849 (nstring-downcase "ABcd+-12&[") ; returns "abcd+-&["
850 (nstring-downcase "ABCDEFGH" ;
851 :start 2 :end 4) ; returns "ABcdEFGH"
852 ;
853 (setq mystr "ABcdEFgh") ; set up variable
854 (nstring-downcase mystr) ; returns "abcdefgh"
855 (print mystr) ; prints "abcdefgh"
856 ; note that MYSTR is modified
857
858
859
860 
861 File: slisp, Node: nstring-upcase, Next: nth, Prev: nstring-downcase, Up: Xlisp Language Reference
862
863 nstring-upcase
864 ==============
865
866 nstring-upcase
867 type: function (subr)
868 location: built-in
869 source file: xlstr.c
870 Common LISP compatible: yes
871 supported on: all machines
872
873 SYNTAX
874
875 (nstring-upcase <string> [ { :start | :end } <offset> ] ... )
876 <string> - a string expression
877 <offset> - an optional integer expression (for a keyword)
878
879 DESCRIPTION
880
881 The NSTRING-UPCASE function takes a string argument and makes it
882 upper case. This function modifies the string (or string variable
883 itself) - it does not just make a copy. The upper case string is
884 returned.
885
886 The keyword arguments allow for accessing substrings within <string>.
887 The keyword arguments require a keyword (:START or :END) first and a
888 single integer expression second. The :START keyword specifies the
889 starting offset for the NSTRING-UPCASE operation on <string>. A value
890 of 0 starts the string at the beginning (no offset). The :END keyword
891 specifies the end offset for the operation on <string>.
892
893 EXAMPLES
894
895 (nstring-upcase "ABcd+-12&[") ; returns "ABCD+-&["
896 (nstring-upcase "abcdefgh" ;
897 :start 2 :end 4) ; returns "abCDefgh"
898 ;
899 (setq mystr "ABcdEFgh") ; set up variable
900 (nstring-upcase mystr) ; returns "ABCDEFGH"
901 (print mystr) ; prints "ABCDEFGH"
902 ; note that MYSTR is modified
903
904
905
906 
907 File: slisp, Node: nth, Next: nthcdr, Prev: nstring-upcase, Up: Xlisp Language Reference
908
909 nth
910 ===
911
912 nth
913 type: function (subr)
914 location: built-in
915 source file: xllist.c
916 Common LISP compatible: yes
917 supported on: all machines
918
919 SYNTAX
920
921 (nth <expr> <list-expr> )
922 <expr> - an integer expression
923 <list-expr> - a list or list expression
924
925 DESCRIPTION
926
927 NTH returns the <expr>'th element of <list-expr>. If the
928 <list-expr> is shorter than <expr>, a NIL is returned. The counting
929 sequence is base zero - the first element is the 0th element.
930
931 EXAMPLES
932
933 (nth 4 '(0 1 2 3 4 5 6)) ; returns 4
934 (nth 3 '(a b)) ; returns NIL
935 ;
936 (nth 4 'a) ; error: bad argument type
937 (nth 3 "abcdefg") ; error: bad argument type
938
939
940
941 
942 File: slisp, Node: nthcdr, Next: null, Prev: nth, Up: Xlisp Language Reference
943
944 nthcdr
945 ======
946
947 nthcdr
948 type: function (subr)
949 location: built-in
950 source file: xllist.c
951 Common LISP compatible: yes
952 supported on: all machines
953
954 SYNTAX
955
956 (nthcdr <expr> <list-expr> )
957 <expr> - an integer expression
958 <list-expr> - a list or list expression
959
960 DESCRIPTION
961
962 NTHCDR returns the <expr>'th CDR of <list-expr>. If the <list-expr>
963 is shorter than <expr>, a NIL is returned. The counting sequence is
964 base zero - the first element is the 0th element.
965
966 EXAMPLES
967
968 (nthcdr 4 '(0 1 2 3 4 5 6)) ; returns (4 5 6)
969 (nthcdr 3 '(a b)) ; returns NIL
970 ;
971 (nthcdr 4 'a) ; error: bad argument type
972
973
974
975 
976 File: slisp, Node: null, Next: numberp, Prev: nthcdr, Up: Xlisp Language Reference
977
978 null
979 ====
980
981 null
982 type: predicate function (subr)
983 location: built-in
984 source file: xlbfun.c
985 Common LISP compatible: yes
986 supported on: all machines
987
988 SYNTAX
989
990 (null <expr> )
991 <expr> - the expression to check
992
993 DESCRIPTION
994
995 The NULL predicate checks <expr> for an empty list. T is returned if
996 the list is empty, NIL is returned otherwise. The <expr> does not have
997 to be a valid list, but if it is not a list then NIL is returned as the
998 result.
999
1000 EXAMPLES
1001
1002 (null '()) ; returns T - empty list
1003 (null ()) ; returns T - still empty
1004 (setq a NIL) ; set up a variable
1005 (null a) ; returns T - value = empty list
1006 ;
1007 (null "a") ; returns NIL - not a list
1008 (null 'a) ; returns NIL - not a list
1009
1010 NOTE: The NULL predicate is the same function as the NOT predicate.
1011
1012
1013
1014 
1015 File: slisp, Node: numberp, Next: *obarray*, Prev: null, Up: Xlisp Language Reference
1016
1017 numberp
1018 =======
1019
1020 numberp
1021 type: predicate function (subr)
1022 location: built-in
1023 source file: xlbfun.c
1024 Common LISP compatible: yes
1025 supported on: all machines
1026
1027 SYNTAX
1028
1029 (numberp <expr> )
1030 <expr> - the expression to check
1031
1032 DESCRIPTION
1033
1034 The NUMBERP predicate checks if an <expr> is a number. T is
1035 returned if <expr> is an integer or floating point number, NIL is
1036 returned otherwise.
1037
1038 EXAMPLES
1039
1040 (numberp 1) ; returns T - integer
1041 (numberp 1.2) ; returns T - float
1042 (numberp '1) ; returns T - still an integer
1043 (numberp #x034) ; returns T - readmacro produces
1044 ; an integer
1045 ;
1046 (numberp 'a) ; returns NIL - symbol
1047 (numberp #\a) ; returns NIL - character
1048 (numberp NIL) ; returns NIL - NIL
1049 (numberp #(0 1 2)) ; returns NIL - array
1050
1051
1052
1053 
1054 File: slisp, Node: *obarray*, Next: object, Prev: numberp, Up: Xlisp Language Reference
1055
1056 *obarray*
1057 =========
1058
1059 *obarray*
1060 type: system variable
1061 location: built-in
1062 source file: xlsym.c
1063 Common LISP compatible: no
1064 supported on: all machines
1065
1066 SYNTAX
1067
1068 *obarray*
1069
1070 DESCRIPTION
1071
1072 *OBARRAY* is the system variable that contains the system symbol
1073 table. This symbol table is an XLISP array that is constructed out of
1074 lists.
1075
1076 EXAMPLES
1077
1078 (defun lookin (sym) ; create a function to
1079 (aref *obarray* ; look inside *OBARRAY*
1080 (hash sym (length *obarray*)))); and look for a specific
1081 ; symbol - returns a list
1082 ;
1083 (lookin "CAR") ; returns (TEST PEEK CAR)
1084 (lookin "car") ; returns NIL
1085
1086 NOTE: When looking into *OBARRAY* or INTERNing symbols, remember
1087 that "car" and "CAR" are two different symbols in *OBARRAY*. Remember
1088 also that normal symbols created by XLISP are upper case names. So, if
1089 you type in "car" as a normal symbol, it will be the symbol "CAR" after
1090 this normal upper-casing operation.
1091
1092
1093
1094 
1095 File: slisp, Node: object, Next: objectp, Prev: *obarray*, Up: Xlisp Language Reference
1096
1097 object
1098 ======
1099
1100 object
1101 type: object
1102 location: built-in
1103 source file: xlobj.c
1104 Common LISP compatible: no
1105 supported on: all machines
1106
1107 SYNTAX
1108
1109 object
1110
1111 DESCRIPTION
1112
1113 OBJECT is an object class. An object is a composite structure that
1114 contains internal state information, methods (which respond to
1115 messages), a pointer to the object's class and a pointer to the object's
1116 super-class. XLISP contains two built in objects: OBJECT and CLASS.
1117 OBJECT is the superclass for the CLASS object.
1118
1119 EXAMPLES
1120
1121 (send object :show) ; look at the object definition
1122 ;
1123 ; example use of objects
1124 (setq my-class ; new class MY-CLASS with STATE
1125 (send class :new '(state))) ;
1126 (send my-class :answer :isnew '() ; set up initialization
1127 '((setq state nil) self)) ;
1128 (send my-class :answer :set-it '(value) ; create :SET-IT message
1129 '((setq state value))) ;
1130 (setq my-obj (send my-class :new)) ; create MY-OBJ out of MY-CLASS
1131 (send my-obj :set-it 5) ; STATE is set to 5
1132
1133 OBJECT DEFINITION: The internal definition of the OBJECT object
1134 instance is:
1135
1136 Object is #<Object: #23fd8>, Class is #<Object: #23fe2>
1137 MESSAGES = ((:SHOW . #<Subr-: #23db2>)
1138 (:CLASS . #<Subr-: #23dee>)
1139 (:ISNEW . #<Subr-: #23e2a>))
1140 IVARS = NIL
1141 CVARS = NIL
1142 CVALS = NIL
1143 SUPERCLASS = NIL
1144 IVARCNT = 0
1145 IVARTOTAL = 0
1146 #<Object: #23fd8>
1147
1148 The class of OBJECT is CLASS. There is no superclass of OBJECT.
1149 Remember that the location information (like #23fd8) varies from system
1150 to system, yours will probably look different.
1151
1152 BUILT-IN METHODS: The built in methods in XLISP include:
1153
1154 <message> operation
1155 -------------------------------------------------------
1156 :ANSWER Add a method to an object.
1157 :CLASS Return the object's class.
1158 :ISNEW Run initialization code on object.
1159 :NEW Create a new object (instance or class).
1160 :SHOW Show the internal state of the object.
1161
1162 MESSAGE STRUCTURE: The normal XLISP convention for a <message> is to
1163 have a valid symbol preceeded by a colon like :ISNEW or :MY-MESSAGE.
1164 However, it is possible to define a <message> that is a symbol without
1165 a colon, but this makes the code less readable.
1166
1167
1168
1169 
1170 File: slisp, Node: objectp, Next: oddp, Prev: object, Up: Xlisp Language Reference
1171
1172 objectp
1173 =======
1174
1175 objectp
1176 type: predicate function (subr)
1177 location: built-in
1178 source file: xlbfun.c
1179 Common LISP compatible: no
1180 supported on: all machines
1181
1182 SYNTAX
1183
1184 (objectp <expr> )
1185 <expr> - the expression to check
1186
1187 DESCRIPTION
1188
1189 The OBJECTP predicate checks if the <expr> is an object. T is
1190 returned if <expr> is an object, NIL is returned otherwise.
1191
1192 EXAMPLES
1193
1194 (objectp object) ; returns T
1195 (objectp class) ; returns T
1196 (objectp NIL) ; returns NIL
1197 (objectp '(a b)) ; returns NIL
1198
1199
1200
1201 
1202 File: slisp, Node: oddp, Next: open, Prev: objectp, Up: Xlisp Language Reference
1203
1204 oddp
1205 ====
1206
1207 oddp
1208 type: predicate function (subr)
1209 location: built-in
1210 source file: xlmath.c
1211 Common LISP compatible: yes
1212 supported on: all machines
1213
1214 SYNTAX
1215
1216 (oddp <expr> )
1217 <expr> - the integer numeric expression to check
1218
1219 DESCRIPTION
1220
1221 The ODDP predicate checks to see if the number <expr> is odd. T is
1222 returned if the number is odd, NIL is returned otherwise. A bad
1223 argument type error is generated if the <expr> is not a numeric
1224 expression. A bad floating point operation is generated if the <expr>
1225 is a floating point number. Zero is an even number.
1226
1227 EXAMPLES
1228
1229 (oddp 0) ; returns NIL
1230 (oddp 1) ; returns T
1231 (oddp 2) ; returns NIL
1232 (oddp -1) ; returns T
1233 (oddp -2) ; returns NIL
1234 ;
1235 (oddp 13.0) ; error: bad flt. pt. op.
1236 (oddp 'a) ; error: bad argument type
1237 (setq a 3) ; set value of A to 3
1238 (oddp a) ; returns T
1239
1240
1241
1242 
1243 File: slisp, Node: open, Next: &optional, Prev: oddp, Up: Xlisp Language Reference
1244
1245 open
1246 ====
1247
1248 open
1249 type: function (subr)
1250 location: built-in
1251 source file: xlfio.c
1252 Common LISP compatible: yes
1253 supported on: all machines
1254
1255 SYNTAX
1256
1257 (open <file> [ :direction <in-out> ] )
1258 <file> - a string expression or symbol
1259 <in-out> - an optional keyword symbol that must either
1260 :INPUT or :OUTPUT. The default is :INPUT.
1261
1262 DESCRIPTION
1263
1264 The OPEN function opens the <file> for input or output. The <file>
1265 may be a string expression or a symbol. Following the <file>, there is
1266 an optional keyword, :DIRECTION. The argument following this is either
1267 :INPUT or :OUTPUT which specifies the direction of the file. If no
1268 :DIRECTION is specified, the default is :INPUT. When <file> is a
1269 string, you may specify a complete file location or extensions (like
1270 "/usr/local/bin/myfile.lsp" or "A:\LISP\TIM.BAT"). If the file open was
1271 successful, then a file pointer of the form #<File: #99999> is returned
1272 as the result. If the file open was not successful, a NIL is returned.
1273 For an input file, the file has to exist, or an error will be signaled.
1274
1275 EXAMPLES
1276
1277 (setq f (open 'mine :direction :output)); create file MINE
1278 (print "hi" f) ; returns "hi"
1279 (close f) ; file contains <hi> <NL>
1280 (setq f (open 'mine :direction :input)) ; open MYFILE for input
1281 (read f) ; returns "hi"
1282 (close f) ; close it
1283
1284 FILE NAMES: In the PC and DOS world, all file names and extensions
1285 ("FOO.BAT") are automatically made uppercase. In using XLISP, this
1286 means you don't have to worry about whether the name is "foo.bat",
1287 "FOO.BAT" or even "FoO.bAt" - they will all work. However, in other
1288 file systems (UNIX in particular), uppercase and lowercase do make a
1289 difference. So, in UNIX if you do a (open 'foo-file :direction
1290 :output), this will create a file named "FOO-FILE" because XLISP
1291 uppercases its symbols. If you do a (open "foo-file" :direction
1292 :output), this will create a file named "foo-file" because UNIX doesn't
1293 uppercase its file names. Another case is if you do (savefun mydefun),
1294 this will create the file "MYDEFUN.lsp". So, if you are having trouble
1295 with opening and accessing files, check to make sure the file name is
1296 in the proper case.
1297
1298 COMMON LISP COMPATIBILITY: Common LISP supports bidirectional files.
1299 So, porting Common LISP code may be difficult to port if it uses these
1300 other file types.
1301
1302
1303
1304 
1305 File: slisp, Node: &optional, Next: or, Prev: open, Up: Xlisp Language Reference
1306
1307 &optional
1308 =========
1309
1310 &optional
1311 type: keyword
1312 location: built-in
1313 source file: xleval.c
1314 Common LISP compatible: similar
1315 supported on: all machines
1316
1317 SYNTAX
1318
1319 &optional [ <opt-arg> | ( <opt-arg> [ <opt-value> [ <opt-symbol> ] ] ) ] ...
1320 <opt-arg> - optional argument
1321 <opt-value> - optional argument initialization
1322 <exist-symbol> - optional argument existence symbol
1323
1324 DESCRIPTION
1325
1326 In XLISP, there are several times that you define a formal argument
1327 list for a body of code (like DEFUN, DEFMACRO, :ANSWER and LAMBDA).
1328 All of the formal arguments that are defined are required to appear in
1329 the invocation of the defined function or operation. If there are any
1330 &OPTIONAL arguments defined, they will be filled in order. If there are
1331 insufficient parameters for the &OPTIONAL arguments, they will contain
1332 NIL, unless the arguments have an <opt-value> initial value specified.
1333 The <exist-symbol>, if it is specified, will contain a T if the
1334 <opt-arg> was supplied by the function call and a NIL if it was not
1335 supplied by the function call. This <exist-symbol> allows the
1336 programmer to test for an arguments existence. At the end of the
1337 function or operation execution, these local symbols and their values
1338 are are removed.
1339
1340 EXAMPLES
1341
1342 (defun foo ; define function FOO
1343 (a &optional b (c 1) ) ; with some optional args
1344 (print a) (print b) (print c)) ;
1345 (foo) ; error: too few arguments
1346 (foo 1) ; prints 1 NIL 1
1347 (foo 1 2) ; prints 1 2 1
1348 (foo 1 2 3) ; prints 1 2 3
1349 ;
1350 (defun fee ; define function FEE
1351 (a &optional (b 9 b-passed) ) ; with some optional args
1352 (print a) (print b) ;
1353 (if b-passed (print "b was passed") ;
1354 (print "b not passed"))) ;
1355 (fee 1) ; prints 1 9 "b not passed"
1356 (fee 1 2) ; prints 1 2 "b was passed"
1357
1358
1359
1360 
1361 File: slisp, Node: or, Next: peek, Prev: &optional, Up: Xlisp Language Reference
1362
1363 or
1364 ==
1365
1366 or
1367 type: special form (fsubr)
1368 location: built-in
1369 source file: xlcont.c
1370 Common LISP compatible: yes
1371 supported on: all machines
1372
1373 SYNTAX
1374
1375 (or [ <expr1> ... ] )
1376 <exprN> - an expression
1377
1378 DESCRIPTION
1379
1380 The OR special form evaluates a sequence of expressions and returns
1381 the effect of a logical INCLUSIVE-OR operation on the expressions. If
1382 all of the expressions are NIL, NIL is returned as OR's result.
1383 Evaluation of the expressions will stop when an expression evaluates to
1384 something other than NIL, none of the subsequent expressions will be
1385 evaluated. If there are no expressions, OR returns NIL as its result.
1386
1387 EXAMPLES
1388
1389 (or NIL NIL NIL) ; returns NIL
1390 (or NIL T NIL) ; returns T
1391 (or NIL (princ "hi") (princ "ho")) ; prints hi and returns "hi"
1392 (or T T T) ; returns T
1393 (or) ; returns NIL
1394 ;
1395 (setq a 5) (setq b 6) ; set up A and B
1396 (if (or (< a b) (< b a)) ; if
1397 (print "not equal") ; then
1398 (print "equal")) ; else
1399 ; prints "not equal"
1400
1401
1402
1403 
1404 File: slisp, Node: peek, Next: peek-char, Prev: or, Up: Xlisp Language Reference
1405
1406 peek
1407 ====
1408
1409 peek
1410 type: function (subr)
1411 location: built-in
1412 source file: xlsys.c
1413 Common LISP compatible: no
1414 supported on: all machines
1415
1416 SYNTAX
1417
1418 (peek <address> )
1419 <address> - an integer expression
1420
1421 DESCRIPTION
1422
1423 The PEEK function returns the internal memory value at the <address>.
1424 The returned value is an integer.
1425
1426 EXAMPLES
1427
1428 (setq var 0) ; set up VAR with 0
1429 (address-of var) ; returns 123224
1430 (address-of 'var) ; returns 161922
1431 (peek (address-of var)) ; returns 83951616
1432 (peek (1+ (address-of var))) ; returns 16777216
1433 (peek (+ 2 (address-of var))) ; returns 0 <-- value of VAR
1434 (setq var 14) ; change the value to 14
1435 (peek (+ 2 (address-of var))) ; returns 14
1436 (setq var 99) ; change the value to 99
1437 (peek (+ 2 (address-of var))) ; returns 99
1438
1439 CAUTION: Be careful when modifying the internal state of XLISP. If
1440 you have modified it, it would be a good idea to exit XLISP and
1441 re-enter before doing any work you really want to retain.
1442
1443 ADDITIONAL CAUTION: It is possible to PEEK and POKE not just XLISP's
1444 memory put other parts of your computer's memory. Be very careful
1445 when doing this. Also, in some computers, just looking at a memory
1446 location can cause things to happen - I/O locations fall in this
1447 category.
1448
1449
1450

brinkley@uw.edu
ViewVC Help
Powered by ViewVC 1.1.26