On this page:
alphorder
atom
eq
eql
eqlablep
equal
identity
lexorder
caar
cdar
cadr
cddr
caaar
cdaar
cadar
cddar
caadr
cdadr
caddr
cdddr
caaaar
cdaaar
cadaar
cddaar
caadar
cdadar
caddar
cdddar
caaadr
cdaadr
cadadr
cddadr
caaddr
cdaddr
cadddr
cddddr
quote
quasiquote
unquote
subst
Version: 4.1
2.4.11 Trees

(alphorder x y)  t

  x : (atom x)

  y : (atom y)

Determines if x is lexicographically less than y. Works on any atomic input.

Examples:

  > (alphorder 6 4)

  ()

  > (alphorder 4 6)

  t

  > (alphorder 4 4)

  t

  > (alphorder "abc" "bcd")

  t

  > (alphorder "bcd" "abc")

  ()

  > (alphorder #\a "a")

  t

  > (alphorder "a" #\a)

  ()

  > (alphorder '(1 2 3) '(4 5 6))

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> atom? atom? any) on here; expected <atom?>,

  given: (1 2 3)

(atom x)  t

  x : t

Returns true if x is not a cons pair.

Examples:

  > (atom 4)

  t

  > (atom 'hello)

  t

  > (atom (cons 4 nil))

  ()

(eq x y)  t

  x : t

  y : (or (symbolp x) (symbolp y))

Tests two symbols for equality.

Examples:

  > (eq 'yes 'yes)

  t

  > (eq 'yes 'no)

  ()

  > (eq "yes" "yes")

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (->r ((x ...) (y ...)) ...) on here; expected

  <symbolp>, given: "yes"

(eql x y)  t

  x : t

  y : (or (eqlablep x) (eqlablep y))

Tests equality of two numbers, symbols, or characters.

Examples:

  > (eql 'yes 'yes)

  t

  > (eql 'yes 'no)

  ()

  > (eql 5 5)

  t

  > (eql #\a #\b)

  ()

  > (eql #\5 5)

  ()

  > (eql "yes" "yes")

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (->r ((x ...) (y ...)) ...) on here; expected

  <eqlablep>, given: "yes"

(eqlablep x)  t

  x : t

Returns t if and only if x is either a number, a symbol, or a character.

Examples:

  > (eqlablep nil)

  t

  > (eqlablep 4)

  t

  > (eqlablep #\a)

  t

  > (eqlablep 'symbol)

  t

  > (eqlablep "string")

  ()

(equal x y)

Tests x and y for equality. Returns t if and only if they are the same value.

Examples:

  > (equal "yes" "yes")

  t

  > (equal 'yes "no")

  ()

  > (equal 'yes "yes")

  ()

(identity x)  t

  x : t

The identity function. Returns its argument unchanged.

Examples:

  > (identity 'x)

  x

(lexorder a b)  t

  a : t

  b : t

Determines if the two given items are in lexicographic order.

Examples:

  > (lexorder 6 4)

  ()

  > (lexorder 4 6)

  t

  > (lexorder #\a #\b)

  t

  > (lexorder #\b #\a)

  ()

  > (lexorder 'a 'b)

  t

  > (lexorder 'b 'a)

  ()

  > (lexorder "abc" "bcd")

  t

  > (lexorder "bcd" "abc")

  ()

  > (lexorder (list 1 2) (list 3 4))

  t

  > (lexorder (list 3 4) (list 1 2))

  ()

(caar x)

(cdar x)

(cadr x)

(cddr x)

(caaar x)

(cdaar x)

(cadar x)

(cddar x)

(caadr x)

(cdadr x)

(caddr x)

(cdddr x)

(caaaar x)

(cdaaar x)

(cadaar x)

(cddaar x)

(caadar x)

(cdadar x)

(caddar x)

(cdddar x)

(caaadr x)

(cdaadr x)

(cadadr x)

(cddadr x)

(caaddr x)

(cdaddr x)

(cadddr x)

(cddddr x)

Shorthand macros for compositions of car and cdr. For instance, (caddr x) is equivalent to (car (cdr (cdr x))).

Examples:

  > (defconst *tree*

      (cons (cons (cons (cons 0 1) (cons 2 3))

                  (cons (cons 4 5) (cons 6 7)))

            (cons (cons (cons 8 9) (cons 10 11))

                  (cons (cons 12 13) (cons 14 15)))))

  > (caar *tree*)

  ((0 . 1) 2 . 3)

  > (cdar *tree*)

  ((4 . 5) 6 . 7)

  > (cadr *tree*)

  ((8 . 9) 10 . 11)

  > (cddr *tree*)

  ((12 . 13) 14 . 15)

  > (caaar *tree*)

  (0 . 1)

  > (cdaar *tree*)

  (2 . 3)

  > (cadar *tree*)

  (4 . 5)

  > (cddar *tree*)

  (6 . 7)

  > (caadr *tree*)

  (8 . 9)

  > (cdadr *tree*)

  (10 . 11)

  > (caddr *tree*)

  (12 . 13)

  > (cdddr *tree*)

  (14 . 15)

  > (caaaar *tree*)

  0

  > (cdaaar *tree*)

  1

  > (cadaar *tree*)

  2

  > (cddaar *tree*)

  3

  > (caadar *tree*)

  4

  > (cdadar *tree*)

  5

  > (caddar *tree*)

  6

  > (cdddar *tree*)

  7

  > (caaadr *tree*)

  8

  > (cdaadr *tree*)

  9

  > (cadadr *tree*)

  10

  > (cddadr *tree*)

  11

  > (caaddr *tree*)

  12

  > (cdaddr *tree*)

  13

  > (cadddr *tree*)

  14

  > (cddddr *tree*)

  15

(quote ...)

Examples:

  > 'a

  a

  > '(1 2 3 4)

  (1 2 3 4)

(quasiquote ...)

Examples:

  > `a

  a

  > `(1 2 3 4)

  (1 2 3 4)

(unquote ...)

Examples:

  > '(list ,a  b c d)

  (list ,a b c d)

(subst new old tree)  t

  new : t

  old : (eqlablep old)

  tree : t

Substitutes every occurrence of old with new in the given tree. Uses eql as the test.

Examples:

  > (subst 2 1 (list 1 1 1 3 1 1 1))

  (2 2 2 3 2 2 2)

  > (subst 'z 'a (list 'a 'b (list 'd 'a (list 'a 'e)) 'a))

  (z b (d z (z e)) z)