Search code examples
schemeracketsicpevaluatormetacircular

Adding primitives in metacircular evaluator


I am working on the metacircular evaluator, and I'm trying to add primitive procedures. I am almost done, except I'm not sure how to add the error. Here is what I have so far:

(define primitive-procedures
  (list (list 'car car)
        (list 'cdr cdr)
        (list 'cons cons)
        (list 'null? null?)
        (list '+ +)
        (list '* *)
        (list '- -)
        (list '/ /)
        (list '< <)
        (list '<= <=)
        (list '= =)
        (list '>= >=)
        (list '> >)))

This works so far. I tried adding (list '(error) (error "Metacircular Interpreter Aborted")) for error, but it's obviously not working... How do I go about that?

Thanks!


Solution

  • It's the same as with the other primitives, you just have to add it like this:

    (list 'error error)