If I want to add an element to the end of an immutable list, is it better
to do:

(append current-list (list new-element))
or
(reverse (cons new-element  (reverse current-list)))
or
something else?

I would imagine it's the first one because that should be a single
traversal and link add instead of two traversals and rebuilds, but maybe
I'm wrong.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAE8gKocM4jNCg6xKruYwuwFtuOdbOSwugYcgUND1ZD%3DRB1iA0g%40mail.gmail.com.

Reply via email to