Ordered sets and maps, implemented in pure clojure
Pull request Compare This branch is 38 commits behind amalloy:develop.
Permalink
Failed to load latest commit information.
src Add implementation for j.u.Map/entrySet, which was missing Oct 18, 2013
test/flatland/ordered Add regression test for (empty x) metadata Apr 10, 2013
.gitignore gitignore for lein Nov 16, 2012
.travis.yml Add a travis file. Jul 23, 2012
LICENSE
README.md
project.clj 1.5.2, adding j.u.Map/entrySet Oct 18, 2013
tasks.clj Don't write a (bad) test for reflection warnings; instead depend on c… Jun 20, 2011

README.md

Build Status

ordered provides sets and maps that maintain the insertion order of their contents.

Sets

(use 'flatland.ordered.set)

(ordered-set 4 3 1 8 2)
=> #ordered/set (4 3 1 8 2)

(conj (ordered-set 9 10) 1 2 3)
=> #ordered/set (9 10 1 2 3)

(into (ordered-set) [7 6 1 5 6])
=> #ordered/set (7 6 1 5)

(disj (ordered-set 8 1 7 2 6) 7)
=> #ordered/set (8 1 2 6)

Maps

(use 'flatland.ordered.map)

(ordered-map :b 2 :a 1 :d 4)
=> #ordered/map ([:b 2] [:a 1] [:d 4])

(assoc (ordered-map :b 2 :a 1 :d 4) :c 3)
=> #ordered/map ([:b 2] [:a 1] [:d 4] [:c 3])

(into (ordered-map) [[:c 3] [:a 1] [:d 4]])
=> #ordered/map ([:c 3] [:a 1] [:d 4])

(dissoc (ordered-map :c 3 :a 1 :d 4) :a)
=> #ordered/map ([:c 3] [:d 4])