Neat! Was disappointed it couldn't handle the decimals in the square root of 2.0 though.
Reminds me of SICP lectures online, from MIT (Abelson and Sussman, 1986). Early on there is a square root program using LISP and recursion. http://www.youtube.com/playlist?list=PLE18841CABEA24090
Using Clojure, I wrote the following based on their LISP listing.
(defn sqrt [v]
(defn avg [v1 v2] ( / ( + v1 v2 ) 2 ) )
(defn sq [v] ( * v v ) )
(defn abs [v] ( if ( < v 0 ) ( * -1 v) v ) )
(defn good-enough? [v1 v2] ( < ( abs ( - v1 v2) ) 0.00001 ) )
(defn improve-guess [v1 v2] ( avg v1 ( / v2 v1 ) ) )
(defn try-guess [v1 v2]
(good-enough? (sq v1) v2)
(try-guess (improve-guess v1 v2) v2))
(try-guess 1 v)
I'm five videos in so far. It's a very interesting set of lectures. I suppose I could have written their examples in Java, but it seems like a good opportunity to get acquainted with a LISP-based language, and Clojure purports to have a lot to offer in terms of gaining functional programming chops.