A Quick Example Of Functional Programming (FP) In CFML
Posted by
Brad Wood
Jun 30, 2019 01:23:00 UTC
I was adding a feature to CommandBox CLI this week when I typed up some code that iterated over the keys in a struct, filtering out the ones it needed and then performed an action on the matching ones. I used the functional methods structFilter() and structEach() in CFML. They are an example of functional programming as they accept functions as input. This also means we can call them "higher order" functions. But termininologo aside, I typed up the same code using an older interactive approach just to compare the too. It was an interesting and rather self contained example so I thought I'd share it as a real life use case for FP (functional programming).