Live data from Hacker News

PG on the cover of Forbes

forbes.com

61–70 of 70 posts

Re: PG on the cover of Forbes

#61
post #60
post #48

Earlier quoted context omitted.

Loops are how most people think. They're also how most CPUs think. It seems to me logical for both parties to express programs mostly using loops.

Except there is no difference at the machine instruction level between a recursive and iterative approaches. They are isomorphic to each other. That is why you can implement all recursive algorithms using an explicit stack and a loop and all iterative algorithms as recursive functions.

Huh?

There's a lot of difference in the unoptimized form of recursion - namely stack usage. Yes you can hack together tail call recursion to try and make recursion perform as well as iteration does, but what really is the point?

Re: PG on the cover of Forbes

#62
post #40
post #32

Earlier quoted context omitted.

Wow, hmm.. I worked a MEDITECH a long time ago, and they actually used a programming language, MAGIC, that you couldn't recurse in. It used macro code expansion to take MAGIC code and output into a lower level language and recursion would make it loop infinitely. Maybe at MEDITECH it wouldn't have been so academic. Edit: Not sure why this got downvoted, but in their internal programming course they talked about the r…

Why is it an issue though? Recursion is an optional thing some programmers like using. It's not necessary. edit: rather than downmod me to -1 for stating a fact, why not reply?

That's like saying integers are an optional thing, and it's no big deal if your programming language doesn't have them. True, they aren't necessary (look at peano arith or pure lambda calc) - but it sure makes things a lot easier. It's much more concise and intuitive to write some search or divide and conquer algos recursively than imperatively.

Re: PG on the cover of Forbes

#63

Earlier quoted context omitted.

> Heh... completely wrong, but I suppose it's the best you can expect a non-techie/math nerd readership to get. Heck, it's probably close to the most you can expect the average programmer to get. How would you explain the Y Combinator to the Hacker News readership?

There have been explanations for the HN readers. Here's one that I'd put in a non-techy newspaper: The Y Combinator is a way to make computer code self-referential without having to introduce names for parts of the code. Or a bit less accurate: The Y Combinator is a clever way to make computer code self-referential.

You do need names for some parts. I would modify that to:

"It's a program that lets other programs see themselves."

Re: PG on the cover of Forbes

#64
post #52
post #33

And here was I expecting a typically insightful commentary by PG regarding the front page of a business journal.

It has unusually clean design. I've noticed that in other consumer goods lately. E.g. cereal boxes. I wonder if it's the result of a/b testing, or just a fashion.

It was an existing trend accelerated by the recession. An excess of stuff is no longer fashionable. Hopefully it lasts awhile (the fashion, not the recession).

Re: PG on the cover of Forbes

#65
post #62
post #40

Earlier quoted context omitted.

Why is it an issue though? Recursion is an optional thing some programmers like using. It's not necessary. edit: rather than downmod me to -1 for stating a fact, why not reply?

That's like saying integers are an optional thing, and it's no big deal if your programming language doesn't have them. True, they aren't necessary (look at peano arith or pure lambda calc) - but it sure makes things a lot easier. It's much more concise and intuitive to write some search or divide and conquer algos recursively than imperatively.

javascript doesn't have an integer type.

Possibly it makes things easier for some algorithms, but as I said, it is optional. It's not rocket science to rewrite any algorithm that relies on recursion to not need it.

Re: PG on the cover of Forbes

#66

Earlier quoted context omitted.

His eyes are smiling, I bet he's about to crack up.

his left eye makes me happy. i wonder why.

i think it's a right brain bicameral lateralization thing, but if someone more knowledgeable than me can get more explicit, i would absolutely love to hear

Re: PG on the cover of Forbes

#67
post #61
post #60

Earlier quoted context omitted.

Except there is no difference at the machine instruction level between a recursive and iterative approaches. They are isomorphic to each other. That is why you can implement all recursive algorithms using an explicit stack and a loop and all iterative algorithms as recursive functions.

Huh? There's a lot of difference in the unoptimized form of recursion - namely stack usage. Yes you can hack together tail call recursion to try and make recursion perform as well as iteration does, but what really is the point?

[deleted]

Re: PG on the cover of Forbes

#68
post #61
post #60

Earlier quoted context omitted.

Except there is no difference at the machine instruction level between a recursive and iterative approaches. They are isomorphic to each other. That is why you can implement all recursive algorithms using an explicit stack and a loop and all iterative algorithms as recursive functions.

Huh? There's a lot of difference in the unoptimized form of recursion - namely stack usage. Yes you can hack together tail call recursion to try and make recursion perform as well as iteration does, but what really is the point?

The concept of recursion in is independent of computers. Recursion is just the mathematicians idea of how to repeat get arbitrarily big objects out of limited definitions.

Loops are a just a special case, and not really closer to the hardware. Branches and jumps are closer to the hardware. "Yes you can hack together [a compiler] to try and make [structured programming] perform as well as [goto] does, but what really is the point?"

Re: PG on the cover of Forbes

#69
post #24

Earlier quoted context omitted.

The Y combinator is a programming construct allowing one to write recursive functions without explicitly calling themselves (unnamed recursive functions): (define Y (lambda (X) ((lambda (procedure) (X (lambda (arg) ((procedure procedure) arg)))) (lambda (procedure) (X (lambda (arg) ((procedure procedure) arg))))))) (define F* (lambda (func-arg) (lambda (n) (if (zero? n) 1 (* n (func-arg (- n 1))))))) (define fact (Y…

I took the liberty of translating this to JavaScript, primarily to help me understand it, but thought I should share: // (define Y // (lambda (X) // ((lambda (procedure) // (X (lambda (arg) ((procedure procedure) arg)))) // (lambda (procedure) // (X (lambda (arg) ((procedure procedure) arg))))))) var Y = function(X) { return (function (procedure) { return X(function (arg) { return procedure(procedure)(arg); }); })(fu…

This will probably go unnoticed, but this function seems to be equivalent, at least for the factorial example. What's the difference?

    var Y = function(X) {
        var Z = X(function(arg) {
            return Z(arg);
        });
        return Z;
    }

Re: PG on the cover of Forbes

#70

Earlier quoted context omitted.

I took the liberty of translating this to JavaScript, primarily to help me understand it, but thought I should share: // (define Y // (lambda (X) // ((lambda (procedure) // (X (lambda (arg) ((procedure procedure) arg)))) // (lambda (procedure) // (X (lambda (arg) ((procedure procedure) arg))))))) var Y = function(X) { return (function (procedure) { return X(function (arg) { return procedure(procedure)(arg); }); })(fu…

This will probably go unnoticed, but this function seems to be equivalent, at least for the factorial example. What's the difference? var Y = function(X) { var Z = X(function(arg) { return Z(arg); }); return Z; }

The difference is that the whole point of the Y combinator is that it's a fixed-point combinator that doesn't use explicit recursion. Imagine that you didn't have "var", and couldn't name anything (which is the situation in, say, the lambda calculus). Using the Y combinator you could still define recursive functions.
Post reply on HN