I uploaded that contribution recently.  I did not know about the Y combinator 
until I saw that particular Rosetta Code task though I had realized few years 
ago that was possible to write fully fixable tacit recursions in J.  
Nevertheless, I was "functionally illiterate" until lately according the author 
an article linked in the Rosetta Code page ( 
http://mvanier.livejournal.com/2897.html ):
 
"In 1959, the British scientist C. P. Snow gave a famous lecture called The Two 
Cultures  where he bemoaned the fact that many intelligent and well-educated 
people of the time had almost no knowledge of science. He used knowledge of the 
Second Law of Thermodynamics as a kind of dividing line between those who were 
scientifically literate and those who weren't. I think we can similarly use 
knowledge of the Y combinator as a dividing line between programmers who are 
'functionally literate' (i.e. have a reasonably deep knowledge of functional 
programming) and those who aren't. There are other topics that could serve just 
as well as Y (notably monads), but Y will do nicely. So if you aspire to have 
the True Lambda-Nature, read on.
By the way, Paul Graham  (the Lisp hacker, Lisp book author, essayist, and now 
venture capitalist) apparently thinks so highly of Y that he named his startup 
incubator company Y Combinator . Paul got rich from his knowledge of ideas like 
these; maybe someone else will too. Maybe even you."

Maybe I am still functionally illiterate because I have no idea what those 
“monads” are; yet, I am able to appreciate Paul Graham's metaphor.

Regarding a public repository of code; I am afraid we do not have one.  
Incidentally, the Y combinator can also be implemented using, for example, 
gerunds instead of linear representations of verbs (as I mentioned before in 
this thread); yet, the code is “stateless” but not tacit and consumes a lot of 
space:

   sr=. [ 'x `:6 y'(4 :) ,&<
   
   Y=. f. ((&>)/) (`'') (&sr) f.
   Y=. 'Y'f. 
   Y NB. Stateless Y Combinator...
(((f.((&>)/))(`''))(&([ 4 : 'x `:6 y' ,&<)))f.
   
   u=. [ NB. Function (left)
   n=. ] NB. Argument (right)
   
   fs=. ((u sr n - 2:) + u sr n - 1:) ^: (1: < n) f. NB. Fibonacci step...
   fs
(([ ([ 4 : 'x `:6 y' ,&<) ] - 2:) + [ ([ 4 : 'x `:6 y' ,&<) ] - 1:)^:(1: < ])
   
   fs Y 10
55
   
   Fibo=. fs Y
   # 5!:5 < 'Fibo'
340





________________________________
From: Dan Bron <[email protected]>
To: Programming forum <[email protected]>
Sent: Monday, August 24, 2009 10:06:08 PM
Subject: Re: [Jprogramming] Recursive nesting, avoiding recursion

Pepe wrote:
... 
>  see http://rosettacode.org/wiki/Y_combinator#J 

Wow.  How did I not notice when that went up?  Thank you for pointing it
out & for providing it in the first place (ex ungue leonem, as Roger
says).  I really need to study this -- I was halfway to concluding that
the Y combinator wasn't possible in J.  

I'm going to see if I can adopt your fixable tacit recursion to my nesting
problem.  I think you've invented a very powerful tool.  Do you have a
public repository of code?  I'd like to understand the implications/uses
of  128!:2  .

-Dan


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