[Discuss] Functional programming @ UVic (was 'C' string tokenizer
for those who hate strtok)
Brian Quinlan
brian at sweetapp.com
Mon Jul 3 12:08:22 PDT 2006
Adam Parkin wrote:
> But is that necessarily a good thing? There's something to be said for
> having to really understand a piece of pseudocode so that you can
> implement it in an actual language, and if the mapping from pseudocode
> to actual code is essentially 1 to 1, then perhaps then the process
> becomes more mechanical than actual understanding. That happened to me
> in the numerical analysis course @ UVic (CSC 340) as the assignments
> were all just taking the psuedocode from the book and rewriting it in
> Matlab which was often trivial and didn't require any real understanding
> of what was going on.
It seems like those assignments were stupidly designed. I think that a
well designed computer course (e.g. for algorithms and data structures)
could have you complete all of your assignments just using pseudocode.
Of course it's nice to test, so we have Python :-)
> But of course, just because students enjoyed it doesn't mean it's the
> best choice. I hated learning ML, but now when I look back on it, it
> was one of the most beneficial learning experiences I had in my
> undgraduate studies.
I agree with this sentiment.
> Yeah I know that braces are optional,
No, they are not allowed.
> as are statement terminators,
OK, you could terminate your statements with semi-colons, but that would
just be wrong.
> No objects involved (other than the argument to len), so now there's a
> confusion that arises: why is len a function, and pop a method? It just
> seems to me that you can't write anything useful in Python without using
> methods from one of the predefined classes, and that's why it feels very
> OO to me.
Yep. Python is an OO language, so it has an OO feel :-) You could use it
functionally, if you really wanted:
a = []
a += [5] # instead of a.append(5)
a = x[:-1] # instead of pop
a = x[1:] # (cont'd)
Cheers,
Brian
More information about the Discuss
mailing list