Re: str-utils change proposal, round 2

2009-05-14 Thread Wilson MacGyver
would you consider adding support of a split by passing a delimiter? since parsing csv/tsv is a pretty common task. I know it can be done by using re-split. but it seems to occur common enough that it's not a bad idea. On Thu, May 14, 2009 at 1:12 AM, Sean Devlin francoisdev...@gmail.com wrote:

Re: tree-utils

2009-05-14 Thread Konrad Hinsen
On 14.05.2009, at 09:22, Laurent PETIT wrote: Isn't tree-reduce similar to clojure.contrib.generic.functor/fmap (though fmap preserves the type of the structure, while your function returns seqs of seqs ...) ? fmap is not recursive. When given a list, it would only act at the top

Re: Extending clojure.contrib.json.write/print-json

2009-05-14 Thread Josip Gracin
On Thu, May 14, 2009 at 1:57 AM, Stuart Sierra the.stuart.sie...@gmail.com wrote: The latest version of c.c.json dispatches on the type function, which in turn uses class.  It should be pretty easily extendible. Thanks! -- mr.sc. Josip Gracin, dipl.ing. direktor razvoja Inge-mark d.o.o.,

Re: Concerns About Pushing Clojure 1.0.0 to Maven Central Repo?

2009-05-14 Thread Rich Hickey
On Tue, May 12, 2009 at 5:36 PM, Laurent PETIT laurent.pe...@gmail.com wrote: Hello, It seems that it's really a matter of convention, I don't see any technical problem of having a groupId of org.clojure and an artifactId of clojure. Please let me try to summarize this never ending

Re: str-utils change proposal, round 2

2009-05-14 Thread Sean Devlin
I guess I don't quite see what you're asking for. If I understand you right, here's how I would do your task today: (def input-string (slurp My File.csv)) ;And using my re-split fn... (re-split input-string '(#[\r\n] #,)) This would return a list of rows cols, and could then be manipulated

Re: str-utils change proposal, round 2

2009-05-14 Thread Stuart Halloway
FYI: I am working on an open-source CSV parser in Clojure. Splitting on delimiters is rarely enough in my experience. Stu would you consider adding support of a split by passing a delimiter? since parsing csv/tsv is a pretty common task. I know it can be done by using re-split. but it

Re: str-utils change proposal, round 2

2009-05-14 Thread Sean Devlin
Stuart, Excellent point about delimiters, parsing CSV is much more sophisticated than my simple s-exp. However, since you're writing a parser you've worked with strings a lot :) I use something like str-take/str-drop all the time in my parsers. So if you could answer a few questions... 1.

Re: str-utils change proposal, round 2

2009-05-14 Thread Sean Devlin
Hmmm... it sounds like there would be use for a string table utils or something like that. On May 14, 11:12 am, Daniel Lyons fus...@storytotell.org wrote: On May 14, 2009, at 7:14 AM, Stuart Halloway wrote: FYI: I am working on an open-source CSV parser in Clojure. Splitting on

Help with Type Hint

2009-05-14 Thread tmountain
I'm trying to optimize some code I've written, and I have set warn on reflection as advised. I'm having a hard time getting a simple statement to avoid reflection. user= (== (byte 0x1) (byte 0x1)) Reflection warning, line: 33 - call to equiv can't be resolved. Can you use type hints on

Re: Help with Type Hint

2009-05-14 Thread David Nolen
If you're going to do that you're going to need to create a let binding which type-hints coll to bytes in your byte-array-contains? If you're going to be doing this a lot in your code I'd recommend making a helper class in Java. loop/recur is fast, but for absolute speed, you just can't beat

Re: str-utils change proposal, round 2

