[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [r6rs-discuss] [Scheme-reports] Scheme pattern matching: the case for (case)
On Tue, 2010-12-21 at 17:54 -0500, John Cowan wrote:
> Peter Kourzanov scripsit:
> > I have no quoting in my example clauses. Read it as follows:
> No, but case implicitly quotes its arguments, which makes it impossible
> (or rather useless) for them to be quasiquotations.
What I am proposing is to generalize quotation in (case) to be
quasiquotation (I hope we do agree that quasiquote is more general
than quote). Then one can add pattern matching by hooking onto
unquote (-splicing) for delineating pattern variables.
> > (case 'b
> > ((`,a) (list a))) ; explicate quasiquote
> That still won't work. (` ,a) is just (quasiquote (unquote a)), and in
> the context of a case key means "either the symbol quasiquote, or the list
> (unquote a which is eqv? to the one in the code".
I think you missed a level of parentheses;-) `,a is here just 1
If I read any modern R*RS spec, I see no possibility to use unquote in
regular (case) clauses. (eqv? datum ',a) is doomed to be #f for all
data, including ',a (because the ',a in the clause is always newly
allocated), except, possibly, in the unlikely case that a compiler
would stash all occurrences of ',a and the like into one single machine
So there is no use-case for this counter-example. In my interpretation,
the clause would match just any datum, with quasiquote elided and
unquote being syntax to delineate pattern variables.
Please correct me if I'm wrong but I see no problem whatsoever in
supporting original (case) semantics alongside pattern-matching
r6rs-discuss mailing list