Closed TheLostLambda closed 1 year ago
I can definitely see the argument for prependf
being more ergonomic. And since there's already a qprepend operation for queues there's an argument from consistency to have prepend
for lists as well.
For queues, there's also a qpreconc
operation that's the destructive equivalent; it might be worth having preconc
and preconcf
for lists as well, using nconc
instead of append
.
Thanks for the swift reply! I can get behind adding preconc
and preconcf
as well — with that being said, I've struggled a little bit to see how appendf
and nconcf
differ in their effects (since the -f
versions are always destructive) — I'd imagine there is some efficiency difference and maybe it looks like nconcf
doesn't play as nice with circular lists?
But that's just an aside I suppose — I'll get to drafting a PR with those four new definitions!
Just as a heads up for @ruricolist , I think that failing ECL CI might mean that new documentation isn't being generated? It doesn't look like any of the prepend
changes have made it into the REFERENCE.md
file!
Hello! I'd love to contribute some code to
serapeum
but wanted to get a feel for what others think before drafting this up in a PR.Would there be interest in adding
prepend
andprependf
definitions that act just like theirappend
counterparts (appendf
is defined byalexandria
) but with their arguments reversed.This obviously doesn't do too much good when you're just
append
ing two lists — you could just swap the arguments after all:But I suppose is makes a bit of a difference with more than one list, since more things need to be swapped:
I found this most helpful though when using
prependf
— when usingappendf
you can no longer swap arguments to get the right order since the first argument is the place that everything ends up:Of course, you could use
setf
, but this quickly becomes unwieldy when your place is a longer expression (note that you can't just put(elt crates (1- to))
in alet
— that breakssetf
and you'd need at leastmacrolet
):The definitions are incredibly simple, so I'm not too worried about bugs or implementation issues:
Let me know if I should open a PR with those two definitions added and some documentation written!