how to get the ordinal number in list

Steven D'Aprano steve at pearwood.info
Mon Aug 11 06:28:59 EDT 2014


On Sun, 10 Aug 2014 21:29:12 -0700, Rustom Mody wrote:

> On Monday, August 11, 2014 8:30:32 AM UTC+5:30, Steven D'Aprano wrote:
> 
>> You did the same thing in your own course, the only difference being
>> you accepted a different set of primitive functions. But ultimately you
>> have to introduce *some* amount of concreteness, at some level,
>> otherwise we're just engaged in mental masturbation:
> 
>> Q: "Write a function to calculate the nth Catalan number." A: "Assume
>> that a function Catalan(n) exists and calculates the nth Catalan
>> number. Then the solution is Catalan."
> 
> 
> You're concocting your own definitions and critiquing/refuting them.

No, but I think you are deliberately choosing to ignore my point for the 
sake of cheap shots. My point is that, at *some* level, you have to 
actually write code (well duh!) which must be targeted at some concrete 
environment. Different languages provide different levels of abstraction, 
but they all have a some concrete set of primitive operations which 
actually do *something*, and that something is concrete, not abstract. 
Every function, even in Haskell, has an implementation. Otherwise if you 
don't need an implementation, you can just declare "imagine a function 
that implements Foo" for any Foo, and you're done.[1]

Computer science, if might be said, is the search for better and more 
productive abstractions which provide more useful implementations for 
concrete tasks.



[1] A perfectly reasonable approach, sometimes, for some philosophical 
questions, including sometimes philosophical questions within the scope 
of computer science. E.g. if we had a supertask, or an oracle-machine, 
what class of problems could we solve?



-- 
Steven



More information about the Python-list mailing list