On 5/10/06, Austin Hastings <[EMAIL PROTECTED]> wrote:
Mark A. Biggar wrote:
> Use hyper compare ops to select what you want followed by using filter
> to prune out the unwanted.
>
> filter gives you with scan:
>
>     filter (list [<] @array) @array ==>
>             first monotonically increasing run in @array
>
This seems false. @array = (1 2 2 1 2 3), if I understand you correctly,
yields (1 2 2 3).

No, it yields (1, 2, 2)

   list [<] @array
==>
   list [<] (1, 2, 2, 1, 2, 3)
==>
   1,
   1 < 2,
   1 < 2 < 2,
   1 < 2 < 2 < 1,
   1 < 2 < 2 < 1 < 2,
   1 < 2 < 2 < 1 < 2 < 3,
==>
   Bool::True, Bool::True, Bool::True, Bool::False, Bool::False, Bool::False

And so
   filter (list [<] @array) @array
would give first 3 elements of @array, i.e. (1, 2, 2)

>     filter (list [<=] @array) @array ==>
>             first monotonically non-decreasing run in @array

So @array = (1 0 -1 -2 -1 -3) ==> (1, -1) is monotonically non-decreasing?

This would give (1, 0, -1, -2)

   list [<=] (1, 0, -1, -2, -1, -3)
==>
   1,
   1 <= 0,
   1 <= 0 <= -1,
   1 <= 0 <= -1 <= -2,
   1 <= 0 <= -1 <= -2 <= -1,
   1 <= 0 <= -1 <= -2 <= -1 <= -3
==>
   Bool::True, Bool::True, Bool::True, Bool::True, Bool::False, Bool::False

And so
   filter (list [<=] @array) @array
would give first 4 elements of @array, i.e. (1, 0, -1, -2)

--
Markus Laire

Reply via email to