Hooray functional programming

I noticed that we’ve suddenly got some of the building blocks for functional programming going on in our Arrays (map, filter, some, every), but reduce (fold) seems to be missing.

Easy enough to implement myself if I really want it (I do), but curious if it was left out for some reason or if we might be seeing it sometime in the future? :D

I think it wasn’t so suddenly, these functions on Arrays have been there at least since 4.0, I think :-)

Anyway: they came with an upgrade of the JavaScript engine a few versions back. Array.reduce is part if the JavaScript engine yet, but it is part of the recently approved EcmaScript (JavaScript) 5 spec, so it’s likely to show up in a future version of the JavaScript engine and then when that gets incorporated into Servoy, you’ll see the reduce/reduceRight functions on Arrays pop up as well.

Paul

pbakker:
I think it wasn’t so suddenly, these functions on Arrays have been there at least since 4.0, I think :-)

:oops:

Well, it took us a while to get out of 3.5…

Anyhow, great fun. I can see myself probably getting into some trouble with this.