Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Regular expression matching against OCaml streams.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-01-12 (15:49)
From: Chris Conway <cconway@c...>
Subject: Re: Regular expression matching against OCaml streams.
Edgar Friendly <thelema314 <at>> writes:

> Dmitri Boulytchev wrote:
> >    Hello,
> > 
> >    is it possible to match OCam streams (by mean of Stream.t) against
> > regular expressions? Are there library
> > that can be used for this purpose? Str matches only against strings.
> I don't know of any libraries for this purpose.  I will warn anyone
> making one that it's easy for simple regex matching to evaluate the
> whole stream, and then fail to match.

Or worse, never terminate. E.g.,

    stream_match "a*b" (Stream.from (fun _ -> Some 'a'))