3 ms·
I fail to see why mutable cons cells has anything to do with the difficulty of implementing Lisp. @dataclass class Cons: car: Any cdr:
by reikonomusha 4y ago
I fail to see why mutable cons cells has anything to do with the difficulty of implementing Lisp.
@dataclass
class Cons:
car: Any
cdr: Any
You can define a nice printer or reader for it if you want, but mutability doesn't seem to be a hindrance in implementation.
- sillysaurusx 4y agoYou can, but then none of the Python libraries that expect Python lists can use your Cons as a list. I tried. It sucks. The conversion becomes a problem all over the place. isinstance(Cons(nil, nil), list) will fail, for example. I posted a more thorough answer here: https://news.ycombinator.com/item?id=33194570 https://news.ycombinator.com/item?id=33194570
- phoe-krk 4y agoThis isn't a case of Lisp being hard to implement, this is a case of trying to make your Lisp work with Python language idiosyncrasies. These two issues have close to nothing to do with one another.
- Turing_Machine 4y agoPython...Python...Python... I think I see where your problem actually is.