Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perl Weekly Challenge 002 #28

Merged
merged 5 commits into from
Apr 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion challenge-001/alex-daniel/README

This file was deleted.

1 change: 1 addition & 0 deletions challenge-001/alexdaniel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Solutions by [AlexDaniel](https://github.com/AlexDaniel/)
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
$_ = ‘Perl Weekly Challenge’; say +tr/e/E/; .say

1 change: 0 additions & 1 deletion challenge-002/alex-daniel/README

This file was deleted.

1 change: 1 addition & 0 deletions challenge-002/alexdaniel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Solutions by [AlexDaniel](https://github.com/AlexDaniel/)
9 changes: 9 additions & 0 deletions challenge-002/alexdaniel/perl6/ch-1.p6
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Supports any unicode digits, so ႐႐၄၂ will be trimmed to ၄၂.
# Zero and negative numbers are not trimmed because the task
# specifically asks for positive numbers. However, it is not specified
# what a “number” is, and same goes for formatting requirements (e.g.
# “.5“ vs “0.5”), therefore I decided to keep it simple and just do
# the integers. So it's just a neat example on how to do unicode-aware
# number matching.

put S:r/^[ <:Nd> & <:Numeric_Value(0)> ]* <before <:Nd>+$>// for @*ARGS
9 changes: 9 additions & 0 deletions challenge-002/alexdaniel/perl6/ch-2.p6
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#| From base 10 to base 35
sub postfix:<₃₅>(Real() $a) { $a.base: 35 }
#| From base 35 to base 10
sub postfix:<₁₀>( Str() $a) { $a.parse-base: 35 }

say ‘ALEXDANIEL’₁₀;
say 836407881643061₃₅;

# You can do non-ints too, but they won't roundtrip as you might expect