Re: (string?) bug

2008-11-12 Thread Stuart Sierra
On Nov 11, 4:27 pm, Dave Newton [EMAIL PROTECTED] wrote: I'd say create your own (stringish? ...) function then--since Clojure is strongly Java-interop returning a T for a non-String would make (string? ...) seem less useful, but that's just my opinion. And every Java object has a

Left-fold enumerators or how to implement map and reduce six times

2008-11-12 Thread Christophe Grand
On my spare time, I've been thinking (and trying) to port Left-Fold Enumerators (http://okmij.org/ftp/Streams.html) to Clojure for a week or so — incidentally (http://clojure-log.n01se.net/date/2008-11-06.html#20:41) I learnt that Rich is also thinking about them. Here is a report of my

Re: Can't create defs outside of current namespace

2008-11-12 Thread wwmorgan
FWIW, there's also a hack without java calls, which Chouser referred to: (binding [*ns* (find-ns 'foo)] (eval '(def bar 3))) although you have to create the namespace yourself if it doesn't exist. On Nov 11, 3:39 pm, MikeM [EMAIL PROTECTED] wrote: This may be a horrible hack, but you can do

Re: Left-fold enumerators or how to implement map and reduce six times [FIXED]

2008-11-12 Thread Christophe Grand
On my spare time, I've been thinking (and trying) to port Left-Fold Enumerators (http://okmij.org/ftp/Streams.html) to Clojure for a week or so — incidentally (http://clojure-log.n01se.net/date/2008-11-06.html#20:41) I learnt that Rich is also thinking about them. Here is a report of my trials

Re: Can't create defs outside of current namespace

2008-11-12 Thread Josip Gracin
Guys, thanks for all the answers. I was posting my follow ups to this thread via Gmail until I realized that Google Groups was bouncing my posts. @#$! Anyway, I used a ref to store my function instead of defn'ing it. Macro expands to (dosync (ref-set fun (fn [] ...)))

Re: thanks, errata, and one gaffe

2008-11-12 Thread Chris Bunch
Great to hear Stuart! I've been very happy with the book so far (it's lived up to the Pragmatic title) and am very much looking forward to the new betas. Just wanted to send my thanks to Rich for developing Clojure and to Stuart for the great book. Keep up the great work! Stuart Halloway

Re: Readable names

2008-11-12 Thread David
On Nov 12, 1:40 pm, Michael Wood [EMAIL PROTECTED] wrote: Your hypothetical IDE, could provide what you want whether or not longer aliases exist. There's nothing stopping someone from writing an IDE that converts aget to array-get or [] when it reads in a file and does the opposite when it

Re: Just Wondering: Tag metadata

2008-11-12 Thread Rich Hickey
On Nov 12, 6:49 pm, samppi [EMAIL PROTECTED] wrote: Onhttp://clojure.org/reader... A shorthand version allows the metadata to be a simple symbol or keyword, in which case it is treated as a single entry map with a key of :tag and a value of the symbol provided, e.g.: #^String

Re: Just Wondering: Tag metadata

2008-11-12 Thread Rich Hickey
On Nov 12, 7:21 pm, samppi [EMAIL PROTECTED] wrote: Ah, yes. I meant, what are these hints? What does the compiler change? Is it some sort of informal type enforcement or something? The hints are described here: http://clojure.org/java_interop#typehints It is strictly a performance

Re: REPL special variables

2008-11-12 Thread Mark Volkmann
Nevermind. I see it's fixed in the latest code in svn. On Nov 12, 7:11 pm, Mark Volkmann [EMAIL PROTECTED] wrote: I don't seem to be able to access the special variables *1, *2, *3 and *e in the REPL. For example, user= (/ 1 0) user= (.printStackTrace *e) outputs java.lang.Exception:

Re: REPL special variables

2008-11-12 Thread Dave Newton
--- On Wed, 11/12/08, Mark Volkmann wrote: I don't seem to be able to access the special variables *1, *2, *3 and *e in the REPL. For example, user= (/ 1 0) user= (.printStackTrace *e) outputs java.lang.Exception: Unable to resolve symbol: *e in this context In which environment/build?

Re: REPL special variables

2008-11-12 Thread Mark Volkmann
On Wed, Nov 12, 2008 at 7:55 PM, Dave Newton [EMAIL PROTECTED] wrote: --- On Wed, 11/12/08, Mark Volkmann wrote: I don't seem to be able to access the special variables *1, *2, *3 and *e in the REPL. For example, user= (/ 1 0) user= (.printStackTrace *e) outputs java.lang.Exception:

iterate

2008-11-12 Thread notallama
i put this at the end of my boot.clj for added fun: (defn iterate returns a lazy seq of arg1, arg2 ... argn, (f arg1 ... argn), (f arg2 ... argn (f arg1 ... argn)), etc. [f [x rest :as all]] (lazy-cons x (apply iterate f (concat rest [(apply f all)] user= (take 10 (iterate + 1 1))