fascinating, I'd add:

A verb not dependent on its arguments (but still has rank and called once for 
each item) (Henry calls this a nilad, but I insist nonad is much more fun)




----- Original Message -----
From: Henry Rich <[email protected]>
To: [email protected]
Sent: Tuesday, March 22, 2016 4:34 PM
Subject: Re: [Jprogramming] Tail recursion (bug hijack)

I am mostly thinking that flexibility would be good.  But there are 
other possible optimizations:

1. An argument to a verb is known to be sorted
2. An argument to a verb is a hash table
3. An argument is known to be 'read-only', and can skip some recopying
4. A result is known to be discardable immediately
5. An expression is guaranteed not to perform any assignments to 
anything but nouns
6. A verb is guaranteed not to create any names except ones appearing in 
name =.: assignments

(2) would require that the hash table become a primitive datatype, which 
I think is something that should be discussed.

There are many things we might do, and as long as we are adding a 
mechanism for directing interpretation, we ought to make it extensible.

Henry Rich


On 3/22/2016 11:02 AM, Thomas Costigliola wrote:
> 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

----------------------------------------------------------------------
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