minmax-relative ( seq k -- lt eq gt lt-max gt-min )


Vocabulary
math.statistics

Definition
USING: combinators generalizations kernel math math.order
sequences ;

IN: math.statistics

: minmax-relative ( seq k -- lt eq gt lt-max gt-min )
[ 0 0 0 -1/0. 1/0. ] 2dip [ [ dup ] ] dip [
<=> {
{ +lt+ [ [ 1 + ] 5 ndip [ max ] curry dip ] }
{ +gt+ [ [ 1 + ] 3dip min ] }
{ +eq+ [ [ 1 + ] 4dip drop ] }
} case
] curry compose each ;