Re: clojure.contrib/repl-utils

2009-01-20 Thread Chouser
On Tue, Jan 20, 2009 at 11:42 AM, pc wrote: > > I think that the get-source function should be changed slightly so > that hyphens in the path (at the first let form) are replaced by > underscores. This would update the function to be consistent with the > documentation for lib. You're right. >

bug: bean returns the wrong kind of false

2009-01-20 Thread Chouser
The first method of the String class does not take varargs: user=> (.isVarArgs (first (.getMethods String))) false The above is the Right Kind of False, as shown here: user=> (if (.isVarArgs (first (.getMethods String))) :true :false) :false However 'bean' returns the Wrong Kind of False: user=>

svn:ignore clojure.jar, classes, target

2009-01-20 Thread rzeze...@gmail.com
Any reason that clojure.jar, classes, and target are not on the svn:ignore list? -Ryan --~--~-~--~~~---~--~~ 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

Re: Clojure now running in production

2009-01-20 Thread Luc Prefontaine
I was a bit surprise when I opened my emails toward the end of the afternoon... http://www.infoq.com/news/2009/01/clojure_production I did not realized that my post of last week would travel so fast. As for the VB stuff, well I am struggling with an SQL query today to get an ad hoc report done..

Re: repl-utils show

2009-01-20 Thread Chouser
On Mon, Jan 19, 2009 at 1:09 PM, Stuart Sierra wrote: > > On Jan 19, 11:59 am, Chouser wrote: >> But my version also only allows matches on the method name (not on >> return value or argument class names). At first I thought this was >> also good, but now I'm less sure. How often do you think

Re: Proposal: "smarter" set operations that take size into account for speed

2009-01-20 Thread Mark Engelberg
I say "thumbs up" to this proposal. Sets really should test for the size of the two inputs, and adjust the algorithm accordingly. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this grou

Re: clojure.contrib.sql - Support DataSource in with-connection

2009-01-20 Thread Stephen C. Gilardi
On Jan 20, 2009, at 7:01 PM, Stephen C. Gilardi wrote: I'd like for clojure.contrib.sql to support DataSource. As an alternative implementation, what do you think of db-spec allowing a :datasource key. If :datasource is specified, with-connection could use its value to acquire the connecti

Re: What's best way to get rid of #

2009-01-20 Thread Dan Larkin
On Jan 20, 2009, at 8:42 PM, wubbie wrote: > > Hi > I would just print the files, excluding "#". > what's the best way? > > user=> (filter recently-modified? (file-seq (File. "."))) > (# # #) > http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#getName() > Thanks > -Sun > > --~--~---

Re: Proposal: "smarter" set operations that take size into account for speed

2009-01-20 Thread Jason Wolfe
On Jan 20, 4:44 pm, Jason Wolfe wrote: > Apologies for multiple posts; I will try to thoroughly investigate > things before starting posting next time.  Anyway, to round out the > thread, here are corresponding results for intersection and union: Well, that didn't last too long ... from now on

What's best way to get rid of #

2009-01-20 Thread wubbie
Hi I would just print the files, excluding "#". what's the best way? user=> (filter recently-modified? (file-seq (File. "."))) (# # #) Thanks -Sun --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Utilities for clojure.contrib?

2009-01-20 Thread Jason Wolfe
> I didn't find any of them compelling enough for core just yet. Putting   > them in contrib first lets people try them out and refine them, point   > out redundancies and conflicts etc. > > As a general rule I haven't pulled many simple combining functions   > from contrib, as they just pollute t

Re: Proposal: "smarter" set operations that take size into account for speed

