Re: Currying for Clojure

2008-10-25 Thread Matthew D. Swank
On Oct 23, 8:12 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 22, 6:45 pm, André Thieme <[EMAIL PROTECTED]> wrote: > > > On 23 Okt., 00:28, wwmorgan <[EMAIL PROTECTED]> wrote: > > > > You can get most of the functionality you're looking for with partial > > > Yes sure. The thing is that curr

patch to add character? to boot

2008-10-25 Thread Matthew D. Swank
It's a small thing, but all the other basic types have dedicated predicates. character-p-patch adds this. Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

enforced keyword constraints

2008-10-25 Thread Matthew D. Swank
Keywords are like symbols, except: o They can and must begin with a colon, e.g. :fred. o They cannot contain '.' or name classes. The last requirement does not seem to be enforced by the reader: user> (keyword? :java.lang.Character) true user> (keyword? :Character) true user>

Re: defmacro should return the function, not nil

2008-10-25 Thread V.Quixote
Macros in closure are (fn ...) where the var in which the function resides has a flag in the metadata set. Which means there is no difference between the two except to eval (or apply). I was just thinking that all of the def* should share return values. --~--~-~--~~~--

Re: fns don't support metadata, is it by design?

2008-10-25 Thread James Reeves
On Oct 25, 4:11 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > It's becoming obvious that metadata is desired for many of the   > reference types. It exists for Vars, and has been requested for   > namespaces and fns, and would be useful on Refs and Agents too. I can understand namespaces having me

Re: LazyMap and why Delegation is powerful

2008-10-25 Thread Meikel Brandmeyer
Hello Phil, Am 25.10.2008 um 15:49 schrieb Phil Jordan: I wanted to try your lazy map implementation just now and hit a snag. As I understand it, I should be able to load the library by adding the jar file to the classpath and using user=> (require 'de.kotka.lazymap) however, that gives m

Re: re-def stuff

2008-10-25 Thread Chouser
On Sat, Oct 25, 2008 at 9:19 AM, Krukow <[EMAIL PROTECTED]> wrote: > > I am kind of embarrassed to ask this, but is there a "correct way" to > do this . Do you simply re-def a function, e.g., to time execution: > > (def old-f f) > (defn f [] (time old-f)) Looks good to me. > Under which conditio

Re: Patch: supporting primitive and array classes in print-method

2008-10-25 Thread Rich Hickey
On Oct 24, 5:42 pm, Chas Emerick <[EMAIL PROTECTED]> wrote: > The existing implementation of print-method for Class objects emits > unreadable representations for primitive classes (Float/TYPE, etc) and > array classes (Object[], etc). Attached is a patch that results in > both types of classes

fns don't support metadata, is it by design?

2008-10-25 Thread Rich Hickey
Begin forwarded message: cgrand asked: > > I forgot to ask you: afaik, fns don't support metadata, is it by > design? > The original and 'pure' notion of metadata was only for value types, specifically: (with-meta x new-meta) should not affect x. It's becoming obvious that metadata is d

Re: take goes too far

2008-10-25 Thread Rich Hickey
On Oct 24, 5:44 pm, Chouser <[EMAIL PROTECTED]> wrote: > I ran into a problem with "take" today (thanks to wwmorgan on IRC for > helping steer me away from blaming "filter"). > > My actual code had to do with computing a subset of primes, but let's > take a simpler example. > > (defn painful-seq

Re: LazyMap and why Delegation is powerful

2008-10-25 Thread Phil Jordan
Hi Meikel, Meikel Brandmeyer wrote: > Dear Clojurians, > >> I'd like to announce LazyMap2. LazyMap is to the map types, what >> lazy-cons is to sequences. > And obviously it is broken, because LazyMapSeq implements only ISeq and > not Sequential. The fix is already in the Mercurial repository. >

re-def stuff

2008-10-25 Thread Krukow
I was thinking about the well known idea of connecting to a REPL in a production system and fixing things on the fly without downtime. Rich talks about this in his presentations. I am kind of embarrassed to ask this, but is there a "correct way" to do this . Do you simply re-def a function, e.g.,

Re: lazy death

2008-10-25 Thread Timothy Pratley
Thanks! --~--~-~--~~~---~--~~ 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] For more options,

Re: lazy death

2008-10-25 Thread Parth Malwankar
On Oct 25, 5:27 pm, Timothy Pratley <[EMAIL PROTECTED]> wrote: > > (set! *print-length* 50) > > Ah perfect. Thanks! Is there a way to make this default? clojure.lang.Repl will run all the files listed before it goes to the prompt. So I have my clj script updated to accept a .cljrc.clj file that

Re: Weird exception behavior

2008-10-25 Thread Christopher Taylor
On 24.10.2008 13:39 Uhr, Rich Hickey wrote: >> user=> (test-fn) >> finally clause >> java.lang.RuntimeException: user.UserException: thrown exception >> (NO_SOURCE_FILE:0) >> >> So am I doing something wrong or is this a bug when an exception is >> thrown from inside a call to map? >> > > Current

Re: lazy death

2008-10-25 Thread Timothy Pratley
> (set! *print-length* 50) Ah perfect. Thanks! Is there a way to make this default? --~--~-~--~~~---~--~~ 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 u

Re: lazy death

2008-10-25 Thread Parth Malwankar
On Oct 25, 4:55 pm, Timothy Pratley <[EMAIL PROTECTED]> wrote: > When I screw up a lazy-cons (which happens quite a lot to me), > my repl goes nuts and appears to corrupt the box it lives in. If I > leave it running my monitor blanks out periodically... like some > system register got reset. I c

Re: defmacro should return the function, not nil

2008-10-25 Thread Timothy Pratley
> Doesn't return the return value of the defn, which I think it should > for consistency. I'm new to Lisp so please forgive me if I'm way off track here... Macros are not functions, and don't enjoy the same rights as first class functions (ie: being assignable). Macro-expansion happens before exe

lazy death

2008-10-25 Thread Timothy Pratley
When I screw up a lazy-cons (which happens quite a lot to me), my repl goes nuts and appears to corrupt the box it lives in. If I leave it running my monitor blanks out periodically... like some system register got reset. I can't break the cycle with ctrl-c. Here is a screenshot of the corruption

Re: Modified doto

2008-10-25 Thread V.Quixote
I'd like some version of doto that works on bare Classes --~--~-~--~~~---~--~~ 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, s

defmacro should return the function, not nil

2008-10-25 Thread V.Quixote
It's unlikely to come up, but I noticed this: (macroexpand-1 '(defmacro foo [] 'bar)) =>(do (clojure/defn foo [] (quote bar)) (. (var foo) (setMacro))) Doesn't return the return value of the defn, which I think it should for consistency. --~--~-~--~~~---~--~~ You