True.  Though I had included the y in there to show that I was
focusing on the monadic case.

So I guess it really should have been (F y) -: (FB^:FT^:_ y) and you
might even need a cleanup stage at the end, giving something like (F
y) -:FC@:(FB^:FT^:_) y.

But, yes, if the task is to convert a working tail recursive function
to this form, I am going to have to also insist on example arguments
which when handed to that function give a result which shows that the
function works for non-identity cases. Otherwise, I'll be spending way
more time on irrelevant stuff than I care to.

Thanks,

-- 
Raul


On Thu, Jan 11, 2018 at 6:18 PM, Jose Mario Quintana
<[email protected]> wrote:
> Of course, I meant F=: FB^:FT^:_  .  By the way, you also meant  F=:
> FB^:FT^:_, not F=: FB^:FT^:_ y .  Did you not?  ;)
>
> Can you think of any verb that cannot be rewritten in that fashion?
>
> I guess the task description is not clear enough for you; that is
> unfortunate.
>
>
>
>
>
>
>
>
> On Thu, Jan 11, 2018 at 6:06 PM, Raul Miller <[email protected]> wrote:
>
>> On Thu, Jan 11, 2018 at 5:50 PM, Jose Mario Quintana
>> <[email protected]> wrote:
>> >> Perhaps you could shed a bit more light on whatever it is that you are
>> >> trying to talk about?
>> >
>> > "Because no restrictions on the nature of FB and FT are imposed" my
>> > reaction to
>> >
>> >> If I have a recursive verb (F y) implemented in J, which satisfies the
>> >> constraints for tail recursion, I believe that there is always a pair
>> >> of companion functions (FB y) (FT y) such that an F workalike can be
>> >> written:
>> >>
>> >>    F=: FB^:FT^:_ y
>>
>> Well, ok, in the sense that either FB or FT could call quicksort.
>>
>> They still have to represent a tail recursive function for this to be
>> meaningful. But even tail recursive routines can call quicksort
>> (though, granted, I do not have any clear ideas, right now, about what
>> useful tail recursive routine would call quicksor).
>>
>> > (so far) is that the part "which satisfies the constraints for tail
>> > recursion," is gratuitous.  (Can you exhibit a verb F which does not
>> > satisfy the constraints for tail recursion and an F workalike cannot be
>> > written as F=: FB^:^:_ ?)
>> >
>> > I could be mistaken though and I am willing to be educated.
>>
>> At this point I don't even know what you are talking about. But I
>> think you asked me to rewrite a non-tail recursive routine in a
>> syntactically invalid fashion.
>>
>> Consider, for example:
>>
>>    FB=: 0 >. <:
>>    FB 2
>> 1
>>    FB^:^:_(2)
>> |syntax error
>>
>> > If I had to guess what you might have in mind for FB and FT in connection
>> > to tail recursion then I would think that the form F=: FB^:FT^:_ might be
>> > almost correct.  However, I rather not guess; I would like to be
>> enlighted
>> > instead, if possible.  That is one reason why I suggested the verb
>> > evolve as a subject matter.
>>
>> The only examples I have found for evolve are either:
>>
>> (a) identity functions (which do nothing whatsoever), or
>> (b) throw errors.
>>
>> How is this relevant?
>>
>> --
>> Raul
>> ----------------------------------------------------------------------
>> 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