Re: eval in macro: No method for dispatch value

2008-12-03 Thread Michiel de Mare
This has nothing to do with eval. The following fails too: (defmacro foo [] (new StringBuffer)) (foo) On Dec 3, 3:22 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Hi Michiel, > > eval is for form data, so I am more surprised that it works for   > ArrayList than that it fails for StringBuffer

Re: eval in macro: No method for dispatch value

2008-12-03 Thread Meikel Brandmeyer
Hi, On 3 Dez., 12:04, Michiel de Mare <[EMAIL PROTECTED]> wrote: > This has nothing to do with eval. The following fails too: > > (defmacro foo [] (new StringBuffer)) > (foo) The results at the Repl are printed via pr-on and obviously print-dup doesn't know how to print a StringBuffer. Sincerel

Re: eval in macro: No method for dispatch value

2008-12-03 Thread Michiel de Mare
Indeed, (print-dup (new StringBuffer) (new java.io.StringWriter)) throws the same exception. But (new StringBuffer) in the REPL prints the stringbuffer just fine. Why does the exception only get triggered in macros? And doesn't print-dup need a default for unknown classes? On Dec 3, 12:23 pm, M

Re: Serializing Clojure objects

2008-12-03 Thread Rich Hickey
On Tue, Dec 2, 2008 at 6:38 PM, Chouser <[EMAIL PROTECTED]> wrote: > > On Tue, Dec 2, 2008 at 3:52 PM, Mark Volkmann <[EMAIL PROTECTED]> > wrote: > > > > (def my-string (print-dup [1 2 3])) > > (def my-data (read my-string)) > > > > Can you give a simple example of serializing and deserializing a

Bug + Post: load failure (depending on file URL)

2008-12-03 Thread ninix
Since SVN rev 1094: RT.lastModified fails when the file is not a jar: or file: URL (for example when it is a bundleresource: URL in an eclipse plugin). With the patch the fallback in this case is to load the source file. http://groups.google.com/group/clojure/web/load_lastModified.patch --~--~-

Re: Supporting protected fields in genclass

2008-12-03 Thread Rich Hickey
On Tue, Dec 2, 2008 at 10:40 PM, Matt Revelle <[EMAIL PROTECTED]> wrote: > Updated patch attached, the extra let for readability looked ugly to > me after some sleep. > > > > > > > > > On Dec 1, 2008, at 3:44 PM, Rich Hickey wrote: > > > > > > > > > On Dec 1, 2:57 pm, Matt Revelle <[EMAIL PROTECTE

Re: slime+clojure problem

2008-12-03 Thread Dimitre Liotev
Peter Eddy wrote: >> How are you attempting to start slime? Are you doing: >> >> 1. C-u M-x slime RET clojure RET >> >> OR >> >> 2. M-- M-x slime RET clojure RET >> > > Well, either method caused this error for me. I deleted all my slime > and clojure-related source trees and re-checked every

Re: [PATCH] Improved Maven Build

2008-12-03 Thread Rich Hickey
On Wed, Dec 3, 2008 at 1:05 AM, Howard Lewis Ship <[EMAIL PROTECTED]> wrote: > I've created a patch for the clojure source that does the following: > > - Adds a minimal site build, with links to the main Clojure web site > (http://clojure.org) > - Generates a source JAR to go with the binary JAR >

Re: eval in macro: No method for dispatch value

2008-12-03 Thread Rich Hickey
On Dec 3, 6:58 am, Michiel de Mare <[EMAIL PROTECTED]> wrote: > Indeed, (print-dup (new StringBuffer) (new java.io.StringWriter)) > throws the same exception. > But (new StringBuffer) in the REPL prints the stringbuffer just fine. > > Why does the exception only get triggered in macros? > > And do

Re: Improved Maven Build

2008-12-03 Thread ivant
On Dec 3, 3:05 pm, "Rich Hickey" <[EMAIL PROTECTED]> wrote: > On Wed, Dec 3, 2008 at 1:05 AM, Howard Lewis Ship <[EMAIL PROTECTED]> wrote: > > > > > I've created a patch for the clojure source that does the following: > > > - Adds a minimal site build, with links to the main Clojure web site > > (

Re: DISCUSS: replace (rand)

2008-12-03 Thread Christian Vest Hansen
For what it is worth, I implemented (for another project) George Marsaglias XorShift algorithm (as recommended in Java Concurrency in Practice) in a thread-safe contention free maner, by making the thread-id part of the source entropy. This way, two threads will generate different random numbers f

Re: Improved Maven Build

2008-12-03 Thread Rich Hickey
On Dec 3, 9:01 am, ivant <[EMAIL PROTECTED]> wrote: > On Dec 3, 3:05 pm, "Rich Hickey" <[EMAIL PROTECTED]> wrote: > > > > > On Wed, Dec 3, 2008 at 1:05 AM, Howard Lewis Ship <[EMAIL PROTECTED]> wrote: > > > > I've created a patch for the clojure source that does the following: > > > > - Adds a m

New: clojure.contrib.repl-ln ?

2008-12-03 Thread Randall R Schulz
Hi, This morning I noticed a new module in Clojure Contrib, "clojure.contrib.repl-ln". But I don't think I've seen any notice of it here or on #clojure. Maybe Stephen Gilardi (the author) would say a little about it? Randall Schulz --~--~-~--~~~---~--~~ You r

clojure.contrib.repl-ln available

2008-12-03 Thread Stephen C. Gilardi
I was just about to do that, Randall. :-) clojure.contrib.repl-ln is a repl that supports lines and line numbers. Here's a session that demonstrates it. --Steve % java -cp clojure.jar:clojure-contrib.jar clojure.main -e "(use 'clojure.contrib.repl-ln)" -e "(repl)" 1:1 user=> ; clojure.contr

Re: clojure.contrib.repl-ln available

2008-12-03 Thread J. McConnell
This looks awesome, great work Stephen! On Wed, Dec 3, 2008 at 9:27 AM, Stephen C. Gilardi <[EMAIL PROTECTED]> wrote: > > I was just about to do that, Randall. :-) > > clojure.contrib.repl-ln is a repl that supports lines and line > numbers. Here's a session that demonstrates it. > > --Steve > >

Re: Improved Maven Build

2008-12-03 Thread Christian Vest Hansen
On Wed, Dec 3, 2008 at 3:01 PM, ivant <[EMAIL PROTECTED]> wrote: > I'm a Maven fan, and I think it'll be good if clojure supports it. > But "support" here can mean different things. And the minimal > "support" for maven could be to just drop the clojure.jar in public > maven repository. And a po

Classpath issue using new main method from jar?

2008-12-03 Thread Craig McDaniel
The classpath specified on the command line seems to be ignored for case #3 (using SVN Rev 1142): 1. Using clojure.lang.Repl java -cp /home/kreg/src/clojure/trunk/clojure.jar:/another/class/path clojure.lang.Repl Clojure user=> (.getProperty System "java.class.path") "/home/kreg/src/clojure/tru

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Randall R Schulz
On Wednesday 03 December 2008 06:27, Stephen C. Gilardi wrote: > I was just about to do that, Randall. :-) Yeah, I'm both nosey and impatient... > clojure.contrib.repl-ln is a repl that supports lines and line > numbers. Here's a session that demonstrates it. Thanks. That looks pretty cool. Do

Re: Classpath issue using new main method from jar?

2008-12-03 Thread Mark Volkmann
Right. Rich pointed out a week or so ago that you can't use -jar together with -cp. That means you can't get around specifying the name of the main class you want to run. On Wed, Dec 3, 2008 at 9:05 AM, Craig McDaniel <[EMAIL PROTECTED]> wrote: > > The classpath specified on the command line seem

Re: Classpath issue using new main method from jar?

2008-12-03 Thread Craig McDaniel
Hmm... I must have missed that. The comment in build.xml regarding how to start Clojure should probably be changed to use clojure.main instead of "-jar clojure.jar". On Dec 3, 10:09 am, "Mark Volkmann" <[EMAIL PROTECTED]> wrote: > Right. Rich pointed out a week or so ago that you can't use -jar >

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 10:06 AM, Randall R Schulz wrote: > Thanks. That looks pretty cool. Do I understand from your example that > if I just hit return I get another prompt? I've been meaning to ask > for > that. Thanks and yes, that's right. > I'm curious how it interacts with rlwrap in general

Re: eval in macro: No method for dispatch value

2008-12-03 Thread Michiel de Mare
Thank you very much for this detailed explanation! Michiel de Mare On Dec 3, 2:47 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Dec 3, 6:58 am, Michiel de Mare <[EMAIL PROTECTED]> wrote: > > > > > Indeed, (print-dup (new StringBuffer) (new java.io.StringWriter)) > > throws the same exception.

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Drew Olson
Would it make sense to add a :gen-class declaration and have the -main function automatically call the repl function? This would make launching the repl less painful for new-comers. - Drew On Wed, Dec 3, 2008 at 9:27 AM, Stephen C. Gilardi <[EMAIL PROTECTED]> wrote: > > I was just about to do tha

