Mercurial > hg > may
changeset 44:76eed6453a8a
Add sketchy beginnings of possible complex class
author | Chris Cannam |
---|---|
date | Mon, 24 Dec 2012 09:21:12 +0000 |
parents | 27c6525fa5db |
children | 1e7430a95926 |
files | complex.yeti |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/complex.yeti Mon Dec 24 09:21:12 2012 +0000 @@ -0,0 +1,22 @@ + +module complex; + +class Complex(float real, float imag) + int getReal() + real, + int getImag() + imag, + String toString() + "\(real) + \(imag)i", +end; + +typedef opaque cplx = ~Complex; + +complex re im is number -> number -> ~Complex = new Complex(re, im); + +{ + complex +} as { + complex is number -> number -> cplx +} +