File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 1
- ($ -> (arg fn1 ...fn) {
2
- ($if (> (len fn) 0)
3
- (-> (fn1 arg) ...fn)
4
- (fn1 arg)) })
1
+ # internal, do not use
2
+ ($ __replace_all_placeholders_with (replacement x ...xs) {
3
+ ($if (empty? xs)
4
+ ($if (= "_" ($repr x))
5
+ replacement
6
+ x)
7
+ ($if (= "_" ($repr x))
8
+ {
9
+ replacement
10
+ (__replace_all_placeholders_with replacement ...xs) }
11
+ {
12
+ x
13
+ (__replace_all_placeholders_with replacement ...xs) })) })
14
+
15
+ ($ -> (arg fn1 ...fns) {
16
+ ($if (= "Symbol" ($type fn1))
17
+ ($ call (fn1 arg))
18
+ ($ call ((__replace_all_placeholders_with arg ...fn1))))
19
+ ($if (> (len fns) 0)
20
+ (-> call ...fns)
21
+ call) })
5
22
6
23
# internal, do not use
7
24
($ __suffix-dup (sym x) {
40
57
($ arg_bloc (__suffix-dup arg length))
41
58
($ all_args (__replace_placeholders [arg_bloc] ...args))
42
59
(fun (arg_bloc) (call all_args)) })
60
+
61
+ ($ unless (cond body)
62
+ (if (not cond) body))
63
+
64
+ ($ until (cond body)
65
+ (while (not cond) body))
Original file line number Diff line number Diff line change 7
7
(+ data "-f2")))
8
8
(let f3 (fun (data)
9
9
(+ data "-f3")))
10
+ (let apply (fun (data f)
11
+ (f data)))
10
12
11
13
(let test_func (fun (a b c) (* a b c)))
12
14
(let test_func1 (partial test_func 1))
16
18
(test:suite macros {
17
19
(test:eq (-> "f0" f1) "f0-f1")
18
20
(test:eq (-> "f0" f1 f2 f3) "f0-f1-f2-f3")
21
+ (test:eq (-> "f0" f1 (apply _ f2) (apply _ f3)) "f0-f1-f2-f3")
19
22
20
23
(test:eq (test_func1 2 3) 6)
21
24
(test:eq ($argcount test_func1) 2)
You can’t perform that action at this time.
0 commit comments