Home | Notifications | New Note | Local | Federated | Search | Logout
Paul SomeoneElse@pkw@snac.d34d.net (2026-06-26 06:13:23) Is this a terrible way to add an element to theReply
end of a list in scheme/lisp ?
(reverse (cons 3 (reverse '(1 2))))
#scheme #lisp
---Replies---
dave@dthompson@toot.cat (2026-06-26 06:23:53) @pkw better to do (append '(1 2) (list 3)). both are O(n) but the latter allocates less. singly linked lists aren't great if appending is a frequent operation.