diff options
| -rw-r--r-- | challenge-172/conor-hoekstra/ch-1.apl | 17 | ||||
| -rw-r--r-- | challenge-172/conor-hoekstra/ch-2.apl | 16 |
2 files changed, 33 insertions, 0 deletions
diff --git a/challenge-172/conor-hoekstra/ch-1.apl b/challenge-172/conor-hoekstra/ch-1.apl new file mode 100644 index 0000000000..30f0e454b4 --- /dev/null +++ b/challenge-172/conor-hoekstra/ch-1.apl @@ -0,0 +1,17 @@ +)load dfns + +primePartitions ← { + p ← ⍸1 pco ⍳⍵ ⍝ primes + c ← p[⍺ cmat ≢p] ⍝ combiations + (↓c)/⍨⍵=+/c +} + +⍝ Tests + 2 primePartitions 18 +┌────┬────┐ +│5 13│7 11│ +└────┴────┘ + 3 primePartitions 19 +┌──────┐ +│3 5 11│ +└──────┘
\ No newline at end of file diff --git a/challenge-172/conor-hoekstra/ch-2.apl b/challenge-172/conor-hoekstra/ch-2.apl new file mode 100644 index 0000000000..9ae2d37f2a --- /dev/null +++ b/challenge-172/conor-hoekstra/ch-2.apl @@ -0,0 +1,16 @@ +min ← ⌊/ +avg ← +/÷≢ +max ← ⌈/ + +percentile ← { + i ← 100÷⍨⍺ׯ1+≢⍵ ⍝ index + avg ⍵[1+(⌈,⌊)i] +} + +fiveNumSummary ← min,25∘percentile,avg,75∘percentile,max + +⍝ Tests + fiveNumSummary 0 0 1 2 63 61 27 13 +0 0.5 20.875 44 63 + fiveNumSummary ⍳5 +1 2 3 4 5 |
