Talk:Y combinator: Difference between revisions
Content deleted Content added
Line 179: | Line 179: | ||
Someone marked this incorrect because "Y is explicitly recursive on Y". The <tt>(Y)</tt> second parameter to <tt>curry</tt> declares a local function parameter Y which is not the same as the original Y. So the original Y never recurses on itself; it calls a different Y. I removed the <nowiki>{{incorrect}}</nowiki> tag from the PicoLisp example. --[[User:Kernigh|Kernigh]] 18:59, 11 April 2011 (UTC) |
Someone marked this incorrect because "Y is explicitly recursive on Y". The <tt>(Y)</tt> second parameter to <tt>curry</tt> declares a local function parameter Y which is not the same as the original Y. So the original Y never recurses on itself; it calls a different Y. I removed the <nowiki>{{incorrect}}</nowiki> tag from the PicoLisp example. --[[User:Kernigh|Kernigh]] 18:59, 11 April 2011 (UTC) |
||
:Thanks for the explanation Kernigh. I goofed. --[[User:Paddy3118|Paddy3118]] 19:57, 11 April 2011 (UTC) |
:Thanks for the explanation Kernigh. I goofed. --[[User:Paddy3118|Paddy3118]] 19:57, 11 April 2011 (UTC) |
||
== Wolfram example == |
|||
This example was added to Fixed-point combinator in wikipaedia. It does not belong there, but it could belong here. |
|||
A Y-combinator implementation of factorial in the [[Wolfram Language]] is, |
|||
<source lang=ocaml>Y = Function[f, #[#]&[Function[g, f[g[g][##]&]]]]; |
|||
factorial = Y[Function[f, If[# < 1, 1, # f[# - 1]] &]]; |
|||
factorial[6] (*Yields 120*)</source> |
|||
[[User:Thepigdog|Thepigdog]] ([[User talk:Thepigdog|talk]]) 03:18, 26 May 2015 (UTC) |