Working with list*

Today’s look into the Clojure API is a post on list*, and how it differs from list and conj.

list* takes as its args elements you want to add to a collection, followed by the collection. If the elements you are adding are primitives, it will return a flat list, simply adding the elements to the collection. Like conj, it adds the elements to the front of the list. Unlike conj, list* always returns a list, even if you give it a vector. If you are adding two collections, you will not get a flat list.

list takes elements to make into a list. If use this to add an element and a list, you will get a nested list.


You’re welcome.