aboutsummaryrefslogtreecommitdiff
path: root/src/clojure/contrib/generic/math_functions.clj
diff options
context:
space:
mode:
authorKonrad Hinsen <konrad.hinsen@laposte.net>2009-05-05 07:31:27 +0000
committerKonrad Hinsen <konrad.hinsen@laposte.net>2009-05-05 07:31:27 +0000
commit1dd60bdd968cd19dc04b4cb4fdcc0b6032833543 (patch)
tree474bf2120125b3a43c6565bbf62acba33fa62f24 /src/clojure/contrib/generic/math_functions.clj
parentb43a05fcb900624b6861043204c931b8d7781f60 (diff)
generic: documentation update
Diffstat (limited to 'src/clojure/contrib/generic/math_functions.clj')
-rw-r--r--src/clojure/contrib/generic/math_functions.clj30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/clojure/contrib/generic/math_functions.clj b/src/clojure/contrib/generic/math_functions.clj
index 3eebe938..a0fb3609 100644
--- a/src/clojure/contrib/generic/math_functions.clj
+++ b/src/clojure/contrib/generic/math_functions.clj
@@ -1,7 +1,7 @@
;; Generic interfaces for mathematical functions
;; by Konrad Hinsen
-;; last updated May 3, 2009
+;; last updated May 5, 2009
;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use
;; and distribution terms for this software are covered by the Eclipse
@@ -26,7 +26,10 @@
[name]
(let [java-symbol (symbol "java.lang.Math" (str name))]
`(do
- (defmulti ~name type)
+ (defmulti ~name
+ ~(str "Return the " name " of x.")
+ {:arglists '([~'x])}
+ type)
(defmethod ~name java.lang.Number
[~'x]
(~java-symbol ~'x)))))
@@ -37,7 +40,10 @@
[name]
(let [java-symbol (symbol "java.lang.Math" (str name))]
`(do
- (defmulti ~name two-types)
+ (defmulti ~name
+ ~(str "Return the " name " of x and y.")
+ {:arglists '([~'x ~'y])}
+ two-types)
(defmethod ~name [java.lang.Number java.lang.Number]
[~'x ~'y]
(~java-symbol ~'x ~'y)))))
@@ -64,7 +70,11 @@
;
; Sign
;
-(defmulti sgn type)
+(defmulti sgn
+ "Return the sign of x (-1, 0, or 1)."
+ {:arglists '([x])}
+ type)
+
(defmethod sgn :default
[x]
(cond (gc/zero? x) 0
@@ -74,7 +84,10 @@
;
; Conjugation
;
-(defmulti conjugate type)
+(defmulti conjugate
+ "Return the conjugate of x."
+ {:arglists '([x])}
+ type)
(defmethod conjugate :default
[x] x)
@@ -82,7 +95,10 @@
;
; Square
;
-(defmulti sqr type)
+(defmulti sqr
+ "Return the square of x."
+ {:arglists '([x])}
+ type)
(defmethod sqr :default
[x]
@@ -93,6 +109,6 @@
;
(defn approx=
"Return true if the absolute value of the difference between x and y
- is less than eps"
+ is less than eps."
[x y eps]
(gc/< (abs (ga/- x y)) eps))