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 <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > 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 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.17 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAk5KcwQACgkQp/VmCx0OL2x1kQCfWDXSVBwHnBncWna/F4W2SXWG > 9QkAn1iVa9PNe2J/jXUoB7licro94SXd > =CZ+1 > -----END PGP SIGNATURE----- _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

