Fork me on GitHub
#specter
<
2016-09-14
>
levitanong12:09:11

Is there any way to transform keys of hashmaps to booleans without filtering out falses?

codonnell13:09:13

@levitanong Not sure exactly what behavior you want. Could you give an example?

levitanong16:09:19

@codonnell given the following dataset:

(def data {1 {“false” 11 “true” 12} 2 {“false” 21 “true” 22}})
I want to turn the strings to proper booleans.
(transform [ALL LAST ALL FIRST]
  boolean
  data)
However, instead of
(def data {1 {false 11 true 12} 2 {false 21 true 22}})
I get
(def data {1 {true 12} 2 {true 22}})
So I’m assuming transform automatically removes falsy values or keys.

nathanmarz16:09:48

@levitanong (boolean "false") returns true

nathanmarz16:09:00

I think you want to make a parse-boolean-string function