Re: Declarative Data Models

2011-05-03 Thread David Jagoe
Hey Stuart, On 4 May 2011 00:19, Stuart Sierra wrote: > No. Clojure template (which I wrote) is a backwards way of doing macros. It > happens to be useful in clojure.test, but nowhere else. Thanks that's good to know. While we're on the subject, I'm curious about cc.apply-macro. Why should it no

ANN: Java dependency injection in Clojure

2011-05-03 Thread Luc Prefontaine
Hi, being tired of wandering through a few thousand lines of XML Spring bean definitions, I finally wrote a library to start moving away from Spring/XML. It's definitively nicer doing dependency injection/auto-wiring using Clojure. This is part of our global effort here to confine Java as much

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Sean Corfield
On Tue, May 3, 2011 at 4:39 PM, Chas Emerick wrote: > That's interesting; I very intentionally built in "proper" support for > browser back/forward actions (as you discovered), thinking that that would be > a good local maxima in terms of history navigation. I guess I could get used to splat-[

Re: Monadic implementation of the Shunting-yard algorithm

2011-05-03 Thread Nicolas Buduroi
I've refactored your code into this: https://gist.github.com/954579 On Tuesday, 3 May 2011 15:02:02 UTC-4, odyssomay wrote: > > I wrote a simple implementation: > http://gist.github.com/953966 > (only supports operators) > It's not very elegant (I don't know how to

Optimizing my function for performance

2011-05-03 Thread Bhinderwala, Shoeb
This is related to my multi-level bucketing problem which I am starting new thread. The code is at: https://gist.github.com/952861 I am referring to the sum-by function which was provided by fellow clojurer in this group. It choked when I passed in data of size one million - meaning I didn't

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread pmbauer
ALT-<[LEFT|RIGHT] ARROW> - nav back/forward I was very pleased to have proper browsing history support - great way to do breadcrumbs. P.S. When I started learning clojure a year ago, one of the biggest pain points was not having a resource like this. Dynamic languages, in general, and clojure, in

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Chas Emerick
On May 3, 2011, at 6:29 PM, Sean Corfield wrote: > On Tue, May 3, 2011 at 3:06 PM, Sean Corfield wrote: >> It doesn't appear to include any of the contrib libraries (I know >> that's a mammoth task for 1.2.0). Do you plan to include the new >> contrib libraries in 1.3.0 since they seem more "int

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Chas Emerick
On May 3, 2011, at 6:06 PM, Sean Corfield wrote: > It's a very cool way to visualize the Clojure world and to explore > what's available. One thing I found - which would definitely stop me > paying for it as-is - I get lost when I drill down: there's no way to > navigate 'back' to what I was look

Re: Closures in macros

