[SOLVED] DSRN (dog slow roman numerals)
|
06-15-2014, 11:49 AM
Post: #32
|
|||
|
|||
RE: DSRN (dog slow roman numerals)
(06-15-2014 04:30 AM)Thomas Klemm Wrote: Look at it as: \<< + \>> STREAM The real question to ask is "Why should I look at it that way?" I look at it from its meaning and what a user/developer might use it for. It tripped David, and forced him to adapt his code to the limitations of the function. That shouldn't happen with a good API unless there's a good reason for it. Back in the day of userRPL, there probably was a good reason, as they needed to implement it in the simplest/fastest way, but in 2014 I can't find any good reason. (06-15-2014 04:30 AM)Thomas Klemm Wrote: Or then the sum of an empty list is 0 as in Lisp. Yes, I thought about that too, and I'm still open to change it, but then I thought that the elements of the list may not be numbers, but for example strings. The sum of a list of strings is a string, so the empty list should give an empty string, not a number. Same thing for a list of vectors: shouldn't it be a zero vector? In the end I thought that it was more appropriate to say that the sum of an empty list is undefined because we don't know the object type of the answer, so an error is appropriate after all. On the other hand, if you have one element, the result is that element and it's a clear and fully defined answer. For the product is the same: should I return the number one? or an identity matrix? Claudio |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)