Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
(How to Write a (Lisp) Interpreter (In Python)) (norvig.com)
6 points by swatson741 on Feb 14, 2022 | hide | past | favorite | 3 comments


I've got a nitpick that x.val() in Java is not accurately represented as (val x) in a scheme. there's a few different ways schemes do objects but two common ones are to either:

Treat x as callable and call it with a symbol representing a member method:

    (x 'val)
Or have a macro that takes the object and method name as arguments, for example:

    (send x val)
I've also seen schemes that have class definitions introduce functions for each method/property so if x is an instance of SomeClass:

    (SomeClass-val x)


I betterfied it just a little bit: https://github.com/timonoko/nokolis.py


(1 . 2)?




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

Search: