Subj : Re: Reversing a number To : comp.programming From : Antoon Pardon Date : Fri Sep 16 2005 08:05 am Op 2005-09-15, Willem schreef : > Antoon wrote: > ) Op 2005-09-15, Willem schreef : > )> I disagree. The problem only states what the end-result should be and > )> does NOT specify how it should be done. > ) > ) The statement of the end result implies that is about numerals, > ) strings representations of numbers, and not about numbers itself. > > So what ? That doesn't mean you're suddenly allowed to interpret > the problem as if it species how it should be solved. > > )> It is simpler in the very real sense that no strings are involved. > )> ('strings' as defined by the programming language.) > )> The only thing that is involved is digits, and base-10 representation. > ) > ) base-10 representation says it all, this is about the representations > ) in a particular base. It is not about the numbers themselves. > > So what ? > Lemme ask you a question: Suppose I have an algorithm that solves the > following problem: > > Return (as a number) the base-10 digits of the input number, repeated > twice. (That is: f(123) = 123123, f(15) = 1515, f(100200) = 100200100200) > > Would you claim that that algorithm involves strings ? Of course, because this is essentially a string problem. You turn a string into the string concatenated with itself. You have just limited the problem space to specific strings and use numbers to represent those strings. Whatever arithmetic or functions you use on the numbers will only make sence if you consider how the numerals will be affected. The effect on the number itself is of little concern. > )> The algorithm described (it's not my algorithm by the way) extracts > )> base-10 digits from one number and injects it into another, one by one. > )> That's all it does. No strings. > ) > ) Extracting base-10 digits is conceptually working with strings. > ) That you keep the digits as a number because that works easier > ) changes nothing about that. Digits is what numerals in particular > ) notations have. Numbers don't have digits. > ) > ) Yes your algorithm works with numbers, but when you explain what > ) it does you are constantly reffering to numeral concepts and > ) not to number concepts, thus betraying that conceptually you > ) are working with strings. > > That I'm using the numeral concept 'digit' does not mean that > I necessarily have to also use the numeral concept 'string'. A numeral is a string. The fact that you working with numerals implies that you are working with strings. > Furthermore, even if I had to use strings to explain *why* the > algorithm works, that *still* would not mean that the algorithm > *uses* strings. Just because you algorithm codes your strings as numbers, doesn't mean it doesn't use strings. I have some code that encodes small sets of cardinal numbers as numbers itself with bit-operators. Are you claiming that whenever I use this code to work with small-sets I am not using sets, but cardinals, because that is how they are coded? > By the way, what part of 'it's not my algorithm' did you not understand ? Yes it is. You are the one that represented it here, and that is enough to use "your algoritm" to refer to it in this context. Possesive nouns are used more generally then for ownership or being the originator. -- Antoon Pardon .