Sha256: 70c46ad870fbf56e70ec629edeb93e5a3638855332c586c03415946704d02798

Contents?: true

Size: 639 Bytes

Versions: 396

Compression:

Stored size: 639 Bytes

Contents

(defpackage #:raindrops
  (:use #:common-lisp)
  (:export #:convert))

(in-package #:raindrops)

(defparameter *raindrops*
  '((3 . "Pling")
    (5 . "Plang")
    (7 . "Plong"))
  "Frequency modulus and impact sound of raindrops.")

(defun convert (integer &optional (raindrops *raindrops*))
  "String of integer or raindrop sound."
  (declare (type integer integer))
  (loop
     for (div . sound) of-type (integer . string) in raindrops
     when (zerop (mod integer div))
     collect sound into sounds
     finally
       (return
         (if sounds
             (format nil "~{~A~}" sounds)
             (write-to-string integer)))))

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.158 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.157 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.156 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.155 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.154 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.153 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.152 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.151 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.150 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.149 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.148 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.147 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.146 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.145 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.144 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.143 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.142 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.141 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.140 tracks/common-lisp/exercises/raindrops/example.lisp