js-on-sx: js-apply-fn unwraps __callable__ before invoking
This commit is contained in:
@@ -58,29 +58,32 @@
|
|||||||
js-apply-fn
|
js-apply-fn
|
||||||
(fn
|
(fn
|
||||||
(fn-val args)
|
(fn-val args)
|
||||||
(cond
|
(let
|
||||||
((= (len args) 0) (fn-val))
|
((callable (if (and (dict? fn-val) (contains? (keys fn-val) "__callable__")) (get fn-val "__callable__") fn-val)))
|
||||||
((= (len args) 1) (fn-val (nth args 0)))
|
(cond
|
||||||
((= (len args) 2) (fn-val (nth args 0) (nth args 1)))
|
((= (len args) 0) (callable))
|
||||||
((= (len args) 3) (fn-val (nth args 0) (nth args 1) (nth args 2)))
|
((= (len args) 1) (callable (nth args 0)))
|
||||||
((= (len args) 4)
|
((= (len args) 2) (callable (nth args 0) (nth args 1)))
|
||||||
(fn-val (nth args 0) (nth args 1) (nth args 2) (nth args 3)))
|
((= (len args) 3)
|
||||||
((= (len args) 5)
|
(callable (nth args 0) (nth args 1) (nth args 2)))
|
||||||
(fn-val
|
((= (len args) 4)
|
||||||
(nth args 0)
|
(callable (nth args 0) (nth args 1) (nth args 2) (nth args 3)))
|
||||||
(nth args 1)
|
((= (len args) 5)
|
||||||
(nth args 2)
|
(callable
|
||||||
(nth args 3)
|
(nth args 0)
|
||||||
(nth args 4)))
|
(nth args 1)
|
||||||
((= (len args) 6)
|
(nth args 2)
|
||||||
(fn-val
|
(nth args 3)
|
||||||
(nth args 0)
|
(nth args 4)))
|
||||||
(nth args 1)
|
((= (len args) 6)
|
||||||
(nth args 2)
|
(callable
|
||||||
(nth args 3)
|
(nth args 0)
|
||||||
(nth args 4)
|
(nth args 1)
|
||||||
(nth args 5)))
|
(nth args 2)
|
||||||
(else (apply fn-val args)))))
|
(nth args 3)
|
||||||
|
(nth args 4)
|
||||||
|
(nth args 5)))
|
||||||
|
(else (apply callable args))))))
|
||||||
|
|
||||||
;; Minimal string->number for the slice. Handles integers, negatives,
|
;; Minimal string->number for the slice. Handles integers, negatives,
|
||||||
;; and simple decimals. Returns 0 on malformed input.
|
;; and simple decimals. Returns 0 on malformed input.
|
||||||
|
|||||||
Reference in New Issue
Block a user