Re: Trying to use lazy-seq for the first time, failing.

2009-06-29 Thread Emeka
Harold, Do you have any material on Factor? I won't going through it. Regards, Emeka On Sat, Jun 27, 2009 at 12:23 AM, _hrrld wrote: > > Hi, > > I'm trying to use lazy-seq to implement a cool piece of functionality > I saw in the Factor programming language. Here is the documentation > for tha

Hash Consing

2009-06-29 Thread Nicolas Oury
Dear all, I am coding a (very) small hash consing library for clojure. For those we don't happen to know what hash consing is, it is a way of allowing equal data structures to be shared in memory. This leverages the purity (as in "immutability") of data structures to reduce memory footprint (no

Re: Hash Consing

2009-06-29 Thread Parth
On Jun 29, 3:09 pm, Nicolas Oury wrote: > Dear all, > > I am coding a (very) small hash consing library for clojure. > > For those we don't happen to know what hash consing is, it is a way of > allowing equal data structures to be shared in memory. > This leverages the purity (as in "immutabili

Would *default-precision* make sense?

2009-06-29 Thread arasoft
At least I believe so: it would allow client code to set the desired precision once and then be able to invoke functions that take an optional precision parameter (or none at all) without having to specify precision every time. For example: (set! *default-precision* (. java.math.MathContext/DECIM

Re: Hash Consing

2009-06-29 Thread Sean Devlin
I'm pretty sure Clojure already does this, because of the built in equality by value. I'm pretty sure the hash keys work of off the value, too. Do you have any code you could post to github or something? That would help us determine if such a thing already exisits. I know this doesn't save you

Re: Hash Consing

2009-06-29 Thread Laurent PETIT
Hi, I'm interested in knowing how you solve garbage collection issues ? 2009/6/29 Nicolas Oury : > > Dear all, > > I am coding a (very) small hash consing library for clojure. > > For those we don't happen to know what hash consing is, it is a way of > allowing equal data structures to be share

Re: Hash Consing

2009-06-29 Thread Achim Passen
Hi! I think it’s basically a generalized version of this: user> (def hcons (memoize cons)) #'user/hcons user> (identical? (cons 1 nil) (cons 1 nil)) false user> (identical? (hcons 1 nil) (hcons 1 nil)) true In the case of cons, every two equal (value-wise) data structes have the same "construc

Re: Would *default-precision* make sense?

2009-06-29 Thread Christophe Grand
On Mon, Jun 29, 2009 at 1:23 PM, arasoft wrote: > > At least I believe so: it would allow client code to set the desired > precision once and then be able to invoke functions that take an > optional precision parameter (or none at all) without having to > specify precision every time. If your

Re: Troll in our midst - please ignore them

2009-06-29 Thread Charles
It's unfortunate when a troll has a brain and uses it for evildoing. Thank you Rich for the language, and your efforts at moderation. On Jun 29, 12:56 am, Alex Combas wrote: > On Sun, Jun 28, 2009 at 10:21 PM, CuppoJava wrote: > > > > > Thank you Denfer, > > That's a very interesting trick. I'm

Re: Hash Consing

2009-06-29 Thread Nicolas Oury
> > I don't know anything about hash consing. Based on my > limited understanding of the description I am just wondering > if this is different from structural sharing that Clojure collections > have. The sharing only concerns data structure having the same creation point. As Achim explained,

Re: Would *default-precision* make sense?

2009-06-29 Thread arasoft
I very much like your idea of setting *math-context* (I was looking for something like that, but could not find it in the documentation), but how do I do it globally? user=> (set! *math-context* java.math.MathContext/DECIMAL128) # whereas (set! *warn-on-reflection* true) works fine? What is t

Re: Would *default-precision* make sense?

2009-06-29 Thread Nicolas Oury
On Mon, 2009-06-29 at 07:04 -0700, arasoft wrote: > I very much like your idea of setting *math-context* (I was looking > for something like that, but could not find it in the documentation), > but how do I do it globally? > > user=> (set! *math-context* java.math.MathContext/DECIMAL128) > # esta

Re: Trying to use lazy-seq for the first time, failing.

2009-06-29 Thread _hrrld
On Jun 29, 1:15 am, Emeka wrote: > Harold, > > Do you have any material on Factor? I won't going through it. Emeka, Many of these links are relevant: http://www.google.com/search?q=factor+language Regards, -Harold --~--~-~--~~~---~--~~ You received this message

Re: executing tasks on a schedule

2009-06-29 Thread Kyle R. Burton
I wrote a basic quartz adapter for calling clojure functions by submitting a job to call a clojure function by namespace/name or submitting a closure. My write-up is here: http://asymmetrical-view.com/2009/05/19/quartz-and-clojure.html The example quartz code is in my github sandbox: http://

Re: Would *default-precision* make sense?

2009-06-29 Thread Stephen C. Gilardi
On Jun 29, 2009, at 10:11 AM, Nicolas Oury wrote: I am not sure, but I believe it's due to *warn-on-reflection* being bound by the compiler/REPL before evaluating (set! *warn-on- reflection* true). When I looked, the REPL was called within a macro 'with-bindings repl' that expands to (bindin

Re: Troll in our midst - please ignore them

2009-06-29 Thread Andrew Garman
Rich, I'd also suggest that folks rate the posts that are exceptionally good or exceptionally bad. If a user account is noted predominately for bad posts, a moderator - whether in this group or another - will think twice about allowing the user to freely post. And vice versa, posts from a user

Re: ANN: libraries promoted from contrib to clojure

2009-06-29 Thread John D. Hume
There may already have been a discussion about this in IRC, but I would have loved to see the 'are' macro continue to support the old syntax (maybe with deprecation warnings) as well as the new until after 1.1 is released. This change makes it relatively expensive for any library with a significan

Re: ANN: libraries promoted from contrib to clojure

2009-06-29 Thread Chouser
On Mon, Jun 29, 2009 at 11:14 AM, John D. Hume wrote: > > There may already have been a discussion about this in IRC The discussion took place here: http://groups.google.com/group/clojure-dev/msg/2df101865a378156?hl=en > This change makes it relatively expensive for > any library with a signifi

Re: ANN: libraries promoted from contrib to clojure

2009-06-29 Thread Jarkko Oranen
On Jun 29, 6:14 pm, "John D. Hume" wrote: > There may already have been a discussion about this in IRC, but I > would have loved to see the 'are' macro continue to support the old > syntax (maybe with deprecation warnings) as well as the new until > after 1.1 is released. This change makes it r

Re: Would *default-precision* make sense?

2009-06-29 Thread Rich Hickey
On Mon, Jun 29, 2009 at 10:51 AM, Stephen C. Gilardi wrote: > > On Jun 29, 2009, at 10:11 AM, Nicolas Oury wrote: > >> I am not sure, but I believe it's due to *warn-on-reflection* being >> bound by the compiler/REPL before evaluating (set! *warn-on-reflection* >> true). >> >> When I looked, the R

Re: Would *default-precision* make sense?

2009-06-29 Thread arasoft
I'm obviously all for it... On Jun 29, 5:53 pm, Rich Hickey wrote: > On Mon, Jun 29, 2009 at 10:51 AM, Stephen C. Gilardi wrote: > > > On Jun 29, 2009, at 10:11 AM, Nicolas Oury wrote: > > >> I am not sure, but I believe it's due to *warn-on-reflection* being > >> bound by the compiler/REPL befo

Re: Hash Consing

2009-06-29 Thread Richard Newman
> This hashing is done in O(num of children), and then you get back a > HashConsed structure, that is shared for all hash consed instances > of the same tree. It can be used to test equality O(1), with > identical?, > and not O(size of the tree). I've seen this referred to as interning -- indee

Re: Trying to use lazy-seq for the first time, failing.

2009-06-29 Thread Emeka
Thanks, however I have that already :) Regards, Emeka On Mon, Jun 29, 2009 at 2:36 PM, _hrrld wrote: > > On Jun 29, 1:15 am, Emeka wrote: > > Harold, > > > > Do you have any material on Factor? I won't going through it. > > Emeka, > > Many of these links are relevant: > http://www.google.com/s

Re: Convincing others about Clojure

2009-06-29 Thread evins.mi...@gmail.com
On Jun 25, 12:59 am, Baishampayan Ghose wrote: > Their concerns are thus: > > 1. How do you get Clojure programmers? Lisp is not for the faint hearted. You advertise for programmers and include Clojure, Lisp, Java, and functional programming on the roster of desirable skills. Lisp hackers wa

ClojureQL - 0.9 approaching 1.0

2009-06-29 Thread Lau_of_DK
Dear community, Meikel and I have been driving an effort to get ClojureQL to version 1.0. For those who do not yet know about ClojureQL, its a database adapter which allows you to interface with MySql, Derby, Sqlite etc, without ever leaving your lisp syntax. But more than being a syntax thing,

ants.clj and render thread starvation

2009-06-29 Thread B Smith-Mannschott
After watching most of Rich's Clojure presentations over the weekend, I found myself playing with ants.clj again on my netbook. The ant simulation runs brilliantly on my quad-core machine at work. Not so much on my netbook. The problem seems to be that with only a single (hyperthreaded) core the r

Re: What are people using Clojure for?

2009-06-29 Thread Howard Lewis Ship
I think we have some similar and overlapping concepts, including reducing a template to an executable function. I think there's a difference in composition, as Cascade has the concept of reusable fragments that take parameters. I also have a lot of ideas for control structures related to renderin

Re: What are people using Clojure for?

2009-06-29 Thread Richard Newman
> Finally, I'm looking forward to (at least experimenting with) > parallel rendering across fragments. The idea of hitting the > database with N requests across N threads in parallel and assembling > the result speedily is very promising. This is how Amazon (and probably eBay et al) assembl

Re: Convincing others about Clojure

2009-06-29 Thread Matt Revelle
On Jun 26, 2:40 pm, Raoul Duke wrote: > > We are hiring; but do you live in Mumbai, India? :) > > no, but i do know some folks around there (although they are all happy > where they are, as far as i know). do you allow telecommuting from > usa? ;-) > > best of luck with the venture. I'm looking

Clojure for Scientific and other CPU-intensive Computing

2009-06-29 Thread fft1976
Based on the recent survey "What are people using Clojure for?", people are mostly using it for non-CPU-intensive work, like parsing, report generation, GUIs, "glue" code. It's been argued by some that Clojure is as fast as Java, because at worst, you can implement your bottlenecks in Java. I hav

Re: ClassNotFoundException with def

2009-06-29 Thread Daniel Borchmann
On Sun, Jun 28, 2009 at 01:25:15PM -0700, hoeck wrote: [...] > Tried it, and had the same results. Somehow defining a class object as > a root value triggers some mechanism to load it with the root > classloader instead of the clojure one. > However, putting /home/me on the classpath using -cp wor

Re: Clojure for Scientific and other CPU-intensive Computing

2009-06-29 Thread Richard Newman
> I would be curious to know if anyone is using Clojure for CPU- > intensive work where performance really counts. Respectfully, I wouldn't class telephony as "non-CPU-intensive". :) Speed directly translates to calls-per-second. I've been very happy with Clojure thus far. --~--~-~--~

Speedy accessors for the trees of clojure.xml

2009-06-29 Thread samppi
clojure.xml/parse returns a PersistentStructMap. Is there a way to refer to its struct template? I wish to create accessors for its keys, such as :tag, :attrs, and :content, with the accessor function for speed. --~--~-~--~~~---~--~~ You received this message becaus

