Two thoughts:

1. Use an atom.

2. Use loop instead of doseq, so you can maintain a bit of state as you go.

-kt

On Saturday, July 15, 2017 at 6:18:10 PM UTC-4, Kevin Kleinfelter wrote:
>
> How does one detect a change in a doseq?  
>
> I'm trying to do what data processing people would call a control break in 
> a report.  I'm printing account + fund names.  My data is sorted by 
> account, so each row has a new fund, and accounts change less frequently. 
>  I'd like to print a separator line when account changes.  In a procedural 
> language, I'd set up an old-account variable, and I'd print the separator 
> line when account != old-account.
>
>     (doseq [h list-of-account-fund-pairs]
>       (let [account (first h)
>             fund (second h)
> *        (if changed-account)*
>             (println "-----------")
>         (println account fund)
>
> Thanks!
>

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