langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
14
Task/Map-range/Objeck/map-range.objeck
Normal file
14
Task/Map-range/Objeck/map-range.objeck
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
bundle Default {
|
||||
class Range {
|
||||
function : MapRange(a1:Float, a2:Float, b1:Float, b2:Float, s:Float) ~ Float {
|
||||
return b1 + (s-a1)*(b2-b1)/(a2-a1);
|
||||
}
|
||||
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
"Mapping [0,10] to [-1,0] at intervals of 1:"->PrintLine();
|
||||
for(i := 0.0; i <= 10.0; i += 1;) {
|
||||
IO.Console->Print("f(")->Print(i->As(Int))->Print(") = ")->PrintLine(MapRange(0.0, 10.0, -1.0, 0.0, i));
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue