Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
CSP and Transducers in JavaScript (phuu.net)
17 points by jackfranklin on Aug 31, 2014 | hide | past | favorite | 1 comment


Some gems in there

First, we have to realise that many array (or other collection) operations like map, filter and reverse can be defined in terms of a reduce.

...

To get at the reducing functions, we need to make map and filter more generic by extracting the pieces they have in common:

- Use of collection.reduce

- The 'seed' value is an empty array

- The concat operation performed on result and the input (transform-ed or not)

...

Before we do that, we need a new function: identity. It simply returns whatever it is given:

(Although there is a lot that may be obvious to the Haskell guys)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: