Comment detail

循環関数 (Nested Flatten)

#6391と一緒になりました

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
(use gauche.test)
(define (modular n low high)
  (+ (modulo n (- high low -1)) low))

(test* "T1" 100 (modular    0 100 200))
(test* "T2" 150 (modular   50 100 200))
(test* "T3" 200 (modular  100 100 200))
(test* "T4" 100 (modular  101 100 200))
(test* "T5" 200 (modular   -1 100 200))
(test* "T6"  -4 (modular    1  -5 200))
(test* "T7"  -5 (modular -500  -5  -1))

Index

Feed

Other

Link

Pathtraq

loading...