0
votes

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

1 Answers

1
votes

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.