Maven vs Ivy (or Leiningen)

2011-01-21 Thread OGINO Masanori
Hello. Clojure will use both Ant and Maven 2. (Maven 3 may be used in the future?) However, if we see management software world widely, there is Ivy. Could I ask you whether Ivy is well enough or not? ; Yes, there is another notable thing, Leiningen written in Clojure. ; It sounds interesting th

Cute demonstration of agent update semantics

2011-01-21 Thread Ken Wesson
(defn evens [] (iterate (partial + 2) 0)) (defn odds [] (iterate (partial + 2) 1)) (def foo (agent [])) (defn push-foo [s] (doseq [x s] (Thread/sleep (rand-int 100)) (send foo conj x))) (defn pusher-threads [ss] (map (fn [s] (Thread. #(do (push-foo s) (println "done!" ss))

Distinguishing a map from a record

2011-01-21 Thread Brian Marick
In the absence of #'record?, what's the safest way to tell whether a particular object is a true map or a record? - Brian Marick, Artisanal Labrador Contract programming in Ruby and Clojure Author of /Ring/ (forthcoming; sample: http://exampler.com/tmp/ring.pdf) www.exampler.com, www.exampler

Re: Distinguishing a map from a record

2011-01-21 Thread Christophe Grand
Hi! On Fri, Jan 21, 2011 at 1:27 PM, Brian Marick wrote: > In the absence of #'record?, what's the safest way to tell whether a > particular object is a true map or a record? > "true" maps extend clojure.lang.APersistentMap, records don't. hth, Christophe -- Professional: http://cgrand.ne

records, metas, and type checking

2011-01-21 Thread kony
If we try to write: (defrecord Point [#^double x #^double y]) then create them as follows: (Point. "sth") we've got java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number (NO_SOURCE_FILE:0) and this is OK, but If we put: (defrecord vect2 [#^clojure.lang.IPersiste

Re: records, metas, and type checking

2011-01-21 Thread Meikel Brandmeyer
Hi, On 21 Jan., 14:00, kony wrote: > If we try to write: > > (defrecord Point [#^double x #^double y]) > > then create them as follows: > > (Point. "sth") > > we've got > > java.lang.ClassCastException: java.lang.String cannot be cast to > java.lang.Number (NO_SOURCE_FILE:0) > > and this is OK,

Re: Why no def- ?

2011-01-21 Thread Aaron Bedra
On 01/21/2011 12:51 AM, Ken Wesson wrote: On Fri, Jan 21, 2011 at 12:40 AM, Alex Baranosky wrote: I've wanted to have private defs. For defn, I just us defn-. But there is no def- So I just use: (defmacro def- [name& decls] (list* `def (with-meta name (assoc (meta name) :private true

Re: Maven vs Ivy (or Leiningen)

2011-01-21 Thread faenvie
you may want to take a look at https://bitbucket.org/kotarak/clojuresque which adapts the feature-rich gradle-buildsystem to implement build- logic for 'native' clojure-projects and also makes builds for mixed- language- projects and multi-projects quite easy. by default the gradle-buildsystem use

Re: Maven vs Ivy (or Leiningen)

2011-01-21 Thread faenvie
>>of a snapshot or a release und update of the documentation would be >>welcome ... after all ... its open-source-software and audience-participation is probably welcome ;-) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: Maven vs Ivy (or Leiningen)

2011-01-21 Thread Meikel Brandmeyer
Hi, On 21 Jan., 15:02, faenvie wrote: > the released version of clojuresque is a little bit outdated ... > publication > of a snapshot or a release und update of the documentation would be > welcome ... Indeed. A new release will hopefully be available soon. A slightly outdated SNAPSHOT is avai

Re: Maven vs Ivy (or Leiningen)

2011-01-21 Thread Stuart Sierra
Maven was the best choice for the kind of inherited configuration we need to make sure Clojure (and soon, contrib) releases get deployed from Hudson into the Sonatype open-source repository and then into the Maven Central repository. You can certainly use Ivy, Leiningen, Gradel, or any other to

Re: Why no def- ?

2011-01-21 Thread Stuart Sierra
And in Clojure 1.3: (def ^:private foo ...) -Stuart Sierra 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

Re: Why no def- ?

2011-01-21 Thread Laurent PETIT
2011/1/21 Aaron Bedra > On 01/21/2011 12:51 AM, Ken Wesson wrote: > >> On Fri, Jan 21, 2011 at 12:40 AM, Alex Baranosky >> wrote: >> >>> I've wanted to have private defs. For defn, I just us defn-. But there >>> is >>> no def- >>> >>> So I just use: >>> >>> (defmacro def- [name& decls] >>>

Re: Why no def- ?

2011-01-21 Thread Aaron Bedra
On 01/21/2011 09:22 AM, Laurent PETIT wrote: 2011/1/21 Aaron Bedra > On 01/21/2011 12:51 AM, Ken Wesson wrote: On Fri, Jan 21, 2011 at 12:40 AM, Alex Baranosky mailto:alexander.barano...@gmail.com>> wrote: I've wanted to have priva

Re: just an observation about doseq...

2011-01-21 Thread Aaron Bedra
On 01/20/2011 07:53 AM, John Szakmeister wrote: On Thu, Jan 20, 2011 at 5:38 AM, Baishampayan Ghose wrote: when we give an empty vector of seq-exprs to doseq it returns the value of the last s-expression.. but returns nil when the vector-of-seq-exprs is not empty.. may be this is the expected b

Re: Maven vs Ivy (or Leiningen)

2011-01-21 Thread OGINO Masanori
Hello. Thank you for responses, faenvie, Meikel and Stuart. Yes, of course, we can use each favorite management software for own Clojure project. (if teammates agree with :)) I asked if non-Maven stuffs can be used for Clojure itself officially or not. And then, as Stuart says, Maven may be good w

Re: Maven vs Ivy (or Leiningen)

2011-01-21 Thread OGINO Masanori
Hello. Thank you for responses, faenvie, Meikel and Stuart. Yes, of course, we can use each favorite management software for own Clojure project. (if teammates agree with :)) I asked if non-Maven stuffs can be used for Clojure itself officially or not. And then, as Stuart says, Maven may be good w

Re: just an observation about doseq...

2011-01-21 Thread Baishampayan Ghose
> Please create a ticket in JIRA for this.  If you have a patch and have > signed the CA then all is good there. Done. http://dev.clojure.org/jira/browse/CLJ-722 My CA is on file. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed t

Re: just an observation about doseq...

2011-01-21 Thread Aaron Bedra
On 01/21/2011 10:31 AM, Baishampayan Ghose wrote: Please create a ticket in JIRA for this. If you have a patch and have signed the CA then all is good there. Done. http://dev.clojure.org/jira/browse/CLJ-722 My CA is on file. Regards, BG Thanks! -- Cheers, Aaron Bedra -- Clojure/core http:

Re: live-processing

2011-01-21 Thread Vilson Vieira
2011/1/21 MarkH : > Cool stuff.  Works on Windows 7. Thanks Mark. Thanks to test! Cheers. -- Vilson Vieira vil...@void.cc ((( http://automata.cc ))) ((( http://musa.cc ))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, s

Re: ANN: Textmash - another IDE for Clojure

2011-01-21 Thread Laurent PETIT
2011/1/20 Jeff Rose > I'd also be interested in clojure paredit as a library. We've been > talking about having a stripped down editor for defining synthesizers > and musical processes inside of Overtone, so some tools to get a > useful little Clojure editing window would be great. > It seems

Help with java conversion

2011-01-21 Thread WoodHacker
I'm converting the java code examples in Killer Game Programming in Java by Andrew Davison to Clojure and am having great fun doing it. But I've hit wall where I can't seem to get the code to work. The following code moves an animated gif strip to a java array: public BufferedImage[] loadStripI

Re: Help with java conversion

2011-01-21 Thread Justin Kramer
If you're setting values in an array, use aset: (dotimes [i number] (aset strip i (.createCompatibleImage gc width height transparency)) ...) If you want to get a value, use aget: (let [stripGC (.createGraphics (aget strip i))] ...) Hope that helps, Justin On Jan 21, 11:07 am, WoodHacke

Re: Overriding a java protected method and calling the super-class method from within

2011-01-21 Thread Stuart Sierra
Accessing protected methods is a pain. You could do it with reflection, as Bill said. In gen-class, you need to add the `:exposes-methods` option to gen-class. This will make the protected method available as a public method, under an alternate name. For example, if you're extending Java class

Re: Help with java conversion

2011-01-21 Thread Laurent PETIT
2011/1/21 WoodHacker > I'm converting the java code examples in Killer Game Programming in > Java by Andrew Davison to Clojure and am having great fun doing it. > But I've hit wall where I can't seem to get the code to work. > > The following code moves an animated gif strip to a java array: > >

Re: Help with java conversion

2011-01-21 Thread Armando Blancas
I usually do something like this little sample. Calculations go in the let bindings and new elements are conjoined into the vector. (defn foo [n] (loop [v [] i 0] (if (= i n) v (let [x (* i i)] (recur (conj v x) (inc i)) user=> (foo 6) [0 1 4 9 16 25] On Jan 21, 8:07 

Re: Help with java conversion

2011-01-21 Thread Laurent PETIT
2011/1/21 Armando Blancas > I usually do something like this little sample. Calculations go in the > let bindings and new elements are conjoined into the vector. > (defn foo [n] > (loop [v [] i 0] >(if (= i n) > v > (let [x (* i i)] >(recur (conj v x) (inc i)) > user=>

Re: Help with java conversion

2011-01-21 Thread Michael Gardner
On Jan 21, 2011, at 10:35 AM, Laurent PETIT wrote: > As far as possible, the equivalent of a java anArray[anIndex] expression will > be of not using an index in the first place in Clojure (*). Expanding on Laurent's answer: to transform one list into another, use 'map'. In this case you can thi

Re: Help with java conversion

2011-01-21 Thread Laurent PETIT
2011/1/21 Michael Gardner > On Jan 21, 2011, at 10:35 AM, Laurent PETIT wrote: > > > As far as possible, the equivalent of a java anArray[anIndex] expression > will be of not using an index in the first place in Clojure (*). > > Expanding on Laurent's answer: to transform one list into another, u

Re: Why no def- ?

2011-01-21 Thread Ken Wesson
On Fri, Jan 21, 2011 at 9:49 AM, Aaron Bedra wrote: > On 01/21/2011 09:22 AM, Laurent PETIT wrote: > > 2011/1/21 Aaron Bedra >> >> On 01/21/2011 12:51 AM, Ken Wesson wrote: >>> >>> On Fri, Jan 21, 2011 at 12:40 AM, Alex Baranosky >>>  wrote: I've wanted to have private defs.  For defn,

Java/Clojure Developer at Wall Street Bank

2011-01-21 Thread Michael
I'm looking for a java/clojure developer for my small team at a Wall Street bank. If interested, please reply to sender and we can discuss details. Thanks, Michael -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: Why no def- ?

2011-01-21 Thread Sean Corfield
On Fri, Jan 21, 2011 at 12:38 PM, Ken Wesson wrote: > Another thing that could be useful: if the entire s-expression (def > ...) or (defn ...) has metadata, merge it in, and if there's more than > one > meta, merge rather than replace. That's how Clojure 1.3 already works... user=> (defn ^:priva

Re: Euler 14

2011-01-21 Thread Aaron Cohen
On Thu, Jan 20, 2011 at 11:57 PM, Mark Engelberg wrote: > On Thu, Jan 20, 2011 at 6:51 AM, Andreas Liljeqvist wrote: >> I am sorry, I can't seem to reproduce the behavior at the moment :( >> Mark, please tell me that I am not delusional... > > I definitely exhausted the heap running your program.

Implementing destructuring without setting your hair on fire

2011-01-21 Thread Daniel Werner
Hi everyone, let's play a round of golf. I am currently implementing associative destructuring for ClojureJS while trying not to peek into clojure.core too often -- which wouldn't make things much easier since the 'destructure fn is a huge beast. After a few tries I've come up with the following

Re: Euler 14

2011-01-21 Thread Aaron Cohen
> max-key uses destructuring, which was one of the culprits for > unexpectedly holding onto the head of lists before locals clearing was > added. This part of what I said is garbage, I'm sorry. I looked at max-key too quickly, but there isn't any destructuring there. That doesn't change that I th

Re: Implementing destructuring without setting your hair on fire

2011-01-21 Thread Mark Triggs
Daniel Werner writes: > After a few tries I've come up with the following algorithm to > transform :keys syntax into normal destructuring syntax, but am still > appalled by its complexity: > > (let [vmap {'y :y, 'z :z :keys ['a 'b]}] > (->> vmap > ((juxt :keys :strs :syms)) > (apply con

Re: Euler 14

2011-01-21 Thread Ken Wesson
On Fri, Jan 21, 2011 at 6:43 PM, Aaron Cohen wrote: >> max-key uses destructuring, which was one of the culprits for >> unexpectedly holding onto the head of lists before locals clearing was >> added. > > This part of what I said is garbage, I'm sorry. I looked at max-key > too quickly, but there

Unification

2011-01-21 Thread Alex Baranosky
Hi, I've read a bit about clojure.core.unify ( http://blog.fogus.me/2010/12/14/unification-versus-pattern-matching-to-the-death/ ) I haven't gotten through PAIP yet, but I gather unification libraries enable logic programming? Is it true that unification is a superset of pattern matching? Mostl

Using private helper functions in a macro.

2011-01-21 Thread Ken Wesson
It *is* possible, and not just if the private helper function is run at macroexpansion time to massage forms for the macro. The macro *can* output code that invokes the helper at runtime, but it's awkward: user=> (ns foo) nil foo=> (defn- priv [x] (+ 2 x)) #'foo/priv foo=> (defmacro call-priv-1 [x