Ok Pepe  - getting off topic, I know, but I'd just been solving
a Listener Crossword (no 4373) which happens to be a numerical
one,  and I happened to have used uppercase A B C etc to
represent the entries,  which,  funnily enough are labelled
A B C ... !

Hadn't thought of clearing the decks.  I'll try again in a
clean environment.

Thanks,
Mike

On 21/11/2015 13:46, Jose Mario Quintana wrote:
Mike (you can call me Pepe as well),

The relevant test is,


    < o train"0 (0&{)`(1&{)`(2&{)
┌───┬───┬───┐
│0&{│1&{│2&{│
└───┴───┴───┘


That is, this sentence produces (illegally :) ) a noun made of boxed
verbs.  My guess is that you had predefined N, A or B as a noun(s).  Try
running the script on a fresh session or erase N, A, and B beforehand.  A
clean script, with a simplified version of hyper, follows for your
convenience (I always type =. instead of =: because it is easier and run
the script from an editing window with Ctrl-a, Ctrl-e),


JVERSION

o=. @:
K=. <;:'&*'
U=. <(<,'&'),<<(":0);1

ku=. K , U ($~) 2 -~ ]

train=. (<'`:')(0:`)(,^:)&6  NB. For compatibility with an official J
an=. <@:((,'0') ,&< ])

erase'N A B'
(N`A`B)=. < o train"0 (0&{)`(1&{)`(2&{)

hyper=. train o ( (an o x: o A , ku o N) , an o B )f.

hyper 2 2 3  NB. 2 * 3
hyper 3 3 2  NB. 3 ^ 2
hyper 4 2 5  NB. Tetration
# ": hyper 4 2 5
hyper 5 3 2  NB. Pentation
hyper 6 1 9  NB. Etc.

hyper

I hope it helps.



On Sat, Nov 21, 2015 at 5:12 AM, Mike Day <[email protected]>
wrote:

Oops^2   !?

I copied Jose's code (further below) to my temporary
script looking at this topic.  Loading the script
failed as shown.  Not my style of programming,  so
I don't see what's wrong in this extract the session:

(sorry, but line feeds will probably double...)

     JVERSION

Engine: j804/2015-09-19 10:06:31

Library: 8.04.13

Qt IDE: 1.4.6/5.4.2

Platform: Win 64

Installer: J804 install

InstallPath: c:/d/j804


load 'c:/d/j804/user/temp/74.ijs'

|length error: script

| (N`A`B) =:<o train"0(0&{)`(1&{)`(2&{)

|[-109] c:\d\j804\user\temp\74.ijs

    train

(,^:((0:)``:))&6


    train"0 (0&{)`(1&{)`(2&{)

0&{


Obvious differences from Jose:  J804 not 803,
installer not shown above,  but I think it's
j804_win64.exe,  September 15.

Thanks,

Mike


On 20/11/2015 20:50, Jose Mario Quintana wrote:

Ups!  I meant to run the script on an official version but I ended up
using
a Jx interpreter.  Anyway, it runs on an official J interpreter:

     JVERSION
Installer: j602a_win.exe
Engine: j803/2014-10-19-11:11:11
Library: 6.02.023

     o=. @:
     K=. <;:'&*'
     U=. <(<,'&'),<<(":0);1

     ku=. K , U ($~) 2 -~ ]

     train=. (<'`:')(0:`)(,^:)&6  NB. For compatibility with an official J
     an=. <@:((,'0') ,&< ])

     (N`A`B)=. < o train"0 (0&{)`(1&{)`(2&{)

     hyper=. train o ( ((an o x: o A) < o train o ,(ku o N)) , an o B )f.

     hyper 2 2 3  NB. 2 * 3
6
     hyper 3 3 2  NB. 3 ^ 2
9
     hyper 4 2 5  NB. Tetration

2003529930406846464979072351560255750447825475569751419265016973710894059556311453089506130880933348101038234342907263181822949382118812668869506364761547029165041871916351587966347219442930927982084309104855990570159318959639524863372367203002916969592156...
     # ": hyper 4 2 5
19729
     hyper 5 3 2  NB. Pentation
7625597484987
     hyper 6 1 9  NB. Etc.
1

     hyper
,^:(0:``:)&6@:((<@:((,'0') ,&< ])@:x:@:(1&{) <@:(,^:(0:``:)&6)@:,
((<;:'&*') , (<(<,'&'),<<(,'0');1) $~ 2 -~ ])@:(0&{)) , <@:((,'0') ,&<
])@:(2&{))





On Fri, Nov 20, 2015 at 3:23 PM, Jose Mario Quintana <
[email protected]> wrote:

This is a verb for performing hyper operations:
     JVERSION

Engine: j701/2012-12-06/12:20/x

Library: 8.03.14

Qt IDE: 1.3.1/5.3.2

Platform: Win 64

Installer: J803 install

InstallPath: f:/j64-803

o=. @:

K=. <;:'&*'

U=. <(<,'&'),<<(":0);1

ku=. K , U ($~) 2 -~ ]

train=. (<'`:')(0:`)(,^:)&6 NB. For compatibility with an official J

an=. <@:((,'0') ,&< ])

(N`A`B)=. < o train"0 (0&{)`(1&{)`(2&{)

hyper=. train o ( ((an o x: o A) < o train o ,(ku o N)) , an o B )f.

hyper 2 2 3 NB. 2 * 3

6

hyper 3 3 2 NB. 3 ^ 2

9

hyper 4 2 5 NB. Tetration



2003529930406846464979072351560255750447825475569751419265016973710894059556311453089506130880933348101038234342907263181822949382118812668869506364761547029165041871916351587966347219442930927982084309104855990570159318959639524863372367203002916969592156108764948889254090805911457037675208500206671563702366126359747144807111774815880914135742720967190151836282560618091458852699826141425030123391108273603843767876449043205960379124490905707560314035076162562476031863793126484703743782954975613770981604614413308692118102485959152380195331030292162800160568670105651646750568038741529463842244845292537361442533614373729088303794601274724958414864915930647252015155693922628180691650796381064132275307267143998158508811292628901134237782705567421080070065283963322155077831214288551675554073345107213112427399562982719769150054883905223804357045848197956393157853510018992000024141963706813559840464039472194016069517690156119726982337890017641517190051133466306898140219383481435426387306539552969691388024158161859561...

# ": hyper 4 2 5

19729

hyper 5 3 2 NB. Pentation

7625597484987

hyper 6 1 9 NB. Etc.

1

hyper

,^:(0:``:)&6@:((<@:((,'0') ,&< ])@:x:@:(1&{) <@:(,^:(0:``:)&6)@:,
((<;:'&*') , (<(<,'&'),<<(,'0');1) $~ 2 -~ ])@:(0&{)) , <@:((,'0') ,&<
])@:(2&{))


I would left a gramatically correct version as an exercise ;)




On Fri, Nov 20, 2015 at 10:31 AM, Jose Mario Quintana <
[email protected]> wrote:

Dan,
Check out the message:
http://www.jsoftware.com/pipermail/programming/2015-February/041095.html
for  one easy way to play with Knuth's up arrow notation in J.

  From there it should be easy to code an alternative version of your
adverb H.  I never bother to do so because there are just a few
numbers, to
say the list, that you can actually compute for the hyper operations.

As it has been pointed out before, J is relatively slow computing large
numbers.  Maybe Pascal's package can help but, of course, huge numbers
are beyond the computer capabilities of J or any other programming
language
(in this universe, as is presently known, anyway).

On Thu, Nov 19, 2015 at 3:51 PM, Dan Bron <[email protected]> wrote:

The notion of “hyper operation” extends the intuition that
multiplication is repeated addition, exponentiation is repeated
multiplication, tetration is repeated exponentiation, and so on.

Hyperoperation can be defined piecewise (per Wikipedia) as:

              / b+1 if n = 0
              | a if n  = 1, b = 0
   H_n(a,b) = | 0 if n  = 2, b = 0
              | 1 if n >= 3, b = 0
              \ H_n-1( a, H_n(a, b-1) ) otherwise

Or, in J:

H =: adverb define
:
    if. 0=m do.
      1+y
    elseif. (m > 0) *. (0=y) do.
      (<:3<.m) { x,0,1
    elseif. do.
      x (<:m) H x m H <:y
    end.
)


Now, while J likes 2 (0 H) 3, 2 (1 H) 3, 2 (2 H) 3, and 2 (3 H) 3 just
fine, producing the expected results [1], it silently crashes (i.e.
the IDE
simply disappears) on 2 (4 H) 3 .

Now, I’m sure  2 tetration 3  is some absurdly large number and I
wouldn’t expect a result, but I’d prefer a stack error (or whatever)
to a
crash.

-Dan

[1]  Representing successor, addition, multiplication, and
exponentiation respectively.




----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to