1
0
mirror of https://github.com/janet-lang/janet synced 2024-09-28 15:08:40 +00:00

Make comp create variadic functions.

This commit is contained in:
Calvin Rose 2019-08-03 13:57:11 -05:00
parent b18f1e8127
commit 6caf8d3d56

View File

@ -494,9 +494,9 @@
(case (length functions) (case (length functions)
0 nil 0 nil
1 (get functions 0) 1 (get functions 0)
2 (let [[f g] functions] (fn [x] (f (g x)))) 2 (let [[f g] functions] (fn [& x] (f (g ;x))))
3 (let [[f g h] functions] (fn [x] (f (g (h x))))) 3 (let [[f g h] functions] (fn [& x] (f (g (h ;x)))))
4 (let [[f g h i] functions] (fn [x] (f (g (h (i x)))))) 4 (let [[f g h i] functions] (fn [& x] (f (g (h (i ;x))))))
(let [[f g h i j] functions] (let [[f g h i j] functions]
(comp (fn [x] (f (g (h (i (j x)))))) (comp (fn [x] (f (g (h (i (j x))))))
;(tuple/slice functions 5 -1))))) ;(tuple/slice functions 5 -1)))))