Pages: 1 2 3 4 »
  Print  
Author Topic: Recursion  (Read 7546 times)
Offline (Male) notachair
Posted on: May 24, 2010, 06:55:43 AM

Definitely not a chair
Contributor
Joined: Feb 2008
Posts: 299

View Profile
It was a recursion joke

http://www.google.com/search?q=recursion
Logged
Offline (Unknown gender) freezway
Reply #1 Posted on: May 24, 2010, 05:30:21 PM

Member
Joined: Dec 2009
Posts: 220

View Profile
recursion....
js: a = "js: a"
Logged
if you drop a cat with buttered toast strapped to its back, which side lands down?
joshdreamland: our languages are based on the idea that it's going to end up FUBAR
/kick retep998
Offline (Male) Rusky
Reply #2 Posted on: May 24, 2010, 05:39:52 PM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
you lose at quining.
Code: (Haskell) [Select]
main = putStr (quine q)
quine s = s ++ show s
q = "main = putStr (quine q)\nquine s = s ++ show s\nq = "
Logged
Offline (Female) IsmAvatar
Reply #3 Posted on: May 25, 2010, 09:32:34 AM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
Code: (PHP) [Select]
<?php //quine.php
echo(file_get_contents('quine.php')); ?>
« Last Edit: May 25, 2010, 12:14:33 PM by IsmAvatar » Logged
Offline (Male) retep998
Reply #4 Posted on: May 25, 2010, 11:16:21 AM

Member
Location: Where else?
Joined: Jan 2010
Posts: 248
MSN Messenger - retep998@charter.net AOL Instant Messenger - retep998 Yahoo Instant Messenger - retep998
View Profile Email
Code: (PHP) [Select]
<?php //quine.php
echo(include('quine.php')); ?>
Fixed
Logged
Offline (Male) Rusky
Reply #5 Posted on: May 25, 2010, 12:35:15 PM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
now you're just cheating, and retep- that won't work.
Code: (PHP) [Select]
<?php printf($a='<?php printf($a=%c%s%c,39,$a,39);',39,$a,39);
Logged
Offline (Male) retep998
Reply #6 Posted on: May 25, 2010, 01:08:18 PM

Member
Location: Where else?
Joined: Jan 2010
Posts: 248
MSN Messenger - retep998@charter.net AOL Instant Messenger - retep998 Yahoo Instant Messenger - retep998
View Profile Email
Code: [Select]
void recursion();
void recursion(){
    recursion();
}
int main(){
    recursion();
}
Logged
Offline (Unknown gender) luiscubal
Reply #7 Posted on: May 25, 2010, 02:11:00 PM
Member
Joined: Jun 2009
Posts: 452

View Profile Email
http://www.google.com/search?q=recursion

Google FTW!

Also:
Code: ( (Unknown Language)) [Select]
\() return callee();();
« Last Edit: May 25, 2010, 02:13:28 PM by luiscubal » Logged
Offline (Male) Josh @ Dreamland
Reply #8 Posted on: May 25, 2010, 03:25:30 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2956

View Profile Email
Code: (C) [Select]
int main();
void recursion(){
    main();
}
int main(){
    recursion();
}

fix'd
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) luiscubal
Reply #9 Posted on: May 25, 2010, 04:15:33 PM
Member
Joined: Jun 2009
Posts: 452

View Profile Email
Josh, you should pay attention to compiler warnings.
Everybody knows non-void functions should have return statements.

make it
Code: (C) [Select]
int main();
void recursion(){
    main();
}
int main(){
    recursion();
    return 0;
}

or alternatively

Code: (C) [Select]
int main();
int recursion(){
    return main();
}
int main(){
    return recursion();
}
Logged
Offline (Male) Josh @ Dreamland
Reply #10 Posted on: May 25, 2010, 05:24:36 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2956

View Profile Email
Yes, because it'd be a crying shame for it to not have a return value for the first processor with a stack size and clock speed of infinity to exit with.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) score_under
Reply #11 Posted on: May 26, 2010, 11:17:21 AM

Member
Joined: Aug 2008
Posts: 308

View Profile
Code: (C) [Select]
int main();
int recursion(){
    return main();
}
int main(){
    return recursion();
}
This is where the optimizer comes in.
Inline the call to "recursion()":
Code: [Select]
int main(){
    return main();
}
Tail call, optimize to a goto:
Code: [Select]
int main(){
    goto main;
}
Which is why the code only causes a stack overflow on lower optimization levels.
Logged
Offline (Male) MahFreenAmeh
Reply #12 Posted on: May 26, 2010, 03:24:56 PM

sysadmin
"Web Team"
Location: Austin, TX
Joined: Apr 2008
Posts: 13
AOL Instant Messenger - sirmxe
View Profile WWW Email
http://enigma-dev.org/forums/index.php?topic=524.msg5861#msg5861
Logged
sys(tem)admin(istrator)
[java,c++,c,javascript,html,css,php,perl,ruby,python,sql]
if you've got ideas, let me hear them.
Offline (Male) Josh @ Dreamland
Reply #13 Posted on: May 26, 2010, 04:21:43 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2956

View Profile Email
</thread>'; void 0
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) retep998
Reply #14 Posted on: May 26, 2010, 05:00:06 PM

Member
Location: Where else?
Joined: Jan 2010
Posts: 248
MSN Messenger - retep998@charter.net AOL Instant Messenger - retep998 Yahoo Instant Messenger - retep998
View Profile Email
http://upurload.com/dl/?n=230*single-digit snip*

(User was banned for this post ("Yes, that will consume many system resources, requiring reboot on Windows (I imagine) or pkill here on Linux." - Josh @ Dreamland))
« Last Edit: May 26, 2010, 10:54:30 PM by Josh @ Dreamland » Logged
Pages: 1 2 3 4 »
  Print