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

Contents of /skandha4/info/slisp-13

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue May 25 09:39:14 1999 UTC (21 years, 5 months ago) by jsp
Branch: biostr, MAIN
CVS Tags: skandha4, skandha4_1_6, dsg_1_0, HEAD
Branch point for: skandha4_pub, autoconf
Changes since 1.1: +0 -0 lines
ANSI C version of Skandha4


1 This is Info file slisp, produced by Makeinfo version 1.68 from the
2 input file slisp.texi.
3
4 This file documents slisp, (skandha-lisp), an extendable xlisp.
5
6 Copyright @copyright 1994 University of Washington Digital Anatomist
7 Program by Jeff Prothero (jsp@biostr.washington.edu) and Jim Brinkley
8 See slisp/SLISPCOPYING for details
9
10 
11 File: slisp, Node: sort, Next: sqrt, Prev: sin, Up: Xlisp Language Reference
12
13 sort
14 ====
15
16 sort
17 type: function (subr)
18 location: built-in
19 source file: xllist.c
20 Common LISP compatible: similar
21 supported on: all machines
22
23 SYNTAX
24
25 (sort <list> <test> )
26 <list> - a list containing elements to be sorted
27 <test> - the test to use for the sort
28
29 DESCRIPTION
30
31 The SORT function sorts the <list> using the <test> to order the
32 list. The SORT function is destructive and modifies the <list>.
33
34 EXAMPLES
35
36 (setq a '(3 1 4 1 5 9 6 7)) ; returns (3 1 4 1 5 9 6 7)
37 (sort a '<) ; returns (1 1 3 4 5 6 7 9)
38 (print a) ; returns (1 1 3 4 5 6 7 9)
39 ; notice that A is modified
40 (sort a '> ) ; returns (9 7 6 5 4 3 1 1)
41 ;
42 (sort '("a" "bar" "foo") 'string> ) ; returns ("foo" "bar" "a")
43
44 BUG: XLISP returns the proper value, but improperly modifies the
45 symbol or actual <list>.
46
47 COMMON LISP COMPATIBILITY: Common LISP allows for a :KEY keyword
48 (which allows a specified function to be run before the ordering takes
49 place), which XLISP does not support.
50
51
52
53 
54 File: slisp, Node: sqrt, Next: *standard-input*, Prev: sort, Up: Xlisp Language Reference
55
56 sqrt
57 ====
58
59 sqrt
60 type: function (subr)
61 location: built-in
62 source file: xlmath.c
63 Common LISP compatible: similar
64 supported on: all machines
65
66 SYNTAX
67
68 (sqrt <expr> )
69 <expr> - floating point number/expression
70
71 DESCRIPTION
72
73 The SQRT function calculates the square root of <expr> and returns
74 this result.
75
76 EXAMPLES
77
78 (sqrt 1.0) ; returns 1
79 (sqrt 2.0) ; returns 1.41421
80 (sqrt 3.0) ; returns 1.73205
81 (sqrt 4.0) ; returns 2
82 (sqrt 5.0) ; returns 2.23607
83 (sqrt -1.0) ; error: sqrt of a neg. number
84 (sqrt 2) ; error: bad integer operation
85
86 COMMON LISP COMPATIBILITY: Common LISP allows for integer numbers,
87 which XLISP does not support for SQRT.
88
89
90
91 
92 File: slisp, Node: *standard-input*, Next: *standard-output*, Prev: sqrt, Up: Xlisp Language Reference
93
94 *standard-input*
95 ================
96
97 *standard-input*
98 type: system variable
99 location: built-in
100 source file: xlinit.c
101 Common LISP compatible: yes
102 supported on: all machines
103
104 SYNTAX
105
106 *standard-input*
107
108 DESCRIPTION
109
110 *STANDARD-INPUT* is a system variable that contains a file pointer
111 that points to the file where all normal input from the programmer or
112 user comes from. The default file for *STANDARD-INPUT* is the system
113 standard input device - normally the system keyboard.
114
115 EXAMPLES
116
117 *standard-input* ; returns #<File-Stream: #2442e>
118
119 NOTE: Be careful when modifying the *STANDARD-INPUT*. If you do not
120 save the old file pointer, you will not be able to return to normal
121 operation and will need to exit XLISP. If the file or source that you
122 have set *STANDARD-INPUT* to does not reset *STANDARD-INPUT* to its
123 previous value, you will never get control back to the keyboard.
124
125
126
127 
128 File: slisp, Node: *standard-output*, Next: strcat, Prev: *standard-input*, Up: Xlisp Language Reference
129
130 *standard-output*
131 =================
132
133 *standard-output*
134 type: system variable
135 location: built-in
136 source file: xlinit.c
137 Common LISP compatible: yes
138 supported on: all machines
139
140 SYNTAX
141
142 *standard-output*
143
144 DESCRIPTION
145
146 *STANDARD-OUTPUT* is a system variable that contains a file pointer
147 that points to the file where all normal printing and messages from
148 XLISP will go. The default file for *STANDARD-OUTPUT* is the system
149 standard output device - normally the screen display/crt.
150
151 EXAMPLES
152
153 *standard-output* ; returns #<File-Stream: #24406>
154 (setq old-so *standard-output*) ; save the file pointer
155 (setq fp (open "f" :direction :output)) ; open a new output file
156 (setq *standard-output* fp) ; change where output goes
157 ;
158 (+ 2 2) ; you won't see any messages
159 ; just the echo of input line
160 ;
161 (setq *standard-output* old-so) ; restore standard output
162 (close fp) ; close file
163
164 NOTE: Be careful when modifying the *STANDARD-OUTPUT*, you will not
165 be able to see what you are doing. If you do not save the old file
166 pointer, you will not be able to return to normal operation and will
167 need to exit XLISP.
168
169
170
171 
172 File: slisp, Node: strcat, Next: streamp, Prev: *standard-output*, Up: Xlisp Language Reference
173
174 strcat
175 ======
176
177 strcat
178 type: function (subr)
179 location: built-in
180 source file: xlstr.c
181 Common LISP compatible: no
182 supported on: all machines
183
184 SYNTAX
185
186 (strcat [ <string1> ... ] )
187 <stringN> - a string expression
188
189 DESCRIPTION
190
191 The STRCAT function returns the concatenation of a sequence of string
192 expressions. If there are no strings, an empty string is returned.
193
194 EXAMPLES
195
196 (strcat) ; returns ""
197 (strcat "a") ; returns "a"
198 (strcat "a" "b") ; returns "ab"
199 (strcat "ab" "cd" "ef") ; returns "abcdef"
200 (strcat "f" "ire tr" "uck") ; returns "fire truck"
201 (strcat 1 2) ; error: bad argument type
202
203
204
205 
206 File: slisp, Node: streamp, Next: string, Prev: strcat, Up: Xlisp Language Reference
207
208 streamp
209 =======
210
211 streamp
212 type: predicate function (subr)
213 location: built-in
214 source file: xlbfun.c
215 Common LISP compatible: yes
216 supported on: all machines
217
218 SYNTAX
219
220 (streamp <expr> )
221 <expr> - the expression to check
222
223 DESCRIPTION
224
225 The STREAMP predicate checks if an <expr> is a stream. T is
226 returned if <expr> is a stream, NIL is returned otherwise.
227
228 EXAMPLES
229
230 (streamp *standard-input*) ; returns T - stream
231 (streamp *debug-io*) ; returns T - stream
232 (streamp (make-string-output-stream)) ; returns T - stream
233 (setq a *standard-output*) ;
234 (streamp a) ; returns T - evaluates to stream
235 ;
236 (streamp "a") ; returns NIL - string
237 (streamp #\a) ; returns NIL - character
238 (streamp '(a b c)) ; returns NIL - list
239 (streamp 1) ; returns NIL - integer
240 (streamp 1.2) ; returns NIL - float
241 (streamp '*debug-io*) ; returns NIL - symbol
242 (streamp 'a) ; returns NIL - symbol
243 (streamp #(0 1 2)) ; returns NIL - array
244 (streamp NIL) ; returns NIL - NIL
245
246
247
248 
249 File: slisp, Node: string, Next: string/=, Prev: streamp, Up: Xlisp Language Reference
250
251 string
252 ======
253
254 string
255 type: function (subr)
256 location: built-in
257 source file: xlstr.c
258 Common LISP compatible: yes
259 supported on: all machines
260
261 SYNTAX
262
263 (string <expr> )
264 <expr> - a string, symbol or character expression
265
266 DESCRIPTION
267
268 The STRING function forces the <expr> to be a string. If the <expr>
269 is a string, it is returned, as is. If the <expr> is a character, a
270 one-character string is returned. If the <expr> is a symbol, the symbol
271 is turned into a string.
272
273 EXAMPLES
274
275 (string 'foo) ; returns "FOO"
276 (string 'x) ; returns "X"
277 (string "abcdef") ; returns "abcdef"
278 (string #\a) ; returns "a"
279 (string #\A) ; returns "A"
280 (string #\Newline) ; returns "\n"
281
282
283
284 
285 File: slisp, Node: string/=, Next: string<, Prev: string, Up: Xlisp Language Reference
286
287 string/=
288 ========
289
290 string/=
291 type: function (subr)
292 location: built-in
293 source file: xlstr.c
294 Common LISP compatible: yes
295 supported on: all machines
296
297 SYNTAX
298
299 (string/= <string1> <string2> [ <key> <offset> ] ... )
300 <string1> - a string expression
301 <string2> - a string expression
302 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
303 <offset> - an optional integer expression (for a keyword)
304
305 DESCRIPTION
306
307 The STRING/= (string-NOT-EQUAL) function takes two string arguments.
308 A non-NIL value is returned if <string1> is not equal to <string2>,
309 otherwise NIL is returned. The non-NIL value returned is the integer
310 index of the first character of <string1> which is CHAR/= the
311 corresponding character of <string2>. This test is case sensitive - the
312 character #\a is different (and of greater ASCII value) than #\A.
313
314 The keyword arguments allow for accessing substrings within <string1>
315 and <string2>. The keyword arguments each require the keyword (:START1
316 :END1 :START2 :END2) and a single integer expression as a pair with the
317 keyword first and the integer second. The pairs may be in any order.
318 The start keywords specify the starting offset of the substring. A
319 value of 0 starts the string at the beginning (no offset). The end
320 keywords specify the ending offset of the substring. A value of 3 ends
321 the string after the 3rd character (an offset of 3 characters).
322
323 EXAMPLES
324
325 (string/= "a" "b") ; returns 0
326 (string/= "a" "a") ; returns NIL
327 (string/= "a" "A") ; returns 0
328 (string/= "A" "a") ; returns 0
329 (string/= "abc" "abc ") ; returns 3
330 ;
331 (string/= "J Smith" "K Smith" ; strip off the first chars
332 :start1 1 :start2 1) ; returns NIL
333 (string/= "abc" "123456789" ; leave just the first 3 chars
334 :end2 3 :end1 3) ; returns 0
335
336 NOTE: Be sure that the STRING/= function is properly typed in. The
337 '/' is a forward slash. It is possible to mistakenly type a '\'
338 (backslash). This is especially easy because the character mechanism
339 is '#\a'. If you do use the backslash, no error will be reported
340 because backslash is the single escape character and the LISP reader
341 will evaluate 'STRING\=' as 'STRING='. No error will be reported, but
342 the sense of the test is reversed.
343
344
345
346 
347 File: slisp, Node: string<, Next: string<=, Prev: string/=, Up: Xlisp Language Reference
348
349 string<
350 =======
351
352 string<
353 type: function (subr)
354 location: built-in
355 source file: xlstr.c
356 Common LISP compatible: yes
357 supported on: all machines
358
359 SYNTAX
360
361 (string< <string1> <string2> [ <key> <offset> ] ... )
362 <string1> - a string expression
363 <string2> - a string expression
364 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
365 <offset> - an optional integer expression (for a keyword)
366
367 DESCRIPTION
368
369 The STRING< (string-LESS-THAN) function takes two string arguments.
370 A non-NIL value is returned if <string1> is less than <string2> in an
371 ASCII ordering, otherwise NIL is returned. The non-NIL value returned
372 is the integer index of the first character of <string1> which is CHAR<
373 the corresponding character of <string2>. This test is case sensitive -
374 the character #\a is different (and of greater ASCII value) than #\A.
375
376 The keyword arguments allow for accessing substrings within <string1>
377 and <string2>. The keyword arguments each require the keyword (:START1
378 :END1 :START2 :END2) and a single integer expression as a pair with the
379 keyword first and the integer second. The pairs may be in any order.
380 The start keywords specify the starting offset of the substring. A
381 value of 0 starts the string at the beginning (no offset). The end
382 keywords specify the ending offset of the substring. A value of 3 ends
383 the string after the 3rd character (an offset of 3 characters).
384
385 EXAMPLES
386
387 (string< "a" "b") ; returns 0
388 (string< "a" "a") ; returns NIL
389 (string< "a" "A") ; returns NIL
390 (string< "A" "a") ; returns 0
391 (string< "abc" "abc ") ; returns 3
392 (string< "1234567" "1234qrst") ; returns 4
393 ;
394 (string< "J Smith" "K Smith" ; strip off the first chars
395 :start1 1 :start2 1) ; returns NIL
396
397
398
399 
400 File: slisp, Node: string<=, Next: string=, Prev: string<, Up: Xlisp Language Reference
401
402 string<=
403 ========
404
405 string<=
406 type: function (subr)
407 location: built-in
408 source file: xlstr.c
409 Common LISP compatible: yes
410 supported on: all machines
411
412 SYNTAX
413
414 (string<= <string1> <string2> [ <key> <offset> ] ... )
415 <string1> - a string expression
416 <string2> - a string expression
417 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
418 <offset> - an optional integer expression (for a keyword)
419
420 DESCRIPTION
421
422 The STRING<= (string-LESS-THAN-OR-EQUAL) function takes two string
423 arguments. A non-NIL value is returned if <string1> is less than or
424 equal to <string2> in an ASCII ordering, otherwise NIL is returned. The
425 non-NIL value returned is the integer index of the first character of
426 <string1> which is CHAR<= the corresponding character of <string2>.
427 This test is case sensitive - the character #\a is different (and of
428 greater ASCII value) than #\A.
429
430 The keyword arguments allow for accessing substrings within <string1>
431 and <string2>. The keyword arguments each require the keyword (:START1
432 :END1 :START2 :END2) and a single integer expression as a pair with the
433 keyword first and the integer second. The pairs may be in any order.
434 The start keywords specify the starting offset of the substring. A
435 value of 0 starts the string at the beginning (no offset). The end
436 keywords specify the ending offset of the substring. A value of 3 ends
437 the string after the 3rd character (an offset of 3 characters).
438
439 EXAMPLES
440
441 (string<= "a" "b") ; returns 0
442 (string<= "a" "a") ; returns 1
443 (string<= "a" "A") ; returns NIL
444 (string<= "A" "a") ; returns 0
445 (string<= "abc" "abc ") ; returns 3
446 (string<= "1234567" "1234qrst") ; returns 4
447 ;
448 (string<= "J Smith" "K Smith" ; strip off the first chars
449 :start1 1 :start2 1) ; returns 7
450
451
452
453 
454 File: slisp, Node: string=, Next: string>, Prev: string<=, Up: Xlisp Language Reference
455
456 string=
457 =======
458
459 string=
460 type: function (subr)
461 location: built-in
462 source file: xlstr.c
463 Common LISP compatible: yes
464 supported on: all machines
465
466 SYNTAX
467
468 (string= <string1> <string2> [ <key> <offset> ] ... )
469 <string1> - a string expression
470 <string2> - a string expression
471 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
472 <offset> - an optional integer expression (for a keyword)
473
474 DESCRIPTION
475
476 The STRING= (string-EQUALITY) function takes two string arguments.
477 It checks to see if the string arguments have the same values. T is
478 returned if <string1> is equal to <string2>. This test is case
479 sensitive - the character #\a is different (and of greater ASCII value)
480 than #\A.
481
482 The keyword arguments allow for accessing substrings within <string1>
483 and <string2>. The keyword arguments each require the keyword (:START1
484 :END1 :START2 :END2) and a single integer expression as a pair with the
485 keyword first and the integer second. The pairs may be in any order.
486 The start keywords specify the starting offset of the substring. A
487 value of 0 starts the string at the beginning (no offset). The end
488 keywords specify the ending offset of the substring. A value of 3 ends
489 the string after the 3rd character (an offset of 3 characters).
490
491 EXAMPLES
492
493 (string= "a" "b") ; returns NIL
494 (string= "a" "a") ; returns T
495 (string= "a" "A") ; returns NIL
496 (string= "A" "a") ; returns NIL
497 (string= "abc" "abc ") ; returns NIL
498 ;
499 (string= "J Smith" "K Smith" ; strip off the first chars
500 :start1 1 :start2 1) ; returns T
501 (string= "abc" "123456789" ; leave just the first 3 chars
502 :end2 3 :end1 3) ; returns NIL
503
504
505
506 
507 File: slisp, Node: string>, Next: string>=, Prev: string=, Up: Xlisp Language Reference
508
509 string>
510 =======
511
512 string>
513 type: function (subr)
514 location: built-in
515 source file: xlstr.c
516 Common LISP compatible: yes
517 supported on: all machines
518
519 SYNTAX
520
521 (string> <string1> <string2> [ <key> <offset> ] ... )
522 <string1> - a string expression
523 <string2> - a string expression
524 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
525 <offset> - an optional integer expression (for a keyword)
526
527 DESCRIPTION
528
529 The STRING> (string-GREATER-THAN) function takes two string
530 arguments. A non-NIL value is returned if <string1> is greater than
531 <string2> in an ASCII ordering, otherwise NIL is returned. The non-NIL
532 value returned is the integer index of the first character of <string1>
533 which is CHAR> the corresponding character of <string2>. This test is
534 case sensitive - the character #\a is different (and of greater ASCII
535 value) than #\A.
536
537 The keyword arguments allow for accessing substrings within <string1>
538 and <string2>. The keyword arguments each require the keyword (:START1
539 :END1 :START2 :END2) and a single integer expression as a pair with the
540 keyword first and the integer second. The pairs may be in any order.
541 The start keywords specify the starting offset of the substring. A
542 value of 0 starts the string at the beginning (no offset). The end
543 keywords specify the ending offset of the substring. A value of 3 ends
544 the string after the 3rd character (an offset of 3 characters).
545
546 EXAMPLES
547
548 (string> "a" "b") ; returns NIL
549 (string> "a" "a") ; returns NIL
550 (string> "a" "A") ; returns 0
551 (string> "A" "a") ; returns NIL
552 (string> "abc" "abc ") ; returns NIL
553 (string> "1234qrst" "12345678") ; returns 4
554 ;
555 (string> "J Smith" "K Jones" ; strip off the first chars
556 :start1 1 :start2 1) ; returns 2
557
558
559
560 
561 File: slisp, Node: string>=, Next: stringp, Prev: string>, Up: Xlisp Language Reference
562
563 string>=
564 ========
565
566 string>=
567 type: function (subr)
568 location: built-in
569 source file: xlstr.c
570 Common LISP compatible: yes
571 supported on: all machines
572
573 SYNTAX
574
575 (string>= <string1> <string2> [ <key> <offset> ] ... )
576 <string1> - a string expression
577 <string2> - a string expression
578 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
579 <offset> - an optional integer expression (for a keyword)
580
581 DESCRIPTION
582
583 The STRING>= (string-GREATER-THAN-OR-EQUAL) function takes two string
584 arguments. A non-NIL value is returned if <string1> is greater than or
585 equal to <string2> in an ASCII ordering, otherwise NIL is returned. The
586 non-NIL value returned is the integer index of the first character of
587 <string1> which is CHAR>= the corresponding character of <string2>.
588 This test is case sensitive - the character #\a is different (and of
589 greater ASCII value) than #\A.
590
591 The keyword arguments allow for accessing substrings within <string1>
592 and <string2>. The keyword arguments each require the keyword (:START1
593 :END1 :START2 :END2) and a single integer expression as a pair with the
594 keyword first and the integer second. The pairs may be in any order.
595 The start keywords specify the starting offset of the substring. A
596 value of 0 starts the string at the beginning (no offset). The end
597 keywords specify the ending offset of the substring. A value of 3 ends
598 the string after the 3rd character (an offset of 3 characters).
599
600 EXAMPLES
601
602 (string>= "a" "b") ; returns NIL
603 (string>= "a" "a") ; returns 1
604 (string>= "a" "A") ; returns 0
605 (string>= "A" "a") ; returns NIL
606 (string>= "abc" "abc ") ; returns NIL
607 (string>= "1234qrst" "12345678") ; returns 4
608 ;
609 (string>= "J Smith" "K Jones" ; strip off the first chars
610 :start1 1 :start2 1) ; returns 2
611
612
613
614 
615 File: slisp, Node: stringp, Next: string-downcase, Prev: string>=, Up: Xlisp Language Reference
616
617 stringp
618 =======
619
620 stringp
621 type: predicate function (subr)
622 location: built-in
623 source file: xlbfun.c
624 Common LISP compatible: yes
625 supported on: all machines
626
627 SYNTAX
628
629 (stringp <expr> )
630 <expr> - the expression to check
631
632 DESCRIPTION
633
634 The STRINGP predicate checks if an <expr> is a string. T is
635 returned if <expr> is a string, NIL is returned otherwise.
636
637 EXAMPLES
638
639 (stringp "a") ; returns T - string
640 (setq a "hi there" ;
641 (stringp a) ; returns T - evaluates to string
642 ;
643 (stringp #\a) ; returns NIL - character
644 (stringp '(a b c)) ; returns NIL - list
645 (stringp 1) ; returns NIL - integer
646 (stringp 1.2) ; returns NIL - float
647 (stringp 'a) ; returns NIL - symbol
648 (stringp #(0 1 2)) ; returns NIL - array
649 (stringp NIL) ; returns NIL - NIL
650
651
652
653 
654 File: slisp, Node: string-downcase, Next: string-equal, Prev: stringp, Up: Xlisp Language Reference
655
656 string-downcase
657 ===============
658
659 string-downcase
660 type: function (subr)
661 location: built-in
662 source file: xlstr.c
663 Common LISP compatible: yes
664 supported on: all machines
665
666 SYNTAX
667
668 (string-downcase <string> [ { :start | :end } <offset> ] ... )
669 <string> - a string expression
670 <offset> - an optional integer expression (for a keyword)
671
672 DESCRIPTION
673
674 The STRING-DOWNCASE function takes a string argument and returns a
675 new string that has been made lower case.
676
677 The keyword arguments allow for accessing substrings within <string>.
678 The keyword arguments require a keyword (:START or :END) first and a
679 single integer expression second. The :START keyword specifies the
680 starting offset for the STRING-DOWNCASE operation on <string>. A value
681 of 0 starts the string at the beginning (no offset). The :END keyword
682 specifies the end offset for the operation on <string>.
683
684 EXAMPLES
685
686 (string-downcase "ABcd+-12&[") ; returns "abcd+-&["
687 (string-downcase "ABCDEFGH" ;
688 :start 2 :end 4) ; returns "ABcdEFGH"
689 ;
690 (setq mystr "ABcdEFgh") ; set up variable
691 (string-downcase mystr) ; returns "abcdefgh"
692 (print mystr) ; prints "ABcdEFgh"
693
694
695
696 
697 File: slisp, Node: string-equal, Next: string-greaterp, Prev: string-downcase, Up: Xlisp Language Reference
698
699 string-equal
700 ============
701
702 string-equal
703 type: function (subr)
704 location: built-in
705 source file: xlstr.c
706 Common LISP compatible: yes
707 supported on: all machines
708
709 SYNTAX
710
711 (string-equal <string1> <string2> [ <key> <offset> ] ... )
712 <string1> - a string expression
713 <string2> - a string expression
714 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
715 <offset> - an optional integer expression (for a keyword)
716
717 DESCRIPTION
718
719 The STRING-EQUAL function takes two string arguments. It checks to
720 see if the string arguments have the same values. T is returned if
721 <string1> is equal to <string2>. This test is not case sensitive - the
722 character #\a is considered to be the same as #\A.
723
724 The keyword arguments allow for accessing substrings within <string1>
725 and <string2>. The keyword arguments each require the keyword (:START1
726 :END1 :START2 :END2) and a single integer expression as a pair with the
727 keyword first and the integer second. The pairs may be in any order.
728 The start keywords specify the starting offset of the substring. A
729 value of 0 starts the string at the beginning (no offset). The end
730 keywords specify the ending offset of the substring. A value of 3 ends
731 the string after the 3rd character (an offset of 3 characters).
732
733 EXAMPLES
734
735 (string-equal "a" "b") ; returns NIL
736 (string-equal "a" "a") ; returns T
737 (string-equal "a" "A") ; returns T
738 (string-equal "A" "a") ; returns T
739 (string-equal "abc" "abc ") ; returns NIL
740 ;
741 (string-equal "J Smith" "K Smith" ; strip off the first chars
742 :start1 1 :start2 1) ; returns T
743 (string-equal "abc" "123456789" ; leave just the first 3 chars
744 :end2 3 :end1 3) ; returns NIL
745
746 NOTE: The STRING-EQUAL function is listed in the documentation that
747 comes with XLISP as STRING-EQUALP. It functions properly in the XLISP
748 code as STRING-EQUAL.
749
750
751
752 
753 File: slisp, Node: string-greaterp, Next: string-left-trim, Prev: string-equal, Up: Xlisp Language Reference
754
755 string-greaterp
756 ===============
757
758 string-greaterp
759 type: predicate function (subr)
760 location: built-in
761 source file: xlstr.c
762 Common LISP compatible: yes
763 supported on: all machines
764
765 SYNTAX
766
767 (string-greaterp <string1> <string2> [ <key> <offset> ] ... )
768 <string1> - a string expression
769 <string2> - a string expression
770 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
771 <offset> - an optional integer expression (for a keyword)
772
773 DESCRIPTION
774
775 The STRING-GREATERP function takes two string arguments. A non-NIL
776 value is returned if <string1> is greater than <string2> in an ASCII
777 ordering, otherwise NIL is returned. The non-NIL value returned is the
778 integer index of the first character of <string1> which is CHAR-GREATERP
779 the corresponding character of <string2>. This test is not case
780 sensitive - the character #\a is considered to be the same as #\A.
781
782 The keyword arguments allow for accessing substrings within <string1>
783 and <string2>. The keyword arguments each require the keyword (:START1
784 :END1 :START2 :END2) and a single integer expression as a pair with the
785 keyword first and the integer second. The pairs may be in any order.
786 The start keywords specify the starting offset of the substring. A
787 value of 0 starts the string at the beginning (no offset). The end
788 keywords specify the ending offset of the substring. A value of 3 ends
789 the string after the 3rd character (an offset of 3 characters).
790
791 EXAMPLES
792
793 (string-greaterp "a" "b") ; returns NIL
794 (string-greaterp "a" "a") ; returns NIL
795 (string-greaterp "a" "A") ; returns NIL
796 (string-greaterp "A" "a") ; returns NIL
797 (string-greaterp "abc" "abc ") ; returns NIL
798 (string-greaterp "1234qrst" "12345678") ; returns 4
799 ;
800 (string-greaterp "J Smith" "K Jones" ; strip off the first chars
801 :start1 1 :start2 1) ; returns 2
802
803
804
805 
806 File: slisp, Node: string-left-trim, Next: string-lessp, Prev: string-greaterp, Up: Xlisp Language Reference
807
808 string-left-trim
809 ================
810
811 string-left-trim
812 type: function (subr)
813 location: built-in
814 source file: xlstr.c
815 Common LISP compatible: similar
816 supported on: all machines
817
818 SYNTAX
819
820 (string-left-trim <trim-stuff> <string> )
821 <trim-stuff> - a string expression
822 <string> - a string expression
823
824 DESCRIPTION
825
826 The STRING-LEFT-TRIM function takes the <trim-stuff> characters and
827 removes them from the left end of the <string>. The <trim-stuff>
828 characters are an un-ordered set of characters to be removed - so any
829 character that occurs in <trim-stuff> is removed if it appears in left
830 portion of <string>. A new string is created and returned as the result
831 of this function.
832
833 EXAMPLES
834
835 (string-left-trim "." "....foo....") ; returns "foo...."
836 (string-left-trim "<>" "<<<<bar>>>>") ; returns "bar>>>>"
837 (string-left-trim "(.)" "..(12.34)..") ; returns "12.34).."
838
839 COMMON LISP COMPATIBILITY: Common LISP also supports a list of
840 characters as a valid <trim-stuff> argument. An example of this is:
841 (STRING-TRIM '(#\Tab #\Newline) mystring). XLISP does not support this
842 non-string parameter. Porting from XLISP will be no problem, but
843 modifications will be necessary if porting from Common LISP code which
844 uses a list of characters.
845
846
847
848 
849 File: slisp, Node: string-lessp, Next: string-not-equal, Prev: string-left-trim, Up: Xlisp Language Reference
850
851 string-lessp
852 ============
853
854 string-lessp
855 type: predicate function (subr)
856 location: built-in
857 source file: xlstr.c
858 Common LISP compatible: yes
859 supported on: all machines
860
861 SYNTAX
862
863 (string-lessp <string1> <string2> [ <key> <offset> ] ... )
864 <string1> - a string expression
865 <string2> - a string expression
866 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
867 <offset> - an optional integer expression (for a keyword)
868
869 DESCRIPTION
870
871 The STRING-LESSP function takes two string arguments. A non-NIL
872 value is returned if <string1> is less than <string2> in an ASCII
873 ordering, otherwise NIL is returned. The non-NIL value returned is the
874 integer index of the first character of <string1> which is CHAR-LESSP
875 the corresponding character of <string2>. This test is not case
876 sensitive - the character #\a is considered to be the same as #\A.
877
878 The keyword arguments allow for accessing substrings within <string1>
879 and <string2>. The keyword arguments each require the keyword (:START1
880 :END1 :START2 :END2) and a single integer expression as a pair with the
881 keyword first and the integer second. The pairs may be in any order.
882 The start keywords specify the starting offset of the substring. A
883 value of 0 starts the string at the beginning (no offset). The end
884 keywords specify the ending offset of the substring. A value of 3 ends
885 the string after the 3rd character (an offset of 3 characters).
886
887 EXAMPLES
888
889 (string-lessp "a" "b") ; returns 0
890 (string-lessp "a" "a") ; returns NIL
891 (string-lessp "a" "A") ; returns NIL
892 (string-lessp "A" "a") ; returns NIL
893 (string-lessp "abc" "abc ") ; returns 3
894 (string-lessp "1234567" "1234qrst") ; returns 4
895 ;
896 (string-lessp "J Smith" "K Smith" ; strip off the first chars
897 :start1 1 :start2 1) ; returns NIL
898
899
900
901 
902 File: slisp, Node: string-not-equal, Next: string-not-greaterp, Prev: string-lessp, Up: Xlisp Language Reference
903
904 string-not-equal
905 ================
906
907 string-not-equal
908 type: function (subr)
909 location: built-in
910 source file: xlstr.c
911 Common LISP compatible: yes
912 supported on: all machines
913
914 SYNTAX
915
916 (string-not-equal <string1> <string2> [ <key> <offset> ] ... )
917 <string1> - a string expression
918 <string2> - a string expression
919 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
920 <offset> - an optional integer expression (for a keyword)
921
922 DESCRIPTION
923
924 The STRING-NOT-EQUAL function takes two string arguments. A non-NIL
925 value is returned if <string1> is not equal to <string2>, otherwise NIL
926 is returned. The non-NIL value returned is the integer index of the
927 first character of <string1> which is CHAR-NOT-EQUAL the corresponding
928 character of <string2>. This test is not case sensitive - the character
929 #\a is considered to be the same as #\A.
930
931 The keyword arguments allow for accessing substrings within <string1>
932 and <string2>. The keyword arguments each require the keyword (:START1
933 :END1 :START2 :END2) and a single integer expression as a pair with the
934 keyword first and the integer second. The pairs may be in any order.
935 The start keywords specify the starting offset of the substring. A
936 value of 0 starts the string at the beginning (no offset). The end
937 keywords specify the ending offset of the substring. A value of 3 ends
938 the string after the 3rd character (an offset of 3 characters).
939
940 EXAMPLES
941
942 (string-not-equal "a" "b") ; returns 0
943 (string-not-equal "a" "a") ; returns NIL
944 (string-not-equal "a" "A") ; returns NIL
945 (string-not-equal "A" "a") ; returns NIL
946 (string-not-equal "abc" "abc ") ; returns 3
947 ;
948 (string-not-equal "J Smith" "K Smith" ; strip off the first chars
949 :start1 1 :start2 1) ; returns NIL
950 (string-not-equal "abc" "123456789" ; leave just the first 3 chars
951 :end2 3 :end1 3) ; returns 0
952
953 NOTE: The STRING-NOT-EQUAL function is listed in the documentation
954 that comes with XLISP as STRING-NOT-EQUALP. It functions properly in
955 the XLISP code as STRING-NOT-EQUAL.
956
957
958
959 
960 File: slisp, Node: string-not-greaterp, Next: string-not-lessp, Prev: string-not-equal, Up: Xlisp Language Reference
961
962 string-not-greaterp
963 ===================
964
965 string-not-greaterp
966 type: predicate function (subr)
967 location: built-in
968 source file: xlstr.c
969 Common LISP compatible: yes
970 supported on: all machines
971
972 SYNTAX
973
974 (string-not-greaterp <string1> <string2> [ <key> <offset> ] ... )
975 <string1> - a string expression
976 <string2> - a string expression
977 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
978 <offset> - an optional integer expression (for a keyword)
979
980 DESCRIPTION
981
982 The STRING-NOT-GREATERP function takes two string arguments. A
983 non-NIL value is returned if <string1> is less than or equal to
984 <string2> in an ASCII ordering, otherwise NIL is returned. The non-NIL
985 value returned is the integer index of the first character of <string1>
986 which is CHAR-NOT-GREATERP the corresponding character of <string2>.
987 This test is not case sensitive - the character #\a is considered to be
988 the same as #\A.
989
990 The keyword arguments allow for accessing substrings within <string1>
991 and <string2>. The keyword arguments each require the keyword (:START1
992 :END1 :START2 :END2) and a single integer expression as a pair with the
993 keyword first and the integer second. The pairs may be in any order.
994 The start keywords specify the starting offset of the substring. A
995 value of 0 starts the string at the beginning (no offset). The end
996 keywords specify the ending offset of the substring. A value of 3 ends
997 the string after the 3rd character (an offset of 3 characters).
998
999 EXAMPLES
1000
1001 (string-not-greaterp "a" "b") ; returns 0
1002 (string-not-greaterp "b" "a") ; returns NIL
1003 (string-not-greaterp "a" "a") ; returns 1
1004 (string-not-greaterp "a" "A") ; returns 1
1005 (string-not-greaterp "A" "a") ; returns 1
1006 (string-not-greaterp "abc" "abc ") ; returns 3
1007 (string-not-greaterp "12345" "1234qr") ; returns 4
1008 ;
1009 (string-not-greaterp "J Smith" "K Smith"; strip off the first chars
1010 :start1 1 :start2 1) ; returns 7
1011
1012
1013
1014 
1015 File: slisp, Node: string-not-lessp, Next: string-right-trim, Prev: string-not-greaterp, Up: Xlisp Language Reference
1016
1017 string-not-lessp
1018 ================
1019
1020 string-not-lessp
1021 type: predicate function (subr)
1022 location: built-in
1023 source file: xlstr.c
1024 Common LISP compatible: yes
1025 supported on: all machines
1026
1027 SYNTAX
1028
1029 (string-not-lessp <string1> <string2> [ <key> <offset> ] ... )
1030 <string1> - a string expression
1031 <string2> - a string expression
1032 <key> - a keyword (one of :START1 :START2 :END1 :END2 )
1033 <offset> - an optional integer expression (for a keyword)
1034
1035 DESCRIPTION
1036
1037 The STRING-NOT-LESSP function takes two string arguments. A non-NIL
1038 value is returned if <string1> is greater than or equal to <string2> in
1039 an ASCII ordering, otherwise NIL is returned. The non-NIL value
1040 returned is the integer index of the first character of <string1> which
1041 is CHAR-NOT-LESSP the corresponding character of <string2>. This test
1042 is not case sensitive - the character #\a is considered to be the same
1043 as #\A.
1044
1045 The keyword arguments allow for accessing substrings within <string1>
1046 and <string2>. The keyword arguments each require the keyword (:START1
1047 :END1 :START2 :END2) and a single integer expression as a pair with the
1048 keyword first and the integer second. The pairs may be in any order.
1049 The start keywords specify the starting offset of the substring. A
1050 value of 0 starts the string at the beginning (no offset). The end
1051 keywords specify the ending offset of the substring. A value of 3 ends
1052 the string after the 3rd character (an offset of 3 characters).
1053
1054 EXAMPLES
1055
1056 (string-not-lessp "a" "b") ; returns NIL
1057 (string-not-lessp "a" "a") ; returns 1
1058 (string-not-lessp "a" "A") ; returns 1
1059 (string-not-lessp "A" "a") ; returns 1
1060 (string-not-lessp "abc" "abc ") ; returns NIL
1061 (string-not-lessp "1234qr" "123456") ; returns 4
1062 ;
1063 (string-not-lessp "J Smith" "K Jones" ; strip off the first chars
1064 :start1 1 :start2 1) ; returns 2
1065
1066
1067
1068 
1069 File: slisp, Node: string-right-trim, Next: string-trim, Prev: string-not-lessp, Up: Xlisp Language Reference
1070
1071 string-right-trim
1072 =================
1073
1074 string-right-trim
1075 type: function (subr)
1076 location: built-in
1077 source file: xlstr.c
1078 Common LISP compatible: similar
1079 supported on: all machines
1080
1081 SYNTAX
1082
1083 (string-right-trim <trim-stuff> <string> )
1084 <trim-stuff> - a string expression
1085 <string> - a string expression
1086
1087 DESCRIPTION
1088
1089 The STRING-RIGHT-TRIM function takes the <trim-stuff> characters and
1090 removes them from the right end of the <string>. The <trim-stuff>
1091 characters are an un-ordered set of characters to be removed - so any
1092 character that occurs in <trim-stuff> is removed if it appears in right
1093 portion of <string>. A new string is created and returned as the result
1094 of this function.
1095
1096 EXAMPLES
1097
1098 (string-right-trim "." "....foo....") ; returns "....foo"
1099 (string-right-trim "<>" "<<<<bar>>>>") ; returns "<<<<bar"
1100 (string-right-trim "(.)" "..(12.34)..") ; returns "..(12.34"
1101
1102 COMMON LISP COMPATIBILITY: Common LISP also supports a list of
1103 characters as a valid <trim-stuff> argument. An example of this is:
1104 (STRING-TRIM '(#\Tab #\Newline) mystring). XLISP does not support this
1105 non-string parameter. Porting from XLISP will be no problem, but
1106 modifications will be necessary if porting from Common LISP code which
1107 uses a list of characters.
1108
1109
1110
1111 
1112 File: slisp, Node: string-trim, Next: string-upcase, Prev: string-right-trim, Up: Xlisp Language Reference
1113
1114 string-trim
1115 ===========
1116
1117 string-trim
1118 type: function (subr)
1119 location: built-in
1120 source file: xlstr.c
1121 Common LISP compatible: similar
1122 supported on: all machines
1123
1124 SYNTAX
1125
1126 (string-trim <trim-stuff> <string> )
1127 <trim-stuff> - a string expression
1128 <string> - a string expression
1129
1130 DESCRIPTION
1131
1132 The STRING-TRIM function takes the <trim-stuff> characters and
1133 removes them from both ends of the <string>. The <trim-stuff>
1134 characters are an un-ordered set of characters to be removed - so any
1135 character that occurs in <trim-stuff> is removed if it appears in
1136 <string>. A new string is created and returned as the result of this
1137 function.
1138
1139 EXAMPLES
1140
1141 (string-trim "." "....foo....") ; returns "foo"
1142 (string-trim "<>" "<<<<bar>>>>") ; returns "bar"
1143 (string-trim "(.)" "..(12.34)..") ; returns "12.34"
1144
1145 COMMON LISP COMPATIBILITY: Common LISP also supports a list of
1146 characters as a valid <trim-stuff> argument. An example of this is:
1147 (STRING-TRIM '(#\Tab #\Newline) mystring). XLISP does not support this
1148 non-string parameter. Porting from XLISP will be no problem, but
1149 modifications will be necessary if porting from Common LISP code which
1150 uses a list of characters.
1151
1152
1153
1154 
1155 File: slisp, Node: string-upcase, Next: sublis, Prev: string-trim, Up: Xlisp Language Reference
1156
1157 string-upcase
1158 =============
1159
1160 string-upcase
1161 type: function (subr)
1162 location: built-in
1163 source file: xlstr.c
1164 Common LISP compatible: yes
1165 supported on: all machines
1166
1167 SYNTAX
1168
1169 (string-upcase <string> [ { :start | :end } <offset> ] ... )
1170 <string> - a string expression
1171 <offset> - an optional integer expression (for a keyword)
1172
1173 DESCRIPTION
1174
1175 The STRING-UPCASE function takes a string argument and returns a new
1176 string that has been made upper case.
1177
1178 The keyword arguments allow for accessing substrings within <string>.
1179 The keyword arguments require a keyword (:START or :END) first and a
1180 single integer expression second. The :START keyword specifies the
1181 starting offset for the STRING-UPCASE operation on <string>. A value of
1182 0 starts the string at the beginning (no offset). The :END keyword
1183 specifies the end offset for the operation on <string>.
1184
1185 EXAMPLES
1186
1187 (string-upcase "ABcd+-12&[") ; returns "ABCD+-&["
1188 (string-upcase "abcdefgh" ;
1189 :start 2 :end 4) ; returns "abCDefgh"
1190 ;
1191 (setq mystr "ABcdEFgh") ; set up variable
1192 (string-upcase mystr) ; returns "ABCDEFGH"
1193 (print mystr) ; prints "ABcdEFgh"
1194
1195
1196
1197 
1198 File: slisp, Node: sublis, Next: subseq, Prev: string-upcase, Up: Xlisp Language Reference
1199
1200 sublis
1201 ======
1202
1203 sublis
1204 type: function (subr)
1205 location: built-in
1206 source file: xllist.c
1207 Common LISP compatible: similar
1208 supported on: all machines
1209
1210 SYNTAX
1211
1212 (sublis <a-list> <expr> [ { :test | :test-not } <test> ] )
1213 <expr> - the expression to substitute within - an atom
1214 or list
1215 <a-list> - the association list to search
1216 <test> - optional test function (default is EQL)
1217
1218 DESCRIPTION
1219
1220 SUBLIS searches through an <expr> and replaces each of the elements
1221 in the <expr> that match the CAR of the elements of the association list
1222 <a-list> with the CDR of elements of the <a-list>. The <expr> with the
1223 substitutions (if any) is returned. You may specify your own test with
1224 the :TEST and :TEST-NOT keywords followed by the test you which to
1225 perform. The SUBLIS function is normally used with a dotted pair (A .
1226 B) association list. It is possible to use a normal list pair (A B) or
1227 a list of the form (A (B C)).
1228
1229 EXAMPLES
1230
1231 (sublis '( (a . b)) '(a a)) ; returns (B B)
1232 (sublis '( (a b)) '(a a)) ; returns ((B) (B))
1233 (sublis '( (a (b c))) '(a a)) ; returns (((B C)) ((B C)))
1234 ;
1235 (setq newlist '( (a . 1) ; set up an association list
1236 (b . 2) ;
1237 (c . 3) )) ;
1238 (sublis newlist '(a b c d e f b a c)) ; returns (1 2 3 D E F 2 1 3)
1239 (sublis newlist 'a) ; returns 1
1240 ;
1241 (setq mylist '((a my-a) (b his-b) ; set up a non-dotted pair
1242 (c her-c) (d end))) ; assoc list
1243 (sublis mylist '(a b c d e f g)) ; returns ((MY-A) (HIS-B)
1244 ; (HER-C) (END) E F G)
1245 (sublis mylist 'a) ; returns (MY-A)
1246 ;
1247 (setq numlist '((1 . a) (2 . b)) ) ; set up a new assoc list
1248 (defun mytest (x y) (princ ": ") ; set up my own test function
1249 (princ x) ; with 2 parameters
1250 (princ " ") ; to see what SUBLIS does
1251 (princ y) (terpri) ;
1252 T) ; always return TRUE
1253 (sublis numlist '(3 1) :test mytest) ; prints : (3 1) 1
1254 ; returns A
1255 ; because the entire list
1256 ; succeeds with the test
1257 ; and so (1 . A) produces
1258 ; the returned value
1259 (sublis numlist '(1) :test-not mytest) ; prints : (1) 1
1260 ; : (1) 2
1261 ; : 1 1
1262 ; : 1 2
1263 ; : NIL 1
1264 ; : NIL 2
1265 ; returns (1)
1266 ; because SUBLIS tried to
1267 ; match every list/sublist
1268 ; against each entry in the
1269 ; assoc. list and failed
1270 ; because of the :TEST-NOT
1271 ; and so returned the
1272 ; original list unaltered
1273
1274 NOTE: The SUBLIS function can work with a list or string as the
1275 <expr>. However, the default EQL test does not work with lists or
1276 strings, only symbols and numbers. To make this work, you need to use
1277 the :TEST keyword along with EQUAL for <test>.
1278
1279 COMMON LISP COMPATIBILITY: Common LISP supports the use of the :KEY
1280 keyword which specifies a function that is applied to each element of
1281 <a-list> before it is tested. XLISP does not support this.
1282
1283
1284

brinkley@uw.edu
ViewVC Help
Powered by ViewVC 1.1.26