This library is deprecated in favor of https://github.com/wagjo/data.cljs
Finger trees in Clojurescript.
Forked from https://github.com/clojure/data.finger-tree
Library is finished but tests, examples and proper packaging is not done.
Resources on finger trees:
Library is not packaged, you should copy ftree source files directly to your project.
List of functions:
- Common for all finger trees - ftree.core
- conjl - conj[oin] l[eft]. Returns a new finger tree with the xs 'added' to the left.
- conjr - conj[oin] r[ight]. Returns a new finger tree with the xs 'added' to the right.
- peekl - Returns leftmost element.
- peekr - Returns rightmost element.
- popl - Returns a new finger tree without leftmost element.
- popr - Returns a new finger tree without rightmost element.
- concat-tree - Returns tree which is a concatenation of two given trees.
- measured - Returns measure of object o. Only for measured trees.
- split-tree - Returns result of splitting tree based on a predicate. Only for measured trees.
- Bare tree - ftree.tree
- to-tree - Creates finger tree from a seq.
- create - Creates finger tree containing supplied elements.
- Seqable tree - ftree.seqable
- create - Creates seqable finger tree containing supplied elements.
- supports clojure.core seq, first, rest
- Double list - ftree.dl
- create - Creates double list containing supplied elements.
- supports clojure.core seq, first, rest, conj, peek, pop
- Counted double list - ftree.cdl
- counted-measure - Measure to be used with counted double list
- create - Creates counted double list containing supplied elements.
- insert-before - Inserts elements into cdl before i position.
- remove-at - Removes elements starting from i position.
- replace-at - Replaces elements starting from i position with new ones.
- update-at - Updates element at i position with result of calling update-fn.
- dropl - Returns a new finger tree without n leftmost elements.
- dropr - Returns a new finger tree without n rightmost elements.
- split-at - Returns splitted tree at i position. i position will be in the second tree.
- supports clojure.core seq, first, rest, conj, peek, pop, count, nth, assoc
- Setting measure - ftree.measure
- set-measure! - Sets new measure. Returns the old one.
- with-measure - macro defined in ftree/measure.clj
(ns foo.bar (:require [ftree.measure :as fm] [ftree.cdl :as fcdl] [ftree.core :as ftc])) ... (fm/set-measure! fcdl/counted-measure) (let [x (fcdl/create :a :b :c :d :e :f)] [x (first x) (rest x)]) (let [x (fcdl/create :a :b :c :d :e :f)] [(ftc/conjl x 1) (ftc/conjr x 1) (ftc/peekl x) (ftc/popr x)]) (let [x (fcdl/create :a :b :c :d :e :f :g :h :i :j :k :l :m :n :o)] [(fcdl/replace-at x 13 20 [:X :Y :Z]) (fcdl/dropr x 4) (fcdl/insert-before x 10 :X :Y :Z)])
Copyright (C) 2012, Rich Hickey, Chris Houser, Jozef Wagner.
The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by the terms of this license.
You must not remove this notice, or any other, from this software.