I’ve got a few books which aim to teach (discrete) mathematics through the use of a programming language: one book uses Haskell; the other Python. Now I like both these languages – I find them elegant, fun to program in (at my elementary level, anyway), and as languages for teaching programming I think they both have a great deal to offer.
But are they the right environment for teaching mathematics? I actually think not. The trouble is that unless you start adding lots of specialist libraries to the system you are reduced to mainly dealing with numbers, lists, and arrays. Now there’s certainly an awful lot you can do here, but is it enough? The trouble is that if you want to include some symbolic manipulation, then you need to add another hefty library. If you’re working in Python, there’s sympy, which is a library for symbolic mathematics which “aims to become a full-featured computer algebra system”. For Haskell there’s DoCon, an ” Algebraic Domain Constructor” which claims to be a “a program for symbolic computation in mathematics”.
Now, I haven’t tested either of these, and I don’t intend to. But I’ll bet that neither of them are as full featured or as easy to use as the freeware computer algebra systems Maxima or Axiom. The only advantage of using sympy/DoCon is that further work in them can be done in that language (Python for sympy, Haskell for DoCon).
For my part, unless the students are so entrenched in using Python/Haskell that everything must be done in that language, it seems to me that from a purely pedagogical perspective you’re much better off using a CAS from the word go. Students’ mathematical knowledge, expertise and confidence can grow with your CAS of choice. And the range of mathematics of which a good CAS is capable is huge.