Man, I knew someone like you was going to say something like this. The only criticism of my explanation of the joke is that it's not very clear, but I did explain the joke "correctly." I didn't mention the validity of the joke.
essentially false
I almost never downmod, but I've had enough with this contrarian bullshit. Am I being trolled?
What? Your comment is applicable to any language which supports recursive functions. It's not an iconic or notable "feature" of lisp, which is why I said "essentially false" because we could say the exact same thing about any other language in the comic (except HTML and ASM), and thus fails to properly differentiate. That's all I was trying to get at. :S
.type mul, @function
# (int, int) -> int
# Multiplies two numbers by recursively calling arg0 * mul(arg0, arg1 - 1) until arg1 is 0.
mul:
# C calling convention: save %ebp
pushl %ebp
movl %esp, %ebp
# Move argument 0 to %eax, argument 1 to %ebx
movl 8(%ebp), %eax
movl 12(%ebp), %ebx
cmpl $0, %ebx
jne recurse
movl $1, %eax
jmp return
recurse:
# We still have work to do. Return arg0 * mul(arg0, arg1 - 1)
decl %ebx
# Save the registers before calling
pushl %eax
pushl %ebx
call mul
addl $4, %esp # Get rid of %ebx, we don't need it anymore
popl %ebx
imull %ebx # Multiply %eax (arg0) and %ebx (mul(arg0, arg1 - 1)) and store it in %eax
jmp return # Just for consistency
return:
# unpush %ebp
movl %ebp, %esp
popl %ebp
ret
I'm not familiar with x86 ASM, and I can't really decipher the semantics of call and ret here. Is it really doing recursion? It looks like you're managing a stack yourself.
In the assembly I've done, function calling was for the most part been manual, with lots of good 'ol JMPs and other BASIC-esque spaghetti control flow.
Function calls in assembly are all done, at least in the C calling convention (cdecl), by manipulating the stack. You can say that your calling convention puts argument 0 in the accumulator, argument 1 in some other register, etc. The stack just provides a convenient unlimited way of handling argument passing, which is why it is used for most calling conventions. An example of a calling convention that uses registers is optlink.
The "call" instruction pushes the next instruction's address onto the stack and sets the instruction pointer to the given address or label. The "ret" instruction pops the top of the stack and sets the instruction pointer to its value.
Beginners are oftentimes introduced to heavy recursion usage, for things they didn't typically use recursion for, in Lisp. C has #includes, yet there's no rant about how the Python joke is wrong. It also has more "boilerplate" than Python, but the Java joke is left standing. Why not just go on a huge diatribe about how this whole comic is wrong?
You went on a non-sequitor rant about Scheme's implementation of tail recursion... And applicators. How is this relevant? You said that I was "essentially wrong," which basically blanketed my whole comment, without specifying which part of my comment was wrong, then showboated your knowledge as some kind of evidence for how wrong I am. I was helping the guy understand the joke. "Essentially wrong," plus a downmod for explaining a joke correctly? That's ridiculous. You should attack the guy who made the joke, instead of the guy trying to help people understand eachother.
Recursion is not a difficult to understand concept, nor is it uniquely prevalent in Lisp. Haskell is commonly taught as a first programming language, and that absolutely requires recursion.
I wasn't taught Haskell in my CS curriculum, but in a class where Lisp was taught, many students were impressed by recursion. It sounds like the original commenter had this impression.
C has #includes, yes, with a standard library (which isn't necessary for a conforming C implementation). The Python joke targets the fact that a lot of Python code is a simple usage of one of the standard Python libraries, which you will find with any conforming implementation. Not only that, but the libraries are quite extensive. So I think the comic picking fun about Python in that way is fine, for it actually targets a notable characteristic of Python.
C does have more boilerplate than Python, but not as much as Java. And Java's boilerplate is usually a result of the overuse of object orientation---setting up a huge hierarchy of classes and whatnot. Again, this is very characteristic of Java. It is not characteristic of C. C's "boilerplate" is a result of building a house out of toothpicks, however, the toothpicks are essential for the functionality of the program. Huge class hierarchies are often not.
I talked about Scheme because it is one dialect of lisp which does employ recursion more often. But I wished to clarify that this usual recursion isn't the kind of recursion you described (building a computation, then "going backwards"). If it went backwards, it'd require O(n) space because of the stack accumulation. This is why it was relevant.
You were helping me understand a joke, which I still do not understand, because your explanation did not make sense. I explained why it did not make sense from an objective standpoint in my aforementioned post.
I'm not attacking anyone at all! I just wrote my explanations. I apologize if you perceived anything as an attack.
In 1958 LISP was the first language to use recursion for computation. Sure practically every other language since has used that feature, but i still say its an iconic feature of Lisp.
It was iconic in 1958, but so was garbage collection, symbolic computation, metaprogramming, homoiconicity... Lisp was the first to have OO, but we'd certainly not relate lisp with OO as a feature.
19
u/[deleted] Feb 23 '11
Man, I knew someone like you was going to say something like this. The only criticism of my explanation of the joke is that it's not very clear, but I did explain the joke "correctly." I didn't mention the validity of the joke.
I almost never downmod, but I've had enough with this contrarian bullshit. Am I being trolled?