-- a/haskell-vs-fortran++ b/haskell-vs-fortran
@@ -61,22 +61,22 @@
As i said before, fortran is imperative. This means that functions are pre-defined and special cases. Look at this non-working Fortran code:
bc. PROGRAM TRIAL
REAL A,B,C,V1
V2 = FUN
V1 = V2(A,B,C)
END
REAL FUNCTION FUN(X,Y,Z)
FUN = X*Y**Z
END
In haskell, you can treat functions just like values of any other type.
bc. f1 x = x + 1
f2 = (+1)
f3 = f1
main = do
print $ map ($ 3) [f1, f2, f3]
Line 1: Plain function definition
Line 2: Function is defined using partial application (+ requires two arguments, but given one, and it will take second argument when applied to some value)