;;Realis of complex number z (def rez (z) (with (lz (tocons z) i 0 j 0) (until (and (isnt (lz j) #\e) (or (is (lz i) #\+) (is (lz i) #\-))) (if (is i 0) (++ i) (do (++ i) (++ j)))) (toint (firstn i lz)))) ;;Imaginaris of complex number z (def imz (z) (with (lz (tocons z) i 0 j 0) (until (and (isnt (lz j) #\e) (or (is (lz i) #\+) (is (lz i) #\-))) (if (is i 0) (++ i) (do (++ i) (++ j)))) (toint (if (pos #\i lz) (rem #\i (nthcdr i lz)) 0))))
;;Complex conjugate of number z. (def zbar (z) (toint (join (tocons (rez z)) (if (> (imz z) 0) '(#\-) '(#\+)) (tocons (abs (imz z))) '(#\i))))