September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,23 +0,0 @@
(deftype Complex [real imag]
Object
(toString [this] (str real " " imag "j")))
(defn c-add [^Complex a ^Complex b]
(Complex. (+ (.real a) (.real b))
(+ (.imag a) (.imag b))))
(defn c-mul [^Complex a ^Complex b]
(Complex. (- (* (.real a) (.real b)) (* (.imag a) (.imag b)))
(+ (* (.real a) (.imag b)) (* (.imag a) (.real b)))))
(defn c-neg [^Complex a]
(Complex. (- (.real a)) (- (.imag a))))
(defn c-inv [^Complex a]
(let [r (.real a)
i (.imag a)
m (+ (* r r) (* i i))]
(Complex. (/ r m) (- (/ i m)))))
(defn c-conj [^Complex a]
(Complex. (.real a) (- (.imag a))))

View file

@ -1,17 +0,0 @@
(Complex. 1 1)
#<Complex 1 1j>
(c-add (Complex. 3.17 7) (Complex. 1 1.77))
#<Complex 4.17 8.77j>
(c-mul (Complex. 0 1) (Complex. 0 1))
#<Complex -1 0j>
(c-neg (Complex. 1 2))
#<Complex -1 -2j>
(c-inv (Complex. 1 1))
#<Complex 1/2 -1/2j>
(c-conj (Complex. 1 1))
#<Complex 1 -1j>