Re: Clojure 1.5.1 head holding

2013-07-01 Thread Kevin Downey
On 7/1/13 3:49 AM, Gerrard McNulty wrote: > Suppose I had code like: > > ((fn [rs] (take-last 3 rs)) (range 2000)) > > This seems to run fine with no head holding. But if I write something like: > > (defn- log [f] > (println "start") > (f) > (println "end")) > > ((fn [rs] (log #(take

Re: Clojure 1.5.1 head holding

2013-07-01 Thread Gerrard McNulty
Hi Meikel, That works for me too. I can use that when I control the definition of that function. However sometimes I don't e.g. when I use with-redefs, which calls with-redefs-fn. On Monday, July 1, 2013 12:23:34 PM UTC+1, Meikel Brandmeyer (kotarak) wrote: > > Hi, > > I did a slight variati

Re: Clojure 1.5.1 head holding

2013-07-01 Thread Meikel Brandmeyer (kotarak)
Hi, I did a slight variation which does not close over the head and it seems to work fine. (defn log [f & args] (println "start") (apply f args) (println "stop")) ((fn [xs] (log take-last 3 xs)) (range 2)) Kind regards Meikel -- -- You received this message because you are s

Clojure 1.5.1 head holding

2013-07-01 Thread Gerrard McNulty
Suppose I had code like: ((fn [rs] (take-last 3 rs)) (range 2000)) This seems to run fine with no head holding. But if I write something like: (defn- log [f] (println "start") (f) (println "end")) ((fn [rs] (log #(take-last 3 rs))) (range 2000)) Then this seems to hold on to the