DEV Community

Discussion on: We Don't Need No Stinking map() or filter()

Collapse
 
joelnet profile image
JavaScript Joel

Great article!

And I could show you a real use case for this. I have created MojiScript and implemented map, filter and reduce. Both map and filter internally call reduce. Here's some examples:

const map = func => iterable => reduceWhile (null) (asyncMapReducer (func)) ([]) (iterable)

github.com/joelnet/MojiScript/blob...

const filter = predicate => iterable => reduceWhile (null) (asyncFilterReducer (predicate)) ([]) (iterable)

github.com/joelnet/MojiScript/blob...

Well technically they (and also reduce) call reduceWhile.

Collapse
 
jdsteinhauser profile image
Jason Steinhauser

Glad you enjoyed it! And it looks like I'm going to have to invest some time in checking out MojiScript. It looks like it could have some legs!

Collapse
 
joelnet profile image
JavaScript Joel

lol I would agree with you on MojiScript, but I am obviously biased ;)