Question about "every?"

2010-06-23 Thread michele
In the book "Programming Clojure" (p2_0, pdf, page 185) "Adding Validation to Refs" there is this code: (def validate-message-list (partial every? #(and (:sender %) (:text % This works fine as a validator, but when I try the code directly - not as a validator - it returns false. I also tested

Re: Question about "every?"

2010-06-24 Thread michele
idate-message-list (partial every? #(and (:sender %) (:text % (def messages (ref [] :validator validate-message-list)) (defn add-message [msg] (dosync (alter messages conj msg))) (add-message (struct message "mm" "first message")) On Jun 23, 12:58 pm, Stuart Hall

Re: Question about "every?"

2010-06-25 Thread michele
So the validation takes place after "alter messages conj msg" in the add-message function? On Jun 24, 4:48 pm, Meikel Brandmeyer wrote: > Hi, > > alter calls conj on [] (which is kept as a vector) since it is the > initial content of the messages ref. So the content of messages is a > seqab

Documentation and examples (and where is the documentation on reduce)?

2010-06-29 Thread michele
I really like Clojure, but as a complete n00b on Lisp languages, it is frustrating that I many times have to hunt high and low for documentation on basic stuff. Recently I saw a code snippet that showed that reduce takes an optional initial value, something I didn't know. When I see something new,

Re: Documentation and examples (and where is the documentation on reduce)?

2010-06-29 Thread michele
? Because we're lazy. On Jun 29, 2:17 pm, Meikel Brandmeyer wrote: > Hi, > > On Jun 29, 11:55 am, michele wrote: > > > Well, to my surprise and frustration, I haven't found any place which > > documents that reduce takes an optional initial value. >

Re: Documentation and examples (and where is the documentation on reduce)?

2010-06-30 Thread michele
Mother's invention is a lazy necessity, I think. On Jun 29, 9:46 pm, Meikel Brandmeyer wrote: > Hi, > > Am 29.06.2010 um 19:11 schrieb michele: > > > Meikel, idiots are nice people too, so don't feel bad. But seriously, > > why do you think we work this har

Programming Clojure: Snake: update-positions: What does the "do" do here?

2010-08-05 Thread michele
ORIGINAL (defn update-positions [snake apple] (dosync (if (eats? @snake @apple) (do (ref-set apple (create-apple)) (alter snake move :grow)) (alter snake move))) nil) WITHOUT do (defn update-positions [snake apple] (dosync (if (eats? @snake @apple) ((ref-se

What is the reason Lisp code is not written with closing parenthesis on new lines?

2010-08-18 Thread michele
Wouldn't that make it easier to keep track of them. Example: (defn myfn-a [a b] (if (zero? b) a (recur (afn (bfn (...)) a) (dec b (defn myfn-b [a b] (if (zero? b) a (recur (afn (bfn (...)) a) (dec b) ) ) ) -- You received this message becau

Re: What is the reason Lisp code is not written with closing parenthesis on new lines?

2010-08-19 Thread michele
Thanks everyone for the your answers (and the internal debates). I will not put closing parenthesis on new lines. Even though the editor helps me with the parenthesis, there have been situations - while editing inside functions - that I had to count them. Here is an idea (by Harold A.), I will try:

Re: What is the reason Lisp code is not written with closing parenthesis on new lines?

2010-08-30 Thread michele
Being the one who asked the question and satisfied with the answers, I agree. I never expected a question like this, about one of the oldest programming languages, to generate so many responses and discussions. Funny... On Aug 29, 9:46 pm, lprefonta...@softaddicts.ca wrote: > My rough estimate

Re: Clojure stack

2011-05-19 Thread michele
It's not really the Emacs tools that are a problem, but the huge amount of web pages trying - with good intentions - to help you installing the Emacs-Clojure stack, but usually lacking some important detail. It feels like playing a jig-saw puzzle without being able to look at the picture on the box

Aquamacs, swank-clojure: clojure-jack-in returns command not found

2011-05-22 Thread michele
I have tried to find a solution to this problem, but to no avail. According to https://github.com/technomancy/swank-clojure: USAGE The simplest way is to just jack-in from an existing project using Leiningen: Install clojure-mode either from Marmalade or from git. lein plugin install swank-clojur

Re: Clojure, Swank, and Leiningen with Emacs on Mac OS X

2011-05-24 Thread michele
Have you tried this one? https://github.com/technomancy/swank-clojure On May 22, 10:53 am, dokondr wrote: > Hello, > I am trying to install Clojure tools on Mac OS X according to the > instructions: > "Clojure, Swank, and Leiningen with Emacs on > Linux"http://riddell.us/ClojureSwankLeininge

Re: Clojure, Swank, and Leiningen with Emacs on Mac OS X

2011-05-24 Thread michele
And this one https://github.com/technomancy/leiningen/ On May 22, 10:53 am, dokondr wrote: > Hello, > I am trying to install Clojure tools on Mac OS X according to the > instructions: > "Clojure, Swank, and Leiningen with Emacs on > Linux"http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.

Re: Aquamacs, swank-clojure: clojure-jack-in returns command not found

2011-05-24 Thread michele
ATH"))) > > > > > > > > > > On Sun, May 22, 2011 at 2:17 PM, michele wrote: > > I have tried to find a solution to this problem, but to no avail. > > > According tohttps://github.com/technomancy/swank-clojure: > > > USAGE > > The simples

Re: Traffic junctions as a metaphor for understanding the STM?

2010-10-17 Thread michele
Well, there are intelligent beings with the ability to make decisions entering the traffic junction, not exactly the same as with the STM. On Oct 16, 11:07 am, Sam Aaron wrote: > This might be slightly off the wall, but I recently watched a tiny > documentary about an experimental congestion

Re: Traffic junctions as a metaphor for understanding the STM?

2010-10-18 Thread michele
better metaphor. On 17 Okt, 15:07, Sam Aaron wrote: > On 17 Oct 2010, at 8.54 am, michele wrote: > > > > > Well, there are intelligent beings with the ability to make decisions > > entering the traffic junction, not exactly the same as with the STM. > > Of course, a

how does Clojure macros work?

2009-06-26 Thread Michele Simionato
he sense that I do not know of any other macro system working in the same way. Michele Simionato --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Re: how does Clojure macros work?

2009-06-26 Thread Michele Simionato
On Jun 26, 9:53 am, Michele Simionato wrote: > I want to asset the status of Clojure > macros with respect to hygiene. Some further experiment: $ clj Clojure 1.1.0-alpha-SNAPSHOT user=> (def x 42) #'user/x user=> (defmacro m[] 'x) #'user/m user=> (m) 42 user=>

Re: how does Clojure macros work?

2009-06-26 Thread Michele Simionato
On Jun 26, 3:51 pm, Rich Hickey wrote: > By using quote, and not syntax-quote, you have written an > intentionally capturing macro Acc, I missed that. I have read the documentation of syntax-quote now: "" For Symbols, syntax-quote resolves the symbol in the current context, yielding a fully-qu

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Michele Simionato
On Aug 14, 2:47 am, Chas Emerick wrote: > On Aug 13, 2009, at 8:29 PM, Scott wrote: > > > A single "super quoted" string reader would avoid this problem. > > Instead of defining a new read syntax like: > > >  #my-syntax(your DSL goes between here and here) > > > Clojure could provide a general pu