From 842a69c09905962291fb71169d096ba14064d8c5 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 1 May 2013 21:22:27 -0700 Subject: [PATCH] math.extras: add fill-nans. --- extra/math/extras/extras.factor | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extra/math/extras/extras.factor b/extra/math/extras/extras.factor index b907f25583..b78e06464a 100644 --- a/extra/math/extras/extras.factor +++ b/extra/math/extras/extras.factor @@ -152,6 +152,11 @@ PRIVATE> : nan-max ( seq -- n ) [ fp-nan? not ] filter supremum ; +: fill-nans ( seq -- newseq ) + [ first ] keep [ + dup fp-nan? [ drop dup ] [ nip dup ] if + ] map nip ; + : sinc ( x -- y ) [ 1 ] [ pi * [ sin ] [ / ] bi ] if-zero ;