For instance,

FORMAT('NIL,"~12,'0d",123)$Lisp
 "000000000123"

s:=s.(1..#s-1) 
s:=string FORMAT('NIL,"~0,20$",123)$Lisp 
"00000000000000000123" 

https://en.wikipedia.org/wiki/Format_(Common_Lisp)

On Wednesday, 13 April 2022 at 18:47:27 UTC+2 ra...@hemmecke.org wrote:

> On 13.04.22 18:03, Sid Andal wrote:
> > The output file type is for Integers and each solution (hundreds of 
> > thousands of them) is tagged with a six-digit integer identifier for 
> > searching and analysis purposes. Leading zeros allow to distinguish
> > these tags from other integers (the solutions).
>
> Are you sure you want a leading zero as a distinction of the different
> types of solutions?
>
> A little example of input/output would have been very helpful.
>
> > I was thinking about converting the tags with leading zeros into
> > strings, but, then writing them out will be a problem since output
> > file is of type Integer.
>
> Hmmm... first thing that comes to my mind is add 10^50 to your tags and 
> then rely on the fact that a "tag" number starts with "10". ;-)
> Honestly, I find the File(S) feature rather lispy, anyway. It's 
> seamingly not really meant for communication with other programs, but 
> rather with writing out and reading back into FriCAS itself.
>
> But, Kurt has another solution. You can use the function FORMAT from the 
> Lisp that is present underneath FriCAS. That is not a SPAD-only 
> solution, but for your purpose it would probably be the simplest way to 
> achieve your goal.
>
> I leave it to Kurt to post the details.
>
> Ralf
>

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/95135ae4-119b-488d-a73b-3243296b9b14n%40googlegroups.com.

Reply via email to