Browse thread
[Caml-list] operators: compose and Haskell's $ operator
-
Charles Martin
- Brian Rogoff
- Charles Martin
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Charles Martin <charles@c...> |
| Subject: | Re: [Caml-list] operators: compose and Haskell's $ operator |
At 05:57 PM 4/25/01 -0700, you wrote:
>On Wed, 25 Apr 2001, Charles Martin wrote:
>>equivalent for the $ operator eludes me, as it needs to be right
>>associative and of low precedence.
>
># let ( <-> ) f x = f x;;
>val ( <-> ) : ('a -> 'b) -> 'a -> 'b = <fun>
Unfortunately, this is left-associative:
# (+) 3 <-> ( * ) 2 <-> 4;;
Characters 0-5:
This expression has type int -> int but is here used with type
(int -> int) -> 'a
...and higher in precedence than logical operators:
# not <-> true && false;;
- : bool = false
The expression table (http://caml.inria.fr/ocaml/htmlman/manual014.html) does not have an ellipsis after the "<-" entry, so I assume that "<->" gets lumped into the "other infix symbols" category, which is left associative (and higher precedence than the logical operators).
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr