Version française
Home     About     Download     Resources     Contact us    
Browse thread
[OSR] Standard syntax extensions ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Till Crueger <crueger@i...>
Subject: Re: [Caml-list] [OSR] Standard syntax extensions ?
On Sat, 26 Apr 2008 09:41:57 +0200, Richard Jones <rich@annexia.org> wrote:

> I'm guessing that there will be ambiguity because you're wanting to
> add yet another meaning to the reserved word 'in'.
>
> However I'm not sure why you don't just use 'List.mem', or even:
>
>   let mem = List.mem ;;
>
>   mem 1 [1;2;3]

Since I am reading the "Haskell School of expressions" right now (to  
become better at functional Programming, not to leave my favourite  
language :)) I am starting to like the way you can turn any function into  
an infix operator by using quotes. Wouldn't it be possible to have  
something similar to this in OCaml? I don't think there is an easy way to  
do this yet, since I didn't find anything on this topic.

I am posting this in this thread, because this would allow us to write the  
above more elegantly as:
1 `mem` [1;2;3], which is close to what was originally proposed.

What do you think of this?

bye,
   Till


-- 
There once was a man from the sticks
Who liked to compose limericks.
But he failed at the sport,
For he wrote 'em too short.