diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2019-06-09 05:54:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-09 05:54:08 +0100 |
| commit | 529f91db3ee24353b458e3387fc11f78708b402f (patch) | |
| tree | 897de13e29aaa8b418e1b917076abe0660f353aa | |
| parent | 7ba32aaf3ff8e06c4d26a512c6ba3c25b558ee3b (diff) | |
| parent | 3679a03c9a70a13cf5028739ad4d15a6a562c325 (diff) | |
| download | perlweeklychallenge-club-529f91db3ee24353b458e3387fc11f78708b402f.tar.gz perlweeklychallenge-club-529f91db3ee24353b458e3387fc11f78708b402f.tar.bz2 perlweeklychallenge-club-529f91db3ee24353b458e3387fc11f78708b402f.zip | |
Merge pull request #227 from threadless-screw/master
Submissions for Week 11
| -rw-r--r-- | challenge-011/ozzy/perl6/ch-1.p6 | 14 | ||||
| -rw-r--r-- | challenge-011/ozzy/perl6/ch-2.p6 | 21 |
2 files changed, 35 insertions, 0 deletions
diff --git a/challenge-011/ozzy/perl6/ch-1.p6 b/challenge-011/ozzy/perl6/ch-1.p6 new file mode 100644 index 0000000000..656cf2aca4 --- /dev/null +++ b/challenge-011/ozzy/perl6/ch-1.p6 @@ -0,0 +1,14 @@ +#!/usr/bin/env perl6 + +sub T_F ( Num $T_C ) { $T_C * (212-32)/100 + 32 } +sub T_C ( Num $T_F ) { ($T_F - 32) * 100/(212-32) } + +sub MAIN ( + Str $T #= Temperature +) +{ + my $Tn = $T.Num; + + printf("%7.2f degrees Celcius is equal to %7.2f degrees Fahrenheit.\n", $Tn, T_F($Tn)); + printf("%7.2f degrees Fahrenheit is equal to %7.2f degrees Celcius.\n", $Tn, T_C($Tn)); +} diff --git a/challenge-011/ozzy/perl6/ch-2.p6 b/challenge-011/ozzy/perl6/ch-2.p6 new file mode 100644 index 0000000000..346fc299d2 --- /dev/null +++ b/challenge-011/ozzy/perl6/ch-2.p6 @@ -0,0 +1,21 @@ +#!/usr/bin/env perl6 +# +# Compose and print identity matrix +# +# Notes: +# - "is default" trait not implemented for shaped arrays +# - Partially dimensioned views of shaped arrays not yet implemented +# - Could use Math::Matrix + +sub MAIN (Int $dim) +{ + my @md[$dim;$dim]; + + for 0..$dim-1 -> $i { + for 0..$dim-1 -> $j { + @md[$i;$j]= $i==$j ?? 1 !! 0; + printf "%3i", @md[$i;$j]; + } + printf "\n"; + } +} |
