Not sure if this is a bug or not, add Stephane and Yann.

On 11/13, Till Bovermann wrote:
>
> // drop the first i elements
> left_drop(0, (x, xs)) = x, xs;
> left_drop(i, (x, xs)) = left_drop(i-1, xs);
>
> // reverse a list
> reverse((x, xs)) = reverse(xs), x;
> reverse(x) = x;
>
> process = left_drop(3, reverse((1, 2, 3, 4, 5)));
> // >> ERROR : pattern matching failed, no rule of case {(<x>,<xs>,<i>) => 
> left_drop(xs,i,1 : -); (<x>,<xs>,0) => x,xs; } matches argument list (2,1)
> ```

To simplify, lets forget about left_drop().

        process = ba.count(reverse((1, 2, 3, 4, 5)));

outputs 2, not 5, and this explains the problem. This is because the code
above acts as

        process = ba.count(( (5,4,3,2), 1 ));

Likewise

        taketwo((a,b)) = a;
        process = taketwo(reverse((1, 2, 3, 4, 5)));

outputs (5,4,3,2).

To me this doesn't look right... Consider another example,

        takefive((a,b,c,d,e)) = 0;
        process = takefive(reverse((1, 2, 3, 4, 5)));

fails with

        ERROR : pattern matching failed, no rule of case {(<a>,<b>,<c>,<d>,<e>) 
=> 0; } matches argument list (5,4,3,2,1)

and the error message is very confusing.

Oleg.



_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to