Implement CaseSensitiveQuery #39

Merged
Felisp merged 12 commits from CaseSensitiveQuery into stable 2024-09-24 02:07:26 +02:00
Showing only changes of commit 454643675f - Show all commits

View file

@ -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