Yield implementation
Hi, I know that it is not a lispy way, but most of us come from imperative Java world, and if there is anyone who needs python/ruby yield here it is: http://bit.ly/ejQrLl and the example usage is: http://bit.ly/ekBHr0 Cheers, Olek -- 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
Ordering of defn's?
I'm new to Lisps in general, and very new to Clojure. When I was trying out CL, I could put my "defun/defn"s in any order in the file, and it would load and run fine in the REPL. However, in Clojure, it seems to be much more C/C++-like and I have to define things before I use them in other defns. Is this... correct? Or is it just a limitation of the IDEs I've been trying out? E.g., it seems like I have to define "sum" before I can define "average". -- 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
Transforming map entries
I'm hoping this is a dumb question and I've missed something obvious. I have a map with various key-value pairs and I want to transform some of the values, e.g. (def mymap {:first "john" :last "smith" :age 25}) and say I want to change the strings to be upper case. Right now all I can think of doing is using reduce and passing in an empty map and the re-associating each key with the (possibly) transformed value. Is there something like the map function that takes two parameters, one a function that receives a pair and returns a new pair, and the other a map, and returns a map that's reconstituted from those pairs? Thanks -- 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
Re: Ordering of defn's?
Hi Jonathan, welcome to Clojure. Yes, you have to define or declare things before you refer to them. It sounds like you already know how to define things. To declare things, use the declare macro. Cheers, Bill Smith On Feb 22, 12:05 am, Jonathan Mitchem wrote: > I'm new to Lisps in general, and very new to Clojure. > > When I was trying out CL, I could put my "defun/defn"s in any order in > the file, and it would load and run fine in the REPL. However, in > Clojure, it seems to be much more C/C++-like and I have to define > things before I use them in other defns. > > Is this... correct? Or is it just a limitation of the IDEs I've been > trying out? > > E.g., it seems like I have to define "sum" before I can define > "average". -- 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
Re: Is there an on-going running service
Although a while loop does work here, it's just a hack to get the desired behavior. Have you considered using a scheduled thread pool as your controller? For example: (def ^{:private true} pool (atom nil)) (def ^{:private true} num-threads 3) (defn- thread-pool [] (swap! pool (fn [p] (or p (ScheduledThreadPoolExecutor. num-threads) (defn schedule-periodic "Schedules function f to run every 'delay' milliseconds after an initial delay of 'initial-delay'." [f initial-delay delay] (.scheduleWithFixedDelay (thread-pool) (protect-from-exceptions f) initial-delay delay TimeUnit/MILLISECONDS)) (defn run-always [] (schedule-periodic dosomething 0 60)) This is a simple example that lacks general robustness around error handling, but provides a clean way to continuously run things. You can also provide a clean shutdown a la: (defn shutdown "Terminates all periodic tasks." [] (swap! pool (fn [p] (when p (.shutdown p) Hope this helps, Aaron Bedra -- Clojure/core http://clojure.com On 02/21/2011 06:35 PM, Brent Millare wrote: Seems to work for me. Are you putting something valid in (do something)? Also if you want to watch files in a directory, there is JNotify, which might be useful to you. On Feb 21, 5:19 pm, clj123 wrote: Hello, I'm looking for an on-going service that runs and processes files in a certain location. This function should be contiously running. The function that I've used, it always running and when files are place it does something with it. (defn run-always [] (while true (dosomething))) However, it throws an exception: Expression failed: (run-always) I'm not sure why it's throwing it, and is there a better way to handle this kind of service? Thanks. -- Cheers, Aaron Bedra -- Clojure/core http://clojure.com -- 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
Re: Transforming map entries
Hi, I thought update-in could help but it looks as complicated as your solution: (use 'clojure.contrib.string) (loop [m mymap, ks (keys m)] (let [new-m (update-in m [(first ks)] #(if (string? %) (upper-case %) %)) more (rest ks)] (if-not (empty? more) (recur new-m more) new-m))) I'm a total newbie so I may also miss an obvious and more simple solution. 2011/2/21 yair > I'm hoping this is a dumb question and I've missed something obvious. > I have a map with various key-value pairs and I want to transform some > of the values, e.g. > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > change the strings to be upper case. > Right now all I can think of doing is using reduce and passing in an > empty map and the re-associating each key with the (possibly) > transformed value. Is there something like the map function that > takes two parameters, one a function that receives a pair and returns > a new pair, and the other a map, and returns a map that's > reconstituted from those pairs? > > Thanks > > -- > 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 -- Damien Lepage http://damienlepage.com -- 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
Re: Transforming map entries
The usual intuitive options for this are reduce, zipmap, or into. You can also write a lazily recursive solution. I wonder why there's no function in core that lazily re-constructs the map with the results of the function? It seems to have been discussed on the list at least once or twice. It seems like there would have to be two versions of it, one expecting a function with an arity of one (for just the value) and another expecting an arity of two (key and value). On Mon, Feb 21, 2011 at 10:08 PM, yair wrote: > I'm hoping this is a dumb question and I've missed something obvious. > I have a map with various key-value pairs and I want to transform some > of the values, e.g. > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > change the strings to be upper case. > Right now all I can think of doing is using reduce and passing in an > empty map and the re-associating each key with the (possibly) > transformed value. Is there something like the map function that > takes two parameters, one a function that receives a pair and returns > a new pair, and the other a map, and returns a map that's > reconstituted from those pairs? > > Thanks > > -- > 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 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
Re: Transforming map entries
You can use map to get your new sequence of pairs, the turn it into a hash-map using into, (->> {:first "john" :last "smith" :age 25} (map #(let [[k v] %] (if (string? v) [k (.toUpperCase v)] [k v]))) (into {})) Best, -- Nurullah Akkaya http://nakkaya.com On Tuesday, February 22, 2011 at 5:08 AM, yair wrote: > I'm hoping this is a dumb question and I've missed something obvious. > I have a map with various key-value pairs and I want to transform some > of the values, e.g. > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > change the strings to be upper case. > Right now all I can think of doing is using reduce and passing in an > empty map and the re-associating each key with the (possibly) > transformed value. Is there something like the map function that > takes two parameters, one a function that receives a pair and returns > a new pair, and the other a map, and returns a map that's > reconstituted from those pairs? > > Thanks > > -- > 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 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
Re: Transforming map entries
I can't think of anything core, but (let [f #(. % toUpperCase)] (zipmap (keys skills) (map f (vals skills doesn't seem too bad. On Feb 21, 8:08 pm, yair wrote: > I'm hoping this is a dumb question and I've missed something obvious. > I have a map with various key-value pairs and I want to transform some > of the values, e.g. > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > change the strings to be upper case. > Right now all I can think of doing is using reduce and passing in an > empty map and the re-associating each key with the (possibly) > transformed value. Is there something like the map function that > takes two parameters, one a function that receives a pair and returns > a new pair, and the other a map, and returns a map that's > reconstituted from those pairs? > > Thanks -- 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
Re: Ordering of defn's?
On Feb 21, 10:05 pm, Jonathan Mitchem wrote: > I'm new to Lisps in general, and very new to Clojure. > > When I was trying out CL, I could put my "defun/defn"s in any order in > the file, and it would load and run fine in the REPL. However, in > Clojure, it seems to be much more C/C++-like and I have to define > things before I use them in other defns. > > Is this... correct? Or is it just a limitation of the IDEs I've been > trying out? > > E.g., it seems like I have to define "sum" before I can define > "average". Yes, this is the way things are. If you want to get around it, you can (declare sum), and there are various macros available if you want to go more whole-hog and declare things in reverse order. For example: (defmacro do-top-down [& forms] (cons 'do (reverse forms))) (do-top-down (defn average [& args] (/ (sum args) (count args))) (defn sum [& args] (reduce + args))) -- 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
Re: Ordering of defn's?
This is true. But you "declare" lets you throw out all the names you need to at the beginning to avoid circular definitions and the like. eg. (declare sum) (defn average [coll] (/ (sum coll) (count coll))) (defn sum [coll] (apply + coll)) On Feb 21, 11:05 pm, Jonathan Mitchem wrote: > I'm new to Lisps in general, and very new to Clojure. > > When I was trying out CL, I could put my "defun/defn"s in any order in > the file, and it would load and run fine in the REPL. However, in > Clojure, it seems to be much more C/C++-like and I have to define > things before I use them in other defns. > > Is this... correct? Or is it just a limitation of the IDEs I've been > trying out? > > E.g., it seems like I have to define "sum" before I can define > "average". -- 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
Re: Transforming map entries
On Feb 22, 3:23 pm, rob levy wrote: > The usual intuitive options for this are reduce, zipmap, or into. You can > also write a lazily recursive solution. I wonder why there's no function in > core that lazily re-constructs the map with the results of the function? It > seems to have been discussed on the list at least once or twice. It seems > like there would have to be two versions of it, one expecting a function > with an arity of one (for just the value) and another expecting an arity of > two (key and value). Maps aren't lazy. They would be seqs if they were lazy, and not have fast lookup by key. clojure.contrib.generic.functor/fmap updates values, and clojure.walk/ walk (and maybe post-walk) can do what you're looking for with pairs: user=> (walk (fn [[k v]] [v k]) identity {:a 1 :b 2}) {1 :a, 2 :b} -- 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
Re: Transforming map entries
Another idea I had is something like this: (hashmap (flatten (map #(...) oldmap))), since calling map on a map returns a sequence of whatever the function returns, but this isn't the neatest solution either... On Feb 23, 10:23 am, rob levy wrote: > The usual intuitive options for this are reduce, zipmap, or into. You can > also write a lazily recursive solution. I wonder why there's no function in > core that lazily re-constructs the map with the results of the function? It > seems to have been discussed on the list at least once or twice. It seems > like there would have to be two versions of it, one expecting a function > with an arity of one (for just the value) and another expecting an arity of > two (key and value). > > > > > > > > On Mon, Feb 21, 2011 at 10:08 PM, yair wrote: > > I'm hoping this is a dumb question and I've missed something obvious. > > I have a map with various key-value pairs and I want to transform some > > of the values, e.g. > > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > > change the strings to be upper case. > > Right now all I can think of doing is using reduce and passing in an > > empty map and the re-associating each key with the (possibly) > > transformed value. Is there something like the map function that > > takes two parameters, one a function that receives a pair and returns > > a new pair, and the other a map, and returns a map that's > > reconstituted from those pairs? > > > Thanks > > > -- > > 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 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
Re: Transforming map entries
There is fmap from clojure.contrib.generic.functor, which expects a function of arity 1, for just the value: (use 'clojure.contrib.generic.functor) (require '[clojure.string :as str]) (def my-map {:first "john" :last "smith" :age 25}) (defn my-fn [value] (if (string? value) (str/upper-case value) value)) user=> (fmap my-fn my-map) {:first "JOHN", :last "SMITH", :age 25} On Feb 22, 4:23 pm, rob levy wrote: > The usual intuitive options for this are reduce, zipmap, or into. You can > also write a lazily recursive solution. I wonder why there's no function in > core that lazily re-constructs the map with the results of the function? It > seems to have been discussed on the list at least once or twice. It seems > like there would have to be two versions of it, one expecting a function > with an arity of one (for just the value) and another expecting an arity of > two (key and value). > > > > > > > > On Mon, Feb 21, 2011 at 10:08 PM, yair wrote: > > I'm hoping this is a dumb question and I've missed something obvious. > > I have a map with various key-value pairs and I want to transform some > > of the values, e.g. > > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > > change the strings to be upper case. > > Right now all I can think of doing is using reduce and passing in an > > empty map and the re-associating each key with the (possibly) > > transformed value. Is there something like the map function that > > takes two parameters, one a function that receives a pair and returns > > a new pair, and the other a map, and returns a map that's > > reconstituted from those pairs? > > > Thanks > > > -- > > 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 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
Re: Transforming map entries
Yeah, after I wrote that, it occurred to me that there are good reasons why Clojure nudges you away from doing lazy operations on maps, although I hadn't thought much about it. I didn't think of walk. That is probably the most elegant out of the approaches I have seen to this common problem. On Tue, Feb 22, 2011 at 6:43 PM, Alan wrote: > On Feb 22, 3:23 pm, rob levy wrote: > > The usual intuitive options for this are reduce, zipmap, or into. You > can > > also write a lazily recursive solution. I wonder why there's no function > in > > core that lazily re-constructs the map with the results of the function? > It > > seems to have been discussed on the list at least once or twice. It > seems > > like there would have to be two versions of it, one expecting a function > > with an arity of one (for just the value) and another expecting an arity > of > > two (key and value). > > Maps aren't lazy. They would be seqs if they were lazy, and not have > fast lookup by key. > > clojure.contrib.generic.functor/fmap updates values, and clojure.walk/ > walk (and maybe post-walk) can do what you're looking for with pairs: > > user=> (walk (fn [[k v]] [v k]) identity {:a 1 :b 2}) > {1 :a, 2 :b} > > -- > 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 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
Re: Transforming map entries
Yeah, fmap is perfect and definitely the most elegant for the specific problem described by the OP. I had never heard of that one. On Tue, Feb 22, 2011 at 6:56 PM, Benny Tsai wrote: > There is fmap from clojure.contrib.generic.functor, which expects a > function of arity 1, for just the value: > > (use 'clojure.contrib.generic.functor) > (require '[clojure.string :as str]) > > (def my-map {:first "john" :last "smith" :age 25}) > > (defn my-fn [value] > (if (string? value) >(str/upper-case value) >value)) > > user=> (fmap my-fn my-map) > {:first "JOHN", :last "SMITH", :age 25} > > On Feb 22, 4:23 pm, rob levy wrote: > > The usual intuitive options for this are reduce, zipmap, or into. You > can > > also write a lazily recursive solution. I wonder why there's no function > in > > core that lazily re-constructs the map with the results of the function? > It > > seems to have been discussed on the list at least once or twice. It > seems > > like there would have to be two versions of it, one expecting a function > > with an arity of one (for just the value) and another expecting an arity > of > > two (key and value). > > > > > > > > > > > > > > > > On Mon, Feb 21, 2011 at 10:08 PM, yair wrote: > > > I'm hoping this is a dumb question and I've missed something obvious. > > > I have a map with various key-value pairs and I want to transform some > > > of the values, e.g. > > > > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > > > change the strings to be upper case. > > > Right now all I can think of doing is using reduce and passing in an > > > empty map and the re-associating each key with the (possibly) > > > transformed value. Is there something like the map function that > > > takes two parameters, one a function that receives a pair and returns > > > a new pair, and the other a map, and returns a map that's > > > reconstituted from those pairs? > > > > > Thanks > > > > > -- > > > 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 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 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
Re: Ordering of defn's?
Hm, I see now. Does Java work like that too? (C# doesn't.) Are there any plans for this to change in the future? I can work with it now, but it makes me uncomfortable. It feels like a step backwards. I fully understand if it was just a feature put on hold, just to get the reader/compiler out there. If it was a design decision, then that's kind of different. On Feb 22, 6:40 pm, Daniel Bell wrote: > This is true. But you "declare" lets you throw out all the names you > need to at the beginning to avoid circular definitions and the like. > > eg. > (declare sum) > > (defn average [coll] > (/ (sum coll) (count coll))) > > (defn sum [coll] > (apply + coll)) > > On Feb 21, 11:05 pm, Jonathan Mitchem wrote: > > > > > > > > > I'm new to Lisps in general, and very new to Clojure. > > > When I was trying out CL, I could put my "defun/defn"s in any order in > > the file, and it would load and run fine in the REPL. However, in > > Clojure, it seems to be much more C/C++-like and I have to define > > things before I use them in other defns. > > > Is this... correct? Or is it just a limitation of the IDEs I've been > > trying out? > > > E.g., it seems like I have to define "sum" before I can define > > "average". -- 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
akka
I've just spent the afternoon perusing the docs for Akka 1.0 (akka.io), which was recently announced. It's a library written in Scala for building distributed, fault-tolerant systems. The library offers both a Scala API and a straight Java API. Interestingly, Akka borrows heavily from Clojure for its basic concurrency constructs - specifically, it also offers agents and STM refs inspired by Clojure's implementation. Like Clojure, it offers futures and promises (called dataflow variables in Akka) -- I assume both languages were inspired by Oz/Alice ML on these features. Akka goes further than Clojure, though, and also adds the kind of fault-tolerant distributed actor-based system that Erlang is famous for. Scala has had actors for a while, but Akka's implementation of actors supports distributed nodes, integration with transaction system, supervisor hierarchies, and persistence/serialization. It's interesting to ask the following questions: 1. Would it make sense to wrap Akka's Java API and use it from within Clojure? It seems like it might work, but it also seems a bit crazy to have to use their alternative version of refs, agents, futures, and promises. 2. Alternatively, how much effort would it take to flesh out Clojure's offerings to match (or come close) to Akka's feature set? 3. What is Clojure's state-of-the-art for building distributed, fault-tolerant systems with its existing feature set and/or leveraging popular libraries? What do you all think? -- 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
Re: Transforming map entries
On Tue, 22 Feb 2011 15:36:02 -0800 (PST) Daniel Bell wrote: > I can't think of anything core, but > > (let [f #(. % toUpperCase)] > (zipmap (keys skills) (map f (vals skills doesn't seem too bad. Does clojure guarantee that keys & vals return things in the proper order for this to work? Since it doesn't guarantee that serializing the entries of a map will always get the same order, that seems unlikely. thanks, http://www.mired.org/consulting.html Independent Software developer/SCM consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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
Re: Transforming map entries
Augh, my eyes! Seriously though, you can save yourself some pain. If you're going to destructure in an anonymous function, just use (fn) instead of the now- actually-longhand #() shorthand form: (fn [[k v]] ...) vs #(let [[k v] %] ...) is clearer and doesn't stop you using another #() nested within or without. Related advice, which I always forget when I'm writing my own code, is that you usually don't want to map an anonymous function; instead, use for: (for [[k v] my-seq] (do-stuff-with k v)) is clearer than (map (fn [[k v]] (do-stuff-with k v)) my-seq) On Feb 22, 3:27 pm, Nurullah Akkaya wrote: > You can use map to get your new sequence of pairs, the turn it into a > hash-map using into, > > (->> {:first "john" :last "smith" :age 25} > (map #(let [[k v] %] > (if (string? v) > [k (.toUpperCase v)] [k v]))) > (into {})) > > Best, > -- > Nurullah Akkayahttp://nakkaya.com > > On Tuesday, February 22, 2011 at 5:08 AM, yair wrote: > > I'm hoping this is a dumb question and I've missed something obvious. > > I have a map with various key-value pairs and I want to transform some > > of the values, e.g. > > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > > change the strings to be upper case. > > Right now all I can think of doing is using reduce and passing in an > > empty map and the re-associating each key with the (possibly) > > transformed value. Is there something like the map function that > > takes two parameters, one a function that receives a pair and returns > > a new pair, and the other a map, and returns a map that's > > reconstituted from those pairs? > > > Thanks > > > -- > > 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 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
Re: Transforming map entries
Yes, it is guaranteed, and I'm dubious about your claim about serializing. (seq foo) will return the entries in foo in the same order always; but (seq (assoc foo 1 2)) may return the entries in a completely different order. You can treat (keys x) as if it were defined by (map key (seq x)): user=> (let [x (meta #'first)] (= (keys x) (map key x))) true On Feb 22, 4:17 pm, Mike Meyer wrote: > On Tue, 22 Feb 2011 15:36:02 -0800 (PST) > > Daniel Bell wrote: > > I can't think of anything core, but > > > (let [f #(. % toUpperCase)] > > (zipmap (keys skills) (map f (vals skills doesn't seem too bad. > > Does clojure guarantee that keys & vals return things in the proper > order for this to work? Since it doesn't guarantee that serializing > the entries of a map will always get the same order, that seems > unlikely. > > thanks, > -- > Mike Meyer http://www.mired.org/consulting.html > Independent Software developer/SCM consultant, email for more information. > > O< ascii ribbon campaign - stop html mail -www.asciiribbon.org -- 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
Re: Transforming map entries
I was introduced to fmap by Haskell. Specifically, the (IMHO) most excellent "Learn You a Haskell for Great Good!" online tutorial. Highly recommended! On Feb 22, 5:04 pm, rob levy wrote: > Yeah, fmap is perfect and definitely the most elegant for the specific > problem described by the OP. I had never heard of that one. > > > > > > > > On Tue, Feb 22, 2011 at 6:56 PM, Benny Tsai wrote: > > There is fmap from clojure.contrib.generic.functor, which expects a > > function of arity 1, for just the value: > > > (use 'clojure.contrib.generic.functor) > > (require '[clojure.string :as str]) > > > (def my-map {:first "john" :last "smith" :age 25}) > > > (defn my-fn [value] > > (if (string? value) > > (str/upper-case value) > > value)) > > > user=> (fmap my-fn my-map) > > {:first "JOHN", :last "SMITH", :age 25} > > > On Feb 22, 4:23 pm, rob levy wrote: > > > The usual intuitive options for this are reduce, zipmap, or into. You > > can > > > also write a lazily recursive solution. I wonder why there's no function > > in > > > core that lazily re-constructs the map with the results of the function? > > It > > > seems to have been discussed on the list at least once or twice. It > > seems > > > like there would have to be two versions of it, one expecting a function > > > with an arity of one (for just the value) and another expecting an arity > > of > > > two (key and value). > > > > On Mon, Feb 21, 2011 at 10:08 PM, yair wrote: > > > > I'm hoping this is a dumb question and I've missed something obvious. > > > > I have a map with various key-value pairs and I want to transform some > > > > of the values, e.g. > > > > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > > > > change the strings to be upper case. > > > > Right now all I can think of doing is using reduce and passing in an > > > > empty map and the re-associating each key with the (possibly) > > > > transformed value. Is there something like the map function that > > > > takes two parameters, one a function that receives a pair and returns > > > > a new pair, and the other a map, and returns a map that's > > > > reconstituted from those pairs? > > > > > Thanks > > > > > -- > > > > 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 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 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
Re: Ordering of defn's?
Basically, when I'm solving the problem, I'd think "average is sum of the items divided by the count". So... (defn average [coll] (/ (sum coll) (count coll))) Then, "since count is defined, I just need to define sum". (defn sum [coll] (reduce + coll)) In that order: 1 2 Without declare, I write 2 1 Even with declare, best case, I'm still bouncing like this: 2 1 3 It just seems to interrupt my flow when coding. Maybe that's not a legitimate enough concern, but coming from first principles, that seems to be one of the fundamental gains of Clojure. On Feb 22, 6:40 pm, Daniel Bell wrote: > This is true. But you "declare" lets you throw out all the names you > need to at the beginning to avoid circular definitions and the like. > > eg. > (declare sum) > > (defn average [coll] > (/ (sum coll) (count coll))) > > (defn sum [coll] > (apply + coll)) > > On Feb 21, 11:05 pm, Jonathan Mitchem wrote: > > > > > > > > > I'm new to Lisps in general, and very new to Clojure. > > > When I was trying out CL, I could put my "defun/defn"s in any order in > > the file, and it would load and run fine in the REPL. However, in > > Clojure, it seems to be much more C/C++-like and I have to define > > things before I use them in other defns. > > > Is this... correct? Or is it just a limitation of the IDEs I've been > > trying out? > > > E.g., it seems like I have to define "sum" before I can define > > "average". -- 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
Re: Ordering of defn's?
On Tue, Feb 22, 2011 at 4:12 PM, Jonathan Mitchem wrote: > I fully understand if it was just a feature put on hold, just to get > the reader/compiler out there. If it was a design decision, then > that's kind of different. I'm not crazy about this behavior either, but my understanding is that this is an intentional design decision that is a direct consequence of two things: 1. In Clojure IDEs, people want to be able to feed the compiler single functions and expressions. You don't need to compile the entire file all at once; this can be useful for making small modifications to a running system. For consistency, compiling the entire file is just like feeding the functions into the compiler one by one. There's no special "lookahead" for compiling a file in its entirety. 2. Without lookahead, declarations are the only way to allow the compiler to give an intelligent error message if you accidentally refer to a function name that does not exist. People want good error messages. -- 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
Re: Ordering of defn's?
On Tue, Feb 22, 2011 at 4:28 PM, Jonathan Mitchem wrote: > Basically, when I'm solving the problem, I'd think "average is sum of > the items divided by the count". > > So... > (defn average [coll] > (/ (sum coll) (count coll))) > > Then, "since count is defined, I just need to define sum". > > (defn sum [coll] > (reduce + coll)) Basically, go ahead and start writing it top-down, and at the point where you realize you want a helper function sum, add the declaration above average. It ends up looking like this: ; In average, we will be using a helper function sum, which will be defined afterwards. (declare sum) (defn average [coll] (/ (sum coll) (count coll))) (defn sum [coll] (reduce + coll)) In principle, I tend to prefer languages that let me structure the code in whatever way I find the most readable, and I chafe that Clojure makes it easier to write bottom-up code than top-down code. But in all honesty, I've found it's not that big a deal to put declarations up front if you really want to write in a top-down style. -- 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
Re: Transforming map entries
On Tue, Feb 22, 2011 at 7:26 PM, Benny Tsai wrote: > I was introduced to fmap by Haskell. Specifically, the (IMHO) most > excellent "Learn You a Haskell for Great Good!" online tutorial. > Highly recommended! Take off every 'monad'! For great justice! -- 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
Re: Transforming map entries
I don't know if it's specified in the documentation anywhere, but (= map-I-made-up (zipmap (keys map-I-made-up) (vals map-I-made-up))) returns true. On Feb 22, 5:17 pm, Mike Meyer wrote: > On Tue, 22 Feb 2011 15:36:02 -0800 (PST) > > Daniel Bell wrote: > > I can't think of anything core, but > > > (let [f #(. % toUpperCase)] > > (zipmap (keys skills) (map f (vals skills doesn't seem too bad. > > Does clojure guarantee that keys & vals return things in the proper > order for this to work? Since it doesn't guarantee that serializing > the entries of a map will always get the same order, that seems > unlikely. > > thanks, > -- > Mike Meyer http://www.mired.org/consulting.html > Independent Software developer/SCM consultant, email for more information. > > O< ascii ribbon campaign - stop html mail -www.asciiribbon.org -- 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
Re: Transforming map entries
On Tue, Feb 22, 2011 at 7:36 PM, Daniel Bell wrote: > I don't know if it's specified in the documentation anywhere It doesn't seem to be. > but > (= map-I-made-up > (zipmap > (keys map-I-made-up) > (vals map-I-made-up))) > > returns true. However, it is clearly intentional behavior nonetheless. In particular, I can think of no other reason why "keys" doesn't return a set than to avoid potential reordering; so (zipmap (keys m) (map do-something-to (vals m))) and things like that will work properly. -- 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
Re: Ordering of defn's?
On Tue, 22 Feb 2011 16:12:50 -0800 (PST) Jonathan Mitchem wrote: > Hm, I see now. Does Java work like that too? (C# doesn't.) No. > Are there any plans for this to change in the future? I can work with > it now, but it makes me uncomfortable. It feels like a step > backwards. > > I fully understand if it was just a feature put on hold, just to get > the reader/compiler out there. If it was a design decision, then > that's kind of different. This is probably by design. Loading or compiling clojure file implies evaluating all the forms it contains in order. You can do anything at compile/load time, not only define things. -- Mikhail -- 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
Implementing search algorithm for binary tree
Hi, I'm trying to implement searching algorithm for binary tree. Here is my Java implementation: public Node findNode(Integer data) { Node current = root; while (!data.equals(current.getData())) { if (data < current.getData()) current = current.getLeftChild(); else current = current.getRightChild(); if (current == null) return null; } return current; } And here is an unfinished Clojure version: (defrecord Node [data left-child right-child]) (defrecord Tree [root]) (defn find-node [tree data] "Search for a node" (let [root (:root tree)] (loop [current root] (if (= data (:data current)) current (cond (< data (:data current)) (> data (:data current))) I don't know to to set/assign a value for current inside cond form. Thank you for help and time. -- 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
Re: Implementing search algorithm for binary tree
On Tue, Feb 22, 2011 at 8:37 PM, HB wrote: > Hi, > > I'm trying to implement searching algorithm for binary tree. > Here is my Java implementation: > > public Node findNode(Integer data) { > Node current = root; > while (!data.equals(current.getData())) { > if (data < current.getData()) > current = current.getLeftChild(); > else > current = current.getRightChild(); > if (current == null) > return null; > } > return current; > } > > > And here is an unfinished Clojure version: > > (defrecord Node [data left-child right-child]) > > (defrecord Tree [root]) > > (defn find-node [tree data] > "Search for a node" > (let [root (:root tree)] > (loop [current root] > (if (= data (:data current)) > current > (cond > (< data (:data current)) > (> data (:data current))) > > I don't know to to set/assign a value for current inside cond form. (defn find-node "Search for a node" [tree data] (let [root (:root tree)] (loop [current root] (cond (< data (:data current)) (recur (:left-child node)) (> data (:data current)) (recur (:right-child node)) :else current -- 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
Re: Transforming map entries
On Tue, 22 Feb 2011 16:23:00 -0800 (PST) Alan wrote: > Yes, it is guaranteed, and I'm dubious about your claim about > serializing. (seq foo) will return the entries in foo in the same > order always; but (seq (assoc foo 1 2)) may return the entries in a > completely different order. You can treat (keys x) as if it were > defined by (map key (seq x)): References please? There was a discussion a while back about why maps weren't treated as sequences, the gist of it being that (seq somemap) wasn't guaranteed to always return things in the same order, and requiring an explicit conversion was a reminder of that. Given that, the fact that (keys x) can be treated the same as (map key (seq x)) isn't sufficient to guarantee that (keys x) and (vals x) will return things in the proper order to zipmap them. Given that it was an email discussion, it could well have been wrong - or things could have changed since then. But I'd like to see a reference to that effect, other than the fact that the current implementation behaves that way. Thanks, http://www.mired.org/consulting.html Independent Software developer/SCM consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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
Release.Next Version Number
As you can see on the Release.Next Planning page [1], there is an open question about whether or not the next version of Clojure should be 1.3 or 2.0. The issue at hand is that we are introducing backwards incompatible API changes. Not looking to start a debate at this point, but just taking a temperature reading from the community. If you care about what the next version number of Clojure is - could you please cast a vote in the poll here: https://spreadsheets.google.com/a/thinkrelevance.com/viewform?hl=en&formkey=dE92bEdzMmpVOURDNUVHOWpaVXVhU3c6MQ#gid=0 Thanks! [1] http://dev.clojure.org/display/design/Release.Next+Planning -- Christopher Redinger http://clojure.com -- 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
Distributed atom :)
Hello all, How could one simulate a distributed atom, e.g. a ref that get updated atomically and thus synchronised in two different processes. Has anyone thought about this in Clojure before? Kind Regards Andreas -- "Programs must be written for people to read, and only incidentally for machines to execute." - Abelson & Sussman, SICP -- ** Andreas Koestler, Software Engineer Leica Geosystems Pty Ltd 270 Gladstone Road, Dutton Park QLD 4102 Main: +61 7 3891 9772 Direct: +61 7 3117 8808 Fax: +61 7 3891 9336 Email: andreas.koest...@leica-geosystems.com www.leica-geosystems.com* when it has to be right, Leica Geosystems Please consider the environment before printing this email. -- 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
Re: Distributed atom :)
On Tue, Feb 22, 2011 at 10:37 PM, Andreas Kostler wrote: > Hello all, > How could one simulate a distributed atom, e.g. a ref that get updated > atomically and thus synchronised in two different processes. > Has anyone thought about this in Clojure before? Well, the simplest and most obvious thing is to wrap an atom in a server. Run a thread that listens for some kind of network protocol that tells it to perform deref, reset!, and compare-and-set! operations on the atom. The corresponding client code consists of three low-level functions that take an atom's name, a hostname, and possibly a newval or both an oldval and a newval, and turns these into the appropriate URI and uses it to cause the server running on hostname to do a deref, reset!, or compare-and-set!. There'd also be one higher-level function that implements remote swap! in terms of the remote deref and compare-and-set!, something like (loop [] (let [oldv (remote-deref atom-addr) newv (f oldv)] (if (remote-compare-and-set! atom-addr oldv newv) newv (recur No sleep/yield in the loop for the obvious reason: the remote-foos perform blocking I/O and yield the CPU anyway so this won't hog the processor. The loop either returns newv after an eventually-successful remote-swap! or throws IOException, say if the host of the remote atom becomes inaccessible. You might also want the ability to command the creation of new atoms on the host from the client, depending on your application. Actually implementing the wire protocol is left as an exercise for the reader. :) -- 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
Importing and using Enum types
Hi Hackers, I am trying to import and use following Enum class from Clojure: http://build.xuggle.com/view/Stable/job/xuggler_jdk5_stable/javadoc/java/api/com/xuggle/xuggler/IContainer.Type.html Basically, I need it so that I can feed it to a Java method that requires it. I'd appreciate any idea or help. Thanks, -- 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
Re: Importing and using Enum types
On Tue, Feb 22, 2011 at 11:38 PM, Kasim wrote: > Hi Hackers, > I am trying to import and use following Enum class from Clojure: > http://build.xuggle.com/view/Stable/job/xuggler_jdk5_stable/javadoc/java/api/com/xuggle/xuggler/IContainer.Type.html > > Basically, I need it so that I can feed it to a Java method that requires > it. I'd appreciate any idea or help. If the enum is a top level class: com.example.package.EnumClass and com.example.package.EnumClass/EnumConstant. If the enum is nested in Foo, com.example.package.Foo$EnumClass and com.example.package.Foo$EnumClass/EnumConstant. The enum class can be imported like any other class. If you want a shorthand for the constants, like foo for EnumClass/FOO, you can do something like this (ns quux (import [com.example.package EnumClass])) (def foo EnumClass/FOO) ... (do-something-with foo) ... (.javaMethod some-object ^String "boo!" (int 42) ^EnumClass foo) -- 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
Re: Trouble with type hints
After looking at it more, it appears that I was executing something intense and lazy immediately prior to this function which then included a doall upon the result of the previous calculation. When I modified the previous function to remove its laziness, the time required for this calculation dropped immediately. Unless I find out otherwise, I'll consider this issue closed. Thanks for the help. On Feb 18, 9:55 am, Daniel Solano Gomez wrote: > > Is there something besides type-hinting that I'm missing? > > Is there any chance that you can make a sample data set/complete script > available? > That would make it easier to try different things and figure out where > the problem is. > > Sincerely, > > Daniel Solano Gómez > > application_pgp-signature_part > < 1KViewDownload -- 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