@fosskers
Ugh, it's 10x slower than this loop facility one.
(defun loopfizz-of (no)
(let ((res (loop :repeat (1+ no)
:for x :from 0 :by 1 :for y := '0 :then y :for z := '0 :then z
:when (eql x y) :do (incf y 3)
:When (eql x z) :do (incf z 5)
:finally (return (list x (decf y 3) (decf z 5))))))
(cond ((and (= (car res) (cadr res)) (= (car res) (caddr res))) '(fizz buzz))
((= (car res) (cadr res)) '(fizz)) ((= (car res) (caddr res)) '(buzz))
(:otherwise (butlast res 2)))))
Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
screwlisp (screwtape@mastodon.sdf.org)'s status on Sunday, 17-Nov-2024 11:51:03 JST screwlisp