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

Continued Fractions

Name: Anonymous 2007-09-03 14:57 ID:Yg9/l8CK

(defun continued-fraction (real)
  (multiple-value-bind (integer-part fractional-part)
      (floor (rationalize real))
    (cons integer-part (if (zerop fractional-part)
               nil
               (continued-fraction (/ 1 fractional-part))))))

What does /prog/ think? Am I shooting myself in the foot by just throwing rationalize in there and hoping it works out?

Name: Anonymous 2007-09-03 16:10 ID:1WCt9T06

1)

(defun foo (a b c &aux (sum (+ a b c)))
 ...)


is like

(defun foo (a b c)
 (let* ((sum (+ a b c)))
  ...))


most lispers consider it bad style

2)
ensure is a CL naming convention, without years of experience (with other CL libraries) you wouldn't understand it.

3)
zerop is fail, sorry but it fucking is
where is my
ONEP TWOP THREEP etc?

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