Hi all,
I'm still sorting my way through the available procedures in Scheme and the
functionality of char testing has be a tad baffled.
For example, if I was uncertain about the nature of an object being passed
to a procedure then I would like to test it (identify it) and then branch
according to what it was.
This code won't work: (char-alphabetic? "a")
;==> char-alphabetic?: expects argument of type <character>; given "a"
Now I know that "a" is a string literal and not a char-alphabetic? object.
I would have expected (wrongly) for the expression to resolve as #f rather
than cough blood and die.
You see, procedures like number? string? char? all resolve as #t or #f
irrespective of whatever is used as the argument (so far as I can tell).
eg: (char? "a") ;==> #f and (number? "a") ; ==> #f.
(a) Is there a hierarchy on these sorts of procedures? As is, first
determine (char? foo) before then asking questions about precisely what sort
of char it might be if the first is true?
(b) Are there any other procedures (testing object types) that behave in the
same way as char-numeric? (excluding the other char-type procedures since
they too behave the same: char-alphabetic? char-punctuation?)?
Thanks,
Mike