Flat-schmat! [was Re: Python syntax in Lisp and Scheme]

Mark Wilson mwilson13 at cox.net
Sun Oct 5 22:23:47 EDT 2003


On Sunday, October 5, 2003, at 09:07 PM, Kenny Tilton wrote:

> [snip]
> (defun quadratic (a b c)
>   (let ((rad (sqrt (- (* b b)
>                       (* 4 a c)))) ;; much nicer than 4*a*c
>         (den (+ a a)))
>      (list (/ (+ (- b) rad) den)
>            (/ (- (- b) rad) den)))))
>
> (Not tested, and without my Lisp editor, parens likely off.)
>
> [snip]

Tested code in Scheme:

(define quadratic
   (lambda (a b c)
   (let ((rad (sqrt (- (* b b)
                       (* 4 a c)))) ;; much nicer than 4*a*c
         (den (+ a a)))
      (list (/ (+ (- b) rad) den)
            (/ (- (- b) rad) den)))))

Regards,

Mark Wilson






More information about the Python-list mailing list