Re: Review request for my JSON parsing implementation

2019-05-07 Thread C K Kashyap
I ended up making the code less pretty. Looks like the suffix ".0" must only be added if the number is not already in floating point format. (setq J (pipe (in '("sh" "-c" "curl -s https://api.iextrading.com/1.0/stock/aapl/chart/3m";) (while (case (echo "close" "volume" "unadjus

Re: Review request for my JSON parsing implementation

2019-05-07 Thread andreas
You would also include "[" in the 'echo' arguments, then check it with (use S (while (prin (setq S (echo "[" "volume" "unadjustedVolume") ) ) (if (= "[" S) (... step through the elements ...) (echo ",") (pri

Re: Review request for my JSON parsing implementation

2019-05-07 Thread C K Kashyap
Oh yes ... I can see how that would work!!! ... thanks Alex. echo seems like a nice function - I don't think I've seen it anywhere before :) (I mean, I've seen echo that's equivalent of printf ... but not this) Regards, Kashyap On Tue, May 7, 2019 at 8:49 AM Alexander Burger wrote: > On Tue, May

Re: Review request for my JSON parsing implementation

2019-05-07 Thread Alexander Burger
On Tue, May 07, 2019 at 08:13:32AM -0700, C K Kashyap wrote: > Actually my point about array was to read the numbers in the array as fixed > points decimals :) - 1, 2.0,3 -> with correct scaling. Ah, ok, this must be handled separately. You would also include "[" in the 'echo' arguments, then che

Re: Review request for my JSON parsing implementation

2019-05-07 Thread C K Kashyap
(and (echo "," "}") (prin ".0" @) is so cool! Actually my point about array was to read the numbers in the array as fixed points decimals :) - 1, 2.0,3 -> with correct scaling. Regards, Kashyap On Tue, May 7, 2019 at 8:05 AM Alexander Burger wrote: > On Tue, May 07, 2019 at 06:30:15AM -070

Re: Review request for my JSON parsing implementation

2019-05-07 Thread Alexander Burger
On Tue, May 07, 2019 at 06:30:15AM -0700, C K Kashyap wrote: > 1. use (echo "\"volume\"") - this way any "volume" inside a string will not > be confused Yes, or even better include the colon "\"volume\":". > 2. use (echo "," "}") so that it works with values that are the last entry > in the dict

Re: Review request for my JSON parsing implementation

2019-05-07 Thread C K Kashyap
Yeah ... and each line is lot fewer than 80 characters :) just to confirm that I got it - I believe that a couple of changes are needed to make it work better - 1. use (echo "\"volume\"") - this way any "volume" inside a string will not be confused 2. use (echo "," "}") so that it works with values

Re: Review request for my JSON parsing implementation

2019-05-07 Thread Guido Stepken
Some also call it "REST" and have written mighty libraries in other languages. In PicoLisp it's a 5 - liner! ;-) Alexander Burger schrieb am Di., 7. Mai 2019, 07:04: > On Mon, May 06, 2019 at 02:06:56PM -0700, C K Kashyap wrote: > > My mind is blown - yet again. I love it just looking at it. I'