Re: clojure-contrib master now in submodules

2010-08-21 Thread Tom Faulhaber
A couple of questions: 1) Does use of clojure-contrib now require maven or leinigen as a prerequisite or is there a place to go grab the jar files? 2) From my read of this, there is no longer a clojure-contrib.jar, just a meta dependency that causes maven to grab all the modules. Is that correct?

Re: Implementing a protocol with using a base implementation?

2010-08-21 Thread tbatchelli
That was it. I didn't think that calling the method directly on the record would use reflection. (dotimes [_ 10] (time (dotimes [_ 1] (m1 my-simple-P "hello" "Elapsed time: 14.765 msecs" "Elapsed time: 5.347 msecs" "Elapsed time: 21.427 msecs" "Elapsed time: 7.267 msecs" "Elapsed time: 2.

Re: Simple Regex Question

2010-08-21 Thread David Sletten
Does this make the processing a little clearer? #"(?<=([ ab]))?([ab])\2*" Have all good days, David Sletten On Aug 21, 2010, at 10:02 PM, CuppoJava wrote: > Wow that's so short! Thanks Chouser! I will abstain from showing the > awful hack that I've been working with currently. > -Patrick > > O

Re: Simple Regex Question

2010-08-21 Thread CuppoJava
Wow that's so short! Thanks Chouser! I will abstain from showing the awful hack that I've been working with currently. -Patrick On Aug 21, 8:45 pm, Chouser wrote: > On Sat, Aug 21, 2010 at 7:11 PM, CuppoJava wrote: > > Hi Everyone, > > > I'm extremely stuck on this simple regex question, which

Re: Simple Regex Question

2010-08-21 Thread Chouser
On Sat, Aug 21, 2010 at 7:11 PM, CuppoJava wrote: > Hi Everyone, > > I'm extremely stuck on this simple regex question, which I'm sure > someone with a little more experience will be able to write in a > second. I would really appreciate the help. > > Given a string consisting of a's, b's, and spa

Simple Regex Question

2010-08-21 Thread CuppoJava
Hi Everyone, I'm extremely stuck on this simple regex question, which I'm sure someone with a little more experience will be able to write in a second. I would really appreciate the help. Given a string consisting of a's, b's, and spaces: "aaa bbb abb ab bb" I want to tokenize this into string'

Re: Implementing a protocol with using a base implementation?

