Skip to content

Instantly share code, notes, and snippets.

View hustodemon's full-sized avatar

Frantisek Kobzik hustodemon

  • Deggendorf Institute of Technology
View GitHub Profile
@hustodemon
hustodemon / 2.clj
Last active December 3, 2021 12:58
(defn compute-next [[cur-pos cur-depth :as current] [dir quant :as instructions]]
(case dir
:forward [(+ cur-pos quant) cur-depth]
:down [cur-pos (+ cur-depth quant)]
:up [cur-pos (- cur-depth quant)]))
(defn compute-pos [[cur-pos cur-depth :as current] [[dir quant :as instructions] & rst]]
[quant dir]
(if (empty? instructions)
(* cur-pos cur-depth)