removing quotes



Thank you to all of you.

Robert Dodier a ?crit :
> On 10/13/08, eric.reyssat at math.unicaen.fr <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'm guessing that you only need to handle lists exactly like L,
>   
not exactly since L usually has more terms. Van Nek's idea of using 
iteration make this work.
> if so, I think this should work:
>
> S : printf (false, "((~f, ~f), (~f, ~f))~%", L[1][1], L[1][2],
> L[2][1], L[2][2]);
>  => ((0.00001, 0.00002), (0.00003, 0.00004))
>
> or printf(true, ...) which prints the string to the console, or printf(s, ...)
> which prints the string to stream s (created by opena or openw).
>
> HTH
>
> Robert Dodier
>
>   


van Nek a ?crit :
> (%i1) L:[[1e-5,2e-5],[3e-5,4e-5]]$
> (%i2) printf (false, "~{~{(~h, ~h)~}~^, ~} ~%", L );
> (%o2) (0.00001, 0.00002), (0.00003, 0.00004
My version of maxima gives an error for this because of  unknown ~h, but 
replacing it with  ~7f  gives what I want :

(%i1) build_info()$
Maxima version: 5.14.0
Maxima build date: 21:46 12/27/2007
host type: i686-pc-mingw32
lisp-implementation-type: GNU Common Lisp (GCL)
lisp-implementation-version: GCL 2.6.8

(%i2) L:[[1e-5,2e-5],[3e-5,4e-5]];  printf (false, "~{~{(~h, ~h)~}~^, ~} 
~%", L );
(%o2) [[1.0000000000000001E-5, 2.0000000000000002E-5],
                                [3.0000000000000004E-5, 
4.0000000000000003E-5]]
Maxima encountered a Lisp error:

 Error in FORMAT [or a callee]: Format error: illegal directive.
       V
"~{~{(~h, ~h)~}~^, ~} ~%"

Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
(%i4) printf (false, "~{~{(~7f, ~7f)~}~^, ~} ~%", L );
(%o4) (0.00001, 0.00002), (0.00003, 0.00004)
(%i5)

Stavros Macrakis a ?crit :
> ...
> You mention "string": do you want to *print* the result, or return a 
> string?
I want to put it in a file for further processing (latex). I first tried 
to change brackets to parentheses using "ssubst" on L viewed as a string.
Anyway, your solution is also perfect for me, and probably similar to 
the way printf uses the  ~{...~} directives.


Eric Reyssat