Created
April 9, 2018 20:52
-
-
Save Gaivile/5df140eb996674ce7140ce3b709d62b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; 59 | |
(fn [& args] | |
(fn [& coll] (for [fun args] | |
(map fun coll)))) | |
( | |
(fn [& fns] | |
(let [result (fn [& coll] | |
(for [fun fns | |
:let [r (map fun coll)]] | |
) | |
)])) | |
2 3 5 1 6 4) | |
((fn [& fns] | |
(let [result (fn [& coll] | |
(for [fun fns | |
:let [r (map fun coll)]] | |
r) | |
)] | |
result)) | |
2 3 4 5 6 1) | |
(defn not-juxt [& fns] | |
(let [result | |
(fn [& coll] | |
(for [fun fns | |
:let [r (comp (partial fun))]] | |
r) | |
)] | |
result)) | |
((not-juxt + max min) 2 3 4 5 6 1) | |
((not-juxt + max min) 1 2 3) | |
(defn fun | |
[& fns] | |
(let [result (fn [& coll] | |
(doseq [f fns] | |
(partial f)))] | |
)) | |
(map #(apply % [1 2 3 4]) [+ max min] ) | |
((fn [& fns] (fn [& coll] (map #(apply % coll) [fns]))) 1 2 3 4 5 6) | |
;; (loop [i [+ max min]] | |
;; (println (partial i)) | |
;; (recur (rest i))) | |
( | |
(not-juxt + max) 2 3 4) | |
( | |
(fn [& args] | |
(doseq [] (map + args) | |
(max args) | |
(min args))) 2 3 4 5) | |
(max 2 3 4 5) | |
(= [21 6 1] ((fn [& fns] | |
(fn [& coll] | |
(map ( #(apply % coll) fns)) + max min) 2 3 5 1 6 4))) | |
(= ["HELLO" 5] ((__ #(.toUpperCase %) count) "hello")) | |
(= [2 6 4] ((__ :a :c :b) {:a 2, :b 4, :c 6, :d 8 :e 10})) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; 70 | |
((fn [s] (sort-by clojure.string/lower-case (set (re-seq #"[a-zA-Z0-9|']+" s))) "Have a nice day.") | |
(clojure.string/split "asdsadf sdfsdf sdfsd" #" ") | |
(fn [s] (sort-by clojure.string/lower-case (clojure.string/split s #" "))) | |
((fn [s] (sort-by str (set (clojure.string/split s #" ")))) "Have a nice day.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment