Re: Clojure for LISP programmers....

2008-11-16 Thread Howard Lewis Ship
I generally like that Clojure dispenses with parens that exist for the benefit of the evaluator rather than the developer; thus far fewer parens when using (cond). Still, my old Lisp habits (20 years without use) succumbed as much as Simons. See my earlier thread about exception reporting. Coul

Re: Clojure for LISP programmers....

2008-11-16 Thread mb
Hi Simon, there is a detailed explanation of syntax, data structures etc. as well as a complete reference at the Clojure site[1]. Then there's a wiki[2] with a lot of information of setting Clojure up with different editors like emacs or vim and a lot of examples. Also explaining some of the qui

Re: recur in catch and finally?

2008-11-16 Thread mb
Hi, On 17 Nov., 02:09, Chouser <[EMAIL PROTECTED]> wrote: > You could of course work around this by putting your loop in some > other function and calling it from inside catch. In this specific case I used: (last (take-while #(not (nil? %)) (iterate #(.getCause %) e))) However, a separate funct

Re: Patch: standalone compiler (almost)

2008-11-16 Thread mac
On Nov 17, 4:34 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Nov 16, 9:47 pm, "Stuart Sierra" <[EMAIL PROTECTED]> > wrote: > > > Hi Rich, and all, > > > I took a stab at writing a static compiler class, i.e. a main() that > > just compiles all the .clj files on the command line and saves the

Re: Clojure for LISP programmers....

2008-11-16 Thread Luc Prefontaine
I never read anywhere in the documentation or in the user group that Clojure is a Common LISP implementation. Since it's existence, LISP has not gained a large acceptance in the commercial market compared to other "conventional" programming languages. I started to use it 28 years ago (UCI Lisp on

Re: Patch: standalone compiler (almost)

2008-11-16 Thread Rich Hickey
On Nov 16, 9:47 pm, "Stuart Sierra" <[EMAIL PROTECTED]> wrote: > Hi Rich, and all, > > I took a stab at writing a static compiler class, i.e. a main() that > just compiles all the .clj files on the command line and saves the > .class files. Patch attached. > > It almost works. The only thing t

Re: offtopic - where are you come from? (poll)

2008-11-16 Thread Giancarlo Angulo
manila, philippines! = ANGOL = -|[EMAIL PROTECTED], =|+^_^X++~_~,@- "The only thing worse than a hopeless romantic is a hopeful one" Magbasa bago Mamuna. Mag-isip bago mambatikos Without Truth there is no Justice, Without Justice, there is Tyranny Semper fi Proof of Desire

Patch: standalone compiler (almost)

2008-11-16 Thread Stuart Sierra
Hi Rich, and all, I took a stab at writing a static compiler class, i.e. a main() that just compiles all the .clj files on the command line and saves the .class files. Patch attached. It almost works. The only thing that seems to be missing is creating the class for the namespace itself, like "

clojure.contrib.test-is changes

2008-11-16 Thread Stuart Sierra
Hi folks, I made some small changes to clojure.contrib.test-is: 1. *test-out* now defaults to standard output (instead of standard error). This should be better for SLIME users. 2. Based on Frantisek Sodomka's suggestions, I've added two convenience macros, each= and all-true: user=> (doc all-t

Re: recur in catch and finally?

2008-11-16 Thread Chouser
On Sun, Nov 16, 2008 at 4:23 AM, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > I tried the following code, which is a valid loop, IMHO, since it > doesn't leave the catch clause. > > (try > :xxx > (catch Exception e >(loop [x e] > (if (nil? (.getCause x)) >x >(r

Re: Clojure for LISP programmers....

2008-11-16 Thread Dave Newton
I'll add that: (cond (foo bar) (baz plugh)) => (cond (foo) (bar) (baz) (plugh)) This particular CL difference is listed on the wiki page you listed: http://en.wikibooks.org/wiki/Clojure_Programming#Clojure_for_Common_Lisp_Programmers I also didn't have anywhere near these kinds of problems get

Re: Clojure for LISP programmers....

2008-11-16 Thread Brian W
I'm going to assume this is serious and not a joke, but you do realize Clojure is already quite well documented at clojure.org? #t t => true define defun =>defn car, cdr, caar, etc. ~> first, rest, ffirst, rrest, frest, rfirst arglists are vectors because [ ] stand out better

Re: Stupid Newbie Question-- Auto Indenting in SLIME -- Fixed

2008-11-16 Thread Bill Clementson
Hi Peter, On Sun, Nov 16, 2008 at 11:40 AM, Peter Wolf <[EMAIL PROTECTED]> wrote: > > This is for the other NOOBs... > > Apparently to use SLIME with Clojure, you need to install a Common Lisp. This is not correct. You don't need to install a Common Lisp in order to use SLIME with Clojure. > I

Re: Stupid Newbie Question-- Auto Indenting in SLIME

2008-11-16 Thread David Nolen
I think the latest version of clojure and swank-clojure also requires something like this line in your emacs file: (setq swank-clojure-extra-classpaths (list "/path/to/clojure/classes")) Personally I use the clojure git mirror hosted on github as well as git clone's of clojure-mode and swank-cloju

Compojure and Clojure 1094+

2008-11-16 Thread J . Pablo Fernández
Hello, I've just forked Compojure and made it work with Clojure 1094+, the change is here: http://github.com/pupeno/compojure/commit/3cac756c89f63bbe009dcb6abbeb4646c252dee4 I haven't updated the clojure.jar and clojure-contrib.jar because I don't believe Compojure should distribute those or an

Clojure for LISP programmers....

2008-11-16 Thread Simon Brooke
Has anyone written a very simple introduction to Clojure for LISP hackers? I've spend an evening playing with it pretty intensively, and thus far I haven't got a thing to work. I've read http://en.wikibooks.org/wiki/Clojure_Programming#Clojure_for_Common_Lisp_Programmers, but it hasn't helped me.

Re: Running Clojure scripts at the command line

2008-11-16 Thread Stephen C. Gilardi
On Nov 16, 2008, at 1:21 PM, Stuart Sierra wrote: > I would like both the REPL and Script to be callable from the same > main > (), i.e. you should just be able to call java -jar clojure.jar without > naming a class. Default behavior would be to run a script, as with > bash/perl/ruby, use a sp

Re: reader macros

2008-11-16 Thread Jeff Rose
Rich Hickey wrote: > I've added #! as a to-end-of-line comment, like ; [EMAIL PROTECTED]:~/projects/languages/clojure$ cat foo #!/usr/bin/env clj (println "Hello World!") [EMAIL PROTECTED]:~/projects/languages/clojure$ chmod u+x foo [EMAIL PROTECTED]:~/projects/languages/clojure$ ./foo Hello Wor

Re: Running Clojure scripts at the command line

2008-11-16 Thread Howard Lewis Ship
On Sun, Nov 16, 2008 at 10:21 AM, Stuart Sierra <[EMAIL PROTECTED]> wrote: > > > I would like both the REPL and Script to be callable from the same main > (), i.e. you should just be able to call java -jar clojure.jar without > naming a class. +1 -- Howard M. Lewis Ship Creator Apache Tapestr

Re: Improved exception reporting

2008-11-16 Thread Howard Lewis Ship
Another idea I had was this (and I haven't had a chance to check the source code to see if any of this is already implemented): When Clojure creates a new Java class for a function, it should find a way to hang the meta-data for the function as a static field on the function. Alternately, there

Re: Looking for the inverse of slurp

2008-11-16 Thread Ethan Herdrick
Thanks, Stuarts! On Nov 16, 10:06 am, Stuart Sierra <[EMAIL PROTECTED]> wrote: > Yes, spit is in clojure.contrib.duck-streams. > > Java doesn't support "~", but if you want the home directory you can > get it with > (System/getProperty "user.home") > -Stuart > > On Nov 16, 9:18 am, Stuart Hallowa

Re: Filter repeats

2008-11-16 Thread npt11tpn
Brilliant, thank you very much! Nik On Nov 16, 5:41 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Nov 16, 12:18 pm, "Craig Andera" <[EMAIL PROTECTED]> wrote: > > > > > One way I could think of to do this would be to build a map with each > > unique item as a key and the count as its value. The

Re: A value that equals everything, or, ignoring things in multi-dispatch

2008-11-16 Thread notallama
what i think would be nice here is multimethods taking multiple dispatch functions. (i'm not sure how you'd do that without breaking the default value syntax) so it'd try the first function, and if it doesn't match any method, then it tries the second, etc. then :default, then throws an exception

Re: Stupid Newbie Question-- Auto Indenting in SLIME -- Fixed

2008-11-16 Thread Matt Revelle
On Nov 16, 2008, at 2:40 PM, Peter Wolf <[EMAIL PROTECTED]> wrote: > > This is for the other NOOBs... > > Apparently to use SLIME with Clojure, you need to install a Common > Lisp. This is not the case. > > > I assumed that SLIME was written in EMACS Lisp, but apparently not. > In > his Bl

Re: recur in catch and finally?

2008-11-16 Thread Stephen C. Gilardi
On Nov 16, 2008, at 1:44 PM, Meikel Brandmeyer wrote: > I skimmed through the thread, and it seems the discussion is > for the following case: > > (loop [...] > (try >... >(catch ... (recur ... > > I wouldn't expect this to work. However in my case the structure > was: > > (try > ..

Re: Stupid Newbie Question-- Auto Indenting in SLIME -- Fixed

2008-11-16 Thread Peter Wolf
This is for the other NOOBs... Apparently to use SLIME with Clojure, you need to install a Common Lisp. I assumed that SLIME was written in EMACS Lisp, but apparently not. In his Blog, Bill did say "If you already use a CL implementation with SLIME

Re: recur in catch and finally?

2008-11-16 Thread Meikel Brandmeyer
Hi Stephen, Am 16.11.2008 um 18:55 schrieb Stephen C. Gilardi: Is this intended? It is intended. Please see the discussion here: http://groups.google.com/group/clojure/search?group=clojure&q=recur+catch&qt_g=Search+this+group I skimmed through the thread, and it seems the discussion is for t

Re: Improved exception reporting

2008-11-16 Thread Stuart Sierra
On Nov 16, 8:33 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > I'm certainly interested in improving the error reporting, but in this > partiicular case: > >  java.lang.ClassCastException: clojure.lang.LazyCons > > is my all-time pet-peeve exception message, and it comes from the JVM. > Why on earth

Running Clojure scripts at the command line

2008-11-16 Thread Stuart Sierra
On Nov 16, 1:09 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > Now, with Clojure compiled into its jar and the associated faster   > launching, it's reasonable to think of using Clojure for more tasks   > that might otherwise be done with bash/perl/python. > > That would require a way (idea

Re: Allowing she-bang lines?

2008-11-16 Thread Stuart Sierra
Whoops, just saw: On Nov 16, 2008, at 8:55 AM, Rich Hickey wrote: > I've added #! as a to-end-of-line comment, like ; So never mind. Thanks, Rich! -S On Nov 16, 1:12 pm, Stuart Sierra <[EMAIL PROTECTED]> wrote: > One (hackish) solution would be to write a wrapper script in some > other scripting

Allowing she-bang lines?

2008-11-16 Thread Stuart Sierra
One (hackish) solution would be to write a wrapper script in some other scripting language that chops off the #! line before running Clojure. But maybe, as a special case, the Clojure reader could ignore #! on the first line. I think some Schemes do that. -S On Nov 15, 7:52 pm, Jeff Rose <[EMAI

Re: reader macros

2008-11-16 Thread Stephen C. Gilardi
On Nov 16, 2008, at 8:55 AM, Rich Hickey wrote: > I've added #! as a to-end-of-line comment, like ; Very cool, thanks! Now, with Clojure compiled into its jar and the associated faster launching, it's reasonable to think of using Clojure for more tasks that might otherwise be done with bash

Re: A value that equals everything, or, ignoring things in multi-dispatch

2008-11-16 Thread Stuart Sierra
All multimethods have :default as the default fallback value, regardless of what the dispatch function is. But I assume that only works with single values. Maybe what you want is TWO multimethods, one that dispatches on the first value, then calls the second multimethod to dispatch on the other

Re: Looking for the inverse of slurp

2008-11-16 Thread Stuart Sierra
Yes, spit is in clojure.contrib.duck-streams. Java doesn't support "~", but if you want the home directory you can get it with (System/getProperty "user.home") -Stuart On Nov 16, 9:18 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Hi Ethan > > spit is in Clojure-contrib. I wouldn't expect Cloj

Re: recur in catch and finally?

2008-11-16 Thread Stephen C. Gilardi
On Nov 16, 2008, at 4:23 AM, Meikel Brandmeyer wrote: > I tried the following code, which is a valid loop, IMHO, since it > doesn't leave the catch clause. > > (try > :xxx > (catch Exception e >(loop [x e] > (if (nil? (.getCause x)) >x >(recur (.getCause x)) > > How

Re: Filter repeats

2008-11-16 Thread Rich Hickey
On Nov 16, 12:18 pm, "Craig Andera" <[EMAIL PROTECTED]> wrote: > One way I could think of to do this would be to build a map with each > unique item as a key and the count as its value. Then it would be > trivial to pull out the keys with the count as a specified value. I > started writing this,

Re: Filter repeats

2008-11-16 Thread Craig Andera
One way I could think of to do this would be to build a map with each unique item as a key and the count as its value. Then it would be trivial to pull out the keys with the count as a specified value. I started writing this, but my SLIME is royally screwed up right now after the upgrade to Clojur

Filter repeats

2008-11-16 Thread npt11tpn
Hi guys, This is my first post to the group, but have been following the discussions for almost a year. Many thanks to Rich Hickey for creating a fantastic future-proof language which is a pleasure to use and to the great community! The following function (as part of a chemistry-related applicati

Re: Stupid Newbie Question-- Auto Indenting in SLIME

2008-11-16 Thread Peter Wolf
OK, I think I found the problem. When I start SLIME I get this... See below for my .emacs It looks like SWANK is sending the progn to Clojure which complains. What did I do wrong? Thanks P (progn (load "/usr/share/slime-2008-11-15/swank-loader.lisp" :verbose t) (funcall (read-from-strin

Stupid Newbie Question-- Auto Indenting in SLIME

2008-11-16 Thread Peter Wolf
Hello, I'm feeling dumb... I set up SLIME/SWANK/Clojure on my Linux system, but indentation isn't working. The doc says that indentation should "just work"... but nothing happens. I tried "indent-region", "indent-sexp" and "slime-update-indentation" What's the trick? Thanks P --~--~-

A clojure executable (was: Re: reader macros)

2008-11-16 Thread Dudley Flanders
On Nov 16, 2008, at 7:45 AM, Mark Volkmann wrote: > > On Sun, Nov 16, 2008 at 6:59 AM, Jeff Rose <[EMAIL PROTECTED]> wrote: >> >> For that matter, a standard clj script >> or executable should probably be a part of the package too. > > A big +1! Everybody shouldn't have to write this script the

Re: Problem with loading, classpath, svn 1106

2008-11-16 Thread Josip Gracin
Please disregard! It seems I've had an older version of Clojure in classpath. [EMAIL PROTECTED] Sorry for the noise. On Nov 16, 4:24 pm, Josip Gracin <[EMAIL PROTECTED]> wrote: > I'm getting exception > "Could not locate Clojure resource on classpath" and I don't --~--~-~--~~-

Problem with loading, classpath, svn 1106

2008-11-16 Thread Josip Gracin
Hi! I'm getting exception "Could not locate Clojure resource on classpath" and I don't understand why. From the stack trace it seems like it's trying to load stuff according to the old library scheme, i.e. config/ config.clj. Here's the info: Clojure svn 1106. Main jar file contains: com/inge

Re: offtopic - where are you come from? (poll)

2008-11-16 Thread mehrheit
Vilnius, Lithuania here. --~--~-~--~~~---~--~~ 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 this group, send email to [EMAIL PROTECTED]

Re: Looking for the inverse of slurp

2008-11-16 Thread Stuart Halloway
Hi Ethan spit is in Clojure-contrib. I wouldn't expect Clojure to support OS- specific idioms like ~, because Java doesn't. Stuart > Has the inverse of slurp been added to the core libraries yet? Like > this: > > (spit "Some text" "/foo.txt") > > to make a file called 'foo.txt' containing "

Re: reader macros

2008-11-16 Thread Rich Hickey
On Nov 16, 7:59 am, Jeff Rose <[EMAIL PROTECTED]> wrote: > Thanks for responding. I had already seen the shebang script hack on > the wiki, and although impressive I don't think it's a solution. It's > shocking to me that someone who is into lisp would even think of getting > rid of read macro

Re: reader macros

2008-11-16 Thread Mark Volkmann
On Sun, Nov 16, 2008 at 6:59 AM, Jeff Rose <[EMAIL PROTECTED]> wrote: > > For that matter, a standard clj script > or executable should probably be a part of the package too. A big +1! Everybody shouldn't have to write this script themselves or copy it from the Wiki. It could require that certai

Re: Improved exception reporting

2008-11-16 Thread Rich Hickey
On Nov 14, 3:50 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > On Nov 14, 2008, at 3:11 PM, Howard Lewis Ship wrote: > > > The point is, an exception that said something like: > > > "Expected java.lang.Comparable but received :king" would have helped > > me unravel this much, much easier!

Re: offtopic - where are you come from? (poll)

2008-11-16 Thread stefano
Romano d' Ezzelino, Italy --~--~-~--~~~---~--~~ 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 this group, send email to [EMAIL PROTECTED

Re: reader macros

2008-11-16 Thread Jeff Rose
Thanks for responding. I had already seen the shebang script hack on the wiki, and although impressive I don't think it's a solution. It's shocking to me that someone who is into lisp would even think of getting rid of read macros though. For sure, there is a potential for abuse, but I don'

Re: Testing for lists, vectors, ...

2008-11-16 Thread Stefan Rusek
lists, vecotrs, and hashes all have an empty() method, so (defn clone-coll ([coll clone-item] (clone-item (seq coll) coll clone-item)) ([seq coll clone-item] (if (not seq) (.empty coll) (cons (clone-item (first seq)) (clone-coll (rest seq) coll clone- item)) ) ) ) will

Looking for the inverse of slurp

2008-11-16 Thread Ethan Herdrick
Has the inverse of slurp been added to the core libraries yet? Like this: (spit "Some text" "/foo.txt") to make a file called 'foo.txt' containing "Some text". By the way, it appears that Clojure (or Java) doesn't recognize ~, as in (slurp "~/foo.txt"). True? --~--~-~--~~

Re: Testing for lists, vectors, ...

2008-11-16 Thread Konrad Hinsen
On 15.11.2008, at 23:29, Stephen C. Gilardi wrote: >> But there is no islist?, nor anything that looks equivalent. So how >> do I test if form is a list? Or a vector? Or a map? For processing >> general forms, I'd need to handle all of these, right? Or is there a >> simpler way to do it? > > You

Re: offtopic - where are you come from? (poll)

2008-11-16 Thread Chanwoo Yoo
Seoul, South Korea, which LG and Samsung are belongs to (I know there is few who knows where South Korea is. ^_^; It is placed between China and Japan.) On 10월22일, 오후10시07분, perdalum <[EMAIL PROTECTED]> wrote: > Aarhus, Denmark > > On 17 Okt., 11:27, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote:

recur in catch and finally?

2008-11-16 Thread Meikel Brandmeyer
Hi, I tried the following code, which is a valid loop, IMHO, since it doesn't leave the catch clause. (try :xxx (catch Exception e (loop [x e] (if (nil? (.getCause x)) x (recur (.getCause x)) However I get: java.lang.UnsupportedOperationException: Cannot recur

Re: reader macros

2008-11-16 Thread Meikel Brandmeyer
Hi, Am 16.11.2008 um 04:37 schrieb James Reeves: As far as I'm aware, Clojure doesn't support user reader macros. There's a section in clojure.org/lisps that mentions that the read table is not available to user programs. Yes. Rich doesn't want to include user defined reader macros, until ther