This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(declarepath ConawWalker) | |
(providepath ConawWalker | |
(stay-then-continue | |
(cond-path map? MAP-VALS coll? ALL) | |
ConawWalker)) | |
(transform [ALL MAP-VALS ConawWalker (pred :tempid)] :tempid data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; given this data structure | |
(def data | |
[{:type :root, | |
:content | |
[{:line-type :comment, :text "#+title: Sample Org File"} | |
{:line-type :comment, :text "#+author: Seylerius"} | |
{:line-type :blank, :text ""} | |
{:line-type :paragraph, | |
:text "This is an attempt to test Org-Mode processing."} | |
{:line-type :blank, :text ""}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns specter.zip | |
(:use [com.rpl.specter.macros :only [defpath]] | |
[com.rpl specter]) | |
(:require [clojure [zip :as zip]])) | |
(def VECTOR-ZIP (view zip/vector-zip)) | |
(def NEXT (view zip/next)) | |
(def RIGHT (view zip/right)) | |
(def LEFT (view zip/left)) | |
(def DOWN (view zip/down)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use 'com.rpl.specter) | |
(use 'com.rpl.specter.macros) | |
(defprotocolpath TreeWalker []) | |
(extend-protocolpath TreeWalker | |
Object nil | |
clojure.lang.PersistentVector [ALL TreeWalker]) | |
(select [TreeWalker number?] [:a 1 [2 [[[3]]] :e] [4 5 [6 7]]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def MOVIES | |
[{:name "Lethal Weapon", :director "Paul Verhoeven", :rating 7.6} | |
{:name "RoboCop", :director "George P. Cosmatos", :rating 7.5} | |
{:name "Bad Movie", :director "James Cameron", :rating 4.2} | |
{:name "Great Movie", :director "James Cameron", :rating 10.0} | |
{:name "Lethal Weapon 3", :director "Ted Kotcheff", :rating 6.6} | |
{:name "Rambo III", :director "John McTiernan", :rating 5.4} | |
{:name "The Terminator", :director "Peter MacDonald", :rating 8.1} | |
{:name "Titanic", :director "James Cameron", :rating 8.3} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isolation.scheduler.machines: | |
"my-topology": 8 | |
"tiny-topology": 1 | |
"some-other-topology": 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stream.groupBy(new Fields("val1")) | |
.aggregate(new Fields("val2"), new Sum(), new Fields("sum")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stream.aggregate(new Fields("val2"), new Sum(), new Fields("sum")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stream.each(new Fields("x", "y"), new AddAndMultiply(), new Fields("added", "multiplied")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AddAndMultiply extends BaseFunction { | |
public void execute(TridentTuple tuple, TridentCollector collector) { | |
int i1 = tuple.getInteger(0); | |
int i2 = tuple.getInteger(1); | |
collector.emit(new Values(i1 + i2, i1 * i2)); | |
} | |
} |