STM in Clojure vs Haskell, why no retry or orElse?

2013-02-15 Thread Tom Hall
A few months ago I reread Simon Peyton Joneses article on STM in the Beautiful Code book and decided to try and translate it into clojures STM See the paper here http://research.microsoft.com/pubs/74063/beautiful.pdf He says 'Atomic blocks as we have introduced them so far are utterly inadequate

Re: STM in Clojure vs Haskell, why no retry or orElse?

2013-02-18 Thread Tom Hall
OK, I guess the essence is: Why does Clojure not need retry or orElse when another implementer of STM considers them essential? I'm guessing it's because clojures in MVCC but would like confirmation and perhaps links to comparisons between STMs and maybe a guide to Clojures. How would you solve th

Re: STM in Clojure vs Haskell, why no retry or orElse?

2013-02-18 Thread Tom Hall
>> Why does Clojure not need retry or orElse when another implementer of >> STM considers them essential? > What are retry and orElse? What do they do? I had hoped to get a reply from someone with experience of both, as the quote suggests they are for blocking and choice (The article was the first

Clojurescript bug

2013-03-04 Thread Tom Hall
Hello, I have just been stuck for ages trying to figure out what was going on in my first clojurescript application and think I have found a bug. I took some working game playing code for a simple tictactoe example and found that I got incorrectly names JS outputted I have created a project with

Re: Clojurescript bug

2013-03-05 Thread Tom Hall
a-clojure >> >> to >> >> src/cljs/aima_clojure >> >> and the file >> >> tictactoe-frontend.cljs >> >> to >> >> tictactoe_frontend.cljs >> >> Maybe we should warn on encountering filenames with dashes, or

Re: Clojurescript bug

2013-03-05 Thread Tom Hall
> Sure, just add it as an explicit dependency to your project. In fact, > your example uses r1450 only because you've got an explicit dependency > on it, as lein-cljsbuild 0.3.0 uses r1552 by default, so you could > also drop the explicit dependency. It's best to use the latest release > though. C

Re: Clojurescript bug

2013-03-06 Thread Tom Hall
encies, and if so, what they are. > > Eg: > > lein outdated > > [org.clojure/clojurescript "0.0-1586"] is available but we use "0.0-971" > > -- > Dave > > > > On Tue, Mar 5, 2013 at 1:26 PM, Tom Hall wrote: >> >> > Sure,

(def some? (comp not nil? some))

2012-12-02 Thread Tom Hall
Hi Guys, We seem to have not-any? but not an any? function, I know we have some but it is not a predicate and I found myself defining some? above today. Why not have some? or any? in the core? Cheers, Tom -- You received this message because you are subscribed to the Google Groups "Clojure" gro

Tail Recursion In Erjang

2011-10-21 Thread Tom Hall
I thought tail recursion was actually not possible on the JVM but saw a talk on the Erlang VM yesterday and Robert Virding mentioned that Erjang managed to do it. I'm sure the core guys have seen it but just in case others thought the same as me here are a few links: http://www.javalimit.com/2009/

max-key taking a list rather than different number of args

2010-11-14 Thread Tom Hall
Hi, I think a better usage for max-key would be (max-key f someseq) rather than passing the values as args. I used (defn max-key-seq [f someseq] (apply max-key (into [f] someseq))) to make it do what I wanted Is there a better way? Cheers, Tom -- You received this message because you are s

Re: max-key taking a list rather than different number of args

2010-11-15 Thread Tom Hall
> > You should be able to use (apply max-key f someseq); apply takes a variable > number of args, and only the last is expanded. > Thanks, thought there would be something like this! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gro

Odd behavior calling a fn "test" or "try"

2011-01-10 Thread Tom Hall
I know I should not be naming my functions the same thing as ones in core but was surprised when I wrote the following https://github.com/thattommyhall/tth-SICP/blob/master/1-35.clj I have being doing the SICP stuff in clojure and accieently copied "try" as the fn name and it did not work, I notice

Re: Odd behavior calling a fn "test" or "try"

2011-01-10 Thread Tom Hall
On Tue, Jan 11, 2011 at 1:51 AM, Stuart Halloway wrote: > Hi Tom, > > "try" is a special form, and "test" is a function. > > Stu Cheers Stu, should have thought of that. Am I correct in thinking only 3 possibilitys for "try" in (try 1) special form, macro, function ? Are the special forms imple

Re: Problem with lazy-seq and heap space overflow

2011-01-22 Thread Tom Hall
Hi Marek, I too am a mostly Python guy looking at clojure. I think you will like the for macro as it is a lot like list comprehensions. I did Euler45 in clojure too and https://github.com/thattommyhall/Project-Euler/blob/master/45.clj runs in 700ms I thought it was quite a nice soln: triangles, he