From 01b00c7acd5ef1bec098548974f75b4befbfe7d1 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Sun, 14 Nov 2021 10:59:00 +0000 Subject: - Added guest contribution by Conor Hoekstra. --- challenge-138/conor-hoekstra/apl/ch-1.apl | 8 ++++++++ challenge-138/conor-hoekstra/ch-01.apl | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 challenge-138/conor-hoekstra/apl/ch-1.apl delete mode 100644 challenge-138/conor-hoekstra/ch-01.apl diff --git a/challenge-138/conor-hoekstra/apl/ch-1.apl b/challenge-138/conor-hoekstra/apl/ch-1.apl new file mode 100644 index 0000000000..a78b3324c0 --- /dev/null +++ b/challenge-138/conor-hoekstra/apl/ch-1.apl @@ -0,0 +1,8 @@ +splitNumber ← { + n ← ≢⍕⍵ ⍝ # of digits + m ← 2(⊥⍣¯1)(¯1∘++⍳)2*¯1+n ⍝ masks + p ← (↓⍉m)⊂¨⊂⍕⍵ ⍝ partitions + ∨/(⍵*0.5)={+/⍎¨⍵}¨p +} + +splitNumber ¨ 81 9801 36 ⍝ 1 1 0 diff --git a/challenge-138/conor-hoekstra/ch-01.apl b/challenge-138/conor-hoekstra/ch-01.apl deleted file mode 100644 index a78b3324c0..0000000000 --- a/challenge-138/conor-hoekstra/ch-01.apl +++ /dev/null @@ -1,8 +0,0 @@ -splitNumber ← { - n ← ≢⍕⍵ ⍝ # of digits - m ← 2(⊥⍣¯1)(¯1∘++⍳)2*¯1+n ⍝ masks - p ← (↓⍉m)⊂¨⊂⍕⍵ ⍝ partitions - ∨/(⍵*0.5)={+/⍎¨⍵}¨p -} - -splitNumber ¨ 81 9801 36 ⍝ 1 1 0 -- cgit