Re: Help Please with numbers

new topic     » goto parent     » topic index » view thread      » older message » newer message

cklester wrote:
> 
> Pete Lomax wrote:
> > 
> > On Mon, 01 Aug 2005 11:33:31 -0700, cklester <guest at RapidEuphoria.com>
> > wrote:
> > 
> > >This is an argument for ESL's sum() function being able to handle all
> > >types...
> > 
> > Holes in this example aside, there is a clear difference between
> > expectation of sum({49,50,51}) and sum("123").
> 
> Good catch. ;)
> 
> -=ck
> "Programming in a state of EUPHORIA."
> <a
> href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a>
> 

I had thought about this case. I think that the programmer would just have to be
clear in what he or she wants.  sum(1) makes as much sense as sum("123").

sum("123", 0) should work correctly. sum("123") would produce 150 because it is
ambiguous.

I still wonder whether it would be a useful feature. How often is implicit
conversion from string to number needed?

=====================================
Too many freaks, not enough circuses.

j.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu