home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / util / edit / jade / man / jade.info-4 (.txt) < prev    next >
GNU Info File  |  1994-10-16  |  50KB  |  1,074 lines

  1. This is Info file jade.info, produced by Makeinfo-1.55 from the input
  2. file jade.texi.
  3. START-INFO-DIR-ENTRY
  4. * Jade: (jade).            An editor for X11 and AmigaDOS
  5. END-INFO-DIR-ENTRY
  6.    This is Edition 1.3, last updated 7 October 1994, of `The Jade
  7. Manual', for Jade, Version 3.2.
  8.    Jade is a text editor for X11 (on Unix) and the Amiga.
  9.    Copyright 1993, 1994 John Harper.
  10.    Permission is granted to make and distribute verbatim copies of this
  11. manual provided the copyright notice and this permission notice are
  12. preserved on all copies.
  13.    Permission is granted to copy and distribute modified versions of
  14. this manual under the conditions for verbatim copying, provided that
  15. the entire resulting derived work is distributed under the terms of a
  16. permission notice identical to this one.
  17. File: jade.info,  Node: Characters,  Prev: Numeric Predicates,  Up: Numbers
  18. Characters
  19. ----------
  20.    In Jade characters are stored in integers. Their read syntax is a
  21. question mark followed by the character itself which may be an escape
  22. sequence introduced by a backslash. For details of the available escape
  23. sequences see *Note Strings::.
  24.      ?a
  25.          => 97
  26.      
  27.      ?\n
  28.          => 10
  29.      
  30.      ?\177
  31.          => 127
  32.  - Function: alpha-char-p CHARACTER
  33.      This function returns `t' when CHARACTER is one of the alphabetic
  34.      characters.
  35.           (alpha-char-p ?a)
  36.               => t
  37.  - Function: upper-case-p CHARACTER
  38.      When CHARACTER is one of the upper-case characters this function
  39.      returns `t'.
  40.  - Function: lower-case-p CHARACTER
  41.      Returns `t' when CHARACTER is lower-case.
  42.  - Function: digit-char-p CHARACTER
  43.      This function returns `t' when CHARACTER is one of the decimal
  44.      digit characters.
  45.  - Function: alphanumericp CHARACTER
  46.      This function returns `t' when CHARACTER is either an alphabetic
  47.      character or a decimal digit character.
  48.  - Function: space-char-p CHARACTER
  49.      Returns `t' when CHARACTER is a white-space character (space, tab,
  50.      newline or form feed).
  51.  - Function: char-upcase CHARACTER
  52.      This function returns the upper-case equivalent of CHARACTER. If
  53.      CHARACTER is already upper-case or has no upper-case equivalent it
  54.      is returned unchanged.
  55.           (char-upcase ?a)
  56.               => 65                       ;`A'
  57.           
  58.           (char-upcase ?A)
  59.               => 65                       ;`A'
  60.           
  61.           (char-upcase ?!)
  62.               => 33                       ;`!'
  63.  - Function: char-downcase CHARACTER
  64.      Returns the lower-case equivalent of the character CHARACTER.
  65. File: jade.info,  Node: Sequences,  Next: Symbols,  Prev: Numbers,  Up: Programming Jade
  66. Sequences
  67. =========
  68.    Sequences are ordered groups of objects, there are several primitive
  69. types which can be considered sequences, each with its own good and bad
  70. points.
  71.    A sequence is either an array or a list, where an array is either a
  72. vector or a string.
  73.  - Function: sequencep OBJECT
  74.      This function returns `t' if OBJECT is a sequence, `nil' otherwise.
  75. * Menu:
  76. * Cons Cells::                  An ordered pair of two objects
  77. * Lists::                       Chains of cons cells
  78. * Vectors::                     A chunk of memory holding a number of objects
  79. * Strings::                     Strings are efficiently-stored vectors
  80. * Array Functions::             Accessing elements in vectors and strings
  81. * Sequence Functions::          These work on any type of sequence
  82. File: jade.info,  Node: Cons Cells,  Next: Lists,  Up: Sequences
  83. Cons Cells
  84. ----------
  85.    A "cons cell" is an ordered pair of two objects, the "car" and the
  86. "cdr".
  87.    The read syntax of a cons cell is an opening parenthesis followed by
  88. the read syntax of the car, a dot, the read syntax of the cdr and a
  89. closing parenthesis. For example a cons cell with a car of 10 and a cdr
  90. of the string `foo' would be written as,
  91.      (10 . "foo")
  92.  - Function: cons CAR CDR
  93.      This function creates a new cons cell. It will have a car of CAR
  94.      and a cdr of CDR.
  95.           (cons 10 "foo")
  96.               => (10 . "foo")
  97.  - Function: consp OBJECT
  98.      This function returns `t' if OBJECT is a cons cell and `nil'
  99.      otherwise.
  100.           (consp '(1 . 2))
  101.               => t
  102.           
  103.           (consp nil)
  104.               => nil
  105.           
  106.           (consp (cons 1 2))
  107.               => t
  108.    In Lisp an "atom" is any object which is not a cons cell (and is,
  109. therefore, atomic).
  110.  - Function: atom OBJECT
  111.      Returns `t' if OBJECT is an atom (not a cons cell).
  112.    Given a cons cell there are a number of operations which can be
  113. performed on it.
  114.  - Function: car CONS-CELL
  115.      This function returns the object which the car of the cons cell
  116.      CONS-CELL.
  117.           (car (cons 1 2))
  118.               => 1
  119.           
  120.           (car '(1 . 2))
  121.               => 1
  122.  - Function: cdr CONS-CELL
  123.      This function returns the cdr of the cons cell CONS-CELL.
  124.           (cdr (cons 1 2))
  125.               => 2
  126.           
  127.           (cdr '(1 . 2))
  128.               => 2
  129.  - Function: rplaca CONS-CELL NEW-CAR
  130.      This function sets the value of the car in the cons cell CONS-CELL
  131.      to NEW-CAR. The value returned is NEW-CAR.
  132.           (setq x (cons 1 2))
  133.               => (1 . 2)
  134.           (rplaca x 3)
  135.               => 3
  136.           x
  137.               => (3 . 2)
  138.  - Function: rplacd CONS-CELL NEW-CDR
  139.      This function is similar to `rplacd' except that the cdr slot of
  140.      CONS-CELL is modified.
  141. File: jade.info,  Node: Lists,  Next: Vectors,  Prev: Cons Cells,  Up: Sequences
  142. Lists
  143. -----
  144.    A list is a sequence of zero or more objects, the main difference
  145. between lists and vectors is that lists are more dynamic: they can
  146. change size, be split, reversed, concatenated, etc... very easily.
  147.    In Lisp lists are not a primitive type; instead singly-linked lists
  148. are created by chaining cons cells together (*note Cons Cells::.).
  149.  - Function: listp OBJECT
  150.      This functions returns `t' when its argument, OBJECT, is a list
  151.      (i.e. either a cons cell or `nil').
  152. * Menu:
  153. * List Structure::              How lists are built from cons cells
  154. * Building Lists::              Dynamically creating lists
  155. * Accessing List Elements::     Getting at the elements which make the list
  156. * Modifying Lists::             How to alter the contents of a list
  157. * Association Lists::           Lists can represent relations
  158. * Infinite Lists::              Circular data structures in Lisp
  159. File: jade.info,  Node: List Structure,  Next: Building Lists,  Up: Lists
  160. List Structure
  161. ..............
  162.    Each element in a list is given its own cons cell and stored in the
  163. car of that cell. The list object is then constructed by making the cdr
  164. of a cell contain the cons cell of the next element (and hence the
  165. whole tail of the list). The cdr of the cell containing the last
  166. element in the list is `nil'. A list of zero elements is represented by
  167. the symbol `nil'.
  168.    The read syntax of a list is an opening parenthesis, followed by the
  169. read syntax of zero or more space-separated objects, followed by a
  170. closing parenthesis. Alternatively, lists can be constructed `manually'
  171. using dotted-pair notation.
  172.    All of the following examples result in the same list of five
  173. elements: the numbers from zero to four.
  174.      (0 1 2 3 4)
  175.      
  176.      (0 . (1 . (2 . (3 . (4 . nil)))))
  177.      
  178.      (0 1 2 . (3 4))
  179.    An easy way to visualise lists and how they are constructed is to
  180. see each cons cell in the list as a separate "box" with pointers to its
  181. car and cdr,
  182.      +-----+-----+
  183.      |  o  |  o----> cdr
  184.      +--|--+-----+
  185.         |
  186.          --> car
  187.    Complex box-diagrams can now be drawn to represent lists. For
  188. example the following diagram represents the list `(1 2 3 4)'.
  189.      +-----+-----+   +-----+-----+   +-----+-----+   +-----+-----+
  190.      |  o  |  o----> |  o  |  o----> |  o  |  o----> |  o  |  o----> nil
  191.      +--|--+-----+   +--|--+-----+   +--|--+-----+   +--|--+-----+
  192.         |               |               |               |
  193.          --> 1           --> 2           --> 3           --> 4
  194.    A more complex example, the list `((1 2) (foo bar))' can be drawn as,
  195.      +-----+-----+                          +-----+-----+
  196.      |  o  |  o---------------------------> |  o  |  o----> nil
  197.      +--|--+-----+