nan-sum ( seq -- n )


Vocabulary
math.extras

Inputs and outputs
seqa sequence
na number


Word description
Return the sum of seq treating any NaNs as zero.

Definition
USING: kernel math sequences ;

IN: math.extras

: nan-sum ( seq -- n )
0 [ dup fp-nan? [ drop ] [ + ] if ] binary-reduce ;