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

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 variation

Simultaneous use of the same dynamic binding

2012-05-30 Thread Gerrard McNulty
I see a lot of clojure libraries use the pattern where an implicit variable is stored as a dynamic variable. A good example is clojure.java.jdbc: (require '[clojure.java.jdbc :as sql]) (sql/with-connection db-spec sql code here) What do I do if I have to instantiate two things that uses the

Head holding issue

2011-11-27 Thread Gerrard McNulty
Hi, I have the following code that I'm trying to use to split a sequence of strings into files of approx. x-size (defn split-file ([path strs split-size] (loop [ss (seq strs), part 0] (when-let [more (split-file path ss split-size part)] (recur more (inc part) ([path

Clojure 1.3 head holding bug

2011-11-27 Thread Gerrard McNulty
Hi, I've a head holding problem that I believe is a bug in clojure 1.3. I wrote the following function to split a a lazy seq of strings across files of x size: (defn split-file ([path strs size] (trampoline split-file path (seq strs) size 0)) ([path strs size part] (with-open [f