On Aug 9, 2:09 pm, Alan <a...@malloys.org> wrote:
> Hi all, I'm new to the group

Welcome!

> I wanted to define a ring function, which takes as input
> N objects, and returns a hash table mapping object N to object N+1
> (mod N). I intended to use this to describe a compass object:
> (ring :w :n :e :s) should result in {:w :n, :n :e, :e :s, :s :w}.

Here's a quick way that seems pretty close to your original:

user> (def x [:w :n :e :s])
#'user/x

user> (zipmap x (rest (cycle x)))
{:s :w, :e :s, :n :e, :w :n}

- Jeff

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

Reply via email to