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)
-
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"
Cool :) highlight-parentheses.el does this as well, it's just a flag.
On Thu, May 14, 2009 at 1:01 PM, Chris Stucchio wrote:
>
> 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
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"
:user "read"
:password "swordf
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 wrote:
> This works really well:http://nschum.de/src/emacs/highlight-parentheses/
--~--~-~--~~~--
> 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 imp
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 clojure@goog
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 escapin
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 defin
A couple of months late to this discussion, but I thought I'd throw in
my 2¢: annotations are pretty important for more things than just
filling in deficiencies in Java.
For example, SIP Servlets 1.1 — finalized in August 2008 — actively
discourages the use of deployment descriptor entries in fav
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, etc)
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
Hello All,
I think it's a good idea to add the subversion revision to *clojure-
version*.
The below patch will work once someone does "svn ps svn:keywords
Revision core.clj".
Index: src/clj/clojure/core.clj
===
--- src/clj/clojure
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 (unchec
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 wrot
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 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 your byte-array-contains
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 [
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
puttin
NM, huge difference in performance even with the cast.
Old version:
(time (dotimes [_ 1000] (byte-array-contains? header 0xFE)))
"Elapsed time: 337.312 msecs"
New version:
(time (dotimes [_ 1000] (byte-array-contains? header 0xFE)))
"Elapsed time: 4.278 msecs"
On that note, is there a native
If that's the case, would I even get a performance increase, or would
the cast overhead cost more than the implicit reflection?
On May 14, 11:32 am, David Nolen wrote:
> This baffled me as well. You need to cast to int.
>
> On Thu, May 14, 2009 at 11:22 AM, tmountain wrote:
>
> > I'm trying to
This baffled me as well. You need to cast to int.
On Thu, May 14, 2009 at 11:22 AM, tmountain wrote:
>
> 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 0x
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 primitiv
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 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 delimiters is rarely e
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 delimiters is rarely enough in my experience.
That would be wonderful. I have wrapped OpenCSV for my own purposes
but would of course prefer not having another li
> Recursively summing all the elements in a tree:
> user=>(tree-apply #(reduce + %) true true atree)
> 28
> user=>(tree-apply #(reduce + %) true true btree)
> 34
>
> I think these are generally useful, so I'm just looking for some
> feedback and possible inclusion in contrib. Thanks!
Please do
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. Wo
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
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 manipu
On Tue, May 12, 2009 at 5:36 PM, Laurent PETIT 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 discussion:
>
> Currently
Hello!
I'm new to clojure and new to lisp, so I'm still getting accustomed to
working functionally and I'm trying to take advantage of clojure's
sequences when appropriate.
I'm working on a project to display a variety of measurements and
comparing values across various intervals. I'm pull
On Thu, May 14, 2009 at 1:57 AM, Stuart Sierra
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., Zavrtnica 17, Zagreb
tel:
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 lev
Hi,
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 ...) ?
(Ah, and I find that the name reduce here is a bit misleading, since the
operation really does a mapping from a tree to another ?
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 wrote:
>
> Hello again everyone
34 matches
Mail list logo