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.180 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.179 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.178 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.177 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.176 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.175 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.174 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.173 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.172 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.171 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.170 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.169 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.167 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.166 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.165 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.164 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.163 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.162 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.161 tracks/common-lisp/exercises/raindrops/example.lisp
trackler-2.2.1.160 tracks/common-lisp/exercises/raindrops/example.lisp