Re: Classpath issue using new main method from jar?

2008-12-03 Thread Mark Volkmann
Using "-jar clojure.jar" is fine if you only need the core. I suspect though that most people are going to want the contrib JAR file and other things, so the -jar option won't be used often. On Wed, Dec 3, 2008 at 9:14 AM, Craig McDaniel <[EMAIL PROTECTED]> wrote: > > Hmm... I must have missed th

Re: Classpath issue using new main method from jar?

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 10:14 AM, Craig McDaniel wrote: > Hmm... I must have missed that. The comment in build.xml regarding how > to start Clojure should probably be changed to use clojure.main > instead of "-jar clojure.jar". Yes it should be changed. This command: java -cp clojure.jar clo

Re: Classpath issue using new main method from jar?

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 10:48 AM, Stephen C. Gilardi wrote: > but "java -jar" is almost never the right way to launch Clojure. More correctly put: "java -jar" is almost never the right way to launch clojure.jar --Steve --~--~-~--~~~---~--~~ You received this messa

Re: Improved Maven Build

2008-12-03 Thread Howard Lewis Ship
+1 (avoid Maven, keep POM) I'm moving Tapestry away from Maven as soon as I get chance, but I'll still have a POM for each module, and I'll still distribute it to the Maven central repository ... that part is the one thing that Maven gets really right. In some ways, avoiding Maven for the build

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Randall R Schulz
On Wednesday 03 December 2008 07:37, Stephen C. Gilardi wrote: > ... > > Fixed. Thanks for the detailed report! Detailed, eh? Anyway, that did it and I gotta' say, very cool. And so far it seems there's no adverse interaction with rlwrap. I've modified my Clojure launcher script to have an opt

doc patch: gensym default prefix is G__, not G

2008-12-03 Thread Stuart Halloway
gensym-docs-default-to-match-impl.diff Description: Binary data --~--~-~--~~~---~--~~ 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 unsubscribe from thi

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Dudley Flanders
On Dec 3, 2008, at 9:06 AM, Randall R Schulz wrote: > > Also, does anybody know how gain any degree or kind of control over > signal handling in Java? Preferably pure Java, but since everything > I do > is on Linux, a native-code solution for that platform would be > acceptable. Not in a porta

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Randall R Schulz
On Wednesday 03 December 2008 08:27, Dudley Flanders wrote: > On Dec 3, 2008, at 9:06 AM, Randall R Schulz wrote: > > Also, does anybody know how gain any degree or kind of control over > > signal handling in Java? Preferably pure Java, but since everything > > I do is on Linux, a native-code solu

Re: DISCUSS: replace (rand)

2008-12-03 Thread Mark H.
On Dec 2, 5:42 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Is it big enough to matter? My intuition says "yes".  That's worth   > nothing, so I will write some tests when I have some spare time ...   > but secretly I was hoping that this thread would goad someone else   > into writing the tes

Clojure podcast by Stuart Halloway

2008-12-03 Thread bc
I just noticed that there's a new Clojure podcast by Stuart Halloway on the Pragmatic Programmers site: http://pragprog.com/podcasts/show/24 The blurb says: "Stuart Halloway, author of "Programming Clojure", tells Susannah Pfalzer all about this new and cool programming language. Stuart explain

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Dakshinamurthy Karra
I am using jline with contrib.repl and it is working pretty well. I use this command: java -classpath .:./jline-0.9.93.jar:classes:clojure/clojure.jar:clojure-contrib/clojure-contrib.jar jline.ConsoleRunner clojure.main -e "(use 'clojure.contrib.repl-ln)" -e "(repl)" -- KD Dakshinamurthy Karra

Re: proposal: match multimethod

2008-12-03 Thread axo...@gmail.com
On Dec 2, 2:08 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Dec 2, 12:16 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > > In Ruby, most things match by value equality. But > > classes match their instances. Ranges match things in the range. > > Regexps match strings that they would match ag

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 9:32 AM, Drew Olson wrote: > Would it make sense to add a :gen-class declaration and have the - > main function automatically call the repl function? This would make > launching the repl less painful for new-comers. > > - Drew It is a good idea and I'll work on it. What I d

Re: DISCUSS: replace (rand)

2008-12-03 Thread Konrad Hinsen
On Dec 3, 2008, at 17:45, Mark H. wrote: > I have the feeling that the "right interface" for a single stream of > pseudorandom numbers is a seq, rather than a "function" that you > call. I'd provide two interfaces: 1) Low-level: (rng seed) yielding a pair [random-number, new-seed] 2) High-level

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Randall R Schulz
On Wednesday 03 December 2008 09:10, Dakshinamurthy Karra wrote: > I am using jline with contrib.repl and it is working pretty well. I > use this command: I recently switched from JLine to rlwrap. I think the latter is preferable, but I'm sure there are matters of taste involved. > ... > > --

Bug: clojure.contrib.trace misses a #

2008-12-03 Thread Meikel Brandmeyer
Hi, there is a missing # in the new trace code. Patch attached. One could think, that clojure-contrib uses clojure-contrib: there's defvar in clojure.contrib.def. Sincerely Meikel missing-sharp.patch Description: Binary data smime.p7s Description: S/MIME cryptographic signature

Re: Clojure podcast by Stuart Halloway

2008-12-03 Thread Stuart Halloway
A few other details: the podcast is free, and fairly short (23 minutes). Cheers, Stuart > I just noticed that there's a new Clojure podcast by Stuart Halloway > on the Pragmatic Programmers site: > > http://pragprog.com/podcasts/show/24 > > The blurb says: > > "Stuart Halloway, author of "Progra

Re: Bug: clojure.contrib.trace misses a #

2008-12-03 Thread Stuart Sierra
Fixed, thanks. -Stuart Sierra On Dec 3, 12:36 pm, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > there is a missing # in the new trace code. Patch attached. > One could think, that clojure-contrib uses clojure-contrib: > there's defvar in clojure.contrib.def. > > Sincerely > Meikel > >  m

Re: proposal: match multimethod

2008-12-03 Thread Stuart Sierra
On Dec 2, 2:08 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > I'm pretty sure I don't like the sound of that at all. We had a nice > discussion about fcase/condf, which I'd like to get in, here: > > http://groups.google.com/group/clojure/browse_frm/thread/dee910bef629... And I haven't forgotten abo

Clojure template library

2008-12-03 Thread Jeff Rose
I've just pushed a template library for Clojure up onto github for public use. You can find it here: http://github.com/rosejn/clj-libs/tree/master This library is based loosely on erb from Ruby, which is the only other template system I've used, and it allows you to insert Clojure scriptlets

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Meikel Brandmeyer
Hi, Am 03.12.2008 um 18:24 schrieb Stephen C. Gilardi: Would it make sense to add a :gen-class declaration and have the -main function automatically call the repl function? This would make launching the repl less painful for new-comers. It is a good idea and I'll work on it. What I do at the mo

Re: Clojure template library

2008-12-03 Thread Stuart Sierra
On Dec 3, 1:04 pm, Jeff Rose <[EMAIL PROTECTED]> wrote: > I've just pushed a template library for Clojure up onto github for > public use. Cool! One thing to consider, a noted flaw in ERB: use real XML processing instructions, like "" instead of "<%= .. %>". That way your template can be a valid

PATCH for clojure.contrib.javadoc: use any local/remote javadocs

2008-12-03 Thread Stuart Sierra
Hi Christophe, hi list, I really like clojure.contrib.javadoc; I've wanted something like this for a while. But I wanted it to work for other packages besides the core Java API, so this patch (attached) does that. It also works for both local and remote Javadoc files. What do you think? In the

Re: slime+clojure problem

2008-12-03 Thread Vijay Lakshminarayanan
If you've got enough time to spare, I'd recommend trying out the clojurebox that was released a few days ago. I installed it, ensured it worked and then replicated that in my .emacs. Once you have a basic setup working you can easily make the needed changes to run the latest version. On Wed, De

Re: Clojure template library

2008-12-03 Thread Jeff Rose
Ok, that makes sense. I'll do it. What about the other options available in erb though? Do we use this: * Will '' pass for valid xml? -Jeff Stuart Sierra wrote: > On Dec 3, 1:04 pm, Jeff Rose <[EMAIL PROTECTED]> wrote: >> I've just pushed a template library for Clojure up onto github

Using main(...) Entry Points From Clojure

2008-12-03 Thread Randall R Schulz
Hi, I really like cli4j and have a nice pattern I follow in creating CLI entry points for my project. I find it has a lot of advantages, including a declarative means of defining your CLI syntax using annotations. So I thought it might be nice not to have to write all new interface wrappers

Re: DISCUSS: replace (rand)

2008-12-03 Thread Mark H.
On Dec 3, 9:27 am, Konrad Hinsen <[EMAIL PROTECTED]> wrote: > I'd provide two interfaces: > > 1) Low-level: (rng seed) yielding a pair [random-number, new-seed] > 2) High-level: (random seed) yielding an infinite (obviously lazy)   > seq of the random numbers obtained starting from the given seed.

