Add juxt
This commit is contained in:
parent
369b994c74
commit
2e87284987
@ -298,6 +298,13 @@
|
|||||||
"Return true if x is an iterator"
|
"Return true if x is an iterator"
|
||||||
(isinstance x collections.Iterator))
|
(isinstance x collections.Iterator))
|
||||||
|
|
||||||
|
(defn juxt [f &rest fs]
|
||||||
|
"Return a function that apply a set of functions to same arguments and
|
||||||
|
collect the result into a list."
|
||||||
|
(setv fs (cons f fs))
|
||||||
|
(fn [&rest args &kwargs kwargs]
|
||||||
|
(list-comp (apply f args kwargs) [f fs])))
|
||||||
|
|
||||||
(defn last [coll]
|
(defn last [coll]
|
||||||
"Return last item from `coll`"
|
"Return last item from `coll`"
|
||||||
(get (tuple coll) -1))
|
(get (tuple coll) -1))
|
||||||
@ -483,8 +490,8 @@
|
|||||||
disassemble drop drop-last drop-while empty? even? every? first filter
|
disassemble drop drop-last drop-while empty? even? every? first filter
|
||||||
flatten float? fraction gensym group-by identity inc input instance?
|
flatten float? fraction gensym group-by identity inc input instance?
|
||||||
integer integer? integer-char? interleave interpose islice iterable?
|
integer integer? integer-char? interleave interpose islice iterable?
|
||||||
iterate iterator? keyword keyword? last list* macroexpand macroexpand-1
|
iterate iterator? juxt keyword keyword? last list* macroexpand
|
||||||
map merge-with multicombinations name neg? none? nth numeric? odd?
|
macroexpand-1 map merge-with multicombinations name neg? none? nth
|
||||||
partition permutations pos? product range read read-str remove repeat
|
numeric? odd? partition permutations pos? product range read read-str
|
||||||
repeatedly rest reduce second some string string? symbol? take take-nth
|
remove repeat repeatedly rest reduce second some string string? symbol?
|
||||||
take-while xor tee zero? zip zip-longest])
|
take take-nth take-while xor tee zero? zip zip-longest])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user