Because the compiler is upset that it doesn't know what n is. r is a long, but n is ???. The following works:
(defn ^:static fact [^long n] (loop [n n r 1] (if (zero? n) r (recur (dec n) (* r n))))) Or see Dnolen's version above. But yeah, I wish that it still worked, because it used to work just fine. Rob On Jun 19, 8:22 pm, Mike Meyer <mwm-keyword-googlegroups. 620...@mired.org> wrote: > "Rob Lachlan" <robertlach...@gmail.com> wrote: > >Actually, Mike, your two functions work just fine. (Equal branch). > >Mind you I checked that out over two hours ago, so this information > >might be out of date. > > >Rob > > >On Jun 19, 6:59 pm, Mike Meyer <mwm-keyword-googlegroups. > > Ok, why does this work but the fact fail? Or does the fact example still fail > on that build? > > The fact that this requires explanation is a pretty good argument the fact > behavior. > > >> (defn count-in [value col] > >> (loop [value value col col res 0] > >> (if (empty? col) > >> res > >> (recur value (rest col) (if (= (first col) value) (inc res) > >> res))))) > > >> (defn ones-n-zeros [vectors] > >> (loop [vectors vectors m-zeros 0 m-ones 0] > >> (if (empty? vectors) > >> [m-zeros m-ones] > >> (let [data (first vectors) > >> zeros (count-in 0 data) > >> ones (count-in 1 data)] > >> (recur (rest vectors) (if (> zeros ones) (inc m-zeros) m-zeros) > >> (if (> ones zeros) (inc m-ones) > >> m-ones)))))) > > -- > Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- 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