2010-08-21 Thread Meikel Brandmeyer
Hi, Am 21.08.2010 um 07:33 schrieb Toni Batchelli: > (dotimes [_ 10] (time (dotimes [_ 1] (.m1 my-simple-P "hello" ; > > "Elapsed time: 131.973 msecs" I think you get caught by reflection here. As Nicholas said, you should call m1, not .m1. Sincerely Meikel -- You received this me

Re: Processing large binary file?

2010-08-21 Thread gary ng
On Sat, Aug 21, 2010 at 10:32 AM, Nicolas Oury wrote: > I am not sure but I think filter will always output a sequence. filter is lazy but the function like (byte-array ..) would still realize the sequence(i.e. list created) then copy. (byte-array (count (filter ...)) (filter ...)) should work, a

Re: Leiningen 1.2.0 released

2010-08-21 Thread Brian Carper
On Aug 21, 1:04 am, "evins.mi...@gmail.com" wrote: > Up til now, I've avoided using ELPA (it doesn't play nicely with my 25 > years' worth of Lisp-oriented emacs customizations). It may be helpful > for other hoary old lisp hackers to know that you really want to use > ELPA with lein, no matter ho

Re: date serialization in clojure-contrib json

2010-08-21 Thread Stuart Sierra
I suppose one could override the (private) read-json-object function to transform maps after they are read, based on the presence of certain keys. But that would seriously complicate the reader. It's probably easier to transform the data after it comes back from the JSON parser. -S On Aug 20,

Re: Processing large binary file?

2010-08-21 Thread Nicolas Oury
I am not sure but I think filter will always output a sequence. You can either: - write filter-array using a loop/recur. - read/write lazily the file in a sequence and use sequence function. If it is possible in your situation, I would advise this one. On Sat, Aug 21, 2010 at 4:42 PM, Piotr 'Q

Re: gedit syntax highlighting for clojure.

2010-08-21 Thread Victor Olteanu
Thanks, I like gedit too as it's fast and easy to use. What about auto-indenting, any ideas about that? -V On Fri, Aug 20, 2010 at 8:30 PM, mitko wrote: > Apparently it is not that hard to create something that does decent > job for syntax highlighting for Clojure. It took me about 3-4 hours >

Re: Windows distribution for Leiningen 1.3.0

2010-08-21 Thread Shantanu Kumar
The lein.bat script is now updated in the sources if some of you want to give it a try. A summary about it is here: http://bit.ly/c4U2bI Regards, Shantanu On Aug 21, 12:45 am, Shantanu Kumar wrote: > Discovered a bug in the the bundle I uploaded, which I have fixed in > update-1: > > http://git

Re: Leiningen 1.2.0 released

2010-08-21 Thread Phil Hagelberg
On Sat, Aug 21, 2010 at 1:04 AM, evins.mi...@gmail.com wrote: > ELPA still hamstrings and lobotomizes my Common Lisp environment, so, > instead of loading either it or my usual environment at Emacs startup, > I now load a pair of M-x commands, one for loading the familiar and > comfortable Common

Re: gedit syntax highlighting for clojure.

2010-08-21 Thread Heinz N. Gies
There is clj-highlight :) On Aug 21, 2010, at 2:30 , mitko wrote: > Apparently it is not that hard to create something that does decent > job for syntax highlighting for Clojure. It took me about 3-4 hours > starting from zero knowledge. > > With that, and the other gedit plugins such as auto com

Processing large binary file?

2010-08-21 Thread Piotr 'Qertoip' Włodarek
I need to process large binary files, i.e. to remove ^M characters. Let's assume files are about 50MB - small enough to be processed in memory (but not with a naive implementation). The following code works, except it throws OutOfMemoryError for file as small as 6MB: (defn read-bin-file [file]

Re: let binding ~'=

2010-08-21 Thread Brian Goslinga
On Aug 21, 9:58 am, limux wrote: > Is where a canonical doc about ~' or I have to read the core.clj? ~' is not an actual thing. Note that `~expr is the same as expr, so `~'foo is the same as 'foo is the same as (quote foo), which when evaluated yields the symbol foo. -- You received this messag

Re: let binding ~'=

2010-08-21 Thread limux
Thanks, I remindered that it's a reader macro used to get the symbol itself exactly without namespace. Ok, I see! On 8月21日, 下午10时58分, limux wrote: > Is where a canonical doc about ~' or I have to read the core.clj? > > On 8月21日, 下午10时40分, Nicolas Oury wrote: > > > > > > > > > Clojure whitin a `(

Re: let binding ~'=

2010-08-21 Thread limux
Is where a canonical doc about ~' or I have to read the core.clj? On 8月21日, 下午10时40分, Nicolas Oury wrote: > Clojure whitin a `(...) context resolves the name space of symbols. > This is most often what you want and prevent some name collisions at > macro expension. > > But as binders can not be

Compilation fails in Clojure Box 1.2.0

2010-08-21 Thread Arie van Wingerden
Hi, when i compile the following little snippet (which i explicitly have saved before compiling) with C-c C-k (Compile/Load file) it always succeeds; however, when I use C-c M-k (Compile File) compilation always fails (i am sure i did save the file before compiling it). (ns nsp.tst (:refer-clo

Re: let binding ~'=

2010-08-21 Thread Nicolas Oury
Clojure whitin a `(...) context resolves the name space of symbols. This is most often what you want and prevent some name collisions at macro expension. But as binders can not be name-space resolved this do not allow to write: `(let [and ]) this would expand to (let [ns/and ...]) which is

Re: let binding ~'=

2010-08-21 Thread Joop Kiefte
it is a macro with a syntax quote, so all symbols are namespace-qualified. so = will actually be clojure.core/= the ~' removes this namespace-qualification, so it is rendered as just =. 2010/8/21 limux : > This is some code in a blog of William Gropper, the useage of ~'= > confused me, waiting so

let binding ~'=

2010-08-21 Thread limux
This is some code in a blog of William Gropper, the useage of ~'= confused me, waiting some more detailed explain, advanced thanks (defmacro filter [pred query] `(let [~'and (fn[& xs#] (apply str (interpose " AND " xs#))) ~'or (fn[& xs#] (apply str (interpose " OR " xs#))) ~'= (fn[x# y#] (sql-

gedit syntax highlighting for clojure.

2010-08-21 Thread mitko
Apparently it is not that hard to create something that does decent job for syntax highlighting for Clojure. It took me about 3-4 hours starting from zero knowledge. With that, and the other gedit plugins such as auto completion this becomes a pretty nice and usable editor. I set up few files and

Re: Getting Clojure into the workplace, how do you do it?

2010-08-21 Thread kerwin franks
Hi Martin, i am actually on the first chapter of my Clojure book and i am actually looking to use it for a currency trading algo that i have in mind. I will be using traditional technical indicators such as MACD and ATR. Do u have any pointers, such as opensource trading software that u used in con

Re: Leiningen 1.2.0 released

2010-08-21 Thread evins.mi...@gmail.com
On Aug 19, 10:39 pm, Phil Hagelberg wrote: > I just pushed out a new release of Leiningen, a Clojure build tool, > with lots of help from many contributors. > > This adds a couple new tasks (test! and interactive) and the ability to chain > tasks. It also allows for user-level init scripts and u

Re: Game development in Clojure

2010-08-21 Thread Nicolas Oury
Just my 2 cents: sometimes these algorithms are easier to implement by constructing an infinite lazy trees of all the game, and then independently writing a few strategy to explore the tree. John Hughes gives an example of that in Section 5 of "Why functional programming matters", that can be fo

Re: Implementing a protocol with using a base implementation?

2010-08-21 Thread Nicolas Oury
m1 I meant. Apologies. On Sat, Aug 21, 2010 at 8:36 AM, Nicolas Oury wrote: > On Sat, Aug 21, 2010 at 6:33 AM, Toni Batchelli wrote: >> P-impl.)) >> (dotimes [_ 10] (time (dotimes [_ 1] (.m1 my-simple-P "hello" ; >> "Elapsed time: 131.973 msecs" >> "Elapsed time: 142.72 msecs" >> "Elaps

Re: Implementing a protocol with using a base implementation?

2010-08-21 Thread Nicolas Oury
On Sat, Aug 21, 2010 at 6:33 AM, Toni Batchelli wrote: > P-impl.)) > (dotimes [_ 10] (time (dotimes [_ 1] (.m1 my-simple-P "hello" ; > "Elapsed time: 131.973 msecs" > "Elapsed time: 142.72 msecs" > "Elapsed time: 95.51 msecs" > "Elapsed time: 95.724 msecs" > "Elapsed time: 83.646 msecs" C