3 ms·
To add, Clojure uses a sequence interface that is typically backed by a vector. Conj (instead of cons) is used to derive a new sequence with the thing added in
by dgb23 5y ago
To add, Clojure uses a sequence interface that is typically backed by a vector. Conj (instead of cons) is used to derive a new sequence with the thing added in front for lists (which are rarely used) and at the back for vectors.
- brundolf 5y agoIt supports both, as it should; Lists are still first-class citizens, it's just that vectors are too. Though also in Clojure's case vectors aren't really vectors, they're immutable persistent data structures that share memory as much as possible, which I think would actually solve most of the performance problem here. But the same is not true of Rust's Vec<>
- nerpderp82 5y agohttps://github.com/bodil/im-rs https://github.com/bodil/im-rs
- brundolf 5y agoI'm solely commenting on the implementation in the OP, which uses a regular Vec<>
- fulafel 5y agoBoth are supported, but people rarely use lists in normal code IME - just in macros or other syntax representations (eg Datalog).