|
| |||
|
|
How mathematics can help learn Haskell There are lots of people who understand moderately advanced to very advanced mathematics and who may want to learn how to write code. These people include mathematicians, physicists, engineers, and others. I will call them "math-savvy". When math-savvy people look at almost any programming languages in use today, they are appalled by the lack of logical elegance in these languages, and hence they think programming is unpleasant. There is now a practically useful programming language, Haskell, based upon the principle that programs should be as similar as possible to mathematical expressions. There are several important similarities between Haskell and mathematics. For example, values in Haskell are immutable and locally scoped, just like symbols such as x or f in a mathematical text: these symbols are defined once and then used throughout a certain part of the text (but not outside that part). If a value is defined but not used for any calculation, that value will be forgotten and never computed. The basic elements of a Haskell program are functions that are very similar to mathematical functions: a function takes an argument value and computes a result value. Functions are defined using formulas and/or inductive reasoning, similarly to how mathematical texts define functions. Each function in a mathematical text admits only a certain type of argument (e.g. real number, a group element, etc.) and computes the same type of value; same in Haskell. I think that math-savvy people will find it quite easy and even interesting to learn Haskell. Once one learns some Haskell, it becomes much easier to learn most other programming languages. Techniques of "functional programming", i.e., similar to the basic idioms of Haskell, have become standard in many programming languages. So learning Haskell should be a good entry point into modern programming. Ideally, there should be a tutorial on Haskell oriented towards maths-savvy people. When I first learned about Haskell, I couldn't find it. Does such a tutorial exist now? If not, what would be a good way of writing it - what specific programming tasks should be chosen as running examples, what kind of exercises, what subset of language to present first? Should the tutorial talk about implementing number theory algorithms, numerical solutions of equations, optimization problems, symbolic algebra? PS There exists one book on using Haskell for machine learning and data analysis. Might be a good start; haven't looked at it yet. |
||||||||||||||