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

My first scheme program

Name: Anonymous 2012-01-17 16:31

Wrote this while bored and waiting for my functional programming class... is it... okay?


(define quad
  (lambda (a b c)
    (define root (- (* b b) (* 4 a c)))
    (if (> root 0)
      (list
        (/ (+ (- b) (sqrt root)) (* 2 a))
        (/ (- (- b) (sqrt root)) (* 2 a)))
      '()
    )))

Name: Anonymous 2012-01-17 17:09

>>4
$ scheme48
Welcome to Scheme 48 1.8 (made by yellow on Sun Sep 18 01:57:41 UTC 2011)
Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees.
Please report bugs to scheme-48-bugs@s48.org.
Get more information at http://www.s48.org/.
Type ,? (comma question-mark) for help.
(sqrt -1)
0.0+1.0i

Exit Scheme 48 (y/n)? y
$ racket
Welcome to Racket v5.1.1.
(sqrt -1)
0+1i

$

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