Implement CaseSensitiveQuery #39
1 changed files with 18 additions and 1 deletions
|
@ -47,6 +47,11 @@
|
|||
~x
|
||||
result#)))
|
||||
|
||||
(defmacro vectorize
|
||||
"If arg is not a vector, put into vector, otherwise return it"
|
||||
[v]
|
||||
(if (vector? v) v [v]))
|
||||
|
||||
;; ===== Generic functions ====
|
||||
|
||||
(defn indices
|
||||
|
@ -71,13 +76,25 @@
|
|||
|
||||
(defn fmap
|
||||
"Applies function [f] to every key and value in map [m]
|
||||
Function signature should be (f [key value])."
|
||||
Function signature should be (f [key value]).
|
||||
Key stays unchanged"
|
||||
[f m]
|
||||
(into
|
||||
(empty m)
|
||||
(for [[key val] m]
|
||||
[key (f key val)])))
|
||||
|
||||
(defn fkmap
|
||||
;; I am horrible with docstrings, I don't deny that
|
||||
"Applies function [f] to every key and value in map [m]
|
||||
Function signature should be (f [key value]).
|
||||
Unlike fmap, you can change key too, so return both {key value} in map"
|
||||
[f m]
|
||||
(into
|
||||
(empty m)
|
||||
(for [[key val] m]
|
||||
(f key val))))
|
||||
|
||||
(defn expand-home
|
||||
"Expands ~ to home directory"
|
||||
;;modified from sauce: https://stackoverflow.com/questions/29585928/how-to-substitute-path-to-home-for
|
||||
|
|
Loading…
Reference in a new issue