Hacker News new | ask | show | jobs
by dborg 4669 days ago
Actually you'd want to save it as (1 . (2 . (4 . (8 . NIL)))) since o/w you'd still get quadratic time complexity as you need to unpack your whole list when you add the next value.
2 comments

True! I forgot that you only keep a pointer to the start.
or build it lazily...