x {~^:a: y
turns into
((y { x) { x) { x ...
repeated until you get the same value fetched from x twice in a row.
The results of all the fetches are concatenated into a list. This is
the idiom to use for chasing a linked-list.
Henry Rich
Tracy Harms wrote:
> I'm having difficulty understanding the following verb:
>
> {~^:a:~
>
> from the following bowling-score verb:
>
> framex =: 10 {. 0 {~^:a:~ _1 _1 ,~ i...@# >:@:+ 10&~:
>
>
> I understand several aspects of what it does. I know it's drawing the
> head element, I know it's doing this repeatedly until stable, and I
> know it's returning the accumulated result of all iterations. I know
> that it's qualifying 10s that have the right remainder-of-two to count
> as a strike in context. What I'm not comprehending is how it produces
> more than the first element of the right-hand argument.
>
> Thank you.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm