Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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:

   http://martin.jambon.free.fr/micmatch-manual.html#htoc13

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

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


Martin