Re: What are people using Clojure for?

2009-06-29 Thread Howard Lewis Ship
A friend of mine who worked for Sleepycat told me that the Amazon home page does up to 40 separate queries. Of course, this was at least five years ago, but still. That would be an option, a fragment that rendered its body in a new/worker thread, with a time limit, and replaced it with a placehold

Re: Speedy accessors for the trees of clojure.xml

2009-06-29 Thread Rich Hickey
On Jun 29, 4:59 pm, samppi wrote: > clojure.xml/parse returns a PersistentStructMap. Is there a way to > refer to its struct template? I wish to create accessors for its keys, > such as :tag, :attrs, and :content, with the accessor function for > speed. If you look at the top of xml.clj you'll

Re: ANN: libraries promoted from contrib to clojure

2009-06-29 Thread Stuart Sierra
On Jun 29, 11:14 am, "John D. Hume" wrote: > There may already have been a discussion about this in IRC, but I > would have loved to see the 'are' macro continue to support the old > syntax (maybe with deprecation warnings) as well as the new until > after 1.1 is released. There were some proble

Re: Speedy accessors for the trees of clojure.xml

2009-06-29 Thread samppi
Wonderful. Thanks for the answer. On Jun 29, 2:47 pm, Rich Hickey wrote: > On Jun 29, 4:59 pm, samppi wrote: > > > clojure.xml/parse returns a PersistentStructMap. Is there a way to > > refer to its struct template? I wish to create accessors for its keys, > > such as :tag, :attrs, and :content

debugging advice

2009-06-29 Thread e
Hi all, at the risk of sounding negative and (-; thus getting "moderated" ;-) ... I'm very interested in taking another stab at clojure after putting it down for a while, but I had real trouble debugging my programs. I'm looking for advice and/or an approach. as I recall, I simply got a general

Re: debugging advice

2009-06-29 Thread Richard Newman
> at the risk of sounding negative and (-; thus getting > "moderated" ;-) ... I'm very interested in taking another stab at > clojure after putting it down for a while, but I had real trouble > debugging my programs. I'm looking for advice and/or an approach. Aside from two areas — JVM pro

Re: debugging advice

2009-06-29 Thread Raoul Duke
> If you're finding that you're managing a lot of state, and thus have > trouble debugging, then you're probably not taking a sufficiently > functional approach. (A big hint is if you find yourself wanting a > stepping debugger to watch values change. It's the "change" part > that's worrying!) pe

