Re: Help Please with numbers
- Posted by cklester <cklester at yahoo.com> Aug 01, 2005
- 605 views
Jason Gade wrote: > Jason Gade wrote: > > cklester wrote: > > > > > > r1 = "123" > > > r2 = 456 > > > total = sum({r1,r2}) -- can work since element 1 is a sequence, use > > > value() > > > > > So I'm trying to think of a reason why this would be a bad idea, and I can't > do it. > The only valid reason I could come up with is that no other Euphoria routine > acts this > way (that I know of). That isn't really a valid argument though. All it is is shorthand for the programmer doing the value()s himself. You could also make type-specific sums like sum_i(list_of_integers) sum_a(list_of_atoms) -- or sumi() and suma() depending on naming convention These would simply be faster (no sequence check or value() conversion) and used when the programmer has no string numbers. -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/