I now have the following. I couldn't find an equivalent of python's join
(in Common Lisp there is format, of course), which takes a string and a
list of strings, and puts the first between all the others...
comments very welcome!
Martin
sageprint(x:InputForm):String ==
atom? x =>
float? x => return float(x)::String
integer? x => return integer(x)::String
string? x => return concat(["_"", string(x)::String, "_""])$String
symbol? x => return string(symbol(x))
S: List String := [sageprint y for y in destruct x]
R: String := new(1 + reduce(_+, [1 + #(s)$String for s in S], 0),
space()$Character)
copyInto!(R, "(", 1)
i := 2
for s in S repeat
copyInto!(R, s, i)
i := i + 1 + #(s)$String
copyInto!(R, ")", i-1)
return R
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.