Functional programming in Python

Kellomaki Pertti pk@cs.tut.fi
Tue, 22 May 2001 17:10:40 +0300


"Manuel M. T. Chakravarty" wrote:
> In languages that don't use curring, you would write
>   f (1, 2) + g (2, 3)
> which also gives application precedence over infix
> operators.  So, I think, we can safely say that application
> being stronger than infix operators is the standard
> situation.

Agreed, though you must remember that where I come from there is no
precedence at all.

> And as far
> as layout is concerned, I think, the Python people have made
> the same experience.  For humans, it is quite natural to use
> visual cues (like layout) to indicate semantics.

Two points: I have been with Haskell less than half a year, and already
I have run into a layout-related bug in a tool that produces Haskell
source.
This does not raise my confidence on the approach very much.
Second, to a Lisp-head like myself something like

    (let ((a 0)
          (b 1))
       (+ a b))

does exactly what you say: it uses layout to indicate semantic. The
parentheses
are there only to indicate semantics to the machine, and to make it easy
for
tools to pretty print the expression in such a way that the layout
reflects
the semantics as seen by the machine.

But all this is not very constructive, because Haskell is not going to
change
into a fully parenthesized prefix syntax at my wish.
-- 
Pertti Kellom\"aki, Tampere Univ. of Technology, Software Systems Lab