On Dec 29, 2014, at 7:43 AM, Thien-Thi Nguyen <[email protected]> wrote:
> () Matt Wette <[email protected]>
> () Mon, 29 Dec 2014 06:05:35 -0800
> 
>   (define (non-terminal? term tokl)
>     (and (symbol? term) (not (memq term tokl))))
> 
> If ‘tokl’ contains only symbols, then the first sub-expression
> ‘(symbol? term)’ is superfluous, thanks to ‘memq’.

Yes, thanks.

>   (define (non-terminal? term)
>     (symbol? term))
> 
> How about using an object property?
> 
> (define terminal (make-object-property))
> 
> (define (non-terminal? obj)
>   (not (terminal obj)))
> 
> You would have to ‘(set! (terminal OBJ) #t)’ for every terminal,
> of course.  This works fine w/ either symbols or keywords, btw.

Thanks.   I did not know about object properties.  Will check.

Matt

Reply via email to