Perfect!!!! - It is pure bliss to see such concise code. Regards, Kashyap On Wed, May 8, 2019 at 6:59 AM Alexander Burger <a...@software-lab.de> wrote:
> On Wed, May 08, 2019 at 09:17:54AM +0200, Alexander Burger wrote: > > Yes, "123.0.0" is not a legal number. > > > I am sure there must a better way to do the lengthy "0"..."9" that I've > > > done :) > > The best is to avoid at all looping over the characters, because built-ins > are a > lot faster than individual function calls in a loop. > > What I would do here is > > (pipe > (in '("curl" "-s" " > https://api.iextrading.com/1.0/stock/aapl/chart/3m") > (while > (prin > (echo "close" "volume" "unadjustedVolume") ) > (when (prin (till "," "}")) > (or (sub? "." @) (prin ".")) ) ) ) > (readJson) ) > > The trick is to read the digits with 'till', print them, and *then* check > if a > dot is needed. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >