From 9a6cdf420bcf7a6c584c74d198f0e6c008e6709b Mon Sep 17 00:00:00 2001 From: Neil Toronto Date: Fri, 14 Feb 2014 16:05:16 -0700 Subject: [PATCH] Updated types for `density' and `kde' --- .../plot-pkgs/plot-lib/plot/typed/private/contracted/kde.rkt | 5 ++++- pkgs/plot-pkgs/plot-lib/plot/typed/private/plot2d/line.rkt | 1 + pkgs/plot-pkgs/plot-test/plot/tests/typed/plot-tests.rkt | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/plot-pkgs/plot-lib/plot/typed/private/contracted/kde.rkt b/pkgs/plot-pkgs/plot-lib/plot/typed/private/contracted/kde.rkt index 3dadcf0f36..ce4b58b0fd 100644 --- a/pkgs/plot-pkgs/plot-lib/plot/typed/private/contracted/kde.rkt +++ b/pkgs/plot-pkgs/plot-lib/plot/typed/private/contracted/kde.rkt @@ -4,5 +4,8 @@ (require/typed/provide plot/private/contracted/kde - [kde ((Listof Real) Real -> (Values mapped-function (Option Real) (Option Real)))] + [kde (case-> ((Listof Real) Real + -> (Values mapped-function (Option Real) (Option Real))) + ((Listof Real) Real (U (Listof Real) #f) + -> (Values mapped-function (Option Real) (Option Real))))] ) diff --git a/pkgs/plot-pkgs/plot-lib/plot/typed/private/plot2d/line.rkt b/pkgs/plot-pkgs/plot-lib/plot/typed/private/plot2d/line.rkt index 18aa51c437..20c08d1405 100644 --- a/pkgs/plot-pkgs/plot-lib/plot/typed/private/plot2d/line.rkt +++ b/pkgs/plot-pkgs/plot-lib/plot/typed/private/plot2d/line.rkt @@ -78,6 +78,7 @@ [density (((Sequenceof Real)) (Real + (Option (Sequenceof Real)) [#:x-min (Option Real)] [#:x-max (Option Real)] [#:y-min (Option Real)] diff --git a/pkgs/plot-pkgs/plot-test/plot/tests/typed/plot-tests.rkt b/pkgs/plot-pkgs/plot-test/plot/tests/typed/plot-tests.rkt index 9af28d68a4..cf37ad6a40 100644 --- a/pkgs/plot-pkgs/plot-test/plot/tests/typed/plot-tests.rkt +++ b/pkgs/plot-pkgs/plot-test/plot/tests/typed/plot-tests.rkt @@ -35,6 +35,7 @@ (function (λ: ([x : Real]) x) -1.5 (- (exp 1.5) 1) #:color 0 #:style 'dot))) (plot (density xs 1)) +(plot (density xs 1 (map (λ: ([x : Flonum]) (sqr x)) xs))) (plot (lines-interval (map (λ: ([x : Real] [y : Real]) (list x y 5.0))