Talk:Anonymous recursion: Difference between revisions

Content deleted Content added
relationship to fixed point combinators
Cewbot (talk | contribs)
m Maintain {{WPBS}} and vital articles: 1 WikiProject template. Create {{WPBS}}. Keep majority rating "C" in {{WPBS}}. Remove 1 same rating as {{WPBS}} in {{WikiProject Computer science}}.
 
(19 intermediate revisions by 8 users not shown)
Line 1:
{{WikiProject banner shell|class=C|
{{WikiProject Computer science|importance=low}}
}}
==Cleanup==
 
Line 28 ⟶ 31:
>>The metaphorical explanation at the end, especially, is misleading and unnecessary.<<
:Yes: it goes off in a tangent. I have removed it. &mdash;[[User:AugPi|AugPi]] 20:31, 2 November 2005 (UTC)
 
=="anonymous"?==
What does "anonymous" mean in this context? [[User:Michael Hardy|Michael Hardy]] 03:55, 15 November 2005 (UTC)
:I'm not an expert in these mattres, but I think the "anonymous" in "anonymous recursive function" means that it doesn't need to have a name assigned. I gather it's okay to take it litterally. ("anonymous" < Greek: an- "without" + onyma, Æolic dialectal form of onoma "name", thus "without a name", "nameless", "unnamed")
:For instance, λx(x + 2) is an anonymous function. You can write down stuff like (λx(x + 2))3 and the result is 5.
:However, if you want to define a recursive function, you would have to name it to be able to write down things like f(x) = ...f(x - 1)... This article shows that you can actually define anonymous recursive functions without naming them. Everything clear? [[User:Gerbrant|Shinobu]] 03:51, 2 March 2006 (UTC)
:: It's not well defined concept as far as I can tell. See [[Talk:First-class_function#Merge_anonymous_function_here]]. [[User:Pohta ce-am pohtit|Pcap]] [[User_talk:Pohta ce-am pohtit|<small>ping</small>]] 01:19, 21 August 2009 (UTC)
 
== The new function is also recursive!? ==
 
In the second, step, you define a new, recursive function, namely h. Now, instead of defining f by using f itself, you define h by using h itself, and passing around a dummy parameter f (that is not used at all in the function)
 
Should the second step perhaps be: replace f(x-1) by f(x-1,f) ? <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/128.176.181.114|128.176.181.114]] ([[User talk:128.176.181.114|talk]]) 20:47, 7 July 2009 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
 
== Factually disputed ==
 
Besides the fact that [[anonymous function]] is not a well-defined concept, the construction given in this article uses names for functions; so how is this recursion anonymous?
: '''Update''': Not well-defined in the context of lambda calculus and mathematics, see [[Talk:Fixed_point_combinator#.22Fixed_point_combinators_allow_the_definition_of_anonymous_recursive_functions.22|this rant]]; it is fairly well defined in programming, but this article tried to be too far removed from that.
 
This article appears to be the product of somebody with a poor understanding of [[lambda calculus]], where functions are indeed anonymous, in that we don't ''need'' to give them names, you can just write well formed expressions in the calculus. But then this article is nothing more than an application of some fix-point combinator; whether it's Y or not, it doesn't really matter, because [[Fixed_point_combinator#Other_fixed_point_combinators|there's an infinity of fix-point combinators]]. [[User:Pohta ce-am pohtit|Pcap]] [[User_talk:Pohta ce-am pohtit|<small>ping</small>]] 01:42, 21 August 2009 (UTC)
 
This whole article appears to be a rehashing of the '''Z''' combinator (see link above) which is needed in call-by-value languages, because Y loops forever there (only works in Haskell and other lazy evaluation or call-by-name languages). But this article is so far removed from explaining any of this that it's effectively a pointless mental exercise reading it, and totally redundant alongside [[Fixed point combinator]]. Did I mention this article cites no sources? [[User:Pohta ce-am pohtit|Pcap]] [[User_talk:Pohta ce-am pohtit|<small>ping</small>]] 01:50, 21 August 2009 (UTC)
 
I propose we redirect this to [[Fixed point combinator]]. [[User:Pohta ce-am pohtit|Pcap]] [[User_talk:Pohta ce-am pohtit|<small>ping</small>]] 01:53, 21 August 2009 (UTC)
 
== Literature survey and conclusion ==
 
This notion is virtually unheard of in print, but it does appear in two ''very recent'' C# books [http://books.google.com/books?q=%22anonymous+recursion%22&btnG=Search+Books], as well as some [[MSDN]] blogs, e.g. [http://blogs.msdn.com/wesdyer/archive/2007/02/02/anonymous-recursion-in-c.aspx]. But note how the author of that blog concludes that he simply rediscovered the Y combinator! So, this is worth no more than a little mention in the [[fixed point combinator]] article. [[User:Pohta ce-am pohtit|Pcap]] [[User_talk:Pohta ce-am pohtit|<small>ping</small>]] 18:03, 21 August 2009 (UTC)
 
== Expand to full article ==
 
This article was previously a redirect (from merge) to [[fixed-point combinator]]. However, that is a very technical article with largely different subject, and in that context “anonymous recursion” is at best an occasional term, at worst an abuse of language.
 
However, anonymous recursion is a legitimate distinct topic – calling a function without using its name – and is possible without the technical machinery of a fixed-point combinator, simply by exposing the current context to programs. This is notably used in JavaScript and Perl, at least.
 
I’ve accordingly expanded this page into a proper article – hope it looks good, and please improve it!
:—Nils von Barth ([[User:Nbarth|nbarth]]) ([[User talk:Nbarth|talk]]) 06:02, 27 April 2013 (UTC)
 
== Simpler solution ==
I came up with a simpler lambda calculus solution for factorial. All I did was take the anonymous recursion version, and replace "lambda a, b" with "lambda a: lambda b:", and "(a, b)" with "(a)(b)".
 
<syntaxhighlight lang=python>
(lambda f: lambda x: f(f)(x)) \
(lambda f: lambda x: 1 if x == 0 else x * f(f)(x-1))
</syntaxhighlight>
 
But, this is original research I guess, so I won't put it on the page. Also the existing explanation might help people trying to understand the Y combinator. <small class="autosigned">—&nbsp;Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/15.203.233.79|15.203.233.79]] ([[User talk:15.203.233.79|talk]]) 22:19, 27 April 2015 (UTC)</small><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->