home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-08-07 | 2.7 KB | 56 lines | [TEXT/CCL ] |
- Reader Examples
- foo -> bar means the reader
- returns bar when it reads
- the char sequence "foo"
- Use FRED c-x-c-r to see what a text region reads to.
- See Common Lisp the Language, Chapter 22 for details.
- -------------------------
- foo -> FOO ;creates a symbol with print name "FOO"
- b\ar -> BaR ;creates a symbol, does not upper case the char following \
- a|bc|d -> AbcD ; creates a symbol. Does not upper case chars between
- vertcal bars
- 2/3 -> the ratio two thirds.
- "ab" -> "ab" ;creates a string which characters a and b
- (a) -> (A) ;creates a list with element A
- (a . b) -> (CONS A B)
- 'foo -> (QUOTE foo)
- `foo -> (QUOTE foo) ;called "BACKQUOTE". In this use, same as QUOTE
- `(,a b) -> (LIST A (QUOTE B)) ; A will get evaled by eval, but B won't
- `(,@c d) -> (APPEND C (QUOTE (D))) ; assumes that C evals to a list,
- each element of which will appear in the list whose last
- element is D.
- Ex: (setq c '(1 2)) then `(,@c d) evals to (1 2 D)
- ; junk -> comment ; everything between semicolon and newline is a comment
- #| junk |# -> comment ;everything between the delimiters is a comment
- #1=(#1#) -> a list which has as itself as its only member.
- DANGEROUS! Printing a circular list may never finish.
- #'foo -> (function foo) ;use instead of 'foo when passing a function as an arg.
- #(a b) -> creates a simple vector with the elements A and B.
- #*101 -> creates a bit vector with bit elements 1, 0, and 1.
- #,(+ 2 3) -> 5 ; evaluates the form after comma at read and load time.
- #.(+ 2 3) -> 5 ; evaluates the form after comma at read and compile time.
- #+foo a -> A if the symbol FOO is in the *features* list, else ignore.
- #-foo a -> A if the symbol FOO is NOT in the *features* list, else ignore.
- #:foo -> FOO ; creates a symbol with print name "FOO" but does not intern it.
- #<foo -> Errors by design. ;use for printed representations which can't be
- read back in.
- #\a -> the character a .
- #\A -> the character A .
- #\return -> the RETURN character
- Use "Char Set" item under the Help menu for other character names.
-
- #b101 -> 5 ;treats 101 as a binary number
- #o101 -> 65 ;treats 101 as an octal number
- #x101 -> 257 ;treats 101 as a hexidecimal number
- #3r101 -> 10 ;treats 101 as a base 3 number.
- #c(1 2) -> complex number with real part 1 and imaginary part 2
-
- #2a((0 1 2) (10 11 12)) -> a 2-d array with 3 elements in each array
- initialized to the [non-evaled] elements in the lists.
- #s(ship x 1 y (+ 2 3)) -> a structure of class SHIP with slot x initialized to 1
- and slot y initialized to 5. Slot values should not depend
- on lexical variables.
- SHIP must have been previously defstructed.
-
-
-