! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel kernel.private math math.private
-math.functions arrays math.functions.private sequences parser ;
+math.functions arrays math.functions.private sequences
+sequences.private parser ;
IN: math.complex.private
M: real real-part ; inline
IN: syntax
-SYNTAX: C{ \ } [ first2 rect> ] parse-literal ;
+ERROR: malformed-complex obj ;
+
+: parse-complex ( seq -- complex )
+ dup length 2 = [ first2-unsafe rect> ] [ malformed-complex ] if ;
+
+SYNTAX: C{ \ } [ parse-complex ] parse-literal ;
USE: prettyprint.custom
M: complex pprint* pprint-object ;
M: complex pprint-delims drop \ C{ \ } ;
-M: complex >pprint-sequence >rect 2array ;
\ No newline at end of file
+M: complex >pprint-sequence >rect 2array ;