Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created February 10, 2012 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swannodette/1786095 to your computer and use it in GitHub Desktop.
Save swannodette/1786095 to your computer and use it in GitHub Desktop.
array.cljs
(extend-type array
ISeqable
(-seq [array] (array-seq array 0))
ICounted
(-count [a] (.-length a))
IIndexed
(-nth
([array n]
(if (< n (.-length array)) (aget array n)))
([array n not-found]
(if (< n (.-length array)) (aget array n)
not-found)))
ILookup
(-lookup
([array k]
(aget array k))
([array k not-found]
(-nth array k not-found)))
IReduce
(-reduce
([array f]
(ci-reduce array f))
([array f start]
(ci-reduce array f start))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment