At 01:35 +0000 1999/11/25, Thoplaop wrote:
>(ii) HOWEVER, GIVEN THIS FUNCTION:
>
>module calculator where
>
>type OpCodes = String
>
>(|$|) :: Float -> (OpCodes,Float) -> Float
>(|$|) f1 (op,f2)
>       | op=="add_to"       = f1 + f2
>       | op=="take_away"    = f1 - f2
>       | op=="multiplied_by"= f1 * f2
>       | op=="divided_by"   = f1 / f2
>       | otherwise          = error( "undefined operation" ++ op)
>
>(iii) THE FOLLOWING INCORRECT RESPONSE FROM HUGS OCCURS:
>
>Calculator> -1 |$| ("take_away", -23)
>-24.0
..
>(v) THIS IS A GET-AROUND:
>
>Calculator> (-1) |$| ("take_away", -23)
>22.0

Evidently
  Calculator> -1 |$| ("take_away", -23)
is parsed as
  Calculator> -(1 |$| ("take_away", -23))

I leave it to the experts to tell whether this is correct or not.

  Hans Aberg
                  * Email: Hans Aberg <mailto:[EMAIL PROTECTED]>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>


Reply via email to