Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  (define eval-expr
    (lambda (expr env)
      (pmatch expr
        [`,x (guard (symbol? x))
          (env x)]
        [`(lambda (,x) ,body)
          (lambda (arg)
            (eval-expr body (lambda (y)
                              (if (eq? x y)
                                  arg
                                  (env y)))))]
        [`(,rator ,rand)
         ((eval-expr rator env)
          (eval-expr rand env))])))
There's an amazing talk about it: https://www.youtube.com/watch?v=OyfBQmvr2Hc


Great. In 90 minutes I may be able to know what you're talking about.


Is it a complete lisp interpreter, written in lisp?


Yes, it uses pmatch behind the scene to match your expr against the evaluator.

https://github.com/webyrd/quines/blob/master/pmatch.scm

I have to agree, this like rank #1 in my book!


This is exactly what came to mind when seeing the question.

I was just recently (re-)reading an article that goes in depth:

Lisp as the Maxwell’s equations of software

http://www.michaelnielsen.org/ddi/lisp-as-the-maxwells-equat...


Once you've seen this one, it's difficult not to rank it first :)


Y Combinator?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: