1 USING: accessors kernel math math.functions
2 sequences sequences.private ;
5 TUPLE: complex-sequence seq ;
6 INSTANCE: complex-sequence sequence
8 : <complex-sequence> ( sequence -- complex-sequence )
9 complex-sequence boa ; inline
13 : complex@ ( n seq -- n' seq' )
14 [ 1 shift ] [ seq>> ] bi* ; inline
18 M: complex-sequence length
19 seq>> length -1 shift ;
20 M: complex-sequence nth-unsafe
21 complex@ [ nth-unsafe ] [ [ 1+ ] dip nth-unsafe ] 2bi rect> ;
22 M: complex-sequence set-nth-unsafe
24 [ [ real-part ] [ ] [ ] tri* set-nth-unsafe ]
25 [ [ imaginary-part ] [ 1+ ] [ ] tri* set-nth-unsafe ] 3bi ;