Skip to content

Instantly share code, notes, and snippets.

@cjfrisz
Created September 19, 2013 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjfrisz/6618190 to your computer and use it in GitHub Desktop.
Save cjfrisz/6618190 to your computer and use it in GitHub Desktop.
Tangla point-free
(defn update-game!
[system-atom]
;; NB: write-only code
(let [game-env ((comp (partial apply game-env/update-player)
(juxt identity
(comp move-player
(partial apply player/update-cur-speed)
(juxt identity
(comp accelerate player/get-cur-speed))
game-env/get-player))
system/get-game-env)
@system-atom)]
(if (exit-reached? game-env)
(let [new-system (system/make-system)]
(dom/reset-canvas!
(system/get-game-env new-system)
(system/get-renderer new-system))
(swap! system-atom (constantly new-system)))
(swap! system-atom system/update-game-env game-env))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment