3 ms·
Curring is a way to do "dependency injection" in FP, so it let you to "capture" some arguments and don't pass them each time. Sure, arguments order matter, but
by megapoliss 5y ago
Curring is a way to do "dependency injection" in FP, so it let you to "capture" some arguments and don't pass them each time. Sure, arguments order matter, but you don't need to refactor that often.
I'm not familiar enough with clojure, buy in F# you sample with collision/shake/police may looks like
someGameState
|> handleCollisions
|> handleShake
|> handlePolice
...
|> renderGameState
where each function accept gameState, run some login against it, and return modified state, so you don't need to pass dozen arguments through call-stack.
- ajuc 5y agoIn clojure: (-> someGameState handleCollisions handleShake handlePolice ;; ... renderGameState) ;; ->> would work as well in this example cause it's both first and last argument But this code is only pretending to be functional, because in practice every function can modify everything. So looking at this I have no idea where the particles were created - I have to look at every function anyway.