read-string behavior in ClojureScript

2011-10-10 Thread Praki
In Clojure (read-string ":a:b:c") returns :a:b:c (a keyword with two embedded colons) whereas ClojureScript returns :a. In ClojureScript reading of a token ends at whitespace or a macro character (except ' and #). Is this difference deliberate or just an oversight and colon to be allowed to be part

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-10 Thread Andy Fingerhut
I'll post more on this later, but I wanted to point out one case where I found that pmap was not achieving the desired level of speedup (# of CPUs/cores) that you would initially expect, and it is not due to any reasons that I've posted about before. Imagine a 4-core CPU. There are 4 physical CPU

Re: Suggestion needed for namespace management in modular clojure app

2011-10-10 Thread Vivek Khurana
On Sun, Oct 9, 2011 at 8:48 AM, Stephen Compall wrote: > On Fri, 2011-10-07 at 19:07 +0530, Vivek Khurana wrote: >> I would prefer to have a >> modules directory where each module will create a sub directory and >> all files in the module sub directory expose a single namespace. > > So it sounds l

Re: Libraries supporting 1.3&1.2 and bignums

2011-10-10 Thread Alan Malloy
(def +M (first [+' 1])) seems like it should work in both versions? On Oct 10, 4:28 pm, Brian Marick wrote: > I may be missing something obvious. > > Midje has a checker that lets users say things like > >    (fact (my-computation) => (roughly 15  2)) > > Where the first number in `roughly` is th

Re: How do I add goog.ui.MenuItem or goog.ui.Option items to goog.ui.Select in clojurescript?

2011-10-10 Thread Eric Harris-Braun
Well, I figured it out. It was working just fine. The "problem" was that the Options/MenuItems are added elsewhere to the dom. I didn't have the css loading so I just didn't notice that they were at the very bottom of the screen. On Oct 10, 9:25 pm, Eric Harris-Braun wrote: > Here's my clojure

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-10 Thread Lee Spector
Interesting. I'll try some of your suggested tests to see if my pmapall all is behaving better than I thought. Does your pmap-pool permit nesting? (That is, does it permit passing pmap-pool a function which itself calls pmap-pool?). If so then that would be a reason to prefer it over my pmapal

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-10 Thread j-g-faustus
I made an alternative implementation using a thread pool and a queue, based on the example at http://clojure.org/concurrent_programming In short, your pmapall and the pool-based implementation (below) both give approximately perfect scaling on my 4/8-core system (Intel i7 920 and HT). Both giv

Re: clojure.contrib.base64

2011-10-10 Thread Alexander Taggart
Base64 decoding support has been added. http://github.com/ataggart/clojure.data.codec -- 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 - pleas

How do I add goog.ui.MenuItem or goog.ui.Option items to goog.ui.Select in clojurescript?

2011-10-10 Thread Eric Harris-Braun
Here's my clojurescript function: (defn make-select [elem-id] (let [select (goog.ui.Select. "Heading") select-elem (d/element (keyword (str "div#" elem-id)))] (.addItemAt select (goog.ui.MenuItem. "Item 1") 0) (.addItem select (goog.ui.Option. "Item 2"))

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread David Nolen
On Mon, Oct 10, 2011 at 6:07 PM, Stephen Wrobleski wrote: > I think a match-debug is barking up the wrong tree. If throwing an > exception > is the right thing to do to track down an unaccounted case, why make a > different macro just for a slightly different default behavior that is > easily spec

Re: How to Collapse Nested Map into a Sequence of Flat Maps

2011-10-10 Thread Ari
> I'd appreciate suggestions and insights on how I can collapse a nested > map with "n" number of keys (levels) to create a flat map which is > comprised of composite keys and a value. For example, let's say we > have: > > { "a" { 2011 [ [ "a" 2011 "ari"] [ "a" 2011 "dan"] ] } { 2010 [ [ "a" > 2010

Re: Libraries supporting 1.3&1.2 and bignums

2011-10-10 Thread Kevin Downey
(defmacro plus [] (if … (resolve (symbol "clojure.core/+")) (resolve (symbol "clojure.core/+'" ((plus) actual delta) On Mon, Oct 10, 2011 at 4:28 PM, Brian Marick wrote: > I may be missing something obvious. > > Midje has a checker that lets users say things like > >   (fact (my-computation)

Libraries supporting 1.3&1.2 and bignums

2011-10-10 Thread Brian Marick
I may be missing something obvious. Midje has a checker that lets users say things like (fact (my-computation) => (roughly 15 2)) Where the first number in `roughly` is the target number and the second is an acceptable range around that target. Part of what the checker does in 1.2 is this:

Re: statistics library?

2011-10-10 Thread Lee Spector
On Oct 10, 2011, at 4:36 PM, Ben Evans wrote: > There should be 1.2.4 (and a snapshot of 1.3.0) up on clojars now. > > Could I ask you to give one of them a go, and mail your findings to > the list? We have our regular Incanter Hack Day coming up next > weekend, so if things are still b0rken for y

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-10 Thread Lee Spector
On Oct 10, 2011, at 7:16 PM, Phil Hagelberg wrote: > What you're really looking for is pdoseq, right? Seems like futures > might be a better building-block for this, although again Clojure's > lack of flexibility over the thread pool could easily bite you here. No -- I want all of the returned va

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-10 Thread Phil Hagelberg
On Mon, Oct 10, 2011 at 1:07 PM, Lee Spector wrote: > Here's my stab at doing this using agents: > > (defn pmapall >  "Like pmap but: 1) coll should be finite, 2) the returned sequence >   will not be lazy, 3) calls to f may occur in any order, to maximize >   multicore processor utilization, and

Re: Type hints and records

2011-10-10 Thread Stuart Halloway
> I am using a record to wrap a number of java classes, which I then > access various properties on. I am trying to avoid reflection so I > type have type hinted, however when accessing the values in the record > the type hints are lost. It might look something like this > > (defrecord Rec [^Integ

Re: clojure.contrib.base64

2011-10-10 Thread Stuart Sierra
> What do the Clojure devs themselves do to keep their > dev environment productive? Use ed and a raw repl > running in two xterms? ;-) *) Emacs inferior-lisp mode and Bash scripts. Not my first choice, but always works. -Stuart Sierra clojure.com -- You received this message because you are

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread Stephen Wrobleski
On Mon, Oct 10, 2011 at 09:08:42AM -0700, Daniel Pittman wrote: > So, I have one other argument in favour of "just return nil", which I > prefer: > > If you just return il, I can use :else to throw fairly cheaply, and > quite visibly. > > If you throw then I have to wrap any non-exhaustive patte

Re: Reactions to google dart?

2011-10-10 Thread Laurent PETIT
What I have in mind is not related to Dart, but to the support of Closure Tools from Google. Will Dart "javascript compatibility layer/javascript compilation" for non-Chrom(e)(ium) browsers include the Closure Tools Suite ? 2011/10/10 David Nolen : > As a language - not much exciting stuff. Cloju

Re: Reactions to google dart?

2011-10-10 Thread David Nolen
As a language - not much exciting stuff. ClojureScript by targeting lowest common denominator JavaScript is portable in a way that Dart is not. I'm skeptical that Dart will see much uptake from various vendors - but only time will tell. David On Mon, Oct 10, 2011 at 7:47 AM, ivo wrote: > And w

Incanter Hack Day, Sunday 16th October, London

2011-10-10 Thread Ben Evans
Hi, There is an Incanter Hack Day taking place on Sunday at the Royal Festival Hall in London. We'll be on the 5th floor, Blue side. The group will begin turning up at 1000, but feel free to come a bit later if that's too early. We'll go for some lunch somewhere close by on Southbank when everyon

Re: Macro tutorials?

2011-10-10 Thread Larry Johnson
Hi, Nicolas, and thanks. I'm new to clojure (I've been working through Programming Clojure), and most of my long work life has gravitated around c, shell scripts, and perl. That being said, I've tinkered with Lisp dialects for the past twenty-five years (mostly elisp, scheme, and common lisp), an

Type hints and records

2011-10-10 Thread casper
I am using a record to wrap a number of java classes, which I then access various properties on. I am trying to avoid reflection so I type have type hinted, however when accessing the values in the record the type hints are lost. It might look something like this (defrecord Rec [^Integer i]) (def

Reactions to google dart?

2011-10-10 Thread ivo
And what does it mean to clojurescript? -- 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 patient with your first post. To unsubscr

Re: statistics library?

2011-10-10 Thread Ben Evans
Hi Lee, On Wed, Sep 28, 2011 at 12:43 AM, Lee Spector wrote: > On Sep 27, 2011, at 5:44 PM, David Powell wrote: > >> I see that there was a recent fix made to Incanter: >> >> Fixed typo in :lower-tail? keyword. >> This was causing the complement of the p-value to be returned. >> >> https://github

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-10 Thread Lee Spector
A weakness of my pmapall: # Which means, I think, that I can't call pmapall within a function that I pass to pmapall. Unfortunate. Is there a better way? -Lee PS to see these exceptions one must change the call to agent in my definition with something like #(agent % :error-handler (fn [agn

Composing HTML rendering functions

2011-10-10 Thread Thorsten Wilms
Hi! Initially I created a mess of interlinked functions for rendering HTML via hiccup. I have few pages with parts that may vary or may be present or not based on whether the user is logged in as admin. With the desire to test for the role in a single place and for composing the views in a

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-10 Thread Lee Spector
I think that the following partially answers my own question and that it provides a way to get decent multicore performance for collections of non-uniform but compute-intensive tasks through a simple, pmap-like interface. But I'm not sure if it's the best approach and I'd like some feedback. If

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread David Nolen
On Mon, Oct 10, 2011 at 3:42 PM, Steve Miner wrote: > > match-let looks good. I see that you are Clojure contributor - I'm more > than happy to include this. > > Yes, I'm a registered contributor. It's all yours. > > I'll take a look at the code and see if I can fix things for myself > regarding

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread Steve Miner
> match-let looks good. I see that you are Clojure contributor - I'm more than > happy to include this. Yes, I'm a registered contributor. It's all yours. I'll take a look at the code and see if I can fix things for myself regarding the implied equality constraints and guard clauses. By the w

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread David Nolen
On Mon, Oct 10, 2011 at 2:43 PM, Steve Miner wrote: > I've just been playing around a bit with match so please forgive me if I've > missed some prior discussions regarding issues that are considered settled. > > One of my first attempts was to match a vector of two of the same thing > using a pat

Re: clojure.contrib.base64

2011-10-10 Thread Ben Smith-Mannschott
I've already figured out how it works and have found the same 2:1 ratio. (This time on my 1.4GHz MacBook Air; The previous tests were on a 2.4 GHz Core2Duo running Linux.) When I did the quick-and-dirty benchmarking this afternoon I used larger random inputs (1 to 8 MiB) allowing me to calculate a

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread Steve Miner
I've just been playing around a bit with match so please forgive me if I've missed some prior discussions regarding issues that are considered settled. One of my first attempts was to match a vector of two of the same thing using a pattern like [a a]. I naively thought that would imply an equal

Re: clojure.contrib.base64

2011-10-10 Thread Alexander Taggart
I see about a 50% increased throughput over apache commons-codec as well. I use the perf-base64 ns generate input data and output timing files to keep track of changes to the performance over time, lest a regression creep in. I'll add some documentation if you want to play with it. -- You re

Re: Is clojure.data.json compatible with 1.3?

2011-10-10 Thread Jim Crossley
Hi Daniel, Daniel writes: > If not, is there a lib I can leverage for this on 1.3? It works fine for me on 1.3. Jim -- 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

Re: clojure.contrib.base64

2011-10-10 Thread Ben Smith-Mannschott
Cool! I did some quick-and-dirty benchmarking of it this afternoon (GMT+2) and got between 50 and 70 MiB/s on my machine. The Apache implementation used for comparison by the unit tests came in at between 30 and 40 MiB/s. Impressive. I've since seen perf_base64.clj go in, though I'm not clear on

Re: Faster JSON library

2011-10-10 Thread Stuart Sierra
Patch welcome... ;) -S -- 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 patient with your first post. To unsubscribe from this gro

Re: Faster JSON library

2011-10-10 Thread Stuart Sierra
I think I got the permissions fixed... -S -- 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 patient with your first post. To unsubs

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread David Nolen
On Mon, Oct 10, 2011 at 12:08 PM, Daniel Pittman wrote: > On Mon, Oct 10, 2011 at 06:57, David Nolen wrote: > > On Sun, Oct 9, 2011 at 11:19 PM, Ambrose Bonnaire-Sergeant < > abonnaireserge...@gmail.com> wrote: > >> On Mon, Oct 10, 2011 at 3:31 AM, David Nolen > wrote: > >>> > >>> - return nil i

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread Daniel Pittman
On Mon, Oct 10, 2011 at 06:57, David Nolen wrote: > On Sun, Oct 9, 2011 at 11:19 PM, Ambrose Bonnaire-Sergeant > wrote: >> On Mon, Oct 10, 2011 at 3:31 AM, David Nolen wrote: >>> >>> - return nil instead of throwing if no match found to mirror the behavior >>> of cond >> >> I don't like this. >

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread David Nolen
On Mon, Oct 10, 2011 at 10:56 AM, Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com> wrote: > How about: > > `match` - defaults to :seq, returns nil > > `match-debug` - defaults to :seq, w/ error checking, w/ comprehensiveness > check > > `matchv` - defaults to :vector > > Ambrose > I think

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread David Nolen
On Mon, Oct 10, 2011 at 10:28 AM, Rob Lally wrote: > If it only makes the non-vector seq case slower, I'd certainly make that an > available option - people are going to have to manually convert other > sequences into vectors anyway which creates a coding overhead and also makes > the code less l

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread David Nolen
On Mon, Oct 10, 2011 at 10:53 AM, Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com> wrote: > > > On Mon, Oct 10, 2011 at 10:28 PM, Rob Lally wrote: > >> Would supporting other data structures make it slower when using vectors, >> or only when using non-vector seq's? >> > > If we use :seq p

Re: Faster JSON library

2011-10-10 Thread Lars Nilsson
On Mon, Oct 10, 2011 at 11:19 AM, Lars Nilsson wrote: > On Fri, Oct 7, 2011 at 4:20 PM, Stuart Halloway > wrote: >>> Trying to be a little bit constructive here, in case I come across as >>> complaining, I took the source for c.d.json and put it into a >>> leiningen project, enabled warn on refle

Re: Faster JSON library

2011-10-10 Thread Lars Nilsson
On Fri, Oct 7, 2011 at 4:20 PM, Stuart Halloway wrote: >> Trying to be a little bit constructive here, in case I come across as >> complaining, I took the source for c.d.json and put it into a >> leiningen project, enabled warn on reflection, and found that several >> cases of (... (let [c (char i

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread Ambrose Bonnaire-Sergeant
How about: `match` - defaults to :seq, returns nil `match-debug` - defaults to :seq, w/ error checking, w/ comprehensiveness check `matchv` - defaults to :vector Ambrose -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send e

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread Ambrose Bonnaire-Sergeant
On Mon, Oct 10, 2011 at 10:28 PM, Rob Lally wrote: > Would supporting other data structures make it slower when using vectors, > or only when using non-vector seq's? > If we use :seq pattern matching, it will use first/rest. This can be very expensive. Vectors will take a performance hit. :vect

Re: How to Collapse Nested Map into a Sequence of Flat Maps

2011-10-10 Thread Ari
> Your input isn't a legal Clojure form, and the correlation between > input and output is difficult to spot, so it is hard to guess what you > mean. Sorry about the malformed map, a correctly formed map follows: {"a" {2011 [["a" 2011 "ari"] ["a" 2011 "dan"]], 2010 [["a" 2010 "jon"]]}} Now as f

Is clojure.data.json compatible with 1.3?

2011-10-10 Thread Daniel
If not, is there a lib I can leverage for this on 1.3? -- 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 patient with your first po

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread Rob Lally
Would supporting other data structures make it slower when using vectors, or only when using non-vector seq's? If it makes it substantially slower across the board, personally I'd still like core.match to support all of clojure's built in data structures; but I could understand why people would

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread David Nolen
On Mon, Oct 10, 2011 at 3:46 AM, Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com> wrote: > While we're on the topic of conventions, I think the most important > convention match is breaking > is using the destructuring syntax to mean something less generic by default > (only vectors). > >

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread David Nolen
On Sun, Oct 9, 2011 at 11:19 PM, Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com> wrote: > > > On Mon, Oct 10, 2011 at 3:31 AM, David Nolen wrote: > >> - return nil instead of throwing if no match found to mirror the behavior >> of cond >> >> > I don't like this. > I'm definitely open to

Re: Is there a clojure counterpart for java.lang.String indexOf method?

2011-10-10 Thread jingguo
Thanks for your clarification. On Oct 9, 11:47 pm, Stephen Compall wrote: > On Sun, 2011-10-09 at 07:36 -0700, jingguo wrote: > > Does clojure has a API for this? I have checked clojure.core and > > clojure.string. > > It seems that clojure does not have a counterpart for indexOf. > > No, it does

Re: clojure.contrib.base64

2011-10-10 Thread Stuart Sierra
Cool! That would make a sweet example of "Clojure is fast at primitives." -S -- 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 patie

Re: clojure.contrib.base64

2011-10-10 Thread Stuart Halloway
> On Sunday, 9 October 2011 19:49:17 UTC-7, Stuart Sierra wrote: > Clojure unless somebody clever can make one that's actually *faster* than the > best Java lib. > > Here ya go: https://github.com/ataggart/clojure.data.codec I owe you a beer for the offset and length args. Thanks! Stu Stuart

Re: Macro tutorials?

2011-10-10 Thread Nicolas
A good book to learn lisp macros, is On Lisp from Paul Graham. This book really cover advanced topics and concepts, and has many chapters related to macros. The book is freely available in online format from Paul Graham Website: http://www.paulgraham.com/onlisp.html On Oct 6, 1:02 pm, Michael Jaa

Re: where can I find the official statement about changes from 1.2 to 1.3?

2011-10-10 Thread Lars Rune Nøstdal
https://github.com/clojure/clojure/blob/1.3.x/changes.txt I think. -- 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 patient with yo

Re: clojure.contrib.base64

2011-10-10 Thread Alexander Taggart
On Sunday, 9 October 2011 19:49:17 UTC-7, Stuart Sierra wrote: > > Clojure unless somebody clever can make one that's actually *faster* than > the best Java lib. > Here ya go: https://github.com/ataggart/clojure.data.codec -- You received this message because you are subscribed to the Googl

ANN: clj-vorbis

2011-10-10 Thread mac
Hello all. I have made a small clojure wrapper around the jorbis library from jcraft (for decoding ogg vorbis compressed audio). I'm planning to maybe use it as a component in a small game library but I made it as a stand alone library because it could really be useful in any app dealing with audio

Re: inconsistent results from String.valueOf

2011-10-10 Thread Alexander Taggart
It's precisely the behaviour you would get by calling String.valueOf(null) in java. Nulls match to the most specific parameter type in a given hierarchy, and in this case, that would be char[] instead of Object. If the param types were not in the same hierarchy, say char[] and String, then you

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread Ambrose Bonnaire-Sergeant
I've come up with some better reasons to return nil. - smaller generated code size - cleaner implementation of which the latter is the most significant. While we're on the topic of conventions, I think the most important convention match is breaking is using the destructuring syntax to mean som