2011-05-03 Thread Chris Perkins
On May 3, 5:22 pm, André Thieme wrote: > Some of the limitations: > 1. (defmacro x [] `(let [a# ~(atom 0)])) > > 2. (defmacro y [] `(let [a# ~(comp inc inc)])) ; from that link > > 3. (defmacro z [] `(let [a# ~((fn [x#] (fn [] x#)) 0)])) > > All three calls fail, (x) and (y) and (z). > I see no pl

Re: Monadic implementation of the Shunting-yard algorithm

2011-05-03 Thread Nicolas Buduroi
One small question, how would you modify your version to output s-expressions? -- 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 - please be pa

Re: Monadic implementation of the Shunting-yard algorithm

2011-05-03 Thread Nicolas Buduroi
On Tuesday, 3 May 2011 15:02:02 UTC-4, odyssomay wrote: > > I wrote a simple implementation: > http://gist.github.com/953966 > (only supports operators) > It's not very elegant (I don't know how to use fnparse..), but it is > functional. > What it does is find out

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Sean Corfield
On Tue, May 3, 2011 at 3:06 PM, Sean Corfield wrote: > It doesn't appear to include any of the contrib libraries (I know > that's a mammoth task for 1.2.0). Do you plan to include the new > contrib libraries in 1.3.0 since they seem more "integrated" now? I also could not find: try/catch/finally/

Re: Declarative Data Models

2011-05-03 Thread Stuart Sierra
No. Clojure template (which I wrote) is a backwards way of doing macros. It happens to be useful in clojure.test, but nowhere else. -Stuart S 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@go

Re: Any wisdom in the math speed of different clojure libraries?

2011-05-03 Thread Stuart Sierra
Anything implemented with multimethods (contrib.generic) will be slow compared to primitives and Java methods invoked on primitives. Also try out the better primitive math ops in the 1.3.0-alphas. -Stuart clojure.com -- You received this message because you are subscribed to the Google Groups

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Sean Corfield
On Tue, May 3, 2011 at 11:34 AM, Chas Emerick wrote: > I've previously linked[1] to my preview of Clojure Atlas – my attempt at > producing a more useful, more tractable medium for understanding programming > languages and the libraries that go along with them – so I won't repeat that > material h

Re: resultset-seq

2011-05-03 Thread Allen Johnson
IMHO c.j.j/resultset-seq should perform something like the following: ;; i want my columns as strings exactly how they are in the db (resultset-seq rs) (resultset-seq rs identity) ;; i want my columns as lower-case keywords (resultset-seq rs (comp keyword lower-case)) ;; i want my columns as upp

Re: which is the location for the latest data.finger-tree?

2011-05-03 Thread Stuart Sierra
Yes, that is the latest source. One JAR has been released to the Maven Central Repository: http://repo2.maven.org/maven2/org/clojure/data.finger-tree/0.0.1/ -Stuart S clojure.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

which is the location for the latest data.finger-tree?

2011-05-03 Thread Sunil S Nandihalli
Hello everybody, Can somebody tell me as to which is the location for the current version of data.finger-tree .. the one I found via google was git://github.com/clojure/data.finger-tree.git Thanks, Sunil.. -- You received this message because you are subscribed to the Google Groups "Clojure" g

Re: Closures in macros

2011-05-03 Thread André Thieme
Am 02.05.2011 23:14, schrieb David Nolen: The relevant clojure-dev thread. http://groups.google.com/group/clojure-dev/browse_thread/thread/f4907ebca8ef6e11 It's not clear whether the core team and the various contributors are interested in supporting the behavior you want. It's also not clear w

Re: resultset-seq

2011-05-03 Thread Sean Corfield
Since this thread from October focused on clojure.core/resultset-seq, I thought I'd bump it again in the context of the (new) clojure.java.jdbc library (formerly clojure.contrib.sql). In order to support naming strategies, c.j.j uses an internal, modified copy of resultset-seq that allows you to c

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Jeffrey Schwab
On Tuesday, May 3, 2011 3:31:33 PM UTC-4, tbc++ wrote: > > > On Tue, May 3, 2011 at 2:28 PM, Jeffrey Schwab wrote: > >> Boo. Keep the paywall. Don't make me look at ads. And for the record, >> you're not paying for information, but rather to have the information >> presented in a particular

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Chas Emerick
On May 3, 2011, at 3:28 PM, Jeffrey Schwab wrote: > Boo. Keep the paywall. Don't make me look at ads. And for the record, > you're not paying for information, but rather to have the information > presented in a particular way. No worries, I've zero intention of using advertising of any sort.

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Timothy Baldridge
On Tue, May 3, 2011 at 2:28 PM, Jeffrey Schwab wrote: > Boo. Keep the paywall. Don't make me look at ads. And for the record, > you're not paying for information, but rather to have the information > presented in a particular way. > > Well I think it's more of the case that with a paywall you'l

Re: Any wisdom in the math speed of different clojure libraries?

2011-05-03 Thread Jeffrey Schwab
On Tuesday, May 3, 2011 3:20:25 PM UTC-4, David Nolen wrote: > > On Tue, May 3, 2011 at 2:51 PM, Ken Wesson wrote: > >> It's optimizing your loop away, or else you're using ridiculously >> powerful hardware. >> >> user=> (time (dotimes [_ 100] (Math/ceil (rand >> "Elapsed time: 142.86748

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Chas Emerick
On May 3, 2011, at 3:15 PM, Timothy Baldridge wrote: > > There is a free (nagging) demo, but I assure you kittens will purr just for > > you if you support Clojure Atlas' future development with your purchase. > > You know it's nice, the search is pretty cool. But it takes me longer to go > and

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Laurent PETIT
This is awesome job, Chas, thanks for creating this! 2011/5/3 Chas Emerick > I've previously linked[1] to my preview of Clojure Atlas – my attempt at > producing a more useful, more tractable medium for understanding programming > languages and the libraries that go along with them – so I won't

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Jeffrey Schwab
Boo. Keep the paywall. Don't make me look at ads. And for the record, you're not paying for information, but rather to have the information presented in a particular way. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: Any wisdom in the math speed of different clojure libraries?

2011-05-03 Thread David Nolen
On Tue, May 3, 2011 at 2:51 PM, Ken Wesson wrote: > It's optimizing your loop away, or else you're using ridiculously > powerful hardware. > > user=> (time (dotimes [_ 100] (Math/ceil (rand > "Elapsed time: 142.86748 msecs" > nil Maybe, maybe not: (do (set! *unchecked-math* true) (

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Ken Wesson
On Tue, May 3, 2011 at 3:15 PM, Timothy Baldridge wrote: >> There is a free (nagging) demo, but I assure you kittens will purr just >> for >> you if you support Clojure Atlas' future development with your purchase. > > You know it's nice, the search is pretty cool. But it takes me longer to go > a

Re: Monadic implementation of the Shunting-yard algorithm

2011-05-03 Thread Ken Wesson
On Mon, May 2, 2011 at 8:23 PM, Nicolas Buduroi wrote: > Is there a more functional way of writing it? If you have imperative code implementing a conceptually-pure function, the answer to this is always "yes", in at least a trivial sense: you can write a pure-functional interpreter for the impera

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Timothy Baldridge
> There is a free (nagging) demo, but I assure you kittens will purr just for > you if you support Clojure Atlas' future development with your purchase. You know it's nice, the search is pretty cool. But it takes me longer to go and search, or to chase little (i) symbols around than it does to act

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Ken Wesson
On Tue, May 3, 2011 at 2:34 PM, Chas Emerick wrote: > There is a free (nagging) demo, but I assure you kittens will purr just for > you if you support Clojure Atlas' future development with your purchase. You've put this thing behind a *paywall*? It's *information*. If you really want to monetize

Re: Monadic implementation of the Shunting-yard algorithm

2011-05-03 Thread Jonathan Fischer Friberg
I wrote a simple implementation: http://gist.github.com/953966 (only supports operators) It's not very elegant (I don't know how to use fnparse..), but it is functional. What it does is find out what the next element in the operator stack and the out stack should be,

Re: Any wisdom in the math speed of different clojure libraries?

2011-05-03 Thread Ken Wesson
On Tue, May 3, 2011 at 8:03 AM, David Nolen wrote: > Why not? > user> (time (dotimes [_ 10] (Math/ceil 0.1))) > "Elapsed time: 626.867 msecs" > David It's optimizing your loop away, or else you're using ridiculously powerful hardware. user=> (time (dotimes [_ 100] (Math/ceil (rand)))

Re: Let over defmacro

2011-05-03 Thread Ken Wesson
You had: (defmacro eval-cached [obj] (when-not (contains? @cache obj) (reset! cache (assoc @cache obj (eval obj (@cache obj)) and: (eval-cached fbody) This results in eval-cached being called with obj bound to the symbol 'fbody rather than to the second argument to def-cached -- pro

Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Chas Emerick
I've previously linked[1] to my preview of Clojure Atlas – my attempt at producing a more useful, more tractable medium for understanding programming languages and the libraries that go along with them – so I won't repeat that material here. I did think I'd let the list know that Clojure Atlas

Re: [ANN] Lacij v.0.1 a graph visualization library

2011-05-03 Thread Ambrose Bonnaire-Sergeant
Hi Pierre This looks very cool, I'd love to try it. The version on clojars is 0.1.0-SNAPSHOT, could you upload 0.1.0? How do you build it from source? I can't locate a build script. Thanks, Ambrose On Tue, May 3, 2011 at 9:26 PM, Pierre Allix < pierre.allix.w...@googlemail.com> wrote: > Hello

Re: Key order of literal maps

2011-05-03 Thread David Jagoe
Thanks for the responses. On 3 May 2011 17:39, Steve Miner wrote: > > On May 3, 2011, at 7:08 AM, David Jagoe wrote: > > For your specific purpose, I would be careful about using a map as an > "entity" specification. If the order is significant, a vector of field > specifiers would be better.  

RE: RE: Multi-level bucketing problem

2011-05-03 Thread Bhinderwala, Shoeb
Whoa! Thanks Juan. I will start to understand/analyze this... From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of JuanManuel Gimeno Illa Sent: Tuesday, May 03, 2011 11:40 AM To: clojure@googlegroups.com Subject: Re: RE: Multi-level buc

Re: RE: Multi-level bucketing problem

2011-05-03 Thread JuanManuel Gimeno Illa
I'm sure this can be simplyfied: (defn mlg [attrs data] (if (empty? attrs) [ (reduce + (map :mv data)) {:children data}] (let [parts (group-by (first attrs) data) subtrees (map (fn [[value data]] [value (mlg (rest attrs) (map #(dissoc % (first

Re: Key order of literal maps

2011-05-03 Thread Steve Miner
On May 3, 2011, at 7:08 AM, David Jagoe wrote: > Can I rely on (keys some-literal-map) always returning the keys in the > order they were defined in the literal map? In general, the key order is not guaranteed, but an array-map will maintain the insertion order of the keys. Use the array-map f

Re: Multi-level bucketing problem

2011-05-03 Thread JuanManuel Gimeno Illa
I'm sure this can be simplyfied: (defn mlg [attrs data] (if (empty? attrs) [ (reduce + (map :mv data)) {:children data}] (let [parts (group-by (first attrs) data) subtrees (map (fn [[value data]] [value (mlg (rest attrs) (map #(dissoc % (first at

Re: Key order of literal maps

2011-05-03 Thread Armando Blancas
Keys from literal maps aren't sorted; you need a sorted map. user=> (keys {:z 1 :f 2 :a 0}) (:z :a :f) user=> (keys (sorted-map :z 1 :f 2 :a 0)) (:a :f :z) On May 3, 4:08 am, David Jagoe wrote: > Hey everyone, > > I'm busy implementing a macro whose usage looks like this: > > (defentity Person >

Re: Any wisdom in the math speed of different clojure libraries?

2011-05-03 Thread David Nolen
On Tue, May 3, 2011 at 9:50 AM, bOR_ wrote: > Because I did not remember Math/ceil :-). > > Point is, is there any consensus on what math library to use? Is (Math/... > in general the fastest? > For basic math, I'm not sure what could be faster than Java primitive operators and methods. For more

Re: Any wisdom in the math speed of different clojure libraries?

2011-05-03 Thread bOR_
Because I did not remember Math/ceil :-). Point is, is there any consensus on what math library to use? Is (Math/... in general the fastest? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.co

Re: Let over defmacro

2011-05-03 Thread Stanislav Paskalev
Hello again, This has solved the issue: (let [cache (atom {}) cache-eval (fn [obj] (when-not (contains? @cache obj) (reset! cache (assoc @cache obj (eval obj (@cache obj))] (defmacro def-cached "Just as def, however it will return an existing object i

[ANN] Lacij v.0.1 a graph visualization library

2011-05-03 Thread Pierre Allix
Hello, I would like to announce the version 0.1 of the Lacij library, a graph visualization library written in Clojure. I would be really happy with any feedbacks and comments, on the code or the architecture. Help is welcome to implement additional layout algorithms. >From the README file: La

Let over defmacro

2011-05-03 Thread Stanislav Paskalev
Hello, Evaluating the form (let [cache (atom {})] (defmacro eval-cached "Just as eval, however it will return an existing object if it has already been evaluated with it" [obj] (when-not (contains? @cache obj) (reset! cache (assoc @cache obj (eval obj

Re: Any wisdom in the math speed of different clojure libraries?

2011-05-03 Thread David Nolen
Why not? user> (time (dotimes [_ 10] (Math/ceil 0.1))) "Elapsed time: 626.867 msecs" David On Tue, May 3, 2011 at 3:38 AM, bOR_ wrote: > user> (time (dotimes [i 10] (contribmath-ceil (rand > > > "Elapsed time: 4500.530303 msecs" > > > nil > > > user> (time (dotimes [i 10] (

Key order of literal maps

2011-05-03 Thread David Jagoe
Hey everyone, I'm busy implementing a macro whose usage looks like this: (defentity Person {:name {:type String :validator name-validator} :id-number {:type String :validator id-number-validator} :height{:type Float :default 0.0} :weight{:type Float :default 0.0} :bmi

Re: Serialising functions...

2011-05-03 Thread Jules
see inline On Friday, 29 April 2011 04:25:58 UTC+1, kovasb wrote: > > Thats some serious hacking. Definitely agree that distributed clojure > would be awesome. > > Two points/questions: > > 1) Is this just a bug in DynamicClassLoader? Why doesn't it call > super.defineClass instead of falling back

Re: Any wisdom in the math speed of different clojure libraries?

2011-05-03 Thread Alan
On May 3, 12:38 am, bOR_ wrote: > user> (time (dotimes [i 10] (contribmath-ceil (rand                 > > "Elapsed time: 4500.530303 msecs"                                           > > nil                                                                         > > user> (time (dotimes [i

Any wisdom in the math speed of different clojure libraries?

2011-05-03 Thread bOR_
user> (time (dotimes [i 10] (contribmath-ceil (rand "Elapsed time: 4500.530303 msecs"