An alternative implementation that shuffles all printable characters. This 
version returns the encryption map and generalizes the encrypt/decrypt 
functionality.

https://gist.github.com/SegFaultAX/5754209

On Tuesday, August 12, 2008 10:25:00 PM UTC-7, Joubert Nel wrote:
>
> Hello, 
>
> I have a hash map, and want to derive another map from it but with the 
> key/value pairs swapped. 
>
> To do this, I wrote: 
>
> (def *reverseMap* (loop [result (hash-map) 
>                          keys (keys *myMap*)] 
>                     (if (== (count keys) 0) 
>                       result 
>                       (recur (merge result (hash-map (val (find *myMap* 
> (first 
> keys))) 
>                                                      (first keys))) 
>                              (rest keys))))) 
>
>
> It works fine, but I suspect there is a better way. 
> Any suggestions? 
>
> Joubert

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to