Generally when you are calling functions that have (and depend on) 
side-effects, you will end up using "do" a lot.  Also, I noticed that in 
your example there's really no reason to make the x and y bindings part of 
the loop.

I haven't tried this code but I think it's along the lines of what you want:

(loop []
  (do
    (a-function)
    (let [y (another-function)]
      (... code that uses y ...))
    (recur)))

On Monday, February 11, 2013 11:25:23 PM UTC-8, George Oliver wrote:
>
> hi, 
>
> I have a loop that looks like this, 
>
> (loop
>   [x (a-function)
>    y (another-function)] ; another-function must be called after a-function
>   (....) ; x is not used in body
>   (recur (a-function) (another-function)))
>
> This gets the job done (my a-function is a select() call which I don't use 
> the return value of in the body), but it feels a little hacky so I'm 
> wondering what's a better way?
>
>

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