Arc Forumnew | comments | leaders | submitlogin
2 points by akkartik 4926 days ago | link | parent

I spent several hours trying to get slices into wart. What I have is extremely unsatisfying, and I'm inclined yet again to blame Common Lisp.

Reading slices looks fine if a little lumpy: https://github.com/akkartik/wart/commit/3433b5e478d37b5f2c76...

(Now that we can't use ssyntax the lisp-2 rears its ugly head again:

  (call l 0 3)
..but I'll slide past that without further comment.)

Writing slices, however, is extremely ugly: https://github.com/akkartik/wart/commit/9a292064188c6fa072c7...

wart translates '= to setf and relies on Common Lisp's defsetf for overriding '=. But you can't just appropriately set the variable inside defsetf. Assigning to a place can't change the aggregate it belongs to.

Not only is this implementation verbose, there's a bug in it that you can drive a truck through: setf can never delete an entire list. I can't see any way to fix it short of reimplementing assignment in wart.