summaryrefslogtreecommitdiffstats
path: root/tests/012/quasi.tl
blob: 1cb245781edd30dfbf3fcb48bcc829317b02f5b6 (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
(load "../common")

(test
  (mapcar (ap (op (ret `@@@1-@@@rest`))) '((a b) (c d) (e f)))
  ("a-b" "c-d" "e-f"))

(test
  (let ((a "abc") (b 123))
    `@{b 12} @{b -12} @{a [0] 3} @{a [0..2] -5}`)
  "123                   123 a      ab")

(test
  (let ((a "abc") (b 123))
    [(ret `@1-@2-@@1-@@2-@{@1 -4}-@{@2 -4}`) a b])
  "abc-123-abc-123- abc- 123")

(test
  [(ret `@1-@rest`) 1 2 3 4]
  "1-2 3 4")

(test
  [(ret `@1-@@rest`) 1 2 3 4]
  "1-2 3 4")

(test
  [(ret [(ret `@1 @rest @@1 @@rest @@@rest @@@1`) 1 10]) 2 20]
  "1 10 1 10 20 2")

(test
  (let ((s))
    (mapcar (ret `@(push (inc @1) s)`) (range 0 2)))
  ("1" "2 1" "3 2 1"))

(test
  (symacrolet ((d "-"))
    (let ((s))
      (mapcar (ret `<@{(push (inc @1) s) d}>`) (range 0 2))))
  ("<1>" "<2-1>" "<3-2-1>"))

(test
  (symacrolet ((two 2))
    `@{two}abc`)
  "2abc")

(test
  (macrolet ((two () 2))
    `@(two)abc`)
  "2abc")

(compile-only
  (eval-only
    (compile-file (base-name *load-path*) "temp.tlo")
    (remove-path "temp.tlo")))