[Jprogramming] Problem with capped fork ?

Martin Kreuzer info at airkreuzer.com
Thu May 25 21:05:03 UTC 2023


In addition, I don't understand why

    f=: (1:)`(* [: $: <:) @. *

shouldn't suffice, compared to

    f=: (1:)`(] * [: $: <:) @. *

as

    (* [: $: <:) y

looks to me like a regular hook.

-M


At 2023-05-25 18:33, you wrote:

>This is odd.
>
>According to https://code.jsoftware.com/wiki/Vocabulary/atdot f should
>have rank 0 (since v is * here).
>
>But, when I redefine f as
>    f=: 1:`(] * [: $:&([echo) <:)@.*
>
>I see that when (f 2 3 5 7 11) is executed, f is being treated as some
>other rank. This does not occur for (f 2 3 5 7).
>
>Using $:@<: works around this issue by using $: with the rank of <:
>(the rank problem with @. would still occur, without triggering a rank
>error).
>
>Also, the j implementation tells me that f has infinite rank - despite
>what nuvoc says and despite the behavior for (f 2 3 5 7):
>
>    f b.0
>_ _ _
>
>--
>Raul
>
>On Thu, May 25, 2023 at 11:12 AM Martin Kreuzer <info at airkreuzer.com> wrote:
>
> > Dear all -
>
> > Thought I had succeeded in deducing step by 
> step the tacit verb for factorial,
>
> >     f=: 1:`(] * [: $: <:)@.*
>
> > when I encountered this:
>
> >     f=. 1:`(] * [: $: <:)@.*
> >     f 2 3 5 7
> > 2 6 120 5040
> >     f 2 3 5 7 11
> > |rank error in f, executing monad $:
> > |       f 2 3 5 7 11
>
> > In contrast this seems to work alright:
>
> >     g=. 1:`(] * $: @ <:)@.*     NB. dictionary entry
> >     g 2 3 5 7
> > 2 6 120 5040
> >     g 2 3 5 7 11
> > 2 6 120 5040 39916800
>
> >     JVERSION
> > Engine: j9.4.2/j64avx2/windows
> > Build: commercial/2023-04-10T01:19:53/clang-15-0-7/SLEEF=1
> > Library: 9.4.21
> > Platform: Win 64
> > Installer: j9.4 install
> > InstallPath: d:/program files (non-sys)/j9.4
> > Contact: www.jsoftware.com
>
> > However, my verb
>
> >     f=: 1:`(] * [: $: <:)@.*
> >     f 2 3 5 7 11 13
> > 2 6 120 5040 39916800 6227020800
>
> > works under v8.07 as expected ....
>
> > Could somebody shed some light on this ?
>
> > -M
>
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list