update-in for every function call might slow things down considerably.
Maybe using an atom referencing to native Java array for counts is
better (in which swap! would just use aset to new count)
On Jan 31, 5:45 pm, "Stephen C. Gilardi" wrote:
> On Jan 31, 2010, at 8:35 AM, Gabi wr
Is there any efficient way to get the number of times a given
function was executed (in run time not during profiling)? Maybe with
some clever use of its metadata ?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to
I wonder what is the difference between the two. Is there a
difference?
I want do define/intern functions at runtime. Which should I use ?
--
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
No
Superb. Getting a fix so fast.. Open Source at its best!
I tried it. Works as expected.
On Jan 27, 8:50 pm, Chouser wrote:
> On Wed, Jan 27, 2010 at 1:00 PM, Rich Hickey wrote:
>
> > On Jan 27, 11:22 am, Chouser wrote:
> >> On Wed, Jan 27, 2010 at 4:03 AM, Gabi wrote:
Yes Rich, Please approve this patch!
On Jan 27, 6:22 pm, Chouser wrote:
> On Wed, Jan 27, 2010 at 4:03 AM, Gabi wrote:
> > This exception is the biggest time waster for me when working with
> > Clojure. It doesn't give you a hint of where the problem really is.
> > I s
This exception is the biggest time waster for me when working with
Clojure. It doesn't give you a hint of where the problem really is.
I strongly suggest to improve parse error messages to contain
meaningful info.
--
You received this message because you are subscribed to the Google
Groups "Cloju
As a side note, I didn't see anywhere in clojure docs that cyclic
references are forbidden.
And if it is forbidden, the Exception raised by the runtime should
reflect this instead of the odd "No
such var->.." exception
On Jan 24, 10:44 pm, Laurent PETIT wrote:
> Some software principle are certai
Sorry, I meant (cp/classpath) ..
On Jan 24, 6:06 pm, Gabi wrote:
> Maybe try
> (ns my (:require [clojure.contrib.classpath :as cp]))
> (cp.classpath)
>
> On Jan 24, 5:28 pm, Manfred Lotz wrote:
>
> > Hi all,
> > I'm stumbling about the very basics.
>
>
Maybe try
(ns my (:require [clojure.contrib.classpath :as cp]))
(cp.classpath)
On Jan 24, 5:28 pm, Manfred Lotz wrote:
> Hi all,
> I'm stumbling about the very basics.
>
> Calling clojure like this:
>
> rlwrap java
> -cp
> /home/manfred/clojure/clojure.jar:/home/manfred/clojure/clojure-contrib.j
ferent
> files. You can just (load) one from the other to include its content
> into the same namespace, but still have the namespace separated into
> several files.
> * maybe move the common parts of a and be into a third namespace c
> * ...
>
> Maybe if you give more info con
This thing is driving me nuts. If I do a cyclic require(ns-a requires
ns-b and ns-b requires ns-a) I get exceptions complaining about "No
such var->.."
How can cyclic dependencies be done correctly in Clojure ? I know it
might be bad practice. But I really need it.
--
You received this message b
Be careful of deftrace. It has a bug that crashes when the defn'ed
funcs have string comment on the top of the func
On Jan 23, 7:02 am, ataggart wrote:
> On Jan 22, 6:27 pm, Mike Meyer
>
>
> 620...@mired.org> wrote:
> > On Fri, 22 Jan 2010 17:25:39 -0800
>
> > ajay gopalakrishnan wrote:
> > > I
I don't think zipper would help in this case
On Jan 21, 12:40 am, brianh wrote:
> Any chance you could rethink your approach & use a zipper?
>
> On Jan 20, 9:32 am, Gabi wrote:
>
> > I posted a question on SO about it. Interesting
> > discussion:http://st
atness will make up for it?
>
> > On Jan 20, 10:15 am, Gabi wrote:
> >> I need to add/delete much more frequently than just updating
> >> actually.
>
> >> On Jan 20, 4:59 pm, Sean Devlin wrote:
>
> >> > Gabi,
> >> > A similar technique
Can you elaborate more ? How can trees be represented in sorted sets?
On Jan 20, 5:24 pm, Sean Devlin wrote:
> How about a sorted set w/ a custom comparator? Of course, this rules
> out transients, but maybe the flatness will make up for it?
>
> On Jan 20, 10:15 am, Gabi wrote:
>
I need to add/delete much more frequently than just updating
actually.
On Jan 20, 4:59 pm, Sean Devlin wrote:
> Gabi,
> A similar technique is used with sparse matrices. You usually have
> severals arrays, one for the non-zero elements, and another one for
> indexing the column and
rithm for this ? Representing and traversing non binary trees as
one dimensional vector?)
Jan 20, 12:53 pm, Christophe Grand wrote:
> Hi Gabi!
>
> Can you tell us more about your problem, what do those deeply nested
> vectors represent and how are you going to update them? (are all
>
Guys, I really need your expertise here.
I have lots of deeply nested vectors, which i need to manipulate
frequently (thousands of times)
What is the most effective way to do this ?
On Jan 17, 4:27 pm, Gabi wrote:
> Right. I thought that transient performing deep 'transientivity'
I was wondering about that myself but was too embarrassed to ask :)
On Jan 17, 8:39 am, itsnotvalid wrote:
> Just started learning Clojure a day ago with Stuart's book I found
> that Clojure doesn't do tail recursion optimization, not at least for
> the most simplest form. Instead the call must b
ate-in!! (get m k)
ks f args)))
(persistent!(assoc! (transient m) k (apply f (get m k) args))
On Jan 17, 3:57 pm, Chouser wrote:
> On Sun, Jan 17, 2010 at 8:25 AM, Gabi wrote:
>
> >> user=> (persistent!(update-in!(transient v) [0] reverse))
>
> > Forgot to m
Forgot to mention that v in the example is defined to [[1 2] [3 4]]
On Jan 17, 3:19 pm, Gabi wrote:
> I really needed an update-in! version that works on transients. I
> couldn't find one so I just modified the original update-in core (just
> replaced "assoc" "
I really needed an update-in! version that works on transients. I
couldn't find one so I just modified the original update-in core (just
replaced "assoc" "assoc!"):
(defn update-in!
"modified version of core/update-in that works on, and return
transients"
([m [k & ks] f & args]
(if ks
said, partition is probably what you want.
>
> On Jan 12, 4:12 am, Jarkko Oranen wrote:
>
> > On Jan 12, 11:08 am, Gabi wrote:
>
> > > What's the idiomatic Clojure way for extracting values/keys from a
> > > binding form vector [key1 val1 key2 val2..] ?
What's the idiomatic Clojure way for extracting values/keys from a
binding form vector [key1 val1 key2 val2..] ?
--
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
Note that posts from new me
Maybe you can post here an example code of how you used it ? Maybe I
missed something?
On Jan 9, 10:38 pm, Laurent PETIT wrote:
> Weird, it used to work for me when I tested it. And it appears it also
> worked for some people on the thread ...
>
> 2010/1/9 Gabi :
>
> > Y
Just found an easy and stupid way. Using Kate editor:
1, Tools->indentation->Lisp
2. Select the whole text and do Tools ->Align
On Jan 9, 10:17 pm, Gabi wrote:
> Yes. Didn't work. Even after fixing a bug in it (complained about
> Character/isWhitespace ) it produced garbag
Yes. Didn't work. Even after fixing a bug in it (complained about
Character/isWhitespace ) it produced garbage
On Jan 9, 3:00 pm, Laurent PETIT wrote:
> Have you tried what I wrote in my above post ?
>
> 2010/1/9 Gabi :
>
> > I really hate emacs. And the solution in
>
way to format lisp/clojure ?
On Dec 23 2009, 7:22 pm, Stefan Kamphausen
wrote:
> Hi,
>
> On Dec 22, 11:48 am, Gabi wrote:
>
> > I need a simple command-line tool to indent Clojure source files.
> > Any recommendation ?
>
> there was a post to a ruby script for s
cking \
-XX:PermSize=64M \
-XX:MaxPermSize=256M \
-Xmx2g"
Now my app consumes ~500M of resident memory, but at least does not
crash and performance does not deteriorate.
BTW, I also tried the 'new' branch suggested . Didn't see any
noticeable effect.
On Jan 8, 4:40 am, Seth wrote:
&g
Thanks I'll try those flags. I indeed use 64 bits
On Jan 7, 6:47 pm, kyle smith wrote:
> First, make sure you have -server. If you can spare more heap, use -
> Xmx1g . If you're on a 64bit jvm, -XX:+UseCompressedOops adds a
> significant boost. A flag that helps quite a bit is -XX:
> +DoEscapeAna
he problem, but I am interested in your
experience and best practices regarding JVM flags in clojure.
I know it really depends on the type of the application, but it seems
to me that the gc is working really hard under Clojure (I cannot prove
it, this is just an impression)
Gabi
--
You rec
in javascript,
> where you can change every method implementation of every object,
> because you would like the method implementation to be chosen
> depending on the caller of the method, not just the callee or a
> function of the other arguments of the method ...
>
> HTH,
>
>
ose types you want to provide with your own
> implementation of defmethod ...
>
> Cant' think of something better, for now ...
>
> HTH,
>
> --
> Laurent
>
> 2010/1/5 Gabi :
>
> > Hi
> > I am trying to extend Clojures' print-method using defmethod fo
Hi
I am trying to extend Clojures' print-method using defmethod for a
library I develop.:
How can I do this without affecting users of my lib (i want only my
lib to be affected )?
(derive clojure.lang.Fn ::fn)
(prefer-method print-method ::fn java.lang.Object)
(defmethod print-method ::fn
[o
pressed interest.
>
> That's part of what it does, using the reader/printer representation.
>
> Alternatives would include standard Java binary serialisation or 3rd party
> libraries (Hessian/Burlap?).
>
> -Steve
>
> On 4 Jan 2010, at 12:15, Gabi wrote:
>
&g
What if I wanted to use Redis just persist binary (serialized) clojure
objects ?
What's the easiest (and fastest) way to serialize/de-serialize vectors
or lists in Clojure ? (so the can stored as blobs in Redis)
On Jan 4, 12:59 pm, Gabi wrote:
> Maybe, though I would avoid dis
Maybe, though I would avoid distributed transactions as much as
possible. They are complex and slow creatures.
On Jan 4, 12:51 pm, Shantanu Kumar wrote:
> On Jan 2, 5:12 am, Gabi wrote:
>
> > I am interested in the idea: Completely stateless set of Clojure nodes
> >
> benchmarks page). Arbitrarily nested collections, indexes, atomic
> > updates (in place operations like inc and append, or atomic compare-
> > and-set), JSON syntax, typed data, replication (built in) and sharding
> > (via a broker process).
>
> > (MongoDB downside
But that does not exclude the fact that sorted-vec-2 is about %75
times faster than sort
On Jan 3, 11:26 pm, Gabi wrote:
> It turns out I run the client version.
> When running the server version (-server) the performance of sort is 4
> times better.
>
> On Jan 3, 11:20
It turns out I run the client version.
When running the server version (-server) the performance of sort is 4
times better.
On Jan 3, 11:20 pm, Gabi wrote:
> "1.6.0_17" .It doesn't support this flag:
> Unrecognized VM option '+DoEscapeAnalysis'
>
> O
Various JVM 6 sub-versions enable and disable it by
> default and it can make a pretty hefty difference if it isn't enabled.
>
> -- Aaron
>
> On Sun, Jan 3, 2010 at 4:00 PM, Gabi wrote:
> > I've double checked on my machine (Vista. JVM 6. Clojure 1.1.0).
> > Cl
I've double checked on my machine (Vista. JVM 6. Clojure 1.1.0).
Clojure's sort is is 4 to 5 times slower than sorted-vec2
Maybe somebody with a Vista machine double check this?
On Jan 3, 5:51 pm, ianp wrote:
> > More findings: The reason that the Clojure's original sort is 8 times
> > slower
;Elapsed time: 23872.07338 msecs"
;Sorted vec. Returns vector, not sequence
user=> (time (dotimes[_ 1000](sorted-vec2 v)))
"Elapsed time: 3534.578648 msecs"
On Jan 3, 1:54 pm, Gabi wrote:
> I investigated a little bit more. Seems that (into-array) is slows
> things
(clojure.lang.RT/toArray coll)]
(java.util.Arrays/sort arr)
(vec arr)))
user=> (time(dotimes [_ 1000] (sorted-vec2 v)))
"Elapsed time: 3502.369933 msecs"
user=> (time(dotimes [_ 1000] (sorted-vec v)))
"Elapsed time: 5874.088425 msecs"
On Jan 3, 10:29 am, Gabi wro
The sorted-vec is ~4 times faster than Clojure's sort (on my humble
old machine):
user=> (def v (vec (take 1 (repeatedly #(rand-int 10)
#'user/v
user=> (time(dotimes [_ 1000] (sort v)))
"Elapsed time: 23945.682336 msecs"
nil
user=> (time(dotimes [_ 1000] (sorted-vec v)))
"Elapsed time:
What is the preferred way getting a vector back from sequence, after a
sequence producing operation (like sort)? Does using (vec..) on a
sequence that was a vector is costly?
One (bad?) possibility is creating a new vector out of sequence:
(vec (sort [1 2 3 4 5 6]))
I am asking because I nee
t; (MongoDB downsides: it grows files in a very greedy way to try and
> minimize data fragmentation, and it needs a 64bit machine to store
> more than about 2Gb.)
>
> On Dec 30 2009, 11:52 am, Gabi wrote:
>
> > On first look, Redis and Clojure seems to be a perfect match. They
&g
ote, which
> > stores arbitrary readable/printable objects to redis:
>
> >http://gist.github.com/266689
>
> > (If there's any interest, I'll wrap it up in a github project and push it
> > to clojars.)
>
> > Redis isn't a hierarchical store, so its
and push it to
> clojars.)
>
> Redis isn't a hierarchical store, so its array/set operations would only
> benefit the most shallow of data structures.
>
> -Steve
>
> On 30 Dec 2009, at 11:52, Gabi wrote:
>
> > On first look, Redis and Clojure seems to be a perf
On first look, Redis and Clojure seems to be a perfect match. They
both handle sets and maps efficiently. If one could find an easy way
to store and retrieve Clojure data structures to Redis (even a small
subset- just a list or a set), a distributed clojure app could be very
easy (and effective?) t
I need a simple command-line tool to indent Clojure source files.
Any recommendation ?
--
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
Note that posts from new members are moderated - pleas
Superb!
This is exactly what I needed.. A way to get rid of the awkward intern
and boost performance.
Have you progressed far with your GP experimenting ?
On Dec 22, 4:17 am, kyle smith wrote:
> Here's the macro I used when I dabbled in Genetic Programming:
>
> user> (time (dotimes [_ 1000]
The problem with is that I need to execute the same function with
different bindings each time. So caching won't help me
For example I need to do something like:
(dotimes [_ 1000]
(intern 'user 'x (rand))
(eval '(prn (+(* x x) 5
On Dec 21, 11:53 pm, AlexK wrote:
> What eval does, is wra
c 21, 4:22 pm, rob wrote:
>
> > It sounds like your use of evals might be something that could be done
> > better using a more idiomatic clojure approach. What are you trying
> > to do that re
>
> > On Dec 21, 2:32 pm, Gabi wrote:
>
> > > Hi
> > > I h
Hi
I have this program that needs to do many eval's to same expression
(eval '(some-list-to-execut..))
My question is how can this be optimized ? Does eval compile the
evaled expression ? Does it re-compile the evaluated expression again
and again? Maybe I could compile the evaled expression once
Ok. Now I get it. Cool stuff
On Nov 25, 4:18 pm, Meikel Brandmeyer wrote:
> Hi,
>
> On Nov 25, 9:10 am, Gabi wrote:
>
> > For example why doesn't the following "repeatedly" never crash?
>
> > (defn repeatedly
> > [f] (lazy-seq (cons (f)
into a call to a LazySeq object ?
On Nov 25, 6:29 pm, David Brown wrote:
> On Wed, Nov 25, 2009 at 12:10:36AM -0800, Gabi wrote:
> >How come that infinite recursions under lazy-seq won't crash the
> >program, whilst regular infinite recursion would crash the program ?
Just out of curiosity,
How come that infinite recursions under lazy-seq won't crash the
program, whilst regular infinite recursion would crash the program ?
What's the trick ?
For example why doesn't the following "repeatedly" never crash?
(defn repeatedly
[f] (lazy-seq (cons (f) (repeatedly f)
This would solve the "holding to the head" problem.
Many times, lazy-seq would be used without the need to get the same
cell twice.
In this case, avoiding cashing would both enhance performance and more
importantly would avoid OutOfMemoryError Exceptions like in:
(def r (repeatedly #(rand)))
(last
59 matches
Mail list logo