FPO
FPO copied to clipboard
should we pick up some tricks/optimizations from Ramda?
Some interesting things from Ramda to consider adding to FPO:
-
_arity(..)is used to create a function with a proper.length, from the results of utils likecurry(..), etc -
utils like
flip(..)will re-curry the function (in other words, assuming you always want currying)
Liking FPO and just heard of it as I'm learning Ramda. Some of the features I find useful in Ramda are lenses, evolve, converge and more. Will FPO support these types of functions?
I'm open to some of those more advanced features... however, I personally haven't ever been able to get my head around their usefulness. I would need to see some concrete examples of how those things would be useful, so if you have some suggestions, please share! :)
Interesting, I am certainly open to having the least cluttered toolbox possible. I'm just looking for the best means to get things done in a project that is data/state intensive.
It does seem like all the functions I mentioned are higher level concepts that are carried out by the basics, essentially getting and setting, which use mapping and transforming in unique ways. So, maybe the right way to view them is just as handy recipes that many have found useful?
Still, I like the facility to breakout data lenses as reusable and composable functions. This is especially useful in the large exchangable and very structured states I'm using. I do like the ability to create a module of these abstracted away lens functions, that can then be used in umpteen ways.
Looking again at evolve I can almost picture it as a FPO function that is handed a state object and a given set of named args mapped to functions that target keys in the state object that match the named args, anything is possible. Maybe this is the new and improved lens!?
Found some pro lens articles in my massive collection of things to digest, simplify and apply. Here are some of the better ones :)
https://medium.com/@drboolean/lenses-with-immutable-js-9bda85674780 https://medium.com/javascript-inside/an-introduction-into-lenses-in-javascript-e494948d1ea5 http://randycoulman.com/blog/2016/07/12/thinking-in-ramda-lenses https://vanslaars.io/post/setstate-lenses http://joneshf.github.io/programming/2015/12/19/Lenses-and-Virtual-DOM-Support-Open-Closed.html#wrap-up