Re: Macrolet

2011-02-11 Thread Konrad Hinsen
On 11 Feb 2011, at 03:15, Ken Wesson wrote: (defmacro macrolet [fnspecs & body] `(macrolet* #{} ~fnspecs ~@body)) See also clojure.contrib.macro-utils/macrolet: https://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/macro_utils.clj It has both ma

Re: Problems with lazy-xml

2011-02-11 Thread Marko Topolnik
Right now I'm working with a 300k-record file, but the code must scale into the millions, and, as I mentioned, it is already spewing OutOfMemoy errors. Also, on a more abstract level, it's just not right to thrash the memory of a concurrent server-side component for absolutely no good reason. --

Re: Sorting of function definitions in namespaces

2011-02-11 Thread Benjamin Teuber
As a user coming from Haskell, I've always been disturbed by Clojure's C-like behavior at this point, so I'd agree with the OP. And of course the solution is not just reverse, as any order should be possible. The question is how one could implement this without raising more problems. Maybe a strat

Re: Problems with lazy-xml

2011-02-11 Thread Benny Tsai
Can you post a link to a (sanitized, if need be) sample file? On Feb 11, 1:21 am, Marko Topolnik wrote: > Right now I'm working with a 300k-record file, but the code must scale > into the millions, and, as I mentioned, it is already spewing > OutOfMemoy errors. Also, on a more abstract level, it'

Re: Sorting of function definitions in namespaces

2011-02-11 Thread Laurent PETIT
2011/2/11 Benjamin Teuber > As a user coming from Haskell, I've always been disturbed by Clojure's > C-like behavior at this point, so I'd agree with the OP. And of course > the solution is not just reverse, as any order should be possible. > of course :-) > > The question is how one could imp

Re: Problems with lazy-xml

2011-02-11 Thread Marko Topolnik
http://db.tt/iqTo1Q4 This is a sample XML file with 1000 records -- enough to notice a significant delay when evaluating the code from the original post. Chouser, could you spare a second here? I've been looking and looking at mktree and siblings for two days now and can't for the life of me find

Re: better error messages > smaller stack traces

2011-02-11 Thread Jeff Rose
Thanks Hubert, this is exactly what I'm talking about. D. Werner's recommendation to use a function call for the validation is a good point, but having a human readable message like this would be the most clear. Cheers, Jeff On Feb 10, 9:23 pm, Hubert Iwaniuk wrote: > Hi, > > Jeff correct me if

Re: Tricky Macro to write.

2011-02-11 Thread CuppoJava
I realized, actually, after your post Ken, that my implementation of macroexpand-all does not do exactly what I want. The properties of macroexpand-all, should be: (eval some-expression) is *always* equal to (eval (macroexpand-all some-expression)) This is not the case in my current implementati

Re: Sorting of function definitions in namespaces

2011-02-11 Thread Fogus
> Well... It is Robert C. Martin's opinion. Who? > I should have said that I _think_ that it is essential to > writing readable code. I definitely agree with this. Another thing that I happen to agree with is that Clojure's model fits my way of programming in Clojure. -- You received this mes

Handling of unsigned bytes

2011-02-11 Thread timc
How on earth is one supposed to do communication programming (not to mention handling binary files etc) without an unsigned byte type? I see that this issue has been talked about vaguely - is there a solution? Thanks -- You received this message because you are subscribed to the Google Groups "

Re: Handling of unsigned bytes

2011-02-11 Thread Andy Fingerhut
What can you not do with the signed byte type and arrays of bytes (Java byte[] and Clojure (byte-array ...))? I believe these are frequently used for Java I/O, and can be used for Clojure I/O as well. Andy On Feb 11, 2011, at 9:22 AM, timc wrote: How on earth is one supposed to do commun

Re: Handling of unsigned bytes

2011-02-11 Thread Miki
> How on earth is one supposed to do communication programming (not to > mention handling binary files etc) without an unsigned byte type? > > I see that this issue has been talked about vaguely - is there a > solution? > http://www.darksleep.com/player/JavaAndUnsignedTypes.html ? -- You

Installing Clojure-CLR 1.3 alpha on Win XP with .Net 4.0

2011-02-11 Thread Robin Munn
I just ran into an interesting problem installing the Clojure-CLR 1.3 alpha (https://github.com/downloads/richhickey/clojure-clr/clojure-clr-1.3.0-alpha1-debug-4.0.zip) on an XP machine with .Net 4.0 installed. Downloading and unzipping the .zip file, then running Clojure.Main.exe at a command-lin

Re: Problems with lazy-xml

2011-02-11 Thread Benny Tsai
I can confirm that the same thing is happening on my end as well. The XML is parsed lazily: user=> (time (let [root (parse-trim (reader "huge.xml"))] (-> root :content type))) "Elapsed time: 45.57367 msecs" clojure.lang.LazySeq ...but as soon as I try to do anything with the struct map for the D

Re: Help - .class files and GAE's "too many files" problem

2011-02-11 Thread jk
I don't know GAE but it's a web app right? Do you need to make a war file with a web.xml descriptor for it to find your servlet? On Feb 10, 9:19 pm, Edgar Gonçalves wrote: > Hi! > > I just realized there's this 3000 files limit we can upload on a WebApp to > Google's Application Engine (GAE). I a

Re: Sorting of function definitions in namespaces

2011-02-11 Thread semperos
To throw another opinion in the mix... Lisp programming encourages a "bottom-up" style of development. I feel this fits very naturally with Clojure's function-order requirements, as you build the "vocabulary" of your program starting with small units. Combined with logical separation of files a

Re: [SOLVED] Re: Help - .class files and GAE's "too many files" problem

2011-02-11 Thread semperos
Thanks for posting your solution. Asking a question and then providing an answer is no noise; I'm sure it will help folks with similar issues. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.c

Re: Help - .class files and GAE's "too many files" problem

2011-02-11 Thread Edgar Gonçalves
On Friday, February 11, 2011 3:42:30 AM UTC, jk wrote: > > I don't know GAE but it's a web app right? Do you need to make a war > file with a web.xml descriptor for it to find your servlet? > GAE is Google's Application Engine, a Python/Java webapp container that can be easily used to host Clo

Re: Handling of unsigned bytes

2011-02-11 Thread Stuart Sierra
Java doesn't have any unsigned types, and that's not really something we can change. Java libraries that need to do binary I/O tend to work with byte arrays and handle individual bytes as ints. -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Gr

Re: Problems with lazy-xml

2011-02-11 Thread Chris Perkins
On Feb 11, 5:07 am, Marko Topolnik wrote: > http://db.tt/iqTo1Q4 > > This is a sample XML file with 1000 records -- enough to notice a > significant delay when evaluating the code from the original post. > > Chouser, could you spare a second here? I've been looking and looking > at mktree and sibl

Re: Are variadic protocol functions supposed to work?

2011-02-11 Thread Stuart Sierra
It is not supported right now, and probably will not ever be supported. Protocol methods are intended to be a "low-level" mechanism, with higher-level APIs, including variable arity, built out of ordinary functions. -Stuart Sierra clojure.com -- You received this message because you are subs

Re: Handling of unsigned bytes

2011-02-11 Thread B Smith-Mannschott
On Fri, Feb 11, 2011 at 20:34, Stuart Sierra wrote: > Java doesn't have any unsigned types, and that's not really something we can > change.  Java libraries that need to do binary I/O tend to work with byte > arrays and handle individual bytes as ints. > -Stuart Sierra > clojure.com Well, except

Re: Problems with lazy-xml

2011-02-11 Thread Chouser
On Fri, Feb 11, 2011 at 2:35 PM, Chris Perkins wrote: > On Feb 11, 5:07 am, Marko Topolnik wrote: >> http://db.tt/iqTo1Q4 >> >> This is a sample XML file with 1000 records -- enough to notice a >> significant delay when evaluating the code from the original post. >> >> Chouser, could you spare a

Re: Sorting of function definitions in namespaces

2011-02-11 Thread gaz jones
>> Well... It is Robert C. Martin's opinion. >Who? 'uncle' bob martin: http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 Also, it's pretty easy to just reverse the level of abstraction ordering from bottom-to-top is it not? I usually jump to the bottom of the file to

Re: Tricky Macro to write.

2011-02-11 Thread Ken Wesson
On Fri, Feb 11, 2011 at 10:59 AM, CuppoJava wrote: > I realized, actually, after your post Ken, that my implementation of > macroexpand-all does not do exactly what I want. > > The properties of macroexpand-all, should be: > > (eval some-expression) is *always* equal to (eval (macroexpand-all > so

Re: Macrolet

2011-02-11 Thread Ken Wesson
On Fri, Feb 11, 2011 at 3:09 AM, Konrad Hinsen wrote: > At first glance, it seems that there are few more special forms that need > special treatment. I see fn*, let*, loop*, and try, but there is also > deftype* and reify* that have peculiar requirements Damn. Those weren't listed on any of the

Re: Anyone want to take a crack at making the fasta shootout program faster?

2011-02-11 Thread Isaac Gouy
Bill James doesn't seem to have had difficulty answering that question - "Both the C++ program and the Clojure program use a much more efficient algorithm than the other programs. That may violate the rules." But what about that fasta Java 6 -server #3 program? On Feb 10, 1:02 pm, Andy Fingerhu

Re: Anyone want to take a crack at making the fasta shootout program faster?

2011-02-11 Thread Andy Fingerhut
fasta.java-3.java calls the method next(), implementing the linear congruential generator, 200,000,000 times, once for each randomly generated DNA character in the output file. Andy On Feb 11, 2011, at 1:50 PM, Isaac Gouy wrote: Bill James doesn't seem to have had difficulty answering that

Re: Macrolet

2011-02-11 Thread Alan
Not exactly documentation, but https://github.com/clojure/clojure/blob/1.2.x/src/jvm/clojure/lang/Compiler.java#L37 On Feb 11, 1:38 pm, Ken Wesson wrote: > On Fri, Feb 11, 2011 at 3:09 AM, Konrad Hinsen > > wrote: > > At first glance, it seems that there are few more special forms that need > >

Newbie: What's your opinion about this Clojure code?

2011-02-11 Thread Nick Wiedenbrueck
I'm just starting to get into Clojure. After implementing some examples from various tutorials, I've tried to implement the following simple server application. Now I'd like you to have a look at the code and hear your opinion. What could be improved? What would be a more idiomatic way implement it

Re: Handling of unsigned bytes

2011-02-11 Thread jk
Well, until you start doing "bit-shift-right"s and the sign bit (high bit) doesn't go to 0 after shifting it down. Actually you typically need to represent individual bytes as ints and write them back out using writeByte() when you're trying to do low level bit-twiddling. It's a pain but it works.

Re: Macrolet

2011-02-11 Thread Ken Wesson
Significantly refactored and expanded to deal with various special forms, including case, reify, and deftype. Some edge cases fixed, all the ones I could find -- notably, the first test below the code confirms the fixing of one of these. Let me know of any more edge cases you find that need handlin

Re: Newbie: What's your opinion about this Clojure code?

2011-02-11 Thread James Reeves
On 11 February 2011 20:53, Nick Wiedenbrueck wrote: > I'm just starting to get into Clojure. After implementing some > examples from various tutorials, I've tried to implement the following > simple server application. Now I'd like you to have a look at the code > and hear your opinion. What could

metadata example on http://clojure.org/evaluation

2011-02-11 Thread Eugen Dück
There's an example on metadata that resembles a repl session snippet (although not exactly): user=> (def x 1) user=> (def y 2) user=> ^{:x x} [x y 3] ^{:x 1} [1 2 3] I interpret that as "the reader prints out meta data", which of course is not true (by default). It could be changed, e.g. to user

Re: ANN: Textmash - another IDE for Clojure

2011-02-11 Thread Olek
Hi! What is the status of paredit.clj in TextMash? Do you have any time for integration? I have moved project to lein in case anyone care. Editor pane is pretty much advanced, but still missing: encoding support, files managment, text transformations, multiple repl support and evaluation, brackets

Re: Handling of unsigned bytes

2011-02-11 Thread Richard Lyman
I have to deal with them when processing AMF packets, and I use the Netty library - it's amazing, you should look into it. http://www.jboss.org/netty -Rich On Fri, Feb 11, 2011 at 10:22 AM, timc wrote: > How on earth is one supposed to do communication programming (not to > mention handling bi

Re: ANN: Textmash - another IDE for Clojure

2011-02-11 Thread Shantanu Kumar
On Feb 12, 8:26 am, Olek wrote: > Hi! > > What is the status of paredit.clj in TextMash? Do you have any time > for integration? > I have moved project to lein in case anyone care. I ran TextMash on Windows 7 using Leiningen's (version 1.4) run task: D:\projects\checkout\textmash>lein run -m t