Arc Forumnew | comments | leaders | submitlogin
1 point by evanrmurphy 5565 days ago | link | parent

Wow, looking back it was awfully dense of me to have your clear explanation about needing to define a setter and then coming over here to post some hack using join. Sorry for that.

Even though my popnth function works, it's a worse solution because by ignoring setforms it only works for the specific case of pop rather than the whole family of destructive functions. Is this accurate?

I'm a good deal more comfortable with the setter concept after your and thaddeus' examples. Thanks to both of you for your patience with a newb. I've been super impressed with this forum so far: the community is small but outstanding.



1 point by shader 5564 days ago | link

Yep. By defining popnth, you get a single function that performs a specific task. But if you define a setform, now any function that wants to operate on a "place" can do so.

In theory, you can now do things like

  (= (nthcdr 3 lst) '(a s d f))
and set the 3rd cdr of lst to (a s d f)

-----