aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.freedom.nl>2021-12-06 12:27:19 +0100
committerAbigail <abigail@abigail.freedom.nl>2021-12-06 12:37:07 +0100
commit576b2414b5710fb36761e040116b0f2b6233e359 (patch)
treedb45cfe1e1203ce579f8c2b071548dd79478dfd5
parentb9773f5c38387d865a093d2ecdfd1b01b4452c34 (diff)
downloadperlweeklychallenge-club-576b2414b5710fb36761e040116b0f2b6233e359.tar.gz
perlweeklychallenge-club-576b2414b5710fb36761e040116b0f2b6233e359.tar.bz2
perlweeklychallenge-club-576b2414b5710fb36761e040116b0f2b6233e359.zip
Solution for week 142.
We lack the resources to implement task 2 (this requires a real time operating system, and a perl with threads compiled in). Task 1 is just a repeat of last week, and the week before. I can't be assed to copy-and-paste most of last weeks code, so, we just have a Perl solution.
-rw-r--r--challenge-142/abigail/README.md31
-rw-r--r--challenge-142/abigail/perl/ch-1.pl10
-rw-r--r--challenge-142/abigail/perl/ch-2.pl16
3 files changed, 26 insertions, 31 deletions
diff --git a/challenge-142/abigail/README.md b/challenge-142/abigail/README.md
index 0ebe05c131..d589af7261 100644
--- a/challenge-142/abigail/README.md
+++ b/challenge-142/abigail/README.md
@@ -2,35 +2,4 @@
## Part 1
-* [AWK](awk/ch-1.awk)
-* [Bash](bash/ch-1.sh)
-* [Bc](bc/ch-1.bc)
-* [C](c/ch-1.c)
-* [Go](go/ch-1.go)
-* [Java](java/ch-1.java)
-* [Lua](lua/ch-1.lua)
-* [Node.js](node/ch-1.js)
-* [Pascal](pascal/ch-1.p)
* [Perl](perl/ch-1.pl)
-* [Python](python/ch-1.py)
-* [R](r/ch-1.r)
-* [Ruby](ruby/ch-1.rb)
-* [Tcl](tcl/ch-1.tcl)
-* [Scheme](scheme/ch-1.scm)
-
-## Part 2
-
-* [AWK](awk/ch-2.awk)
-* [Bash](bash/ch-2.sh)
-* [C](c/ch-2.c)
-* [Go](go/ch-2.go)
-* [Java](java/ch-2.java)
-* [Lua](lua/ch-2.lua)
-* [Node.js](node/ch-2.js)
-* [Pascal](pascal/ch-2.p)
-* [Perl](perl/ch-2.pl)
-* [Python](python/ch-2.py)
-* [R](r/ch-2.r)
-* [Ruby](ruby/ch-2.rb)
-* [Tcl](tcl/ch-2.tcl)
-* [Scheme](scheme/ch-2.scm)
diff --git a/challenge-142/abigail/perl/ch-1.pl b/challenge-142/abigail/perl/ch-1.pl
new file mode 100644
index 0000000000..dcc92f41db
--- /dev/null
+++ b/challenge-142/abigail/perl/ch-1.pl
@@ -0,0 +1,10 @@
+#
+# This is the third week in a row where me need the divisors
+# of a number. Kind of boring....
+#
+# This is just a one liner, taking input from standard input.
+#
+# Math::Prime::divisors gives us the divisors of the first number;
+# then it's a matter of grepping the ones ending with the second number.
+#
+perl -MMath::Prime::Util=divisors -pale '$_ = grep {/$F[1]$/} divisors $F[0]'
diff --git a/challenge-142/abigail/perl/ch-2.pl b/challenge-142/abigail/perl/ch-2.pl
new file mode 100644
index 0000000000..90be35c6a8
--- /dev/null
+++ b/challenge-142/abigail/perl/ch-2.pl
@@ -0,0 +1,16 @@
+#
+# To do this, we need two things:
+#
+# 1. A perl with threads compiled in.
+# 2. A machine with a real-time OS (Windows, and almost all Unices,
+# including Linux and MacOs will not do).
+#
+# 2. is necessary because the algorithm critically depends on sleeping
+# for an exact amount of time. Most OSses cannot do this. I don't even
+# know whether perl runs on any OS which can sleep an exact amount of time.
+#
+# I'm not even going to bother recompiling my perl to implement some
+# stupid joke. Let alone buy another box.
+#
+
+die "$^O will not do.\n";