From fe117d2fc5884464f681a2dd4d21456efe6c64f1 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Wed, 13 Oct 2021 15:59:37 -0400 Subject: Challenge 111 --- challenge-111/conor-hoekstra/ch-01.apl | 6 ++++++ challenge-111/conor-hoekstra/ch-01.bqn | 6 ++++++ challenge-111/conor-hoekstra/ch-01.ijs | 6 ++++++ challenge-111/conor-hoekstra/ch-02.apl | 8 ++++++++ challenge-111/conor-hoekstra/ch-02.bqn | 4 ++++ 5 files changed, 30 insertions(+) create mode 100644 challenge-111/conor-hoekstra/ch-01.apl create mode 100644 challenge-111/conor-hoekstra/ch-01.bqn create mode 100644 challenge-111/conor-hoekstra/ch-01.ijs create mode 100644 challenge-111/conor-hoekstra/ch-02.apl create mode 100644 challenge-111/conor-hoekstra/ch-02.bqn diff --git a/challenge-111/conor-hoekstra/ch-01.apl b/challenge-111/conor-hoekstra/ch-01.apl new file mode 100644 index 0000000000..258593d268 --- /dev/null +++ b/challenge-111/conor-hoekstra/ch-01.apl @@ -0,0 +1,6 @@ +exists ← ∨/,⍤= + +⍝ Tests +input ← 4 4⍴⍳16 +10 exists input ⍝ 1 +20 exists input ⍝ 0 diff --git a/challenge-111/conor-hoekstra/ch-01.bqn b/challenge-111/conor-hoekstra/ch-01.bqn new file mode 100644 index 0000000000..75a1807ac3 --- /dev/null +++ b/challenge-111/conor-hoekstra/ch-01.bqn @@ -0,0 +1,6 @@ +Exists ← ∨´⥊∘= + +# Test +input ← 4‿4⥊↕16 +10 Exists input # 1 +20 Exists input # 0 diff --git a/challenge-111/conor-hoekstra/ch-01.ijs b/challenge-111/conor-hoekstra/ch-01.ijs new file mode 100644 index 0000000000..ca72766b1c --- /dev/null +++ b/challenge-111/conor-hoekstra/ch-01.ijs @@ -0,0 +1,6 @@ +exists =. [:+./,@:= + +NB. Tests +input =. i.4 4 +10 exists input NB. 1 +20 exists input NB. 0 diff --git a/challenge-111/conor-hoekstra/ch-02.apl b/challenge-111/conor-hoekstra/ch-02.apl new file mode 100644 index 0000000000..30f113bd9b --- /dev/null +++ b/challenge-111/conor-hoekstra/ch-02.apl @@ -0,0 +1,8 @@ +solution ← { + s ← ⍵/⍨(⊢≡⍳∘≢)∘⍋¨⍵ + ⊃s/⍨(⌈/=⊢)≢¨s +} + +⍝ Tests +solution 'ant' 'cat' 'dog' 'bee' 'deer' 'mouse' ⍝ deer +solution 'aNt' 'Cat' 'dog' 'bee' 'Deer' 'mouse' ⍝ Deer diff --git a/challenge-111/conor-hoekstra/ch-02.bqn b/challenge-111/conor-hoekstra/ch-02.bqn new file mode 100644 index 0000000000..421257a3cd --- /dev/null +++ b/challenge-111/conor-hoekstra/ch-02.bqn @@ -0,0 +1,4 @@ +Solution ← {⊑(⊢/˜·(⌈´=⊢)≠¨)(⊢/˜∧≡⊢)¨𝕩} + +# Tests (not doesn't work for uppercase) +Solution "ant"‿"cat"‿"dog"‿"bee"‿"deer"‿"mouse" # "deer" -- cgit