Let us discuss the various implementations of the
.
(defun fibp (n) (let* ((phi (/ (1+ (sqrt 5)) 2)) (idx (floor (+ 1/2 (log (* n (sqrt 5)) phi)))) (u (floor (+ 1/2 (/ (expt phi idx) (sqrt 5)))))) (= u n))) (defun bs (str &key (test #'oddp)) (format t "[b]") (loop for c across str for i from 1 do (let ((tag (if (funcall test i) #\o #\u))) (format t "[~c]~c[/~c]" tag c tag))) (format t "[/b]")) (bs "fibonacci butt sort" :test #'fibp)