From ok@atlas.otago.ac.nz  Thu Nov 23 22:52:51 2000
Received: from atlas.otago.ac.nz (atlas.otago.ac.nz [139.80.32.250])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id WAA24926;
	Thu, 23 Nov 2000 22:52:50 +0100 (MET)
Received: (from ok@localhost)
	by atlas.otago.ac.nz (8.9.3/8.9.3) id KAA06735;
	Fri, 24 Nov 2000 10:52:45 +1300 (NZDT)
Date: Fri, 24 Nov 2000 10:52:45 +1300 (NZDT)
From: "Richard A. O'Keefe" <ok@atlas.otago.ac.nz>
Message-Id: <200011232152.KAA06735@atlas.otago.ac.nz>
To: jan@swi.psy.uva.nl, jcabrera@dis.ulpgc.es, ok@atlas.otago.ac.nz,
        prolog@swi.psy.uva.nl
Subject: Re:  About unification

	> Note that it's the same in Scheme and Lisp: (- 3) is an arithmetic
	> expression that negates a 3 at run time, but -3 is a simple negative number.
	
	That I think is the misleading thing.  In functional languages they may
	be different terms too, but they usually evaluate to the same thing, so
	the naive user doesn't notice.
	
Well, no.  The problem with negation is one of the things that hits the
SML or Haskell beginner in the face quite early on.

For example, in Haskell, suppose we have an infix operator
	($) x y = whatever
We can form
	1 $ 3		= ((($) 1) 3)		-- operator application
	(1 $)		= \y. 1 $ y		-- a SECTION
	($ 3)		= \x. x $ 3		-- a SECTION
	($)		= \x y.x $ y		-- the operator as a function

So for example (+3) is the function that adds 3 to things.
But (-3) is *NOT* the function that subtracts 3 from things,
it is the number negative three.  So negation is syntactically
different from all other infix operators, and in a sometimes very
surprising way.

For example, in SML, 
- ~1;
val it = ~1 : int
- -1;
stdIn:18.1 Error: expression or pattern begins with infix identifier "-"
stdIn:18.1-18.3 Error: operator and operand don't agree [literal]
  operator domain: 'Z * 'Z
  operand:         int
  in expression:
    - 1

That is, contrary to all other programming languages except APL,
-3 does *not* evaluate to negative three in SML, it is a syntax error.
You have to use "~" (tilde) to get unary negation.

What's more, while "~" is in fact a function in SML, you can write
~n in a pattern (where n is an integer constant), and this is true
for NO OTHER FUNCTION.

	Lack of functions in standard Prolog is sometimes advantagous,
	sometimes not but almost invariably confusing to novice users.
	
Unary negation is trouble no matter who you are or what you're using.

