Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Someone Halp!

Name: Anonymous 2010-11-10 2:20

What in the fuck:

Array.prototype.foldr = function(func, initial) {
    return this.reduce(function(sum, x) {
        return function(n) {
            return sum(func(n, x));
        };
    }, function(x){return x;})(initial);
}

Name: Anonymous 2010-11-10 2:55

Halp
Stopped reading right there.

Name: Anonymous 2010-11-10 3:11

What kind of help do you want?

Name: Anonymous 2010-11-10 3:22

>>3
He clearly wants a ``halp''.

Name: Anonymous 2011-02-03 3:03

Name: Anonymous 2011-02-04 13:50

Name: Anonymous 2011-02-04 15:12

Name: Anonymous 2013-08-09 19:50

>>3
Don't halp him!

Name: Anonymous 2013-08-09 20:48

 

Name:   2013-08-09 20:49

 

Name: Anonymous 2013-08-09 20:49

 

Name: Anonymous 2013-08-09 20:49

 ☻

Name: Anonymous 2013-08-10 8:24

>>1

That is retarded, you should write normal code like this:


Array.prototype.foldl = function(f,z){
for(i = 0; i < this.length; i++){
   z = f(z,this[i]);
}
return z;
}


Javascript sucks at tail recursion, so you better translate your snippet to imperative code. Also foldl is more natural in this context and has no disadvantage over foldr. If you want foldr, walk over the list reverse (start by (length - 1)).

Name: Anonymous 2013-08-10 8:37

>>13
you can't tell me what to do.

And you're silly implementation will not take advantage of the multicore javascript enabled future.

You'll be left behind in the dark ages of computing.

Name: Anonymous 2013-08-10 8:40

>>14
multicore javascript enabled future

folds cannot (in general) be parallelized.

Name: Anonymous 2013-08-10 9:10

javascript enabled apps of the future will inspect the properties of the operation in the fold, and paralyze as necessary in different iframes. This is done using the <hoist><isub parallel="true"/></hoist> combinator pop up menu jquery.

Name: Anonymous 2013-08-10 9:18

>paralyze
My Firefox doesn't like the sound of this.

Name: Anonymous 2013-08-10 9:20

>>15-16
With a supporting type system you can annotate the closure with the associative property. But no, you can't use analysis.

Name: Anonymous 2013-08-10 9:49

>>16

But that operation will yield a map then, so why not use map in the first place?

Don't change these.
Name: Email:
Entire Thread Thread List