langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

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

View file

@ -0,0 +1,7 @@
sub getmapper(Range $a, Range $b) {
my ($a1, $a2, $b1, $b2) = ($a, $b)».bounds;
return -> $s { $b1 + (($s-$a1) * ($b2-$b1) / ($a2-$a1)) }
}
my &mapper = getmapper(0 .. 10, -1 .. 0);
for ^11 -> $x {say "$x maps to &mapper($x)"}