Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tuples for clojure
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src/tuples
test/tuples/test
.gitignore
README.org
project.clj

README.org

tuples

Description

Provides “tuples” for Clojure, with faster element access, otherwise behaving like Clojure’s vectors.

Usage

  • add to your project.clj:
[tuples 0.0.3]
;=> (use 'tuples.core)
nil
;=> (tuple 1 2)
[1 2]
;=> (tuple 1 2 3)
[1 2 3]
;=> (tuple 1 2 3 4)
[1 2 3 4]
;=> (tuple 1 2 3 "foo")
[1 2 3 "foo"]
;=> (get0 (tuple 1 2 3 "foo"))
1
;=> (get3 (tuple 1 2 3 "foo"))
"foo"

Performance

;; run on a macbook pro with  java 7 preview
;; Fri Oct 21 12:51:51 2011
tuples.core> (let [n 1e10 t (tuple 1 2) v (vector 1 2)]
               (time (dotimes [_ n] (get0 t)))
               (time (dotimes [_ n] (nth v 0))))
"Elapsed time: 7870.339 msecs"
"Elapsed time: 130419.589 msecs"
nil
tuples.core> 

License

Copyright (C) 2012 Kevin Downey

Distributed under the Eclipse Public License, the same as Clojure.

Something went wrong with that request. Please try again.