Thanks Rich,
Expanding into the symbol is clever, but less readable (IMO) than just
expanding into the . form. Anyway, I get it now.
Stuart
> On Feb 15, 2009, at 9:06 AM, Stuart Halloway wrote:
>
>>
>> Does this clarify the point I was making?
>>
>> When writing macros, you cannot dynamically
On Sun, Feb 15, 2009 at 9:06 AM, Stuart Halloway
wrote:
>
> Does this clarify the point I was making?
>
> When writing macros, you cannot dynamically build one of the syntactic
> sugar forms. For example, you cannot write a macro that expands cls
> and member into (cls/member):
>
> (defmacr
On Feb 15, 2009, at 9:06 AM, Stuart Halloway wrote:
>
> Does this clarify the point I was making?
>
> When writing macros, you cannot dynamically build one of the syntactic
> sugar forms. For example, you cannot write a macro that expands cls
> and member into (cls/member):
>
> (defmacro c
Does this clarify the point I was making?
When writing macros, you cannot dynamically build one of the syntactic
sugar forms. For example, you cannot write a macro that expands cls
and member into (cls/member):
(defmacro call-static [cls member] `(~cls/~member))
-> java.lang.Ex
I just wanted to point out that ' is syntactic sugar for (quote) not (list).
(list) will evaluate your arguments, where as '() will not. So if you try to
use them interchangeable you'll run into trouble.
user> (list 1 2 (+ 1 2))
(1 2 3)
user> '(1 2 (+ 1 2))
(1 2 (+ 1 2))
Its a pretty common lisp
Personally I find that the clearest way to think about macros, is to
treat them like a *very* advanced search-and-replace feature.
Just keep in mind that macros expand into code, and check to make sure
that your generated code is indeed valid code.
--~--~-~--~~~---~--~-
Marde, Feb 3, 2009 at 14:24, Konrad Hinsen skribis:
[...]
> I can't think of anything that would be "forbidden" in a macro but
> "allowed" in a plain function. There are many things that don't make
> sense in a macro, of course: launching agents, opening windows, ...
Well, for normal functions y
Thanks Mark, Chouser,
I will update that section of the book with a corrected example in
Beta 7.
Cheers,
Stuart
>
> On Tue, Feb 3, 2009 at 11:26 AM, Mark Volkmann
> wrote:
>>
>> Now I remember what I was thinking about. This isn't so much a
>> difference between macros and functions as it is
Mark Volkmann wrote:
> I see from the feedback so far that my statements are wrong. However,
> I think it's true that there are *some* things you can do in a
> function that you cannot do in a macro, and perhaps vice-versa. Are
> those clearly documented anywhere? If not, what are some?
You migh
Hi!
Am 03.02.2009 um 17:26 schrieb Mark Volkmann:
> On Tue, Feb 3, 2009 at 8:24 AM, Konrad Hinsen > wrote:
>>
>> On Feb 3, 2009, at 14:49, Mark Volkmann wrote:
>>
>>> I see from the feedback so far that my statements are wrong.
>>> However,
>>> I think it's true that there are *some* things y
On Tue, Feb 3, 2009 at 11:26 AM, Mark Volkmann
wrote:
>
> Now I remember what I was thinking about. This isn't so much a
> difference between macros and functions as it is a rule about
> something you cannot do in a macro. Quoting from "Programming Clojure"
> ...
>
> "You cannot write a macro tha
On Tue, Feb 3, 2009 at 8:24 AM, Konrad Hinsen wrote:
>
> On Feb 3, 2009, at 14:49, Mark Volkmann wrote:
>
>> I see from the feedback so far that my statements are wrong. However,
>> I think it's true that there are *some* things you can do in a
>> function that you cannot do in a macro, and perha
On Feb 3, 2009, at 14:49, Mark Volkmann wrote:
> I see from the feedback so far that my statements are wrong. However,
> I think it's true that there are *some* things you can do in a
> function that you cannot do in a macro, and perhaps vice-versa. Are
> those clearly documented anywhere? If not
On Tue, Feb 3, 2009 at 7:32 AM, Konrad Hinsen wrote:
>
> On Feb 3, 2009, at 14:01, Mark Volkmann wrote:
>
>> Are the following statements true? They aren't discussed at
>> http://clojure.org/macros, but I think they are true.
>>
>> Macros cannot call other macros during their evaluation, but they
On Feb 3, 2009, at 14:01, Mark Volkmann wrote:
> Are the following statements true? They aren't discussed at
> http://clojure.org/macros, but I think they are true.
>
> Macros cannot call other macros during their evaluation, but they can
> expand to code that calls macros.
Macros can certainly
On Feb 4, 12:01 am, Mark Volkmann wrote:
> Are the following statements true? They aren't discussed
> athttp://clojure.org/macros, but I think they are true.
>
> Macros cannot call other macros during their evaluation, but they can
> expand to code that calls macros.
I don't know, but I'll br
Are the following statements true? They aren't discussed at
http://clojure.org/macros, but I think they are true.
Macros cannot call other macros during their evaluation, but they can
expand to code that calls macros.
Macros cannot use syntactic sugar such as '(items) to create a list
and instea
17 matches
Mail list logo