BookmarkSubscribeRSS Feed
nascif_jmp

Staff

Joined:

Jul 30, 2015

MFR: a Functional Programming Library for JSL

I developed this helper library while I was working on a large JSL framework. After coding the n-th For() loop to traverse a list (and fixing that many bugs related to unintended clobbering of the index variable) I realized that the code would look a lot cleaner (and be easier to maintain) if I used higher-level abstractions like the ones commonly used in Functional Programming.

The library implements the trio map/filter/reduce, available in languages like Python and JavaScript, plus a few more like apply, reduce and compare. It was inspired by http://book.pythontips.com/en/latest/map_filter.html.

Check the tests for usage examples and let me know if you find a bug or a way to improve it!

Article Tags
Contributors