Re: Why is this an Exception ?

2014-08-31 Thread Alex Baranosky
There is no pot of gold at the end of the no-namespacing rainbow. Only sadness. :'( On Sat, Aug 30, 2014 at 9:29 AM, Andy Fingerhut wrote: > How would another Lisp avoid giving you an error when referring to a > symbol that has no value? > > If you just want your entire program in a single name

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-31 Thread Atamert Ölçgen
Hi Francis, On Sat, Aug 30, 2014 at 1:34 PM, Francis Avila wrote: > It would probably help if you said more about the source of this > atom-holding object. Is it a plain Java class? A deftype/defrecord? Is it > final? > It's not an atom-holding object. The only guarantee is that this object ex

Macro that modifies the body of a function

2014-08-31 Thread Yehonathan Sharvit
I tried to write a macro that wraps the code a function with a try/catch statement. It works fine for regular functions but it doesn't work for multimethods. I understand the reason, but I don't know how to fix it. Here is my code: (defmacro deftry [name args & body] " https://groups.google.com/

Re: Macro that modifies the body of a function

2014-08-31 Thread Beau Fabry
This isn't a multimethod, it's a multiple-arity function. Anyway, you just need to detect that someone has tried to define a multiple arity method and change your definition accordingly. Something like below. I haven't actually tried this code so it's almost definitely wrong but you get the gis

Re: Resources for intermediate/not-absolute-beginner Clojurians

2014-08-31 Thread Vladimir Bokov
Great idea Alex! I'll be waiting for the book воскресенье, 31 августа 2014 г., 1:58:18 UTC+7 пользователь Alex Miller написал: > > Hi Sam, > > I am working on a book for Pragmatic Programmers with Ben Vandgrift called > "Clojure Applied" that is target specifically at people like yourself. Our

Re: Macro that modifies the body of a function

2014-08-31 Thread Yehonathan Sharvit
Thanks a lot Beau. Your code almost worked. This is the working code -- you just forgot the '&' between args and body :) I am impressed that you were able to write a macro without any repl... (defmacro deftry [& definition] (if (vector? (second definition)) (let [[name args & body] de

Re: Macro that modifies the body of a function

2014-08-31 Thread Beau Fabry
> I am impressed that you were able to write a macro without any repl... Pretty amazed myself. Never seems to happen when it's code that I'm trying to write for myself :-) On Monday, September 1, 2014 12:06:45 AM UTC+10, Yehonathan Sharvit wrote: > > Thanks a lot Beau. > > Your code almost worke

Re: Macro that modifies the body of a function

2014-08-31 Thread Isaac Zeng
;;; there is a simple, but not a good way ;;; (deftry foo [x] x) ;;; (:arglists (meta #'foo)) => ([& args__5399__auto__]) (defmacro deftry [name & fdecl] `(defn ~name [& args#] (try (apply (fn ~@fdecl) args#) (catch Error e# (println "err caught" e#) ;;; this is

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-31 Thread adrian . medina
If you don't want to wrap the object in an atom, you can also reify an object that supports IDeref which returns your object. All reified objects support IObj out of the box. On Sunday, August 31, 2014 4:55:58 AM UTC-4, Atamert Ölçgen wrote: > > Hi Francis, > > > On Sat, Aug 30, 2014 at 1:34 PM

Re: clojure streams

2014-08-31 Thread Andy Fingerhut
I have a note in a list of things to do that I have been maintaining that says " Remove now-obsolete http://clojure.org/streams and any links to it (RH said in 2009 that streams lost to chunked sequences)". I don't have a link handy to that email that suggested this change, nor to a quote by Rich

Re: clojure streams

2014-08-31 Thread Andy Fingerhut
Found it: "Don't worry about streams - they lost to chunked seqs. Any vestiges just need to be removed. -- Rich" https://groups.google.com/forum/#!msg/clojure-dev/VcHaPv0s_90/EkGmLyzV7ZoJ It seems like at least marking the page http://clojure.org/streams near the top with a message that it is

Re: Transducers are Coming

2014-08-31 Thread Niels van Klaveren
Great to see that it's on the cards. Really looking forward to be able to use this when stable. Also, wouldn't transducers also open up the way to define the chunking size of transduced lazy operations ? Something like (with-chunk-size 1 (xform data)) ? Or would this make chunking a non-issue a

Howto Load Project Namespaces in Leiningen Plugins

2014-08-31 Thread Timothy Washington
Ok, So I'm trying to write a leiningen plugin that takes some namespace arguments. Let's call it **. This is a brand new plugin, so everything else is empty, and this value is present: *{:eval-in-leiningen true}*. My problem happens when, in the context of the project ** is acting on, the plugin c

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-31 Thread Atamert Ölçgen
On Mon, Sep 1, 2014 at 1:52 AM, wrote: > If you don't want to wrap the object in an atom, you can also reify an > object that supports IDeref which returns your object. All reified objects > support IObj out of the box. > As I said earlier: ... can't deref it since I can't change the functions