1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.structs alien.c-types math math.functions sequences
4 arrays kernel functors vocabs.parser namespaces accessors
6 IN: alien.complex.functor
8 FUNCTOR: define-complex-type ( N T -- )
10 T-real DEFINES ${T}-real
11 T-imaginary DEFINES ${T}-imaginary
12 set-T-real DEFINES set-${T}-real
13 set-T-imaginary DEFINES set-${T}-imaginary
21 >rect T <c-object> [ set-T-imaginary ] [ set-T-real ] [ ] tri ; inline
24 [ T-real ] [ T-imaginary ] bi rect> ; inline
27 { { N "real" } { N "imaginary" } }
31 <T> 1quotation >>boxer-quot
32 *T 1quotation >>unboxer-quot