Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 25
- #(filter odd? %)
- 39
- #(mapcat vector %1 %2)
- Mapcat function can take a collection of number
- ?44
- (fn [i nums]
- (take (count nums)
- (drop (mod i (count nums))
- (cycle nums)))
- (fn [i nums]
- (if (pos? nums)
- (drop (count nums)
- else
- (take (mod i(count nums))
- /* if statement is good way for this problem, and I tried, but it does not work.*/
- /*classnote
- (take 3 (range 10))
- (drop 3 (range 10))
- (concat (drop 3 (range 10)) (take 3 (range 10))
- */
- 45
- [1 4 7 10 13]
- 1, 1+3, 4+3, 7+3, 10+3
- 48
- 6
- 50
- (comp vals (partial group-by type))
- /*comp: Take a set of functions and reaturns a fn that is the composition.
- partial: Takes a function f and fewer than the normal arguments to f, and
- returns a fn that takes a variable number of additional args.
- group-by: Make group by argument.
- type: This is argument
- This separete by group-by function with type.
- */
- 51
- (range 1 6)
- 61
- #(apply hash-map (interleave %1 %2))
- /*apply hash-map: Return a new has map with suupplied mapping
- interleave: Return seq of the first item in each coll, then return 2nd coll...*/
- /*Connect %1 and %2 content by interleave function.
- 81
- (fn [x y] (set(filter #(contains? x %) y)))
- /*set: returns a set of the distinct elements of coll
- contains?: Checking y have content of x */
- /*define x and y. filter and contain fucntion check overlap content in x and y.*/
- 90
- (fn [x y] (set (for [z x v y ] [z v])))
- /*Using for that making conbination of x and y.*/
- 107
- (fn [x]
- (fn [y]
- (apply * (repeat x y)))
- )
- /*define x and y. repeat y x times. Apply multiply.*/
- /*Question
- What hash-map is doing?
- hash map convert the list to map
- What set function is doing?
- set convert the list to set stuff.
- */
- /*
- (defn my-sum [&args]
- if (empty? args)
- 0
- (+ (first args)
- (apply my-sum (rest args))))
- */
- /*((comp f g) x)
- = (f (g x))
- (->7 inc double double inc)
- 7+1=8 8*2=16 16*2 =32 32+1=33
- */
Add Comment
Please, Sign In to add comment