|
1 | 1 | # internal, do not use |
2 | | -($ __replace_all_placeholders_with (replacement x ...xs) { |
| 2 | +(macro __replace_all_placeholders_with (replacement x ...xs) { |
3 | 3 | ($if (empty? xs) |
4 | 4 | ($if (= "_" ($repr x)) |
5 | 5 | replacement |
|
12 | 12 | x |
13 | 13 | (__replace_all_placeholders_with replacement ...xs) })) }) |
14 | 14 |
|
15 | | -($ -> (arg fn1 ...fns) { |
| 15 | +(macro -> (arg fn1 ...fns) { |
16 | 16 | ($if (= "Symbol" ($type fn1)) |
17 | | - ($ call (fn1 arg)) |
18 | | - ($ call ((__replace_all_placeholders_with arg ...fn1)))) |
| 17 | + (macro call (fn1 arg)) |
| 18 | + (macro call ((__replace_all_placeholders_with arg ...fn1)))) |
19 | 19 | ($if (> (len fns) 0) |
20 | 20 | (-> call ...fns) |
21 | 21 | call) }) |
22 | 22 |
|
23 | 23 | # internal, do not use |
24 | | -($ __suffix-dup (sym x) { |
| 24 | +(macro __suffix-dup (sym x) { |
25 | 25 | ($if (> x 1) (__suffix-dup sym (- x 1))) |
26 | 26 | ($symcat sym x) }) |
27 | 27 |
|
28 | | -($ partial (func ...defargs) { |
29 | | - ($ bloc (__suffix-dup a (- ($argcount func) (len defargs)))) |
| 28 | +(macro partial (func ...defargs) { |
| 29 | + (macro bloc (__suffix-dup a (- ($argcount func) (len defargs)))) |
30 | 30 | (fun (bloc) (func ...defargs bloc)) |
31 | 31 | ($undef bloc) }) |
32 | 32 |
|
33 | | -($ __count_placeholders (acc x ...xs) ($if (empty? xs) |
| 33 | +(macro __count_placeholders (acc x ...xs) ($if (empty? xs) |
34 | 34 | ($if (= "_" ($repr x)) |
35 | 35 | (+ 1 acc) |
36 | 36 | acc) |
37 | 37 | ($if (= "_" ($repr x)) |
38 | 38 | (__count_placeholders (+ 1 acc) ...xs) |
39 | 39 | (__count_placeholders acc ...xs)))) |
40 | 40 |
|
41 | | -($ __replace_placeholders (replacements x ...xs) { |
| 41 | +(macro __replace_placeholders (replacements x ...xs) { |
42 | 42 | ($if (empty? xs) |
43 | 43 | ($if (= "_" ($repr x)) |
44 | 44 | (head replacements) |
|
52 | 52 |
|
53 | 53 | (__replace_placeholders replacements ...xs) })) }) |
54 | 54 |
|
55 | | -($ partial2 (call ...args) { |
56 | | - ($ length (__count_placeholders 0 ...args)) |
57 | | - ($ arg_bloc (__suffix-dup arg length)) |
58 | | - ($ all_args (__replace_placeholders [arg_bloc] ...args)) |
| 55 | +(macro partial2 (call ...args) { |
| 56 | + (macro length (__count_placeholders 0 ...args)) |
| 57 | + (macro arg_bloc (__suffix-dup arg length)) |
| 58 | + (macro all_args (__replace_placeholders [arg_bloc] ...args)) |
59 | 59 | (fun (arg_bloc) (call all_args)) }) |
60 | 60 |
|
61 | | -($ unless (cond ...body) |
| 61 | +(macro unless (cond ...body) |
62 | 62 | (if (not cond) ...body)) |
63 | 63 |
|
64 | | -($ until (cond body) |
| 64 | +(macro until (cond body) |
65 | 65 | (while (not cond) body)) |
0 commit comments