Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Fibonacci Butt Sort

Name: Anonymous 2009-08-16 23:08

Let us discuss the various implementations of theFIBONACCI BUTT SORT.

Name: Anonymous 2012-02-09 4:42


(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)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List