[racket] TR Keyword Args (Lil Help)

From: Ray Racine (ray.racine at gmail.com)
Date: Thu Aug 9 19:01:41 EDT 2012

The following sample works well enough that I can do something similar for
each of my current situational plotting needs  However, I can't seem to get
any of the keyword typings to work.

No keyword typing support for require/typed at this time, bug, or I'm flat
out doing it wrong?

Thanks,

Ray

#lang typed/racket/base

(require
 (only-in racket/math
          sqr))

(define-type Color% (Class () () ()))

(define-type Plot-Pen-Style (U Integer
                               (U 'transparent 'solid
                                  'bdiagnol-hatch 'fdiagonal-hatch
                                  'horizontal-hath 'veritcal-hatch
                                  'crossdisg-hatch 'cross-hath)))

(define-type Plot-Color (U Integer (List Real Real Real)
                           String Symbol Color%))

(define-type Image-Snip% (Class () () ()))

(require/typed plot/utils
               [opaque Renderer2d renderer2d?]
               [linear-seq (Real Real Exact-Nonnegative-Integer -> (Listof
Real))])

(require/typed plot/main
   [plot (Any -> Any)]
   [function (case-> ((Real -> Real)
                      (Option Exact-Rational)
                      (Option Exact-Rational)
                      ;[#:y-min   Exact-Rational]
                      ;              [#:y-max   Exact-Rational]
                      ;              [#:samples Integer]
                      ;              [#:color   Plot-Color]
                      ;              [#:width   Natural]
                      ;              [#:style   Plot-Pen-Style]
                      ;              [#:alpha   Real]
                      ;              [#:label  (Option String)]
                      -> Renderer2d)
                     ((Real -> Real) -> Renderer2d))]

   [area-histogram
    ((Real -> Real) (Listof Real) -> Renderer2d)])

(define (test)
  (: f (Real -> Real))
  (define (f x) (exp (* -1/2 (sqr x))))
  (plot (list (area-histogram f (linear-seq -4 4 10))
              (function f -4 4))))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120809/309f2b0e/attachment.html>

Posted on the users mailing list.