Pascal Costanza <········@web.de> writes:
> I have written the following macro.
[snip]
> Its purpose is to allow returning values from somewhere in the
> middle of a function.
>
> So for example you can do the following things.
>
> > (····@
> (format t @"Hello, World!"))
> Hello, World!
> "Hello, World!"
>
> (defmethod test ()
> (format t "Hello, World!"))
>
> (defmethod test :around ()
> (format t "around: ")
> @(call-next-method)
> (format t " :around"))
>
> > (test)
> around: Hello, World! :around
> NIL
>
> The purpose of this posting is to check whether I have got this
> macro right. It seems to work well - but is there anything I might
> have overlooked? Any comments?
What I don't like about it:
(····@ 3 @2 (+ 2 3))
gives an error, and
(····@ 32 @(+ 2 3) (print '(foo @ bar)))
doesn't print (FOO @ BAR) as it (IMHO) should. And the following
doesn't work, either:
(····@ (flet ((foo (x)
(····@
(print 'foo)
@(+ x 2)
(print 'foo-out))))
(format t "(FOO 40) is ~D" (foo 40)))
@(+ 5 7)
18)
Regards,
--
Nils G�sche
"Don't ask for whom the <CTRL-G> tolls."
PGP key ID 0x0655CFA0
Pascal Costanza <········@web.de> wrote:
> Anything else? ;)
Sure ;-)
What do you think
(····@
(let ((@ 2))
@))
should return (once you get rid of the macroexpansion-time errors)?
Hey, when you're done with ····@, don't forget to abstract-out the
more interesting parts. Maybe call it WALKER?
--
Marcus Breiing
···················@breiing.com (will expire)
Marcus Breiing wrote:
> Pascal Costanza <········@web.de> wrote:
>
>
>>Anything else? ;)
>
>
> Sure ;-)
>
> What do you think
>
> (····@
> (let ((@ 2))
> @))
>
> should return (once you get rid of the macroexpansion-time errors)?
Oh dear! ;)
> Hey, when you're done with ····@, don't forget to abstract-out the
> more interesting parts. Maybe call it WALKER?
I haven't exposed myself to tree walkers yet - could you or someone give
me pointer where to read about them?
Thanks,
Pascal
--
Given any rule, however �fundamental� or �necessary� for science, there
are always circumstances when it is advisable not only to ignore the
rule, but to adopt its opposite. - Paul Feyerabend
Pascal Costanza <········@web.de> writes:
> Marcus Breiing wrote:
> > Hey, when you're done with ····@, don't forget to
> > abstract-out the more interesting parts. Maybe call it
> > WALKER?
>
> I haven't exposed myself to tree walkers yet - could you or
> someone give me pointer where to read about them?
Heh -- I gave you those examples to help you understand that what
you need is a fully-fledged code walker /if/ you really want to
descend into the code to replace the occurrences of @. Just
google for ``code walker�� to find one, or do (apropos "walk")
because many Lisp implementations already contain one. However,
all the PROG* forms return simply one of their ``top-level��
forms -- if you do the same, your macro would be much easier to
write -- just don't descend into the code.
Regards,
--
Nils G�sche
Ask not for whom the <CONTROL-G> tolls.
PGP key ID #xD26EF2A0
Nils Goesche wrote:
> Pascal Costanza <········@web.de> writes:
>
>
>>Marcus Breiing wrote:
>
>
>>>Hey, when you're done with ····@, don't forget to
>>>abstract-out the more interesting parts. Maybe call it
>>>WALKER?
>>
>>I haven't exposed myself to tree walkers yet - could you or
>>someone give me pointer where to read about them?
>
>
> Heh -- I gave you those examples to help you understand that what
> you need is a fully-fledged code walker /if/ you really want to
> descend into the code to replace the occurrences of @. Just
> google for ``code walker�� to find one, or do (apropos "walk")
> because many Lisp implementations already contain one.
Of course - sorry!
Pascal
--
Given any rule, however �fundamental� or �necessary� for science, there
are always circumstances when it is advisable not only to ignore the
rule, but to adopt its opposite. - Paul Feyerabend
Pascal Costanza <········@web.de> writes:
> Nils Goesche wrote:
> > Pascal Costanza <········@web.de> writes:
> >
> >>Marcus Breiing wrote:
> >
> >>>Hey, when you're done with ····@, don't forget to
> >>>abstract-out the more interesting parts. Maybe call it
> >>>WALKER?
> >>
> >>I haven't exposed myself to tree walkers yet - could you or
> >>someone give me pointer where to read about them?
> > Heh -- I gave you those examples to help you understand that what
> > you need is a fully-fledged code walker /if/ you really want to
> > descend into the code to replace the occurrences of @. Just
> > google for ``code walker�� to find one, or do (apropos "walk")
> > because many Lisp implementations already contain one.
>
> Of course - sorry!
Wieso sorry? Nur falls Du es nicht weiszt, ``Heh�� ist Englisch
fuer ``Hehe��, nicht ``Hey!�� :-)
Bis denne,
--
Nils G�sche
Ask not for whom the <CONTROL-G> tolls.
PGP key ID #xD26EF2A0
I <···@cartan.de> wrote:
[German gibberish]
Sorry. Was supposed to be mailed. Maybe I should remap the `F�
or `R� key to some different place on my keyboard...
Regards,
--
Nils G�sche
Ask not for whom the <CONTROL-G> tolls.
PGP key ID #xD26EF2A0