aboutsummaryrefslogtreecommitdiff
path: root/challenge-011
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2019-06-07 23:36:48 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2019-06-07 23:36:48 +0100
commit82d3bc4156c6bc9a94bb5d6bca89b7b747371cc6 (patch)
tree9b6491546b4fb1a90a7f624d68cc0f2bb408f9f7 /challenge-011
parent8d3b71a68c5f96b12cbc52c4ce86249d3a6cc40b (diff)
downloadperlweeklychallenge-club-82d3bc4156c6bc9a94bb5d6bca89b7b747371cc6.tar.gz
perlweeklychallenge-club-82d3bc4156c6bc9a94bb5d6bca89b7b747371cc6.tar.bz2
perlweeklychallenge-club-82d3bc4156c6bc9a94bb5d6bca89b7b747371cc6.zip
- Added blog by Jo Christian Oterhals.
Diffstat (limited to 'challenge-011')
-rw-r--r--challenge-011/jo-christian-oterhals/blog.txt1
-rw-r--r--challenge-011/jo-christian-oterhals/perl6/ch-1.p621
2 files changed, 22 insertions, 0 deletions
diff --git a/challenge-011/jo-christian-oterhals/blog.txt b/challenge-011/jo-christian-oterhals/blog.txt
new file mode 100644
index 0000000000..8abe3a4a23
--- /dev/null
+++ b/challenge-011/jo-christian-oterhals/blog.txt
@@ -0,0 +1 @@
+https://medium.com/@jcoterhals/perl-6-small-stuff-20-from-anonymous-one-line-functions-to-full-length-mains-with-type-and-error-3d3a69faabda
diff --git a/challenge-011/jo-christian-oterhals/perl6/ch-1.p6 b/challenge-011/jo-christian-oterhals/perl6/ch-1.p6
new file mode 100644
index 0000000000..54955d03c7
--- /dev/null
+++ b/challenge-011/jo-christian-oterhals/perl6/ch-1.p6
@@ -0,0 +1,21 @@
+#!/usr/bin/env perl6
+
+multi MAIN( #= Compares the C. scale to any scale you dream up
+ Real $f, #= freezing point in custom scale
+ Real $b #= boiling point in custom scale
+) {
+ say "There is no equal point for this scale." and exit if $b - $f == 100;
+ my $equal-point = $f / (1 - (($b - $f) / 100));
+ say "The calculated equal point is only theoretical as it is below absolute zero." if $equal-point < -273.15;
+ say "Equal point: $equal-point";
+}
+
+multi MAIN( #= Compares the C. scale to a named temperature scale
+ Str $scale where { $_ ~~ m:i/^(fahrenheit|kelvin|rankin)$/ } #= Name of scale (Fahrenheit, Kelvin or Rankin)
+) {
+ given $scale.fc {
+ when "fahrenheit" { MAIN( 32 , 212 ); }
+ when "kelvin" { MAIN(273.15, 373.15); }
+ when "rankin" { MAIN(491.67, 671.67); }
+ }
+}