What kind of possibilities where you thinking of? Things not related to $: as well?

On 03/21/2016 07:19 PM, Henry Rich wrote:
Would it make sense for O. to be a conjunction where v is a bitmask indicating the type of optimization requested? There might be many possibilities.

Henry Rich

On 3/21/2016 7:15 PM, Jose Mario Quintana wrote:
One reason might be that Jx's adverb O. expects a verb in tail-recursive
form and bad things might happen if it is not and currently it cannot
determine automatically if it is.  Jx is not for the faint of heart and
will stay there but I am not sure about J Unbox or the official
interpreter.

On Mon, Mar 21, 2016 at 6:21 PM, Pascal Jasmin <[email protected]>
wrote:

Can't think of a reason why we wouldn't want this in the official
interpreter




----- Original Message -----
From: Jose Mario Quintana <[email protected]>
To: Programming forum <[email protected]>
Sent: Monday, March 21, 2016 9:54 AM
Subject: Re: [Jprogramming] Tail recursion (bug hijack)

Right, I never saw or found a satisfactory coding of a genuine while
conjunction. However, in Jx one can afford, thanks to Thomas' effective
implementation of the adverb O. for the Jx interpreter, to do the
unthinkable: code a genuine while conjunction recursively! That is, a
conjunction wTCO such that,

    u wTCO v
]`($:^:(1:`u))@.v O.

This is how it works for the case at hand,

    whileO    =: v1@:(v0 wTCO (-. @: v2))  NB.

    power      i.20
0 7 8 9 10 11 12 13 14 15 16 17 18 19
    recursive  i.20
0 10 11 12 13 14 15 16 17 18 19
    whileO     i.20
0 10 11 12 13 14 15 16 17 18 19
    recursiveO i.20
0 10 11 12 13 14 15 16 17 18 19


stp=. ([ ((<;._1 '|Sentence|Space|Time|Space * Time') , (, */&.:>@:(1
2&{))@:(] ; 7!:2@:] ; 6!:2)&>) (10{a.) -.&a:@:(<;._2@,~) ]) ".@:('0 :
0'"_)

    Y=. i.111

    stp 11

   recursive  Y
   whileO     Y
   recursiveO Y
)
┌──────────────┬──────┬────────────┬────────────┐
│Sentence      │Space │Time        │Space * Time│
├──────────────┼──────┼────────────┼────────────┤
│  recursive  Y│222592│0.0475173844│10576.9896  │
├──────────────┼──────┼────────────┼────────────┤
│  whileO     Y│36992 │0.0397433474│1470.18591  │
├──────────────┼──────┼────────────┼────────────┤
│  recursiveO Y│37376 │0.0434088376│1622.44871  │
└──────────────┴──────┴────────────┴────────────┘


On Sat, Mar 19, 2016 at 2:39 PM, Dan Bron <[email protected]> wrote:

Louis wrote:
The problem is that u^:v^:_ y terminates
either when 0 = v y OR when y -: u y .
Yeah, this has bitten us all at one time or another. The traditional
solution is to add a little tag to the data structure which you mutate
(along with the normal processing) at every iteration. Most commonly we
just do (u@:>@:{. ; -.&.>@:{:)^:v^:_ y ; 0 (adjusting the boxing logic
as
needed).

I asked for better alternatives than this a few years back [1], but we
didn’t come up with anything compelling.

-Dan

[1] J Programming thread, “Limit limitation, Oct 2009:

http://www.jsoftware.com/pipermail/programming/2009-October/016513.html
<
http://www.jsoftware.com/pipermail/programming/2009-October/016513.html>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

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

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

Reply via email to