Hello all,

I have the code below:

(def data
  '(a b c c b a))

(for [value data] (hash-map "id" (.indexOf data value) "value" value))

That gives me the output:

({"value" a, "id" 0} {"value" b, "id" 1} {"value" c, "id" 2} {"value" c,
"id" 0} {"value" b, "id" 1} {"value" a, "id" 2})

but I need the following output:

({"value" a, "id" 0} {"value" b, "id" 1} {"value" c, "id" 2} {"value" c,
"id" *3*} {"value" b, "id" *4*} {"value" a, "id" *5*})

When using ".indexOf" I can't manage to work with values that repeats. Any
tips?

thank. Christian.

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