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: Richard Jones <rich@a...>
Subject: Re: [Caml-list] [OSR] Standard syntax extensions ?
On Fri, Apr 25, 2008 at 01:37:47PM -0700, Arthur Chan wrote:
> Would it be difficult to have python-like syntax for List.exists?  Could we
> add it to Hashtbl and Array too?  I'm not too fond of python's general
> sloppiness, but the (x in mylist) syntax seemed very pretty to me.  At the
> least, it correspondes directly to mathematical syntax (x \in blah, for
> Latex ppl).
> 
> Does this already exist in a syntax extension?

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]

Did I miss something about how the Python syntax works?

Rich.

-- 
Richard Jones
Red Hat