Re:"On iteration": Why people leave Python
by jrockway on Thursday February 04, 2010 @10:25PM
(#1102592)
The paper you posted is a good example. The conclusion is:
sudoku = map (map head) . search . prune . choice
Note how the "code" never mentions the data to which it is applied, namely the Board object. This is why I can't agree with the GP's argument that FP is closer to "code" than anything else -- I think it's as far from "code" as you can get. There are no "instructions" here, just an equation representing something complex ("the solution to sudoku"), in terms of slightly simpler parts. The simpler parts are, earlier in the paper, the complex parts; and are of course described there by simpler parts.And, this is not just something that's useful for esoteric mathematics papers; my "enterprise" code in Haskell looks very similar.
Re:"On iteration": Why people leave Python
by jchonphoenix on Friday February 05, 2010 @12:53AM
(#1102827)
"Functional Programming is more like mathematics." I would completely agree. In fact, I would add to that and say FP is mathematics because its "Functionally" based and was originally created for easy inductive proofs.
However, from a readability standpoint, english is better than mathematics, and readability counts for quite a bit if you aren't planning on throwing away your code.
Re:"On iteration": Why people leave Python
by plinkplonk on Friday February 05, 2010 @12:56AM
(#1102834)
"However, from a readability standpoint, english is better than mathematics"
That depends on what you are reading. Try reading differential calculus in English, without using notation.
Not to take anything away from your point (and I think it is a good one), but there are all kinds of code. Functional Programs can be astonishingly elegant.
Having written non-trivial programs in Haskell, ML, and Python, I agree with this, but I would add: Functional programming is more like mathematics.
English expresses some ideas more clearly, while mathematics is better for others. And notations that are more "mathematical" often have other nice properties like composability and equational reasoning.*
*The best example of what I mean by equational reasoning is the Sudoku functional pearl: http://www.cs.tufts.edu/~nr/comp150fp/archive/richard-bird/s...