Re: Help Please with numbers
- Posted by cklester <cklester at yahoo.com> Aug 02, 2005
- 613 views
Jason Gade wrote: > > 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? You could just provide the base functionality of summing only integers/atoms in a sequence, and if the user wanted more they could wrap it themselves. sumi() -- sum a list of integers suma() -- sum a list of atoms sum() -- sum a list of atoms and/or integers -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/