Difference between revisions of "Talk:1270: Functional"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
(Reward is a pun of Reword)
m
Line 14: Line 14:
 
:--[[User:Chtz|Chtz]] ([[User talk:Chtz|talk]]) 10:34, 27 September 2013 (UTC)
 
:--[[User:Chtz|Chtz]] ([[User talk:Chtz|talk]]) 10:34, 27 September 2013 (UTC)
 
::Addendum: I did not dare to edit that yet, as I am unsure if this actually helps anyone not familiar with functional programming (and I don't think this page should include a Haskell crash course just to explain this comic). --[[User:Chtz|Chtz]] ([[User talk:Chtz|talk]]) 10:43, 27 September 2013 (UTC)
 
::Addendum: I did not dare to edit that yet, as I am unsure if this actually helps anyone not familiar with functional programming (and I don't think this page should include a Haskell crash course just to explain this comic). --[[User:Chtz|Chtz]] ([[User talk:Chtz|talk]]) 10:43, 27 September 2013 (UTC)
 +
:::I think the pseudo-code examples currently in the explanation are easy enough to understand regardless of which programming languages one works in, but the [I'm assuming] Haskell example here in the comments makes no sense to me. <span style="color:green;">Saibot84</span> 12:51, 27 September 2013 (UTC)
  
 
I thought about the text a little and don't the the interpretation "tail recursion is an end unto itself" is correct.  I think what's going on is a pun of the word "reward".  "Tail recursion is it's own reword" makes more sense since you are calling the same function but are "rewording" the arguements.  To reword means to re-express something with different words.  --[[Special:Contributions/24.187.72.209|24.187.72.209]] 11:31, 27 September 2013 (UTC)
 
I thought about the text a little and don't the the interpretation "tail recursion is an end unto itself" is correct.  I think what's going on is a pun of the word "reward".  "Tail recursion is it's own reword" makes more sense since you are calling the same function but are "rewording" the arguements.  To reword means to re-express something with different words.  --[[Special:Contributions/24.187.72.209|24.187.72.209]] 11:31, 27 September 2013 (UTC)

Revision as of 12:51, 27 September 2013

I'm getting the adblock message at the top.. on mobile. On an unrelated note, I laughed and I don't even get it. Edit: I'm also seeing an ad while seeing the message.50.159.5.112 06:03, 27 September 2013 (UTC)

This shouldn't be in comic discussion. I have written an updated version of our ad plugin that should only display a message to people using adblock, but we're using a sitenotice for now to test the waters. We'll take it down in about a day, promise!
Also, would you be complicit if I were to move this to the relevant forum? Davidy²²[talk] 06:13, 27 September 2013 (UTC)

I removed that misguided explanation about lists that was not tail recursive. I'm also wondering if we should also mention that tail call optimization is also applicable to mutually recursive functions. In fact proper functional languages will always apply it whether the functions are recursive or not. Maybe emphasize the fact that "The efficiency and elegance are the literal rewards of tail recursion."?

I feel like the examples should be in Haskall, because that is the major functional language... 67.160.98.42 09:48, 27 September 2013 (UTC) GBGamer117

I think Haskell is more common, but I agree. And to emphasize the clarity, usually if/else blocks are avoided using pattern matching. I.e. tail-recursive factorial can be written as follows:
 fac2::Integer->Integer-> Integer  -- optional function header
 fac2 acc 0 = acc
 fac2 acc n = fac2 (acc*n) (n-1)
 
 fac::Integer-> Integer
 fac = fac2 1
--Chtz (talk) 10:34, 27 September 2013 (UTC)
Addendum: I did not dare to edit that yet, as I am unsure if this actually helps anyone not familiar with functional programming (and I don't think this page should include a Haskell crash course just to explain this comic). --Chtz (talk) 10:43, 27 September 2013 (UTC)
I think the pseudo-code examples currently in the explanation are easy enough to understand regardless of which programming languages one works in, but the [I'm assuming] Haskell example here in the comments makes no sense to me. Saibot84 12:51, 27 September 2013 (UTC)

I thought about the text a little and don't the the interpretation "tail recursion is an end unto itself" is correct. I think what's going on is a pun of the word "reward". "Tail recursion is it's own reword" makes more sense since you are calling the same function but are "rewording" the arguements. To reword means to re-express something with different words. --24.187.72.209 11:31, 27 September 2013 (UTC)