Re: debugging advice

2009-06-29 Thread Howard Lewis Ship
My negative experience with debugging touches on a number of things, but the biggest is the way that lazy evaluation makes it hard to determine cause and effect while debugging. This has been a problem, and I've had to do a lot of (prn) calls to try and identify what's going on. I eventually have

Re: debugging advice

2009-06-29 Thread e
oh yeah . . . .been down the prn road for many many hours, myself. seems like a lot of nice people here ready to help so i'll get back into it soon and post specific problems. . . . there are a lot lot lot of them, so i am sure it will take some time. Thanks for the ideas. On Mon, Jun 29,

clueless hash-map question

2009-06-29 Thread Raoul Duke
hi, is there an equivalent of java.util.Map.entrySet() or an iterator over that? i see things for getting the keys alone, or the vals alone. i guess off the cuff i find it odd that doseq on a map doesn't give me k-v pairs as the entries by default, but gives them interleaved. -Mr. Not Yet With T

Re: Speedy accessors for the trees of clojure.xml

2009-06-29 Thread Adrian Cuthbertson
As a matter of interest, one can get the keys keys in an unknown struct by allocating an empty struct; (def st (create-struct :a :b :c)) (keys (struct st)) (:a :b :c) -Adrian. On Tue, Jun 30, 2009 at 12:14 AM, samppi wrote: > > Wonderful. Thanks for the answer. > > On Jun 29, 2:47 pm, Rich Hic

Re: clueless hash-map question

2009-06-29 Thread Richard Newman
> is there an equivalent of java.util.Map.entrySet() or an iterator over > that? i see things for getting the keys alone, or the vals alone. i > guess off the cuff i find it odd that doseq on a map doesn't give me > k-v pairs as the entries by default, but gives them interleaved. If you're talkin

Re: clueless hash-map question

2009-06-29 Thread Rich Hickey
On Jun 29, 9:34 pm, Raoul Duke wrote: > hi, > > is there an equivalent of java.util.Map.entrySet() or an iterator over > that? i see things for getting the keys alone, or the vals alone. i > guess off the cuff i find it odd that doseq on a map doesn't give me > k-v pairs as the entries by defau

Re: Clojure for Scientific and other CPU-intensive Computing

2009-06-29 Thread fft1976
On Jun 29, 1:39 pm, Richard Newman wrote: > > I would be curious to know if anyone is using Clojure for CPU- > > intensive work where performance really counts. > > Respectfully, I wouldn't class telephony as "non-CPU-intensive". :) I would have thought those kinds of things are bandwidth-limite

Re: Clojure for Scientific and other CPU-intensive Computing

2009-06-29 Thread Richard Newman
>> Respectfully, I wouldn't class telephony as "non-CPU-intensive". :) > > I would have thought those kinds of things are bandwidth-limited. Typically not. Some rough numbers: a complete call setup and teardown is usually no more than 5KB, spread over the course of the call -- the initial si

Re: Speedy accessors for the trees of clojure.xml

2009-06-29 Thread samppi
Yes, but I'm not so sure that you can get usable accessors with those keys: Clojure 1.0.0- user=> (defstruct test-s :a :b :c) #'user/test-s user=> (defstruct test-2-s :a :b :c) #'user/test-2-s user=> (def accessor-a (accessor test-s :a)) #'user/accessor-a user=> (accessor-a (struct test-2-s 5 3 2)

Re: Speedy accessors for the trees of clojure.xml

2009-06-29 Thread Adrian Cuthbertson
How about; (defn get-accessors "Given a struct definition, return a map of its keys and generated accessors for each key." [the-struct] (let [st-kys (keys (struct the-struct))] (reduce (fn [accsrs ky] (assoc accsrs ky (accessor the-struct ky))) {} st-kys))) (defstruct test-s

Re: clueless hash-map question

2009-06-29 Thread Laurent PETIT
Hi, Here would be the function returning a lazy seq of the map entries : (def #^{:docstring "Returns a lazy seq of java.util.Map.MapEntry for the map given as an argument." } mapentries (partial map identity)) (mapentries {:a 1 :b 2}) => ([:a 1] [:b 2]) (lazy seq) Regards, -- Laurent 2009/

Re: Clojure for Scientific and other CPU-intensive Computing

2009-06-29 Thread kyle smith
On Jun 30, 2:41 am, fft1976 wrote: > I would be curious to know if anyone is using Clojure for CPU- > intensive work where performance really counts. I'm using clojure for various computational physics tasks: 1. I'm writing a dsl for substructure searching. 2. I'm doing classical molecular dynam