2009-05-14 Thread Meikel Brandmeyer
Hi, Am 14.05.2009 um 17:12 schrieb Daniel Lyons: That would be wonderful. I have wrapped OpenCSV for my own purposes but would of course prefer not having another library dependency. My code wound up like this: (import 'java.io.FileReader 'au.com.bytecode.opencsv.CSVReader)) (defn read-csv

Re: Help with Type Hint

2009-05-14 Thread tmountain
Thanks for all the helpful advice. I may consider rewriting key portions in Java if performance becomes an issue. Travis On May 14, 12:10 pm, David Nolen dnolen.li...@gmail.com wrote: If you're going to do that you're going to need to create a let binding which type-hints coll to bytes in

Re: Help with Type Hint

2009-05-14 Thread Boris Mizhen - 迷阵
Please correct me if I'm wrong, but my understanding is that Clojure compiler can produce bytecode equivalent to compiled Java code. I think the right approach would be to figure out how to do this in Clojure for the cases like this. Rich? Boris On Thu, May 14, 2009 at 2:25 PM, tmountain

Re: Help with Type Hint

2009-05-14 Thread Dimiter malkia Stanev
This is the best I was able to come up with in Clojure: (defn byte-array-contains? [coll key] scans a byte array for a given value (let [c (int (count coll)) k (byte key)] (loop [i (int 0)] (if ( i c) (if (= k (aget coll i)) true (recur

Re: Adding :svn to *clojure-version*

2009-05-14 Thread lazy1
Also at http://paste.lisp.org/display/80244 --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to

3D Grapher in Clojure

2009-05-14 Thread Curran Kelleher
Greetings, I have had success writing a 3D graphing program in Clojure, which parses a user defined parametric function (of the form (x,y,z) = f (u,v)) and renders it as a freely rotatable 3D surface (using OpenGL). The full source code is posted here (public domain, feel free to use, copy,

Re: Help with Type Hint

2009-05-14 Thread Kevin Downey
so I took a look at with this code: http://gist.github.com/111935 output: :original Elapsed time: 369.683 msecs :redux-1 Elapsed time: 11672.329 msecs :redux-2 Elapsed time: 74.233 msecs as to why there is such a huge difference between your code and redux-2 I am not sure. I would definitely

Re: str-utils change proposal, round 2

2009-05-14 Thread Wilson MacGyver
it sounds like what I'm looking for will be served by Stu's csv parser in clojure. the other need that comes to mind was stripping the annoying Microsoft's smart quote characters. ie, replace them with regular quote marks. This came to mind because I saw your string functions have html escaping

Why do Refs implement IFn and Atoms don't?

2009-05-14 Thread David Nolen
Just curious about the reasoning behind this decision? ((ref +) 3 4) ; - 7 ((atom +) 3 4) ; Exception --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: str-utils change proposal, round 2

2009-05-14 Thread Daniel Lyons
I'm doing the same. I cannot judge the quality of OpenCVS but up to now I had no problems. I thought about using fnparse to build a clojure CSV parser, but I'm not sure how hard this would be. Let's see with what Stuart comes up. CSV parsing is a headache because there are so many

Re: Colored parentheses highlighting for Emacs Clojurians

2009-05-14 Thread Chris Stucchio
Very nice. See also hl-sexp, which highlights the entire sexp, rather than merely the parenthesis. http://edward.oconnor.cx/elisp/hl-sexp.el On May 13, 5:53 pm, David Nolen dnolen.li...@gmail.com wrote: This works really well:http://nschum.de/src/emacs/highlight-parentheses/

Re: OutOfMemoryError with clojure.contrib.sql and large result sets

2009-05-14 Thread Stephen C. Gilardi
On May 14, 2009, at 7:13 PM, Ian Eure wrote: I'm trying to process mid/large result sets with Clojure, and not having any success. (ns foo (:require [clojure.contrib.sql :as sql])) (def *db* {:classname com.mysql.jdbc.Driver :subprotocol mysql :subname //DSN

Re: Why do Refs implement IFn and Atoms don't?

2009-05-14 Thread Christophe Grand
David Nolen a écrit : Just curious about the reasoning behind this decision? ((ref +) 3 4) ; - 7 ((atom +) 3 4) ; Exception Last time I asked, Rich said to not rely on refs implementing IFn. (It may be a remain from the time where vars and refs were the same thing -- just guessing) --