Hi Axel,

> I suppose you mean that you want to arrange syntax in a complex
> manner, then evaluate it and you are concerned about the cost of
> rearranging every time the function/macro is called. Suppose also that
> this rearranging can be done as soon as you know the code inside the
> macro form, in CL language after definition time but before runtime.
> In this case you cannot use Alexander's suggestion of using reader
> macros at definition time. Here is a solution:
> 
> (de defmacro "F"
>    (let (@Name (car "F")
>            @Fun (cdr "F")
>            @Arg (pack "X")
>            @Id (pack "WILL EVAL:") )
>       (macro
>          (de @Name @Arg
>             (unless (== (car @Arg) @Id)
>                (con @Arg (apply '@Fun @Arg))
>                (set @Arg @Id) )
>             (eval (cdr @Arg)) ) ) ) )
> (====)

Nice! Very clever! :)

Minor: I would suggest to use 'name' instead of 'pack' to produce the
unique transient symbol, as it is cheaper and probably more clear.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to