Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] patterns usage
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Virgile Prevosto <prevosto@m...>
Subject: Re: [Caml-list] patterns usage
Le samedi 06 mars, à  0h46 +0100,
Eugene Ossintsev a écrit:
> Is it the "right way" to rewrite it having added
>    let is_space = function
>      | Some (' ' | '\010' | '\013' | '\009') -> true
>      | _ -> false
> 
> in order to use like
> 
>    match Stream.peek strm with
>    | c when is_space c -> ...
>    | ...

Hi,
your solution should work without any problem, but you might be
interested in camlp4's syntax to handle streams
(http://caml.inria.fr/camlp4/manual/manual003.html). In this case,
you'll have to add -pp camlp4o as a command line option to the ocaml
compiler (or use the directive #load camlp4o.cma;; in the interpreter).

-- 
E tutto per oggi, a la prossima volta
Virgile

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners