On Wed, Sep 14, 2011 at 10:40:11PM +0200, Basile Starynkevitch wrote:
> And there is a reason why you cannot match (in Ocaml) on the content
> of strings (or arrays). It won't be easy to implement efficiently
> (you would need to copy a substring or subarray when matching)

How about just prefix matching?  That on its own would be very useful.

For example in web app that was passed arguments foo_1, foo_2, bar_1,
bar_5 you could parse the arguments like this:

  match arg with
  | "foo_" ^ s -> (* ... *)
  | "bar_" ^ s -> (* ... *)

Rich.

-- 
Richard Jones
Red Hat

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to