2009-01-20 Thread Jason Wolfe
Apologies for multiple posts; I will try to thoroughly investigate things before starting posting next time. Anyway, to round out the thread, here are corresponding results for intersection and union:  (defn- fast-intersection- "Expects s1 and s2 sets, s1 bigger than s2." [s1 s2] (reduce (fn

Re: Utilities for clojure.contrib?

2009-01-20 Thread Rich Hickey
On Jan 20, 2009, at 7:16 PM, Jason Wolfe wrote: > >> On Jan 20, 4:15 pm, Chouser wrote: >>> On Tue, Jan 20, 2009 at 3:55 PM, Stephen C. Gilardi >>> wrote: >>> >>> >>> I recommend that proposed changes for clojure-contrib be tracked as clojure-contrib issues. >>> >>> I agree. >>>

Re: pmap memory hogging

2009-01-20 Thread Mark H.
On Jan 20, 8:36 am, Perry Trolard wrote: > Yesterday I had a strange case of pmap (parallel map) eating up all of > the heap space I'd make available -- from 256M up to a Gig. I track > SVN, & I know for sure this wasn't happening last Wednesday (the > 14th). Calling map in place of pmap caused t

Re: Multimethod Reflection?

2009-01-20 Thread David Nolen
Thanks! On Tue, Jan 20, 2009 at 7:28 PM, Rich Hickey wrote: > > > > On Jan 20, 6:48 pm, David Nolen wrote: > > Looking at the multimethod implementation (MultiFn.java) I noticed that > > multimethod keeps an internal persistent map of dispatch values in a > field > > call methodTable. It seems

Re: Multimethod Reflection?

2009-01-20 Thread Rich Hickey
On Jan 20, 6:48 pm, David Nolen wrote: > Looking at the multimethod implementation (MultiFn.java) I noticed that > multimethod keeps an internal persistent map of dispatch values in a field > call methodTable. It seems to me it would pretty simple to expose this > field (or a copy of it anyway

Re: Another socket repl

2009-01-20 Thread Phil Hagelberg
Craig McDaniel writes: > On Jan 19, 11:45 am, Phil Hagelberg wrote: >> I noticed that very little of this code is specific to the REPL; the >> bulk of it is just dealing with creating and doing things with server >> sockets. Perhaps it could be included in clojure-contrib as a >> generalized se

Re: pmap memory hogging

2009-01-20 Thread Mark H.
On Jan 20, 10:38 am, Perry Trolard wrote: > But I don't think lazyness is the problem: > > user=> (def r (doall (map inc (range 100 > #'user/r > user=> (count r) > 100 > user=> (pmap inc [0]) > java.lang.OutOfMemoryError: Java heap space (NO_SOURCE_FILE:0) Hm, that's funny, the latte

Re: Utilities for clojure.contrib?

2009-01-20 Thread Jason Wolfe
> On Jan 20, 4:15 pm, Chouser wrote: >> On Tue, Jan 20, 2009 at 3:55 PM, Stephen C. Gilardi >> wrote: >> >> >> >>> I recommend that proposed changes for clojure-contrib be tracked as >>> clojure-contrib issues. >> >> I agree. >> >>> My understanding of the issue policy for Clojure is that Rich

Re: Proposal: "smarter" set operations that take size into account for speed

2009-01-20 Thread Jason Wolfe
One caveat: I do like the fact that the set operations currently don't require the second argument to be a set. In the case that it's not, I believe the current implementations (at least for difference) are as good as it gets. So, I guess fast-difference should read: (defn fast-difference "Like

Re: Utilities for clojure.contrib?

2009-01-20 Thread Rich Hickey
On Jan 20, 4:15 pm, Chouser wrote: > On Tue, Jan 20, 2009 at 3:55 PM, Stephen C. Gilardi wrote: > > > > > I recommend that proposed changes for clojure-contrib be tracked as > > clojure-contrib issues. > > I agree. > > > My understanding of the issue policy for Clojure is that Rich would still

Re: clojure.contrib.sql - Support DataSource in with-connection

2009-01-20 Thread Stephen C. Gilardi
On Jan 20, 2009, at 6:16 PM, Juergen Gmeiner wrote: I've been using clojure for prototyping in JBoss and I found that clojure.contrib.sql does not currently support opening JDBC connections via a javax.sql.DataSource. So I propose the patch below. Hi Juergen, I'd like for clojure.contrib.sq

Proposal: "smarter" set operations that take size into account for speed

2009-01-20 Thread Jason Wolfe
I ran into a situation in my application where I wanted to take a set- difference between a small set and a large set. In this circumstance, clojure.set/difference is needlessly slow. Because of this, in general, a sequence of n clojure.set operations may run in O(n^2) time when O(n) is easily a

Re: pmap memory hogging

2009-01-20 Thread Rich Hickey
On Jan 20, 1:38 pm, Perry Trolard wrote: > > Doesn't pmap have to construct the whole sequence explicitly in order > > to map its execution across more than one processor? or does it take > > in a lazy fashion? > > Semi-lazy, according to the doc: > > Like map, except f is applied in parallel

Multimethod Reflection?

2009-01-20 Thread David Nolen
Looking at the multimethod implementation (MultiFn.java) I noticed that multimethod keeps an internal persistent map of dispatch values in a field call methodTable. It seems to me it would pretty simple to expose this field (or a copy of it anyway) so that multimethod reflection can take place. (r

Re: Mysterious performance anomalies

2009-01-20 Thread Mark H.
On Jan 20, 1:41 pm, Rich Hickey wrote: > Let's keep from making the same mistakes as c.l.l, including calling > people trolls. Sorry, yes Rich, I will refrain from using such titles in the future. mfh --~--~-~--~~~---~--~~ You received this message because you ar

Re: [ANN] Dejcartes

2009-01-20 Thread Tom Ayerst
Mark, Thanks for doing this, I haven't had a chance to look at it yet but its been on the wish list for a while. Cheers Tom 2009/1/20 Mark Fredrickson > > Hello friends, > > I would like to announce a super-pre-alpha release of Dejcartes, a > Clojure wrapper around the JFreeChart charting lib

Re: doall vs. dorun

2009-01-20 Thread Mark Volkmann
Thanks Steve and Cosmin! I understand it now. On Tue, Jan 20, 2009 at 4:53 PM, Stephen C. Gilardi wrote: > > On Jan 20, 2009, at 5:32 PM, Mark Volkmann wrote: > >>> Here's one: >>> >>> (defn read-my-file [] >>> (with-open [reader (BufferedReader. (FileReader. "my-file.txt"))] >>> (doall (line-s

clojure.contrib.sql - Support DataSource in with-connection

2009-01-20 Thread Juergen Gmeiner
I've been using clojure for prototyping in JBoss and I found that clojure.contrib.sql does not currently support opening JDBC connections via a javax.sql.DataSource. So I propose the patch below. Cheers, Juergen diff --git a/src/clojure/contrib/sql.clj b/src/clojure/contrib/sql.clj index 75242

Re: doall vs. dorun

2009-01-20 Thread Cosmin Stejerean
On Tue, Jan 20, 2009 at 4:32 PM, Mark Volkmann wrote: > > On Tue, Jan 20, 2009 at 3:14 PM, Stuart Sierra > wrote: > > > > On Jan 20, 3:32 pm, Mark Volkmann wrote: > >> Can someone describe a situation where it is preferable to use doall > >> instead of dorun? > > > > Here's one: > > > > (defn re

2nd European Lisp Symposium 2009

2009-01-20 Thread aml
2nd European Lisp Symposium (ELS 2009) Milan, Italy, May 27-29, 2009 Università degli Studi di Milano-Bicocca New Submission Deadline: **

Re: doall vs. dorun

2009-01-20 Thread Stephen C. Gilardi
On Jan 20, 2009, at 5:32 PM, Mark Volkmann wrote: Here's one: (defn read-my-file [] (with-open [reader (BufferedReader. (FileReader. "my-file.txt"))] (doall (line-seq reader "line-seq" returns a lazy sequence, but you have to consume that sequence before "with-open" closes the file. H

Re: doall vs. dorun

2009-01-20 Thread Mark Volkmann
On Tue, Jan 20, 2009 at 3:14 PM, Stuart Sierra wrote: > > On Jan 20, 3:32 pm, Mark Volkmann wrote: >> Can someone describe a situation where it is preferable to use doall >> instead of dorun? > > Here's one: > > (defn read-my-file [] > (with-open [reader (BufferedReader. (FileReader. "my-file.t

Re: Unexpected binding behavior

2009-01-20 Thread Christian Vest Hansen
On Tue, Jan 20, 2009 at 10:54 PM, Hugh Winkler wrote: > but why not make "safe" the default? i.e. use "unsafe-binding" if > you know it's OK. Not all seqs are finite. Also, Clojure skews toward lazy-by-default. Once a function has run inside a `binding, I would assume that the result it deliv

Re: Unexpected binding behavior

2009-01-20 Thread Stuart Halloway
That's simpler than the example I was typing up, so I will stop now. :-) Another problem is that you might want the binding to be in effect while defining a sequence, but not while realizing it. Haven't come up with any realistic examples of that, though. Cheers, Stuart > Uh oh, I see what

Re: Unexpected binding behavior

2009-01-20 Thread Hugh Winkler
On Tue, Jan 20, 2009 at 3:54 PM, Hugh Winkler wrote: > On Tue, Jan 20, 2009 at 3:06 PM, Stuart Halloway > wrote: >> >> Hi Hugh, >> >> I don't see how this would work in general, which is why a I suggested >> a special-purpose macro before. Surely you would not want a binding to >> force all sequ

Re: Multiple hashing functions? (+ (update: not a) bug in PersistentHashMap.java?)

2009-01-20 Thread Jason Wolfe
> And, lest you think that confusing = and .equals is just a noobie > mistake, let me point out what seems to be a bug in > PersistentHashMap.java I just found based on this same confusion.  In > particular, Objects are located in the map using Clojure's hash > function, which is equivalent to .ha

Re: Unexpected binding behavior

2009-01-20 Thread Hugh Winkler
On Tue, Jan 20, 2009 at 3:06 PM, Stuart Halloway wrote: > > Hi Hugh, > > I don't see how this would work in general, which is why a I suggested > a special-purpose macro before. Surely you would not want a binding to > force all sequences while that binding is in effect. And if not that, > what w

Re: pmap memory hogging

2009-01-20 Thread Mark H.
On Jan 20, 10:38 am, Perry Trolard wrote: > > Doesn't pmap have to construct the whole sequence explicitly in order > > to map its execution across more than one processor?  or does it take > > in a lazy fashion? > > Semi-lazy, according to the doc: > >  Like map, except f is applied in parallel.

Re: Mysterious performance anomalies

2009-01-20 Thread Rich Hickey
On Jan 20, 4:21 pm, "Mark H." wrote: > On Jan 20, 9:31 am, Jon Harrop wrote: > > > On Tuesday 20 January 2009 08:01:19 ivant wrote: > > > > IIRC, the only major complain Rich has about JVM is the lack > > > of tail-call optimization. > > > That's a pretty major problem. :-) > > btw, did you ev

Re: Utilities for clojure.contrib?

2009-01-20 Thread Chouser
On Tue, Jan 20, 2009 at 3:55 PM, Stephen C. Gilardi wrote: > > I recommend that proposed changes for clojure-contrib be tracked as > clojure-contrib issues. I agree. > My understanding of the issue policy for Clojure is that Rich would still > like to approve them either here or on #clojure (ir

Re: doall vs. dorun

2009-01-20 Thread Mark Triggs
In addition to what others have said, I also tend to use doall when working with agent actions that return sequences (i.e. to force any computation to happen in the agent's thread and not in the caller's) Cheers, Mark On Wed, Jan 21, 2009 at 7:32 AM, Mark Volkmann wrote: > > Can someone descri

Re: Mysterious performance anomalies

2009-01-20 Thread Mark H.
On Jan 20, 9:31 am, Jon Harrop wrote: > On Tuesday 20 January 2009 08:01:19 ivant wrote: > > > IIRC, the only major complain Rich has about JVM is the lack > > of tail-call optimization. > > That's a pretty major problem. :-) btw, did you ever stop trolling comp.lang.lisp? You were the main rea

Re: Clojure Library Documentation

2009-01-20 Thread lpetit
Hello, As modest as this could be in the quest of a formal categorization, I find the integrated string pattern search integrated into clojuredev really useful, so I can't resist to do this shameless plug. You can see it in action, with a search on the word "string", either by searching the word

Re: doall vs. dorun

2009-01-20 Thread Stuart Sierra
On Jan 20, 3:32 pm, Mark Volkmann wrote: > Can someone describe a situation where it is preferable to use doall > instead of dorun? Here's one: (defn read-my-file [] (with-open [reader (BufferedReader. (FileReader. "my-file.txt"))] (doall (line-seq reader "line-seq" returns a lazy se

Re: doall vs. dorun

2009-01-20 Thread Nathanael Cunningham
Pretty much any lazy-seq thats reading data from somewhere that might give up on you if you take to long. For example: Your using line-seq to read from a socket, but the sequence wont be read through until the user does something. On Tue, Jan 20, 2009 at 3:32 PM, Mark Volkmann wrote: > > Can some

Re: Unexpected binding behavior

2009-01-20 Thread Stuart Halloway
Hi Hugh, I don't see how this would work in general, which is why a I suggested a special-purpose macro before. Surely you would not want a binding to force all sequences while that binding is in effect. And if not that, what would the general strategy be for deciding which sequences to f

Re: Unexpected binding behavior

2009-01-20 Thread Hugh Winkler
On Tue, Jan 20, 2009 at 12:53 AM, Timothy Pratley wrote: > > >> How would one go about fixing f1 (or b1)? > > Depends what you want to achieve... here are two possible 'fixes': > > ; don't use lazy evaluation > (defn f1 [] > (doall (map (fn [x] *num* ) [1]))) > > ; use lazy evaluation, but pres

Re: Utilities for clojure.contrib?

2009-01-20 Thread Stephen C. Gilardi
On Jan 20, 2009, at 3:36 PM, Jason Wolfe wrote: OK, I'll get on this then. It this just for changes to core, or should I post proposed functions for contrib there/ on the contrib issues page too? If not, what should I do with them? I recommend that proposed changes for clojure-contrib be tr

Re: Newbie: What is the function of refer-clojure?

2009-01-20 Thread Stephen C. Gilardi
On Jan 20, 2009, at 2:44 PM, samppi wrote: I'm trying to get into more of how namespaces work. The refer function refers to all the public variables of a library. What is the point of refer-clojure, though? When would you use it? What variables of clojure.core are not normally present in a new

Re: Clojure Library Documentation

2009-01-20 Thread Mark Volkmann
On Tue, Jan 20, 2009 at 10:09 AM, Mark Addleman wrote: > > I'm a long time Java programmer and, before that, a Smalltalker. One > of the major biggest challenges I face when picking up a new language > is getting a working understanding of its libraries. I believe that > standardizing on a doc

Re: Utilities for clojure.contrib?

2009-01-20 Thread Jason Wolfe
> I'm sorry, Jason, I really thought I answered this the first time you > asked. But I can't find any such answer in the archives, so I must > have been mistaken. No worries, thanks for all your help with this. >> I can try to make patches for the changes in core, and/or improve >> and document

doall vs. dorun

2009-01-20 Thread Mark Volkmann
Can someone describe a situation where it is preferable to use doall instead of dorun? I see in the documentation that it "retains the head and returns it, thus causing the entire seq to reside in memory at one time", but I'm not sure why I'd want that. -- R. Mark Volkmann Object Computing, Inc.

Re: Possible feature: consider aliases when reading namespace-qualified keywords.

2009-01-20 Thread Jason Wolfe
Hi David, Thanks ... I just looked at CLJOS, and was actually just earlier thinking about writing something similar myself. It looks very nice, and I very well might end up using it (especially if it gets up-to- speed with "struct"). Still, I stand by my feature request :). I guess in the mea

Re: Utilities for clojure.contrib?

2009-01-20 Thread Chouser
On Tue, Jan 20, 2009 at 3:06 PM, Jason Wolfe wrote: > > Also, once again (Chouser?), is there anything I can do to help > implement the changes we've talked about? I'm sorry, Jason, I really thought I answered this the first time you asked. But I can't find any such answer in the archives, so I

Re: Newbie: What is the function of refer-clojure?

2009-01-20 Thread Chouser
On Tue, Jan 20, 2009 at 2:59 PM, Stuart Halloway wrote: >> >> I'm trying to get into more of how namespaces work. The refer function >> refers to all the public variables of a library. What is the point of >> refer-clojure, though? When would you use it? What variables of >> clojure.core are not

Re: Unexpected binding behavior

2009-01-20 Thread Brian Carper
On Jan 20, 10:06 am, "Hugh Winkler" wrote: > Inside FP, outside FP, all I want is no surprises. I agree, this is confusing for new users. Especially given the counter-intuitive (for a new person) way the REPL forces evaluation of everything, making everything seem to be eager when it's not. Th

Re: Utilities for clojure.contrib?

2009-01-20 Thread Jason Wolfe
A couple more updates to these: > (defn random-permutation [s] >   "Return a random permutation of this seq." >   (let [arr (to-array s) len (alength arr)] >     (dotimes [i (dec len)] >       (let [r (+ i (rand-int (- len i))), >             prev (aget arr i)] >         (aset arr i (aget arr r))

Re: Newbie: What is the function of refer-clojure?

2009-01-20 Thread Stuart Halloway
All of them, if you use in-ns: (in-ns 'foo) # > str java.lang.Exception: Unable to resolve symbol: str in this context (clojure.core/refer-clojure) -> nil str -> # > > I'm trying to get into more of how namespaces work. The refer function > refers to all the public variables of a library.

Newbie: What is the function of refer-clojure?

2009-01-20 Thread samppi
I'm trying to get into more of how namespaces work. The refer function refers to all the public variables of a library. What is the point of refer-clojure, though? When would you use it? What variables of clojure.core are not normally present in a new namespace? --~--~-~--~~---

Re: Mysterious performance anomalies

2009-01-20 Thread Cosmin Stejerean
On Tue, Jan 20, 2009 at 11:31 AM, Jon Harrop wrote: > > On Tuesday 20 January 2009 08:01:19 ivant wrote: > > IIRC, the only major complain Rich has about JVM is the lack > > of tail-call optimization. > > That's a pretty major problem. :-) > > It's a problem, and I hope future versions of the JVM

Re: pmap memory hogging

2009-01-20 Thread Perry Trolard
> Doesn't pmap have to construct the whole sequence explicitly in order > to map its execution across more than one processor?  or does it take > in a lazy fashion? Semi-lazy, according to the doc: Like map, except f is applied in parallel. Semi-lazy in that the parallel computation stays ahe

Re: pmap memory hogging

2009-01-20 Thread Mark H.
On Jan 20, 8:36 am, Perry Trolard wrote: > Yesterday I had a strange case of pmap (parallel map) eating up all of > the heap space I'd make available -- from 256M up to a Gig. I track > SVN, & I know for sure this wasn't happening last Wednesday (the > 14th). Calling map in place of pmap caused t

Clojure Library Documentation

2009-01-20 Thread Mark Addleman
I'm a long time Java programmer and, before that, a Smalltalker. One of the major biggest challenges I face when picking up a new language is getting a working understanding of its libraries. I believe that standardizing on a doc format was a pretty important driver for Java's success. As I see

Re: Mysterious performance anomalies

2009-01-20 Thread Jon Harrop
On Tuesday 20 January 2009 08:01:19 ivant wrote: > IIRC, the only major complain Rich has about JVM is the lack > of tail-call optimization. That's a pretty major problem. :-) -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e --~--~-~--~~~--

Re: Unexpected binding behavior

2009-01-20 Thread Hugh Winkler
On Tue, Jan 20, 2009 at 11:45 AM, Stuart Halloway wrote: > >> OK, good, thanks for the explanation. >> >> Is it desirable behavior? Is there some case where a programmer wants >> this behavior? >> >> It's pretty scary to have to consider these hidden effects. Sort of >> the opposite of FP. > > If

Re: Unexpected binding behavior

2009-01-20 Thread Stuart Halloway
> OK, good, thanks for the explanation. > > Is it desirable behavior? Is there some case where a programmer wants > this behavior? > > It's pretty scary to have to consider these hidden effects. Sort of > the opposite of FP. If you write functions that work differently depending on a binding, t

Re: Multimethod question

2009-01-20 Thread Konrad Hinsen
On Jan 20, 2009, at 17:49, Christophe Grand wrote: > user=> (ancestors clojure.lang.IPersistentVector) > #{clojure.lang.Sequential clojure.lang.Associative > clojure.lang.IPersistentCollection clojure.lang.Reversible > clojure.lang.IPersistentStack} > > Hence clojure.lang.IPersistentVector clearl

Re: Yet another html templating library

2009-01-20 Thread Daniel Jomphe
Christophe Grand wrote: > > Therefore, this feels a bit misleading to me: "this separates design > > from code even further". I just want to point out StringTemplate helps > > separating design from code, but its main goal is separating the View > > from Controller and Model in a formally strict

Re: 2 Cents Calculator

2009-01-20 Thread Emeka
Tim, Thanks so much. Emeka On Tue, Jan 20, 2009 at 5:16 AM, Timothy Pratley wrote: > > Hi Emeka, > > On Jan 19, 11:17 pm, janus wrote: > > that's why I' ve decided to 'outsource' :).I invite your comments and > > any code that might make this toy to worth 2 cents in today's market. > > Reducin

Re: Multimethod question

2009-01-20 Thread Christophe Grand
Hi Konrad! Konrad Hinsen a écrit : > Given the definitions: > > (defmulti foo class) > (defmethod foo clojure.lang.IPersistentCollection [_] :a-collection) > (defmethod foo clojure.lang.IPersistentVector [_] :a-vector) > > one obtains the following results: > > (foo [1 2 3]) -> :a-vector > (foo

clojure.contrib/repl-utils

2009-01-20 Thread pc
I think that the get-source function should be changed slightly so that hyphens in the path (at the first let form) are replaced by underscores. This would update the function to be consistent with the documentation for lib. More generally, are hyphens replaced by underscores in the file and path

pmap memory hogging

2009-01-20 Thread Perry Trolard
Hi All, Yesterday I had a strange case of pmap (parallel map) eating up all of the heap space I'd make available -- from 256M up to a Gig. I track SVN, & I know for sure this wasn't happening last Wednesday (the 14th). Calling map in place of pmap caused the code to run fine inside of a 256M heap

Re: Unexpected binding behavior

2009-01-20 Thread Hugh Winkler
On Mon, Jan 19, 2009 at 11:01 PM, Stuart Halloway wrote: > > Lazy evaluation is a harsh mistress. > > user=> (def b1 (binding [*num* 1024] (f1))) > #'user/b1 > user=> (def b2 (binding [*num* 1024] (f1))) > #'user/b2 > user=> b1 > (16) > user=> b2 > (16) > > The difference between the example abov

Multimethod question

2009-01-20 Thread Konrad Hinsen
Given the definitions: (defmulti foo class) (defmethod foo clojure.lang.IPersistentCollection [_] :a-collection) (defmethod foo clojure.lang.IPersistentVector [_] :a-vector) one obtains the following results: (foo [1 2 3]) -> :a-vector (foo #{1 2 3}) -> :a-collection This looks perfectly logi

Re: Mysterious performance anomalies

2009-01-20 Thread Mark H.
On Jan 20, 12:01 am, ivant wrote: > On Jan 20, 3:14 am, e wrote: > > > That's a solid arg, too . . . but it would be stronger if we weren't > > importing things from java all the time.  If we said like, "(gui-frame > > "hello"), which happened to be implemented as a JFrame . . . then that'd be >

Patch: Make clojure.set/union accept any number of arguments

2009-01-20 Thread Konrad Hinsen
I have submitted an issue (with patch) today for making clojure.set/ union accept more than two sets. The operation is well defined, and other similar operations in Clojure (+ * concat ...) take multiple arguments as well, so this looks coherent to me. Moreover, I needed the multi-argument

Re: defmacro returns nil

2009-01-20 Thread Rich Hickey
On Jan 20, 9:29 am, Christophe Grand wrote: > Rich Hickey a écrit :> Thanks - would you please post this as an issue? > > Well. Already turned this mail into an issue (#51). For such issues, > should one directly open an issue without posting to the group? > For now I'd like to stick with firs

Re: Mysterious performance anomalies

2009-01-20 Thread cliffc
fyi... non of the bytecode machines made much headway; once you get above a certain (actually fairly small) size device you can afford a tiny JIT - and even a trivial JIT instantly blows away pure bytecode interpreters; to the point that the energy consumed is actually less even counting the JIT c

Re: Bug in (try (dosync ...) (finally (dosync ...)))?

2009-01-20 Thread Rich Hickey
On Jan 19, 1:59 pm, "John D. Hume" wrote: > With the latest from svn, I'm seeing the following weird behavior. > > (def r (ref :old)) > (let [old-value @r] > (try > (dosync (ref-set r :new)) > (finally > (dosync (ref-set r old-value)) > ))) > (println "@r is" @r) > > This

Re: defmacro returns nil

2009-01-20 Thread Christophe Grand
Rich Hickey a écrit : > Thanks - would you please post this as an issue? > Well. Already turned this mail into an issue (#51). For such issues, should one directly open an issue without posting to the group? Christophe --~--~-~--~~~---~--~~ You received this m

Re: Patch: Arbitrary Symbols between ||

2009-01-20 Thread Rich Hickey
On Jan 14, 10:53 am, Robert Pfeiffer wrote: > On 14 Jan., 13:59, Rich Hickey wrote: > > > [...] the toString in the patch is quite > > inefficient. > > Becausesymbolsare immutable, they could cache the printable > representation in an extra field, but this would double the space > occupied by

Re: defmacro returns nil

2009-01-20 Thread Rich Hickey
On Jan 19, 4:38 am, Christophe Grand wrote: > Hello, > > While playing with clojure.contrib.test-is/with-test I realized that I > was unable to use with-test with macros because the form (defmacro foo > [bar]) returns nil and not #'foo. > Please find attached a patch. > Thanks - would you plea

Re: Clojure blog post about laziness

2009-01-20 Thread Rich Hickey
On Jan 18, 5:17 am, Mark Engelberg wrote: > On Fri, Jan 9, 2009 at 6:00 AM, Rich Hickey wrote: > > When I hadlazy-seqin play, many of those were defined that way. The > > real cost is explaining either whylazy-seqis private, or, if public, > > when/how to use it. > > I'd certainly make use ofl

Re: Patch: Arbitrary Symbols between ||

2009-01-20 Thread Rich Hickey
On Jan 14, 8:47 am, "Christian Vest Hansen" wrote: > On Wed, Jan 14, 2009 at 1:59 PM, Rich Hickey wrote: > > > I am interested insymbolswith arbitrary names, > > Why is this interesting? > It supports working with names from some arbitrary external namespace symbolically. Rich --~--~---

Re: per-defmulti hierarchies

2009-01-20 Thread Rich Hickey
On Jan 20, 12:13 am, Mark Fredrickson wrote: > On the subject of per defmulti hierarchies: > > The recent CLJOS thread got me thinking about this problem again. > While allowing per-multimethod hierarchies solves a large number > problems, I think it might be lacking for a class of needs. I thi

Re: Unexpected binding behavior

2009-01-20 Thread Stuart Halloway
Doh. Disregard my code example. :-) The reasoning is correct however. Stuart > Hi > > On Tue, Jan 20, 2009 at 7:01 AM, Stuart Halloway > wrote: >> >> Lazy evaluation is a harsh mistress. >> >> user=> (def b1 (binding [*num* 1024] (f1))) >> #'user/b1 >> user=> (def b2 (binding [*num* 1024] (f1))

Re: Yet another html templating library

2009-01-20 Thread Christophe Grand
Daniel Jomphe a écrit : > Stuart Sierra wrote: > >> Very interesting, Christophe. I've been playing with StringTemplate >> lately, but this separates design >> from code even further. Can it do conditionals, as in "if this >> variable is true, includes this HTM

Re: Mysterious performance anomalies

2009-01-20 Thread ivant
On Jan 20, 3:14 am, e wrote: > That's a solid arg, too . . . but it would be stronger if we weren't > importing things from java all the time.  If we said like, "(gui-frame > "hello"), which happened to be implemented as a JFrame . . . then that'd be > even stronger.  Drop in a different REPL and