<div dir="ltr">That might not be what he wants either, if he wants anything representable as a flonum to be a flonum. For instance, (S->F "5") is #false by your implementation. It's hard to tell exactly what S->F is supposed to do without more of a specification.<br>
</div><div class="gmail_extra"><br clear="all"><div>Carl Eastlund</div>
<br><br><div class="gmail_quote">On Wed, Feb 13, 2013 at 10:04 PM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
#lang typed/racket<br>
<br>
(: S->F : String -> (Option Float))<br>
(define (S->F s)<br>
(define n (string->number s))<br>
(and (flonum? n) n))<br>
<br>
I assume you mean to convert strings into floats, if possible.<br>
<br>
But you may like the funny answers better -- Matthias<br>
<div class="im HOEnZb"><br>
<br>
<br>
On Feb 13, 2013, at 9:49 PM, Ray Racine wrote:<br>
<br>
> What is the most efficient way to write the following method in TR?<br>
><br>
> (: S->F (String -> (Option Float)))<br>
><br>
><br>
</div><div class="HOEnZb"><div class="h5">> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
</div></div></blockquote></div><br></div>