Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/cljs/cljs/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4462,7 +4462,11 @@ reduces them without incurring seq initialization"

(defn constantly
"Returns a function that takes any number of arguments and returns x."
[x] (fn [& args] x))
[x] (fn
([] x)
([_] x)
([_ _] x)
([_ _ & args] x)))

(defn comp
"Takes a set of functions and returns a fn that is the composition
Expand Down
11 changes: 8 additions & 3 deletions src/test/cljs/cljs/other_functions_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@
(deftest test-constantly
(let [c0 (constantly 10)]
(are [x] (= 10 (c0 x))
nil
42
"foo")))
nil
42
"foo")
(are [x] (= 10 (c0 x :a :b :c))
nil
42
"foo")))

;juxt

(deftest test-juxt
Expand Down
Loading