Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Map-range/Clojure/map-range.clj
Normal file
17
Task/Map-range/Clojure/map-range.clj
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(defn maprange [[a1 a2] [b1 b2] s]
|
||||
(+ b1 (/ (* (- s a1) (- b2 b1)) (- a2 a1))))
|
||||
|
||||
> (doseq [s (range 11)]
|
||||
(printf "%2s maps to %s\n" s (maprange [0 10] [-1 0] s)))
|
||||
|
||||
0 maps to -1
|
||||
1 maps to -9/10
|
||||
2 maps to -4/5
|
||||
3 maps to -7/10
|
||||
4 maps to -3/5
|
||||
5 maps to -1/2
|
||||
6 maps to -2/5
|
||||
7 maps to -3/10
|
||||
8 maps to -1/5
|
||||
9 maps to -1/10
|
||||
10 maps to 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue