Yes Roger, I mentioned in the first post of this thread that both use ad-hoc encodings to implement anonymous recursions (and I was not very proud of the tacit version).
On Sunday, November 18, 2018, roger stokes <[email protected]> wrote: > Pepe, have you seen the Rosettacode entry for Y-combinator in J ? > The tacit version is just before this: > > > http://www.rosettacode.org/wiki/Y_combinator#Explicit_ > alternate_implementation > > Regards > > On Fri, Nov 16, 2018 at 10:06 PM Jose Mario Quintana < > [email protected]> wrote: > > > Yes, it is cheating. :) The problem is that the only names allowed > > should refer to arguments (a la λ-calculus) and once you replace AAr the > > assignment is visible. > > > > I think I figured out a way but I have tested it only a little bit, > > > > M=. 'if. * y do. y * u <: y else. 1 end.' (1 :) > > M=. (5!:1)<'M' > > > > Y=. (1 : '<(<,'':''),<(<(,''0'');1),<(,''0'');, (''u > > u`:6('',(5!:5<''u''),'')`:6 y'')')(1 : 'u (u`:6)') > > > > M Y("0) i.11 > > 1 1 2 6 24 120 720 5040 40320 362880 3628800 > > > > It looks ugly but I guess that is the price one has to pay to be orthodox > > and fully functional. > > > > > > > > On Fri, Nov 16, 2018 at 12:22 AM 'Pascal Jasmin' via Programming < > > [email protected]> wrote: > > > > > I can cheat, by hiding the assignment in another function. > > > > > > AAr =: 1 : '(5!:1 < ''a'') a =. 1 : m' > > > > > > 'u u`:6('',(5!:5<''u''),'')`:6 y' AAr > > > <(<,':'),<(<(,'0');1),<(,'0');,:'u u`:6('',(5!:5<''u''),'')`:6 y' (1 > : 'u > > > u`:6('',(5!:5<''u''),'')`:6 y') > > > > > > this is not the same as Y though. > > > > > > but this is, > > > > > > YAr =: 1 : '1 : (''(5!:1 < ''''a'''') a =. 1 : '' , ''('' , m , '')'' > )' > > > Y1 =. '''u u`:6('',(5!:5<''u''),'')`:6 y''' YAr > > > > > > > > > > > > > > > ________________________________ > > > From: Jose Mario Quintana <[email protected]> > > > To: [email protected] > > > Sent: Thursday, November 15, 2018 6:01 PM > > > Subject: Re: [Jprogramming] Revisisting the Y combinator > > > > > > > > > > > > Some authors regard functional programming as programming without any > > > assignments. > > > > > > The wicked tacit fixed version of Y has no assignments whatsoever but > it > > is > > > produced and it works by means of non-standard J code. I could alter > > > slightly the non-tacit version, > > > > > > Y=. '(5!:1<''v'')v=. 1 : (''u u`:6('',(5!:5<''u''),'')`:6 y'')'(1 :) > > > > > > and get rid of its single assignment using a bit of wicked code but > that > > > defeats my purpose. > > > > > > I cannot figure out how to produce an orthodox version of Y with no > > > assignments; then again, Y, actually, XY was the most complicated > > non-tacit > > > entity I have produced in a couple of decades and my failure probably > > means > > > little. > > > > > > I would be very interested to see an orthodox version of Y with no > > > assignments if anyone can produce one. > > > > > > ---------------------------------------------------------------------- > > > 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
