Hi,
On Aug 17, 6:08 am, Konrad Scorciapino scorciap...@gmail.com wrote:
I'm new with Clojure, and I'm having a problem with Vimclojure and
Namespaces. I'm following
thishttp://java.ociweb.com/mark/clojure/article.htmltutorial,
currently trying to evaluate the code below. If I evaluate the
Hi,
On Aug 17, 3:23 am, Mark Volkmann r.mark.volkm...@gmail.com wrote:
Once commute has been called on a Ref (within a transaction of
course), ref-set and alter cannot be called on it within the same
transaction.
This is enforced by the following code from the doSet method in
On Aug 13, 2009, at 12:16 AM, Meikel Brandmeyer wrote:
Also this function generates two classes, while the
other two variants generate 6.
Is there an easy way to tell how many classes a given function
generates?
—
Daniel Lyons
--~--~-~--~~~---~--~~
You
Hi,
On Aug 17, 8:51 am, Daniel Lyons fus...@storytotell.org wrote:
Also this function generates two classes, while the
other two variants generate 6.
Is there an easy way to tell how many classes a given function
generates?
Not in general. But as a rule of thumb: every fn/#()
Hi Mark and Meikel,
On Mon, Aug 17, 2009 at 8:15 AM, Meikel Brandmeyer m...@kotka.de wrote:
On Aug 17, 3:23 am, Mark Volkmann r.mark.volkm...@gmail.com wrote:
Maybe it's there in case ref-set or alter was called on the Ref before
commute.
In that case, does that mean that the commute
Hi Meikel,
It now works. The problem was that the file was not accessible via the
classpath.
Thanks for the help!
On Mon, Aug 17, 2009 at 3:04 AM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
On Aug 17, 6:08 am, Konrad Scorciapino scorciap...@gmail.com wrote:
I'm new with Clojure, and I'm
On Aug 17, 2009, at 1:27 AM, Meikel Brandmeyer wrote:
Not in general. But as a rule of thumb: every fn/#()
generates a class and hence everything using it:
defn, comp, partial, letfn, thunk'ing in macros, ...
Thanks!
—
Daniel Lyons
--~--~-~--~~~---~--~~
Hi Meikel,
It now works. The problem was that the file was not accessible via the
classpath.
Thanks for the help!
On Mon, Aug 17, 2009 at 3:04 AM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
On Aug 17, 6:08 am, Konrad Scorciapino scorciap...@gmail.com wrote:
I'm new with Clojure, and I'm
I was referring to the rules of the benchmark game. When you benchmark
language, using another language is not fair.
If you were to do your own program, of course you could use Java.
However, in the particular circumstance, it is a bit annoying to use
Java just to create a data structure type.
Here's what I've learned from following this benchmark thread:
From the various things I've read about Clojure's performance, I've
always had this sense that:
a) if you have a performance problem, there's probably some inner loop
that needs to be optimized, and so
b) you can use Clojure's
On Sat, Aug 15, 2009 at 4:23 PM, Andy Fingerhut
andy_finger...@alum.wustl.edu wrote:
Not to say this ought to be done, but would it be possible to have no
'edit' field *at all* for persistent data structures (not even a null
reference), and only an edit field at the root data structure of a
@Meikel:
Yes, I do know, but at the start I´ve had some trouble with the ng
server and the configuration. I thought, as a buildin-alternative
it
completes the possibilities. But nevertheless, it´s a quite nice
hack
I think.
@ogcraft:
I would recommend you to start reading the
I'm trying to understand this line in the run method of LockingTransaction.java.
if(wasEnsured ref.tvals != null ref.tvals.point readPoint)
throw retryex;
This is in the loop where commutes get rerun during a commit.
The question is how the Ref could have gotten a new committed value
On Mon, Aug 17, 2009 at 4:32 AM, Nicolas Oury nicolas.o...@gmail.comwrote:
I was referring to the rules of the benchmark game. When you benchmark
language, using another language is not fair.
If you were to do your own program, of course you could use Java.
However, in the particular
Here are the major points:
The algorithm requires that for about 400,000 points there will be
~8,000,000 iterations. This is a very tight loop. You cannot create anything
in this loop, not even a regular Object, much less a temporary Clojure
vector for doing vector math.
The Java version avoids
i don't know much about this (haven't followed closely, lately), but do the
new Transients come into play to somewhat address this? Sounds like they
were designed just for this sort of thing: inner-loop optimization and
low-level mutation that still works functionally to everything outside...
On
On this particular example, I think we are a bit further that what
Transients currently offers. Even using a mutable primitive Java array
results in code 2 or 3 times slower than the Java implementation of the
benchmarks.
I have no doubt the struct and transients in Clojure will allow to do that
HI,
Jwt (http://www.webtoolkit.eu/jwt ) is a java translation of the C++
web toolkit (http://www.webtoolkit.eu/wt )
I'd like to develop a web app in clojure based on Jwt, but Jwt apps
need to run in a servlet container.
What's the best path to follow in that case? Is developing a Ring
adapter
On Sun, Aug 16, 2009 at 6:50 AM, Nicolas Oury nicolas.o...@gmail.comwrote:
Dear all,
The good news: I have a version of the N-body benchmark that goes as
fast as java.
The bad news: I am cheating a little bit...
You're only cheating if you care about the fantasy world that is
Hi Raphaël,
If you're going to drive your app (and server) from clojure, then you
can use Compojure's jetty.clj module. This allows you to create a
servlet holder (in which you can add an instantiated Jwt servlet on a
jetty url path). Compojure also supports the Ring protocol, so you can
also
On Aug 17, 1:32 am, Nicolas Oury nicolas.o...@gmail.com wrote:
I was referring to the rules of the benchmark game. When you benchmark
language, using another language is not fair.
If you were to do your own program, of course you could use Java.
However, in the particular circumstance, it is
Seems to mean that I was wrong and that the cost is both in bound check
and unpacking the indices, mostly the second one.
On Mon, 2009-08-17 at 09:25 -0700, Bradbev wrote:
On Aug 17, 1:32 am, Nicolas Oury nicolas.o...@gmail.com wrote:
I was referring to the rules of the benchmark game. When
Just checking my understanding.
It seems to me that it is not possible for Clojure to remove the
possibility of writing code that has race conditions. I could write
code in which two threads each change the value of the same Ref inside
a transaction. Let's say the Ref starts with a value of 2,
I don't have enough knowledge to answer the deadlock question. But I
can offer you my opinion about your question on race conditions.
In your example, the result WILL depend on which transaction is run
first.
However I think practically this isn't a problem, because of the
following:
As a
Hi,
Ditto on the ordering example. Clojure can't infer which order your
code needs to run any more than it can figure out what your code is
supposed to do.
On the deadlock question, it is my understanding from a prior post by
Rich that Clojure's STM acquires locks in such a way that deadlocks
On Mon, Aug 17, 2009 at 2:47 PM, Michael Reidkid.me...@gmail.com wrote:
Hi,
Ditto on the ordering example. Clojure can't infer which order your
code needs to run any more than it can figure out what your code is
supposed to do.
Okay. I was pretty sure that was the case, but just wanted to
The official docs for this are at: http://clojure.org/
special_forms#let .
That's a great link. Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
I wrote this for the book:
(defn index-filter [pred coll]
(when pred
(for [[idx elt] (indexed coll) :when (pred elt)] idx)))
and I keep finding myself needing it all over the place. Is there a
better idiom for finding *positions* of things in a sequence, rather
than the things
Hmmm... this seems like a cool way to do this. Could you provide an
example for when you need to this? A few use cases would help me
understand the intent.
Sean
On Aug 17, 7:18 pm, Stuart Halloway stuart.hallo...@gmail.com wrote:
I wrote this for the book:
(defn index-filter [pred coll]
On Mon, Aug 17, 2009 at 7:45 PM, Mark Engelbergmark.engelb...@gmail.com wrote:
On Mon, Aug 17, 2009 at 9:25 AM, Bradbevbrad.beveri...@gmail.com wrote:
I found
another 2-3x speed up by coercing the indexes with (int x), ie
(defmacro mass [p] `(double (aget ~p (int 0
Which makes me
Hi all,
Is there an idiom for what I'm doing below, or does a function already
exist?
(let [vowels (slice abcdefghijklmnopqrstuvwxyz
0 4 8 14 20)]
vowels)
= (\a \e \i \o \u)
A possible implementation:
(defn slice
Return the items in coll at index positions
My $.02
(defn slice
[indices coll]
(let [idx (filter #( % (count coll) (set indices))]
(map (partial nth coll) idx)))
I changed the order of your arguments to accommodate map operations
(which you're gonna need to parse a log file). Alternatively, you
could have slice generate a
Mark Triggs mark.h.tri...@gmail.com writes:
Is there an idiom for what I'm doing below, or does a function already
exist?
(let [vowels (slice abcdefghijklmnopqrstuvwxyz
0 4 8 14 20)]
vowels)
= (\a \e \i \o \u)
Here's how I would do it:
(defn extract [coll keys]
Actually, now that I think about this, I do have another solution.
I've posted a proposal for a proj fn in the dev list. Read up here
http://groups.google.com/group/clojure-dev/browse_thread/thread/155c8b9893d673bc
(defn slice-c
[ indices]
(apply proj (map
(fn[index]
(defn slice [coll keys]
(remove nil? (map #(get coll %) keys)))
this doesn't handle nils, here is a better definition
(defn slice [coll keys]
(let [not-found (Object.)]
(remove #(identical? % not-found) (map #(get coll % not-found) keys
--
jan
if this works exactly like indexOf in java, then it seems like it
should be in the core ... but as position, or pos, based on your
description. Why the core? I'm mentioned this before: symmetry,
since nth is there. Others would argue, leave it out since
there's a way to do it from
On Mon, Aug 17, 2009 at 1:56 PM, Mark Volkmann r.mark.volkm...@gmail.comwrote:
Does Clojure STM eliminate the possibility of deadlock? When two
transactions have a contention for the same Ref, Clojure gives
preference to the transaction that has been running the longest
(unless it has only
Thanks all. So combining a few suggested ideas:
(defn slice
Return the items in coll at index positions keys.
(slice [0 4 6] \abcdefg\) = (\\a \\e \\g)
[keys coll]
(let [max-idx (apply max keys)
keyset (set keys)]
(map second
(filter (fn [[idx _]]
38 matches
Mail list logo