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.0.0.5 tracks/lisp/exercises/raindrops/example.lisp
trackler-2.0.0.4 tracks/lisp/exercises/raindrops/example.lisp
trackler-2.0.0.3 tracks/lisp/exercises/raindrops/example.lisp
trackler-2.0.0.2 tracks/lisp/exercises/raindrops/example.lisp
trackler-2.0.0.1 tracks/lisp/exercises/raindrops/example.lisp
trackler-2.0.0.0 tracks/lisp/exercises/raindrops/example.lisp
trackler-1.0.4.1 tracks/lisp/exercises/raindrops/example.lisp
trackler-1.0.4.0 tracks/lisp/exercises/raindrops/example.lisp
trackler-1.0.3.0 tracks/lisp/exercises/raindrops/example.lisp
trackler-1.0.2.1 tracks/lisp/exercises/raindrops/example.lisp
trackler-1.0.2.0 tracks/lisp/exercises/raindrops/example.lisp
trackler-1.0.1.2 tracks/lisp/exercises/raindrops/example.lisp
trackler-1.0.1.1 tracks/lisp/exercises/raindrops/example.lisp
trackler-1.0.1.0 tracks/lisp/exercises/raindrops/example.lisp
trackler-1.0.0.1 tracks/lisp/exercises/raindrops/example.lisp
trackler-1.0.0 tracks/lisp/exercises/raindrops/example.lisp