Something like this, perhaps?:
princ(x):=printf(true,"~a",x)$
paren_print(l):=
if listp(l)
then (princ("("),
while l # [] do
(paren_print(l[1]),
if rest(l) # [] then princ(","),
l:rest(l)),
princ(")"))
else printf(true,"~f",l)$
You can't really use "map" here because you don't want a comma after the
last list element, and the mapped function doesn't know whether it's the
last list element.
You mention "string": do you want to *print* the result, or return a string?
Of course, you'll want to specify the precision of the floats, otherwise 0.1
will print as 0.10000000000000001 etc.
-s
On Mon, Oct 13, 2008 at 8:04 AM, <eric.reyssat at math.unicaen.fr> wrote:
> Hi, I want to print the list
>
> L:[[1e-5,2e-5],[3e-5,4e-5]];
>
> as a string with parentheses instead of brackets, decimal rather than
> scientific
> notation, and no quotes around the numbers. Like this :
>
> (0.00001,0.00002),(0.00003,0.00004)
>
> I played around with printf, string, map but have not been able to
> obtain the desired result.
>
> Thanks in advance for any help.
>
>
> Eric Reyssat
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>