Yes :pre should apply to every recur, like usual without :post.

user=> ((fn [a] {:pre [(number? a)]} (recur 'a)) 1)
AssertionError Assert failed: (number? a)  user/eval5376/fn--5377
(form-init687485383035947214.clj:1)

That probably means that if :post is present, the preconditions should be
moved inside the inner loop instead.

I can see how destructuring makes this a little tricky.

Thanks,
Ambrose


On Sat, Jul 26, 2014 at 6:27 AM, Steve Miner <stevemi...@gmail.com> wrote:

> My first patch was buggy with destructured args so I had to withdraw it.
>
> While working on a better patch, I came up against a related issue: Should
> the :pre conditions apply to every recur "call". I'm saying no.  The :pre
> conditions should be checked just once on the initial function call and
> never during a recur. Any other opinions?
>
> On Jul 25, 2014, at 10:57 AM, Steve Miner <stevemi...@gmail.com> wrote:
>
> > Ticket CLJ-1475 with my patch.
> >
> > http://dev.clojure.org/jira/browse/CLJ-1475
>
> --
> 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