[plt-scheme] match.ss questions
On Sat, 2006-02-25 at 09:59 -0500, Prabhakar Ragde wrote:
> I have just gotten around to trying to use match.ss, and it is quite
> nice. I am using it in Pretty Big, where it is automatically loaded. Can
> someone explain why I cannot use false or empty in patterns, but have to
> use #f and '() instead? Also, why is match.ss automatically loaded, and
> not plt-match.ss? (I know I can just require it, but I am thinking about
> students.) Thanks. --PR
false and empty are variable bindings, which match doesn't allow you to
match against as literals. It's the same as doing:
(let ([x 5])
(match 6
[x "5 = 6"]
[_ "5 != 6"]))
This produces "5 = 6", since match just treats x as a variable. #f and
'(), in contrast, are literals, which match knows about.
As for match.ss vs plt-match.ss, the both export the same bindings, so
only one could be used in Pretty Big (unless one set of bindings was
prefixed). Since match.ss is the more traditional and more popular,
it's the one in Pretty Big.
sam th