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:
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
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.,
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
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
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
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.
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
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
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
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
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
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
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
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
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,
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
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
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
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
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/
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
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)
--
23 matches
Mail list logo