Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Map-range/Wren/map-range.wren
Normal file
11
Task/Map-range/Wren/map-range.wren
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import "/fmt" for Fmt
|
||||
|
||||
var mapRange = Fn.new { |a, b, s| b.from + (s - a.from) * (b.to - b.from) / (a.to - a.from) }
|
||||
|
||||
var a = 0..10
|
||||
var b = -1..0
|
||||
for (s in a) {
|
||||
var t = mapRange.call(a, b, s)
|
||||
var f = (t >= 0) ? " " : ""
|
||||
System.print("%(Fmt.d(2, s)) maps to %(f)%(t)")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue