Re: Risks of (over-)using destructuring?

2009-07-25 Thread Laurent PETIT
Hi, 2009/7/25 jan > > Laurent PETIT writes: > > > 2009/7/24 pcda...@gmail.com > > > > On Jul 23, 10:15 pm, Richard Newman wrote: > > > > Coming from an OO background which puts a strong focus on data > > > > encapsulation, > > > > this makes me a little nervous. > > > > >

Re: Tests in Clojure source

2009-07-25 Thread ajlopez
Hi people! Thanks for the answers, Wilson, Richard. Yesterday, I could clone the CLR branch from github (github hates my IE7 browser, I switched to FireFox): http://github.com/richhickey/clojure-clr/tree/master I found in the code the kind of test I was looking for. Just curious: any attempt t

Simple questions from a newbie

2009-07-25 Thread ajlopez
Hi people! I have some experience with plain-vanilla Lisp (not Common Lisp or Scheme); I have some questions about minor (or not) design decisions in Clojure: 1) Why the fn special form receives an array as list of parameters? That is, why Clojure is using: (fn [x y] instead of (fn (x y)

Re: Very minor problem in the REPL

2009-07-25 Thread ronen
Iv stumbled this also when using Threads, (http:// javadevelopmentforthemasses.blogspot.com/2009/07/easiest-singleton- around.html) user=> (defn singleton-factory [] (println "creating object") (+ 1 2)) user=> (use 'clojure.contrib.singleton) nil user=> (def t-singleton (per-thr

Re: Simple questions from a newbie

2009-07-25 Thread Meikel Brandmeyer
Hi, Am 25.07.2009 um 15:08 schrieb ajlopez: 1) Why the fn special form receives an array as list of parameters? That is, why Clojure is using: (fn [x y] instead of (fn (x y) ... or both Any rationale behing this decision? In Clojure vectors are used everywhere, where the grouping par

Re: Very minor problem in the REPL

2009-07-25 Thread Stuart Sierra
That's a general problem with multiple threads printing to the same stream, and not something that can be easily avoided. -Stuart On Jul 25, 12:48 pm, ronen wrote: > Iv stumbled this also when using Threads, (http:// > javadevelopmentforthemasses.blogspot.com/2009/07/easiest-singleton- > around

validate inconsistency

2009-07-25 Thread Mark Volkmann
Looking at the source ARef.java, I see that the validate method will throw an IllegalStateException if the validator function either returns false or throws a non-RuntimeException. The setValidator method immediately validates the Ref using the new validator function. It always throws a RuntimeExc

where to suggestion changes

2009-07-25 Thread Mark Volkmann
Should I use this mailing list to suggest changes to the Clojure implementation or some other avenue? Some suggestions I may have are pretty simple. For example, in LockingTransaction.java I see: ref.validate(ref.getValidator(), e.getValue()); That could be replaced by: ref.validate(e.getValue

Re: where to suggestion changes

2009-07-25 Thread Rich Hickey
On Jul 25, 3:20 pm, Mark Volkmann wrote: > Should I use this mailing list to suggest changes to the Clojure > implementation or some other avenue? > > Some suggestions I may have are pretty simple. > For example, in LockingTransaction.java I see: > > ref.validate(ref.getValidator(), e.getValue(

Re: where to suggestion changes

2009-07-25 Thread Mark Volkmann
On Sat, Jul 25, 2009 at 2:53 PM, Rich Hickey wrote: > > On Jul 25, 3:20 pm, Mark Volkmann wrote: >> Should I use this mailing list to suggest changes to the Clojure >> implementation or some other avenue? >> >> Some suggestions I may have are pretty simple. >> For example, in LockingTransaction.j

Re: How to write performant functions in clojure (and other functional languages)

2009-07-25 Thread atucker
I wonder if any of the Clojurians on here might like to describe how one might write the factorial function as a parallel one? Taking advantage of the associativity of multiplication, along the lines of 16! = (((1*2)*(3*4)) * ((5*6)*(7*8))) * (((9*10)*(11*12)) * ((13*14)* (15*16))) On Jul 24, 8

Re: Simple questions from a newbie

2009-07-25 Thread Michael Wood
Hi 2009/7/25 ajlopez : [...] > from loop* to loop, let* to let, fn* to fn... Are all *-ended names > special forms? [...] No, you can name your own functions/macros something* if you want to. The * at the end normally just means that this function/macro is similar to the one without the *, but n

Re: How to write performant functions in clojure (and other functional languages)

2009-07-25 Thread Timothy Pratley
The parallel library wraps the ForkJoin library scheduled for inclusion in JDK 7: http://gee.cs.oswego.edu/dl/concurrency-interest/index.html You'll need jsr166y.jar in your classpath in order to use this library. (use '(clojure.parallel)) (clojure.parallel/preduce * (range 2 16)) On Jul 26, 6:40