If I wanted to produce a verb, I would do the following,
o=. @:
K=. <;:'&*'
U=. <(<,'&'),<<(":0);1
ku=. K , U ($~) ]
train=. (<'`:')(0:`)(,^:)&6
up=. train o ku f.
2 (up 1) 4
16
2 (up 2) 4
65536
2 (up 3) 3
65536
3 (up 2) 2
27
3 (up 2) 3
7625597484987
If I were forced to be grammatically correct, then I could do this,
Up=.'(ku x)`:6'(adverb :)
2 (1 Up) 4
16
2 (2 Up) 4
65536
2 (3 Up) 3
65536
3 (2 Up) 2
27
3 (2 Up) 3
7625597484987
instead.
I hope it helps.
On Tue, Sep 18, 2018 at 2:39 AM, Skip Cave <[email protected]> wrote:
> How would a J programmer build a verb that would emulate Knuth's up-arrow
> notation <https://goo.gl/7pCZKW>? (https://goo.gl/7pCZKW). Tacit &
> explicit
> versions would be nice.
>
> Examples - assuming the verb 'u' is the up-arrow:
>
> 2 u 4 = 16
> 2 u u 4 = 65536
> 2 u u u 3 = 65536
> 3 u u 2 = 27
> 3 u u 3 = 7,625,597,484,987
>
> Skip
>
> Skip Cave
> Cave Consulting LLC
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm