Probably a reduce is more appropriate.

(reduce
  (fn [x a]
    (your-compare-expression x a)  ; the result of this expr is the result
of the fn and will be 'x' for the next iteration
    )
  0 b)


BTW, a let to bind an atom outside your do-seq, while _not recommended_,
should work.  We would have to see your code to know why it didn't for
you.  Show you code if you're curious, but please don't actually do it this
way.



On Tue, Mar 3, 2015 at 10:26 PM, noobcoder <kely...@gmail.com> wrote:

> Hi,
> I have the following code structure
>
> (do-seq [a b]
>     .
>     .
>     .
> )
>
> For each a in b, I want to check a particular value in a, store it and
> compare it with the same value in next a. If it is same I want to clear it
> before next a. I tried to define an x (atom 0) by having a let outside of
> the do-seq. I can successfully compare the value of the atom and reset it,
> but when I get the second a the atom value is again 0. How do I go about
> this?
>
> --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to