Robert
Thanks for your hints.
So I should revise printf. There are also two bug reports for other functions from stringproc
reported by Stavros.
But I think I should better wait for the soon coming 5.14. Then there will be a clear maxima-
strings-are-lisp-strings environment also in my Windows Maxima.
Volker
Am 24 Nov 2007 um 10:24 hat Robert Dodier geschrieben:
> On 11/24/07, van Nek <van.nek at arcor.de> wrote:
>
> > (%i1) foo(n) := printf(true,"~d",n)$
> > (%i2) compile(foo)$
> > ...
> > (%i3) foo(7)$
> > 7
> > (%i4) compile(foo)$
> > ...
> > (%i5) foo(7)$
> > n
> >
> > printf is a macro function from package stringproc.
> >
> > Is this behaviour due to printf itself or is there a general problem
> > with compiling macro functions?
>
> The translator generates the following code, which seems OK,
> for a printf call:
>
> foo(x) := printf (true, "FOO: ~a~%", x);
> translate (foo);
> :lisp #'$foo
> => #<FUNCTION $FOO ($X) (DECLARE (IN-DEFUN $FOO) (SPECIAL $X)) (BLOCK
> $FOO ($PRINTF T FOO: ~a~% $X))>
>
> But printf expands its argument x to 'x so it isn't evaluated:
>
> :lisp (macroexpand '($printf t "FOO: ~a~%" $x))
> => (FORMAT T FOO: ~a~% 'x)
>
> I think that's the cause of the observed behavior.
> I don't know if printf should sometimes quote and sometimes not,
> or always not quote, or what.
>
> best
>
> Robert
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima