Oz and Mozart Users Mailing List

Re: Checksum mismatch and trivial question


From: Adriano Volpones (adriano.volpones@arscomputandi.com)
Date: Tue Dec 03 2002 - 11:43:41 CET


Thanks a lot Denys,
the ozmake utility resolved the problem.

I have another trivial question:

I would like a padding function for integers: the follwing is my best, but is there another way more direct ?

OPI
------------------------------------------------------------------------------
declare
fun {PrintPaddedToRight Val Size Ch}
   BStr = {ByteString.make {Value.toVirtualString Val 1 1}}
   Len = {ByteString.length BStr}
   Blank
in
   if Len>=Size
   then
      {ByteString.toString {ByteString.slice BStr Len-Size Len}}
   else
      Blank={ByteString.make {Map {MakeList Size-Len} fun{$ E} E=Ch end}}
      {ByteString.toString {ByteString.append Blank BStr}}
   end
end

{Browse {StringToAtom {PrintPaddedToRight 12345 8 &0}}}
------------------------------------------------------------------------------
 

Thanks again,

        Adriano
 
-----
Adriano Volpones
Ars Computandi s.c.r.l.
via G.Donizetti, 20
24040 Canonica D'Adda - BERGAMO - ITALY
phone +39 035 501410 cell. +39 347 8344988
adriano.volpones@arscomputandi.com http://www.arscomputandi.com

-
Please send submissions to users@mozart-oz.org
and administriva mail to users-request@mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.



This archive was generated by hypermail 2b29.