ruricolist / serapeum

Utilities beyond Alexandria
MIT License
415 stars 41 forks source link

Add prepend and prependf #143

Closed TheLostLambda closed 1 year ago

TheLostLambda commented 1 year ago

Addresses #142

I experimented a bit with preconc and preconcf, but they aren't in this PR because I had a number of issues with both its design and implementation.

  1. The reversing involved in these prepend definitions meant that preconc was mutating it's last argument instead of the first, which was pretty counter intuitive (at least from my perspective)
  2. More confusingly, the preconc tests (the same as the prepend tests in this PR) would fully hang SBCL when wrapped in (with-notinline (preconc) ...) — this might be some odd undefined behavior from destructively mutating list literals in this unusual context?

Personally, I'd prefer merging this PR as is and addressing preconc and friends down the line, but I'm happy with whatever you think is best — I could just be missing some obvious answers here :)

ruricolist commented 1 year ago

Merged, thanks!