Re: Do I need to add "dosync" when I read the ref in this case

2010-02-20 Thread ataggart
On Feb 20, 6:07 am, Jack Fang wrote: >    Suppose the transfer-money and print-info are run in different > thread. With the current Clojure STM, is it possible that print-info > prints the old source-account information and modified dest-account > information?   Yes. > Do I need to add a dosync

Re: equality comparisons of finite and infinite collections?

2010-02-20 Thread ataggart
What would the post-patch result be of that operation? On Feb 20, 10:25 am, Stuart Halloway wrote: > Current results vary based on arg order: > > (def xes (iterate #(str % "x") "x")) > => #'user/xes > > ; infinite first ok > (= xes ["x" "xx"]) > => false > > ; finite first boom > (= ["x" "xx"] xe

Re: STM with deeper structure

2010-02-20 Thread Mike Meyer
On Sat, 20 Feb 2010 17:27:34 -0800 (PST) "sailormoo...@gmail.com" wrote: > Hi : > > Say, I have a (def *a (ref {:b [{:c 5}]})) . > I want to add 1 to the :c inside, how would I write? > (Note: the value 5 is in (:b 0 :c), while 0 is the array index) > > (dosync (alter *a __ )) ; ple

STM with deeper structure

2010-02-20 Thread sailormoo...@gmail.com
Hi : Say, I have a (def *a (ref {:b [{:c 5}]})) . I want to add 1 to the :c inside, how would I write? (Note: the value 5 is in (:b 0 :c), while 0 is the array index) (dosync (alter *a __ )) ; please help me fill the blank. Someone mention I can use the zipper library or the walker

Simplenote Desktop App in Clojure

2010-02-20 Thread Kasim
Hi, I am a web developer and would like to write a small Desktop UI application in Clojure for the popular Simplenote app. http://simplenoteapp.com/ I was wondering what UI framework I should use. Anyone out there care to suggest one that works best with Clojure? -- You received this message beca

Re: Clojure box

2010-02-20 Thread Zeynel
On Feb 18, 6:45 pm, Brian Wolf wrote: > I use it all the time.  And its a gentle introduction to emacs Ok. So Clojure box installs the clojures on windows? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure

Re: Clojure box

2010-02-20 Thread Zeynel
On Feb 18, 11:32 pm, Sean Devlin wrote: > Do you need to do a lot of Java work as well?  If so, take a look at > Enclojure (Netbeans) or Counter Clockwise (Eclipse). > No. I just want to install Clojure and start with some tutorials. I was wondering about the installation process of clojure on win

Do I need to add "dosync" when I read the ref in this case

2010-02-20 Thread Jack Fang
Hi,all I am new to clojure. Now I hava a problem about read transcation. Suppose now I write some code about bank transfer. So this is the source-account and destination-account //The code (def source-account (ref 1000)) (def dest-account (ref 0)) And I have a function to do the

Re: compojure stop server?

2010-02-20 Thread Jeff Schwab
Brian Wolf wrote: Is there something like a (stop-server) I don't see anything here Are you just looking for compojure/stop? $ cat hello.clj (ns hello) (use 'compojure) (defroutes rts (GET "/" (html [:h1 "Hello World"])) (ANY "*" (page-not-found))) (defserver srv {:port 8080} (

Re: Clojure on Go

2010-02-20 Thread Chouser
On Sat, Feb 20, 2010 at 3:59 PM, Joop Kiefte wrote: > I read this part... > > http://www.reddit.com/r/programming/comments/b3sb1/golisp_a_lisp_interpreter_in_go/ > > and thought, would someone be able to do that for clojure? (the > Clojure in Clojure stuff might make this easier :)) > > Is this a

Clojure on Go

2010-02-20 Thread Joop Kiefte
I read this part... http://www.reddit.com/r/programming/comments/b3sb1/golisp_a_lisp_interpreter_in_go/ and thought, would someone be able to do that for clojure? (the Clojure in Clojure stuff might make this easier :)) Is this a weird idea? I like a lot of ideas in go, and it's speed, but Cloj

Re: Emacs/Slime -- Slime wont eval but *inferior-lisp* will (Help a newbie out)

2010-02-20 Thread Paul Tarvydas
> >When you perform the installation, you will see warnings related to the > >byte-compilation of the packages. This is normal; the packages will work > >just fine even if there are problems compiling it upon installation > > Since elisp can work in either compiled or interpreted mode, > compila

Re: Emacs/Slime -- Slime wont eval but *inferior-lisp* will (Help a newbie out)

2010-02-20 Thread Phil Hagelberg
On Sat, Feb 20, 2010 at 9:41 AM, Paul Tarvydas wrote: > I tried to install clojure today using these instructions > > http://github.com/technomancy/swank-clojure > > (after first wasting a couple of hours trying to follow these instructions > linked to by clojure.org > http://en.wikibooks.org/wi

equality comparisons of finite and infinite collections?

2010-02-20 Thread Stuart Halloway
Current results vary based on arg order: (def xes (iterate #(str % "x") "x")) => #'user/xes ; infinite first ok (= xes ["x" "xx"]) => false ; finite first boom (= ["x" "xx"] xes) => java.lang.OutOfMemoryError: Java heap space (NO_SOURCE_FILE:0) It looks as if this particular case could be fixe

Re: Applying "and" macro to sequence

2010-02-20 Thread ataggart
On Feb 20, 8:38 am, Johnny Kwan wrote: > The specific problem I'm trying to solve is to see if two sequences of > strings "=" each other.  If one sequence is shorter, the "=" comparison stops > at the end of the shorter sequence.  So I've been trying to do a simple > (reduce and (map = seq1 seq

Re: Emacs/Slime -- Slime wont eval but *inferior-lisp* will (Help a newbie out)

2010-02-20 Thread Paul Tarvydas
I tried to install clojure today using these instructions http://github.com/technomancy/swank-clojure (after first wasting a couple of hours trying to follow these instructions linked to by clojure.org http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Installing_a_JAR) and I se

Re: Applying "and" macro to sequence

2010-02-20 Thread ataggart
On Feb 20, 8:38 am, Johnny Kwan wrote: > Hi, > > This is a very basic question, but I can't find the answer anywhere.  How do > you take the "and" or "or" of sequence?   Try using every? and some, respectively. -- You received this message because you are subscribed to the Google Groups "Clo

Re: Applying "and" macro to sequence

2010-02-20 Thread Meikel Brandmeyer
And while we are at it: (defn f-or [s] (loop [s (seq s)] (when s (if-let [f (first s)] f (recur (next s)) On Sat, Feb 20, 2010 at 06:24:53PM +0100, Meikel Brandmeyer wrote: > (defn fand > [s] > (loop [s (seq s) > l nil] > (if s > (when-let

Re: Applying "and" macro to sequence

2010-02-20 Thread Meikel Brandmeyer
Hi, here a "short-circuiting" (in sense of realising only needed values from the passed seq) version of a "function and". (defn fand [s] (let [s (seq s) l nil] (if s (when-let [f (first s)] (recur (next s) f)) l))) clojureql.sql=> (fand (map = [:a :b :c] [:a :

Re: Applying "and" macro to sequence

2010-02-20 Thread Johnny Kwan
OK, I should have just tried passing in 'and at the REPL before posting. Of course, it works. Is this the idiomatic way? I'm still curious about short-circuiting. On Feb 20, 2010, at 11:38 AM, Johnny Kwan wrote: > Hi, > > This is a very basic question, but I can't find the answer anywhere.

Applying "and" macro to sequence

2010-02-20 Thread Johnny Kwan
Hi, This is a very basic question, but I can't find the answer anywhere. How do you take the "and" or "or" of sequence? They are defined as macros and can't be passed into "apply" or "reduce". Is there some reader macro character to force it? Also, how does one write it so that it will shor