My mind is blown - yet again. I love it just looking at it. I'll have to
look a little more to see what's going on.
How do I capture the output though - I mean this does not capture the
output in J
(setq J (pipe
(in '("curl" "-s" "https://api.iextrading.com/1.0/stock/aapl/chart/3m
")
(while
(prin
(echo "volume" "unadjustedVolume") )
(echo ",")
(prin ".0,") ) )
(pretty (readJson)) ))
Regards,
Kashyap
On Mon, May 6, 2019 at 1:44 PM Alexander Burger <[email protected]> wrote:
> On Mon, May 06, 2019 at 10:21:34PM +0200, Alexander Burger wrote:
> > (pipe
> > (in '("curl" "-s" "
> https://api.iextrading.com/1.0/stock/aapl/chart/3m")
> > (while
> > (prin
> > (echo "volume" "unadjustedVolume") )
> > (echo ",")
> > (prin ".0,") ) )
> > ...
> > The code echoes all text until it hits one of the target strings. In
> such case
> > it echoes the number till the comma, then prints ".0" and a comma.
>
> This way has the additional advantage that it is extremely fast.
>
> It just scans and echoes the input stream in a single linear pass. Much
> better
> than regular expression matching with all its overhead.
>
> And it is a lot simpler :)
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe
>