Conceptually you want to signal the error out of the 'parms' computation.
So even if you introduce string->real as a variation on string->number,
you probably want to catch the error it raises and re-cast it as 'params'
message.
On Jun 22, 2014, at 12:56 PM, Manfred Lotz wrote:
> On Sun, 2
On Sun, 22 Jun 2014 11:58:59 -0400
Sam Tobin-Hochstadt
wrote:
> Fortunately, one of those casts can be eliminated with a bit of type
> annotation on `NUM`. Full code here:
> https://gist.github.com/samth/48bf2ccb2c510c75017e
>
> (define parms
> (command-line
>#:program "mypgm"
>#:onc
On Sun, 22 Jun 2014 11:25:01 -0400
Matthias Felleisen
wrote:
>
> I would use Real for the parameter type and then cast twice:
>
> (define parms
> (command-line
>#:program "mypgm"
>#:once-each
>[("-v" "--verbose") "Show verbose output" (opt-verbose-mode #t)]
>[("-m" "--max-siz
Fortunately, one of those casts can be eliminated with a bit of type
annotation on `NUM`. Full code here:
https://gist.github.com/samth/48bf2ccb2c510c75017e
(define parms
(command-line
#:program "mypgm"
#:once-each
[("-v" "--verbose") "Show verbose output" (opt-verbose-mode #t)]
[(
I would use Real for the parameter type and then cast twice:
(define parms
(command-line
#:program "mypgm"
#:once-each
[("-v" "--verbose") "Show verbose output" (opt-verbose-mode #t)]
[("-m" "--max-size")
NUM
("Max size." "NUM")
(opt-max-size (cast (string->number (ca
On Sat, 21 Jun 2014 10:12:27 -0400
"Alexander D. Knauth"
wrote:
> The first thing I notice is that opt-max-size is a (Parameterof Any),
> but you use string->number on it. So you should probably put a guard
> on the opt-max-size parameter something like this: (: opt-max-size
> (Parameterof Any Re
The first thing I notice is that opt-max-size is a (Parameterof Any), but you
use string->number on it.
So you should probably put a guard on the opt-max-size parameter something like
this:
(: opt-max-size (Parameterof Any Real))
(: opt-max-size-guard (Any -> Real))
(define (opt-max-size-guard
7 matches
Mail list logo