[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: srfe records in reworked match

From: Ludovic Courtès
Subject: Re: srfe records in reworked match
Date: Fri, 23 Apr 2010 11:23:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)


stefan <address@hidden> writes:

> On Wednesday 21 April 2010 10:40:29 am Ludovic Courtès wrote:
>> As noted in Shinn’s match-cond-expand.scm, this record matching form is
>> not ideal:
>>   ;; Annoying unhygienic record matching.  Record patterns look like
>>   ;;   ($ record fields...)
>>   ;; where the record name simply assumes that the same name suffixed
>>   ;; with a "?" is the correct predicate.
> Entering,
> scheme@(guile-user)> (macroexpand '(n? x))
> (if (struct? x) (eq? (struct-vtable x) n) #f)

That’s an implementation detail that you should ignore.  :-)

Just have users write:

  (($ n? a b c) ...)

Where ‘n?’ is bound to the record type predicate, and have ‘match’
invoke that record type predicate.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]