Re: Using main(...) Entry Points From Clojure

2008-12-03 Thread Randall R Schulz
Hello again, Sorry to follow-up on my own post, but another idea came to me shortly after sending it. On Wednesday 03 December 2008 10:49, Randall R Schulz wrote: > ... > > Between this approach and Steve G.'s new REPL, I feel I'm going to > get an interactive environment for my full suite of t

Re: fix imports

2008-12-03 Thread Vijay Lakshminarayanan
On Tue, Dec 2, 2008 at 1:53 AM, Stuart Sierra <[EMAIL PROTECTED]> wrote: > > On Nov 28, 7:41 am, lpetit <[EMAIL PROTECTED]> wrote: >> The "fix import" action could try to resolve an unknown symbol by >> first searching the symbol in one of the classpath available >> namespaces, and then search for

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Mark Volkmann
On Wed, Dec 3, 2008 at 11:25 AM, Randall R Schulz <[EMAIL PROTECTED]> wrote: > > On Wednesday 03 December 2008 09:10, Dakshinamurthy Karra wrote: >> I am using jline with contrib.repl and it is working pretty well. I >> use this command: > > I recently switched from JLine to rlwrap. I think the la

Re: AOT Compilation for Contrib

2008-12-03 Thread Stephen C. Gilardi
On Nov 28, 2008, at 5:07 PM, Meikel Brandmeyer wrote: > Hi, > > I'm kind of lost with the latest works on the compiler. > However here is a short patch, which modifies build.xml > of contrib to also compile the sources. [...] > The build.xml adds all jar files in the path given by > the CLOJURE

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 1:12 PM, Meikel Brandmeyer wrote: > I tried to trace down, what happens before we enter the Repl. > The only points I noticed were setting the namespace to user > and setting the command-line-args. I wrote a simple main to > do this. Patch attached. To be started with clojure.c

Re: clojure.contrib.repl-ln available

2008-12-03 Thread Randall R Schulz
On Wednesday 03 December 2008 11:26, Mark Volkmann wrote: > On Wed, Dec 3, 2008 at 11:25 AM, Randall R Schulz <[EMAIL PROTECTED]> wrote: > > On Wednesday 03 December 2008 09:10, Dakshinamurthy Karra wrote: > >> I am using jline with contrib.repl and it is working pretty well. > >> I use this comm

A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Meikel Brandmeyer
Hi Stuart and Rich, Am 03.12.2008 um 19:00 schrieb Stuart Sierra: I'm pretty sure I don't like the sound of that at all. We had a nice discussion about fcase/condf, which I'd like to get in, here: http://groups.google.com/group/clojure/browse_frm/thread/ dee910bef629... And I haven't forgott

Building regex pattern literals (Noob question)

2008-12-03 Thread Blaine
I want to build a regular expression pattern literal (I think that's what they're called) like #"a.*" out of separate strings like "a" and ".*". user> (re-seq #"a.*" "bab") ; this is cool ("ab") user> (re-seq #(str "a" ".*") "bab") ; but this, in all its noobness, is not ; Evaluation aborted.

Re: Building regex pattern literals (Noob question)

