Giter VIP home page Giter VIP logo

transduce's Introduction

NOTE: This library is totally unrelated to Clojure 1.7's new tranducers

transduce

A Clojure library providing functions for threading a state accumulator through a sequence transformation. These state/behavior pairs are sometimes called "transducers" or "state transducers".

The class of transducers which use bounded space are particularly interesting. They are known as finite state transducers.

In particular, this library provides map-state and mapcat-state, which are like their stateless namesakes. Also provided is a non-macro variant of doseq, called each. Both lazy sequence and reducers versions are available for all functions.

Usage

(require '[transduce.lazy :as t])
;OR: (require '[transduce.reducers :as t])

(do
  (->> [[:c \a] [:n 3] [:c \b] [:c \c] [:n 1] [:c \d]]
       (t/mapcat-state (fn [n [cmd arg]]
                         (case cmd
                           :n [arg nil]
                           :c [n (repeat n arg)]))
                     1)
       (t/each print))
  (println))
;=> abbbcccd
;=> nil

Installation

Transduce artifacts are published on Clojars.

To depend on this version with Lein, add the following to your project.clj:

[transduce "0.1.0"]

License

Copyright © 2013 Brandon Bloom

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

transduce's People

Contributors

brandonbloom avatar jonase avatar

Stargazers

Jane Olszewska avatar Romain Leroux avatar  avatar Ryan McGowan avatar  avatar uraimo avatar Mike Anderson avatar Nicola Mometto avatar Jakub Arnold avatar Matt Mower avatar Ralf Schmitt avatar Nils Grünwald avatar Joel Boehland avatar Ronen avatar Christoffer Sawicki avatar Andrew Cholakian avatar Zach Tellman avatar Marshall Bockrath avatar Luca Antiga avatar Noah Zucker avatar Brad Chapman avatar

Watchers

AlexBaranosky avatar  avatar James Cloos avatar  avatar

Forkers

jonase

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.