Skip to content

Commit

Permalink
check math on updown cyclic modulation
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Sep 27, 2024
1 parent 5e259b6 commit dcd6766
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/shimmers/scratch/modulus.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@
p (range 2 6)]
[[s p]
(mapv (fn [x] (mod (+ s (mod x p)) 8)) (range 8))
(mapv (fn [x] (mod (+ s (mod (- p 1 x) p)) 8)) (range 8))]))
(mapv (fn [x] (mod (+ s (mod (- p 1 x) p)) 8)) (range 8))])

;; updown cyclic
(for [n [3 4 5]]
(for [x (range 16)]
[(mod x n)
(let [m (mod x (- (* 2 n) 2))]
(if (< m n) m (- (* 2 n) 2 m)))])))

0 comments on commit dcd6766

Please sign in to comment.