Sha256: c7ed22a07f6ee243c12eba8c95ccd6fa6cea88d01d0931dc07f29ee92a1f378f

Contents?: true

Size: 1.15 KB

Versions: 130

Compression:

Stored size: 1.15 KB

Contents

log←'./raindrops.tc.log'
⍎ ')COPY ',(⎕FIO 30),'/../../test.apl'

test∆copy_relative 'raindrops.apl'
test∆clear_log log

⍝ ∇convert
⍝ Given an integer, returns a string representation of that integer's "raindrop sound", based on its prime factors.

⍝ the sound for 1 is '1'
  1⎕CR convert 1
'1'

⍝ the sound for multiples of 3 is 'Pling'
  convert 3
Pling
  convert 6
Pling

⍝ the sound for multiples of 5 is 'Plang'
  convert 5
Plang
  convert 10
Plang

⍝ the sound for multiples of 7 is 'Plong'
  convert 7
Plong
  convert 14
Plong

⍝ the sound for numbers that aren't multiples of 3, 5, or 7 is the stringified number
  1⎕CR convert 8
'8'
  1⎕CR convert 52
'52'

⍝ the sound for numbers that have multiple raindrop factors is the combination of all the sounds
  convert 15 ⍝ 3×5
PlingPlang
  convert 21 ⍝ 3×7
PlingPlong
  convert 35 ⍝ 5×7
PlangPlong
  1⎕CR convert 105 ⍝ 3×5×7
'PlingPlangPlong'

⍝ the sound for powers of a raindrop factor is only the single sound
  convert 9 ⍝ 3×3
Pling
  convert 25 ⍝ 5×5
Plang
  convert 49 ⍝ 7×7
Plong
  convert 27 ⍝ 3*3
Pling
  convert 3125 ⍝ 5*5
Plang

test∆show_log log

Version data entries

130 entries across 130 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.179 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.178 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.177 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.176 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.175 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.174 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.173 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.172 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.171 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.170 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.169 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.167 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.166 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.165 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.164 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.163 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.162 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.161 tracks/gnu-apl/exercises/raindrops/raindrops.tc
trackler-2.2.1.160 tracks/gnu-apl/exercises/raindrops/raindrops.tc