Giter Site home page Giter Site logo

psychic-meme's Introduction

psychic-meme

Radix Tree for Clojure

Installation

Add the following dependency to your project.clj file:

Clojars Project

Usage

user=> (require ['psychic-meme.core :refer ['create 'add 'items 'complete]])
nil

user=> (def graph (create))
#'user/graph

user=> (def graph (add graph ["hello" "hi" "able" "help"]))
#'user/graph

user=> (items graph)
((\a \b \l \e) (\h \e \l \l \o) (\h \e \l \p) (\h \i))

user=> (for [item (items graph)] (apply str item))
("able" "hello" "help" "hi")

user=> (complete graph "he")
((\h \e \l \l \o) (\h \e \l \p))

user=> (for [item (complete graph "he")] (apply str item))
("hello" "help")

;; can be used for anything that is a sequence
user=> (def graph2 (create))
#'user/graph2

user=> (def graph2 (add graph2 [[1 2 3] [1 4 5] [2 6 7] [1 2 7]]))
#'user/graph2

user=> (items graph2)
((1 2 7) (1 2 3) (1 4 5) (2 6 7))

user=> (complete graph2 [1])
((1 2 7) (1 2 3) (1 4 5))

user=> (complete graph2 [1 2])
((1 2 7) (1 2 3))

Documentation

API

Todos

  1. Allow the user to define an equality function for comparing node values
  2. Allow the graph to be initialized with a collection. Currently (create) => (add) seems too clunky
  3. Allow updating of items in the sequence

Why is it called psychic-meme?

Couldn't think of a good name for this project, and GitHub's auto-generated name seemed like it was a pretty close fit.

License

Copyright © 2014 Chris LaVoie

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

psychic-meme's People

Contributors

clavoie avatar clavoie-dk avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.