2008-12-03 Thread Randall R Schulz
On Wednesday 03 December 2008 11:57, Blaine wrote: > I want to build a regular expression pattern literal (I think that's > what they're called) like #"a.*" out of separate strings like "a" and > ".*". > > user> (re-seq #"a.*" "bab") ; this is cool > ("ab") > user> (re-seq #(str "a" ".*") "bab")

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Brian Doyle
Can you include an example usage of this function? Thanks. On Wed, Dec 3, 2008 at 12:51 PM, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi Stuart and Rich, > > Am 03.12.2008 um 19:00 schrieb Stuart Sierra: > >> I'm pretty sure I don't like the sound of that at all. We had a nice >>> discussio

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Meikel Brandmeyer
Hello again, Am 03.12.2008 um 20:51 schrieb Meikel Brandmeyer: cls (mapcat (fn [[x c]] `[(~xprd ~xndl ~x) ~c]) (partition 2 cls)) xndl (gensym "condp_needle__") xprd (gensym "condp_predicate__") Oops. These should of course be changed to be in the right order. Sincerel

Re: Building regex pattern literals (Noob question)

2008-12-03 Thread J. McConnell
On Wed, Dec 3, 2008 at 3:10 PM, Randall R Schulz <[EMAIL PROTECTED]> wrote: > > You're using a reader notation unrelated to regular expressions. > Instead, #(...) is a shorthand notation for an anonymous function > definition. You can read more about the other reader macros here: http://clojure.

Re: Clojure podcast by Stuart Halloway

2008-12-03 Thread Randall R Schulz
On Wednesday 03 December 2008 09:07, bc wrote: > I just noticed that there's a new Clojure podcast by Stuart Halloway > on the Pragmatic Programmers site: > > http://pragprog.com/podcasts/show/24 > > ... I just listened to the interview. It was good, but I think for denizens here, there won't be

Re: Building regex pattern literals (Noob question)

2008-12-03 Thread Chouser
On Wed, Dec 3, 2008 at 2:57 PM, Blaine <[EMAIL PROTECTED]> wrote: > > I want to build a regular expression pattern literal (I think that's > what they're called) like #"a.*" out of separate strings like "a" and > ".*". > > user> (re-seq #"a.*" "bab") ; this is cool > ("ab") > user> (re-seq #(str

Adding boolean?

2008-12-03 Thread Tom Emerson
I found myself needing the following today, and it was noticeably missing from core.clj --- any reason not to include it? (defn boolean? "Returns true if b is a Boolean (i.e., true or false)" [b] (instance? Boolean b)) Peace, -tree -- Tom Emerson [EMAIL PROTECTED] http://www.dreamer

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Meikel Brandmeyer
Hi, Am 03.12.2008 um 21:10 schrieb Brian Doyle: Can you include an example usage of this function? Thanks. (condp = x 1 "We got a one." 2 (str "We got a " (- 3 1)) "We got something else.")) Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: Clojure could be to Concurrency-Oriented Programming what Java was to OOP

2008-12-03 Thread Bill Clementson
Hi Mark, On Tue, Dec 2, 2008 at 10:38 PM, Mark H. <[EMAIL PROTECTED]> wrote: > On Dec 1, 12:03 am, bc <[EMAIL PROTECTED]> wrote: >> I've written a blog post titled "Clojure could be to Concurrency- >> Oriented Programming what Java was to OOP" in which I discuss >> Clojure's approach to concurren

Extending Clojure's STM with external transactions

2008-12-03 Thread Dave Griffith
It often happens that I would like to have gaurantees about the consistency of in-memory data structures and external resources. For instance, in the last two large systems I've built, the system would respond to an external message received via socket, do some complex processing based on the co

Re: slime+clojure problem

2008-12-03 Thread Dimitre Liotev
Vijay Lakshminarayanan wrote: > If you've got enough time to spare, I'd recommend trying out the > clojurebox that was released a few days ago. I installed it, ensured > it worked and then replicated that in my .emacs. > > Once you have a basic setup working you can easily make the needed > chang

Re: AOT Compilation for Contrib

2008-12-03 Thread Meikel Brandmeyer
Hello Stephen, Am 03.12.2008 um 20:35 schrieb Stephen C. Gilardi: Can we make clojure-contrib/build.xml work such that if you specify a location for a clojure.jar as a property, it compiles (the stand-alone compilable parts of ) clojure-contrib into clojure-contrib.jar, but if you don't specify

Re: Embedding Clojure/swank into existing Java system

2008-12-03 Thread Anton Vodonosov
Hi Craig, clojure.main/with-bindings was exactly what I needed. With it my JSP became trivial few liner: http://paste.lisp.org/display/71541 Thank you. - Anton --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cloju

Re: Building regex pattern literals (Noob question)

2008-12-03 Thread Blaine
I'm all straightened out. Thanks everyone. Very helpful. On Dec 3, 3:18 pm, Chouser <[EMAIL PROTECTED]> wrote: > On Wed, Dec 3, 2008 at 2:57 PM, Blaine <[EMAIL PROTECTED]> wrote: > > > I want to build a regular expression pattern literal (I think that's > > what they're called) like #"a.*" out

Re: AOT Compilation for Contrib

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 4:23 PM, Meikel Brandmeyer wrote: > I think your initial suggestion, is a good idea. I changed the > build.xml file to look for a property called clojure.jar. If it > exists, we use it and compile the libraries. Otherwise - well - > we don't... > > Invocation: ant -Dclojure.ja

Clojure indentation conventions

2008-12-03 Thread levand
I am coming to Clojure from the Java side, and am completely ignorant about lisp indentation & newline conventions. Some things are easy to pick up from posted examples and common sense...newline + tab after the parameters vector when defining a function, etc. But I did some web searches on lisp

Re: AOT Compilation for Contrib

2008-12-03 Thread Drew Olson
On Wed, Dec 3, 2008 at 5:27 PM, Stephen C. Gilardi <[EMAIL PROTECTED]> wrote: Buildfile: build.xml > > init: > [mkdir] Created dir: /ext/clojure-contrib/classes > > compile_clojure: > [java] Compiling clojure.contrib.command-line to /ext/clojure- > contrib/classes > [java] Comp

Re: Clojure indentation conventions

2008-12-03 Thread Meikel Brandmeyer
Hi, Am 03.12.2008 um 22:06 schrieb levand: I am coming to Clojure from the Java side, and am completely ignorant about lisp indentation & newline conventions. Good. Then you aren't spoiled, yet. ;) My advice: get a reasonable editor like emacs or vim and the corresponding clojure modes. They

Monadic Parsing

2008-12-03 Thread jim
Continuing with the monad theme, I decided to implement monadic parsing in Clojure. Erik Meijer and Graham Hutton published a paper called "Monadic Parsing in Haskell" and I implemented the examples from that paper in Clojure. The code is available here: http://groups.google.com/group/clojure/w

For Comprehension and println (Noob Question)

2008-12-03 Thread aria42
Hi all, When I run the following from the REPL, I see the result of the "println" (defn read-docs [duc-dir] (for [file (.listFiles (java.io.File. duc-dir)) :when (.isFile file)] (do (println file) (.getName file However, when embedded in a script (u

Re: Extending Clojure's STM with external transactions

2008-12-03 Thread Rich Hickey
On Dec 3, 3:48 pm, Dave Griffith <[EMAIL PROTECTED]> wrote: > It often happens that I would like to have gaurantees about the > consistency of in-memory data structures and external resources. For > instance, in the last two large systems I've built, the system would > respond to an external me

Re: change in doto behavior

2008-12-03 Thread Blaine
The example on http://clojure.org/jvm_hosted should reflect this. I'm not sure this is the proper venue to report such stuff. I've used this example (successfully) to convince those that normally walk away when I start talking about lisp to give clojure a look. I just cut and paste it into the

Re: For Comprehension and println (Noob Question)

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 7:19 PM, aria42 wrote: > Hi all, > When I run the following from the REPL, I see the result of the > "println" > > (defn read-docs [duc-dir] > (for [file (.listFiles (java.io.File. duc-dir)) > :when (.isFile file)] > (do > (println file) > (.get

Re: Clojure indentation conventions

2008-12-03 Thread Mark Volkmann
On Wed, Dec 3, 2008 at 4:49 PM, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > Am 03.12.2008 um 22:06 schrieb levand: >> >> I am coming to Clojure from the Java side, and am completely ignorant >> about lisp indentation & newline conventions. > > Good. Then you aren't spoiled, yet. ;) > >

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Rich Hickey
On Dec 3, 2:51 pm, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi Stuart and Rich, > > Am 03.12.2008 um 19:00 schrieb Stuart Sierra: > > >> I'm pretty sure I don't like the sound of that at all. We had a nice > >> discussion about fcase/condf, which I'd like to get in, here: > > >>http://grou

Unary Application of (= ...)

2008-12-03 Thread Randall R Schulz
Hi, What's the rationale for accepting unary applications of =? To wit: user=> (= nil) true user=> (= true) true user=> (= false) true user=> (= 0) true user=> (= 1) true user=> (= =) true etc. By the way, I do understand while (or) is false and (and) is true, but I don't see why = all

Re: Unary Application of (= ...)

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 9:15 PM, Randall R Schulz wrote: > By the way, I do understand while (or) is false and (and) is true, > but I > don't see why = allows a single argument. I don't know the answer, but I do see it making sense as the final value in this sequence: (= 1 1 1 ...) (= 1 1 1) (=

Re: Unary Application of (= ...)

2008-12-03 Thread Randall R Schulz
On Wednesday 03 December 2008 18:28, Stephen C. Gilardi wrote: > On Dec 3, 2008, at 9:15 PM, Randall R Schulz wrote: > > By the way, I do understand while (or) is false and (and) is true, > > but I don't see why = allows a single argument. > > I don't know the answer, but I do see it making sense

Re: Unary Application of (= ...)

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 9:39 PM, Randall R Schulz wrote: > OK, so it's consistent with the null-ary (and) (no argument is false) > and (or) (there is a true argument). But from that perspective, > shouldn't the definition extend to the null-ary case, too? I think not. How would you decide the values

Re: Unary Application of (= ...)

2008-12-03 Thread Randall R Schulz
On Wednesday 03 December 2008 18:48, Stephen C. Gilardi wrote: > On Dec 3, 2008, at 9:39 PM, Randall R Schulz wrote: > > OK, so it's consistent with the null-ary (and) (no argument is > > false) and (or) (there is a true argument). But from that > > perspective, shouldn't the definition extend to

Re: slime+clojure problem

2008-12-03 Thread Vijay Lakshminarayanan
On Thu, Dec 4, 2008 at 2:33 AM, Dimitre Liotev <[EMAIL PROTECTED]> wrote: > > Vijay Lakshminarayanan wrote: >> If you've got enough time to spare, I'd recommend trying out the >> clojurebox that was released a few days ago. I installed it, ensured >> it worked and then replicated that in my .emac

Re: delimited continuations for web development

2008-12-03 Thread Monsieur Pinocchio
On Tue, Dec 2, 2008 at 12:52 PM "Jan Rychter" <[EMAIL PROTECTED]> wrote: > > Rich Hickey <[EMAIL PROTECTED]> writes: > > On Jun 20, 11:58 am, Jaime Barciela <[EMAIL PROTECTED]> wrote: > >> Hello Phil, > >> > >> My understanding is that Common Lisp doesn't have support for > >> continuations either

License of/permission for Clojure's logo

2008-12-03 Thread samppi
I want to put the Clojure logo: http://clojure.googlegroups.com/web/Clojure-logo.png?gda=y8lqvUIAAABoLitVpBTEcNIQc_NHg39S6iU75fHiOxnOGiH4bfPrlzZZL8wLBEcX9EgDZpMYxIxV4u3aa4iAIyYQIqbG9naPgh6o8ccLBvP6Chud5KMzIQ ...on Wikipedia's article on Clojure. What is the license of Clojure's logo--is it a free

(doc)strings after param in defn

2008-12-03 Thread Mon Key
I apologize if this has been brought up before... But, where does the doc string on the `my-test' defn below reside. In case one evaluating (doc my-test returns the doc string. In case two (doc evaluates the string as nil). Is this value interned with the symbol and if so where and how do I ac

Bug: recur won't work in tail position within cond

2008-12-03 Thread puzzler
(defn sub-til-0 [n] (if (zero? n) 0 (recur (dec 1 works but the equivalent (defn sub-til-0 [n] (cond [(zero? n) 0] [:else (recur (dec 1))])) does not. Recursion is already limited enough in Clojure... give us recur in tail position within cond! :) Thanks, Mark --~--~-

Re: Unary Application of (= ...)

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 9:58 PM, Randall R Schulz wrote: > But it is also the case that subtraction and division _do_ have > identity > elements. They follow directly from the application of the inverse > operation to the corresponding operator's identity element. In other > words, the identity elem

Re: delimited continuations for web development

2008-12-03 Thread harrison clarke
the hard part about implementing continuations in a language that doesn't already support them is that you're trying to capture it from within. with a delimited continuation, you're capturing it from the outside, so you don't have that problem. --~--~-~--~~~---~--~

Re: Bug: recur won't work in tail position within cond

2008-12-03 Thread harrison clarke
did cond change syntax? last i checked, it was (cond (case) (expr) (case) (expr) ) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojur

Re: Bug: recur won't work in tail position within cond

2008-12-03 Thread Brian Doyle
This seems to work for me: (defn sub-til-0 [n] (cond (zero? n) 0 :else (recur (dec 1 I'm not sure what those extra ['s are for in your example. On Wed, Dec 3, 2008 at 9:39 PM, puzzler <[EMAIL PROTECTED]> wrote: > > (defn sub-til-0 [n] > (if (zero? n) 0 (recur (dec 1 > >

Re: (doc)strings after param in defn

2008-12-03 Thread Stephen C. Gilardi
On Dec 3, 2008, at 11:35 PM, Mon Key wrote: > I apologize if this has been brought up before... But, where does > the doc string on the `my-test' defn below reside. It becomes metadata for the var that your defn form defines. You can see all the metadata with (meta (var my-test)). > If not,

Re: Unary Application of (= ...)

2008-12-03 Thread Krukow
On Dec 4, 5:40 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > I agree. By the identity element argument, (/) should be 1 and (-)   > should be 0. > Regarding *the* identity argument, I think it only works if the operator is associative. Otherwise, you can talk about a left identity or a

Re: (doc)strings after param in defn

2008-12-03 Thread Mon Key
I'm sure I'm missing something Maybe I should re address the issue in a different way; outside of `meta' what other way is there to do a *visual* check/comparison to test if two otherwise identical and/or nearly identical symbols contain identical slot values? In the case where the `doc' str

  1   2   >