Subversion Repositories programming

Rev

Rev 63 | Blame | Compare with Previous | Last modification | View Log | RSS feed

irasnyd@duallie lisp $ script hw01.script
Script started, file is hw01.script
irasnyd@duallie lisp $ cat hw01.lisp
;Written By: Ira Snyder
;Date:       01-13-2005
;Project #:  Hw 01

;define the QUAD1 funtion which returns the "positive" root
;
;in infix, this is
;-b +- sqrt( -b^2 - 4*a*c )

(defun QUAD1 (A B C) 
  (/ 
    (+ (- B) (sqrt (- (* B B) (* 4 A C)))) 
    (* 2 A)
  ) 
)

;(QUAD1 1 2 1)          ;commented since I will run this during a script session
;(QUAD1 1 -2 1)         ;commented since I will run this during a script session
;(QUAD1 1 -2 -3)        ;commented since I will run this during a script session

irasnyd@duallie lisp $ clisp -q

[1]> (load 'hw01.lisp)
;; Loading file hw01.lisp ...
;; Loaded file hw01.lisp
T
[2]> (QUAD1 1 2 1)
-1
[3]> (QUAD1 1 -2 1)
1
[4]> (QUAD1 1 -2 -3)
3
[5]> (quit)
irasnyd@duallie lisp $ exit
Script done, file is hw01.script