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
Pattern matching over lazy lists
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-07-11 (15:51)
From: Martin Jambon <martin.jambon@e...>
Subject: Re: [Caml-list] Pattern matching over lazy lists
On Tue, 10 Jul 2007, Jon Harrop wrote:

> What's the best way to do this?
> I was thinking of forcing the first few elements of a lazy list before pattern
> matching and then looking for forced values in the lists as patterns but I
> don't think you can deconstruct a lazy value in a pattern match...

You can use this approach:

I found this convenient for "sliding window" signal analysis.

It requires micmatch and a 3.09-compatible version of camlp4.