Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread David Nolen
I'm just following what seemed to be a convention - https://github.com/clojure/core.unify/blob/master/src/main/clojure/clojure/core/unify.clj On Sun, Oct 9, 2011 at 7:17 PM, Alan Malloy a...@malloys.org wrote: On Oct 9, 12:31 pm, David Nolen dnolen.li...@gmail.com wrote: I've removed some

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

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

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

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 Google

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

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

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: 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 patient

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 stephen.comp...@gmail.com 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

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 dnolen.li...@gmail.comwrote: - return nil instead of throwing if no match found to mirror the behavior of cond I don't like this. I'm definitely

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). (match

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

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

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 for the

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 rob.la...@gmail.com 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

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

Re: Faster JSON library

2011-10-10 Thread Lars Nilsson
On Fri, Oct 7, 2011 at 4:20 PM, Stuart Halloway stuart.hallo...@gmail.com 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

Re: Faster JSON library

2011-10-10 Thread Lars Nilsson
On Mon, Oct 10, 2011 at 11:19 AM, Lars Nilsson chamael...@gmail.com wrote: On Fri, Oct 7, 2011 at 4:20 PM, Stuart Halloway stuart.hallo...@gmail.com 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

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 rob.la...@gmail.com 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

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 we can just

Re: ANN: core.match 0.2.0-alpha5

2011-10-10 Thread Daniel Pittman
On Mon, Oct 10, 2011 at 06:57, David Nolen dnolen.li...@gmail.com 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 dnolen.li...@gmail.com wrote: - return nil instead of throwing if no match found

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 dan...@rimspace.netwrote: On Mon, Oct 10, 2011 at 06:57, David Nolen dnolen.li...@gmail.com 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

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

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

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

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: 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

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

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 stevemi...@gmail.com 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

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

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 stevemi...@gmail.com 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

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.

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

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

2011-10-10 Thread Lee Spector
A weakness of my pmapall: #Exception java.lang.Exception: Can't await in agent action 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

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])

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

Re: statistics library?

2011-10-10 Thread Ben Evans
Hi Lee, On Wed, Sep 28, 2011 at 12:43 AM, Lee Spector lspec...@hampshire.edu 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.

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),

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

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

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 dnolen.li...@gmail.com: As a language - not much

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 pattern in a

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: 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 [^Integer

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 lspec...@hampshire.edu 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

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

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 you,

Libraries supporting 1.31.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: Libraries supporting 1.31.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 mar...@exampler.com wrote: I may be missing something obvious. Midje has a checker that lets users say things like   (fact

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 jon] ] } } I'd

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 st...@localtoast.orgwrote: 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

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: 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 - please

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

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

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 zippy.314@gmail.com

Re: Libraries supporting 1.31.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 mar...@exampler.com 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

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 stephen.comp...@gmail.com 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.

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