Re: Request for review of my string to float function

2019-03-30 Thread C K Kashyap
Thanks Alex, Sorry ... I was distracted exploring vip :) ... I like the rule - "In PicoLisp a shorter program is also faster" :) What I take away is this. Whether it is 1 byte or 32 per character, one will have to consider a case when the whole file does not fit in memory (although a factor of 32

Re: Request for review of my string to float function

2019-03-30 Thread Alexander Burger
On Sat, Mar 30, 2019 at 06:10:02PM +0100, Alexander Burger wrote: > > About 1 cell per character - if I understand correctly, that would be > > 16bytes per character on 64 bit I forgot to explain one more thing: It is not 16, but 32 bytes per character! Each character in a 'chop'ped string is a t

Re: Request for review of my string to float function

2019-03-30 Thread Alexander Burger
On Sat, Mar 30, 2019 at 09:04:28AM -0700, C K Kashyap wrote: > The sample you shared certainly looks more elegant. I have a follow up > question though - we seem to do 3 iterations in it, the main one, one for > length and one for member. Coming to think of it, given my scenario, its > negligible.

Re: Request for review of my string to float function

2019-03-30 Thread C K Kashyap
Thank you so much Alex, I just love this - #-> (and (= "." (car Lst)) (on P)) :) The sample you shared certainly looks more elegant. I have a follow up question though - we seem to do 3 iterations in it, the main one, one for length and one for member. Coming to think of it, given my scenario, i

Re: Request for review of my string to float function

2019-03-30 Thread Alexander Burger
Hi Kashyap, > While working on the json library I had to write a string to float I recommend to use upper case for locally bound symbols (de isNum (N) (or (= "." N) (num? (format N))) ) The 'num?' can be omitted, because 'format' returns NIL if it does not succeed. (or (= "." N)

Request for review of my string to float function

2019-03-30 Thread C K Kashyap
Hi, While working on the json library I had to write a string to float function. In a list of characters when I encounter a digit, I'd like to go over the rest of the list and consume all the digits (and possibly a period) that form a number. I'd appreciate some feedback from a Lispiness and PicoLi