tag:blogger.com,1999:blog-32241238.post4628155432521619906..comments2023-03-25T05:46:26.256-04:00Comments on Why not?: Deriving the Y Combinator in Erlang - Part 2: AbstractionDanhttp://www.blogger.com/profile/06099373265709774874noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-32241238.post-72438500085153358892019-05-30T07:17:01.685-04:002019-05-30T07:17:01.685-04:00"it might make some forms of unit testing eas..."it might make some forms of unit testing easier."<br />Really? How?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-32241238.post-76357173878855483422010-02-03T18:48:16.027-05:002010-02-03T18:48:16.027-05:00I've toyed with functional languages before, b...I've toyed with functional languages before, but never extensively. I was unaware of letrec. Thanks!<br /><br />Correct me if I'm wrong, but I don't think Erlang supports letrec. It would certainly be convenient.<br /><br />The Y combinator is certainly not perfect. It supports self-recursive functions well, but I'm not sure how it would scale to mutually-recursive functions.<br /><br />There is an interesting consequence to the Y combinator that I will try to cover in another post. In short: it might make some forms of unit testing easier.Danhttps://www.blogger.com/profile/06099373265709774874noreply@blogger.comtag:blogger.com,1999:blog-32241238.post-10681104491535433992010-02-03T11:15:08.890-05:002010-02-03T11:15:08.890-05:00This is why Landin invented letrec.
For single f...This is why Landin invented letrec.<br /> <br />For single functions the problem of self reference<br />is much easier solved with a meta variable.<br /><br />Fac = fun(0) -> 1;<br /> (N) -> Self * fac(N-1)<br /> end.<br /><br />The obscurity of the Y combinator necessitates the invention of letrec.<br /><br />The third part of the article should be<br />Replacing the Y combinator with labelsAnonymousnoreply@blogger.com