Skip to content

Commit afa650b

Browse files
committed
Succ and pred
1 parent 6c3d942 commit afa650b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

strats/simple.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
(def LM 5)
2929
(def GHOST 6)
3030

31-
(def at [world-map x y]
31+
(defn at [world-map x y]
3232
(nth (nth (world-map) y) x))
3333

34-
(def neighbour [pos direction]
34+
(defn neighbour [pos direction]
3535
(let [x (head pos)
3636
y (tail pos)]
3737
(if (== direction UP)

strats/stdlib.clj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
(defn nth [list pos]
2-
(if (== pos 0) (head list) (nth (tail list) (- pos 1)))
2+
(if (== pos 0) (head list) (nth (tail list) (pred pos)))
3+
4+
(defn succ [x]
5+
(add x 1))
6+
7+
(defn pred [x]
8+
(sub x 1))

0 commit comments

Comments
 (0)