Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -1,8 +1,7 @@
use v6;
# Author: P. Seebauer
sub the_function(Range $a, Range $b, $s ) {
my ($a1, $a2, $b1, $b2) = ($a, $b)».bounds;
sub the_function(Range $a, Range $b, $s) {
my ($a1, $a2) = $a.bounds;
my ($b1, $b2) = $b.bounds;
return $b1 + (($s-$a1) * ($b2-$b1) / ($a2-$a1));
}
for ^11 -> $x {say "$x maps to {the_function(0..10,-1..0, $x)}"}
for ^11 -> $x { say "$x maps to {the_function(0..10, -1..0, $x)}" }

View file

@ -1,5 +1,6 @@
sub getmapper(Range $a, Range $b) {
my ($a1, $a2, $b1, $b2) = ($a, $b)».bounds;
my ($a1, $a2) = $a.bounds;
my ($b1, $b2) = $b.bounds;
return -> $s { $b1 + (($s-$a1) * ($b2-$b1) / ($a2-$a1)) }
}