[racket] Local form in typed racket

From: Ben Dean (benjamin.dean at aya.yale.edu)
Date: Sat Feb 9 21:56:45 EST 2013

It would be very helpful to me to have an example of the "local" form for
defining an internal function in typed racket. I've read and re-read the
docs and can't seem to figure it out from the syntax definition.

Here's what i've been trying:

(: make-random-emetype-list (Range -> (Listof EmeType)))
(define (make-random-emetype-list range )
  (local ([define how-many-types (random-integer (Range-lower range)
(Range-upper range))]
          [define: (bld-lst  lst remaining)  : ((Listof EmeType) Integer ->
(Listof EmeType))
            (cond [(< remaining 1) lst]
                  [else (bld-lst (cons (new-emetype) lst) (- remaining
1))])])
    (bld-lst '() how-many-types)))

but I get an error on this: "define:: expected the identifier `:' in:
((Listof EmeType) Integer -> (Listof EmeType))"

Thanks for the help!

Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130209/e8a7d980/attachment.html>

Posted on the users mailing list.