I can't find anywhere in Oz that describes syntactic sugar for character
constants. If I want to examine a single character in a character
string, I can use numbers for pattern matching:
proc {Test1 C}
case C
of 97 then {Browse a}
[] 98 then {Browse b}
[] 99 then {Browse c}
end
end
{Test1 ("abc").1}
and that will work. But I lose the nicety of knowing that 97, 98, and
99 are really the character 'a'. Works, but it means I'd have to resort
to using comments to describe that intent.
Alternatively, I could convert a single character back into a string:
proc {Test2 C}
case [C]
of "a" then {Browse a}
[] "b" then {Browse b}
[] "c" then {Browse c}
else {Browse nomatch#C}
end
end
{Test2 ("abc").1}
But that would seem to be inefficient (and slightly obtuse).
Does Oz support syntax for characters? (As an analogy, SML uses #"a").
Thanks,
Chris
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users