auto doc generation

This commit is contained in:
Felix Brendel
2019-06-11 01:17:36 +02:00
parent d01269aa13
commit 6f5ecc87b0
22 changed files with 2375 additions and 229 deletions
+41 -38
View File
@@ -2,56 +2,59 @@
(define-package math
(define pi 3.14159265)
(define pi
"Tha famous circle constant."
3.14159265)
(define (abs x)
"Accepts one argument and returns the absoulte value of it"
(if (> x 0) x (- x)))
(define (sqrt x)
"Accepts one argument and returns the square root of it"
(** x 0.5))
;; (define-class vector3 (x y z)
;; (define (get-x) x)
;; (define (get-y) y)
;; (define (get-z) z)
(define-class (vector3 x y z)
(define (set-x new-x) (mutate x new-x))
(define (set-y new-y) (mutate y new-y))
(define (set-z new-z) (mutate z new-z))
;; (define (set-x new-x) (mutate x new-x))
;; (define (set-y new-y) (mutate y new-y))
;; (define (set-z new-z) (mutate z new-z))
(define (length)
(** (+ (* x x) (* y y) (* z z)) 0.5))
;; (define (length)
;; (** (+ (* x x) (* y y) (* z z)) 0.5))
(define (scale fac)
(mutate x (* fac x))
(mutate y (* fac y))
(mutate z (* fac z))
fac)
;; (define (scale fac)
;; (mutate x (* fac x))
;; (mutate y (* fac y))
;; (mutate z (* fac z))
;; fac)
(define (add other)
(make-vector3
(+ (-> other x) x)
(+ (-> other y) y)
(+ (-> other z) z)))
;; (define (add other)
;; (make-vector3
;; (+ x (other get-x))
;; (+ y (other get-y))
;; (+ z (other get-z))))
(define (subtract other)
(make-vector3
(- (-> other x) x)
(- (-> other y) y)
(- (-> other z) z)))
;; (define (subtract other)
;; (make-vector3
;; (- x (other get-x))
;; (- y (other get-y))
;; (- z (other get-z))))
(define (equal? other)
(and (= (-> other x) x)
(= (-> other y) y)
(= (-> other z) z)))
;; (define (scalar-product other)
;; (+ (* x (other get-x))
;; (* y (other get-y))
;; (* z (other get-z))))
(define (scalar-product other)
(+ (* (-> other x) x)
(* (-> other y) y)
(* (-> other z) z)))
;; (define (cross-product other)
;; (make-vector3
;; (- (* y (other get-z)) (* z (other get-y)))
;; (- (* z (other get-x)) (* x (other get-z)))
;; (- (* x (other get-y)) (* y (other get-x)))))
(define (cross-product other)
(make-vector3
(- (* (-> other z) y) (* (-> other y) z))
(- (* (-> other x) z) (* (-> other z) x))
(- (* (-> other y) x) (* (-> other x) y))))
;; (define (print)
;; (printf :sep "" "[vector3] (" x y z ")"))
;; )
)
(define (print)
(printf :sep "" "[vector3] (" x " " y " " z ")"))))