[racket] string->number failure value

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Tue Aug 16 09:45:49 EDT 2011

Writing (or (string->number str) default) has the same effect, since
#f never indicates a success.  The same is not true of hash-ref, where
#f can be a value in the hash table; that's why it needs an explicit
default argument.

Carl Eastlund

On Tue, Aug 16, 2011 at 9:39 AM, Marijn <hkBst at gentoo.org> wrote:
> Hash: SHA1
> Hi,
> Upon failure to recognize a number string->number currently returns #f.
> It would be nice if it was possible to supply the failure value as an
> argument, the way it is possible for hash-ref. Problem with that is that
> string->number currently takes an optional argument to determine the
> radix in which the string should be interpreted as a number. If both
> optional arguments were promoted to keyword arguments then there would
> be no ordering problem. So I'd like to propose to change the signature
> of string->number to:
> (string->number string #:radix [radix 10] #:default [default #f])
> What do you think?
> Marijn
> Version: GnuPG v2.0.17 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 9QkAn1iVa9PNe2J/jXUoB7licro94SXd
> =CZ+1

Posted on the users mailing list.