0

I am writing a function called annotate that uses match-lambda, often with recursive calls to annotate. Here is one of the pattern matches:

(`(lambda (,<param1> . ,<params>) ,<stmts>)
        `(CLOSURE ENV (,<param1> . ,<params>) `(lambda (ENV) ,(map annotate ,(list-append `(,<param1> . ,<params>) `(,<stmts>))))))

list-append just makes new lists out of its two arguments. The problem is that when this pattern matches it returns something like:

'(CLOSURE
  ENV
  (x)
  `(lambda (ENV)
     ,(map
       annotate
       (<results of list-append>))))

Specifically, ",(map annotate" prints literally rather than being evaluated -- even though it is being unquoted. Other patterns within the function appear to use the exact same syntax without this issue. Also, the unquoted function list-append executes with no problems.

Any advice is appreciated.

1 Answer 1

1

You have nested backquotes: you have one in front of CLOSURE and then a second one in front of the second lambda without a comma in between: notice the literal backquote in the middle of your output. I think removing the backquote before the second lambda will fix the problem.

3
  • I tried that and it complains that the unquote before "(list-append" is not in a quasi-quote.
    – Schemer
    Feb 27, 2011 at 5:47
  • You need to remove the comma there; map annotate will be outside of a quasiquote (since you want to run it), so you do not need to unquote things inside it. Feb 27, 2011 at 5:48
  • Ah, list-append does not need to be unquoted afterall. Thanks again.
    – Schemer
    Feb 27, 2011 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.