egallesio / STklos

STklos Scheme
http://stklos.net
GNU General Public License v2.0
68 stars 17 forks source link

The STklos reader does not understand `+inf.0+1i` and `-inf.0+1i` #564

Closed jpellegrini closed 11 months ago

jpellegrini commented 12 months ago

Hi @egallesio ! Found a tiny issue:

+inf.0+1i
%execute: symbol `+inf.0+1i' unbound in module `stklos'

-inf.0+1i
%execute: symbol `-inf.0+1i' unbound in module `stklos'
jpellegrini commented 12 months ago

The same happens with 1-inf.0 and 1+inf.0. I'm really busy this week, but I think I can prepare a patch next weekend. I suppose the change would be in STk_Cstr2number, in number.c.

jpellegrini commented 12 months ago

I suppose the change would be in STk_Cstr2number, in number.c.

My idea would be to split STk_Cstr2number in two functions: one that reads a non-complex number, and another, which actually reads a number. This second function would check if the next character is + or - and read again, then building a complex number. This would also make that function smaller.

egallesio commented 11 months ago

Hi @jpellegrini, This one was already on my TODO list. I have not started to tackle it, because I suspect it is not so simple to fix it.

My idea would be to split STk_Cstr2number in two functions: one that reads a non-complex number, and another, which actually reads a number. This second function would check if the next character is + or - and read again, then building a complex number. This would also make that function smaller.

Yes, you are right. This is probably what should be done.