Thanks for the link to Rick's introduction. I still have a question - if my program gets its input from two json strings - {"V": 10} and {"V" : 10.1}, and I need to sum up all the Vs - how can I do it? Perhaps, I would have to suppress the . reader macro before calling parseJson and then do a pass to normalize the numbers?
On Sun, May 5, 2019 at 1:10 PM Alexander Burger <a...@software-lab.de> wrote: > On Sun, May 05, 2019 at 08:00:18AM -0700, C K Kashyap wrote: > > : (scl 2) > > -> 2 > > : (parseJson "{\"a\": 10.1}") > > -> (("a" . 1010)) > > : (parseJson "{\"a\": 10}") > > -> (("a" . 10)) > > > > Shouldn't 10 be scaled to 1000? Did I miss something here or is there > > something I need to do so that all the numbers are normalized? > > No, 10 is correct. > > Keep in mind that PicoLisp really only has integers, which may be handled > by a > program as scaled fixpoinbn numbers. > > So the dot in 10.1 is in fact enly a read macro, scaling the number while > *reading* it. > > I recommend Rick's excellent introduction to PicoLisp fixpoint numbers > > https://the-m6.net/blog/fixed-point-arithmetic-in-picolisp/ > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >