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

Contents of /skandha4/info/slisp-11

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue May 25 09:39:16 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: peek-char, Next: plusp, Prev: peek, Up: Xlisp Language Reference
12
13 peek-char
14 =========
15
16 peek-char
17 type: function (subr)
18 location: built-in
19 source file: xlfio.c
20 Common LISP compatible: similar
21 supported on: all machines
22
23 SYNTAX
24
25 (peek-char [ <skip-flag> [ <source> ] ] )
26 <skip-flag> - an optional expression - default is NIL
27 <source> - an optional source - must be a file pointer
28 or stream, the default is *standard-input*
29
30 DESCRIPTION
31
32 The PEEK-CHAR function looks at a single character from the specified
33 <source>. The character looked-at is returned as an integer value for
34 the result. If the <skip-flag> expression is NIL, then the next
35 character will be looked-at, without advancing the position within the
36 file. If the <skip-flag> expression is non-NIL, then the next
37 non-white-space character will be looked-at. This skipping does advance
38 the position within the file. White-space characters include blank, tab
39 and new-line characters. If <skip-flag> is not used, no skipping will
40 occur. The <source> may be a file pointer or a stream. If there is no
41 <source>, *STANDARD-INPUT* is the default. If an end-of-file is
42 encountered in the <source>, then NIL will be returned as the result.
43
44 EXAMPLES
45
46 (setq fp (open "f" :direction :output)) ; create file "f"
47 (print 12 fp) ;
48 (princ " 34" fp) (terpri fp) ;
49 (close fp) ;
50 ;
51 (setq fp (open "f" :direction :input)) ; open "f" for reading
52 (peek-char NIL fp) ; returns #\1
53 (peek-char NIL fp) ; returns #\1 - didn't advance
54 (read-char fp) ; returns #\1 - force advance
55 (peek-char NIL fp) ; returns #\2
56 (read-char fp) ; returns #\2 - force advance
57 (peek-char NIL fp) ; returns #\Newline
58 (peek-char T fp) ; returns #\3 - skipped blanks
59 (read-line fp) ; returns "34"
60 (close fp) ;
61
62 COMMON LISP COMPATIBILITY: The XLISP and Common LISP PEEK-CHAR
63 functions are compatible for simple cases. They both allow for the
64 optional <skip-flag> and <source>. However, in Common LISP, there are
65 addition parameters which occur right after <source> that support
66 various end-of-file operations and recursive calls. So, when porting
67 from Common LISP to XLISP, remember there are additional arguments in
68 Common LISP's PEEK-CHAR that are not supported in XLISP.
69
70
71
72 
73 File: slisp, Node: plusp, Next: poke, Prev: peek-char, Up: Xlisp Language Reference
74
75 plusp
76 =====
77
78 plusp
79 type: predicate function (subr)
80 location: built-in
81 source file: xlmath.c
82 Common LISP compatible: yes
83 supported on: all machines
84
85 SYNTAX
86
87 (plusp <expr> )
88 <expr> - the numeric expression to check
89
90 DESCRIPTION
91
92 The PLUSP predicate checks to see if the number <expr> is positive.
93 T is returned if the number is positive (greater than 0), NIL is
94 returned otherwise. A bad argument type error is generated if the
95 <expr> is not a numeric expression.
96
97 EXAMPLES
98
99 (plusp 0) ; returns NIL
100 (plusp 1) ; returns T
101 (plusp -1) ; returns NIL
102 (plusp #xFFFFFFFF) ; returns NIL
103 (plusp #x0FFFFFFF) ; returns T
104 ;
105 (plusp 'a) ; error: bad argument type
106 (setq a 4) ; set value of A to 4
107 (plusp a) ; returns T
108
109
110
111 
112 File: slisp, Node: poke, Next: pp, Prev: plusp, Up: Xlisp Language Reference
113
114 poke
115 ====
116
117 poke
118 type: function (subr)
119 location: built-in
120 source file: xlsys.c
121 Common LISP compatible: no
122 supported on: all machines
123
124 SYNTAX
125
126 (poke <address> <expr> )
127 <address> - an integer expression
128 <expr> - an integer expression
129
130 DESCRIPTION
131
132 The POKE function writes the <expr> at the internal memory value at
133 the specified <address>. The returned value is <expr>. Be very careful
134 with this function.
135
136 EXAMPLES
137
138 (setq var 0) ; set up VAR with 0
139 (address-of var) ; returns 123224
140 (address-of 'var) ; returns 161922
141 (peek (address-of var)) ; returns 83951616
142 (peek (1+ (address-of var))) ; returns 16777216
143 (peek (+ 2 (address-of var))) ; returns 0 <-- value of VAR
144 (setq var 14) ; change the value to 14
145 (peek (+ 2 (address-of var))) ; returns 14
146 (poke (+ 2 (address-of var)) 1023) ; POKE the value to 1023
147 (print var) ; prints 1023
148
149 CAUTION: Be careful when modifying the internal state of XLISP. If
150 you have modified it, it would be a good idea to exit XLISP and
151 re-enter before doing any work you really want to retain.
152
153 ADDITIONAL CAUTION: It is possible to PEEK and POKE not just XLISP's
154 memory but other parts of your computer's memory. Be very careful
155 when doing this. Also, in some computers, just looking at a memory
156 location can cause things to happen - I/O locations fall in this
157 category.
158
159
160
161 
162 File: slisp, Node: pp, Next: pprint, Prev: poke, Up: Xlisp Language Reference
163
164 pp
165 ==
166
167 pp
168 type: function (subr)
169 location: extension
170 source file: pp.lsp
171 Common LISP compatible: no
172 supported on: all machines
173
174 SYNTAX
175
176 (pp <expr> [ <destination> [ <break-size> ] ] )
177 <expr> - an expression to be pretty printed
178 <destination> - an optional destination - must be a file pointer
179 or stream, the default is *standard-output*
180 <break-size> - an integer expression - default is 45
181
182 DESCRIPTION
183
184 The PP function produces a pretty looking version of the <expr> and
185 prints it to the specified <destination>. If <expr> is an atom (like a
186 string, a symbol, a number, etc.) PP will print it like PRINT. If
187 <expr> is a list, it will perform indenting. T is always returned as
188 the result of PP. The <destination> may be a file pointer or a stream.
189 If there is no <destination> (or it is NIL), *STANDARD-OUTPUT* is the
190 default. The <break-size> paramter is used to determine when an
191 expression should be broken into multiple lines. The default
192 <break-size> is 45.
193
194 EXAMPLES
195
196 (pp 'a) ; prints A returns T
197 (pp "abcd") ; prints "abcd" returns T
198 (pp '(a (b c))) ; prints (A (B C)) returns T
199
200 COMMON LISP COMPATIBILITY: In Common LISP, the PP functionality is
201 provided with the PPRINT function. The PP function was available in
202 previous XLISP releases and is still accessible. It does allow you to
203 specify the length through <break-size>, which is not available in
204 PPRINT.
205
206 NOTE: PP is an extension to the XLISP system provided in the PP.LSP
207 file. The default system and INIT.LSP start-up code do not
208 automatically load PP.LSP. You need to specifically LOAD it yourself
209 during your XLISP session. Another alternative is to put the code or a
210 (LOAD "pp") in the INIT.LSP file. The PP.LSP should have come with
211 your XLISP system. If it doesn't, refer to the EXAMPLE PROGRAMS
212 chapter.
213
214
215
216 
217 File: slisp, Node: pprint, Next: prin1, Prev: pp, Up: Xlisp Language Reference
218
219 pprint
220 ======
221
222 pprint
223 type: function (subr)
224 location: built-in
225 source file: xlpp.c
226 Common LISP compatible: yes
227 supported on: all machines
228
229 SYNTAX
230
231 (pp <expr> [ <destination> ] )
232 <expr> - an expression to be pretty printed
233 <destination> - an optional destination - must be a file pointer
234 or stream, the default is *standard-output*
235
236 DESCRIPTION
237
238 The PPRINT function produces a pretty looking version of the <expr>
239 and prints it to the specified <destination>. If <expr> is an atom
240 (like a string, a symbol, a number, etc.) PPRINT will print it like
241 PRINT. If <expr> is a list, it will perform indenting, as necessary.
242 NIL is always returned as the result of PPRINT. The <destination> may
243 be a file pointer or a stream. If there is no <destination> (or it is
244 NIL), *STANDARD-OUTPUT* is the default.
245
246 EXAMPLES
247
248 (pprint 'a) ; prints A returns T
249 (pprint "abcd") ; prints "abcd" returns T
250 ;
251 (pprint '(a-very-long-name (first list) (second list)))
252 ;
253 ; prints (A-VERY-LONG-NAME (FIRST LIST)
254 ; (SECOND LIST))
255
256 COMMON LISP COMPATIBILITY: Common LISP specifies that PPRINT with a
257 <destination> of NIL, will go to *STANDARD-OUTPUT*. XLISP does not
258 send the output to *STANDARD-OUTPUT* with a <destination> of NIL.
259 Common LISP also specifies that a <destination> of T will be sent to
260 *TERMINAL-IO*. XLISP does not allow T as a valid argument for
261 <destination>.
262
263
264
265 
266 File: slisp, Node: prin1, Next: princ, Prev: pprint, Up: Xlisp Language Reference
267
268 prin1
269 =====
270
271 prin1
272 type: function (subr)
273 location: built-in
274 source file: xlfio.c and xlprin.c
275 Common LISP compatible: yes
276 supported on: all machines
277
278 SYNTAX
279
280 (prin1 <expr> [ <destination> ] )
281 <expr> - an expression
282 <destination> - an optional destination - must be a file pointer
283 or stream, the default is *standard-output*
284
285 DESCRIPTION
286
287 The PRIN1 function prints the <expr> to the specified <destination>.
288 The <expr> is printed without a new-line. If <expr> is a string, it
289 will be printed with quotes around the string. The <expr> is returned
290 as the result. The <destination> may be a file pointer or a stream. If
291 there is no <destination>, *STANDARD-OUTPUT* is the default. The TERPRI
292 function is used to terminate the print lines produced.
293
294 EXAMPLES
295
296 (prin1 'a) ; prints A without <NL>
297 (prin1 '(a b)) ; prints (A B) without <NL>
298 (prin1 2.5) ; prints 2.5 without <NL>
299 (prin1 "hi") ; prints "hi" without <NL>
300 ;
301 (setq f (open "f" :direction :output)) ; create file
302 (prin1 "hi" f) ; returns "hi"
303 (prin1 1234 f) ; returns 1234
304 (prin1 "he" f) ; returns "he"
305 (close f) ; file contains <"hi"1234"he">
306
307 COMMON LISP COMPATIBILITY: Common LISP specifies that print
308 operations with a <destination> of NIL, will go to *STANDARD-OUTPUT*.
309 XLISP does not send the output to *STANDARD-OUTPUT* with a
310 <destination> of NIL. Common LISP also specifies that a <destination>
311 of T will be sent to *TERMINAL-IO*. XLISP does not allow T as a valid
312 argument for <destination>.
313
314
315
316 
317 File: slisp, Node: princ, Next: print, Prev: prin1, Up: Xlisp Language Reference
318
319 princ
320 =====
321
322 princ
323 type: function (subr)
324 location: built-in
325 source file: xlfio.c and xlprin.c
326 Common LISP compatible: yes
327 supported on: all machines
328
329 SYNTAX
330
331 (princ <expr> [ <destination> ] )
332 <expr> - an expression
333 <destination> - an optional destination - must be a file pointer
334 or stream, the default is *standard-output*
335
336 DESCRIPTION
337
338 The PRINC function prints the <expr> to the specified <destination>.
339 The <expr> is printed without a new-line. If <expr> is a string, it
340 will not be printed with quotes around the string. The <expr> is
341 returned as the result. The <destination> may be a file pointer or a
342 stream. If there is no <destination>, *STANDARD-OUTPUT* is the default.
343 The TERPRI function is used to terminate the print lines produced.
344
345 EXAMPLES
346
347 (princ 'a) ; prints A without <NL>
348 (princ '(a b)) ; prints (A B) without <NL>
349 (princ 99) ; prints 99 without <NL>
350 (princ "hi") ; prints hi without <NL>
351 ;
352 (setq f (open "f" :direction :output)) ; create file
353 (princ "hi" f) ; returns "hi"
354 (princ 727 f) ; returns 727
355 (princ "ho" f) ; returns "ho"
356 (close f) ; file contains <hi727ho>
357
358 COMMON LISP COMPATIBILITY: Common LISP specifies that print
359 operations with a <destination> of NIL, will go to *STANDARD-OUTPUT*.
360 XLISP does not send the output to *STANDARD-OUTPUT* with a
361 <destination> of NIL. Common LISP also specifies that a <destination>
362 of T will be sent to *TERMINAL-IO*. XLISP does not allow T as a valid
363 argument for <destination>.
364
365
366
367 
368 File: slisp, Node: print, Next: *print-case*, Prev: princ, Up: Xlisp Language Reference
369
370 print
371 =====
372
373 print
374 type: function (subr)
375 location: built-in
376 source file: xlfio.c and xlprin.c
377 Common LISP compatible: yes
378 supported on: all machines
379
380 SYNTAX
381
382 (print <expr> [ <destination> ] )
383 <expr> - an expression
384 <destination> - an optional destination - must be a file pointer
385 or stream, the default is *standard-output*
386
387 DESCRIPTION
388
389 The PRINT function prints the <expr> to the specified <destination>.
390 The <expr> is printed followed by a new-line. If <expr> is a string, it
391 will be printed with quotes around the string. The <expr> is returned
392 as the result. The <destination> may be a file pointer or a stream. If
393 there is no <destination>, *STANDARD-OUTPUT* is the default.
394
395 EXAMPLES
396
397 (print 'a) ; prints A with <NL>
398 (print '(a b)) ; prints (A B) with <NL>
399 (print 99) ; prints 99 with <NL>
400 (print "hi") ; prints "hi" with <NL>
401 ;
402 (setq f (open "f" :direction :output)) ; create file
403 (print "hi" f) ; returns "hi"
404 (print 727 f) ; returns 727
405 (print "ho" f) ; returns "ho"
406 (close f) ; file contains "hi"<NL>
407 ; 727<NL>
408 ; "ho"<NL>
409
410 COMMON LISP COMPATIBILITY: Common LISP specifies that print
411 operations with a <destination> of NIL, will go to *STANDARD-OUTPUT*.
412 XLISP does not send the output to *STANDARD-OUTPUT* with a
413 <destination> of NIL. Common LISP also specifies that a <destination>
414 of T will be sent to *TERMINAL-IO*. XLISP does not allow T as a valid
415 argument for <destination>.
416
417
418
419 
420 File: slisp, Node: *print-case*, Next: prog, Prev: print, Up: Xlisp Language Reference
421
422 *print-case*
423 ============
424
425 *print-case*
426 type: system variable
427 location: built-in
428 source file: xlprin.c
429 Common LISP compatible: similar
430 supported on: all machines
431
432 SYNTAX
433
434 *print-case*
435
436 DESCRIPTION
437
438 *PRINT-CASE* is a system variable that allows a user to specify how
439 symbols are to be printed by XLISP. If *PRINT-CASE* is set to
440 :DOWNCASE, all symbols will be printed in lower case characters. If
441 *PRINT-CASE* is set to :UPCASE, all symbols will be printed in upper
442 case characters. If *PRINT-CASE* is set to anything other than :UPCASE
443 or :DOWNCASE, all symbols will be printed in upper case characters. The
444 default value for *PRINT-CASE* is the keyword :UPCASE.
445
446 EXAMPLES
447
448 (setq *print-case* :downcase) ; returns :downcase
449 (setq a 'b) ; returns b
450 ;
451 (setq *print-case* 'foo) ; returns FOO
452 (setq a 'b) ; returns B
453 ;
454 (setq *print-case* :upcase) ; returns :UPCASE
455 (setq a 'b) ; returns B
456
457 COMMON LISP COMPATIBILITY: Common LISP supports a third keyword
458 :CAPITALIZE. XLISP does not support this, but this should not be a
459 major problem. If set to :CAPITALIZE, XLISP will print all symbols in
460 upper-case characters.
461
462
463
464 
465 File: slisp, Node: prog, Next: prog*, Prev: *print-case*, Up: Xlisp Language Reference
466
467 prog
468 ====
469
470 prog
471 type: special form (fsubr)
472 location: built-in
473 source file: xlcont.c
474 Common LISP compatible: yes
475 supported on: all machines
476
477 SYNTAX
478
479 (prog ( [ <binding> ... ] ) [ <expr> ... ] )
480 <binding> - a variable binding which is can take one of
481 <symbol> or ( <symbol> <init-expr> )
482 <symbol> - a symbol
483 <init-expr> - an initialization expression for <symbol>
484 <expr> - expressions comprising the body of the loop
485 which may contain RETURNs, GOs or tags for GO
486
487 DESCRIPTION
488
489 The PROG special form is basically a 'block' construct (like a PASCAL
490 BEGIN / END) that contains symbols (with optional initializations) and a
491 block of code (expressions) to evaluate. The PROG form evaluates its
492 initializations in no specified order (as opposed to PROG* which does it
493 sequential order). The first form after the PROG is the <binding> form.
494 It contains a series of <symbol>'s or <binding>'s. The <binding> is a
495 <symbol> followed by an initialization expression <init-expr>. If there
496 is no <init-expr>, the <symbol> will be initialized to NIL. There is no
497 specification as to the order of execution of the bindings or the step
498 expressions - except that they happen all together. If a RETURN form is
499 evaluated, its value will be returned. Otherwise, NIL is returned.
500 When the PROG is finished execution, the <symbol>'s that were defined
501 will no longer exist or retain their values.
502
503 EXAMPLES
504
505 (prog () (print "hello")) ; prints "hello" returns NIL
506 (prog (i j) ; PROG with vars I and J
507 (print i) (print j)) ; prints NIL NIL returns NIL
508 (prog ((i 1) (j 2)) ; PROG with vars I and J
509 (print i) (print j) ;
510 (return (+ i j))) ; prints 1 2 returns 3
511
512
513
514 
515 File: slisp, Node: prog*, Next: prog1, Prev: prog, Up: Xlisp Language Reference
516
517 prog*
518 =====
519
520 prog*
521 type: special form (fsubr)
522 location: built-in
523 source file: xlcont.c
524 Common LISP compatible: yes
525 supported on: all machines
526
527 SYNTAX
528
529 (prog* ( [ <binding> ... ] ) [ <expr> ... ] )
530 <binding> - a variable binding which is can take one of
531 <symbol> or ( <symbol> <init-expr> )
532 <symbol> - a symbol
533 <init-expr> - an initialization expression for <symbol>
534 <expr> - expressions comprising the body of the loop
535 which may contain RETURNs, GOs or tags for GO
536
537 DESCRIPTION
538
539 The PROG* special form is basically a 'block' construct (like a
540 PASCAL BEGIN / END) that contains symbols (with optional
541 initializations) and a block of code (expressions) to evaluate. The
542 PROG* form evaluates its initializations in sequential order (as
543 opposed to PROG which does it in no specified order). The first form
544 after the PROG* is the 'binding' form. It contains a series of
545 <symbol>'s or <binding>'s. The <binding> is a <symbol> followed by an
546 initialization expression <init-expr>. If there is no <init-expr>, the
547 <symbol> will be initialized to NIL. The order of execution of the
548 bindings is sequential. If a RETURN form is evaluated, its value will
549 be returned. Otherwise, NIL is returned. When the PROG* is finished
550 execution, the <symbol>'s that were defined will no longer exist or
551 retain their values.
552
553 EXAMPLES
554
555 (prog* (i j) ; PROG* with vars I and J
556 (print i) (print j)) ; prints NIL NIL returns NIL
557 (prog* ((i 1) (j 2)) ; PROG* with vars I and J
558 (print i) (print j) ;
559 (return (+ i j))) ; prints 1 2 returns 3
560 (prog* () (print "hello")) ; prints "hello" returns NIL
561 ;
562 (prog ((i 1) (j (+ i 1))) ; PROG won't work due to order
563 (print (+ i j)) ) ; error: unbound variable - I
564 (prog* ((i 1) (j (+ i 1))) ; PROG* will work due to order
565 (print (+ i j)) ) ; prints 3 returns NIL
566
567
568
569 
570 File: slisp, Node: prog1, Next: prog2, Prev: prog*, Up: Xlisp Language Reference
571
572 prog1
573 =====
574
575 prog1
576 type: special form (fsubr)
577 location: built-in
578 source file: xlcont.c
579 Common LISP compatible: yes
580 supported on: all machines
581
582 SYNTAX
583
584 (prog1 [ <expr1> <expr2> ... ] )
585 <exprN> - expressions comprising the body of the loop
586
587 DESCRIPTION
588
589 The PROG1 special form is basically a 'block' construct (like a
590 PASCAL BEGIN / END) that contains a block of code (expressions) to
591 evaluate. <expr1>'s value will be returned as the result of PROG1. If
592 there is no <expr1>, NIL is returned.
593
594 EXAMPLES
595
596 (prog1 (print "hi") (print "ho")) ; prints "hi" "ho" returns "hi"
597 (prog1) ; returns NIL
598 (prog1 'a) ; returns A
599 (prog1 "hey" (print "ho")) ; prints "ho" returns "hey"
600
601 NOTE: PROG1, PROG2, PROGN and PROGV do not allow the use of RETURN
602 or GO or tags for GO.
603
604
605
606 
607 File: slisp, Node: prog2, Next: progn, Prev: prog1, Up: Xlisp Language Reference
608
609 prog2
610 =====
611
612 prog2
613 type: special form (fsubr)
614 location: built-in
615 source file: xlcont.c
616 Common LISP compatible: yes
617 supported on: all machines
618
619 SYNTAX
620
621 (prog2 [ <expr1> <expr2> ... ] )
622 <exprN> - expressions comprising the body of the loop
623
624 DESCRIPTION
625
626 The PROG2 special form is basically a 'block' construct (like a
627 PASCAL BEGIN / END) that contains a block of code (expressions) to
628 evaluate. <expr2>'s value will be returned as the result of PROG2. If
629 there is no <expr2>, <expr1> is returned. If there is no <expr1>, NIL
630 is returned.
631
632 EXAMPLES
633
634 (prog2 (print "hi") (print "ho")) ; prints "hi" "ho" returns "ho"
635 (prog2) ; returns NIL
636 (prog2 (print "hi")) ; prints "hi" returns "hi"
637 (prog2 (print "ho") "hey") ; prints "ho" returns "hey"
638 (prog2 'a 'b 'c) ; returns B
639
640 NOTE: PROG1, PROG2, PROGN and PROGV do not allow the use of RETURN
641 or GO or tags for GO.
642
643
644
645 
646 File: slisp, Node: progn, Next: progv, Prev: prog2, Up: Xlisp Language Reference
647
648 progn
649 =====
650
651 progn
652 type: special form (fsubr)
653 location: built-in
654 source file: xlcont.c
655 Common LISP compatible: yes
656 supported on: all machines
657
658 SYNTAX
659
660 (progn [ <expr1> <expr2> ... ] )
661 <exprN> - expressions comprising the body of the loop
662
663 DESCRIPTION
664
665 The PROGN special form is basically a 'block' construct (like a
666 PASCAL BEGIN / END) that contains a block of code (expressions) to
667 evaluate. The last <expr>'s value will be returned as the result of
668 PROGN. If there are no <expr>s, NIL is returned.
669
670 EXAMPLES
671
672 (progn (print "hi") (print "ho")) ; prints "hi" "ho" returns "ho"
673 (progn) ; returns NIL
674 (progn "hey" (print "ho")) ; prints "ho" returns "ho"
675 (progn 'a) ; returns A
676 (progn 'a 'b 'c) ; returns C
677
678 NOTE: PROG1, PROG2, PROGN and PROGV do not allow the use of RETURN
679 or GO or tags for GO.
680
681
682
683 
684 File: slisp, Node: progv, Next: psetq, Prev: progn, Up: Xlisp Language Reference
685
686 progv
687 =====
688
689 progv
690 type: special form (fsubr)
691 location: built-in
692 source file: xlcont.c
693 Common LISP compatible: yes
694 supported on: all machines
695
696 SYNTAX
697
698 (progv <symbols> <values> [ <expr1> <expr2> ... ] )
699 <symbols> - a list comprising symbols to be bound
700 <values> - a list comprising values to be bound to symbols
701 <exprN> - expressions comprising the body of the loop
702
703 DESCRIPTION
704
705 The PROGV special form is basically a 'block' construct (like a
706 PASCAL BEGIN / END) that contains a block of code (expressions) to
707 evaluate. PROGV is different from PROG1, PROG2 and PROGN in that it
708 contains a pair of lists - <symbols> and <values>. Before evaluating
709 the <exprN> expressions, PROGV will dynamically bind the <values> to the
710 corresponding <symbols>. If there are too many <symbols> for the
711 <values>, the <symbols> with no corresponding <values> will be bound to
712 NIL. The variables will be unbound after the execution of PROGV. The
713 last <expr>'s value will be returned as the result of PROGV. If there
714 are no <expr>s, NIL is returned.
715
716 EXAMPLES
717
718 (progv '(var) '(2) ;
719 (print var) (print "two")) ; prints 2 "two" returns "two"
720 ;
721 (setq a "beginning") ; initialize A
722 (progv '(a) '(during) (print a)) ; prints DURING
723 (print a) ; prints "beginning"
724 ;
725 (progv '(no-way) '(no-how) ) ; returns NIL
726 (progv) ; error: too few arguments
727
728 NOTE: PROGV is different from PROG (which allows symbols and
729 initialization forms) in that PROGV allows its <symbols> and <values>
730 to be evaluated. This allows you to pass in forms that generate the
731 <symbols> and their <values>.
732
733 NOTE: PROG1, PROG2, PROGN and PROGV do not allow the use of RETURN
734 or GO or tags for GO.
735
736
737
738 
739 File: slisp, Node: psetq, Next: putprop, Prev: progv, Up: Xlisp Language Reference
740
741 psetq
742 =====
743
744 psetq
745 type: special form (fsubr)
746 location: built-in
747 source file: xlcont.c
748 Common LISP compatible: yes
749 supported on: all machines
750
751 SYNTAX
752
753 (psetq [ <symbol> <expr> ] ... )
754 <symbol> - un-evaluated symbol
755 <expr> - value for <symbol>
756
757 DESCRIPTION
758
759 PSETQ sets <expr> as the value of <symbol>. There can be several
760 pairs of assignment. PSETQ performs these assignments in parallel - the
761 <symbol>'s are not assigned new values until all the <expr>'s have been
762 evaluated. PSETQ returns the value from the last <expr> as it's result.
763
764 EXAMPLES
765
766 (psetq a 1) ; symbol A gets value 1
767 (psetq b '(a b c)) ; symbol B gets value (A B C)
768 (psetq mynum (+ 3 4)) ; symbol MYNUM gets value 7
769 ;
770 (setq goo 'ber) ; returns BER
771 (setq num 1) ; returns 1
772 (psetq goo num num goo) ; returns BER
773 (print goo) ; returns 1
774 (print num) ; returns BER
775
776
777
778 
779 File: slisp, Node: putprop, Next: quote, Prev: psetq, Up: Xlisp Language Reference
780
781 putprop
782 =======
783
784 putprop
785 type: function (subr)
786 location: built-in
787 source file: xlbfun.c
788 Common LISP compatible: no
789 supported on: all machines
790
791 SYNTAX
792
793 (putprop <symbol> <value> <property> )
794 <symbol> - the symbol with a property list
795 <value> - the value to be assigned to the property
796 <property> - the property name being changed/added
797
798 DESCRIPTION
799
800 PUTPROP sets the value of the <property> in the <symbol>. If the
801 <property> does not exist, the <property> is added to the property list.
802 The <symbol> must be an existing symbol. The <value> may be a single
803 value or a list.
804
805 Property lists are lists attached to any user defined variables.
806 The lists are in the form of (name1 val1 name2 val2 ....). Any
807 number of properties may be attached to a single variable.
808
809 EXAMPLES
810
811 (setq person 'bobby) ; create a var with a value
812 (putprop person 'boogie 'last-name) ; add a LAST-NAME property
813 (putprop person 'disc-jockey 'job) ; add a JOB property
814 (get person 'last-name) ; retrieve LAST-NAME - boogie
815 (get person 'job) ; retrieve JOB - disc-jockey
816 (get person 'height) ; non-existant - returns NIL
817 (putprop person '(10 20 30) 'stats) ; add STATS - a list
818 (get person 'stats) ;
819
820 NOTE: You can set a property to the value NIL. However, this NIL
821 value is indistinguishable from the NIL returned when a property does
822 not exist.
823
824 COMMON LISP COMPATIBILITY: Common LISP does not have a PUTPROP
825 function. It uses a SETF to achieve this functionality. Porting
826 from Common LISP to XLISP will work fine since XLISP supports the SETF
827 modifications of property lists and GET. Porting from XLISP to
828 Common LISP will require translating PUTPROP into SETF forms.
829
830 LISP DIALECTS: The order of PUTPROP arguments is <symbol>, <value>,
831 <property>. This is different from many other LISPs which
832 normally use <symbol>, <property>, <value>. Be careful when porting
833 existing LISP code.
834
835
836
837 
838 File: slisp, Node: quote, Next: random, Prev: putprop, Up: Xlisp Language Reference
839
840 quote
841 =====
842
843 quote
844 type: special form (fsubr)
845 location: built-in
846 source file: xlcont.c
847 Common LISP compatible: yes
848 supported on: all machines
849
850 SYNTAX
851
852 (quote <expr> )
853 <expr> - an expression
854
855 DESCRIPTION
856
857 QUOTE returns the the <expr> un-evaluated.
858
859 EXAMPLES
860
861 my-var ; error: unbound variable
862 (quote my-var) ; returns MY-VAR
863 my-var ; still error: unbound variable
864 (set (quote my-var) 111) ; give MY-VAR a value -
865 ; make it exist
866 my-var ; returns 111
867 (quote my-var) ; returns MY-VAR
868 ;
869 ; SAME AS ABOVE BUT USING THE
870 ; READ MACRO FOR QUOTE - '
871 new-var ; error: unbound variable
872 'new-var ; returns NEW-VAR
873 new-var ; still error: unbound variable
874 (setq new-var 222) ; give NEW-VAR a value -
875 ; make it exist
876 new-var ; returns 222
877 'new-var ; returns NEW-VAR
878
879 READ MACRO: XLISP supports the normal read macro of a single quote
880 as a short-hand method of writing the QUOTE function.
881
882
883
884 
885 File: slisp, Node: random, Next: read, Prev: quote, Up: Xlisp Language Reference
886
887 random
888 ======
889
890 random
891 type: function (subr)
892 location: built-in
893 source file: xlmath.c
894 Common LISP compatible: similar
895 supported on: all machines
896
897 SYNTAX
898
899 (random <expr> )
900 <expr> - integer number/expression
901
902 DESCRIPTION
903
904 The RANDOM function generates and returns a random number between 0
905 and <expr> - 1. If <expr> is negative, the number range is forced to be
906 positive.
907
908 EXAMPLES
909
910 (random 100) ; returns 7
911 (random 100) ; returns 49
912 (random 100) ; returns 73
913 (random -100) ; returns 58
914 (random 100.01) ; error: bad flt.pt. operation
915
916 COMMON LISP COMPATIBILITY: Common LISP allows an optional state
917 parameter, which is not supported in XLISP. Also, Common LISP allows
918 floating point numbers, which XLISP does not support.
919
920 NOTE: This function is an extension of the XLISP system. It is
921 provided in the MSSTUFF.C source code file. If your XLISP system is
922 built for an IBM PC and compatibles, this function will work. If your
923 system is built on UNIX or some other operating system, it will need
924 the code in the corresponding STUFF.C file.
925
926
927
928 
929 File: slisp, Node: read, Next: read-byte, Prev: random, Up: Xlisp Language Reference
930
931 read
932 ====
933
934 read
935 type: function (subr)
936 location: built-in
937 source file: xlfio.c and xlread.c
938 Common LISP compatible: similar
939 supported on: all machines
940
941 SYNTAX
942
943 (read [ <source> [ <eof-result> [ <recursive-flag> ] ] ] )
944 <source> - an optional source - must be a file pointer
945 or stream, the default is *standard-input*
946 <eof-result> - an optional expression (default is NIL)
947 <recursive-flag>- an optional expression ( NIL or non-NIL )
948
949 DESCRIPTION
950
951 The READ function reads an expression from the specified <source>.
952 The expression read is a 'normal' XLISP expression - not a line. This
953 means that white space is removed - blanks, empty lines and comment
954 lines. Read-macro expansions will occur (like QUOTE instead of '). The
955 expression needs to be an atom (numeric, string or symbol) or a valid
956 list. It can span several lines. The expression read is returned as
957 the result. The <source> may be a file pointer or a stream. If there
958 is no <source>, *STANDARD-INPUT* is the default. If an end-of-file is
959 encountered in the <source>, then the <eof-result> value will be
960 returned as the result.
961
962 If you wish to read just lines or characters, refer to READ-LINE
963 or READ-CHAR.
964
965 The <recursive-flag> is intended for use with embedded calls to READ.
966 This is useful in read-macro and read-table uses. If <recursive-flag>
967 is non-NIL, the READ does not expect itself to be at a 'top-level', but
968 recursively executing within another READ that is in progress.
969
970 EXAMPLES
971
972 (setq fp (open "f" :direction :output)) ; set up file
973 (print "hello" fp) ;
974 (print 12.34 fp) ;
975 (princ "'(a b" fp) (terpri fp) ; fill with stuff
976 (princ "; comment" fp) (terpri fp) ;
977 (princ " c d)" fp ) ;
978 (close fp) ;
979 ;
980 (setq fp (open "f" :direction :input)) ; now read the file
981 (read fp "done") ; returns "hello"
982 (read fp "done") ; returns 12.34
983 (read fp "done") ; returns (QUOTE (A B C D))
984 ; note macro expansion of QUOTE
985 ; note that comment is gone
986 (read fp "done") ; returns "done"
987 (close fp)
988
989 COMMON LISP COMPATIBILITY: The XLISP and Common LISP READ functions
990 are similar. They both allow for <source>, <eof-result> and
991 <recursive-flag>. However, in Common LISP, there is an addition
992 end-of-file error parameter. This parameter occurs right after
993 <source> and specifies whether or not to flag an error on end-of-file.
994 So, when porting, remember there is one additional argument in Common
995 LISP's READ. You need to be concerned about this if you use more than
996 just a <source> argument - going either from XLISP to Common LISP or
997 vice versa.
998
999 COMMON LISP COMPATIBILITY: Common LISP specifies that read
1000 operations with a <source> of NIL, will come from *STANDARD-INPUT*.
1001 XLISP does not read the input from *STANDARD-INPUT* with a <source> of
1002 NIL. Common LISP also specifies that a <source> of T will read from
1003 *TERMINAL-IO*. XLISP does not allow T as a valid argument for <source>.
1004
1005
1006
1007 
1008 File: slisp, Node: read-byte, Next: read-char, Prev: read, Up: Xlisp Language Reference
1009
1010 read-byte
1011 =========
1012
1013 read-byte
1014 type: function (subr)
1015 location: built-in
1016 source file: xlfio.c
1017 Common LISP compatible: similar
1018 supported on: all machines
1019
1020 SYNTAX
1021
1022 (read-byte [ <source> ] )
1023 <source> - an optional source - must be a file pointer
1024 or stream, the default is *standard-input*
1025
1026 DESCRIPTION
1027
1028 The READ-BYTE function reads a single character from the specified
1029 <source>. The character read is returned as an integer value for the
1030 result. The <source> may be a file pointer or a stream. If there is no
1031 <source>, *STANDARD-INPUT* is the default. If an end-of-file is
1032 encountered in the <source>, then NIL will be returned as the result.
1033
1034 EXAMPLES
1035
1036 (setq fp (open "f" :direction :output)) ; set up file
1037 (print 12.34 fp) ;
1038 (close fp) ;
1039 ;
1040 (setq fp (open "f" :direction :input)) ; now read the file
1041 (read-byte fp) ; returns 49 "1"
1042 (read-byte fp) ; returns 50 "2"
1043 (read-byte fp) ; returns 46 "."
1044 (read-byte fp) ; returns 51 "3"
1045 (read-byte fp) ; returns 52 "4"
1046 (read-byte fp) ; returns 10 "\n"
1047 (read-byte fp) ; returns NIL empty
1048 (close fp) ;
1049
1050 COMMON LISP COMPATIBILITY: The XLISP and Common LISP READ-BYTE
1051 functions are compatible for simple cases. They both allow for the
1052 optional <source>. However, in Common LISP, there are addition
1053 parameters which occur right after <source>. So, when porting from
1054 Common LISP to XLISP, remember there are additional arguments in Common
1055 LISP's READ-BYTE.
1056
1057 COMMON LISP COMPATIBILITY: Common LISP specifies that read
1058 operations with a <source> of NIL, will come from *STANDARD-INPUT*.
1059 XLISP does not read the input from *STANDARD-INPUT* with a <source> of
1060 NIL. Common LISP also specifies that a <source> of T will read from
1061 *TERMINAL-IO*. XLISP does not allow T as a valid argument for <source>.
1062
1063
1064
1065 
1066 File: slisp, Node: read-char, Next: read-line, Prev: read-byte, Up: Xlisp Language Reference
1067
1068 read-char
1069 =========
1070
1071 read-char
1072 type: function (subr)
1073 location: built-in
1074 source file: xlfio.c
1075 Common LISP compatible: similar
1076 supported on: all machines
1077
1078 SYNTAX
1079
1080 (read-char [ <source> ] )
1081 <source> - an optional source - must be a file pointer
1082 or stream, the default is *standard-input*
1083
1084 DESCRIPTION
1085
1086 The READ-CHAR function reads a single character from the specified
1087 <source>. The character read is returned as a single character value
1088 for the result. The <source> may be a file pointer or a stream. If
1089 there is no <source>, *STANDARD-INPUT* is the default. If an
1090 end-of-file is encountered in the <source>, then NIL will be returned as
1091 the result.
1092
1093 EXAMPLES
1094
1095 (setq fp (open "f" :direction :output)) ; set up file
1096 (print 12.34 fp) ;
1097 (close fp) ;
1098 ;
1099 (setq fp (open "f" :direction :input)) ; now read the file
1100 (read-char fp) ; returns #\1
1101 (read-char fp) ; returns #\2
1102 (read-char fp) ; returns #\.
1103 (read-char fp) ; returns #\3
1104 (read-char fp) ; returns #\4
1105 (read-char fp) ; returns #\Newline
1106 (read-char fp) ; returns NIL empty
1107 (close fp) ;
1108
1109 COMMON LISP COMPATIBILITY: The XLISP and Common LISP READ-CHAR
1110 functions are compatible for simple cases. They both allow for the
1111 optional <source>. However, in Common LISP, there are addition
1112 parameters which occur right after <source>. So, when porting from
1113 Common LISP to XLISP, remember there are additional arguments in Common
1114 LISP's READ-CHAR.
1115
1116 COMMON LISP COMPATIBILITY: Common LISP specifies that read
1117 operations with a <source> of NIL, will come from *STANDARD-INPUT*.
1118 XLISP does not read the input from *STANDARD-INPUT* with a <source> of
1119 NIL. Common LISP also specifies that a <source> of T will read from
1120 *TERMINAL-IO*. XLISP does not allow T as a valid argument for <source>.
1121
1122
1123
1124 
1125 File: slisp, Node: read-line, Next: *readtable*, Prev: read-char, Up: Xlisp Language Reference
1126
1127 read-line
1128 =========
1129
1130 read-line
1131 type: function (subr)
1132 location: built-in
1133 source file: xlfio.c
1134 Common LISP compatible: similar
1135 supported on: all machines
1136
1137 SYNTAX
1138
1139 (read-line [ <source> ] )
1140 <source> - an optional source - must be a file pointer
1141 or stream, the default is *standard-input*
1142
1143 DESCRIPTION
1144
1145 The READ-LINE function reads a single line from the specified
1146 <source>. The line read is returned as a string value for the result.
1147 The <source> may be a file pointer or a stream. If there is no
1148 <source>, *STANDARD-INPUT* is the default. If an end-of-file is
1149 encountered in the <source>, then NIL will be returned as the result.
1150
1151 EXAMPLES
1152
1153 (setq fp (open "f" :direction :output)) ; set up file
1154 (print "fe fi" fp) ;
1155 (print 12.34 fp) ;
1156 (close fp) ;
1157 ;
1158 (setq fp (open "f" :direction :input)) ; now read the file
1159 (read-line fp) ; returns ""fe fi""
1160 (read-line fp) ; returns "12.34"
1161 (read-line fp) ; returns NIL
1162 (close fp) ;
1163
1164 COMMON LISP COMPATIBILITY: The XLISP and Common LISP READ-LINE
1165 functions are compatible for simple cases. They both allow for the
1166 optional <source>. However, in Common LISP, there are addition
1167 parameters which occur right after <source>. So, when porting from
1168 Common LISP to XLISP, remember there are additional arguments in Common
1169 LISP's READ-LINE.
1170
1171 COMMON LISP COMPATIBILITY: Common LISP specifies that read
1172 operations with a <source> of NIL, will come from *STANDARD-INPUT*.
1173 XLISP does not read the input from *STANDARD-INPUT* with a <source> of
1174 NIL. Common LISP also specifies that a <source> of T will read from
1175 *TERMINAL-IO*. XLISP does not allow T as a valid argument for <source>.
1176
1177
1178
1179 
1180 File: slisp, Node: *readtable*, Next: rem, Prev: read-line, Up: Xlisp Language Reference
1181
1182 *readtable*
1183 ===========
1184
1185 *readtable*
1186 type: system variable
1187 location: built-in
1188 source file: xlread.c
1189 Common LISP compatible: related
1190 supported on: all machines
1191
1192 SYNTAX
1193
1194 *readtable*
1195
1196 DESCRIPTION
1197
1198 The *READTABLE* is a system variable that contains XLISP's data
1199 structures relating to the processing of characters from the user (or
1200 files) and read-macro expansions. The table is 128 entries (0..127) for
1201 each of the 7-bit ASCII characters that XLISP can read. Each entry in
1202 the *READTABLE* array must be one of NIL, :CONSTITUENT, :WHITE-SPACE,
1203 :SESCAPE, :MESCAPE, a :TMACRO dotted pair or a :NMACRO dotted pair.
1204
1205 Table entry Meaning
1206 --------------------------------------------------------
1207 NIL Invalid character
1208 :CONSTITUENT The character is valid, as is.
1209 :WHITE-SPACE The character may be skipped over.
1210 :SESCAPE The single escape character ('\');
1211 :MESCAPE The multiple escape character ('|');
1212 (:TMACRO . <f> ) A terminating read-macro
1213 (:NMACRO . <f> ) A non-terminating read-macro
1214
1215 In the case of :NMACRO and :TMACRO, the form of the *READTABLE*
1216 entry is a list like (:TMACRO . <function> ) or (:NMACRO . <function>
1217 ). The <function> can be a built-in read-macro function or a user
1218 defined lambda expression. The <function> takes two parameters, an
1219 input stream specification, and an integer that is the character value.
1220 The <function> should return NIL if the character is 'white-space' or a
1221 value CONSed with NIL to return the value.
1222
1223 EXAMPLES
1224
1225 *readtable* ; returns the current table
1226 ;
1227 (defun look-at (table) ; define a function to
1228 (dotimes (ch 127) ; look in a table
1229 (prog ( (entry (aref table ch)) ) ; and print out any
1230 (case entry ; entries with a function
1231 (NIL NIL) ;
1232 (:CONSTITUENT NIL) ;
1233 (:WHITE-SPACE NIL) ;
1234 (:SESCAPE NIL) ;
1235 (:MESCAPE NIL) ;
1236 (T (princ (int-char ch)));
1237 ))) ;
1238 (terpri)) ;
1239 ;
1240 (look-at *readtable*) ; prints "#'(),;`
1241
1242 CAUTION: If you experiment with *READTABLE*, it is useful to save
1243 the old value in a variable, so that you can restore the system state.
1244
1245
1246
1247 
1248 File: slisp, Node: rem, Next: remove, Prev: *readtable*, Up: Xlisp Language Reference
1249
1250 rem
1251 ===
1252
1253 rem
1254 type: function (subr)
1255 location: built-in
1256 source file: xlmath.c
1257 Common LISP compatible: similar
1258 supported on: all machines
1259
1260 SYNTAX
1261
1262 (rem <expr1> ... )
1263 <exprN> - integer number/expression
1264
1265 DESCRIPTION
1266
1267 The REM function takes the first pair of expressions and determines
1268 what is the remainder from dividing the first by the second expression.
1269 If there are no other arguments, this value is returned. If there are
1270 additional arguments, the remainder of the first pair is applied to the
1271 next and then the next and so on. In other words, (REM A B C D) is
1272 equivalent to (REM (REM (REM A B) C) D).
1273
1274 EXAMPLES
1275
1276 (rem 1) ; returns 1
1277 (rem 1 2) ; returns 1
1278 (rem 13 8) ; returns 5
1279 (rem 13 8 3) ; returns 2
1280 (rem 13.5 8) ; error: bad flt.pt. operation
1281
1282 COMMON LISP COMPATIBILITY: Common LISP only allows two arguments.
1283 XLISP supports an arbitrary number of arguments. Also, Common LISP
1284 allows for floating point expressions where XLISP does not support this.
1285
1286
1287

brinkley@uw.edu
ViewVC Help
Powered by ViewVC 1.1.26