summaryrefslogtreecommitdiff
path: root/src/lisp/test.lisp
blob: 2482fdf6afa810c43ca2a9f037f66b1cf2ecb203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
(in-module "clojure")

(defn f0 ())

(defn f1 (x) x)

(defn f2 (x y) y)

(defn f5 (a b c d e) (d e) (f1 a))


(defn* f01
       (())
       ((x) x))

(defn fa (x)
      (.foo x))

(defn fk (x)
      (:foo x))

(defn fl (a b c)
      (let ((d (let ((x a))
                 x)))
        d)
      (let ((e c))
        e))

(defn fl* (a b c)
      (let* ((d b)
             (e d))
        e))

(defn always (x)
      (fn () x))

(defn fletfn (x)
      (letfn ((a (b) b)
              (c (d) (a d))
              (d (x) (d a)))
             (c x)))


(defn fif (a b x y z)
      (if a
           (if (if x y z)
               0
             z)
         b))

(defn fr (a b & c) c)

(defn fnot (x y z)
      (if (not x)
          (not y)
        (not z)))

(defn forf (x y z)
      (if (or x y)
          x
        (or x y z)))


(defn fand (x y z)
      (if (and x y)
          x
        (and x y z)))

(defn fset (x y z)
      (set x 1)
      (set b #\y)
      (if (set (:foo x) z)
          (set (.bar y) z)
        (set (foo x y) z)))

(defn fdo (a b c)
      (do ((a b a)
           (b c b))
          (c)
        a b c)
      (do ((a b a)
           (b c b))
          (c b)
        a b c))

(defn fg (x)
      y)

(defn ftry (x)
      (try
       (foo x)
       nil
       (bar x))
      (try
       (let ((ex x))
         (try
          (foo x 2)
          (fred ex "string")
          (bar x)))
       (foo x)
       (fred ex)
       (bar x))
      (try
       (foo x)
       (fred ex)
       (bar x)
       "foo"))

(defn fbind (a b c x)
      (bind ((x t)
             (y 17))
            c)
      (bind ((x nil)
             (y b))
            c))

(defn fq (x)
      (if ':key '.foo 'a))

(defn fql ()
      '(1 2 3 (4 5)))

(defn fcast ()
      (if (int 7) (char 17) (long 29999)))