Hi Seth,
On Jul 28, 2009, at 9:16 PM, Seth wrote:
I found a simple, worthwhile improvement for a CPU bound
implementation of the Sieve of Eratosthenes in Clojure and thought I'd
share it. Also attached are a few metrics and code for the curious.
So I'm using Clojure to solve some of the
Daniel Lyons fus...@storytotell.org writes:
Hi Daniel,
In your particular case I think you might want to take a look at the
source code in the contrib project which implements a lazy list of
primes:
I threw this together, how does it measure up?
(defn prime? [x primes]
(not (first (filter #(zero? (rem x %)) primes
(defn next-prime [xs primes]
(lazy-seq
(let [xs (drop-while #(not (prime? % primes)) xs)
prime (first xs)
primes (conj primes prime)]
(cons
I have had the same experience. I solved it by using (ns ...) and (use
separately).
/mac
On Jul 27, 9:41 pm, Tom Emerson tremer...@gmail.com wrote:
Hi all,
I'm working with a Clojure file that creates a namespace to include
all of its functions:
(ns foobar)
I load slime and then
That worked pretty well! It completed in about 9 seconds with the
default JVM flags. Better yet I switched to the 64bit server 1.6 VM
and it completed in 2.9 seconds. Unlike my code, which threw a stack
overflow exception. Sigh.
I *really* appreciate everyone's friendly and helpful feedback.
I have added a script that uses the Java version of the benchmark
programs to generate the large files that were in the distribution
file I gave a link to earlier, so it is much smaller. I've also
published it on github and added a COPYING file that makes the
licenses more explicit (revised BSD
Gentlemen---
Thanks for fixing my newbish error and showing me a better way to
do it!
Nick.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
On Mon, Jul 27, 2009 at 7:46 AM, Sean Devlin francoisdev...@gmail.com
wrote:
Howdy everyone,
I've got a project that needs a Doc DB. It will need to run on
windows (and probably OS X), so I am looking for something that works
with Java. I thought I'd ask for some help here before I
On Wed, Jul 29, 2009 at 2:59 AM, Daniel Lyons fus...@storytotell.orgwrote:
Probably it would help to try and implement a lazy
list of the Fibonacci sequence before looking at that code, and then
maybe try some other mathematical sequences that are a little easier
to construct too.
Using the
Hello all,
Just started learning clojure recently - initial examples were easy to
understand, until I found this example
fibonacci sequence using lazy-cat :
(def fibs (lazy-cat [0 1] (map + fibs (rest fibs
I am trying to understand how this works ..not sure i fully comprehend
it.
Can
FYI, some potentially useful info here:
http://n2.nabble.com/Does-JDK6u14-%22Garbage-First-garbage-collector-%28G1%29%22-work-and-or-improve-Xwiki-performance-size-mem-locality--tp2344358p2344358.html
Does JDK6u14 Garbage-First garbage collector (G1) work and/or improve
Xwiki
Hi all,
I thought about this naive (it considers even numbers!) implementation of
the sieve:
(defn primes [max]
(let [enqueue (fn [sieve n factor]
(let [m (+ n factor)]
(assoc sieve m
(conj (sieve m) factor
next-sieve (fn
I wrote a emacs macro to help set up different slime implementations
for clojure. It has been really helpful. It's at
http://github.com/rubbish/rubbish-emacs-setup/blob/ad5bfc6f74cc9f794470e50080f8076b5599fb24/mine/mine-slime.el#L19
I probably should contribute it back to swank-clojure though.
On Wed, Jul 29, 2009 at 9:49 AM, John Harrop jharrop...@gmail.com wrote:
On Wed, Jul 29, 2009 at 2:59 AM, Daniel Lyons fus...@storytotell.orgwrote:
Probably it would help to try and implement a lazy
list of the Fibonacci sequence before looking at that code, and then
maybe try some other
Hi swaroop,
2009/7/29 swaroop belur swaroop.be...@gmail.com:
fibonacci sequence using lazy-cat :
(def fibs (lazy-cat [0 1] (map + fibs (rest fibs
I am trying to understand how this works ..not sure i fully comprehend
it.
Can anyone please explain how clojure evaluates this.
I'll
Does anybody know an elegant way to have a regex pattern with
capturing groups like in this simple example:
user= (def pat #^foo=([^;]*);bar=([^;]*);$)
#'user/pat
user= (re-seq pat foo=F0o;bar=bAr;)
([foo=F0o;bar=bAr; F0o bAr])
And reuse that pattern to generate a text that replaces the groups
Hi there,
is it possible to compile clojure source to Java 1.4 class files? If
so, how?
Thanks
Frank
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Swaroop,
Just started learning clojure recently - initial examples were easy to
understand, until I found this example
fibonacci sequence using lazy-cat :
(def fibs (lazy-cat [0 1] (map + fibs (rest fibs
I am trying to understand how this works ..not sure i fully comprehend
it.
Look at clojure.contrib.str-utils2/replace. It accepts a function --
the fn will be called on each match, and its return value will be
inserted into the result string.
But that may not be quite what you want. If you want true string
generation, you'd need a template library.
-SS
On Jul 29,
The Clojure runtime classes target Java 1.5. Compiled clojure source
files still require clojure.jar. So the answer is probably no, it's
not possible.
-SS
On Jul 29, 9:26 am, Frank frakoe.koe...@googlemail.com wrote:
Hi there,
is it possible to compile clojure source to Java 1.4 class
On Wed, Jul 29, 2009 at 9:49 AM, Rowdy Rednoserowdy.redn...@gmx.net wrote:
Does anybody know an elegant way to have a regex pattern with
capturing groups like in this simple example:
user= (def pat #^foo=([^;]*);bar=([^;]*);$)
#'user/pat
user= (re-seq pat foo=F0o;bar=bAr;)
Hello,
It seems JDK 7 is going to implement JSR 223 which explicitly adds
support for Dynamic Programming languages running on the JVM.
http://java.sun.com/developer/technicalArticles/DynTypeLang/index.html
I would like to know how it will help the Clojure Runtime.
Regards,
BG
--
On Wed, Jul 29, 2009 at 11:41 AM, Baishampayan
Ghoseb.gh...@ocricket.com wrote:
Hello,
It seems JDK 7 is going to implement JSR 223 which explicitly adds
support for Dynamic Programming languages running on the JVM.
http://java.sun.com/developer/technicalArticles/DynTypeLang/index.html
I
Hi Lico,
Please find the Hibernate-backed Clojure CRUD-test code here --
http://paste.lisp.org/+1T46
You will notice that I have NOT mentioned default_entity_mode=dynamic-
map anywhere in the config. I have simply used the syntax that goes
with dynamic map style. You could set that config as
I'd try to first compile Clojure to 1.5 bytecode, then translate it to
1.4 using Retroweaver (http://retroweaver.sourceforge.net/). I don't
know whether that'll work, though, since I think the Clojure compiler
generates and loads bytecode at runtime. You might need to patch
Clojure to somehow
Hello,
Is there any reason for some of the bitwise functions (bit-and-not,
bit-clear, bit-set, bit-flip, bit-test, bit-shift-left and bit-shift-
right) not having inline variants?
Thanks,
Daniel
--~--~-~--~~~---~--~~
You received this message because you are
Hi,
I was experimenting with Clojure and XML and stumbled upon a lengthy
hang when exiting java which was tracked down to the use of
clojure.contrib.lazy-xml. Here's a toy example which exhibits the
issue:
Script started on Wed Jul 29 15:06:44 2009
[~/dev/clojure]$ cat read-xml-lazy.clj
(ns
It's actually JSR 292 (invoke_dynamic) that's the big news.
~~ Robert.
Baishampayan Ghose wrote:
Hello,
It seems JDK 7 is going to implement JSR 223 which explicitly adds
support for Dynamic Programming languages running on the JVM.
This is my blog post about how to set up clojure in emacs, using
clojure-mode. I hope you enjoy:
http://felipero.posterous.com/1446961
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
cool - thanks guys for the detailed reply. crystal clear now -:)
Thx
swaroop
--~--~-~--~~~---~--~~
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
Nico Swart wrote:
I recently got clojure source and rebuilt clojure.jar. I noticed that
the performance is
significantly worse with the new clojure.jar compared to a older
clojure.jar. Everything else is the same, I just change
the clojure.jar file and the performance is 4x slower. Below the
While fibs is a nice small example, it is not idiomatic Clojure.
Pointing the fibs var to the head of the list keeps the whole list in
memory as it realizes. Better is to expose fibs as a *function* return
the sequence, so the head is not retained.
(defn fibo []
(map first (iterate (fn
2009/7/29 mwillson cdr@gmail.com:
Hi,
I was experimenting with Clojure and XML and stumbled upon a lengthy
hang when exiting java which was tracked down to the use of
clojure.contrib.lazy-xml. Here's a toy example which exhibits the
issue:
I haven't looked at
I was thinking exactly the same thing. It feels like there should be
a better way than instance? ...Sequable. Unless there's a reason
that's a bad idea.
Chris
On Jul 27, 6:49 pm, Sean Devlin francoisdev...@gmail.com wrote:
Rich,
There have been a few times in this thread that people have
On Mon, Jul 27, 2009 at 1:49 PM, Sean Devlinfrancoisdev...@gmail.com wrote:
There have been a few times in this thread that people have tried to
determine if a function was seqable, and used the following code
(seq? a-collection)
While this code is great for determining if a-collection is
On Jul 29, 3:45 pm, Chris Kent cjk...@gmail.com wrote:
I was thinking exactly the same thing. It feels like there should be
a better way than instance? ...Sequable. Unless there's a reason
that's a bad idea.
There's some discussion here and the linked-to message:
Is this a bug?
user (eval `(make-array ~Byte/TYPE 2))
; Evaluation aborted. (ExceptionInInitializerError)
Compare:
user (eval `(make-array ~Byte 2))
#Byte[] [Ljava.lang.Byte;@26fcfd5c
user (eval `(make-array Byte/TYPE 2))
#byte[] [...@1f0feb6e
user (make-array (eval Byte/TYPE) 2)
#byte[]
I haven't tried JavaFX much myself, but has anyone tried or thought
about using Clojure to manage the logic and data of a JavaFX
application yet? What limitations would there be, other than having to
compile its Clojure code?
--~--~-~--~~~---~--~~
You received this
Baishampayan Ghose wrote:
Nico Swart wrote:
I recently got clojure source and rebuilt clojure.jar. I noticed that
the performance is
significantly worse with the new clojure.jar compared to a older
clojure.jar. Everything else is the same, I just change
the clojure.jar file and the
39 matches
Mail list logo