[plt-scheme] Syntax && SchemeQL
This has nothing to do with SrPersist. When you use ` (quasiquote)
then the , (unquote) must be physically nested inside. By the time
you macro expand, the cons structures have been formed from
quasiquote and unquote. -- Matthias
On May 20, 2004, at 2:33 PM, Ryan Culpepper wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> --- Toon Verwaest <camden at camden.be> wrote:
>> I'm trying out the SchemeQL, but it still seems to have a few
>> bugs...
>> One of the things I can't figure out how to fix it:
>>
>> (define-syntax (add-constraint-to-table! stx)
>> (syntax-case stx ()
>> [(_ table . cons)]
>> (syntax
>> (let ((tab (quasiquote table))
>> (con (quasiquote cons)))
>> (if (table-definition? tab)
>> (begin (set-table-definition-constraint!
>> table
>> (map format-table-named-constraint con))
>> table)
>> (raise-type-error 'add-check-to-table "table-definition
>> structure" tab))))]))
>>
>> When I call this, I can send stuff to the . cons part, with
>> unquote, but the table I can't unquote.
>>
>> I don't really know how the syntax-stuff works, but I would think
>> from the (quasiquote table),
>> that table should be able to have an unquote also..
>>
>> When I run it with unquote, it just says: not in quasiquote.
>
> I haven't examined the SchemeQL code, but this snippet looks like it
> should be using the local variable "tab" instead of the pattern
> variable "table" within the body of the let.
>
> Try replacing the code with this:
>
> (define-syntax (add-constraint-to-table! stx)
> (syntax-case stx ()
> [(_ table . cons)]
> (syntax
> (let ((tab (quasiquote table))
> (con (quasiquote cons)))
> (if (table-definition? tab)
> (begin (set-table-definition-constraint!
> tab ;; CHANGED!
> (map format-table-named-constraint con))
> tab) ;; CHANGED!
> (raise-type-error 'add-check-to-table
> "table-definition structure"
> tab))))]))
>
> Hope that helps,
> Ryan
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains Claim yours for only $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer