f=: 13 :' 0{"1([:+/\|.)^:(i.y)1 1'
f 10
1 1 2 3 5 8 13 21 34 55
By definition: x u^:n y
x and y are known.
The noun n needs to be modified.
f handles this nicely with (i.]):
f
3 : ' 0{"1([:+/\|.)^:(i.y)1 1'
But the result it is not tacit!
My question is, why not?
;:'0{"1(+/\|.)^:(i.])1 1'
┌─┬─┬─┬─┬─┬─┬─┬─┬──┬─┬──┬─┬──┬─┬─┬───┐
│0│{│"│1│(│+│/│\│|.│)│^:│(│i.│]│)│1 1│
└─┴─┴─┴─┴─┴─┴─┴─┴──┴─┴──┴─┴──┴─┴─┴───┘
Y night be similar.
Linda
-----Original Message-----
From: Programming <[email protected]> On Behalf Of roger
stokes
Sent: Sunday, November 18, 2018 5:52 AM
To: [email protected]
Subject: Re: [Jprogramming] Revisisting the Y combinator
Pepe, have you seen the Rosettacode entry for Y-combinator in J ?
The tacit version is just before this:
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.rosettacode.org%2Fwiki%2FY_combinator%23Explicit_alternate_implementation&data=02%7C01%7C%7Cbc2b49bf5ae74575b82608d64d43f20d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636781351548434532&sdata=r71scWFKxwaBkW%2Bor1vp6ruuO458Wndhp35jsMj4%2BcU%3D&reserved=0
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
> > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> > .jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cbc2b49bf5ae74575b8
> > 2608d64d43f20d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63678135
> > 1548434532&sdata=R2isF4i9NycxN1nra4xp5rL2qWBa1rp7i%2F2wcG0Li2s%3
> > D&reserved=0
> > --------------------------------------------------------------------
> > -- For information about J forums see
> > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> > .jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cbc2b49bf5ae74575b8
> > 2608d64d43f20d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63678135
> > 1548434532&sdata=R2isF4i9NycxN1nra4xp5rL2qWBa1rp7i%2F2wcG0Li2s%3
> > D&reserved=0
> ----------------------------------------------------------------------
> For information about J forums see
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
> software.com%2Fforums.htm&data=02%7C01%7C%7Cbc2b49bf5ae74575b82608
> d64d43f20d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63678135154843
> 4532&sdata=R2isF4i9NycxN1nra4xp5rL2qWBa1rp7i%2F2wcG0Li2s%3D&re
> served=0
----------------------------------------------------------------------
For information about J forums see
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cbc2b49bf5ae74575b82608d64d43f20d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636781351548434532&sdata=R2isF4i9NycxN1nra4xp5rL2qWBa1rp7i%2F2wcG0Li2s%3D&reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm