On 20 Jan 2014, at 00:00 , Duncan Murdoch <murdoch.dun...@gmail.com> wrote:
>>> 
>>> Someone might want to fix this by implementing a full syntax for complex 
>>> constants, but meanwhile, I think a passable workaround could be
>> 
>> That might be nice to do.  Not sure if it's easy or hard...
> 
> I think it's hard.  After seeing the 1, when the parser gets a "+", it's not 
> clear whether you're in the middle of a complex number or some other kind of 
> sum.  And since users can redefine "+", it could be a really different kind, 
> even if it's followed by 2i.

Yes. That's what I suspected; you may need to actually change the syntax. 

I was thinking something like a=1C+2i, or even more radically a=_Const_(1+2i) 
with the idea of evaluating the contents of _Const_() at parse time or maybe 
rather function definition time.  

The latter idea might solve some other issues where R structures can't be 
defined as constants (pretty much any nonscalar vector, for instance), and the 
associated issues with non-reversibility of deparse().

But as you say, it's likely to be hard.

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to