Article View: comp.lang.python
Article #26Re: Python in "math through programming" curriculum
From: Neelakantan Krishnaswami
Date: Thu, 21 Dec 2000 00:33
Date: Thu, 21 Dec 2000 00:33
84 lines
5244 bytes
5244 bytes
On Wed, 20 Dec 2000 13:52:53 +0100, Alex Martelli <aleaxit@yahoo.com> wrote: >"Neelakantan Krishnaswami" <neelk@alum.mit.edu> wrote in message >news:slrn9402bt.fa6.neelk@alum.mit.edu... > [snip] >> I disagree with you here about Python's appropriateness. Conceptually, >> the strongly typed FPLs are the best languages there are for learning >> about the mathematics of computer programming. The combination of > > I wouldn't consider anything but Haskell if I were to teach "the > mathematics of computer programming" (that may be because my > exposure to Clean is too limited) stricto sensu [...]. > > But "math through programming" is a completely different issue, > at least as the original poster meant it (as he explained in a > followup to this post of yours) and as I took it -- middle and > high school levels, as he had said! Yes -- the reference to Knuth's _Concrete Mathematics_ made me think that an introduction to CS was envisioned. For things like graphing and statistics, there's no reason not to use Python, since it has good graphing and statistical libraries. Static typechecking doesn't help here, I don't think, and in Haskell's case it becomes a positive nuisance (because of all the IO). > I would *NOT* introduce Haskell in middle school, and even for high > school, I have my doubts -- students would have to have strong > *previous* exposure to mathematical concepts, AND to computer > programming; few high schools, I suspect, are good enough for that. I do think a typed FPL would work at the high school level, once the kids have gotten exposed to algebra (for the idea of functions) and geometry (for the idea of proofs). Then Haskell could be used as a way of teaching them how to write proofs. It has the two great advantage that proofs are programs, and hence executable and testable, and that it has type-checking to help catch errors in them. Call it experimental constructive mathematics. :) You would definitely want to improve the quality of the error messages these implementation emit though. An adult programmer would find them feasible to work through, but something like ERROR: Type error in application *** Expression : foldr (*) 1 take n (enumFrom 1) *** Term : take *** Type : Int -> [b] -> [b] *** Does not match : [a] will not help a ninth-grader figure out she needs to add some parens and write "foldr (*) 1 (take n (enumFrom 1))" to compute the factorial. And this is a very good error message, compared with most! >> > Caml, IMHO, has rather cluttered syntax when compared to Haskell (or >> > Python!); it only gets worse when the Object-oriented extensions are >> > also considered. Admittedly, a minor consideration, but, _for the >> > specific issue of programming-newbies_, not a negligible one IMHO. >> >> This is the *big* weakness of the ML-family languages (including >> Haskell and Clean): they all have gnarly syntaxes. Python is proof > > Haskell's syntax is *lovely*! How can you class it in "the ML > family"? [Again, I don't know enough Clean to have a real opinion > about it]. > >What specific objections do you have to Haskell syntax...? Honestly, Haskell looks very similar to ML and OCaml to my eyes. An ML program translated to Haskell will read very similarly[*]. Some of the peculiarities of Haskell's syntax that I find annoying are the use of case to distinguish the type and value namespaces, the use of '\' to introduce lambdas (I find this ugly and twee), and the $ syntax to force strict evaluation. However, these are all fundamentally nuisances, rather than mortal wounds. However, a really huge lose is the do-notation, which is fantastically ugly. I *love* the way that monads let me type effects in the language, but I hate the way I have to type effects in the editor. :) IO is important enough that it shouldn't be painful to use. [*] The usual caveats about tail recursion and lazy languages apply; I'm assuming them away for the purposes of example. Neel
Technical Details
Message-ID:
<slrn942nln.mjs.neelk@alum.mit.edu>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!sunqbc.risq.qc.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!feed2.news.rcn.net!feed1.news.rcn.net!rcn!neelkReferences:
<2g2t3t06r2agrrjmfnr41eu4lc2u39a8qi@4ax.com> <3A3EFF47.67DE69CF@gte.net> <91n9i30pr7@news2.newsguy.com> <slrn9402bt.fa6.neelk@alum.mit.edu> <91qa3r01m78@news2.newsguy.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1025ed,6a046a4159e3af32 X-Google-Attributes: gid1025ed,public X-Google-Thread: f4b63,6a046a4159e3af32 X-Google-Attributes: gidf4b63,public X-Google-Thread: 10dd18,6a046a4159e3af32 X-Google-Attributes: gid10dd18,public X-Google-ArrivalTime: 2000-12-20 16:35:51 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!sunqbc.risq.qc.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!feed2.news.rcn.net!feed1.news.rcn.net!rcn!neelk From: neelk@alum.mit.edu (Neelakantan Krishnaswami) Newsgroups: comp.lang.python,sci.crypto,bit.listserv.geodesic Subject: Re: Python in "math through programming" curriculum Date: 21 Dec 2000 00:33:12 GMT Lines: 85 Message-ID: <slrn942nln.mjs.neelk@alum.mit.edu> References: <2g2t3t06r2agrrjmfnr41eu4lc2u39a8qi@4ax.com> <3A3EFF47.67DE69CF@gte.net> <91n9i30pr7@news2.newsguy.com> <slrn9402bt.fa6.neelk@alum.mit.edu> <91qa3r01m78@news2.newsguy.com> Reply-To: neelk@alum.mit.edu X-Trace: UmFuZG9tSVbHxRqAZKbDEpgttoM3uyU+Jal0VQLrRAmEiuZa5TDKZqEISUn1FigF X-Complaints-To: abuse@rcn.com NNTP-Posting-Date: 21 Dec 2000 00:33:12 GMT User-Agent: slrn/0.9.5.7 (UNIX)