All Projects → clj-pour → pour

clj-pour / pour

Licence: MIT license
Declarative, composable and extensible tree querying and transformation based on EQL.

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to pour

Java-Questions-and-Solutions
This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
Stars: ✭ 34 (-5.56%)
Mutual labels:  trees
DSA--GeeksForGeeks
DSA course solutions in C++ Jump to below directly for more problems
Stars: ✭ 47 (+30.56%)
Mutual labels:  trees
tailwind-hiccup
tailwindcss + hiccup = 👍👍
Stars: ✭ 34 (-5.56%)
Mutual labels:  hiccup
finger-tree
🌵 Finger tree data structure for JavaScript
Stars: ✭ 20 (-44.44%)
Mutual labels:  trees
Hiccup
Fast library for rendering HTML in Clojure
Stars: ✭ 2,337 (+6391.67%)
Mutual labels:  hiccup
django-ltree-demo
A demo for storing and querying trees in Django using PostgreSQL
Stars: ✭ 85 (+136.11%)
Mutual labels:  trees
3013-Algorithms
Algorithms Course Repo
Stars: ✭ 15 (-58.33%)
Mutual labels:  trees
treegen
Vegetation Generation Tool for Houdini
Stars: ✭ 72 (+100%)
Mutual labels:  trees
metacoder
Parsing, Manipulation, and Visualization of Metabarcoding/Taxonomic data
Stars: ✭ 120 (+233.33%)
Mutual labels:  trees
hx
A simple, easy to use library for React development in ClojureScript.
Stars: ✭ 244 (+577.78%)
Mutual labels:  hiccup
Laravel Nestedset
Effective tree structures in Laravel 4-5
Stars: ✭ 3,045 (+8358.33%)
Mutual labels:  trees
Reagent
The idea and some of the code for making components atom-like comes from pump. The reactive-atom idea (and some code) comes from reflex.
Stars: ✭ 4,344 (+11966.67%)
Mutual labels:  hiccup
thicket
Thicket: Laubwerk Plants Add-on for Blender
Stars: ✭ 51 (+41.67%)
Mutual labels:  trees
Data-Structures-and-Algorithms
Data Structures and Algorithms implementation in Python
Stars: ✭ 31 (-13.89%)
Mutual labels:  trees
hn-clojure
Hacker News in Clojure.
Stars: ✭ 31 (-13.89%)
Mutual labels:  hiccup
DSA
Data Structures and Algorithms
Stars: ✭ 13 (-63.89%)
Mutual labels:  trees
LeetCode
Solution to LeetCode Problems in Python and Golang 🎯
Stars: ✭ 12 (-66.67%)
Mutual labels:  trees
Algorithms
Data Structures & Algorithms. Includes solutions for Cracking the Coding Interview 6th Edition
Stars: ✭ 89 (+147.22%)
Mutual labels:  trees
algorithms-in-dart
Implementation of data structures and algorithms in Dart programming language.
Stars: ✭ 189 (+425%)
Mutual labels:  trees
Algorithms-Java
A collection of common algorithms and data structures implemented in Java.
Stars: ✭ 141 (+291.67%)
Mutual labels:  trees

Pour

CircleCI

Pour consists of a library for applying EQL queries to a value, and a tool for composing queries from functions annotated with a query (examples at the bottom). The primary use case is for functions that return hiccup.

Pour allows you to define custom resolvers that can be run at arbitrary points inside a query.

It currently only supports JVM clojure but cljs support is under development.

Resolution is run inside core async processes, and runs in parallel as far as possible.

  • available as a git dependency via deps, eg (latest stable):
{:deps {pour {:git/url "https://github.com/clj-pour/pour.git"
              :sha     "07efe0455b5473dab89af6e29bc5905a74cfd118"}}}

Usage

Pour is based on EQL.

There are two arities of the main pour/pour function.

query, value

The arity-2 version is a mostly barebones implementation of extracting data from a map with EQL.

Apply the query to the provided value, eg:

(require '[pour.core :as pour])

(pour/pour [:a :b] {:a 1 :b 2 :c 3})
=> {:a 1 :b 2}

If a requested key is not present in the value, it is not present in the output.

(pour/pour [:b] {:a 1 :c 3})
=> {}

env, query, value

The Arity-3 version can take an env argument in the first position.

Here the user can specify an environment, or context, in which the query is operating. The user can supply a map of keys to resolver functions on the resolvers key on the env which, when present, will be used preferentially over direct access to the value, as in the example below.

Resolvers are functions that take two arguments - env and the current node upon which it is operating. The env can contain arbitrary data, it is up to you. The node provides the value, and the EQL information about that position in the query, eg params, type..

(pour/pour
  {:now       (inst-ms (java.util.Date.))
   :resolvers {:days-ago-timestamp (fn [{:keys [now] :as env} {:keys [value params]
                                                               :as node}]
                                     (let [days-ago (:days-ago params)
                                           days-ago-ms (* days-ago 24 60 60 1000)]
                                       (- now days-ago-ms)))}}
  '[(:days-ago-timestamp {:days-ago 7})
    :foo]
  {:foo :bar})

Compose Usage

Tool for composing and executing defcup components together. Pour knows nothing about what the output might be - that's up to you - but we'll be building hiccup in the examples below.

:coming/soon!
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].