Talk:Y combinator: Difference between revisions
Content added Content deleted
Line 91: | Line 91: | ||
</lang> |
</lang> |
||
''Edit: Err... I think I messed it up a little, it should be ok now.'' |
''Edit: Err... I think I messed it up a little, it should be ok now.'' |
||
''Edit2: '' You can obviously also do |
|||
<lang scheme> |
|||
(define fact |
|||
(lambda (f) |
|||
(lambda (n) |
|||
(if (zero? n) |
|||
1 |
|||
(* n ((force f) (- n 1))))))) |
|||
</lang> |
|||
and then call it as |
|||
<lang scheme> |
|||
> ((Y fact) 5) |
|||
120</lang> |
|||
[[Special:Contributions/93.144.202.116|93.144.202.116]] |
[[Special:Contributions/93.144.202.116|93.144.202.116]] |