Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] Re: Y Combinator
- Date: Fri, 06 Feb 2009 17:34:41 +0900
- From: Edward Middleton <emiddleton@example.com>
- Subject: [tlug] Re: Y Combinator
- References: <20090129064805.GQ24024@smtp.office.cynic.net> <49867CF9.50006@bebear.net> <49893031.4000700@fremlin.org>
- User-agent: Thunderbird 2.0.0.19 (X11/20090202)
John Fremlin wrote: > Edward Middleton wrote: >> 1. http://www.eecs.harvard.edu/~cduan/technical/ruby/ycombinator.shtml > > If you looked at this code and actually understood what it was doing, > I think it is basically this: (well at least it has the same results > when I ran it) > > def make_hash_func() > Hash.new { |h, k| h[k] = make_hash_func } > end I guess you didn't read the part were he provided this solution and commented on its shortcomings. > The Y Combinator is for making an anonymous recursive function. > > I am sure that there are real uses for it. Can you provide an example > in Haskell? It is used in the implementation of the value recursion operator mfix[1] for lists. libraries/base/Control/Monad/Fix.hs -- List: instance MonadFix [] where mfix f = case fix (f . head) of [] -> [] (x:_) -> x : mfix (tail . f) > Seeing as it is part of the standard library one would hope that it > was at least occasionally used. I guess they decided they would splash out and add the two extra lines ;) libraries/base/Data/Function.hs fix :: (a -> a) -> a fix f = let x = f x in x Edward 1. http://leventerkok.googlepages.com/mfixTR.pdf or http://leventerkok.googlepages.com/erkok-thesis.pdf
- Follow-Ups:
- [tlug] Re: Y Combinator
- From: John Fremlin
- References:
- Re: [tlug] Today's TSAC Meeting
- From: Edward Middleton
- [tlug] Re: Today's TSAC Meeting
- From: John Fremlin
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Disabling "Expire Messages" Function in KMail
- Next by Date: Re: [tlug] Disabling "Expire Messages" Function in KMail
- Previous by thread: [tlug] Re: Today's TSAC Meeting
- Next by thread: [tlug] Re: Y Combinator
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links