by megapoliss · 4y ago · 0 comments
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. (-> 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.