News for hackers. Stuff that matters.
Re:It’s time to move on from OOP? by fauigerzigerk on Monday July 22, 2019 @06:37AM (#20496745)
Here's a functional programming version of a similar bug:

    function factorial(x, pred) {
        if (x == 0)
            return 1;
        return x * factorial(pred(x), pred);
    }

    function makePred(x) {
        return y => y - x;
    }

    console.log(factorial(5, makePred(-1)));

There are no comments on this comment yet.