diff options
| author | Conor Hoekstra <codereport@outlook.com> | 2024-07-09 14:29:46 -0400 |
|---|---|---|
| committer | Conor Hoekstra <codereport@outlook.com> | 2024-07-09 14:29:46 -0400 |
| commit | f6319d73080f30f96184f1d1377c174750d7dc8b (patch) | |
| tree | 0eb71b586491c61cccc26c95e1fca7279d5806ca | |
| parent | 96580cd62594876fa534d57eb553637433c8ba04 (diff) | |
| download | perlweeklychallenge-club-f6319d73080f30f96184f1d1377c174750d7dc8b.tar.gz perlweeklychallenge-club-f6319d73080f30f96184f1d1377c174750d7dc8b.tar.bz2 perlweeklychallenge-club-f6319d73080f30f96184f1d1377c174750d7dc8b.zip | |
Challenge 272 in BQN
| -rw-r--r-- | challenge-272/conor-hoekstra/ch-1.bqn | 10 | ||||
| -rw-r--r-- | challenge-272/conor-hoekstra/ch-2.bqn | 17 |
2 files changed, 27 insertions, 0 deletions
diff --git a/challenge-272/conor-hoekstra/ch-1.bqn b/challenge-272/conor-hoekstra/ch-1.bqn new file mode 100644 index 0000000000..e30ce8f758 --- /dev/null +++ b/challenge-272/conor-hoekstra/ch-1.bqn @@ -0,0 +1,10 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/272-1.bqn + +Join ← {(≠𝕨)↓∾𝕨⊸∾¨𝕩} +Split ← (¬-˜⊢×·+`»⊸>)∘≠⊔⊢ +DefangIp ← "[.]" Join '.' Split ⊢ + +# Tests +DefangIp "1.1.1.1" # "1[.]1[.]1[.]1" +DefangIp "255.101.1.0" # "255[.]101[.]1[.]0" diff --git a/challenge-272/conor-hoekstra/ch-2.bqn b/challenge-272/conor-hoekstra/ch-2.bqn new file mode 100644 index 0000000000..67079f6d43 --- /dev/null +++ b/challenge-272/conor-hoekstra/ch-2.bqn @@ -0,0 +1,17 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/272-2.bqn + +# Solution 1 (Explicit) +ScoreOfString ← {+´|-´˘2↕'a'-˜𝕩} + +# Solution 2 (Tacit) +ScoreOfString ← +´·|·-´˘2↕-⟜'a' + +# Solution 3 (More Functions) +Ord ← -⟜'a' +Deltas ← -´˘2↕⊢ +ScoreOfString ← +´·|·Deltas Ord + +ScoreOfString "hello" # 13 +ScoreOfString "perl" # 30 +ScoreOfString "raku" # 37 |
