aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubos Kolouch <lubos@kolouch.net>2019-10-02 09:22:30 +0200
committerLubos Kolouch <lubos@kolouch.net>2019-10-02 09:22:30 +0200
commited33276e9f88fb1826a5dc1b0eba6b4ed116cd99 (patch)
tree2ec498226a2bb4ebb26399e62f320b4de83467b4
parent5c6789e1f955c451d35388b15f7c19ade549d271 (diff)
downloadperlweeklychallenge-club-ed33276e9f88fb1826a5dc1b0eba6b4ed116cd99.tar.gz
perlweeklychallenge-club-ed33276e9f88fb1826a5dc1b0eba6b4ed116cd99.tar.bz2
perlweeklychallenge-club-ed33276e9f88fb1826a5dc1b0eba6b4ed116cd99.zip
Initial commit for challenge 2
-rw-r--r--challenge-008/adam-russell/perl5/ext/blib/lib/temp.pl14
-rwxr-xr-xchallenge-017/arne-sommer/perl6/ackermann-cached30
-rwxr-xr-xchallenge-021/arne-sommer/perl6/finding-e-fatrat-test-cached67
-rw-r--r--challenge-028/lubos-kolouch/perl5/ch-2.pl33
4 files changed, 33 insertions, 111 deletions
diff --git a/challenge-008/adam-russell/perl5/ext/blib/lib/temp.pl b/challenge-008/adam-russell/perl5/ext/blib/lib/temp.pl
deleted file mode 100644
index ed75e5c98f..0000000000
--- a/challenge-008/adam-russell/perl5/ext/blib/lib/temp.pl
+++ /dev/null
@@ -1,14 +0,0 @@
-use strict;
-use warnings;
-
-use perfect;
-
-use Data::Dump q/pp/;
-
-my $p=new perfect::Perfect();
-foreach my $x (0..10000){
- if($p->isPerfect($x)){
- print "$x ";
- }
-}
-print "\n";
diff --git a/challenge-017/arne-sommer/perl6/ackermann-cached b/challenge-017/arne-sommer/perl6/ackermann-cached
deleted file mode 100755
index 6f59c82609..0000000000
--- a/challenge-017/arne-sommer/perl6/ackermann-cached
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /usr/bin/env perl6
-
-subset PositiveInt of Int where * > 0;
-subset PositiveIntZero of Int where * >= 0;
-
-sub MAIN(PositiveIntZero \m, PositiveIntZero \n)
-{
- say A(m, n);
-}
-my %cache;
-
-sub A(PositiveIntZero \m, PositiveIntZero \n)
-{
- unless %cache{m}{n}.defined
- {
- if m == 0
- {
- %cache{m}{n} = n + 1;
- }
- elsif n == 0
- {
- %cache{m}{n} = A(m - 1, 1);
- }
- else
- {
- %cache{m}{n} = A(m - 1, A(m, n - 1));
- }
- }
- return %cache{m}{n};
-}
diff --git a/challenge-021/arne-sommer/perl6/finding-e-fatrat-test-cached b/challenge-021/arne-sommer/perl6/finding-e-fatrat-test-cached
deleted file mode 100755
index 2d66fde1c7..0000000000
--- a/challenge-021/arne-sommer/perl6/finding-e-fatrat-test-cached
+++ /dev/null
@@ -1,67 +0,0 @@
-#! /usr/bin/env perl6
-
-my $e-seq := gather
-{
- take 1;
-
- my FatRat $current = 1.FatRat;
-
- for 1 .. Inf
- {
- $current /= $_;
- take $current;
- }
-}
-
-sub MAIN (:$steps = 10, :$verbose, :$test)
-{
- $verbose && say "{$_ + 1}: { $e-seq[$_].perl }" for ^$steps;
-
- my $value = $e-seq[^$steps].sum;
-
- if $test
- {
- my $long = get-euler-from-web($test);
-
- print "Answer: ";
- for ^$value.chars -> $pos
- {
- $value.substr($pos, 1) eq $long.substr($pos, 1)
- ?? print $value.substr($pos, 1)
- !! print "\x1b[41m" ~ $value.substr($pos, 1) ~ "\x1b[0m";
- }
- print "\n";
- say "Correct: " ~ $long.substr(0, $value.chars + 2) ~ "...";
-
- }
- else
- {
- say $e-seq[^$steps].sum;
- }
-}
-
-sub get-euler-from-web ($test)
-{
- use LWP::Simple;
-
- my $e-string = "";
-
- if $test eq "cached"
- {
- say "Loaded cached e.";
- return $*TMPDIR.add('euler_10000.txt').slurp if $*TMPDIR.add('euler_10000.txt').e;
- }
-
- for LWP::Simple.get('http://www-history.mcs.st-and.ac.uk/HistTopics/e_10000.html').lines -> $line
- {
- $e-string ~= $line.trim unless $line ~~ /<[a .. z A .. Z]>/; # Skip lines with html tags
- }
-
- if $test eq "cached"
- {
- $*TMPDIR.add('euler_10000.txt').spurt: $e-string;
- say "Saved cached e.";
- }
-
- return $e-string;
-}
diff --git a/challenge-028/lubos-kolouch/perl5/ch-2.pl b/challenge-028/lubos-kolouch/perl5/ch-2.pl
new file mode 100644
index 0000000000..47252e98bc
--- /dev/null
+++ b/challenge-028/lubos-kolouch/perl5/ch-2.pl
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+#===============================================================================
+#
+# FILE: ch-2.pl
+#
+# USAGE: ./ch-2.pl
+#
+# DESCRIPTION: https://perlweeklychallenge.org/blog/perl-weekly-challenge-028/
+#
+# Write a script to display Digital Clock. Feel free to be as creative as you can when displaying digits. We expect bare minimum something like “14:10:11”.
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Lubos Kolouch
+# ORGANIZATION:
+# VERSION: 1.0
+# CREATED: 09/30/2019 01:20:02 PM
+# REVISION: ---
+#===============================================================================
+
+use strict;
+use warnings;
+use feature qw/say/;
+use Acme::Cow;
+use DateTime;
+
+my $cow = new Acme::Cow;
+my $dt=DateTime->now;
+
+$cow->say($dt->hms);
+$cow->print();