<div dir="ltr">As so often happens when one is forced to type out a question in real words, shortly after sending the previous email, I was able to answer my own question.<div><br></div><div style>the result:</div><div style>
<br></div><div style><div>(: make-random-emetype-list (Range -> (Listof EmeType)))</div><div>(define (make-random-emetype-list range )</div><div> (letrec: ([lower : Integer (Range-lower range)]</div><div> [upper : Integer (Range-upper range)]</div>
<div> [how-many : Integer (random-integer lower upper)]</div><div> [bld-lst : (Integer (Listof EmeType) -> (Listof EmeType)) (lambda: ([remaining : Integer] [lst : (Listof EmeType)]) </div><div> (cond [(< remaining 1 ) lst]</div>
<div> [else (bld-lst (- remaining 1) (cons (new-emetype) lst))]))])</div><div> (bld-lst how-many '())))</div><div><br></div><div style>Thanks!</div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Feb 9, 2013 at 6:56 PM, Ben Dean <span dir="ltr"><<a href="mailto:benjamin.dean@aya.yale.edu" target="_blank">benjamin.dean@aya.yale.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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. <div>
<br></div><div>Here's what i've been trying:</div><div><div><br></div><div>(: make-random-emetype-list (Range -> (Listof EmeType)))</div><div>(define (make-random-emetype-list range )</div><div> (local ([define how-many-types (random-integer (Range-lower range) (Range-upper range))]</div>
<div> [define: (bld-lst lst remaining) : ((Listof EmeType) Integer -> (Listof EmeType))</div><div> (cond [(< remaining 1) lst]</div><div> [else (bld-lst (cons (new-emetype) lst) (- remaining 1))])])</div>
<div> (bld-lst '() how-many-types)))</div></div><div><br></div><div>but I get an error on this: "define:: expected the identifier `:' in: ((Listof EmeType) Integer -> (Listof EmeType))"</div>
<div><br></div><div>Thanks for the help!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Ben</div></font></span></div>
</blockquote></div><br></div>