Ask HN: Examples of Complecting
1 pointsby oskarkv0 comments
(-> state
(assoc :a val)
(update-in [:b :c] f args)
(dissoc :d)
(some-other-fn args))
where :a - :d are keys. (call-update-fns game-state hook
(update-monster-positions)
(update-monster-ai)
(let-characters-attack)
(some-other-stuff))
It would thread the game-state (immutable) through all the functions, and call hook (a function) in between all the functions to send network messages and stuff (to minimize latency), and also collect and return new events that the functions created that I needed to handle (e.g. someone died when the characters attacked). It's almost like the state monad but not quite.