Thanks Alex,
After looking at the docs for echo I can follow what's going on. it's
pretty nifty!
Since all the numbers I need are values of dictionary keys, this technique
would work perfectly!
Regards,
Kashyap

On Mon, May 6, 2019 at 2:06 PM C K Kashyap <ckkash...@gmail.com> wrote:

> 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 <a...@software-lab.de>
> 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:picolisp@software-lab.de?subject=Unsubscribe
>>
>

Reply via email to