Browse files

naive function to convert records to maps

This function only operates on the first layer of 
the record. If there are nested structures then they
have to be pulled out by hand, calling this funciton
again with the specified value
  • Loading branch information...
1 parent e9ce447 commit a566e18b3f00ad1cb0826eda520a535c2cc26740 @videlalvaro committed Aug 19, 2010
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/closerl/core.clj
@@ -94,6 +94,11 @@
[{a, 1}, {b, 2}, {c, 3}] or {{a, 1}, {b, 2}, {c, 3}} in Erlang will become:
{:a 1, :b 2, :c 3}"
(reduce (fn [my-map my-value] (assoc my-map (keyword (first my-value)) (second my-value))) {} pl))
+(defn from-record [r]
+ (let [k (keyword (first r))
+ v (proplist-to-map (second r))]
+ {k v}))
(defn otp-node
"Creates an OtpNode"

0 comments on commit a566e18

Please sign in to comment.