aboutsummaryrefslogtreecommitdiff
path: root/challenge-178
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2022-08-17 13:12:44 +0100
committerGitHub <noreply@github.com>2022-08-17 13:12:44 +0100
commit9d463c40ddab67dfcbf43f2154ee8da01d83ca45 (patch)
treefc834eca4c988ece5d0b2f7ac36a9e1f119581a9 /challenge-178
parent36f3d61ca459c3b7f6c75e6bdd11c5030c869c17 (diff)
parentaf25d3c7e89c15703c51ba2383b918ff1d6a5380 (diff)
downloadperlweeklychallenge-club-9d463c40ddab67dfcbf43f2154ee8da01d83ca45.tar.gz
perlweeklychallenge-club-9d463c40ddab67dfcbf43f2154ee8da01d83ca45.tar.bz2
perlweeklychallenge-club-9d463c40ddab67dfcbf43f2154ee8da01d83ca45.zip
Merge pull request #6627 from steve-g-lynn/branch-for-challenge-178
pwc-178
Diffstat (limited to 'challenge-178')
-rw-r--r--challenge-178/steve-g-lynn/blog.txt1
-rwxr-xr-xchallenge-178/steve-g-lynn/julia/ch-1.jl14
-rwxr-xr-xchallenge-178/steve-g-lynn/perl/ch-2.pl23
-rwxr-xr-xchallenge-178/steve-g-lynn/raku/ch-1.p613
4 files changed, 51 insertions, 0 deletions
diff --git a/challenge-178/steve-g-lynn/blog.txt b/challenge-178/steve-g-lynn/blog.txt
new file mode 100644
index 0000000000..379c3eb461
--- /dev/null
+++ b/challenge-178/steve-g-lynn/blog.txt
@@ -0,0 +1 @@
+https://thiujiac.blogspot.com/2022/08/pwc-178.html
diff --git a/challenge-178/steve-g-lynn/julia/ch-1.jl b/challenge-178/steve-g-lynn/julia/ch-1.jl
new file mode 100755
index 0000000000..a83f2d2af4
--- /dev/null
+++ b/challenge-178/steve-g-lynn/julia/ch-1.jl
@@ -0,0 +1,14 @@
+#!/usr/bin/env julia
+
+#-- this works only for real integers
+#-- uses the connection between base -4 and base 2i for reals
+#-- (see wikipedia: https://en.wikipedia.org/wiki/Quater-imaginary_base)
+
+function quater_imaginary( n::Int64) ::String
+ dn = digits(n,base=-4)
+ return join(reverse(dn),0)
+end
+
+println(quater_imaginary(4)) #10300
+println(quater_imaginary(-15)) #1030001
+
diff --git a/challenge-178/steve-g-lynn/perl/ch-2.pl b/challenge-178/steve-g-lynn/perl/ch-2.pl
new file mode 100755
index 0000000000..a6bd42727d
--- /dev/null
+++ b/challenge-178/steve-g-lynn/perl/ch-2.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+
+use Date::Manip;
+#https://metacpan.org/pod/Date::Manip
+
+print &print_date_plus_duration('2022-08-01 10:30','in 4 business hours'),"\n";
+
+#22-08-01 14:30
+
+print &print_date_plus_duration('2022-08-01 17:00','in 3.5 business hours'),"\n";
+
+#22-08-02 11:30
+
+sub print_date_plus_duration {
+ my ($datestr,$deltastr)=@_;
+ my $date = new Date::Manip::Date;
+ my $delta = $date->new_delta();
+ $date->parse($datestr);
+ $delta->parse($deltastr);
+
+ return $date->calc($delta)->printf('%y-%m-%d %H:%M');
+}
+
diff --git a/challenge-178/steve-g-lynn/raku/ch-1.p6 b/challenge-178/steve-g-lynn/raku/ch-1.p6
new file mode 100755
index 0000000000..f914e259eb
--- /dev/null
+++ b/challenge-178/steve-g-lynn/raku/ch-1.p6
@@ -0,0 +1,13 @@
+#!/usr/bin/env perl6
+
+use Base::Any;
+
+say 4.&to-base( 2i); #10300
+say (-15).&to-base( 2i); #1030001
+
+say (35+23i).&to-base( 2i); #121003.2
+
+
+
+
+