remove unwanted files

This commit is contained in:
Nathan Marz 2015-06-24 16:21:24 -04:00
parent 67139390ca
commit ec9020b35b
82 changed files with 1 additions and 69565 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ pom.xml.asc
.lein-repl-history .lein-repl-history
.lein-plugins/ .lein-plugins/
.lein-failures .lein-failures
out/

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__465__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__465 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__466__i = 0, G__466__a = new Array(arguments.length - 0);
while (G__466__i < G__466__a.length) {G__466__a[G__466__i] = arguments[G__466__i + 0]; ++G__466__i;}
args = new cljs.core.IndexedSeq(G__466__a,0);
}
return G__465__delegate.call(this,args);};
G__465.cljs$lang$maxFixedArity = 0;
G__465.cljs$lang$applyTo = (function (arglist__467){
var args = cljs.core.seq(arglist__467);
return G__465__delegate(args);
});
G__465.cljs$core$IFn$_invoke$arity$variadic = G__465__delegate;
return G__465;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__1084__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__1084 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__1085__i = 0, G__1085__a = new Array(arguments.length - 0);
while (G__1085__i < G__1085__a.length) {G__1085__a[G__1085__i] = arguments[G__1085__i + 0]; ++G__1085__i;}
args = new cljs.core.IndexedSeq(G__1085__a,0);
}
return G__1084__delegate.call(this,args);};
G__1084.cljs$lang$maxFixedArity = 0;
G__1084.cljs$lang$applyTo = (function (arglist__1086){
var args = cljs.core.seq(arglist__1086);
return G__1084__delegate(args);
});
G__1084.cljs$core$IFn$_invoke$arity$variadic = G__1084__delegate;
return G__1084;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__715__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__715 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__716__i = 0, G__716__a = new Array(arguments.length - 0);
while (G__716__i < G__716__a.length) {G__716__a[G__716__i] = arguments[G__716__i + 0]; ++G__716__i;}
args = new cljs.core.IndexedSeq(G__716__a,0);
}
return G__715__delegate.call(this,args);};
G__715.cljs$lang$maxFixedArity = 0;
G__715.cljs$lang$applyTo = (function (arglist__717){
var args = cljs.core.seq(arglist__717);
return G__715__delegate(args);
});
G__715.cljs$core$IFn$_invoke$arity$variadic = G__715__delegate;
return G__715;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__320__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__320 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__321__i = 0, G__321__a = new Array(arguments.length - 0);
while (G__321__i < G__321__a.length) {G__321__a[G__321__i] = arguments[G__321__i + 0]; ++G__321__i;}
args = new cljs.core.IndexedSeq(G__321__a,0);
}
return G__320__delegate.call(this,args);};
G__320.cljs$lang$maxFixedArity = 0;
G__320.cljs$lang$applyTo = (function (arglist__322){
var args = cljs.core.seq(arglist__322);
return G__320__delegate(args);
});
G__320.cljs$core$IFn$_invoke$arity$variadic = G__320__delegate;
return G__320;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__473__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__473 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__474__i = 0, G__474__a = new Array(arguments.length - 0);
while (G__474__i < G__474__a.length) {G__474__a[G__474__i] = arguments[G__474__i + 0]; ++G__474__i;}
args = new cljs.core.IndexedSeq(G__474__a,0);
}
return G__473__delegate.call(this,args);};
G__473.cljs$lang$maxFixedArity = 0;
G__473.cljs$lang$applyTo = (function (arglist__475){
var args = cljs.core.seq(arglist__475);
return G__473__delegate(args);
});
G__473.cljs$core$IFn$_invoke$arity$variadic = G__473__delegate;
return G__473;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__519__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__519 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__520__i = 0, G__520__a = new Array(arguments.length - 0);
while (G__520__i < G__520__a.length) {G__520__a[G__520__i] = arguments[G__520__i + 0]; ++G__520__i;}
args = new cljs.core.IndexedSeq(G__520__a,0);
}
return G__519__delegate.call(this,args);};
G__519.cljs$lang$maxFixedArity = 0;
G__519.cljs$lang$applyTo = (function (arglist__521){
var args = cljs.core.seq(arglist__521);
return G__519__delegate(args);
});
G__519.cljs$core$IFn$_invoke$arity$variadic = G__519__delegate;
return G__519;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__1326__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__1326 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__1327__i = 0, G__1327__a = new Array(arguments.length - 0);
while (G__1327__i < G__1327__a.length) {G__1327__a[G__1327__i] = arguments[G__1327__i + 0]; ++G__1327__i;}
args = new cljs.core.IndexedSeq(G__1327__a,0);
}
return G__1326__delegate.call(this,args);};
G__1326.cljs$lang$maxFixedArity = 0;
G__1326.cljs$lang$applyTo = (function (arglist__1328){
var args = cljs.core.seq(arglist__1328);
return G__1326__delegate(args);
});
G__1326.cljs$core$IFn$_invoke$arity$variadic = G__1326__delegate;
return G__1326;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__586__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__586 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__587__i = 0, G__587__a = new Array(arguments.length - 0);
while (G__587__i < G__587__a.length) {G__587__a[G__587__i] = arguments[G__587__i + 0]; ++G__587__i;}
args = new cljs.core.IndexedSeq(G__587__a,0);
}
return G__586__delegate.call(this,args);};
G__586.cljs$lang$maxFixedArity = 0;
G__586.cljs$lang$applyTo = (function (arglist__588){
var args = cljs.core.seq(arglist__588);
return G__586__delegate(args);
});
G__586.cljs$core$IFn$_invoke$arity$variadic = G__586__delegate;
return G__586;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__424__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__424 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__425__i = 0, G__425__a = new Array(arguments.length - 0);
while (G__425__i < G__425__a.length) {G__425__a[G__425__i] = arguments[G__425__i + 0]; ++G__425__i;}
args = new cljs.core.IndexedSeq(G__425__a,0);
}
return G__424__delegate.call(this,args);};
G__424.cljs$lang$maxFixedArity = 0;
G__424.cljs$lang$applyTo = (function (arglist__426){
var args = cljs.core.seq(arglist__426);
return G__424__delegate(args);
});
G__424.cljs$core$IFn$_invoke$arity$variadic = G__424__delegate;
return G__424;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__461__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__461 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__462__i = 0, G__462__a = new Array(arguments.length - 0);
while (G__462__i < G__462__a.length) {G__462__a[G__462__i] = arguments[G__462__i + 0]; ++G__462__i;}
args = new cljs.core.IndexedSeq(G__462__a,0);
}
return G__461__delegate.call(this,args);};
G__461.cljs$lang$maxFixedArity = 0;
G__461.cljs$lang$applyTo = (function (arglist__463){
var args = cljs.core.seq(arglist__463);
return G__461__delegate(args);
});
G__461.cljs$core$IFn$_invoke$arity$variadic = G__461__delegate;
return G__461;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__322__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__322 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__323__i = 0, G__323__a = new Array(arguments.length - 0);
while (G__323__i < G__323__a.length) {G__323__a[G__323__i] = arguments[G__323__i + 0]; ++G__323__i;}
args = new cljs.core.IndexedSeq(G__323__a,0);
}
return G__322__delegate.call(this,args);};
G__322.cljs$lang$maxFixedArity = 0;
G__322.cljs$lang$applyTo = (function (arglist__324){
var args = cljs.core.seq(arglist__324);
return G__322__delegate(args);
});
G__322.cljs$core$IFn$_invoke$arity$variadic = G__322__delegate;
return G__322;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__707__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__707 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__708__i = 0, G__708__a = new Array(arguments.length - 0);
while (G__708__i < G__708__a.length) {G__708__a[G__708__i] = arguments[G__708__i + 0]; ++G__708__i;}
args = new cljs.core.IndexedSeq(G__708__a,0);
}
return G__707__delegate.call(this,args);};
G__707.cljs$lang$maxFixedArity = 0;
G__707.cljs$lang$applyTo = (function (arglist__709){
var args = cljs.core.seq(arglist__709);
return G__707__delegate(args);
});
G__707.cljs$core$IFn$_invoke$arity$variadic = G__707__delegate;
return G__707;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__963__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__963 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__964__i = 0, G__964__a = new Array(arguments.length - 0);
while (G__964__i < G__964__a.length) {G__964__a[G__964__i] = arguments[G__964__i + 0]; ++G__964__i;}
args = new cljs.core.IndexedSeq(G__964__a,0);
}
return G__963__delegate.call(this,args);};
G__963.cljs$lang$maxFixedArity = 0;
G__963.cljs$lang$applyTo = (function (arglist__965){
var args = cljs.core.seq(arglist__965);
return G__963__delegate(args);
});
G__963.cljs$core$IFn$_invoke$arity$variadic = G__963__delegate;
return G__963;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__316__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__316 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__317__i = 0, G__317__a = new Array(arguments.length - 0);
while (G__317__i < G__317__a.length) {G__317__a[G__317__i] = arguments[G__317__i + 0]; ++G__317__i;}
args = new cljs.core.IndexedSeq(G__317__a,0);
}
return G__316__delegate.call(this,args);};
G__316.cljs$lang$maxFixedArity = 0;
G__316.cljs$lang$applyTo = (function (arglist__318){
var args = cljs.core.seq(arglist__318);
return G__316__delegate(args);
});
G__316.cljs$core$IFn$_invoke$arity$variadic = G__316__delegate;
return G__316;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__842__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__842 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__843__i = 0, G__843__a = new Array(arguments.length - 0);
while (G__843__i < G__843__a.length) {G__843__a[G__843__i] = arguments[G__843__i + 0]; ++G__843__i;}
args = new cljs.core.IndexedSeq(G__843__a,0);
}
return G__842__delegate.call(this,args);};
G__842.cljs$lang$maxFixedArity = 0;
G__842.cljs$lang$applyTo = (function (arglist__844){
var args = cljs.core.seq(arglist__844);
return G__842__delegate(args);
});
G__842.cljs$core$IFn$_invoke$arity$variadic = G__842__delegate;
return G__842;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__609__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__609 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__610__i = 0, G__610__a = new Array(arguments.length - 0);
while (G__610__i < G__610__a.length) {G__610__a[G__610__i] = arguments[G__610__i + 0]; ++G__610__i;}
args = new cljs.core.IndexedSeq(G__610__a,0);
}
return G__609__delegate.call(this,args);};
G__609.cljs$lang$maxFixedArity = 0;
G__609.cljs$lang$applyTo = (function (arglist__611){
var args = cljs.core.seq(arglist__611);
return G__609__delegate(args);
});
G__609.cljs$core$IFn$_invoke$arity$variadic = G__609__delegate;
return G__609;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__516__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__516 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__517__i = 0, G__517__a = new Array(arguments.length - 0);
while (G__517__i < G__517__a.length) {G__517__a[G__517__i] = arguments[G__517__i + 0]; ++G__517__i;}
args = new cljs.core.IndexedSeq(G__517__a,0);
}
return G__516__delegate.call(this,args);};
G__516.cljs$lang$maxFixedArity = 0;
G__516.cljs$lang$applyTo = (function (arglist__518){
var args = cljs.core.seq(arglist__518);
return G__516__delegate(args);
});
G__516.cljs$core$IFn$_invoke$arity$variadic = G__516__delegate;
return G__516;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__613__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__613 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__614__i = 0, G__614__a = new Array(arguments.length - 0);
while (G__614__i < G__614__a.length) {G__614__a[G__614__i] = arguments[G__614__i + 0]; ++G__614__i;}
args = new cljs.core.IndexedSeq(G__614__a,0);
}
return G__613__delegate.call(this,args);};
G__613.cljs$lang$maxFixedArity = 0;
G__613.cljs$lang$applyTo = (function (arglist__615){
var args = cljs.core.seq(arglist__615);
return G__613__delegate(args);
});
G__613.cljs$core$IFn$_invoke$arity$variadic = G__613__delegate;
return G__613;
})()
;
});

View file

@ -1,12 +0,0 @@
goog.provide('cljs.nodejscli');
goog.require('cljs.core');
goog.require('cljs.nodejs');
if(COMPILED){
goog.global = global;
} else {
}
if(((cljs.core._STAR_main_cli_fn_STAR_ == null)) || (!(cljs.core.fn_QMARK_.call(null,cljs.core._STAR_main_cli_fn_STAR_)))){
throw (new Error("cljs.core/*main-cli-fn* not set"));
} else {
cljs.core.apply.call(null,cljs.core._STAR_main_cli_fn_STAR_,cljs.core.drop.call(null,(2),cljs.nodejs.process.argv));
}

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__1205__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__1205 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__1206__i = 0, G__1206__a = new Array(arguments.length - 0);
while (G__1206__i < G__1206__a.length) {G__1206__a[G__1206__i] = arguments[G__1206__i + 0]; ++G__1206__i;}
args = new cljs.core.IndexedSeq(G__1206__a,0);
}
return G__1205__delegate.call(this,args);};
G__1205.cljs$lang$maxFixedArity = 0;
G__1205.cljs$lang$applyTo = (function (arglist__1207){
var args = cljs.core.seq(arglist__1207);
return G__1205__delegate(args);
});
G__1205.cljs$core$IFn$_invoke$arity$variadic = G__1205__delegate;
return G__1205;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__326__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__326 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__327__i = 0, G__327__a = new Array(arguments.length - 0);
while (G__327__i < G__327__a.length) {G__327__a[G__327__i] = arguments[G__327__i + 0]; ++G__327__i;}
args = new cljs.core.IndexedSeq(G__327__a,0);
}
return G__326__delegate.call(this,args);};
G__326.cljs$lang$maxFixedArity = 0;
G__326.cljs$lang$applyTo = (function (arglist__328){
var args = cljs.core.seq(arglist__328);
return G__326__delegate(args);
});
G__326.cljs$core$IFn$_invoke$arity$variadic = G__326__delegate;
return G__326;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__1914__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__1914 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__1915__i = 0, G__1915__a = new Array(arguments.length - 0);
while (G__1915__i < G__1915__a.length) {G__1915__a[G__1915__i] = arguments[G__1915__i + 0]; ++G__1915__i;}
args = new cljs.core.IndexedSeq(G__1915__a,0);
}
return G__1914__delegate.call(this,args);};
G__1914.cljs$lang$maxFixedArity = 0;
G__1914.cljs$lang$applyTo = (function (arglist__1916){
var args = cljs.core.seq(arglist__1916);
return G__1914__delegate(args);
});
G__1914.cljs$core$IFn$_invoke$arity$variadic = G__1914__delegate;
return G__1914;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__243__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__243 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__244__i = 0, G__244__a = new Array(arguments.length - 0);
while (G__244__i < G__244__a.length) {G__244__a[G__244__i] = arguments[G__244__i + 0]; ++G__244__i;}
args = new cljs.core.IndexedSeq(G__244__a,0);
}
return G__243__delegate.call(this,args);};
G__243.cljs$lang$maxFixedArity = 0;
G__243.cljs$lang$applyTo = (function (arglist__245){
var args = cljs.core.seq(arglist__245);
return G__243__delegate(args);
});
G__243.cljs$core$IFn$_invoke$arity$variadic = G__243__delegate;
return G__243;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__684__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__684 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__685__i = 0, G__685__a = new Array(arguments.length - 0);
while (G__685__i < G__685__a.length) {G__685__a[G__685__i] = arguments[G__685__i + 0]; ++G__685__i;}
args = new cljs.core.IndexedSeq(G__685__a,0);
}
return G__684__delegate.call(this,args);};
G__684.cljs$lang$maxFixedArity = 0;
G__684.cljs$lang$applyTo = (function (arglist__686){
var args = cljs.core.seq(arglist__686);
return G__684__delegate(args);
});
G__684.cljs$core$IFn$_invoke$arity$variadic = G__684__delegate;
return G__684;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__594__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__594 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__595__i = 0, G__595__a = new Array(arguments.length - 0);
while (G__595__i < G__595__a.length) {G__595__a[G__595__i] = arguments[G__595__i + 0]; ++G__595__i;}
args = new cljs.core.IndexedSeq(G__595__a,0);
}
return G__594__delegate.call(this,args);};
G__594.cljs$lang$maxFixedArity = 0;
G__594.cljs$lang$applyTo = (function (arglist__596){
var args = cljs.core.seq(arglist__596);
return G__594__delegate(args);
});
G__594.cljs$core$IFn$_invoke$arity$variadic = G__594__delegate;
return G__594;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__423__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__423 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__424__i = 0, G__424__a = new Array(arguments.length - 0);
while (G__424__i < G__424__a.length) {G__424__a[G__424__i] = arguments[G__424__i + 0]; ++G__424__i;}
args = new cljs.core.IndexedSeq(G__424__a,0);
}
return G__423__delegate.call(this,args);};
G__423.cljs$lang$maxFixedArity = 0;
G__423.cljs$lang$applyTo = (function (arglist__425){
var args = cljs.core.seq(arglist__425);
return G__423__delegate(args);
});
G__423.cljs$core$IFn$_invoke$arity$variadic = G__423__delegate;
return G__423;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__566__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__566 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__567__i = 0, G__567__a = new Array(arguments.length - 0);
while (G__567__i < G__567__a.length) {G__567__a[G__567__i] = arguments[G__567__i + 0]; ++G__567__i;}
args = new cljs.core.IndexedSeq(G__567__a,0);
}
return G__566__delegate.call(this,args);};
G__566.cljs$lang$maxFixedArity = 0;
G__566.cljs$lang$applyTo = (function (arglist__568){
var args = cljs.core.seq(arglist__568);
return G__566__delegate(args);
});
G__566.cljs$core$IFn$_invoke$arity$variadic = G__566__delegate;
return G__566;
})()
;
});

View file

@ -1,29 +0,0 @@
goog.provide('cljs.nodejs');
goog.require('cljs.core');
cljs.nodejs.require = require;
cljs.nodejs.process = process;
cljs.nodejs.enable_util_print_BANG_ = (function cljs$nodejs$enable_util_print_BANG_(){
cljs.core._STAR_print_newline_STAR_ = false;
return cljs.core._STAR_print_fn_STAR_ = (function() {
var G__366__delegate = function (args){
return console.log.apply(console,cljs.core.into_array.call(null,args));
};
var G__366 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__367__i = 0, G__367__a = new Array(arguments.length - 0);
while (G__367__i < G__367__a.length) {G__367__a[G__367__i] = arguments[G__367__i + 0]; ++G__367__i;}
args = new cljs.core.IndexedSeq(G__367__a,0);
}
return G__366__delegate.call(this,args);};
G__366.cljs$lang$maxFixedArity = 0;
G__366.cljs$lang$applyTo = (function (arglist__368){
var args = cljs.core.seq(arglist__368);
return G__366__delegate(args);
});
G__366.cljs$core$IFn$_invoke$arity$variadic = G__366__delegate;
return G__366;
})()
;
});

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,22 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; 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.
; Projects compiled with :target :nodejs can 'require' this namespace
; to get the nodejs globals loaded into cljs.nodejs and get
; ClojureScript's 'print' set up correctly.
(ns cljs.nodejs)
; Define namespaced references to Node's externed globals:
(def require (js* "require"))
(def process (js* "process"))
(defn enable-util-print! []
(set! *print-newline* false)
(set! *print-fn*
(fn [& args]
(.apply (.-log js/console) js/console (into-array args)))))

View file

@ -1,24 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; 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.
; Projects compiled with :target :nodejs have this file appended. Its
; job is to make sure cljs.nodejs is loaded and that the *main-cli-fn*
; is called with the script's command-line arguments.
(ns cljs.nodejscli
(:require [cljs.nodejs :as nodejs]))
;; need to set js/goog.global if COMPILED
(when ^boolean js/COMPILED
(set! js/goog.global js/global))
;; Call the user's main function
(if (or (nil? cljs.core/*main-cli-fn*)
(not (fn? cljs.core/*main-cli-fn*)))
(throw (js/Error. "cljs.core/*main-cli-fn* not set"))
(apply cljs.core/*main-cli-fn* (drop 2 (.-argv nodejs/process))))

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,49 +0,0 @@
;; Copyright (c) Rich Hickey. All rights reserved.
;; 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.
(ns cljs.repl
(:require-macros cljs.repl))
(defn print-doc [m]
(println "-------------------------")
(println (str (when-let [ns (:ns m)] (str ns "/")) (:name m)))
(when (:protocol m)
(println "Protocol"))
(cond
(:forms m) (doseq [f (:forms m)]
(println " " f))
(:arglists m) (let [arglists (:arglists m)]
(if (or (:macro m)
(:repl-special-function m))
(prn arglists)
(prn
(if (= 'quote (first arglists))
(second arglists)
arglists)))))
(if (:special-form m)
(do
(println "Special Form")
(println " " (:doc m))
(if (contains? m :url)
(when (:url m)
(println (str "\n Please see http://clojure.org/" (:url m))))
(println (str "\n Please see http://clojure.org/special_forms#"
(:name m)))))
(do
(when (:macro m)
(println "Macro"))
(when (:repl-special-function m)
(println "REPL Special Function"))
(println " " (:doc m))
(when (:protocol m)
(doseq [[name {:keys [doc arglists]}] (:methods m)]
(println)
(println " " name)
(println " " arglists)
(when doc
(println " " doc)))))))

View file

@ -1,2 +0,0 @@
;; Analyzed by ClojureScript 0.0-3308
{:use-macros nil, :excludes #{}, :name cljs.repl, :imports nil, :requires nil, :uses nil, :defs {print-doc {:protocol-inline nil, :meta {:file "/Users/pietromenna/git/specter/out/cljs/repl.cljs", :line 12, :column 7, :end-line 12, :end-column 16, :arglists (quote ([m]))}, :name cljs.repl/print-doc, :variadic false, :file "out/cljs/repl.cljs", :end-column 16, :method-params ([m]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 12, :end-line 12, :max-fixed-arity 1, :fn-var true, :arglists (quote ([m]))}}, :require-macros {cljs.repl cljs.repl}, :cljs.analyzer/constants {:seen #{:protocol :ns :name :special-form :repl-special-function :methods :macro :url :arglists :doc :forms}, :order [:ns :name :protocol :forms :arglists :macro :repl-special-function :special-form :doc :url :methods]}, :doc nil}

View file

@ -1,207 +0,0 @@
// Compiled by ClojureScript 0.0-3308 {:target :nodejs}
goog.provide('cljs.repl');
goog.require('cljs.core');
cljs.repl.print_doc = (function cljs$repl$print_doc(m){
cljs.core.println.call(null,"-------------------------");
cljs.core.println.call(null,[cljs.core.str((function (){var temp__4423__auto__ = new cljs.core.Keyword(null,"ns","ns",441598760).cljs$core$IFn$_invoke$arity$1(m);
if(cljs.core.truth_(temp__4423__auto__)){
var ns = temp__4423__auto__;
return [cljs.core.str(ns),cljs.core.str("/")].join('');
} else {
return null;
}
})()),cljs.core.str(new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(m))].join(''));
if(cljs.core.truth_(new cljs.core.Keyword(null,"protocol","protocol",652470118).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.call(null,"Protocol");
} else {
}
if(cljs.core.truth_(new cljs.core.Keyword(null,"forms","forms",2045992350).cljs$core$IFn$_invoke$arity$1(m))){
var seq__1866_1878 = cljs.core.seq.call(null,new cljs.core.Keyword(null,"forms","forms",2045992350).cljs$core$IFn$_invoke$arity$1(m));
var chunk__1867_1879 = null;
var count__1868_1880 = (0);
var i__1869_1881 = (0);
while(true){
if((i__1869_1881 < count__1868_1880)){
var f_1882 = cljs.core._nth.call(null,chunk__1867_1879,i__1869_1881);
cljs.core.println.call(null," ",f_1882);
var G__1883 = seq__1866_1878;
var G__1884 = chunk__1867_1879;
var G__1885 = count__1868_1880;
var G__1886 = (i__1869_1881 + (1));
seq__1866_1878 = G__1883;
chunk__1867_1879 = G__1884;
count__1868_1880 = G__1885;
i__1869_1881 = G__1886;
continue;
} else {
var temp__4423__auto___1887 = cljs.core.seq.call(null,seq__1866_1878);
if(temp__4423__auto___1887){
var seq__1866_1888__$1 = temp__4423__auto___1887;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__1866_1888__$1)){
var c__3739__auto___1889 = cljs.core.chunk_first.call(null,seq__1866_1888__$1);
var G__1890 = cljs.core.chunk_rest.call(null,seq__1866_1888__$1);
var G__1891 = c__3739__auto___1889;
var G__1892 = cljs.core.count.call(null,c__3739__auto___1889);
var G__1893 = (0);
seq__1866_1878 = G__1890;
chunk__1867_1879 = G__1891;
count__1868_1880 = G__1892;
i__1869_1881 = G__1893;
continue;
} else {
var f_1894 = cljs.core.first.call(null,seq__1866_1888__$1);
cljs.core.println.call(null," ",f_1894);
var G__1895 = cljs.core.next.call(null,seq__1866_1888__$1);
var G__1896 = null;
var G__1897 = (0);
var G__1898 = (0);
seq__1866_1878 = G__1895;
chunk__1867_1879 = G__1896;
count__1868_1880 = G__1897;
i__1869_1881 = G__1898;
continue;
}
} else {
}
}
break;
}
} else {
if(cljs.core.truth_(new cljs.core.Keyword(null,"arglists","arglists",1661989754).cljs$core$IFn$_invoke$arity$1(m))){
var arglists_1899 = new cljs.core.Keyword(null,"arglists","arglists",1661989754).cljs$core$IFn$_invoke$arity$1(m);
if(cljs.core.truth_((function (){var or__3370__auto__ = new cljs.core.Keyword(null,"macro","macro",-867863404).cljs$core$IFn$_invoke$arity$1(m);
if(cljs.core.truth_(or__3370__auto__)){
return or__3370__auto__;
} else {
return new cljs.core.Keyword(null,"repl-special-function","repl-special-function",1262603725).cljs$core$IFn$_invoke$arity$1(m);
}
})())){
cljs.core.prn.call(null,arglists_1899);
} else {
cljs.core.prn.call(null,((cljs.core._EQ_.call(null,new cljs.core.Symbol(null,"quote","quote",1377916282,null),cljs.core.first.call(null,arglists_1899)))?cljs.core.second.call(null,arglists_1899):arglists_1899));
}
} else {
}
}
if(cljs.core.truth_(new cljs.core.Keyword(null,"special-form","special-form",-1326536374).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.call(null,"Special Form");
cljs.core.println.call(null," ",new cljs.core.Keyword(null,"doc","doc",1913296891).cljs$core$IFn$_invoke$arity$1(m));
if(cljs.core.contains_QMARK_.call(null,m,new cljs.core.Keyword(null,"url","url",276297046))){
if(cljs.core.truth_(new cljs.core.Keyword(null,"url","url",276297046).cljs$core$IFn$_invoke$arity$1(m))){
return cljs.core.println.call(null,[cljs.core.str("\n Please see http://clojure.org/"),cljs.core.str(new cljs.core.Keyword(null,"url","url",276297046).cljs$core$IFn$_invoke$arity$1(m))].join(''));
} else {
return null;
}
} else {
return cljs.core.println.call(null,[cljs.core.str("\n Please see http://clojure.org/special_forms#"),cljs.core.str(new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(m))].join(''));
}
} else {
if(cljs.core.truth_(new cljs.core.Keyword(null,"macro","macro",-867863404).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.call(null,"Macro");
} else {
}
if(cljs.core.truth_(new cljs.core.Keyword(null,"repl-special-function","repl-special-function",1262603725).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.call(null,"REPL Special Function");
} else {
}
cljs.core.println.call(null," ",new cljs.core.Keyword(null,"doc","doc",1913296891).cljs$core$IFn$_invoke$arity$1(m));
if(cljs.core.truth_(new cljs.core.Keyword(null,"protocol","protocol",652470118).cljs$core$IFn$_invoke$arity$1(m))){
var seq__1870 = cljs.core.seq.call(null,new cljs.core.Keyword(null,"methods","methods",453930866).cljs$core$IFn$_invoke$arity$1(m));
var chunk__1871 = null;
var count__1872 = (0);
var i__1873 = (0);
while(true){
if((i__1873 < count__1872)){
var vec__1874 = cljs.core._nth.call(null,chunk__1871,i__1873);
var name = cljs.core.nth.call(null,vec__1874,(0),null);
var map__1875 = cljs.core.nth.call(null,vec__1874,(1),null);
var map__1875__$1 = ((cljs.core.seq_QMARK_.call(null,map__1875))?cljs.core.apply.call(null,cljs.core.hash_map,map__1875):map__1875);
var doc = cljs.core.get.call(null,map__1875__$1,new cljs.core.Keyword(null,"doc","doc",1913296891));
var arglists = cljs.core.get.call(null,map__1875__$1,new cljs.core.Keyword(null,"arglists","arglists",1661989754));
cljs.core.println.call(null);
cljs.core.println.call(null," ",name);
cljs.core.println.call(null," ",arglists);
if(cljs.core.truth_(doc)){
cljs.core.println.call(null," ",doc);
} else {
}
var G__1900 = seq__1870;
var G__1901 = chunk__1871;
var G__1902 = count__1872;
var G__1903 = (i__1873 + (1));
seq__1870 = G__1900;
chunk__1871 = G__1901;
count__1872 = G__1902;
i__1873 = G__1903;
continue;
} else {
var temp__4423__auto__ = cljs.core.seq.call(null,seq__1870);
if(temp__4423__auto__){
var seq__1870__$1 = temp__4423__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__1870__$1)){
var c__3739__auto__ = cljs.core.chunk_first.call(null,seq__1870__$1);
var G__1904 = cljs.core.chunk_rest.call(null,seq__1870__$1);
var G__1905 = c__3739__auto__;
var G__1906 = cljs.core.count.call(null,c__3739__auto__);
var G__1907 = (0);
seq__1870 = G__1904;
chunk__1871 = G__1905;
count__1872 = G__1906;
i__1873 = G__1907;
continue;
} else {
var vec__1876 = cljs.core.first.call(null,seq__1870__$1);
var name = cljs.core.nth.call(null,vec__1876,(0),null);
var map__1877 = cljs.core.nth.call(null,vec__1876,(1),null);
var map__1877__$1 = ((cljs.core.seq_QMARK_.call(null,map__1877))?cljs.core.apply.call(null,cljs.core.hash_map,map__1877):map__1877);
var doc = cljs.core.get.call(null,map__1877__$1,new cljs.core.Keyword(null,"doc","doc",1913296891));
var arglists = cljs.core.get.call(null,map__1877__$1,new cljs.core.Keyword(null,"arglists","arglists",1661989754));
cljs.core.println.call(null);
cljs.core.println.call(null," ",name);
cljs.core.println.call(null," ",arglists);
if(cljs.core.truth_(doc)){
cljs.core.println.call(null," ",doc);
} else {
}
var G__1908 = cljs.core.next.call(null,seq__1870__$1);
var G__1909 = null;
var G__1910 = (0);
var G__1911 = (0);
seq__1870 = G__1908;
chunk__1871 = G__1909;
count__1872 = G__1910;
i__1873 = G__1911;
continue;
}
} else {
return null;
}
}
break;
}
} else {
return null;
}
}
});
//# sourceMappingURL=repl.js.map

View file

@ -1 +0,0 @@
{"version":3,"file":"\/Users\/pietromenna\/git\/specter\/out\/cljs\/repl.js","sources":["repl.cljs"],"lineCount":207,"mappings":";AAQA;;AAGA,sBAAA,tBAAMA,oDAAWC;AAAjB,AACE,4BAAA,5BAACC;;AACD,AAACA,4BAAQ,eAAK,iBAAAC,qBAAc,AAAA,8EAAKF;AAAnB,AAAA,oBAAAE;AAAA,AAAA,SAAAA,LAAWC;AAAX,AAAuB,wCAAA,lBAAKA;;AAA5B;;oBAAqC,AAAA,mFAAOH;;AAC1D,oBAAM,AAAA,0FAAWA;AAAjB,AACE,4BAAA,5BAACC;;AADH;;AAEA,oBACE,AAAA,qFAAQD;AAAG,IAAAI,iBAAA,AAAAC,wBAAU,AAAA,qFAAQL;IAAlBM,mBAAA;IAAAC,mBAAA;IAAAC,eAAA;;AAAA,AAAA,GAAA,AAAA,CAAAA,eAAAD;AAAA,aAAA,AAAAE,yBAAAH,iBAAAE,nDAAQS;AAAR,AAAA,AACE,4BAAA,5BAAChB,iCAAagB;;AADhB,cAAAb;cAAAE;cAAAC;cAAA,CAAAC,eAAA;;;;;;;AAAA,IAAAN,0BAAA,AAAAG,wBAAAD;AAAA,AAAA,GAAAF;AAAA,AAAA,IAAAE,qBAAAF;AAAA,AAAA,GAAA,AAAAQ,uCAAAN;AAAA,IAAAO,uBAAA,AAAAC,gCAAAR;AAAA,AAAA,cAAA,AAAAS,+BAAAT;cAAAO;cAAA,AAAAG,0BAAAH;cAAA;;;;;;;AAAA,aAAA,AAAAI,0BAAAX,nCAAQa;AAAR,AAAA,AACE,4BAAA,5BAAChB,iCAAagB;;AADhB,cAAA,AAAAD,yBAAAZ;cAAA;cAAA;cAAA;;;;;;;;AAAA;;;;;AADb,oBAGE,AAAA,2FAAWJ;AAAG,IAAMkB,gBAAS,AAAA,2FAAWlB;AAA1B,AACE,oBAAI,iBAAAmB,mBAAI,AAAA,qFAAQnB;AAAZ,AAAA,oBAAAmB;AAAAA;;AACC,OAAA,qHAAwBnB;;;AAC5B,AAACoB,wBAAIF;;AACL,AAACE,wBACC,EAAI,yBAAA,zBAACC,oFAAS,AAACN,0BAAMG,iBACnB,AAACI,2BAAOJ,eACRA;;;AAVvB;;;AAWA,oBAAI,AAAA,oGAAelB;AACjB,AACE,4BAAA,5BAACC;;AACD,4BAAA,5BAACA,gCAAY,AAAA,iFAAMD;;AACnB,GAAI,sCAAA,tCAACuB,oCAAUvB;AACb,oBAAM,AAAA,gFAAMA;AAAZ,AACE,OAACC,4BAAQ,eAAA,oDAA0C,AAAA,gFAAMD;;AAD3D;;;AAEA,OAACC,4BAAQ,eAAA,kEACE,AAAA,mFAAOD;;;AACtB,AACE,oBAAM,AAAA,qFAAQA;AAAd,AACE,4BAAA,5BAACC;;AADH;;AAEA,oBAAM,AAAA,qHAAwBD;AAA9B,AACE,4BAAA,5BAACC;;AADH;;AAEA,4BAAA,5BAACA,gCAAY,AAAA,iFAAMD;;AACnB,oBAAM,AAAA,0FAAWA;AAAjB,AACE,IAAAwB,YAAA,AAAAnB,wBAAsC,AAAA,wFAAUL;IAAhDyB,cAAA;IAAAC,cAAA;IAAAC,UAAA;;AAAA,AAAA,GAAA,AAAA,CAAAA,UAAAD;AAAA,IAAAE,YAAA,AAAAnB,yBAAAgB,YAAAE;WAAA,AAAAE,wBAAAD,UAAA,IAAA,7CAASS;IAATP,YAAA,AAAAD,wBAAAD,UAAA,IAAA;IAAAE,gBAAA,EAAA,AAAAC,+BAAAD,YAAA,AAAAE,0BAAAC,mBAAAH,WAAAA;UAAA,AAAAI,wBAAAJ,cAAA,5CAAsBQ;eAAtB,AAAAJ,wBAAAJ,cAAA,jDAA0BZ;AAA1B,AAAA,AACE,AAACjB;;AACD,4BAAA,5BAACA,gCAAYoC;;AACb,4BAAA,5BAACpC,gCAAYiB;;AACb,oBAAMoB;AAAN,AACE,4BAAA,5BAACrC,gCAAYqC;;AADf;;AAJF,cAAAd;cAAAC;cAAAC;cAAA,CAAAC,UAAA;;;;;;;AAAA,IAAAzB,qBAAA,AAAAG,wBAAAmB;AAAA,AAAA,GAAAtB;AAAA,AAAA,IAAAsB,gBAAAtB;AAAA,AAAA,GAAA,AAAAQ,uCAAAc;AAAA,IAAAb,kBAAA,AAAAC,gCAAAY;AAAA,AAAA,cAAA,AAAAX,+BAAAW;cAAAb;cAAA,AAAAG,0BAAAH;cAAA;;;;;;;AAAA,IAAAwB,YAAA,AAAApB,0BAAAS;WAAA,AAAAK,wBAAAM,UAAA,IAAA,7CAASE;IAATD,YAAA,AAAAP,wBAAAM,UAAA,IAAA;IAAAC,gBAAA,EAAA,AAAAL,+BAAAK,YAAA,AAAAJ,0BAAAC,mBAAAG,WAAAA;UAAA,AAAAF,wBAAAE,cAAA,5CAAsBE;eAAtB,AAAAJ,wBAAAE,cAAA,jDAA0BlB;AAA1B,AAAA,AACE,AAACjB;;AACD,4BAAA,5BAACA,gCAAYoC;;AACb,4BAAA,5BAACpC,gCAAYiB;;AACb,oBAAMoB;AAAN,AACE,4BAAA,5BAACrC,gCAAYqC;;AADf;;AAJF,cAAA,AAAAtB,yBAAAQ;cAAA;cAAA;cAAA;;;;;;;;AAAA;;;;;;AADF","names":["cljs.repl\/print-doc","m","cljs.core\/println","temp__4423__auto__","ns","seq__1866","cljs.core\/seq","chunk__1867","count__1868","i__1869","cljs.core\/-nth","cljs.core\/chunked-seq?","c__3739__auto__","cljs.core\/chunk-first","cljs.core\/chunk-rest","cljs.core\/count","cljs.core\/first","cljs.core\/next","f","arglists","or__3370__auto__","cljs.core\/prn","cljs.core\/=","cljs.core\/second","cljs.core\/contains?","seq__1870","chunk__1871","count__1872","i__1873","vec__1874","cljs.core\/nth","map__1875","cljs.core\/seq?","cljs.core\/apply","cljs.core\/hash-map","cljs.core\/get","vec__1876","map__1877","name","doc"]}

View file

@ -1 +0,0 @@
goog.addDependency("base.js", ['goog'], []);

View file

@ -1,312 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; 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.
(ns ^{:doc
"A library for reduction and parallel folding. Alpha and subject
to change. Note that fold and its derivatives require
jsr166y.jar for fork/join support. See Clojure's pom.xml for the
dependency info."
:author "Rich Hickey"}
clojure.core.reducers
(:refer-clojure :exclude [reduce map mapcat filter remove take take-while drop flatten cat])
(:require [cljs.core :as core]))
;;;;;;;;;;;;;; some fj stuff ;;;;;;;;;;
(defn- fjtask [f]
f)
(defn- fjinvoke [f]
(f))
(defn- fjfork [task]
task)
(defn- fjjoin [task]
(task))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn reduce
"Like core/reduce except:
When init is not provided, (f) is used.
Maps are reduced with reduce-kv"
([f coll] (reduce f (f) coll))
([f init coll]
(if (map? coll)
(-kv-reduce coll f init)
(cond
(nil? coll) init
(array? coll) (array-reduce coll f init)
:else (-reduce coll f init)))))
(defprotocol CollFold
(coll-fold [coll n combinef reducef]))
(defn fold
"Reduces a collection using a (potentially parallel) reduce-combine
strategy. The collection is partitioned into groups of approximately
n (default 512), each of which is reduced with reducef (with a seed
value obtained by calling (combinef) with no arguments). The results
of these reductions are then reduced with combinef (default
reducef). combinef must be associative, and, when called with no
arguments, (combinef) must produce its identity element. These
operations may be performed in parallel, but the results will
preserve order.
Note: Performing operations in parallel is currently not implemented."
([reducef coll] (fold reducef reducef coll))
([combinef reducef coll] (fold 512 combinef reducef coll))
([n combinef reducef coll]
(coll-fold coll n combinef reducef)))
(defn reducer
"Given a reducible collection, and a transformation function xf,
returns a reducible collection, where any supplied reducing
fn will be transformed by xf. xf is a function of reducing fn to
reducing fn."
([coll xf]
(reify
cljs.core/IReduce
(-reduce [this f1]
(-reduce this f1 (f1)))
(-reduce [_ f1 init]
(-reduce coll (xf f1) init)))))
(defn folder
"Given a foldable collection, and a transformation function xf,
returns a foldable collection, where any supplied reducing
fn will be transformed by xf. xf is a function of reducing fn to
reducing fn."
([coll xf]
(reify
cljs.core/IReduce
(-reduce [_ f1]
(-reduce coll (xf f1) (f1)))
(-reduce [_ f1 init]
(-reduce coll (xf f1) init))
CollFold
(coll-fold [_ n combinef reducef]
(coll-fold coll n combinef (xf reducef))))))
(defcurried map
"Applies f to every value in the reduction of coll. Foldable."
{}
[f coll]
(folder coll
(fn [f1]
(rfn [f1 k]
([ret k v]
(f1 ret (f k v)))))))
(defcurried mapcat
"Applies f to every value in the reduction of coll, concatenating the result
colls of (f val). Foldable."
{}
[f coll]
(folder coll
(fn [f1]
(rfn [f1 k]
([ret k v]
(reduce f1 ret (f k v)))))))
(defcurried filter
"Retains values in the reduction of coll for which (pred val)
returns logical true. Foldable."
{}
[pred coll]
(folder coll
(fn [f1]
(rfn [f1 k]
([ret k v]
(if (pred k v)
(f1 ret k v)
ret))))))
(defcurried flatten
"Takes any nested combination of sequential things (lists, vectors,
etc.) and returns their contents as a single, flat foldable
collection."
{}
[coll]
(folder coll
(fn [f1]
(fn
([] (f1))
([ret v]
(if (sequential? v)
(-reduce (flatten v) f1 ret)
(f1 ret v)))))))
(defcurried remove
"Removes values in the reduction of coll for which (pred val)
returns logical true. Foldable."
{}
[pred coll]
(filter (complement pred) coll))
(defcurried take-while
"Ends the reduction of coll when (pred val) returns logical false."
{}
[pred coll]
(reducer coll
(fn [f1]
(rfn [f1 k]
([ret k v]
(if (pred k v)
(f1 ret k v)
(reduced ret)))))))
(defcurried take
"Ends the reduction of coll after consuming n values."
{}
[n coll]
(reducer coll
(fn [f1]
(let [cnt (atom n)]
(rfn [f1 k]
([ret k v]
(swap! cnt dec)
(if (neg? @cnt)
(reduced ret)
(f1 ret k v))))))))
(defcurried drop
"Elides the first n values from the reduction of coll."
{}
[n coll]
(reducer coll
(fn [f1]
(let [cnt (atom n)]
(rfn [f1 k]
([ret k v]
(swap! cnt dec)
(if (neg? @cnt)
(f1 ret k v)
ret)))))))
;;do not construct this directly, use cat
(deftype Cat [cnt left right]
cljs.core/ICounted
(-count [_] cnt)
cljs.core/ISeqable
(-seq [_] (concat (seq left) (seq right)))
cljs.core/IReduce
(-reduce [this f1] (-reduce this f1 (f1)))
(-reduce
[_ f1 init]
(-reduce
right f1
(-reduce left f1 init)))
CollFold
(coll-fold
[this n combinef reducef]
(-reduce this reducef)))
(defn cat
"A high-performance combining fn that yields the catenation of the
reduced values. The result is reducible, foldable, seqable and
counted, providing the identity collections are reducible, seqable
and counted. The single argument version will build a combining fn
with the supplied identity constructor. Tests for identity
with (zero? (count x)). See also foldcat."
([] (array))
([ctor]
(fn
([] (ctor))
([left right] (cat left right))))
([left right]
(cond
(zero? (count left)) right
(zero? (count right)) left
:else
(Cat. (+ (count left) (count right)) left right))))
(defn append!
".adds x to acc and returns acc"
[acc x]
(doto acc (.push x)))
(defn foldcat
"Equivalent to (fold cat append! coll)"
[coll]
(fold cat append! coll))
(defn monoid
"Builds a combining fn out of the supplied operator and identity
constructor. op must be associative and ctor called with no args
must return an identity value for it."
[op ctor]
(fn m
([] (ctor))
([a b] (op a b))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(comment
(require '[clojure.core.reduce :as r])
(def v (take 1000000 (range)))
(reduce + 0 (r/map inc [1 2 3 4]))
(into [] (r/take 12 (range 100)))
(into [] (r/drop 12 (range 100)))
(reduce + 0 (r/filter even? [1 2 3 4]))
(into [] (r/filter even? [1 2 3 4]))
(reduce + (filter even? [1 2 3 4]))
(dotimes [_ 10] (time (reduce + 0 (r/map inc v))))
(dotimes [_ 10] (time (reduce + 0 (map inc v))))
(dotimes [_ 100] (time (reduce + 0 v)))
(dotimes [_ 100] (time (reduce + 0 v)))
(dotimes [_ 20] (time (reduce + 0 (r/map inc (r/filter even? v)))))
(dotimes [_ 20] (time (reduce + 0 (map inc (filter even? v)))))
(reduce + 0 (r/take-while even? [2 4 3]))
(into [] (r/filter even? (r/flatten (r/remove #{4} [[1 2 3] 4 [5 [6 7 8]] [9] 10]))))
(into [] (r/flatten nil))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; fold impls ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn- foldvec
[v n combinef reducef]
(cond
(empty? v) (combinef)
(<= (count v) n) (reduce reducef (combinef) v)
:else
(let [split (quot (count v) 2)
v1 (subvec v 0 split)
v2 (subvec v split (count v))
fc (fn [child] #(foldvec child n combinef reducef))]
(fjinvoke
#(let [f1 (fc v1)
t2 (fjtask (fc v2))]
(fjfork t2)
(combinef (f1) (fjjoin t2)))))))
(extend-protocol CollFold
nil
(coll-fold
[coll n combinef reducef]
(combinef))
object
(coll-fold
[coll n combinef reducef]
;;can't fold, single reduce
(reduce reducef (combinef) coll))
cljs.core/PersistentVector
(coll-fold
[v n combinef reducef]
(foldvec v n combinef reducef))
#_
cljs.core/PersistentHashMap
#_
(coll-fold
[m n combinef reducef]
(.fold m n combinef reducef fjinvoke fjtask fjfork fjjoin)))

File diff suppressed because one or more lines are too long

View file

@ -1,994 +0,0 @@
// Compiled by ClojureScript 0.0-3308 {:target :nodejs}
goog.provide('clojure.core.reducers');
goog.require('cljs.core');
goog.require('cljs.core');
clojure.core.reducers.fjtask = (function clojure$core$reducers$fjtask(f){
return f;
});
clojure.core.reducers.fjinvoke = (function clojure$core$reducers$fjinvoke(f){
return f.call(null);
});
clojure.core.reducers.fjfork = (function clojure$core$reducers$fjfork(task){
return task;
});
clojure.core.reducers.fjjoin = (function clojure$core$reducers$fjjoin(task){
return task.call(null);
});
/**
* Like core/reduce except:
* When init is not provided, (f) is used.
* Maps are reduced with reduce-kv
*/
clojure.core.reducers.reduce = (function clojure$core$reducers$reduce(){
var G__342 = arguments.length;
switch (G__342) {
case 2:
return clojure.core.reducers.reduce.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.core.reducers.reduce.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.reduce.cljs$core$IFn$_invoke$arity$2 = (function (f,coll){
return clojure.core.reducers.reduce.call(null,f,f.call(null),coll);
});
clojure.core.reducers.reduce.cljs$core$IFn$_invoke$arity$3 = (function (f,init,coll){
if(cljs.core.map_QMARK_.call(null,coll)){
return cljs.core._kv_reduce.call(null,coll,f,init);
} else {
if((coll == null)){
return init;
} else {
if(cljs.core.array_QMARK_.call(null,coll)){
return cljs.core.array_reduce.call(null,coll,f,init);
} else {
return cljs.core._reduce.call(null,coll,f,init);
}
}
}
});
clojure.core.reducers.reduce.cljs$lang$maxFixedArity = 3;
clojure.core.reducers.CollFold = (function (){var obj345 = {};
return obj345;
})();
clojure.core.reducers.coll_fold = (function clojure$core$reducers$coll_fold(coll,n,combinef,reducef){
if((function (){var and__3362__auto__ = coll;
if(and__3362__auto__){
return coll.clojure$core$reducers$CollFold$coll_fold$arity$4;
} else {
return and__3362__auto__;
}
})()){
return coll.clojure$core$reducers$CollFold$coll_fold$arity$4(coll,n,combinef,reducef);
} else {
var x__3634__auto__ = (((coll == null))?null:coll);
return (function (){var or__3370__auto__ = (clojure.core.reducers.coll_fold[goog.typeOf(x__3634__auto__)]);
if(or__3370__auto__){
return or__3370__auto__;
} else {
var or__3370__auto____$1 = (clojure.core.reducers.coll_fold["_"]);
if(or__3370__auto____$1){
return or__3370__auto____$1;
} else {
throw cljs.core.missing_protocol.call(null,"CollFold.coll-fold",coll);
}
}
})().call(null,coll,n,combinef,reducef);
}
});
/**
* Reduces a collection using a (potentially parallel) reduce-combine
* strategy. The collection is partitioned into groups of approximately
* n (default 512), each of which is reduced with reducef (with a seed
* value obtained by calling (combinef) with no arguments). The results
* of these reductions are then reduced with combinef (default
* reducef). combinef must be associative, and, when called with no
* arguments, (combinef) must produce its identity element. These
* operations may be performed in parallel, but the results will
* preserve order.
*
* Note: Performing operations in parallel is currently not implemented.
*/
clojure.core.reducers.fold = (function clojure$core$reducers$fold(){
var G__347 = arguments.length;
switch (G__347) {
case 2:
return clojure.core.reducers.fold.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.core.reducers.fold.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
case 4:
return clojure.core.reducers.fold.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.fold.cljs$core$IFn$_invoke$arity$2 = (function (reducef,coll){
return clojure.core.reducers.fold.call(null,reducef,reducef,coll);
});
clojure.core.reducers.fold.cljs$core$IFn$_invoke$arity$3 = (function (combinef,reducef,coll){
return clojure.core.reducers.fold.call(null,(512),combinef,reducef,coll);
});
clojure.core.reducers.fold.cljs$core$IFn$_invoke$arity$4 = (function (n,combinef,reducef,coll){
return clojure.core.reducers.coll_fold.call(null,coll,n,combinef,reducef);
});
clojure.core.reducers.fold.cljs$lang$maxFixedArity = 4;
/**
* Given a reducible collection, and a transformation function xf,
* returns a reducible collection, where any supplied reducing
* fn will be transformed by xf. xf is a function of reducing fn to
* reducing fn.
*/
clojure.core.reducers.reducer = (function clojure$core$reducers$reducer(coll,xf){
if(typeof clojure.core.reducers.t352 !== 'undefined'){
} else {
/**
* @constructor
*/
clojure.core.reducers.t352 = (function (reducer,coll,xf,meta353){
this.reducer = reducer;
this.coll = coll;
this.xf = xf;
this.meta353 = meta353;
this.cljs$lang$protocol_mask$partition0$ = 917504;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
clojure.core.reducers.t352.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_354,meta353__$1){
var self__ = this;
var _354__$1 = this;
return (new clojure.core.reducers.t352(self__.reducer,self__.coll,self__.xf,meta353__$1));
});
clojure.core.reducers.t352.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_354){
var self__ = this;
var _354__$1 = this;
return self__.meta353;
});
clojure.core.reducers.t352.prototype.cljs$core$IReduce$_reduce$arity$2 = (function (this$,f1){
var self__ = this;
var this$__$1 = this;
return cljs.core._reduce.call(null,this$__$1,f1,f1.call(null));
});
clojure.core.reducers.t352.prototype.cljs$core$IReduce$_reduce$arity$3 = (function (_,f1,init){
var self__ = this;
var ___$1 = this;
return cljs.core._reduce.call(null,self__.coll,self__.xf.call(null,f1),init);
});
clojure.core.reducers.t352.getBasis = (function (){
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"reducer","reducer",-948842876,null),new cljs.core.Symbol(null,"coll","coll",-1006698606,null),new cljs.core.Symbol(null,"xf","xf",2042434515,null),new cljs.core.Symbol(null,"meta353","meta353",-1141562705,null)], null);
});
clojure.core.reducers.t352.cljs$lang$type = true;
clojure.core.reducers.t352.cljs$lang$ctorStr = "clojure.core.reducers/t352";
clojure.core.reducers.t352.cljs$lang$ctorPrWriter = (function (this__3585__auto__,writer__3586__auto__,opt__3587__auto__){
return cljs.core._write.call(null,writer__3586__auto__,"clojure.core.reducers/t352");
});
clojure.core.reducers.__GT_t352 = (function clojure$core$reducers$reducer_$___GT_t352(reducer__$1,coll__$1,xf__$1,meta353){
return (new clojure.core.reducers.t352(reducer__$1,coll__$1,xf__$1,meta353));
});
}
return (new clojure.core.reducers.t352(clojure$core$reducers$reducer,coll,xf,cljs.core.PersistentArrayMap.EMPTY));
});
/**
* Given a foldable collection, and a transformation function xf,
* returns a foldable collection, where any supplied reducing
* fn will be transformed by xf. xf is a function of reducing fn to
* reducing fn.
*/
clojure.core.reducers.folder = (function clojure$core$reducers$folder(coll,xf){
if(typeof clojure.core.reducers.t358 !== 'undefined'){
} else {
/**
* @constructor
*/
clojure.core.reducers.t358 = (function (folder,coll,xf,meta359){
this.folder = folder;
this.coll = coll;
this.xf = xf;
this.meta359 = meta359;
this.cljs$lang$protocol_mask$partition0$ = 917504;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
clojure.core.reducers.t358.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_360,meta359__$1){
var self__ = this;
var _360__$1 = this;
return (new clojure.core.reducers.t358(self__.folder,self__.coll,self__.xf,meta359__$1));
});
clojure.core.reducers.t358.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_360){
var self__ = this;
var _360__$1 = this;
return self__.meta359;
});
clojure.core.reducers.t358.prototype.cljs$core$IReduce$_reduce$arity$2 = (function (_,f1){
var self__ = this;
var ___$1 = this;
return cljs.core._reduce.call(null,self__.coll,self__.xf.call(null,f1),f1.call(null));
});
clojure.core.reducers.t358.prototype.cljs$core$IReduce$_reduce$arity$3 = (function (_,f1,init){
var self__ = this;
var ___$1 = this;
return cljs.core._reduce.call(null,self__.coll,self__.xf.call(null,f1),init);
});
clojure.core.reducers.t358.prototype.clojure$core$reducers$CollFold$ = true;
clojure.core.reducers.t358.prototype.clojure$core$reducers$CollFold$coll_fold$arity$4 = (function (_,n,combinef,reducef){
var self__ = this;
var ___$1 = this;
return clojure.core.reducers.coll_fold.call(null,self__.coll,n,combinef,self__.xf.call(null,reducef));
});
clojure.core.reducers.t358.getBasis = (function (){
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"folder","folder",-1138554033,null),new cljs.core.Symbol(null,"coll","coll",-1006698606,null),new cljs.core.Symbol(null,"xf","xf",2042434515,null),new cljs.core.Symbol(null,"meta359","meta359",-1011639428,null)], null);
});
clojure.core.reducers.t358.cljs$lang$type = true;
clojure.core.reducers.t358.cljs$lang$ctorStr = "clojure.core.reducers/t358";
clojure.core.reducers.t358.cljs$lang$ctorPrWriter = (function (this__3585__auto__,writer__3586__auto__,opt__3587__auto__){
return cljs.core._write.call(null,writer__3586__auto__,"clojure.core.reducers/t358");
});
clojure.core.reducers.__GT_t358 = (function clojure$core$reducers$folder_$___GT_t358(folder__$1,coll__$1,xf__$1,meta359){
return (new clojure.core.reducers.t358(folder__$1,coll__$1,xf__$1,meta359));
});
}
return (new clojure.core.reducers.t358(clojure$core$reducers$folder,coll,xf,cljs.core.PersistentArrayMap.EMPTY));
});
/**
* Applies f to every value in the reduction of coll. Foldable.
*/
clojure.core.reducers.map = (function clojure$core$reducers$map(){
var G__362 = arguments.length;
switch (G__362) {
case 1:
return clojure.core.reducers.map.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.core.reducers.map.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.map.cljs$core$IFn$_invoke$arity$1 = (function (f){
return (function (x__3464__auto__){
return clojure.core.reducers.map.call(null,f,x__3464__auto__);
});
});
clojure.core.reducers.map.cljs$core$IFn$_invoke$arity$2 = (function (f,coll){
return clojure.core.reducers.folder.call(null,coll,(function (f1){
return (function() {
var G__364 = null;
var G__364__0 = (function (){
return f1.call(null);
});
var G__364__2 = (function (ret,v){
return f1.call(null,ret,f.call(null,v));
});
var G__364__3 = (function (ret,k,v){
return f1.call(null,ret,f.call(null,k,v));
});
G__364 = function(ret,k,v){
switch(arguments.length){
case 0:
return G__364__0.call(this);
case 2:
return G__364__2.call(this,ret,k);
case 3:
return G__364__3.call(this,ret,k,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__364.cljs$core$IFn$_invoke$arity$0 = G__364__0;
G__364.cljs$core$IFn$_invoke$arity$2 = G__364__2;
G__364.cljs$core$IFn$_invoke$arity$3 = G__364__3;
return G__364;
})()
}));
});
clojure.core.reducers.map.cljs$lang$maxFixedArity = 2;
/**
* Applies f to every value in the reduction of coll, concatenating the result
* colls of (f val). Foldable.
*/
clojure.core.reducers.mapcat = (function clojure$core$reducers$mapcat(){
var G__366 = arguments.length;
switch (G__366) {
case 1:
return clojure.core.reducers.mapcat.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.core.reducers.mapcat.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.mapcat.cljs$core$IFn$_invoke$arity$1 = (function (f){
return (function (x__3464__auto__){
return clojure.core.reducers.mapcat.call(null,f,x__3464__auto__);
});
});
clojure.core.reducers.mapcat.cljs$core$IFn$_invoke$arity$2 = (function (f,coll){
return clojure.core.reducers.folder.call(null,coll,(function (f1){
return (function() {
var G__368 = null;
var G__368__0 = (function (){
return f1.call(null);
});
var G__368__2 = (function (ret,v){
return clojure.core.reducers.reduce.call(null,f1,ret,f.call(null,v));
});
var G__368__3 = (function (ret,k,v){
return clojure.core.reducers.reduce.call(null,f1,ret,f.call(null,k,v));
});
G__368 = function(ret,k,v){
switch(arguments.length){
case 0:
return G__368__0.call(this);
case 2:
return G__368__2.call(this,ret,k);
case 3:
return G__368__3.call(this,ret,k,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__368.cljs$core$IFn$_invoke$arity$0 = G__368__0;
G__368.cljs$core$IFn$_invoke$arity$2 = G__368__2;
G__368.cljs$core$IFn$_invoke$arity$3 = G__368__3;
return G__368;
})()
}));
});
clojure.core.reducers.mapcat.cljs$lang$maxFixedArity = 2;
/**
* Retains values in the reduction of coll for which (pred val)
* returns logical true. Foldable.
*/
clojure.core.reducers.filter = (function clojure$core$reducers$filter(){
var G__370 = arguments.length;
switch (G__370) {
case 1:
return clojure.core.reducers.filter.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.core.reducers.filter.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.filter.cljs$core$IFn$_invoke$arity$1 = (function (pred){
return (function (x__3464__auto__){
return clojure.core.reducers.filter.call(null,pred,x__3464__auto__);
});
});
clojure.core.reducers.filter.cljs$core$IFn$_invoke$arity$2 = (function (pred,coll){
return clojure.core.reducers.folder.call(null,coll,(function (f1){
return (function() {
var G__372 = null;
var G__372__0 = (function (){
return f1.call(null);
});
var G__372__2 = (function (ret,v){
if(cljs.core.truth_(pred.call(null,v))){
return f1.call(null,ret,v);
} else {
return ret;
}
});
var G__372__3 = (function (ret,k,v){
if(cljs.core.truth_(pred.call(null,k,v))){
return f1.call(null,ret,k,v);
} else {
return ret;
}
});
G__372 = function(ret,k,v){
switch(arguments.length){
case 0:
return G__372__0.call(this);
case 2:
return G__372__2.call(this,ret,k);
case 3:
return G__372__3.call(this,ret,k,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__372.cljs$core$IFn$_invoke$arity$0 = G__372__0;
G__372.cljs$core$IFn$_invoke$arity$2 = G__372__2;
G__372.cljs$core$IFn$_invoke$arity$3 = G__372__3;
return G__372;
})()
}));
});
clojure.core.reducers.filter.cljs$lang$maxFixedArity = 2;
/**
* Takes any nested combination of sequential things (lists, vectors,
* etc.) and returns their contents as a single, flat foldable
* collection.
*/
clojure.core.reducers.flatten = (function clojure$core$reducers$flatten(){
var G__374 = arguments.length;
switch (G__374) {
case 0:
return clojure.core.reducers.flatten.cljs$core$IFn$_invoke$arity$0();
break;
case 1:
return clojure.core.reducers.flatten.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.flatten.cljs$core$IFn$_invoke$arity$0 = (function (){
return (function (x__3464__auto__){
return clojure.core.reducers.flatten.call(null,x__3464__auto__);
});
});
clojure.core.reducers.flatten.cljs$core$IFn$_invoke$arity$1 = (function (coll){
return clojure.core.reducers.folder.call(null,coll,(function (f1){
return (function() {
var G__376 = null;
var G__376__0 = (function (){
return f1.call(null);
});
var G__376__2 = (function (ret,v){
if(cljs.core.sequential_QMARK_.call(null,v)){
return cljs.core._reduce.call(null,clojure.core.reducers.flatten.call(null,v),f1,ret);
} else {
return f1.call(null,ret,v);
}
});
G__376 = function(ret,v){
switch(arguments.length){
case 0:
return G__376__0.call(this);
case 2:
return G__376__2.call(this,ret,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__376.cljs$core$IFn$_invoke$arity$0 = G__376__0;
G__376.cljs$core$IFn$_invoke$arity$2 = G__376__2;
return G__376;
})()
}));
});
clojure.core.reducers.flatten.cljs$lang$maxFixedArity = 1;
/**
* Removes values in the reduction of coll for which (pred val)
* returns logical true. Foldable.
*/
clojure.core.reducers.remove = (function clojure$core$reducers$remove(){
var G__378 = arguments.length;
switch (G__378) {
case 1:
return clojure.core.reducers.remove.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.core.reducers.remove.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.remove.cljs$core$IFn$_invoke$arity$1 = (function (pred){
return (function (x__3464__auto__){
return clojure.core.reducers.remove.call(null,pred,x__3464__auto__);
});
});
clojure.core.reducers.remove.cljs$core$IFn$_invoke$arity$2 = (function (pred,coll){
return clojure.core.reducers.filter.call(null,cljs.core.complement.call(null,pred),coll);
});
clojure.core.reducers.remove.cljs$lang$maxFixedArity = 2;
/**
* Ends the reduction of coll when (pred val) returns logical false.
*/
clojure.core.reducers.take_while = (function clojure$core$reducers$take_while(){
var G__381 = arguments.length;
switch (G__381) {
case 1:
return clojure.core.reducers.take_while.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.core.reducers.take_while.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.take_while.cljs$core$IFn$_invoke$arity$1 = (function (pred){
return (function (x__3464__auto__){
return clojure.core.reducers.take_while.call(null,pred,x__3464__auto__);
});
});
clojure.core.reducers.take_while.cljs$core$IFn$_invoke$arity$2 = (function (pred,coll){
return clojure.core.reducers.reducer.call(null,coll,(function (f1){
return (function() {
var G__383 = null;
var G__383__0 = (function (){
return f1.call(null);
});
var G__383__2 = (function (ret,v){
if(cljs.core.truth_(pred.call(null,v))){
return f1.call(null,ret,v);
} else {
return cljs.core.reduced.call(null,ret);
}
});
var G__383__3 = (function (ret,k,v){
if(cljs.core.truth_(pred.call(null,k,v))){
return f1.call(null,ret,k,v);
} else {
return cljs.core.reduced.call(null,ret);
}
});
G__383 = function(ret,k,v){
switch(arguments.length){
case 0:
return G__383__0.call(this);
case 2:
return G__383__2.call(this,ret,k);
case 3:
return G__383__3.call(this,ret,k,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__383.cljs$core$IFn$_invoke$arity$0 = G__383__0;
G__383.cljs$core$IFn$_invoke$arity$2 = G__383__2;
G__383.cljs$core$IFn$_invoke$arity$3 = G__383__3;
return G__383;
})()
}));
});
clojure.core.reducers.take_while.cljs$lang$maxFixedArity = 2;
/**
* Ends the reduction of coll after consuming n values.
*/
clojure.core.reducers.take = (function clojure$core$reducers$take(){
var G__385 = arguments.length;
switch (G__385) {
case 1:
return clojure.core.reducers.take.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.core.reducers.take.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.take.cljs$core$IFn$_invoke$arity$1 = (function (n){
return (function (x__3464__auto__){
return clojure.core.reducers.take.call(null,n,x__3464__auto__);
});
});
clojure.core.reducers.take.cljs$core$IFn$_invoke$arity$2 = (function (n,coll){
return clojure.core.reducers.reducer.call(null,coll,(function (f1){
var cnt = cljs.core.atom.call(null,n);
return ((function (cnt){
return (function() {
var G__387 = null;
var G__387__0 = (function (){
return f1.call(null);
});
var G__387__2 = (function (ret,v){
cljs.core.swap_BANG_.call(null,cnt,cljs.core.dec);
if((cljs.core.deref.call(null,cnt) < (0))){
return cljs.core.reduced.call(null,ret);
} else {
return f1.call(null,ret,v);
}
});
var G__387__3 = (function (ret,k,v){
cljs.core.swap_BANG_.call(null,cnt,cljs.core.dec);
if((cljs.core.deref.call(null,cnt) < (0))){
return cljs.core.reduced.call(null,ret);
} else {
return f1.call(null,ret,k,v);
}
});
G__387 = function(ret,k,v){
switch(arguments.length){
case 0:
return G__387__0.call(this);
case 2:
return G__387__2.call(this,ret,k);
case 3:
return G__387__3.call(this,ret,k,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__387.cljs$core$IFn$_invoke$arity$0 = G__387__0;
G__387.cljs$core$IFn$_invoke$arity$2 = G__387__2;
G__387.cljs$core$IFn$_invoke$arity$3 = G__387__3;
return G__387;
})()
;})(cnt))
}));
});
clojure.core.reducers.take.cljs$lang$maxFixedArity = 2;
/**
* Elides the first n values from the reduction of coll.
*/
clojure.core.reducers.drop = (function clojure$core$reducers$drop(){
var G__389 = arguments.length;
switch (G__389) {
case 1:
return clojure.core.reducers.drop.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.core.reducers.drop.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.drop.cljs$core$IFn$_invoke$arity$1 = (function (n){
return (function (x__3464__auto__){
return clojure.core.reducers.drop.call(null,n,x__3464__auto__);
});
});
clojure.core.reducers.drop.cljs$core$IFn$_invoke$arity$2 = (function (n,coll){
return clojure.core.reducers.reducer.call(null,coll,(function (f1){
var cnt = cljs.core.atom.call(null,n);
return ((function (cnt){
return (function() {
var G__391 = null;
var G__391__0 = (function (){
return f1.call(null);
});
var G__391__2 = (function (ret,v){
cljs.core.swap_BANG_.call(null,cnt,cljs.core.dec);
if((cljs.core.deref.call(null,cnt) < (0))){
return f1.call(null,ret,v);
} else {
return ret;
}
});
var G__391__3 = (function (ret,k,v){
cljs.core.swap_BANG_.call(null,cnt,cljs.core.dec);
if((cljs.core.deref.call(null,cnt) < (0))){
return f1.call(null,ret,k,v);
} else {
return ret;
}
});
G__391 = function(ret,k,v){
switch(arguments.length){
case 0:
return G__391__0.call(this);
case 2:
return G__391__2.call(this,ret,k);
case 3:
return G__391__3.call(this,ret,k,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__391.cljs$core$IFn$_invoke$arity$0 = G__391__0;
G__391.cljs$core$IFn$_invoke$arity$2 = G__391__2;
G__391.cljs$core$IFn$_invoke$arity$3 = G__391__3;
return G__391;
})()
;})(cnt))
}));
});
clojure.core.reducers.drop.cljs$lang$maxFixedArity = 2;
/**
* @constructor
*/
clojure.core.reducers.Cat = (function (cnt,left,right){
this.cnt = cnt;
this.left = left;
this.right = right;
this.cljs$lang$protocol_mask$partition0$ = 8912898;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
clojure.core.reducers.Cat.prototype.cljs$core$ICounted$_count$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.cnt;
});
clojure.core.reducers.Cat.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.concat.call(null,cljs.core.seq.call(null,self__.left),cljs.core.seq.call(null,self__.right));
});
clojure.core.reducers.Cat.prototype.cljs$core$IReduce$_reduce$arity$2 = (function (this$,f1){
var self__ = this;
var this$__$1 = this;
return cljs.core._reduce.call(null,this$__$1,f1,f1.call(null));
});
clojure.core.reducers.Cat.prototype.cljs$core$IReduce$_reduce$arity$3 = (function (_,f1,init){
var self__ = this;
var ___$1 = this;
return cljs.core._reduce.call(null,self__.right,f1,cljs.core._reduce.call(null,self__.left,f1,init));
});
clojure.core.reducers.Cat.prototype.clojure$core$reducers$CollFold$ = true;
clojure.core.reducers.Cat.prototype.clojure$core$reducers$CollFold$coll_fold$arity$4 = (function (this$,n,combinef,reducef){
var self__ = this;
var this$__$1 = this;
return cljs.core._reduce.call(null,this$__$1,reducef);
});
clojure.core.reducers.Cat.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"cnt","cnt",1924510325,null),new cljs.core.Symbol(null,"left","left",1241415590,null),new cljs.core.Symbol(null,"right","right",1187949694,null)], null);
});
clojure.core.reducers.Cat.cljs$lang$type = true;
clojure.core.reducers.Cat.cljs$lang$ctorStr = "clojure.core.reducers/Cat";
clojure.core.reducers.Cat.cljs$lang$ctorPrWriter = (function (this__3585__auto__,writer__3586__auto__,opt__3587__auto__){
return cljs.core._write.call(null,writer__3586__auto__,"clojure.core.reducers/Cat");
});
clojure.core.reducers.__GT_Cat = (function clojure$core$reducers$__GT_Cat(cnt,left,right){
return (new clojure.core.reducers.Cat(cnt,left,right));
});
/**
* A high-performance combining fn that yields the catenation of the
* reduced values. The result is reducible, foldable, seqable and
* counted, providing the identity collections are reducible, seqable
* and counted. The single argument version will build a combining fn
* with the supplied identity constructor. Tests for identity
* with (zero? (count x)). See also foldcat.
*/
clojure.core.reducers.cat = (function clojure$core$reducers$cat(){
var G__393 = arguments.length;
switch (G__393) {
case 0:
return clojure.core.reducers.cat.cljs$core$IFn$_invoke$arity$0();
break;
case 1:
return clojure.core.reducers.cat.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.core.reducers.cat.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.core.reducers.cat.cljs$core$IFn$_invoke$arity$0 = (function (){
return [];
});
clojure.core.reducers.cat.cljs$core$IFn$_invoke$arity$1 = (function (ctor){
return (function() {
var G__395 = null;
var G__395__0 = (function (){
return ctor.call(null);
});
var G__395__2 = (function (left,right){
return clojure.core.reducers.cat.call(null,left,right);
});
G__395 = function(left,right){
switch(arguments.length){
case 0:
return G__395__0.call(this);
case 2:
return G__395__2.call(this,left,right);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__395.cljs$core$IFn$_invoke$arity$0 = G__395__0;
G__395.cljs$core$IFn$_invoke$arity$2 = G__395__2;
return G__395;
})()
});
clojure.core.reducers.cat.cljs$core$IFn$_invoke$arity$2 = (function (left,right){
if((cljs.core.count.call(null,left) === (0))){
return right;
} else {
if((cljs.core.count.call(null,right) === (0))){
return left;
} else {
return (new clojure.core.reducers.Cat((cljs.core.count.call(null,left) + cljs.core.count.call(null,right)),left,right));
}
}
});
clojure.core.reducers.cat.cljs$lang$maxFixedArity = 2;
/**
* .adds x to acc and returns acc
*/
clojure.core.reducers.append_BANG_ = (function clojure$core$reducers$append_BANG_(acc,x){
var G__397 = acc;
G__397.push(x);
return G__397;
});
/**
* Equivalent to (fold cat append! coll)
*/
clojure.core.reducers.foldcat = (function clojure$core$reducers$foldcat(coll){
return clojure.core.reducers.fold.call(null,clojure.core.reducers.cat,clojure.core.reducers.append_BANG_,coll);
});
/**
* Builds a combining fn out of the supplied operator and identity
* constructor. op must be associative and ctor called with no args
* must return an identity value for it.
*/
clojure.core.reducers.monoid = (function clojure$core$reducers$monoid(op,ctor){
return (function() {
var clojure$core$reducers$monoid_$_m = null;
var clojure$core$reducers$monoid_$_m__0 = (function (){
return ctor.call(null);
});
var clojure$core$reducers$monoid_$_m__2 = (function (a,b){
return op.call(null,a,b);
});
clojure$core$reducers$monoid_$_m = function(a,b){
switch(arguments.length){
case 0:
return clojure$core$reducers$monoid_$_m__0.call(this);
case 2:
return clojure$core$reducers$monoid_$_m__2.call(this,a,b);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
clojure$core$reducers$monoid_$_m.cljs$core$IFn$_invoke$arity$0 = clojure$core$reducers$monoid_$_m__0;
clojure$core$reducers$monoid_$_m.cljs$core$IFn$_invoke$arity$2 = clojure$core$reducers$monoid_$_m__2;
return clojure$core$reducers$monoid_$_m;
})()
});
clojure.core.reducers.foldvec = (function clojure$core$reducers$foldvec(v,n,combinef,reducef){
if(cljs.core.empty_QMARK_.call(null,v)){
return combinef.call(null);
} else {
if((cljs.core.count.call(null,v) <= n)){
return clojure.core.reducers.reduce.call(null,reducef,combinef.call(null),v);
} else {
var split = cljs.core.quot.call(null,cljs.core.count.call(null,v),(2));
var v1 = cljs.core.subvec.call(null,v,(0),split);
var v2 = cljs.core.subvec.call(null,v,split,cljs.core.count.call(null,v));
var fc = ((function (split,v1,v2){
return (function (child){
return ((function (split,v1,v2){
return (function (){
return clojure$core$reducers$foldvec.call(null,child,n,combinef,reducef);
});
;})(split,v1,v2))
});})(split,v1,v2))
;
return clojure.core.reducers.fjinvoke.call(null,((function (split,v1,v2,fc){
return (function (){
var f1 = fc.call(null,v1);
var t2 = clojure.core.reducers.fjtask.call(null,fc.call(null,v2));
clojure.core.reducers.fjfork.call(null,t2);
return combinef.call(null,f1.call(null),clojure.core.reducers.fjjoin.call(null,t2));
});})(split,v1,v2,fc))
);
}
}
});
(clojure.core.reducers.CollFold["null"] = true);
(clojure.core.reducers.coll_fold["null"] = (function (coll,n,combinef,reducef){
return combinef.call(null);
}));
(clojure.core.reducers.CollFold["object"] = true);
(clojure.core.reducers.coll_fold["object"] = (function (coll,n,combinef,reducef){
return clojure.core.reducers.reduce.call(null,reducef,combinef.call(null),coll);
}));
cljs.core.PersistentVector.prototype.clojure$core$reducers$CollFold$ = true;
cljs.core.PersistentVector.prototype.clojure$core$reducers$CollFold$coll_fold$arity$4 = (function (v,n,combinef,reducef){
var v__$1 = this;
return clojure.core.reducers.foldvec.call(null,v__$1,n,combinef,reducef);
});
//# sourceMappingURL=reducers.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,195 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; 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.
(ns clojure.string
(:refer-clojure :exclude [replace reverse])
(:require [goog.string :as gstring])
(:import [goog.string StringBuffer]))
(defn- seq-reverse
[coll]
(reduce conj () coll))
(def ^:private re-surrogate-pair
(js/RegExp. "([\\uD800-\\uDBFF])([\\uDC00-\\uDFFF])" "g"))
(defn reverse
"Returns s with its characters reversed."
[s]
(-> (.replace s re-surrogate-pair "$2$1")
(.. (split "") (reverse) (join ""))))
(defn replace
"Replaces all instance of match with replacement in s.
match/replacement can be:
string / string
pattern / (string or function of match)."
[s match replacement]
(cond (string? match)
(.replace s (js/RegExp. (gstring/regExpEscape match) "g") replacement)
(instance? js/RegExp match)
(.replace s (js/RegExp. (.-source match) "g") replacement)
:else (throw (str "Invalid match arg: " match))))
(defn replace-first
"Replaces the first instance of match with replacement in s.
match/replacement can be:
string / string
pattern / (string or function of match)."
[s match replacement]
(.replace s match replacement))
(defn join
"Returns a string of all elements in coll, as returned by (seq coll),
separated by an optional separator."
([coll]
(loop [sb (StringBuffer.) coll (seq coll)]
(if coll
(recur (. sb (append (str (first coll)))) (next coll))
(.toString sb))))
([separator coll]
(loop [sb (StringBuffer.) coll (seq coll)]
(if coll
(do
(. sb (append (str (first coll))))
(let [coll (next coll)]
(when-not (nil? coll)
(. sb (append separator)))
(recur sb coll)))
(.toString sb)))))
(defn upper-case
"Converts string to all upper-case."
[s]
(.toUpperCase s))
(defn lower-case
"Converts string to all lower-case."
[s]
(.toLowerCase s))
(defn capitalize
"Converts first character of the string to upper-case, all other
characters to lower-case."
[s]
(if (< (count s) 2)
(upper-case s)
(str (upper-case (subs s 0 1))
(lower-case (subs s 1)))))
;; The JavaScript split function takes a limit argument but the return
;; value is not the same as the Java split function.
;;
;; Java: (.split "a-b-c" #"-" 2) => ["a" "b-c"]
;; JavaScript: (.split "a-b-c" #"-" 2) => ["a" "b"]
;;
;; For consistency, the three arg version has been implemented to
;; mimic Java's behavior.
(defn- pop-last-while-empty
[v]
(loop [v v]
(if (= "" (peek v))
(recur (pop v))
v)))
(defn- discard-trailing-if-needed
[limit v]
(if (= 0 limit)
(pop-last-while-empty v)
v))
(defn- split-with-empty-regex
[s limit]
(if (or (<= limit 0) (>= limit (+ 2 (count s))))
(conj (vec (cons "" (map str (seq s)))) "")
(condp = limit
1 (vector s)
2 (vector "" s)
(let [c (- limit 2)]
(conj (vec (cons "" (subvec (vec (map str (seq s))) 0 c))) (subs s c))))))
(defn split
"Splits string on a regular expression. Optional argument limit is
the maximum number of splits. Not lazy. Returns vector of the splits."
([s re]
(split s re 0))
([s re limit]
(discard-trailing-if-needed limit
(if (= (str re) "/(?:)/")
(split-with-empty-regex s limit)
(if (< limit 1)
(vec (.split (str s) re))
(loop [s s
limit limit
parts []]
(if (= limit 1)
(conj parts s)
(if-let [m (re-find re s)]
(let [index (.indexOf s m)]
(recur (.substring s (+ index (count m)))
(dec limit)
(conj parts (.substring s 0 index))))
(conj parts s)))))))))
(defn split-lines
"Splits s on \n or \r\n."
[s]
(split s #"\n|\r\n"))
(defn trim
"Removes whitespace from both ends of string."
[s]
(gstring/trim s))
(defn triml
"Removes whitespace from the left side of string."
[s]
(gstring/trimLeft s))
(defn trimr
"Removes whitespace from the right side of string."
[s]
(gstring/trimRight s))
(defn trim-newline
"Removes all trailing newline \\n or return \\r characters from
string. Similar to Perl's chomp."
[s]
(loop [index (.-length s)]
(if (zero? index)
""
(let [ch (get s (dec index))]
(if (or (= ch \newline) (= ch \return))
(recur (dec index))
(.substring s 0 index))))))
(defn blank?
"True is s is nil, empty, or contains only whitespace."
[s]
(gstring/isEmptySafe s))
(defn escape
"Return a new string, using cmap to escape each character ch
from s as follows:
If (cmap ch) is nil, append ch to the new string.
If (cmap ch) is non-nil, append (str (cmap ch)) instead."
[s cmap]
(let [buffer (StringBuffer.)
length (.-length s)]
(loop [index 0]
(if (= length index)
(. buffer (toString))
(let [ch (.charAt s index)]
(if-let [replacement (get cmap ch)]
(.append buffer (str replacement))
(.append buffer ch))
(recur (inc index)))))))

File diff suppressed because one or more lines are too long

View file

@ -1,310 +0,0 @@
// Compiled by ClojureScript 0.0-3308 {:target :nodejs}
goog.provide('clojure.string');
goog.require('cljs.core');
goog.require('goog.string');
goog.require('goog.string.StringBuffer');
clojure.string.seq_reverse = (function clojure$string$seq_reverse(coll){
return cljs.core.reduce.call(null,cljs.core.conj,cljs.core.List.EMPTY,coll);
});
clojure.string.re_surrogate_pair = (new RegExp("([\\uD800-\\uDBFF])([\\uDC00-\\uDFFF])","g"));
/**
* Returns s with its characters reversed.
*/
clojure.string.reverse = (function clojure$string$reverse(s){
return s.replace(clojure.string.re_surrogate_pair,"$2$1").split("").reverse().join("");
});
/**
* Replaces all instance of match with replacement in s.
* match/replacement can be:
*
* string / string
* pattern / (string or function of match).
*/
clojure.string.replace = (function clojure$string$replace(s,match,replacement){
if(typeof match === 'string'){
return s.replace((new RegExp(goog.string.regExpEscape(match),"g")),replacement);
} else {
if((match instanceof RegExp)){
return s.replace((new RegExp(match.source,"g")),replacement);
} else {
throw [cljs.core.str("Invalid match arg: "),cljs.core.str(match)].join('');
}
}
});
/**
* Replaces the first instance of match with replacement in s.
* match/replacement can be:
*
* string / string
* pattern / (string or function of match).
*/
clojure.string.replace_first = (function clojure$string$replace_first(s,match,replacement){
return s.replace(match,replacement);
});
/**
* Returns a string of all elements in coll, as returned by (seq coll),
* separated by an optional separator.
*/
clojure.string.join = (function clojure$string$join(){
var G__1829 = arguments.length;
switch (G__1829) {
case 1:
return clojure.string.join.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.string.join.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.string.join.cljs$core$IFn$_invoke$arity$1 = (function (coll){
var sb = (new goog.string.StringBuffer());
var coll__$1 = cljs.core.seq.call(null,coll);
while(true){
if(coll__$1){
var G__1831 = sb.append([cljs.core.str(cljs.core.first.call(null,coll__$1))].join(''));
var G__1832 = cljs.core.next.call(null,coll__$1);
sb = G__1831;
coll__$1 = G__1832;
continue;
} else {
return sb.toString();
}
break;
}
});
clojure.string.join.cljs$core$IFn$_invoke$arity$2 = (function (separator,coll){
var sb = (new goog.string.StringBuffer());
var coll__$1 = cljs.core.seq.call(null,coll);
while(true){
if(coll__$1){
sb.append([cljs.core.str(cljs.core.first.call(null,coll__$1))].join(''));
var coll__$2 = cljs.core.next.call(null,coll__$1);
if((coll__$2 == null)){
} else {
sb.append(separator);
}
var G__1833 = sb;
var G__1834 = coll__$2;
sb = G__1833;
coll__$1 = G__1834;
continue;
} else {
return sb.toString();
}
break;
}
});
clojure.string.join.cljs$lang$maxFixedArity = 2;
/**
* Converts string to all upper-case.
*/
clojure.string.upper_case = (function clojure$string$upper_case(s){
return s.toUpperCase();
});
/**
* Converts string to all lower-case.
*/
clojure.string.lower_case = (function clojure$string$lower_case(s){
return s.toLowerCase();
});
/**
* Converts first character of the string to upper-case, all other
* characters to lower-case.
*/
clojure.string.capitalize = (function clojure$string$capitalize(s){
if((cljs.core.count.call(null,s) < (2))){
return clojure.string.upper_case.call(null,s);
} else {
return [cljs.core.str(clojure.string.upper_case.call(null,cljs.core.subs.call(null,s,(0),(1)))),cljs.core.str(clojure.string.lower_case.call(null,cljs.core.subs.call(null,s,(1))))].join('');
}
});
clojure.string.pop_last_while_empty = (function clojure$string$pop_last_while_empty(v){
var v__$1 = v;
while(true){
if(cljs.core._EQ_.call(null,"",cljs.core.peek.call(null,v__$1))){
var G__1835 = cljs.core.pop.call(null,v__$1);
v__$1 = G__1835;
continue;
} else {
return v__$1;
}
break;
}
});
clojure.string.discard_trailing_if_needed = (function clojure$string$discard_trailing_if_needed(limit,v){
if(cljs.core._EQ_.call(null,(0),limit)){
return clojure.string.pop_last_while_empty.call(null,v);
} else {
return v;
}
});
clojure.string.split_with_empty_regex = (function clojure$string$split_with_empty_regex(s,limit){
if(((limit <= (0))) || ((limit >= ((2) + cljs.core.count.call(null,s))))){
return cljs.core.conj.call(null,cljs.core.vec.call(null,cljs.core.cons.call(null,"",cljs.core.map.call(null,cljs.core.str,cljs.core.seq.call(null,s)))),"");
} else {
var pred__1839 = cljs.core._EQ_;
var expr__1840 = limit;
if(cljs.core.truth_(pred__1839.call(null,(1),expr__1840))){
return (new cljs.core.PersistentVector(null,1,(5),cljs.core.PersistentVector.EMPTY_NODE,[s],null));
} else {
if(cljs.core.truth_(pred__1839.call(null,(2),expr__1840))){
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,["",s],null));
} else {
var c = (limit - (2));
return cljs.core.conj.call(null,cljs.core.vec.call(null,cljs.core.cons.call(null,"",cljs.core.subvec.call(null,cljs.core.vec.call(null,cljs.core.map.call(null,cljs.core.str,cljs.core.seq.call(null,s))),(0),c))),cljs.core.subs.call(null,s,c));
}
}
}
});
/**
* Splits string on a regular expression. Optional argument limit is
* the maximum number of splits. Not lazy. Returns vector of the splits.
*/
clojure.string.split = (function clojure$string$split(){
var G__1843 = arguments.length;
switch (G__1843) {
case 2:
return clojure.string.split.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.string.split.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
clojure.string.split.cljs$core$IFn$_invoke$arity$2 = (function (s,re){
return clojure.string.split.call(null,s,re,(0));
});
clojure.string.split.cljs$core$IFn$_invoke$arity$3 = (function (s,re,limit){
return clojure.string.discard_trailing_if_needed.call(null,limit,((cljs.core._EQ_.call(null,[cljs.core.str(re)].join(''),"/(?:)/"))?clojure.string.split_with_empty_regex.call(null,s,limit):(((limit < (1)))?cljs.core.vec.call(null,[cljs.core.str(s)].join('').split(re)):(function (){var s__$1 = s;
var limit__$1 = limit;
var parts = cljs.core.PersistentVector.EMPTY;
while(true){
if(cljs.core._EQ_.call(null,limit__$1,(1))){
return cljs.core.conj.call(null,parts,s__$1);
} else {
var temp__4421__auto__ = cljs.core.re_find.call(null,re,s__$1);
if(cljs.core.truth_(temp__4421__auto__)){
var m = temp__4421__auto__;
var index = s__$1.indexOf(m);
var G__1845 = s__$1.substring((index + cljs.core.count.call(null,m)));
var G__1846 = (limit__$1 - (1));
var G__1847 = cljs.core.conj.call(null,parts,s__$1.substring((0),index));
s__$1 = G__1845;
limit__$1 = G__1846;
parts = G__1847;
continue;
} else {
return cljs.core.conj.call(null,parts,s__$1);
}
}
break;
}
})())));
});
clojure.string.split.cljs$lang$maxFixedArity = 3;
/**
* Splits s on
* or
* .
*/
clojure.string.split_lines = (function clojure$string$split_lines(s){
return clojure.string.split.call(null,s,/\n|\r\n/);
});
/**
* Removes whitespace from both ends of string.
*/
clojure.string.trim = (function clojure$string$trim(s){
return goog.string.trim(s);
});
/**
* Removes whitespace from the left side of string.
*/
clojure.string.triml = (function clojure$string$triml(s){
return goog.string.trimLeft(s);
});
/**
* Removes whitespace from the right side of string.
*/
clojure.string.trimr = (function clojure$string$trimr(s){
return goog.string.trimRight(s);
});
/**
* Removes all trailing newline \n or return \r characters from
* string. Similar to Perl's chomp.
*/
clojure.string.trim_newline = (function clojure$string$trim_newline(s){
var index = s.length;
while(true){
if((index === (0))){
return "";
} else {
var ch = cljs.core.get.call(null,s,(index - (1)));
if((cljs.core._EQ_.call(null,ch,"\n")) || (cljs.core._EQ_.call(null,ch,"\r"))){
var G__1848 = (index - (1));
index = G__1848;
continue;
} else {
return s.substring((0),index);
}
}
break;
}
});
/**
* True is s is nil, empty, or contains only whitespace.
*/
clojure.string.blank_QMARK_ = (function clojure$string$blank_QMARK_(s){
return goog.string.isEmptySafe(s);
});
/**
* Return a new string, using cmap to escape each character ch
* from s as follows:
*
* If (cmap ch) is nil, append ch to the new string.
* If (cmap ch) is non-nil, append (str (cmap ch)) instead.
*/
clojure.string.escape = (function clojure$string$escape(s,cmap){
var buffer = (new goog.string.StringBuffer());
var length = s.length;
var index = (0);
while(true){
if(cljs.core._EQ_.call(null,length,index)){
return buffer.toString();
} else {
var ch = s.charAt(index);
var temp__4421__auto___1849 = cljs.core.get.call(null,cmap,ch);
if(cljs.core.truth_(temp__4421__auto___1849)){
var replacement_1850 = temp__4421__auto___1849;
buffer.append([cljs.core.str(replacement_1850)].join(''));
} else {
buffer.append(ch);
}
var G__1851 = (index + (1));
index = G__1851;
continue;
}
break;
}
});
//# sourceMappingURL=string.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,94 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; 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.
;;; walk.cljs - generic tree walker with replacement
;; by Stuart Sierra
;; Jul5 17, 2011
;; CHANGE LOG:
;;
;; * July 17, 2011: Port to ClojureScript
;;
;; * December 15, 2008: replaced 'walk' with 'prewalk' & 'postwalk'
;;
;; * December 9, 2008: first version
(ns
^{:author "Stuart Sierra",
:doc "This file defines a generic tree walker for Clojure data
structures. It takes any data structure (list, vector, map, set,
seq), calls a function on every element, and uses the return value
of the function in place of the original. This makes it fairly
easy to write recursive search-and-replace functions, as shown in
the examples.
Note: \"walk\" supports all Clojure data structures EXCEPT maps
created with sorted-map-by. There is no (obvious) way to retrieve
the sorting function."}
clojure.walk)
(defn walk
"Traverses form, an arbitrary data structure. inner and outer are
functions. Applies inner to each element of form, building up a
data structure of the same type, then applies outer to the result.
Recognizes all Clojure data structures. Consumes seqs as with doall."
{:added "1.1"}
[inner outer form]
(cond
(seq? form) (outer (doall (map inner form)))
(coll? form) (outer (into (empty form) (map inner form)))
:else (outer form)))
(defn postwalk
"Performs a depth-first, post-order traversal of form. Calls f on
each sub-form, uses f's return value in place of the original.
Recognizes all Clojure data structures. Consumes seqs as with doall."
{:added "1.1"}
[f form]
(walk (partial postwalk f) f form))
(defn prewalk
"Like postwalk, but does pre-order traversal."
{:added "1.1"}
[f form]
(walk (partial prewalk f) identity (f form)))
(defn keywordize-keys
"Recursively transforms all map keys from strings to keywords."
{:added "1.1"}
[m]
(let [f (fn [[k v]] (if (string? k) [(keyword k) v] [k v]))]
;; only apply to maps
(postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)))
(defn stringify-keys
"Recursively transforms all map keys from keywords to strings."
{:added "1.1"}
[m]
(let [f (fn [[k v]] (if (keyword? k) [(name k) v] [k v]))]
;; only apply to maps
(postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)))
(defn prewalk-replace
"Recursively transforms form by replacing keys in smap with their
values. Like clojure/replace but works on any data structure. Does
replacement at the root of the tree first."
{:added "1.1"}
[smap form]
(prewalk (fn [x] (if (contains? smap x) (smap x) x)) form))
(defn postwalk-replace
"Recursively transforms form by replacing keys in smap with their
values. Like clojure/replace but works on any data structure. Does
replacement at the leaves of the tree first."
{:added "1.1"}
[smap form]
(postwalk (fn [x] (if (contains? smap x) (smap x) x)) form))

File diff suppressed because one or more lines are too long

View file

@ -1,113 +0,0 @@
// Compiled by ClojureScript 0.0-3308 {:target :nodejs}
goog.provide('clojure.walk');
goog.require('cljs.core');
/**
* Traverses form, an arbitrary data structure. inner and outer are
* functions. Applies inner to each element of form, building up a
* data structure of the same type, then applies outer to the result.
* Recognizes all Clojure data structures. Consumes seqs as with doall.
*/
clojure.walk.walk = (function clojure$walk$walk(inner,outer,form){
if(cljs.core.seq_QMARK_.call(null,form)){
return outer.call(null,cljs.core.doall.call(null,cljs.core.map.call(null,inner,form)));
} else {
if(cljs.core.coll_QMARK_.call(null,form)){
return outer.call(null,cljs.core.into.call(null,cljs.core.empty.call(null,form),cljs.core.map.call(null,inner,form)));
} else {
return outer.call(null,form);
}
}
});
/**
* Performs a depth-first, post-order traversal of form. Calls f on
* each sub-form, uses f's return value in place of the original.
* Recognizes all Clojure data structures. Consumes seqs as with doall.
*/
clojure.walk.postwalk = (function clojure$walk$postwalk(f,form){
return clojure.walk.walk.call(null,cljs.core.partial.call(null,clojure$walk$postwalk,f),f,form);
});
/**
* Like postwalk, but does pre-order traversal.
*/
clojure.walk.prewalk = (function clojure$walk$prewalk(f,form){
return clojure.walk.walk.call(null,cljs.core.partial.call(null,clojure$walk$prewalk,f),cljs.core.identity,f.call(null,form));
});
/**
* Recursively transforms all map keys from strings to keywords.
*/
clojure.walk.keywordize_keys = (function clojure$walk$keywordize_keys(m){
var f = (function (p__333){
var vec__334 = p__333;
var k = cljs.core.nth.call(null,vec__334,(0),null);
var v = cljs.core.nth.call(null,vec__334,(1),null);
if(typeof k === 'string'){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.keyword.call(null,k),v], null);
} else {
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,v], null);
}
});
return clojure.walk.postwalk.call(null,((function (f){
return (function (x){
if(cljs.core.map_QMARK_.call(null,x)){
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,f,x));
} else {
return x;
}
});})(f))
,m);
});
/**
* Recursively transforms all map keys from keywords to strings.
*/
clojure.walk.stringify_keys = (function clojure$walk$stringify_keys(m){
var f = (function (p__337){
var vec__338 = p__337;
var k = cljs.core.nth.call(null,vec__338,(0),null);
var v = cljs.core.nth.call(null,vec__338,(1),null);
if((k instanceof cljs.core.Keyword)){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.name.call(null,k),v], null);
} else {
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,v], null);
}
});
return clojure.walk.postwalk.call(null,((function (f){
return (function (x){
if(cljs.core.map_QMARK_.call(null,x)){
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,f,x));
} else {
return x;
}
});})(f))
,m);
});
/**
* Recursively transforms form by replacing keys in smap with their
* values. Like clojure/replace but works on any data structure. Does
* replacement at the root of the tree first.
*/
clojure.walk.prewalk_replace = (function clojure$walk$prewalk_replace(smap,form){
return clojure.walk.prewalk.call(null,(function (x){
if(cljs.core.contains_QMARK_.call(null,smap,x)){
return smap.call(null,x);
} else {
return x;
}
}),form);
});
/**
* Recursively transforms form by replacing keys in smap with their
* values. Like clojure/replace but works on any data structure. Does
* replacement at the leaves of the tree first.
*/
clojure.walk.postwalk_replace = (function clojure$walk$postwalk_replace(smap,form){
return clojure.walk.postwalk.call(null,(function (x){
if(cljs.core.contains_QMARK_.call(null,smap,x)){
return smap.call(null,x);
} else {
return x;
}
}),form);
});
//# sourceMappingURL=walk.js.map

View file

@ -1 +0,0 @@
{"version":3,"file":"\/Users\/pietromenna\/git\/specter\/out\/clojure\/walk.js","sources":["walk.cljs"],"lineCount":113,"mappings":";AAsBA;;AAcA;;;;;;oBAAA,pBAAMA,gDAOHC,MAAMC,MAAMC;AAPf,AAQE,GACC,AAACC,+BAAKD;AAAM,OAACD,gBAAM,AAACG,0BAAM,AAACC,wBAAIL,MAAME;;AADtC,GAEC,AAACI,gCAAMJ;AAAM,OAACD,gBAAM,AAACM,yBAAK,AAACC,0BAAMN,MAAM,AAACG,wBAAIL,MAAME;;AAFnD,AAGO,OAACD,gBAAMC;;;;;AAEhB;;;;;wBAAA,xBAAMO,wDAKHC,EAAER;AALL,AAME,OAACH,4BAAK,AAACY,4BAAQC,sBAASF,GAAGA,EAAER;;AAE\/B;;;uBAAA,vBAAMW,sDAGHH,EAAER;AAHL,AAIE,OAACH,4BAAK,AAACY,4BAAQG,qBAAQJ,GAAGK,mBAAS,AAACL,YAAER;;AAExC;;;+BAAA,\/BAAMc,sEAGHC;AAHH,AAIE,IAAMP,IAAE,WAAAQ;AAAA,AAAA,IAAAC,WAAAD;QAAA,AAAAE,wBAAAD,SAAA,IAAA,zCAAME;QAAN,AAAAD,wBAAAD,SAAA,IAAA,zCAAQG;AAAR,AAAY,GAAI,OAASD;AAAb,0FAAiB,AAACE,4BAAQF,GAAGC;;AAA7B,0FAAiCD,EAAEC;;;AAAvD,AAEE,OAACb,gCAAS;kBAAKe;AAAL,AAAQ,GAAI,AAACC,+BAAKD;AAAG,gCAAA,zBAACjB,4DAAQ,AAACF,wBAAIK,EAAEc;;AAAIA;;;CAAIP;;AAE3D;;;8BAAA,9BAAMS,oEAGHT;AAHH,AAIE,IAAMP,IAAE,WAAAiB;AAAA,AAAA,IAAAC,WAAAD;QAAA,AAAAP,wBAAAQ,SAAA,IAAA,zCAAMP;QAAN,AAAAD,wBAAAQ,SAAA,IAAA,zCAAQN;AAAR,AAAY,GAAI,cAAAO,bAAUR;AAAd,0FAAkB,AAACS,yBAAKT,GAAGC;;AAA3B,0FAA+BD,EAAEC;;;AAArD,AAEE,OAACb,gCAAS;kBAAKe;AAAL,AAAQ,GAAI,AAACC,+BAAKD;AAAG,gCAAA,zBAACjB,4DAAQ,AAACF,wBAAIK,EAAEc;;AAAIA;;;CAAIP;;AAE3D;;;;;+BAAA,\/BAAMc,sEAKHC,KAAK9B;AALR,AAME,OAACW,+BAAQ,WAAKW;AAAL,AAAQ,GAAI,AAACS,oCAAUD,KAAKR;AAAG,OAACQ,eAAKR;;AAAGA;;GAAItB;;AAEvD;;;;;gCAAA,hCAAMgC,wEAKHF,KAAK9B;AALR,AAME,OAACO,gCAAS,WAAKe;AAAL,AAAQ,GAAI,AAACS,oCAAUD,KAAKR;AAAG,OAACQ,eAAKR;;AAAGA;;GAAItB","names":["clojure.walk\/walk","inner","outer","form","cljs.core\/seq?","cljs.core\/doall","cljs.core\/map","cljs.core\/coll?","cljs.core\/into","cljs.core\/empty","clojure.walk\/postwalk","f","cljs.core\/partial","postwalk","clojure.walk\/prewalk","prewalk","cljs.core\/identity","clojure.walk\/keywordize-keys","m","p__333","vec__334","cljs.core\/nth","k","v","cljs.core\/keyword","x","cljs.core\/map?","clojure.walk\/stringify-keys","p__337","vec__338","cljs.core\/Keyword","cljs.core\/name","clojure.walk\/prewalk-replace","smap","cljs.core\/contains?","clojure.walk\/postwalk-replace"]}

View file

@ -1,203 +0,0 @@
(ns com.rpl.specter
(:use [com.rpl.specter.protocols :only [StructurePath comp-paths*]])
(:require [com.rpl.specter.impl :as i])
)
;;TODO: can make usage of vals much more efficient by determining during composition how many vals
;;there are going to be. this should make it much easier to allocate space for vals without doing concats
;;all over the place. The apply to the vals + structure can also be avoided since the number of vals is known
;;beforehand
(defn comp-paths [& paths]
(comp-paths* (vec paths)))
;; Selector functions
(def ^{:doc "Version of select that takes in a selector pre-compiled with comp-paths"}
compiled-select i/compiled-select*)
(defn select
"Navigates to and returns a sequence of all the elements specified by the selector."
[selector structure]
(compiled-select (i/comp-unoptimal selector)
structure))
(defn compiled-select-one
"Version of select-one that takes in a selector pre-compiled with comp-paths"
[selector structure]
(let [res (compiled-select selector structure)]
(when (> (count res) 1)
(i/throw-illegal "More than one element found for params: " selector structure))
(first res)
))
(defn select-one
"Like select, but returns either one element or nil. Throws exception if multiple elements found"
[selector structure]
(compiled-select-one (i/comp-unoptimal selector) structure))
(defn compiled-select-one!
"Version of select-one! that takes in a selector pre-compiled with comp-paths"
[selector structure]
(let [res (compiled-select-one selector structure)]
(when (nil? res) (i/throw-illegal "No elements found for params: " selector structure))
res
))
(defn select-one!
"Returns exactly one element, throws exception if zero or multiple elements found"
[selector structure]
(compiled-select-one! (i/comp-unoptimal selector) structure))
(defn compiled-select-first
"Version of select-first that takes in a selector pre-compiled with comp-paths"
[selector structure]
(first (compiled-select selector structure)))
(defn select-first
"Returns first element found. Not any more efficient than select, just a convenience"
[selector structure]
(compiled-select-first (i/comp-unoptimal selector) structure))
;; Transformfunctions
(def ^{:doc "Version of transform that takes in a selector pre-compiled with comp-paths"}
compiled-transform i/compiled-transform*)
(defn transform
"Navigates to each value specified by the selector and replaces it by the result of running
the transform-fn on it"
[selector transform-fn structure]
(compiled-transform (i/comp-unoptimal selector) transform-fn structure))
(defn compiled-setval
"Version of setval that takes in a selector pre-compiled with comp-paths"
[selector val structure]
(compiled-transform selector (fn [_] val) structure))
(defn setval
"Navigates to each value specified by the selector and replaces it by val"
[selector val structure]
(compiled-setval (i/comp-unoptimal selector) val structure))
(defn compiled-replace-in
"Version of replace-in that takes in a selector pre-compiled with comp-paths"
[selector transform-fn structure & {:keys [merge-fn] :or {merge-fn concat}}]
(let [state (i/mutable-cell nil)]
[(compiled-transform selector
(fn [e]
(let [res (transform-fn e)]
(if res
(let [[ret user-ret] res]
(->> user-ret
(merge-fn (i/get-cell state))
(i/set-cell! state))
ret)
e
)))
structure)
(i/get-cell state)]
))
(defn replace-in
"Similar to transform, except returns a pair of [transformd-structure sequence-of-user-ret].
The transform-fn in this case is expected to return [ret user-ret]. ret is
what's used to transform the data structure, while user-ret will be added to the user-ret sequence
in the final return. replace-in is useful for situations where you need to know the specific values
of what was transformd in the data structure."
[selector transform-fn structure & {:keys [merge-fn] :or {merge-fn concat}}]
(compiled-replace-in (i/comp-unoptimal selector) transform-fn structure :merge-fn merge-fn))
;; Built-in pathing and context operations
(def ALL (i/->AllStructurePath))
(def VAL (i/->ValCollect))
(def LAST (i/->LastStructurePath))
(def FIRST (i/->FirstStructurePath))
(defn srange-dynamic [start-fn end-fn] (i/->SRangePath start-fn end-fn))
(defn srange [start end] (srange-dynamic (fn [_] start) (fn [_] end)))
(def BEGINNING (srange 0 0))
(def END (srange-dynamic count count))
(defn walker [afn] (i/->WalkerStructurePath afn))
(defn codewalker [afn] (i/->CodeWalkerStructurePath afn))
(defn filterer [& path] (i/->FilterStructurePath (comp-paths* path)))
(defn keypath [akey] (i/->KeyPath akey))
(defn view [afn] (i/->ViewPath afn))
(defn selected?
"Filters the current value based on whether a selector finds anything.
e.g. (selected? :vals ALL even?) keeps the current element only if an
even number exists for the :vals key"
[& selectors]
(let [s (comp-paths* selectors)]
(fn [structure]
(->> structure
(select s)
empty?
not))))
(extend-type #?(:clj clojure.lang.Keyword :cljs cljs.core/Keyword)
StructurePath
(select* [kw structure next-fn]
(next-fn (get structure kw)))
(transform* [kw structure next-fn]
(assoc structure kw (next-fn (get structure kw)))
))
(extend-type #?(:clj clojure.lang.AFn :cljs js/Function)
StructurePath
(select* [afn structure next-fn]
(if (afn structure)
(next-fn structure)))
(transform* [afn structure next-fn]
(if (afn structure)
(next-fn structure)
structure)))
(defn collect [& selector]
(i/->SelectCollector select (comp-paths* selector)))
(defn collect-one [& selector]
(i/->SelectCollector select-one (comp-paths* selector)))
(defn putval
"Adds an external value to the collected vals. Useful when additional arguments
are required to the transform function that would otherwise require partial
application or a wrapper function.
e.g., incrementing val at path [:a :b] by 3:
(transform [:a :b (putval 3)] + some-map)"
[val]
(i/->PutValCollector val))
(defn cond-path
"Takes in alternating cond-path selector cond-path selector...
Tests the structure if selecting with cond-path returns anything.
If so, it uses the following selector for this portion of the navigation.
Otherwise, it tries the next cond-path. If nothing matches, then the structure
is not selected."
[& conds]
(->> conds
(partition 2)
(map (fn [[c p]] [(comp-paths* c) (comp-paths* p)]))
doall
i/->ConditionalPath
))
(defn if-path
"Like cond-path, but with if semantics."
([cond-fn if-path] (cond-path cond-fn if-path))
([cond-fn if-path else-path]
(cond-path cond-fn if-path nil else-path)))

File diff suppressed because one or more lines are too long

View file

@ -1,365 +0,0 @@
// Compiled by ClojureScript 0.0-3308 {:target :nodejs}
goog.provide('com.rpl.specter');
goog.require('cljs.core');
goog.require('com.rpl.specter.protocols');
goog.require('com.rpl.specter.impl');
com.rpl.specter.comp_paths = (function com$rpl$specter$comp_paths(){
var argseq__3882__auto__ = ((((0) < arguments.length))?(new cljs.core.IndexedSeq(Array.prototype.slice.call(arguments,(0)),(0))):null);
return com.rpl.specter.comp_paths.cljs$core$IFn$_invoke$arity$variadic(argseq__3882__auto__);
});
com.rpl.specter.comp_paths.cljs$core$IFn$_invoke$arity$variadic = (function (paths){
return com.rpl.specter.protocols.comp_paths_STAR_.call(null,cljs.core.vec.call(null,paths));
});
com.rpl.specter.comp_paths.cljs$lang$maxFixedArity = (0);
com.rpl.specter.comp_paths.cljs$lang$applyTo = (function (seq300){
return com.rpl.specter.comp_paths.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq300));
});
/**
* Version of select that takes in a selector pre-compiled with comp-paths
*/
com.rpl.specter.compiled_select = com.rpl.specter.impl.compiled_select_STAR_;
/**
* Navigates to and returns a sequence of all the elements specified by the selector.
*/
com.rpl.specter.select = (function com$rpl$specter$select(selector,structure){
return com.rpl.specter.compiled_select.call(null,com.rpl.specter.impl.comp_unoptimal.call(null,selector),structure);
});
/**
* Version of select-one that takes in a selector pre-compiled with comp-paths
*/
com.rpl.specter.compiled_select_one = (function com$rpl$specter$compiled_select_one(selector,structure){
var res = com.rpl.specter.compiled_select.call(null,selector,structure);
if((cljs.core.count.call(null,res) > (1))){
com.rpl.specter.impl.throw_illegal.call(null,"More than one element found for params: ",selector,structure);
} else {
}
return cljs.core.first.call(null,res);
});
/**
* Like select, but returns either one element or nil. Throws exception if multiple elements found
*/
com.rpl.specter.select_one = (function com$rpl$specter$select_one(selector,structure){
return com.rpl.specter.compiled_select_one.call(null,com.rpl.specter.impl.comp_unoptimal.call(null,selector),structure);
});
/**
* Version of select-one! that takes in a selector pre-compiled with comp-paths
*/
com.rpl.specter.compiled_select_one_BANG_ = (function com$rpl$specter$compiled_select_one_BANG_(selector,structure){
var res = com.rpl.specter.compiled_select_one.call(null,selector,structure);
if((res == null)){
com.rpl.specter.impl.throw_illegal.call(null,"No elements found for params: ",selector,structure);
} else {
}
return res;
});
/**
* Returns exactly one element, throws exception if zero or multiple elements found
*/
com.rpl.specter.select_one_BANG_ = (function com$rpl$specter$select_one_BANG_(selector,structure){
return com.rpl.specter.compiled_select_one_BANG_.call(null,com.rpl.specter.impl.comp_unoptimal.call(null,selector),structure);
});
/**
* Version of select-first that takes in a selector pre-compiled with comp-paths
*/
com.rpl.specter.compiled_select_first = (function com$rpl$specter$compiled_select_first(selector,structure){
return cljs.core.first.call(null,com.rpl.specter.compiled_select.call(null,selector,structure));
});
/**
* Returns first element found. Not any more efficient than select, just a convenience
*/
com.rpl.specter.select_first = (function com$rpl$specter$select_first(selector,structure){
return com.rpl.specter.compiled_select_first.call(null,com.rpl.specter.impl.comp_unoptimal.call(null,selector),structure);
});
/**
* Version of transform that takes in a selector pre-compiled with comp-paths
*/
com.rpl.specter.compiled_transform = com.rpl.specter.impl.compiled_transform_STAR_;
/**
* Navigates to each value specified by the selector and replaces it by the result of running
* the transform-fn on it
*/
com.rpl.specter.transform = (function com$rpl$specter$transform(selector,transform_fn,structure){
return com.rpl.specter.compiled_transform.call(null,com.rpl.specter.impl.comp_unoptimal.call(null,selector),transform_fn,structure);
});
/**
* Version of setval that takes in a selector pre-compiled with comp-paths
*/
com.rpl.specter.compiled_setval = (function com$rpl$specter$compiled_setval(selector,val,structure){
return com.rpl.specter.compiled_transform.call(null,selector,(function (_){
return val;
}),structure);
});
/**
* Navigates to each value specified by the selector and replaces it by val
*/
com.rpl.specter.setval = (function com$rpl$specter$setval(selector,val,structure){
return com.rpl.specter.compiled_setval.call(null,com.rpl.specter.impl.comp_unoptimal.call(null,selector),val,structure);
});
/**
* Version of replace-in that takes in a selector pre-compiled with comp-paths
*/
com.rpl.specter.compiled_replace_in = (function com$rpl$specter$compiled_replace_in(){
var argseq__3882__auto__ = ((((3) < arguments.length))?(new cljs.core.IndexedSeq(Array.prototype.slice.call(arguments,(3)),(0))):null);
return com.rpl.specter.compiled_replace_in.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),argseq__3882__auto__);
});
com.rpl.specter.compiled_replace_in.cljs$core$IFn$_invoke$arity$variadic = (function (selector,transform_fn,structure,p__305){
var map__306 = p__305;
var map__306__$1 = ((cljs.core.seq_QMARK_.call(null,map__306))?cljs.core.apply.call(null,cljs.core.hash_map,map__306):map__306);
var merge_fn = cljs.core.get.call(null,map__306__$1,new cljs.core.Keyword(null,"merge-fn","merge-fn",588067341),cljs.core.concat);
var state = com.rpl.specter.impl.mutable_cell.call(null,null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [com.rpl.specter.compiled_transform.call(null,selector,((function (state,map__306,map__306__$1,merge_fn){
return (function (e){
var res = transform_fn.call(null,e);
if(cljs.core.truth_(res)){
var vec__307 = res;
var ret = cljs.core.nth.call(null,vec__307,(0),null);
var user_ret = cljs.core.nth.call(null,vec__307,(1),null);
com.rpl.specter.impl.set_cell_BANG_.call(null,state,merge_fn.call(null,com.rpl.specter.impl.get_cell.call(null,state),user_ret));
return ret;
} else {
return e;
}
});})(state,map__306,map__306__$1,merge_fn))
,structure),com.rpl.specter.impl.get_cell.call(null,state)], null);
});
com.rpl.specter.compiled_replace_in.cljs$lang$maxFixedArity = (3);
com.rpl.specter.compiled_replace_in.cljs$lang$applyTo = (function (seq301){
var G__302 = cljs.core.first.call(null,seq301);
var seq301__$1 = cljs.core.next.call(null,seq301);
var G__303 = cljs.core.first.call(null,seq301__$1);
var seq301__$2 = cljs.core.next.call(null,seq301__$1);
var G__304 = cljs.core.first.call(null,seq301__$2);
var seq301__$3 = cljs.core.next.call(null,seq301__$2);
return com.rpl.specter.compiled_replace_in.cljs$core$IFn$_invoke$arity$variadic(G__302,G__303,G__304,seq301__$3);
});
/**
* Similar to transform, except returns a pair of [transformd-structure sequence-of-user-ret].
* The transform-fn in this case is expected to return [ret user-ret]. ret is
* what's used to transform the data structure, while user-ret will be added to the user-ret sequence
* in the final return. replace-in is useful for situations where you need to know the specific values
* of what was transformd in the data structure.
*/
com.rpl.specter.replace_in = (function com$rpl$specter$replace_in(){
var argseq__3882__auto__ = ((((3) < arguments.length))?(new cljs.core.IndexedSeq(Array.prototype.slice.call(arguments,(3)),(0))):null);
return com.rpl.specter.replace_in.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),argseq__3882__auto__);
});
com.rpl.specter.replace_in.cljs$core$IFn$_invoke$arity$variadic = (function (selector,transform_fn,structure,p__312){
var map__313 = p__312;
var map__313__$1 = ((cljs.core.seq_QMARK_.call(null,map__313))?cljs.core.apply.call(null,cljs.core.hash_map,map__313):map__313);
var merge_fn = cljs.core.get.call(null,map__313__$1,new cljs.core.Keyword(null,"merge-fn","merge-fn",588067341),cljs.core.concat);
return com.rpl.specter.compiled_replace_in.call(null,com.rpl.specter.impl.comp_unoptimal.call(null,selector),transform_fn,structure,new cljs.core.Keyword(null,"merge-fn","merge-fn",588067341),merge_fn);
});
com.rpl.specter.replace_in.cljs$lang$maxFixedArity = (3);
com.rpl.specter.replace_in.cljs$lang$applyTo = (function (seq308){
var G__309 = cljs.core.first.call(null,seq308);
var seq308__$1 = cljs.core.next.call(null,seq308);
var G__310 = cljs.core.first.call(null,seq308__$1);
var seq308__$2 = cljs.core.next.call(null,seq308__$1);
var G__311 = cljs.core.first.call(null,seq308__$2);
var seq308__$3 = cljs.core.next.call(null,seq308__$2);
return com.rpl.specter.replace_in.cljs$core$IFn$_invoke$arity$variadic(G__309,G__310,G__311,seq308__$3);
});
com.rpl.specter.ALL = com.rpl.specter.impl.__GT_AllStructurePath.call(null);
com.rpl.specter.VAL = com.rpl.specter.impl.__GT_ValCollect.call(null);
com.rpl.specter.LAST = com.rpl.specter.impl.__GT_LastStructurePath.call(null);
com.rpl.specter.FIRST = com.rpl.specter.impl.__GT_FirstStructurePath.call(null);
com.rpl.specter.srange_dynamic = (function com$rpl$specter$srange_dynamic(start_fn,end_fn){
return com.rpl.specter.impl.__GT_SRangePath.call(null,start_fn,end_fn);
});
com.rpl.specter.srange = (function com$rpl$specter$srange(start,end){
return com.rpl.specter.srange_dynamic.call(null,(function (_){
return start;
}),(function (_){
return end;
}));
});
com.rpl.specter.BEGINNING = com.rpl.specter.srange.call(null,(0),(0));
com.rpl.specter.END = com.rpl.specter.srange_dynamic.call(null,cljs.core.count,cljs.core.count);
com.rpl.specter.walker = (function com$rpl$specter$walker(afn){
return com.rpl.specter.impl.__GT_WalkerStructurePath.call(null,afn);
});
com.rpl.specter.codewalker = (function com$rpl$specter$codewalker(afn){
return com.rpl.specter.impl.__GT_CodeWalkerStructurePath.call(null,afn);
});
com.rpl.specter.filterer = (function com$rpl$specter$filterer(){
var argseq__3882__auto__ = ((((0) < arguments.length))?(new cljs.core.IndexedSeq(Array.prototype.slice.call(arguments,(0)),(0))):null);
return com.rpl.specter.filterer.cljs$core$IFn$_invoke$arity$variadic(argseq__3882__auto__);
});
com.rpl.specter.filterer.cljs$core$IFn$_invoke$arity$variadic = (function (path){
return com.rpl.specter.impl.__GT_FilterStructurePath.call(null,com.rpl.specter.protocols.comp_paths_STAR_.call(null,path));
});
com.rpl.specter.filterer.cljs$lang$maxFixedArity = (0);
com.rpl.specter.filterer.cljs$lang$applyTo = (function (seq314){
return com.rpl.specter.filterer.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq314));
});
com.rpl.specter.keypath = (function com$rpl$specter$keypath(akey){
return com.rpl.specter.impl.__GT_KeyPath.call(null,akey);
});
com.rpl.specter.view = (function com$rpl$specter$view(afn){
return com.rpl.specter.impl.__GT_ViewPath.call(null,afn);
});
/**
* Filters the current value based on whether a selector finds anything.
* e.g. (selected? :vals ALL even?) keeps the current element only if an
* even number exists for the :vals key
*/
com.rpl.specter.selected_QMARK_ = (function com$rpl$specter$selected_QMARK_(){
var argseq__3882__auto__ = ((((0) < arguments.length))?(new cljs.core.IndexedSeq(Array.prototype.slice.call(arguments,(0)),(0))):null);
return com.rpl.specter.selected_QMARK_.cljs$core$IFn$_invoke$arity$variadic(argseq__3882__auto__);
});
com.rpl.specter.selected_QMARK_.cljs$core$IFn$_invoke$arity$variadic = (function (selectors){
var s = com.rpl.specter.protocols.comp_paths_STAR_.call(null,selectors);
return ((function (s){
return (function (structure){
return !(cljs.core.empty_QMARK_.call(null,com.rpl.specter.select.call(null,s,structure)));
});
;})(s))
});
com.rpl.specter.selected_QMARK_.cljs$lang$maxFixedArity = (0);
com.rpl.specter.selected_QMARK_.cljs$lang$applyTo = (function (seq315){
return com.rpl.specter.selected_QMARK_.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq315));
});
cljs.core.Keyword.prototype.com$rpl$specter$protocols$StructurePath$ = true;
cljs.core.Keyword.prototype.com$rpl$specter$protocols$StructurePath$select_STAR_$arity$3 = (function (kw,structure,next_fn){
var kw__$1 = this;
return next_fn.call(null,cljs.core.get.call(null,structure,kw__$1));
});
cljs.core.Keyword.prototype.com$rpl$specter$protocols$StructurePath$transform_STAR_$arity$3 = (function (kw,structure,next_fn){
var kw__$1 = this;
return cljs.core.assoc.call(null,structure,kw__$1,next_fn.call(null,cljs.core.get.call(null,structure,kw__$1)));
});
Function.prototype.com$rpl$specter$protocols$StructurePath$ = true;
Function.prototype.com$rpl$specter$protocols$StructurePath$select_STAR_$arity$3 = (function (afn,structure,next_fn){
var afn__$1 = this;
if(cljs.core.truth_(afn__$1.call(null,structure))){
return next_fn.call(null,structure);
} else {
return null;
}
});
Function.prototype.com$rpl$specter$protocols$StructurePath$transform_STAR_$arity$3 = (function (afn,structure,next_fn){
var afn__$1 = this;
if(cljs.core.truth_(afn__$1.call(null,structure))){
return next_fn.call(null,structure);
} else {
return structure;
}
});
com.rpl.specter.collect = (function com$rpl$specter$collect(){
var argseq__3882__auto__ = ((((0) < arguments.length))?(new cljs.core.IndexedSeq(Array.prototype.slice.call(arguments,(0)),(0))):null);
return com.rpl.specter.collect.cljs$core$IFn$_invoke$arity$variadic(argseq__3882__auto__);
});
com.rpl.specter.collect.cljs$core$IFn$_invoke$arity$variadic = (function (selector){
return com.rpl.specter.impl.__GT_SelectCollector.call(null,com.rpl.specter.select,com.rpl.specter.protocols.comp_paths_STAR_.call(null,selector));
});
com.rpl.specter.collect.cljs$lang$maxFixedArity = (0);
com.rpl.specter.collect.cljs$lang$applyTo = (function (seq316){
return com.rpl.specter.collect.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq316));
});
com.rpl.specter.collect_one = (function com$rpl$specter$collect_one(){
var argseq__3882__auto__ = ((((0) < arguments.length))?(new cljs.core.IndexedSeq(Array.prototype.slice.call(arguments,(0)),(0))):null);
return com.rpl.specter.collect_one.cljs$core$IFn$_invoke$arity$variadic(argseq__3882__auto__);
});
com.rpl.specter.collect_one.cljs$core$IFn$_invoke$arity$variadic = (function (selector){
return com.rpl.specter.impl.__GT_SelectCollector.call(null,com.rpl.specter.select_one,com.rpl.specter.protocols.comp_paths_STAR_.call(null,selector));
});
com.rpl.specter.collect_one.cljs$lang$maxFixedArity = (0);
com.rpl.specter.collect_one.cljs$lang$applyTo = (function (seq317){
return com.rpl.specter.collect_one.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq317));
});
/**
* Adds an external value to the collected vals. Useful when additional arguments
* are required to the transform function that would otherwise require partial
* application or a wrapper function.
*
* e.g., incrementing val at path [:a :b] by 3:
* (transform [:a :b (putval 3)] + some-map)
*/
com.rpl.specter.putval = (function com$rpl$specter$putval(val){
return com.rpl.specter.impl.__GT_PutValCollector.call(null,val);
});
/**
* Takes in alternating cond-path selector cond-path selector...
* Tests the structure if selecting with cond-path returns anything.
* If so, it uses the following selector for this portion of the navigation.
* Otherwise, it tries the next cond-path. If nothing matches, then the structure
* is not selected.
*/
com.rpl.specter.cond_path = (function com$rpl$specter$cond_path(){
var argseq__3882__auto__ = ((((0) < arguments.length))?(new cljs.core.IndexedSeq(Array.prototype.slice.call(arguments,(0)),(0))):null);
return com.rpl.specter.cond_path.cljs$core$IFn$_invoke$arity$variadic(argseq__3882__auto__);
});
com.rpl.specter.cond_path.cljs$core$IFn$_invoke$arity$variadic = (function (conds){
return com.rpl.specter.impl.__GT_ConditionalPath.call(null,cljs.core.doall.call(null,cljs.core.map.call(null,(function (p__319){
var vec__320 = p__319;
var c = cljs.core.nth.call(null,vec__320,(0),null);
var p = cljs.core.nth.call(null,vec__320,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [com.rpl.specter.protocols.comp_paths_STAR_.call(null,c),com.rpl.specter.protocols.comp_paths_STAR_.call(null,p)], null);
}),cljs.core.partition.call(null,(2),conds))));
});
com.rpl.specter.cond_path.cljs$lang$maxFixedArity = (0);
com.rpl.specter.cond_path.cljs$lang$applyTo = (function (seq318){
return com.rpl.specter.cond_path.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq318));
});
/**
* Like cond-path, but with if semantics.
*/
com.rpl.specter.if_path = (function com$rpl$specter$if_path(){
var G__322 = arguments.length;
switch (G__322) {
case 2:
return com.rpl.specter.if_path.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return com.rpl.specter.if_path.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join('')));
}
});
com.rpl.specter.if_path.cljs$core$IFn$_invoke$arity$2 = (function (cond_fn,if_path){
return com.rpl.specter.cond_path.call(null,cond_fn,if_path);
});
com.rpl.specter.if_path.cljs$core$IFn$_invoke$arity$3 = (function (cond_fn,if_path,else_path){
return com.rpl.specter.cond_path.call(null,cond_fn,if_path,null,else_path);
});
com.rpl.specter.if_path.cljs$lang$maxFixedArity = 3;
//# sourceMappingURL=specter.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,532 +0,0 @@
(ns com.rpl.specter.impl
(:use [com.rpl.specter.protocols :only [StructurePath StructureValsPath Collector StructureValsPathComposer comp-paths*]])
(:require [clojure.walk :as walk]
[clojure.core.reducers :as r])
)
#?(
:clj
(do
(defmacro throw* [etype & args]
`(throw (new ~etype (pr-str ~@args))))
(defmacro throw-illegal [& args]
`(throw* IllegalArgumentException ~@args)))
:cljs
(defn throw-illegal [& args]
(throw (js/Error. (apply str args)))
)
)
(defn benchmark [iters afn]
(time
(dotimes [_ iters]
(afn))))
(deftype ExecutorFunctions [type select-executor transform-executor])
(def StructureValsPathExecutor
(->ExecutorFunctions
:svalspath
(fn [selector structure]
(selector [] structure
(fn [vals structure]
(if-not (empty? vals) [(conj vals structure)] [structure]))))
(fn [transformer transform-fn structure]
(transformer [] structure
(fn [vals structure]
(if (empty? vals)
(transform-fn structure)
(apply transform-fn (conj vals structure))))))
))
(def StructurePathExecutor
(->ExecutorFunctions
:spath
(fn [selector structure]
(selector structure (fn [structure] [structure])))
(fn [transformer transform-fn structure]
(transformer structure transform-fn))
))
(deftype TransformFunctions [executors selector transformer])
(defprotocol CoerceTransformFunctions
(coerce-path [this]))
(defn no-prot-error-str [obj]
(str "Protocol implementation cannot be found for object.
Extending Specter protocols should not be done inline in a deftype definition
because that prevents Specter from finding the protocol implementations for
optimized performance. Instead, you should extend the protocols via an
explicit extend-protocol call. \n" obj))
(defn find-protocol-impl! [prot obj]
(let [ret (find-protocol-impl prot obj)]
(if (= ret obj)
(throw-illegal (no-prot-error-str obj))
ret
)))
(defn coerce-structure-vals-path [this]
(let [pimpl (find-protocol-impl! StructureValsPath this)
selector (:select-full* pimpl)
transformer (:transform-full* pimpl)]
(->TransformFunctions
StructureValsPathExecutor
(fn [vals structure next-fn]
(selector this vals structure next-fn))
(fn [vals structure next-fn]
(transformer this vals structure next-fn)))
))
(defn coerce-collector [this]
(let [cfn (->> this
(find-protocol-impl! Collector)
:collect-val
)
afn (fn [vals structure next-fn]
(next-fn (conj vals (cfn this structure)) structure)
)]
(->TransformFunctions StructureValsPathExecutor afn afn)))
(defn structure-path-impl [this]
(if (fn? this)
;;TODO: this isn't kosher, it uses knowledge of internals of protocols
(-> StructurePath :impls (get clojure.lang.AFn))
(find-protocol-impl! StructurePath this)))
(defn coerce-structure-path [this]
(let [pimpl (structure-path-impl this)
selector (:select* pimpl)
transformer (:transform* pimpl)]
(->TransformFunctions
StructurePathExecutor
(fn [structure next-fn]
(selector this structure next-fn))
(fn [structure next-fn]
(transformer this structure next-fn))
)))
(defn coerce-structure-path-direct [this]
(let [pimpl (structure-path-impl this)
selector (:select* pimpl)
transformer (:transform* pimpl)]
(->TransformFunctions
StructureValsPathExecutor
(fn [vals structure next-fn]
(selector this structure (fn [structure] (next-fn vals structure))))
(fn [vals structure next-fn]
(transformer this structure (fn [structure] (next-fn vals structure))))
)))
(defn obj-extends? [prot obj]
(->> obj (find-protocol-impl prot) nil? not))
(defn structure-path? [obj]
(or (fn? obj) (obj-extends? StructurePath obj)))
(extend-protocol CoerceTransformFunctions
nil ; needs its own path because it doesn't count as an Object
(coerce-path [this]
(coerce-structure-path nil))
TransformFunctions
(coerce-path [this]
this)
#?(:clj java.util.List :cljs cljs.core/PersistentVector)
(coerce-path [this]
(comp-paths* this))
#?(:clj Object :cljs js/Object)
(coerce-path [this]
(cond (structure-path? this) (coerce-structure-path this)
(obj-extends? Collector this) (coerce-collector this)
(obj-extends? StructureValsPath this) (coerce-structure-vals-path this)
:else (throw-illegal (no-prot-error-str this))
)))
(defn extype [^TransformFunctions f]
(let [^ExecutorFunctions exs (.executors f)]
(.type exs)
))
(defn- combine-same-types [[^TransformFunctions f & _ :as all]]
(if (empty? all)
(coerce-path nil)
(let [^ExecutorFunctions exs (.executors f)
t (.type exs)
combiner
(if (= t :svalspath)
(fn [curr next]
(fn [vals structure next-fn]
(curr vals structure
(fn [vals-next structure-next]
(next vals-next structure-next next-fn)
))))
(fn [curr next]
(fn [structure next-fn]
(curr structure (fn [structure] (next structure next-fn)))))
)]
(reduce (fn [^TransformFunctions curr ^TransformFunctions next]
(->TransformFunctions
exs
(combiner (.selector curr) (.selector next))
(combiner (.transformer curr) (.transformer next))
))
all))))
(defn coerce-structure-vals [^TransformFunctions tfns]
(if (= (extype tfns) :svalspath)
tfns
(let [selector (.selector tfns)
transformer (.transformer tfns)]
(->TransformFunctions
StructureValsPathExecutor
(fn [vals structure next-fn]
(selector structure (fn [structure] (next-fn vals structure))))
(fn [vals structure next-fn]
(transformer structure (fn [structure] (next-fn vals structure))))
))))
(extend-protocol StructureValsPathComposer
nil
(comp-paths* [sp]
(coerce-path sp))
#?(:clj Object :cljs js/Object)
(comp-paths* [sp]
(coerce-path sp))
#?(:clj java.util.List :cljs cljs.core/PersistentVector)
(comp-paths* [structure-paths]
(let [combined (->> structure-paths
(map coerce-path)
(partition-by extype)
(map combine-same-types)
)]
(if (= 1 (count combined))
(first combined)
(->> combined
(map coerce-structure-vals)
combine-same-types)
))))
(defn coerce-structure-vals-direct [this]
(cond (structure-path? this) (coerce-structure-path-direct this)
(obj-extends? Collector this) (coerce-collector this)
(obj-extends? StructureValsPath this) (coerce-structure-vals-path this)
(instance? TransformFunctions this) (coerce-structure-vals this)
:else (throw-illegal (no-prot-error-str this))
))
;;this composes paths together much faster than comp-paths* but the resulting composition
;;won't execute as fast. Useful for when select/transform are used without pre-compiled paths
;;(where cost of compiling dominates execution time)
(defn comp-unoptimal [sp]
(if (instance? #?(:clj java.util.List :cljs cljs.core/PersistentVector) sp)
(->> sp
(map coerce-structure-vals-direct)
combine-same-types)
(coerce-path sp)))
;; cell implementation idea taken from prismatic schema library
(defprotocol PMutableCell
(get_cell [cell])
(set_cell [cell x]))
(deftype MutableCell [^:volatile-mutable q]
PMutableCell
(get_cell [this] q)
(set_cell [this x] (set! q x)))
(defn mutable-cell
([] (mutable-cell nil))
([init] (MutableCell. init)))
(defn set-cell! [cell val]
(set_cell cell val))
(defn get-cell [cell]
(get_cell cell))
(defn update-cell! [cell afn]
(let [ret (afn (get-cell cell))]
(set-cell! cell ret)
ret))
(defn- append [coll elem]
(-> coll vec (conj elem)))
(defprotocol SetExtremes
(set-first [s val])
(set-last [s val]))
(defn- set-first-list [l v]
(cons v (rest l)))
(defn- set-last-list [l v]
(append (butlast l) v))
(extend-protocol SetExtremes
#?(:clj clojure.lang.PersistentVector :cljs cljs.core/PersistentVector)
(set-first [v val]
(assoc v 0 val))
(set-last [v val]
(assoc v (-> v count dec) val))
#?(:clj Object :cljs js/Object)
(set-first [l val]
(set-first-list l val))
(set-last [l val]
(set-last-list l val)
))
(defn- walk-until [pred on-match-fn structure]
(if (pred structure)
(on-match-fn structure)
(walk/walk (partial walk-until pred on-match-fn) identity structure)
))
(defn- fn-invocation? [f]
(or (instance? clojure.lang.Cons f)
(instance? clojure.lang.LazySeq f)
(list? f)))
(defn- codewalk-until [pred on-match-fn structure]
(if (pred structure)
(on-match-fn structure)
(let [ret (walk/walk (partial codewalk-until pred on-match-fn) identity structure)]
(if (and (fn-invocation? structure) (fn-invocation? ret))
(with-meta ret (meta structure))
ret
))))
(defn- conj-all! [cell elems]
(set-cell! cell (concat (get-cell cell) elems)))
(defn compiled-select*
[^com.rpl.specter.impl.TransformFunctions tfns structure]
(let [^com.rpl.specter.impl.ExecutorFunctions ex (.executors tfns)]
((.select-executor ex) (.selector tfns) structure)
))
(defn compiled-transform*
[^com.rpl.specter.impl.TransformFunctions tfns transform-fn structure]
(let [^com.rpl.specter.impl.ExecutorFunctions ex (.executors tfns)]
((.transform-executor ex) (.transformer tfns) transform-fn structure)
))
(defn selected?*
[compiled-path structure]
(->> structure
(compiled-select* compiled-path)
empty?
not))
;; returns vector of all results
(defn- walk-select [pred continue-fn structure]
(let [ret (mutable-cell [])
walker (fn this [structure]
(if (pred structure)
(conj-all! ret (continue-fn structure))
(walk/walk this identity structure))
)]
(walker structure)
(get-cell ret)
))
(defn- filter+ancestry [path aseq]
(let [aseq (vec aseq)]
(reduce (fn [[s m :as orig] i]
(let [e (get aseq i)
pos (count s)]
(if (selected?* path e)
[(conj s e) (assoc m pos i)]
orig
)))
[[] {}]
(range (count aseq))
)))
(defn key-select [akey structure next-fn]
(next-fn (get structure akey)))
(defn key-transform [akey structure next-fn]
(assoc structure akey (next-fn (get structure akey))
))
(deftype AllStructurePath [])
(extend-protocol StructurePath
AllStructurePath
(select* [this structure next-fn]
(into [] (r/mapcat next-fn structure)))
(transform* [this structure next-fn]
(let [empty-structure (empty structure)]
(if (list? empty-structure)
;; this is done to maintain order, otherwise lists get reversed
(doall (map next-fn structure))
(->> structure (r/map next-fn) (into empty-structure))
))))
(deftype ValCollect [])
(extend-protocol Collector
ValCollect
(collect-val [this structure]
structure))
(deftype LastStructurePath [])
(extend-protocol StructurePath
LastStructurePath
(select* [this structure next-fn]
(next-fn (last structure)))
(transform* [this structure next-fn]
(set-last structure (next-fn (last structure)))))
(deftype FirstStructurePath [])
(extend-protocol StructurePath
FirstStructurePath
(select* [this structure next-fn]
(next-fn (first structure)))
(transform* [this structure next-fn]
(set-first structure (next-fn (first structure)))))
(deftype WalkerStructurePath [afn])
(extend-protocol StructurePath
WalkerStructurePath
(select* [^WalkerStructurePath this structure next-fn]
(walk-select (.afn this) next-fn structure))
(transform* [^WalkerStructurePath this structure next-fn]
(walk-until (.afn this) next-fn structure)))
(deftype CodeWalkerStructurePath [afn])
(extend-protocol StructurePath
CodeWalkerStructurePath
(select* [^CodeWalkerStructurePath this structure next-fn]
(walk-select (.afn this) next-fn structure))
(transform* [^CodeWalkerStructurePath this structure next-fn]
(codewalk-until (.afn this) next-fn structure)))
(deftype FilterStructurePath [path])
(extend-protocol StructurePath
FilterStructurePath
(select* [^FilterStructurePath this structure next-fn]
(->> structure (filter #(selected?* (.path this) %)) doall next-fn))
(transform* [^FilterStructurePath this structure next-fn]
(let [[filtered ancestry] (filter+ancestry (.path this) structure)
;; the vec is necessary so that we can get by index later
;; (can't get by index for cons'd lists)
next (vec (next-fn filtered))]
(reduce (fn [curr [newi oldi]]
(assoc curr oldi (get next newi)))
(vec structure)
ancestry))))
(deftype KeyPath [akey])
(extend-protocol StructurePath
KeyPath
(select* [^KeyPath this structure next-fn]
(key-select (.akey this) structure next-fn))
(transform* [^KeyPath this structure next-fn]
(key-transform (.akey this) structure next-fn)
))
(deftype SelectCollector [sel-fn selector])
(extend-protocol Collector
SelectCollector
(collect-val [^SelectCollector this structure]
((.sel-fn this) (.selector this) structure)))
(deftype SRangePath [start-fn end-fn])
(extend-protocol StructurePath
SRangePath
(select* [^SRangePath this structure next-fn]
(let [start ((.start-fn this) structure)
end ((.end-fn this) structure)]
(next-fn (-> structure vec (subvec start end)))
))
(transform* [^SRangePath this structure next-fn]
(let [start ((.start-fn this) structure)
end ((.end-fn this) structure)
structurev (vec structure)
newpart (next-fn (-> structurev (subvec start end)))
res (concat (subvec structurev 0 start)
newpart
(subvec structurev end (count structure)))]
(if (vector? structure)
(vec res)
res
))))
(deftype ViewPath [view-fn])
(extend-protocol StructurePath
ViewPath
(select* [^ViewPath this structure next-fn]
(->> structure ((.view-fn this)) next-fn))
(transform* [^ViewPath this structure next-fn]
(->> structure ((.view-fn this)) next-fn)
))
(deftype PutValCollector [val])
(extend-protocol Collector
PutValCollector
(collect-val [^PutValCollector this structure]
(.val this)
))
(extend-protocol StructurePath
nil
(select* [this structure next-fn]
(next-fn structure))
(transform* [this structure next-fn]
(next-fn structure)
))
(deftype ConditionalPath [cond-pairs])
(defn- retrieve-selector [cond-pairs structure]
(->> cond-pairs
(drop-while (fn [[c-selector _]]
(->> structure
(compiled-select* c-selector)
empty?)))
first
second
))
;;TODO: test nothing matches case
(extend-protocol StructurePath
ConditionalPath
(select* [this structure next-fn]
(if-let [selector (retrieve-selector (.cond-pairs this) structure)]
(->> (compiled-select* selector structure)
(mapcat next-fn)
doall)))
(transform* [this structure next-fn]
(if-let [selector (retrieve-selector (.cond-pairs this) structure)]
(compiled-transform* selector next-fn structure)
structure
)))

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,15 +0,0 @@
(ns com.rpl.specter.protocols)
(defprotocol StructureValsPath
(select-full* [this vals structure next-fn])
(transform-full* [this vals structure next-fn]))
(defprotocol StructurePath
(select* [this structure next-fn])
(transform* [this structure next-fn]))
(defprotocol Collector
(collect-val [this structure]))
(defprotocol StructureValsPathComposer
(comp-paths* [paths]))

File diff suppressed because one or more lines are too long

View file

@ -1,181 +0,0 @@
// Compiled by ClojureScript 0.0-3308 {:target :nodejs}
goog.provide('com.rpl.specter.protocols');
goog.require('cljs.core');
com.rpl.specter.protocols.StructureValsPath = (function (){var obj263 = {};
return obj263;
})();
com.rpl.specter.protocols.select_full_STAR_ = (function com$rpl$specter$protocols$select_full_STAR_(this$,vals,structure,next_fn){
if((function (){var and__3362__auto__ = this$;
if(and__3362__auto__){
return this$.com$rpl$specter$protocols$StructureValsPath$select_full_STAR_$arity$4;
} else {
return and__3362__auto__;
}
})()){
return this$.com$rpl$specter$protocols$StructureValsPath$select_full_STAR_$arity$4(this$,vals,structure,next_fn);
} else {
var x__3634__auto__ = (((this$ == null))?null:this$);
return (function (){var or__3370__auto__ = (com.rpl.specter.protocols.select_full_STAR_[goog.typeOf(x__3634__auto__)]);
if(or__3370__auto__){
return or__3370__auto__;
} else {
var or__3370__auto____$1 = (com.rpl.specter.protocols.select_full_STAR_["_"]);
if(or__3370__auto____$1){
return or__3370__auto____$1;
} else {
throw cljs.core.missing_protocol.call(null,"StructureValsPath.select-full*",this$);
}
}
})().call(null,this$,vals,structure,next_fn);
}
});
com.rpl.specter.protocols.transform_full_STAR_ = (function com$rpl$specter$protocols$transform_full_STAR_(this$,vals,structure,next_fn){
if((function (){var and__3362__auto__ = this$;
if(and__3362__auto__){
return this$.com$rpl$specter$protocols$StructureValsPath$transform_full_STAR_$arity$4;
} else {
return and__3362__auto__;
}
})()){
return this$.com$rpl$specter$protocols$StructureValsPath$transform_full_STAR_$arity$4(this$,vals,structure,next_fn);
} else {
var x__3634__auto__ = (((this$ == null))?null:this$);
return (function (){var or__3370__auto__ = (com.rpl.specter.protocols.transform_full_STAR_[goog.typeOf(x__3634__auto__)]);
if(or__3370__auto__){
return or__3370__auto__;
} else {
var or__3370__auto____$1 = (com.rpl.specter.protocols.transform_full_STAR_["_"]);
if(or__3370__auto____$1){
return or__3370__auto____$1;
} else {
throw cljs.core.missing_protocol.call(null,"StructureValsPath.transform-full*",this$);
}
}
})().call(null,this$,vals,structure,next_fn);
}
});
com.rpl.specter.protocols.StructurePath = (function (){var obj265 = {};
return obj265;
})();
com.rpl.specter.protocols.select_STAR_ = (function com$rpl$specter$protocols$select_STAR_(this$,structure,next_fn){
if((function (){var and__3362__auto__ = this$;
if(and__3362__auto__){
return this$.com$rpl$specter$protocols$StructurePath$select_STAR_$arity$3;
} else {
return and__3362__auto__;
}
})()){
return this$.com$rpl$specter$protocols$StructurePath$select_STAR_$arity$3(this$,structure,next_fn);
} else {
var x__3634__auto__ = (((this$ == null))?null:this$);
return (function (){var or__3370__auto__ = (com.rpl.specter.protocols.select_STAR_[goog.typeOf(x__3634__auto__)]);
if(or__3370__auto__){
return or__3370__auto__;
} else {
var or__3370__auto____$1 = (com.rpl.specter.protocols.select_STAR_["_"]);
if(or__3370__auto____$1){
return or__3370__auto____$1;
} else {
throw cljs.core.missing_protocol.call(null,"StructurePath.select*",this$);
}
}
})().call(null,this$,structure,next_fn);
}
});
com.rpl.specter.protocols.transform_STAR_ = (function com$rpl$specter$protocols$transform_STAR_(this$,structure,next_fn){
if((function (){var and__3362__auto__ = this$;
if(and__3362__auto__){
return this$.com$rpl$specter$protocols$StructurePath$transform_STAR_$arity$3;
} else {
return and__3362__auto__;
}
})()){
return this$.com$rpl$specter$protocols$StructurePath$transform_STAR_$arity$3(this$,structure,next_fn);
} else {
var x__3634__auto__ = (((this$ == null))?null:this$);
return (function (){var or__3370__auto__ = (com.rpl.specter.protocols.transform_STAR_[goog.typeOf(x__3634__auto__)]);
if(or__3370__auto__){
return or__3370__auto__;
} else {
var or__3370__auto____$1 = (com.rpl.specter.protocols.transform_STAR_["_"]);
if(or__3370__auto____$1){
return or__3370__auto____$1;
} else {
throw cljs.core.missing_protocol.call(null,"StructurePath.transform*",this$);
}
}
})().call(null,this$,structure,next_fn);
}
});
com.rpl.specter.protocols.Collector = (function (){var obj267 = {};
return obj267;
})();
com.rpl.specter.protocols.collect_val = (function com$rpl$specter$protocols$collect_val(this$,structure){
if((function (){var and__3362__auto__ = this$;
if(and__3362__auto__){
return this$.com$rpl$specter$protocols$Collector$collect_val$arity$2;
} else {
return and__3362__auto__;
}
})()){
return this$.com$rpl$specter$protocols$Collector$collect_val$arity$2(this$,structure);
} else {
var x__3634__auto__ = (((this$ == null))?null:this$);
return (function (){var or__3370__auto__ = (com.rpl.specter.protocols.collect_val[goog.typeOf(x__3634__auto__)]);
if(or__3370__auto__){
return or__3370__auto__;
} else {
var or__3370__auto____$1 = (com.rpl.specter.protocols.collect_val["_"]);
if(or__3370__auto____$1){
return or__3370__auto____$1;
} else {
throw cljs.core.missing_protocol.call(null,"Collector.collect-val",this$);
}
}
})().call(null,this$,structure);
}
});
com.rpl.specter.protocols.StructureValsPathComposer = (function (){var obj269 = {};
return obj269;
})();
com.rpl.specter.protocols.comp_paths_STAR_ = (function com$rpl$specter$protocols$comp_paths_STAR_(paths){
if((function (){var and__3362__auto__ = paths;
if(and__3362__auto__){
return paths.com$rpl$specter$protocols$StructureValsPathComposer$comp_paths_STAR_$arity$1;
} else {
return and__3362__auto__;
}
})()){
return paths.com$rpl$specter$protocols$StructureValsPathComposer$comp_paths_STAR_$arity$1(paths);
} else {
var x__3634__auto__ = (((paths == null))?null:paths);
return (function (){var or__3370__auto__ = (com.rpl.specter.protocols.comp_paths_STAR_[goog.typeOf(x__3634__auto__)]);
if(or__3370__auto__){
return or__3370__auto__;
} else {
var or__3370__auto____$1 = (com.rpl.specter.protocols.comp_paths_STAR_["_"]);
if(or__3370__auto____$1){
return or__3370__auto____$1;
} else {
throw cljs.core.missing_protocol.call(null,"StructureValsPathComposer.comp-paths*",paths);
}
}
})().call(null,paths);
}
});
//# sourceMappingURL=protocols.js.map

View file

@ -1 +0,0 @@
{"version":3,"file":"\/Users\/pietromenna\/git\/specter\/out\/com\/rpl\/specter\/protocols.js","sources":["protocols.cljc"],"lineCount":181,"mappings":";AAAA;;AAEA,AAAA;AAAA,8CAAA,iBAAAA,SAAA,xEAAaQ;AAAb,AAAAR;;;AAAA,8CAAA,9CACGS,oGAAcC,MAAKC,KAAKC,UAAUC;AADrC,AAAA,GAAA,iBAAAZ,oBACiBS;AADjB,AAAA,GAAAT;AAAA,OACiBS;;AADjBT;;;AAAA,OACiBS,4EAAAA,MAAKC,KAAKC,UAAUC;;AADrC,IAAAX,kBAAA,EAAA,UAAA,OAAA,hBACiBQ,qBAAAA;AADjB,AAAA,OAAA,iBAAAP,mBAAA,CAAAC,4CAAA,AAAAC,YAAAH;AAAA,AAAA,GAAAC;AAAAA;;AAAA,IAAAA,uBAAA,CAAAC,4CAAA;AAAA,AAAA,GAAAD;AAAAA;;AAAA,MAAA,AAAAG,qCAAA,iCACiBI;;;eAAAA,MAAKC,KAAKC,UAAUC;;;;AADrC,iDAAA,jDAEGC,0GAAiBJ,MAAKC,KAAKC,UAAUC;AAFxC,AAAA,GAAA,iBAAAZ,oBAEoBS;AAFpB,AAAA,GAAAT;AAAA,OAEoBS;;AAFpBT;;;AAAA,OAEoBS,+EAAAA,MAAKC,KAAKC,UAAUC;;AAFxC,IAAAX,kBAAA,EAAA,UAAA,OAAA,hBAEoBQ,qBAAAA;AAFpB,AAAA,OAAA,iBAAAP,mBAAA,CAAAI,+CAAA,AAAAF,YAAAH;AAAA,AAAA,GAAAC;AAAAA;;AAAA,IAAAA,uBAAA,CAAAI,+CAAA;AAAA,AAAA,GAAAJ;AAAAA;;AAAA,MAAA,AAAAG,qCAAA,oCAEoBI;;;eAAAA,MAAKC,KAAKC,UAAUC;;;;AAFxC,AAIA,AAAA;AAAA,0CAAA,iBAAAE,SAAA,pEAAaG;AAAb,AAAAH;;;AAAA,yCAAA,zCACGI,0FAAST,MAAKE,UAAUC;AAD3B,AAAA,GAAA,iBAAAZ,oBACYS;AADZ,AAAA,GAAAT;AAAA,OACYS;;AADZT;;;AAAA,OACYS,mEAAAA,MAAKE,UAAUC;;AAD3B,IAAAX,kBAAA,EAAA,UAAA,OAAA,hBACYQ,qBAAAA;AADZ,AAAA,OAAA,iBAAAP,mBAAA,CAAAa,uCAAA,AAAAX,YAAAH;AAAA,AAAA,GAAAC;AAAAA;;AAAA,IAAAA,uBAAA,CAAAa,uCAAA;AAAA,AAAA,GAAAb;AAAAA;;AAAA,MAAA,AAAAG,qCAAA,wBACYI;;;eAAAA,MAAKE,UAAUC;;;;AAD3B,4CAAA,5CAEGO,gGAAYV,MAAKE,UAAUC;AAF9B,AAAA,GAAA,iBAAAZ,oBAEeS;AAFf,AAAA,GAAAT;AAAA,OAEeS;;AAFfT;;;AAAA,OAEeS,sEAAAA,MAAKE,UAAUC;;AAF9B,IAAAX,kBAAA,EAAA,UAAA,OAAA,hBAEeQ,qBAAAA;AAFf,AAAA,OAAA,iBAAAP,mBAAA,CAAAc,0CAAA,AAAAZ,YAAAH;AAAA,AAAA,GAAAC;AAAAA;;AAAA,IAAAA,uBAAA,CAAAc,0CAAA;AAAA,AAAA,GAAAd;AAAAA;;AAAA,MAAA,AAAAG,qCAAA,2BAEeI;;;eAAAA,MAAKE,UAAUC;;;;AAF9B,AAIA,AAAA;AAAA,sCAAA,iBAAAQ,SAAA,hEAAaE;AAAb,AAAAF;;;AAAA,wCAAA,xCACGG,wFAAad,MAAKE;AADrB,AAAA,GAAA,iBAAAX,oBACgBS;AADhB,AAAA,GAAAT;AAAA,OACgBS;;AADhBT;;;AAAA,OACgBS,8DAAAA,MAAKE;;AADrB,IAAAV,kBAAA,EAAA,UAAA,OAAA,hBACgBQ,qBAAAA;AADhB,AAAA,OAAA,iBAAAP,mBAAA,CAAAmB,sCAAA,AAAAjB,YAAAH;AAAA,AAAA,GAAAC;AAAAA;;AAAA,IAAAA,uBAAA,CAAAmB,sCAAA;AAAA,AAAA,GAAAnB;AAAAA;;AAAA,MAAA,AAAAG,qCAAA,wBACgBI;;;eAAAA,MAAKE;;;;AADrB,AAGA,AAAA;AAAA,sDAAA,iBAAAa,SAAA,hFAAaE;AAAb,AAAAF;;;AAAA,6CAAA,7CACGG,kGAAaC;AADhB,AAAA,GAAA,iBAAA5B,oBACgB4B;AADhB,AAAA,GAAA5B;AAAA,OACgB4B;;AADhB5B;;;AAAA,OACgB4B,mFAAAA;;AADhB,IAAA3B,kBAAA,EAAA,UAAA,OAAA,hBACgB2B,qBAAAA;AADhB,AAAA,OAAA,iBAAA1B,mBAAA,CAAAuB,2CAAA,AAAArB,YAAAH;AAAA,AAAA,GAAAC;AAAAA;;AAAA,IAAAA,uBAAA,CAAAuB,2CAAA;AAAA,AAAA,GAAAvB;AAAAA;;AAAA,MAAA,AAAAG,qCAAA,wCACgBuB;;;eAAAA;;;;AADhB","names":["obj263","and__3362__auto__","x__3634__auto__","or__3370__auto__","com\/rpl.specter.protocols.select-full*","goog\/typeOf","cljs.core\/missing-protocol","com\/rpl.specter.protocols.transform-full*","com.rpl.specter.protocols\/StructureValsPath","com.rpl.specter.protocols\/select-full*","this","vals","structure","next-fn","com.rpl.specter.protocols\/transform-full*","obj265","com\/rpl.specter.protocols.select*","com\/rpl.specter.protocols.transform*","com.rpl.specter.protocols\/StructurePath","com.rpl.specter.protocols\/select*","com.rpl.specter.protocols\/transform*","obj267","com\/rpl.specter.protocols.collect-val","com.rpl.specter.protocols\/Collector","com.rpl.specter.protocols\/collect-val","obj269","com\/rpl.specter.protocols.comp-paths*","com.rpl.specter.protocols\/StructureValsPathComposer","com.rpl.specter.protocols\/comp-paths*","paths"]}

File diff suppressed because it is too large Load diff

View file

@ -1,365 +0,0 @@
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Utilities to check the preconditions, postconditions and
* invariants runtime.
*
* Methods in this package should be given special treatment by the compiler
* for type-inference. For example, <code>goog.asserts.assert(foo)</code>
* will restrict <code>foo</code> to a truthy value.
*
* The compiler has an option to disable asserts. So code like:
* <code>
* var x = goog.asserts.assert(foo()); goog.asserts.assert(bar());
* </code>
* will be transformed into:
* <code>
* var x = foo();
* </code>
* The compiler will leave in foo() (because its return value is used),
* but it will remove bar() because it assumes it does not have side-effects.
*
* @author agrieve@google.com (Andrew Grieve)
*/
goog.provide('goog.asserts');
goog.provide('goog.asserts.AssertionError');
goog.require('goog.debug.Error');
goog.require('goog.dom.NodeType');
goog.require('goog.string');
/**
* @define {boolean} Whether to strip out asserts or to leave them in.
*/
goog.define('goog.asserts.ENABLE_ASSERTS', goog.DEBUG);
/**
* Error object for failed assertions.
* @param {string} messagePattern The pattern that was used to form message.
* @param {!Array<*>} messageArgs The items to substitute into the pattern.
* @constructor
* @extends {goog.debug.Error}
* @final
*/
goog.asserts.AssertionError = function(messagePattern, messageArgs) {
messageArgs.unshift(messagePattern);
goog.debug.Error.call(this, goog.string.subs.apply(null, messageArgs));
// Remove the messagePattern afterwards to avoid permenantly modifying the
// passed in array.
messageArgs.shift();
/**
* The message pattern used to format the error message. Error handlers can
* use this to uniquely identify the assertion.
* @type {string}
*/
this.messagePattern = messagePattern;
};
goog.inherits(goog.asserts.AssertionError, goog.debug.Error);
/** @override */
goog.asserts.AssertionError.prototype.name = 'AssertionError';
/**
* The default error handler.
* @param {!goog.asserts.AssertionError} e The exception to be handled.
*/
goog.asserts.DEFAULT_ERROR_HANDLER = function(e) { throw e; };
/**
* The handler responsible for throwing or logging assertion errors.
* @private {function(!goog.asserts.AssertionError)}
*/
goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER;
/**
* Throws an exception with the given message and "Assertion failed" prefixed
* onto it.
* @param {string} defaultMessage The message to use if givenMessage is empty.
* @param {Array<*>} defaultArgs The substitution arguments for defaultMessage.
* @param {string|undefined} givenMessage Message supplied by the caller.
* @param {Array<*>} givenArgs The substitution arguments for givenMessage.
* @throws {goog.asserts.AssertionError} When the value is not a number.
* @private
*/
goog.asserts.doAssertFailure_ =
function(defaultMessage, defaultArgs, givenMessage, givenArgs) {
var message = 'Assertion failed';
if (givenMessage) {
message += ': ' + givenMessage;
var args = givenArgs;
} else if (defaultMessage) {
message += ': ' + defaultMessage;
args = defaultArgs;
}
// The '' + works around an Opera 10 bug in the unit tests. Without it,
// a stack trace is added to var message above. With this, a stack trace is
// not added until this line (it causes the extra garbage to be added after
// the assertion message instead of in the middle of it).
var e = new goog.asserts.AssertionError('' + message, args || []);
goog.asserts.errorHandler_(e);
};
/**
* Sets a custom error handler that can be used to customize the behavior of
* assertion failures, for example by turning all assertion failures into log
* messages.
* @param {function(!goog.asserts.AssertionError)} errorHandler
*/
goog.asserts.setErrorHandler = function(errorHandler) {
if (goog.asserts.ENABLE_ASSERTS) {
goog.asserts.errorHandler_ = errorHandler;
}
};
/**
* Checks if the condition evaluates to true if goog.asserts.ENABLE_ASSERTS is
* true.
* @template T
* @param {T} condition The condition to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {T} The value of the condition.
* @throws {goog.asserts.AssertionError} When the condition evaluates to false.
*/
goog.asserts.assert = function(condition, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !condition) {
goog.asserts.doAssertFailure_('', null, opt_message,
Array.prototype.slice.call(arguments, 2));
}
return condition;
};
/**
* Fails if goog.asserts.ENABLE_ASSERTS is true. This function is useful in case
* when we want to add a check in the unreachable area like switch-case
* statement:
*
* <pre>
* switch(type) {
* case FOO: doSomething(); break;
* case BAR: doSomethingElse(); break;
* default: goog.assert.fail('Unrecognized type: ' + type);
* // We have only 2 types - "default:" section is unreachable code.
* }
* </pre>
*
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @throws {goog.asserts.AssertionError} Failure.
*/
goog.asserts.fail = function(opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS) {
goog.asserts.errorHandler_(new goog.asserts.AssertionError(
'Failure' + (opt_message ? ': ' + opt_message : ''),
Array.prototype.slice.call(arguments, 1)));
}
};
/**
* Checks if the value is a number if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {number} The value, guaranteed to be a number when asserts enabled.
* @throws {goog.asserts.AssertionError} When the value is not a number.
*/
goog.asserts.assertNumber = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isNumber(value)) {
goog.asserts.doAssertFailure_('Expected number but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {number} */ (value);
};
/**
* Checks if the value is a string if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {string} The value, guaranteed to be a string when asserts enabled.
* @throws {goog.asserts.AssertionError} When the value is not a string.
*/
goog.asserts.assertString = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isString(value)) {
goog.asserts.doAssertFailure_('Expected string but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {string} */ (value);
};
/**
* Checks if the value is a function if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {!Function} The value, guaranteed to be a function when asserts
* enabled.
* @throws {goog.asserts.AssertionError} When the value is not a function.
*/
goog.asserts.assertFunction = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isFunction(value)) {
goog.asserts.doAssertFailure_('Expected function but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {!Function} */ (value);
};
/**
* Checks if the value is an Object if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {!Object} The value, guaranteed to be a non-null object.
* @throws {goog.asserts.AssertionError} When the value is not an object.
*/
goog.asserts.assertObject = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isObject(value)) {
goog.asserts.doAssertFailure_('Expected object but got %s: %s.',
[goog.typeOf(value), value],
opt_message, Array.prototype.slice.call(arguments, 2));
}
return /** @type {!Object} */ (value);
};
/**
* Checks if the value is an Array if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {!Array<?>} The value, guaranteed to be a non-null array.
* @throws {goog.asserts.AssertionError} When the value is not an array.
*/
goog.asserts.assertArray = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isArray(value)) {
goog.asserts.doAssertFailure_('Expected array but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {!Array<?>} */ (value);
};
/**
* Checks if the value is a boolean if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {boolean} The value, guaranteed to be a boolean when asserts are
* enabled.
* @throws {goog.asserts.AssertionError} When the value is not a boolean.
*/
goog.asserts.assertBoolean = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(value)) {
goog.asserts.doAssertFailure_('Expected boolean but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {boolean} */ (value);
};
/**
* Checks if the value is a DOM Element if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {!Element} The value, likely to be a DOM Element when asserts are
* enabled.
* @throws {goog.asserts.AssertionError} When the value is not an Element.
*/
goog.asserts.assertElement = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && (!goog.isObject(value) ||
value.nodeType != goog.dom.NodeType.ELEMENT)) {
goog.asserts.doAssertFailure_('Expected Element but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {!Element} */ (value);
};
/**
* Checks if the value is an instance of the user-defined type if
* goog.asserts.ENABLE_ASSERTS is true.
*
* The compiler may tighten the type returned by this function.
*
* @param {*} value The value to check.
* @param {function(new: T, ...)} type A user-defined constructor.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @throws {goog.asserts.AssertionError} When the value is not an instance of
* type.
* @return {T}
* @template T
*/
goog.asserts.assertInstanceof = function(value, type, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !(value instanceof type)) {
goog.asserts.doAssertFailure_('Expected instanceof %s but got %s.',
[goog.asserts.getType_(type), goog.asserts.getType_(value)],
opt_message, Array.prototype.slice.call(arguments, 3));
}
return value;
};
/**
* Checks that no enumerable keys are present in Object.prototype. Such keys
* would break most code that use {@code for (var ... in ...)} loops.
*/
goog.asserts.assertObjectPrototypeIsIntact = function() {
for (var key in Object.prototype) {
goog.asserts.fail(key + ' should not be enumerable in Object.prototype.');
}
};
/**
* Returns the type of a value. If a constructor is passed, and a suitable
* string cannot be found, 'unknown type name' will be returned.
* @param {*} value A constructor, object, or primitive.
* @return {string} The best display name for the value, or 'unknown type name'.
* @private
*/
goog.asserts.getType_ = function(value) {
if (value instanceof Function) {
return value.displayName || value.name || 'unknown type name';
} else if (value instanceof Object) {
return value.constructor.displayName || value.constructor.name ||
Object.prototype.toString.call(value);
} else {
return value === null ? 'null' : typeof value;
}
};

File diff suppressed because it is too large Load diff

View file

@ -1,108 +0,0 @@
// Copyright 2013 The Closure Library Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview A nodejs script for dynamically requiring Closure within
* nodejs.
*
* Example of usage:
* <code>
* require('./bootstrap/nodejs')
* goog.require('goog.ui.Component')
* </code>
*
* This loads goog.ui.Component in the global scope.
*
* If you want to load custom libraries, you can require the custom deps file
* directly. If your custom libraries introduce new globals, you may
* need to run goog.nodeGlobalRequire to get them to load correctly.
*
* <code>
* require('./path/to/my/deps.js')
* goog.bootstrap.nodeJs.nodeGlobalRequire('./path/to/my/base.js')
* goog.require('my.Class')
* </code>
*
* @author nick@medium.com (Nick Santos)
*
* @nocompile
*/
var fs = require("fs");
var vm = require("vm");
var path = require("path");
var CLJS_ROOT = ".";
/**
* The goog namespace in the global scope.
*/
global.goog = {};
/**
* Imports a script using Node's require() API.
*
* @param {string} src The script source.
* @return {boolean} True if the script was imported, false otherwise.
*/
global.CLOSURE_IMPORT_SCRIPT = function(src) {
// if CLJS_ROOT has been rewritten (by REPLs) need to compute require path
// so we can delete the old entry from the Node.js require cache
if(CLJS_ROOT !== ".") {
var cached = null;
if(src.substring(0, 2) == "..") {
cached = path.join(CLJS_ROOT, src.substring(3));
} else {
cached = path.join(CLJS_ROOT, "goog", src);
}
if(require.cache[cached]) delete require.cache[cached];
}
// Sources are always expressed relative to closure's base.js, but
// require() is always relative to the current source.
require(path.join(".", "..", src));
return true;
};
// Declared here so it can be used to require base.js
function nodeGlobalRequire(file) {
var _module = global.module, _exports = global.exports;
global.module = undefined;
global.exports = undefined;
vm.runInThisContext(fs.readFileSync(file), file);
global.exports = _exports;
global.module = _module;
}
// Load Closure's base.js into memory. It is assumed base.js is in the
// directory above this directory given this script's location in
// bootstrap/nodejs.js.
nodeGlobalRequire(path.resolve(__dirname, '..', 'base.js'));
/**
* Bootstraps a file into the global scope.
*
* This is strictly for cases where normal require() won't work,
* because the file declares global symbols with 'var' that need to
* be added to the global scope.
* @suppress {missingProvide}
*
* @param {string} file The path to the file.
*/
goog.nodeGlobalRequire = nodeGlobalRequire;

View file

@ -1,63 +0,0 @@
// Copyright 2009 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Provides a base class for custom Error objects such that the
* stack is correctly maintained.
*
* You should never need to throw goog.debug.Error(msg) directly, Error(msg) is
* sufficient.
*
*/
goog.provide('goog.debug.Error');
/**
* Base class for custom error objects.
* @param {*=} opt_msg The message associated with the error.
* @constructor
* @extends {Error}
*/
goog.debug.Error = function(opt_msg) {
// Attempt to ensure there is a stack trace.
if (Error.captureStackTrace) {
Error.captureStackTrace(this, goog.debug.Error);
} else {
var stack = new Error().stack;
if (stack) {
this.stack = stack;
}
}
if (opt_msg) {
this.message = String(opt_msg);
}
/**
* Whether to report this error to the server. Setting this to false will
* cause the error reporter to not report the error back to the server,
* which can be useful if the client knows that the error has already been
* logged on the server.
* @type {boolean}
*/
this.reportErrorToServer = true;
};
goog.inherits(goog.debug.Error, Error);
/** @override */
goog.debug.Error.prototype.name = 'CustomError';

File diff suppressed because one or more lines are too long

View file

@ -1,48 +0,0 @@
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Definition of goog.dom.NodeType.
*/
goog.provide('goog.dom.NodeType');
/**
* Constants for the nodeType attribute in the Node interface.
*
* These constants match those specified in the Node interface. These are
* usually present on the Node object in recent browsers, but not in older
* browsers (specifically, early IEs) and thus are given here.
*
* In some browsers (early IEs), these are not defined on the Node object,
* so they are provided here.
*
* See http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247
* @enum {number}
*/
goog.dom.NodeType = {
ELEMENT: 1,
ATTRIBUTE: 2,
TEXT: 3,
CDATA_SECTION: 4,
ENTITY_REFERENCE: 5,
ENTITY: 6,
PROCESSING_INSTRUCTION: 7,
COMMENT: 8,
DOCUMENT: 9,
DOCUMENT_TYPE: 10,
DOCUMENT_FRAGMENT: 11,
NOTATION: 12
};

View file

@ -1,686 +0,0 @@
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Utilities for manipulating objects/maps/hashes.
* @author arv@google.com (Erik Arvidsson)
*/
goog.provide('goog.object');
/**
* Calls a function for each element in an object/map/hash.
*
* @param {Object<K,V>} obj The object over which to iterate.
* @param {function(this:T,V,?,Object<K,V>):?} f The function to call
* for every element. This function takes 3 arguments (the element, the
* index and the object) and the return value is ignored.
* @param {T=} opt_obj This is used as the 'this' object within f.
* @template T,K,V
*/
goog.object.forEach = function(obj, f, opt_obj) {
for (var key in obj) {
f.call(opt_obj, obj[key], key, obj);
}
};
/**
* Calls a function for each element in an object/map/hash. If that call returns
* true, adds the element to a new object.
*
* @param {Object<K,V>} obj The object over which to iterate.
* @param {function(this:T,V,?,Object<K,V>):boolean} f The function to call
* for every element. This
* function takes 3 arguments (the element, the index and the object)
* and should return a boolean. If the return value is true the
* element is added to the result object. If it is false the
* element is not included.
* @param {T=} opt_obj This is used as the 'this' object within f.
* @return {!Object<K,V>} a new object in which only elements that passed the
* test are present.
* @template T,K,V
*/
goog.object.filter = function(obj, f, opt_obj) {
var res = {};
for (var key in obj) {
if (f.call(opt_obj, obj[key], key, obj)) {
res[key] = obj[key];
}
}
return res;
};
/**
* For every element in an object/map/hash calls a function and inserts the
* result into a new object.
*
* @param {Object<K,V>} obj The object over which to iterate.
* @param {function(this:T,V,?,Object<K,V>):R} f The function to call
* for every element. This function
* takes 3 arguments (the element, the index and the object)
* and should return something. The result will be inserted
* into a new object.
* @param {T=} opt_obj This is used as the 'this' object within f.
* @return {!Object<K,R>} a new object with the results from f.
* @template T,K,V,R
*/
goog.object.map = function(obj, f, opt_obj) {
var res = {};
for (var key in obj) {
res[key] = f.call(opt_obj, obj[key], key, obj);
}
return res;
};
/**
* Calls a function for each element in an object/map/hash. If any
* call returns true, returns true (without checking the rest). If
* all calls return false, returns false.
*
* @param {Object<K,V>} obj The object to check.
* @param {function(this:T,V,?,Object<K,V>):boolean} f The function to
* call for every element. This function
* takes 3 arguments (the element, the index and the object) and should
* return a boolean.
* @param {T=} opt_obj This is used as the 'this' object within f.
* @return {boolean} true if any element passes the test.
* @template T,K,V
*/
goog.object.some = function(obj, f, opt_obj) {
for (var key in obj) {
if (f.call(opt_obj, obj[key], key, obj)) {
return true;
}
}
return false;
};
/**
* Calls a function for each element in an object/map/hash. If
* all calls return true, returns true. If any call returns false, returns
* false at this point and does not continue to check the remaining elements.
*
* @param {Object<K,V>} obj The object to check.
* @param {?function(this:T,V,?,Object<K,V>):boolean} f The function to
* call for every element. This function
* takes 3 arguments (the element, the index and the object) and should
* return a boolean.
* @param {T=} opt_obj This is used as the 'this' object within f.
* @return {boolean} false if any element fails the test.
* @template T,K,V
*/
goog.object.every = function(obj, f, opt_obj) {
for (var key in obj) {
if (!f.call(opt_obj, obj[key], key, obj)) {
return false;
}
}
return true;
};
/**
* Returns the number of key-value pairs in the object map.
*
* @param {Object} obj The object for which to get the number of key-value
* pairs.
* @return {number} The number of key-value pairs in the object map.
*/
goog.object.getCount = function(obj) {
// JS1.5 has __count__ but it has been deprecated so it raises a warning...
// in other words do not use. Also __count__ only includes the fields on the
// actual object and not in the prototype chain.
var rv = 0;
for (var key in obj) {
rv++;
}
return rv;
};
/**
* Returns one key from the object map, if any exists.
* For map literals the returned key will be the first one in most of the
* browsers (a know exception is Konqueror).
*
* @param {Object} obj The object to pick a key from.
* @return {string|undefined} The key or undefined if the object is empty.
*/
goog.object.getAnyKey = function(obj) {
for (var key in obj) {
return key;
}
};
/**
* Returns one value from the object map, if any exists.
* For map literals the returned value will be the first one in most of the
* browsers (a know exception is Konqueror).
*
* @param {Object<K,V>} obj The object to pick a value from.
* @return {V|undefined} The value or undefined if the object is empty.
* @template K,V
*/
goog.object.getAnyValue = function(obj) {
for (var key in obj) {
return obj[key];
}
};
/**
* Whether the object/hash/map contains the given object as a value.
* An alias for goog.object.containsValue(obj, val).
*
* @param {Object<K,V>} obj The object in which to look for val.
* @param {V} val The object for which to check.
* @return {boolean} true if val is present.
* @template K,V
*/
goog.object.contains = function(obj, val) {
return goog.object.containsValue(obj, val);
};
/**
* Returns the values of the object/map/hash.
*
* @param {Object<K,V>} obj The object from which to get the values.
* @return {!Array<V>} The values in the object/map/hash.
* @template K,V
*/
goog.object.getValues = function(obj) {
var res = [];
var i = 0;
for (var key in obj) {
res[i++] = obj[key];
}
return res;
};
/**
* Returns the keys of the object/map/hash.
*
* @param {Object} obj The object from which to get the keys.
* @return {!Array<string>} Array of property keys.
*/
goog.object.getKeys = function(obj) {
var res = [];
var i = 0;
for (var key in obj) {
res[i++] = key;
}
return res;
};
/**
* Get a value from an object multiple levels deep. This is useful for
* pulling values from deeply nested objects, such as JSON responses.
* Example usage: getValueByKeys(jsonObj, 'foo', 'entries', 3)
*
* @param {!Object} obj An object to get the value from. Can be array-like.
* @param {...(string|number|!Array<number|string>)} var_args A number of keys
* (as strings, or numbers, for array-like objects). Can also be
* specified as a single array of keys.
* @return {*} The resulting value. If, at any point, the value for a key
* is undefined, returns undefined.
*/
goog.object.getValueByKeys = function(obj, var_args) {
var isArrayLike = goog.isArrayLike(var_args);
var keys = isArrayLike ? var_args : arguments;
// Start with the 2nd parameter for the variable parameters syntax.
for (var i = isArrayLike ? 0 : 1; i < keys.length; i++) {
obj = obj[keys[i]];
if (!goog.isDef(obj)) {
break;
}
}
return obj;
};
/**
* Whether the object/map/hash contains the given key.
*
* @param {Object} obj The object in which to look for key.
* @param {*} key The key for which to check.
* @return {boolean} true If the map contains the key.
*/
goog.object.containsKey = function(obj, key) {
return key in obj;
};
/**
* Whether the object/map/hash contains the given value. This is O(n).
*
* @param {Object<K,V>} obj The object in which to look for val.
* @param {V} val The value for which to check.
* @return {boolean} true If the map contains the value.
* @template K,V
*/
goog.object.containsValue = function(obj, val) {
for (var key in obj) {
if (obj[key] == val) {
return true;
}
}
return false;
};
/**
* Searches an object for an element that satisfies the given condition and
* returns its key.
* @param {Object<K,V>} obj The object to search in.
* @param {function(this:T,V,string,Object<K,V>):boolean} f The
* function to call for every element. Takes 3 arguments (the value,
* the key and the object) and should return a boolean.
* @param {T=} opt_this An optional "this" context for the function.
* @return {string|undefined} The key of an element for which the function
* returns true or undefined if no such element is found.
* @template T,K,V
*/
goog.object.findKey = function(obj, f, opt_this) {
for (var key in obj) {
if (f.call(opt_this, obj[key], key, obj)) {
return key;
}
}
return undefined;
};
/**
* Searches an object for an element that satisfies the given condition and
* returns its value.
* @param {Object<K,V>} obj The object to search in.
* @param {function(this:T,V,string,Object<K,V>):boolean} f The function
* to call for every element. Takes 3 arguments (the value, the key
* and the object) and should return a boolean.
* @param {T=} opt_this An optional "this" context for the function.
* @return {V} The value of an element for which the function returns true or
* undefined if no such element is found.
* @template T,K,V
*/
goog.object.findValue = function(obj, f, opt_this) {
var key = goog.object.findKey(obj, f, opt_this);
return key && obj[key];
};
/**
* Whether the object/map/hash is empty.
*
* @param {Object} obj The object to test.
* @return {boolean} true if obj is empty.
*/
goog.object.isEmpty = function(obj) {
for (var key in obj) {
return false;
}
return true;
};
/**
* Removes all key value pairs from the object/map/hash.
*
* @param {Object} obj The object to clear.
*/
goog.object.clear = function(obj) {
for (var i in obj) {
delete obj[i];
}
};
/**
* Removes a key-value pair based on the key.
*
* @param {Object} obj The object from which to remove the key.
* @param {*} key The key to remove.
* @return {boolean} Whether an element was removed.
*/
goog.object.remove = function(obj, key) {
var rv;
if ((rv = key in obj)) {
delete obj[key];
}
return rv;
};
/**
* Adds a key-value pair to the object. Throws an exception if the key is
* already in use. Use set if you want to change an existing pair.
*
* @param {Object<K,V>} obj The object to which to add the key-value pair.
* @param {string} key The key to add.
* @param {V} val The value to add.
* @template K,V
*/
goog.object.add = function(obj, key, val) {
if (key in obj) {
throw Error('The object already contains the key "' + key + '"');
}
goog.object.set(obj, key, val);
};
/**
* Returns the value for the given key.
*
* @param {Object<K,V>} obj The object from which to get the value.
* @param {string} key The key for which to get the value.
* @param {R=} opt_val The value to return if no item is found for the given
* key (default is undefined).
* @return {V|R|undefined} The value for the given key.
* @template K,V,R
*/
goog.object.get = function(obj, key, opt_val) {
if (key in obj) {
return obj[key];
}
return opt_val;
};
/**
* Adds a key-value pair to the object/map/hash.
*
* @param {Object<K,V>} obj The object to which to add the key-value pair.
* @param {string} key The key to add.
* @param {V} value The value to add.
* @template K,V
*/
goog.object.set = function(obj, key, value) {
obj[key] = value;
};
/**
* Adds a key-value pair to the object/map/hash if it doesn't exist yet.
*
* @param {Object<K,V>} obj The object to which to add the key-value pair.
* @param {string} key The key to add.
* @param {V} value The value to add if the key wasn't present.
* @return {V} The value of the entry at the end of the function.
* @template K,V
*/
goog.object.setIfUndefined = function(obj, key, value) {
return key in obj ? obj[key] : (obj[key] = value);
};
/**
* Sets a key and value to an object if the key is not set. The value will be
* the return value of the given function. If the key already exists, the
* object will not be changed and the function will not be called (the function
* will be lazily evaluated -- only called if necessary).
*
* This function is particularly useful for use with a map used a as a cache.
*
* @param {!Object<K,V>} obj The object to which to add the key-value pair.
* @param {string} key The key to add.
* @param {function():V} f The value to add if the key wasn't present.
* @return {V} The value of the entry at the end of the function.
* @template K,V
*/
goog.object.setWithReturnValueIfNotSet = function(obj, key, f) {
if (key in obj) {
return obj[key];
}
var val = f();
obj[key] = val;
return val;
};
/**
* Compares two objects for equality using === on the values.
*
* @param {!Object<K,V>} a
* @param {!Object<K,V>} b
* @return {boolean}
* @template K,V
*/
goog.object.equals = function(a, b) {
for (var k in a) {
if (!(k in b) || a[k] !== b[k]) {
return false;
}
}
for (var k in b) {
if (!(k in a)) {
return false;
}
}
return true;
};
/**
* Does a flat clone of the object.
*
* @param {Object<K,V>} obj Object to clone.
* @return {!Object<K,V>} Clone of the input object.
* @template K,V
*/
goog.object.clone = function(obj) {
// We cannot use the prototype trick because a lot of methods depend on where
// the actual key is set.
var res = {};
for (var key in obj) {
res[key] = obj[key];
}
return res;
// We could also use goog.mixin but I wanted this to be independent from that.
};
/**
* Clones a value. The input may be an Object, Array, or basic type. Objects and
* arrays will be cloned recursively.
*
* WARNINGS:
* <code>goog.object.unsafeClone</code> does not detect reference loops. Objects
* that refer to themselves will cause infinite recursion.
*
* <code>goog.object.unsafeClone</code> is unaware of unique identifiers, and
* copies UIDs created by <code>getUid</code> into cloned results.
*
* @param {*} obj The value to clone.
* @return {*} A clone of the input value.
*/
goog.object.unsafeClone = function(obj) {
var type = goog.typeOf(obj);
if (type == 'object' || type == 'array') {
if (obj.clone) {
return obj.clone();
}
var clone = type == 'array' ? [] : {};
for (var key in obj) {
clone[key] = goog.object.unsafeClone(obj[key]);
}
return clone;
}
return obj;
};
/**
* Returns a new object in which all the keys and values are interchanged
* (keys become values and values become keys). If multiple keys map to the
* same value, the chosen transposed value is implementation-dependent.
*
* @param {Object} obj The object to transpose.
* @return {!Object} The transposed object.
*/
goog.object.transpose = function(obj) {
var transposed = {};
for (var key in obj) {
transposed[obj[key]] = key;
}
return transposed;
};
/**
* The names of the fields that are defined on Object.prototype.
* @type {Array<string>}
* @private
*/
goog.object.PROTOTYPE_FIELDS_ = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
/**
* Extends an object with another object.
* This operates 'in-place'; it does not create a new Object.
*
* Example:
* var o = {};
* goog.object.extend(o, {a: 0, b: 1});
* o; // {a: 0, b: 1}
* goog.object.extend(o, {b: 2, c: 3});
* o; // {a: 0, b: 2, c: 3}
*
* @param {Object} target The object to modify. Existing properties will be
* overwritten if they are also present in one of the objects in
* {@code var_args}.
* @param {...Object} var_args The objects from which values will be copied.
*/
goog.object.extend = function(target, var_args) {
var key, source;
for (var i = 1; i < arguments.length; i++) {
source = arguments[i];
for (key in source) {
target[key] = source[key];
}
// For IE the for-in-loop does not contain any properties that are not
// enumerable on the prototype object (for example isPrototypeOf from
// Object.prototype) and it will also not include 'replace' on objects that
// extend String and change 'replace' (not that it is common for anyone to
// extend anything except Object).
for (var j = 0; j < goog.object.PROTOTYPE_FIELDS_.length; j++) {
key = goog.object.PROTOTYPE_FIELDS_[j];
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
};
/**
* Creates a new object built from the key-value pairs provided as arguments.
* @param {...*} var_args If only one argument is provided and it is an array
* then this is used as the arguments, otherwise even arguments are used as
* the property names and odd arguments are used as the property values.
* @return {!Object} The new object.
* @throws {Error} If there are uneven number of arguments or there is only one
* non array argument.
*/
goog.object.create = function(var_args) {
var argLength = arguments.length;
if (argLength == 1 && goog.isArray(arguments[0])) {
return goog.object.create.apply(null, arguments[0]);
}
if (argLength % 2) {
throw Error('Uneven number of arguments');
}
var rv = {};
for (var i = 0; i < argLength; i += 2) {
rv[arguments[i]] = arguments[i + 1];
}
return rv;
};
/**
* Creates a new object where the property names come from the arguments but
* the value is always set to true
* @param {...*} var_args If only one argument is provided and it is an array
* then this is used as the arguments, otherwise the arguments are used
* as the property names.
* @return {!Object} The new object.
*/
goog.object.createSet = function(var_args) {
var argLength = arguments.length;
if (argLength == 1 && goog.isArray(arguments[0])) {
return goog.object.createSet.apply(null, arguments[0]);
}
var rv = {};
for (var i = 0; i < argLength; i++) {
rv[arguments[i]] = true;
}
return rv;
};
/**
* Creates an immutable view of the underlying object, if the browser
* supports immutable objects.
*
* In default mode, writes to this view will fail silently. In strict mode,
* they will throw an error.
*
* @param {!Object<K,V>} obj An object.
* @return {!Object<K,V>} An immutable view of that object, or the
* original object if this browser does not support immutables.
* @template K,V
*/
goog.object.createImmutableView = function(obj) {
var result = obj;
if (Object.isFrozen && !Object.isFrozen(obj)) {
result = Object.create(obj);
Object.freeze(result);
}
return result;
};
/**
* @param {!Object} obj An object.
* @return {boolean} Whether this is an immutable view of the object.
*/
goog.object.isImmutableView = function(obj) {
return !!Object.isFrozen && Object.isFrozen(obj);
};

File diff suppressed because it is too large Load diff

View file

@ -1,103 +0,0 @@
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Utility for fast string concatenation.
*/
goog.provide('goog.string.StringBuffer');
/**
* Utility class to facilitate string concatenation.
*
* @param {*=} opt_a1 Optional first initial item to append.
* @param {...*} var_args Other initial items to
* append, e.g., new goog.string.StringBuffer('foo', 'bar').
* @constructor
*/
goog.string.StringBuffer = function(opt_a1, var_args) {
if (opt_a1 != null) {
this.append.apply(this, arguments);
}
};
/**
* Internal buffer for the string to be concatenated.
* @type {string}
* @private
*/
goog.string.StringBuffer.prototype.buffer_ = '';
/**
* Sets the contents of the string buffer object, replacing what's currently
* there.
*
* @param {*} s String to set.
*/
goog.string.StringBuffer.prototype.set = function(s) {
this.buffer_ = '' + s;
};
/**
* Appends one or more items to the buffer.
*
* Calling this with null, undefined, or empty arguments is an error.
*
* @param {*} a1 Required first string.
* @param {*=} opt_a2 Optional second string.
* @param {...*} var_args Other items to append,
* e.g., sb.append('foo', 'bar', 'baz').
* @return {!goog.string.StringBuffer} This same StringBuffer object.
* @suppress {duplicate}
*/
goog.string.StringBuffer.prototype.append = function(a1, opt_a2, var_args) {
// Use a1 directly to avoid arguments instantiation for single-arg case.
this.buffer_ += a1;
if (opt_a2 != null) { // second argument is undefined (null == undefined)
for (var i = 1; i < arguments.length; i++) {
this.buffer_ += arguments[i];
}
}
return this;
};
/**
* Clears the internal buffer.
*/
goog.string.StringBuffer.prototype.clear = function() {
this.buffer_ = '';
};
/**
* @return {number} the length of the current contents of the buffer.
*/
goog.string.StringBuffer.prototype.getLength = function() {
return this.buffer_.length;
};
/**
* @return {string} The concatenated string.
* @override
*/
goog.string.StringBuffer.prototype.toString = function() {
return this.buffer_;
};

View file

@ -1,7 +0,0 @@
goog.addDependency("base.js", ['goog'], []);
goog.addDependency("../cljs/core.js", ['cljs.core'], ['goog.string', 'goog.object', 'goog.string.StringBuffer', 'goog.array']);
goog.addDependency("../clojure/core/reducers.js", ['clojure.core.reducers'], ['cljs.core']);
goog.addDependency("../clojure/walk.js", ['clojure.walk'], ['cljs.core']);
goog.addDependency("../com/rpl/specter/protocols.js", ['com.rpl.specter.protocols'], ['cljs.core']);
goog.addDependency("../com/rpl/specter/impl.js", ['com.rpl.specter.impl'], ['clojure.core.reducers', 'cljs.core', 'clojure.walk', 'com.rpl.specter.protocols']);
goog.addDependency("../com/rpl/specter.js", ['com.rpl.specter'], ['cljs.core', 'com.rpl.specter.impl', 'com.rpl.specter.protocols']);

View file

@ -1,74 +0,0 @@
process.env.NODE_DISABLE_COLORS = true;
var net = require("net");
var vm = require("vm");
var dom = require("domain").create();
var PORT = 50415;
try {
require("source-map-support").install();
} catch(err) {
}
net.createServer(function (socket) {
var buffer = "",
ret = null,
err = null;
socket.write("ready");
socket.write("\0");
socket.setEncoding("utf8");
dom.on("error", function(ue) {
console.error(ue.stack);
});
socket.on("data", function(data) {
if(data[data.length-1] != "\0") {
buffer += data;
} else {
if(buffer.length > 0) {
data = buffer + data;
buffer = "";
}
if(data) {
// not sure how \0's are getting through - David
data = data.replace(/\0/g, "");
try {
dom.run(function() {
ret = vm.runInThisContext(data, "repl");
});
} catch (e) {
err = e;
}
}
if(err) {
socket.write(JSON.stringify({
status: "exception",
value: err.stack
}));
} else if(ret !== undefined && ret !== null) {
socket.write(JSON.stringify({
status: "success",
value: ret.toString()
}));
} else {
socket.write(JSON.stringify({
status: "success",
value: null
}));
}
ret = null;
err = null;
socket.write("\0");
}
});
}).listen(PORT);
console.log("ClojureScript Node.js REPL server listening on", PORT);

View file

@ -1,2 +0,0 @@
goog.addDependency("base.js", ['goog'], []);
goog.addDependency("../cljs/core.js", ['cljs.core'], ['goog.string', 'goog.object', 'goog.string.StringBuffer', 'goog.array']);

View file

@ -1,18 +0,0 @@
Building ...
Compiling src/com/rpl/specter/protocols.cljc
Compiling src/com/rpl/specter/impl.cljc
Reading analysis cache for jar:file:/Users/pietromenna/git/specter/cljs.jar!/clojure/core/reducers.cljs
Reading analysis cache for jar:file:/Users/pietromenna/git/specter/cljs.jar!/clojure/walk.cljs
WARNING: Use of undeclared Var com.rpl.specter.impl/find-protocol-impl at line 68 src/com/rpl/specter/impl.cljc
WARNING: Use of undeclared Var com.rpl.specter.impl/find-protocol-impl at line 128 src/com/rpl/specter/impl.cljc
WARNING: Extending an existing JavaScript type - use a different symbol name instead of js/Object e.g object at line 133 src/com/rpl/specter/impl.cljc
WARNING: Extending an existing JavaScript type - use a different symbol name instead of js/Object e.g object at line 202 src/com/rpl/specter/impl.cljc
WARNING: Extending an existing JavaScript type - use a different symbol name instead of js/Object e.g object at line 279 src/com/rpl/specter/impl.cljc
Compiling src/com/rpl/specter.cljc
WARNING: Extending an existing JavaScript type - use a different symbol name instead of js/Function e.g function at line 159 src/com/rpl/specter.cljc
Compiling out/clojure/walk.cljs
Compiling out/cljs/core.cljs
Using cached cljs.core out/cljs/core.cljs
Compiling out/clojure/core/reducers.cljs
... done. Elapsed 0.846669065 seconds
Watching paths: /Users/pietromenna/git/specter/src

797
pb
View file

@ -1,797 +0,0 @@
diff --git a/project.clj b/project.clj
index 13c1e4d..de6ff30 100644
--- a/project.clj
+++ b/project.clj
@@ -1,10 +1,10 @@
(def VERSION (.trim (slurp "VERSION")))
(defproject com.rpl/specter VERSION
- :dependencies [[org.clojure/clojure "1.6.0"]
+ :dependencies [[org.clojure/clojure "1.7.0-RC2"]
]
:jvm-opts ["-XX:-OmitStackTraceInFastThrow"] ; this prevents JVM from doing optimizations which can remove stack traces from NPE and other exceptions
- :source-paths ["src/clj"]
+ :source-paths ["src"]
:test-paths ["test/clj"]
:profiles {:dev {:dependencies
[[org.clojure/test.check "0.5.9"]]}
diff --git a/src/clj/com/rpl/specter.clj b/src/clj/com/rpl/specter.clj
deleted file mode 100644
index f117e99..0000000
--- a/src/clj/com/rpl/specter.clj
+++ /dev/null
@@ -1,205 +0,0 @@
-(ns com.rpl.specter
- (:use [com.rpl.specter impl protocols])
- )
-
-;;TODO: can make usage of vals much more efficient by determining during composition how many vals
-;;there are going to be. this should make it much easier to allocate space for vals without doing concats
-;;all over the place. The apply to the vals + structure can also be avoided since the number of vals is known
-;;beforehand
-(defn comp-paths [& paths]
- (comp-paths* (vec paths)))
-
-;; Selector functions
-
-(def ^{:doc "Version of select that takes in a selector pre-compiled with comp-paths"}
- compiled-select compiled-select*)
-
-(defn select
- "Navigates to and returns a sequence of all the elements specified by the selector."
- [selector structure]
- (compiled-select (comp-unoptimal selector)
- structure))
-
-(defn compiled-select-one
- "Version of select-one that takes in a selector pre-compiled with comp-paths"
- [selector structure]
- (let [res (compiled-select selector structure)]
- (when (> (count res) 1)
- (throw-illegal "More than one element found for params: " selector structure))
- (first res)
- ))
-
-(defn select-one
- "Like select, but returns either one element or nil. Throws exception if multiple elements found"
- [selector structure]
- (compiled-select-one (comp-unoptimal selector) structure))
-
-(defn compiled-select-one!
- "Version of select-one! that takes in a selector pre-compiled with comp-paths"
- [selector structure]
- (let [res (compiled-select-one selector structure)]
- (when (nil? res) (throw-illegal "No elements found for params: " selector structure))
- res
- ))
-
-(defn select-one!
- "Returns exactly one element, throws exception if zero or multiple elements found"
- [selector structure]
- (compiled-select-one! (comp-unoptimal selector) structure))
-
-(defn compiled-select-first
- "Version of select-first that takes in a selector pre-compiled with comp-paths"
- [selector structure]
- (first (compiled-select selector structure)))
-
-(defn select-first
- "Returns first element found. Not any more efficient than select, just a convenience"
- [selector structure]
- (compiled-select-first (comp-unoptimal selector) structure))
-
-;; Transformfunctions
-
-
-(def ^{:doc "Version of transform that takes in a selector pre-compiled with comp-paths"}
- compiled-transform compiled-transform*)
-
-(defn transform
- "Navigates to each value specified by the selector and replaces it by the result of running
- the transform-fn on it"
- [selector transform-fn structure]
- (compiled-transform (comp-unoptimal selector) transform-fn structure))
-
-(defn compiled-setval
- "Version of setval that takes in a selector pre-compiled with comp-paths"
- [selector val structure]
- (compiled-transform selector (fn [_] val) structure))
-
-(defn setval
- "Navigates to each value specified by the selector and replaces it by val"
- [selector val structure]
- (compiled-setval (comp-unoptimal selector) val structure))
-
-(defn compiled-replace-in
- "Version of replace-in that takes in a selector pre-compiled with comp-paths"
- [selector transform-fn structure & {:keys [merge-fn] :or {merge-fn concat}}]
- (let [state (mutable-cell nil)]
- [(compiled-transform selector
- (fn [e]
- (let [res (transform-fn e)]
- (if res
- (let [[ret user-ret] res]
- (->> user-ret
- (merge-fn (get-cell state))
- (set-cell! state))
- ret)
- e
- )))
- structure)
- (get-cell state)]
- ))
-
-(defn replace-in
- "Similar to transform, except returns a pair of [transformd-structure sequence-of-user-ret].
- The transform-fn in this case is expected to return [ret user-ret]. ret is
- what's used to transform the data structure, while user-ret will be added to the user-ret sequence
- in the final return. replace-in is useful for situations where you need to know the specific values
- of what was transformd in the data structure."
- [selector transform-fn structure & {:keys [merge-fn] :or {merge-fn concat}}]
- (compiled-replace-in (comp-unoptimal selector) transform-fn structure :merge-fn merge-fn))
-
-;; Built-in pathing and context operations
-
-(def ALL (->AllStructurePath))
-
-(def VAL (->ValCollect))
-
-(def LAST (->LastStructurePath))
-
-(def FIRST (->FirstStructurePath))
-
-(defn srange-dynamic [start-fn end-fn] (->SRangePath start-fn end-fn))
-
-(defn srange [start end] (srange-dynamic (fn [_] start) (fn [_] end)))
-
-(def START (srange 0 0))
-
-(def END (srange-dynamic count count))
-
-(defn walker [afn] (->WalkerStructurePath afn))
-
-(defn codewalker [afn] (->CodeWalkerStructurePath afn))
-
-(defn filterer [& path] (->FilterStructurePath (comp-paths* path)))
-
-(defn keypath [akey] (->KeyPath akey))
-
-(defn view [afn] (->ViewPath afn))
-
-(defmacro viewfn [& args]
- `(view (fn ~@args)))
-
-(defn selected?
- "Filters the current value based on whether a selector finds anything.
- e.g. (selected? :vals ALL even?) keeps the current element only if an
- even number exists for the :vals key"
- [& selectors]
- (let [s (comp-paths* selectors)]
- (fn [structure]
- (->> structure
- (select s)
- empty?
- not))))
-
-(extend-type clojure.lang.Keyword
- StructurePath
- (select* [kw structure next-fn]
- (next-fn (get structure kw)))
- (transform* [kw structure next-fn]
- (assoc structure kw (next-fn (get structure kw)))
- ))
-
-(extend-type clojure.lang.AFn
- StructurePath
- (select* [afn structure next-fn]
- (if (afn structure)
- (next-fn structure)))
- (transform* [afn structure next-fn]
- (if (afn structure)
- (next-fn structure)
- structure)))
-
-(defn collect [& selector]
- (->SelectCollector select (comp-paths* selector)))
-
-(defn collect-one [& selector]
- (->SelectCollector select-one (comp-paths* selector)))
-
-(defn putval
- "Adds an external value to the collected vals. Useful when additional arguments
- are required to the transform function that would otherwise require partial
- application or a wrapper function.
-
- e.g., incrementing val at path [:a :b] by 3:
- (transform [:a :b (putval 3)] + some-map)"
- [val]
- (->PutValCollector val))
-
-(defn cond-path
- "Takes in alternating cond-path selector cond-path selector...
- Tests the structure if selecting with cond-path returns anything.
- If so, it uses the following selector for this portion of the navigation.
- Otherwise, it tries the next cond-path. If nothing matches, then the structure
- is not selected."
- [& conds]
- (->> conds
- (partition 2)
- (map (fn [[c p]] [(comp-paths* c) (comp-paths* p)]))
- doall
- ->ConditionalPath
- ))
-
-(defn if-path
- "Like cond-path, but with if semantics."
- ([cond-fn if-path] (cond-path cond-fn if-path))
- ([cond-fn if-path else-path]
- (cond-path cond-fn if-path nil else-path)))
diff --git a/src/clj/com/rpl/specter/impl.clj b/src/clj/com/rpl/specter/impl.clj
deleted file mode 100644
index 6b864a5..0000000
--- a/src/clj/com/rpl/specter/impl.clj
+++ /dev/null
@@ -1,521 +0,0 @@
-(ns com.rpl.specter.impl
- (:use [com.rpl.specter protocols])
- (:require [clojure.walk :as walk]
- [clojure.core.reducers :as r])
- )
-
-(defmacro throw* [etype & args]
- `(throw (new ~etype (pr-str ~@args))))
-
-(defmacro throw-illegal [& args]
- `(throw* IllegalArgumentException ~@args))
-
-(defn benchmark [iters afn]
- (time
- (dotimes [_ iters]
- (afn))))
-
-(deftype ExecutorFunctions [type select-executor transform-executor])
-
-(def StructureValsPathExecutor
- (->ExecutorFunctions
- :svalspath
- (fn [selector structure]
- (selector [] structure
- (fn [vals structure]
- (if-not (empty? vals) [(conj vals structure)] [structure]))))
- (fn [transformer transform-fn structure]
- (transformer [] structure
- (fn [vals structure]
- (if (empty? vals)
- (transform-fn structure)
- (apply transform-fn (conj vals structure))))))
- ))
-
-(def StructurePathExecutor
- (->ExecutorFunctions
- :spath
- (fn [selector structure]
- (selector structure (fn [structure] [structure])))
- (fn [transformer transform-fn structure]
- (transformer structure transform-fn))
- ))
-
-(deftype TransformFunctions [executors selector transformer])
-
-
-(defprotocol CoerceTransformFunctions
- (coerce-path [this]))
-
-(defn no-prot-error-str [obj]
- (str "Protocol implementation cannot be found for object.
- Extending Specter protocols should not be done inline in a deftype definition
- because that prevents Specter from finding the protocol implementations for
- optimized performance. Instead, you should extend the protocols via an
- explicit extend-protocol call. \n" obj))
-
-(defn find-protocol-impl! [prot obj]
- (let [ret (find-protocol-impl prot obj)]
- (if (= ret obj)
- (throw-illegal (no-prot-error-str obj))
- ret
- )))
-
-(defn coerce-structure-vals-path [this]
- (let [pimpl (find-protocol-impl! StructureValsPath this)
- selector (:select-full* pimpl)
- transformer (:transform-full* pimpl)]
- (->TransformFunctions
- StructureValsPathExecutor
- (fn [vals structure next-fn]
- (selector this vals structure next-fn))
- (fn [vals structure next-fn]
- (transformer this vals structure next-fn)))
- ))
-
-(defn coerce-collector [this]
- (let [cfn (->> this
- (find-protocol-impl! Collector)
- :collect-val
- )
- afn (fn [vals structure next-fn]
- (next-fn (conj vals (cfn this structure)) structure)
- )]
- (->TransformFunctions StructureValsPathExecutor afn afn)))
-
-
-(defn structure-path-impl [this]
- (if (fn? this)
- ;;TODO: this isn't kosher, it uses knowledge of internals of protocols
- (-> StructurePath :impls (get clojure.lang.AFn))
- (find-protocol-impl! StructurePath this)))
-
-(defn coerce-structure-path [this]
- (let [pimpl (structure-path-impl this)
- selector (:select* pimpl)
- transformer (:transform* pimpl)]
- (->TransformFunctions
- StructurePathExecutor
- (fn [structure next-fn]
- (selector this structure next-fn))
- (fn [structure next-fn]
- (transformer this structure next-fn))
- )))
-
-(defn coerce-structure-path-direct [this]
- (let [pimpl (structure-path-impl this)
- selector (:select* pimpl)
- transformer (:transform* pimpl)]
- (->TransformFunctions
- StructureValsPathExecutor
- (fn [vals structure next-fn]
- (selector this structure (fn [structure] (next-fn vals structure))))
- (fn [vals structure next-fn]
- (transformer this structure (fn [structure] (next-fn vals structure))))
- )))
-
-(defn obj-extends? [prot obj]
- (->> obj (find-protocol-impl prot) nil? not))
-
-(defn structure-path? [obj]
- (or (fn? obj) (obj-extends? StructurePath obj)))
-
-(extend-protocol CoerceTransformFunctions
- nil ; needs its own path because it doesn't count as an Object
- (coerce-path [this]
- (coerce-structure-path nil))
-
- TransformFunctions
- (coerce-path [this]
- this)
-
- java.util.List
- (coerce-path [this]
- (comp-paths* this))
-
- Object
- (coerce-path [this]
- (cond (structure-path? this) (coerce-structure-path this)
- (obj-extends? Collector this) (coerce-collector this)
- (obj-extends? StructureValsPath this) (coerce-structure-vals-path this)
- :else (throw-illegal (no-prot-error-str this))
- )))
-
-
-(defn extype [^TransformFunctions f]
- (let [^ExecutorFunctions exs (.executors f)]
- (.type exs)
- ))
-
-(defn- combine-same-types [[^TransformFunctions f & _ :as all]]
- (if (empty? all)
- (coerce-path nil)
- (let [^ExecutorFunctions exs (.executors f)
-
- t (.type exs)
-
- combiner
- (if (= t :svalspath)
- (fn [curr next]
- (fn [vals structure next-fn]
- (curr vals structure
- (fn [vals-next structure-next]
- (next vals-next structure-next next-fn)
- ))))
- (fn [curr next]
- (fn [structure next-fn]
- (curr structure (fn [structure] (next structure next-fn)))))
- )]
-
- (reduce (fn [^TransformFunctions curr ^TransformFunctions next]
- (->TransformFunctions
- exs
- (combiner (.selector curr) (.selector next))
- (combiner (.transformer curr) (.transformer next))
- ))
- all))))
-
-(defn coerce-structure-vals [^TransformFunctions tfns]
- (if (= (extype tfns) :svalspath)
- tfns
- (let [selector (.selector tfns)
- transformer (.transformer tfns)]
- (->TransformFunctions
- StructureValsPathExecutor
- (fn [vals structure next-fn]
- (selector structure (fn [structure] (next-fn vals structure))))
- (fn [vals structure next-fn]
- (transformer structure (fn [structure] (next-fn vals structure))))
- ))))
-
-(extend-protocol StructureValsPathComposer
- nil
- (comp-paths* [sp]
- (coerce-path sp))
- Object
- (comp-paths* [sp]
- (coerce-path sp))
- java.util.List
- (comp-paths* [structure-paths]
- (let [combined (->> structure-paths
- (map coerce-path)
- (partition-by extype)
- (map combine-same-types)
- )]
- (if (= 1 (count combined))
- (first combined)
- (->> combined
- (map coerce-structure-vals)
- combine-same-types)
- ))))
-
-(defn coerce-structure-vals-direct [this]
- (cond (structure-path? this) (coerce-structure-path-direct this)
- (obj-extends? Collector this) (coerce-collector this)
- (obj-extends? StructureValsPath this) (coerce-structure-vals-path this)
- (instance? TransformFunctions this) (coerce-structure-vals this)
- :else (throw-illegal (no-prot-error-str this))
- ))
-
-;;this composes paths together much faster than comp-paths* but the resulting composition
-;;won't execute as fast. Useful for when select/transform are used without pre-compiled paths
-;;(where cost of compiling dominates execution time)
-(defn comp-unoptimal [sp]
- (if (instance? java.util.List sp)
- (->> sp
- (map coerce-structure-vals-direct)
- combine-same-types)
- (coerce-path sp)))
-
-;; cell implementation idea taken from prismatic schema library
-(definterface PMutableCell
- (get_cell ^Object [])
- (set_cell [^Object x]))
-
-(deftype MutableCell [^:volatile-mutable ^Object q]
- PMutableCell
- (get_cell [this] q)
- (set_cell [this x] (set! q x)))
-
-(defn mutable-cell ^PMutableCell
- ([] (mutable-cell nil))
- ([init] (MutableCell. init)))
-
-(defn set-cell! [^PMutableCell cell val]
- (.set_cell cell val))
-
-(defn get-cell [^PMutableCell cell]
- (.get_cell cell))
-
-(defn update-cell! [cell afn]
- (let [ret (afn (get-cell cell))]
- (set-cell! cell ret)
- ret))
-
-(defn- append [coll elem]
- (-> coll vec (conj elem)))
-
-(defprotocol SetExtremes
- (set-first [s val])
- (set-last [s val]))
-
-(defn- set-first-list [l v]
- (cons v (rest l)))
-
-(defn- set-last-list [l v]
- (append (butlast l) v))
-
-(extend-protocol SetExtremes
- clojure.lang.PersistentVector
- (set-first [v val]
- (assoc v 0 val))
- (set-last [v val]
- (assoc v (-> v count dec) val))
- Object
- (set-first [l val]
- (set-first-list l val))
- (set-last [l val]
- (set-last-list l val)
- ))
-
-(defn- walk-until [pred on-match-fn structure]
- (if (pred structure)
- (on-match-fn structure)
- (walk/walk (partial walk-until pred on-match-fn) identity structure)
- ))
-
-(defn- fn-invocation? [f]
- (or (instance? clojure.lang.Cons f)
- (instance? clojure.lang.LazySeq f)
- (list? f)))
-
-(defn- codewalk-until [pred on-match-fn structure]
- (if (pred structure)
- (on-match-fn structure)
- (let [ret (walk/walk (partial codewalk-until pred on-match-fn) identity structure)]
- (if (and (fn-invocation? structure) (fn-invocation? ret))
- (with-meta ret (meta structure))
- ret
- ))))
-
-(defn- conj-all! [cell elems]
- (set-cell! cell (concat (get-cell cell) elems)))
-
-(defn compiled-select*
- [^com.rpl.specter.impl.TransformFunctions tfns structure]
- (let [^com.rpl.specter.impl.ExecutorFunctions ex (.executors tfns)]
- ((.select-executor ex) (.selector tfns) structure)
- ))
-
-(defn compiled-transform*
- [^com.rpl.specter.impl.TransformFunctions tfns transform-fn structure]
- (let [^com.rpl.specter.impl.ExecutorFunctions ex (.executors tfns)]
- ((.transform-executor ex) (.transformer tfns) transform-fn structure)
- ))
-
-(defn selected?*
- [compiled-path structure]
- (->> structure
- (compiled-select* compiled-path)
- empty?
- not))
-
-;; returns vector of all results
-(defn- walk-select [pred continue-fn structure]
- (let [ret (mutable-cell [])
- walker (fn this [structure]
- (if (pred structure)
- (conj-all! ret (continue-fn structure))
- (walk/walk this identity structure))
- )]
- (walker structure)
- (get-cell ret)
- ))
-
-(defn- filter+ancestry [path aseq]
- (let [aseq (vec aseq)]
- (reduce (fn [[s m :as orig] i]
- (let [e (get aseq i)
- pos (count s)]
- (if (selected?* path e)
- [(conj s e) (assoc m pos i)]
- orig
- )))
- [[] {}]
- (range (count aseq))
- )))
-
-(defn key-select [akey structure next-fn]
- (next-fn (get structure akey)))
-
-(defn key-transform [akey structure next-fn]
- (assoc structure akey (next-fn (get structure akey))
- ))
-
-(deftype AllStructurePath [])
-
-(extend-protocol StructurePath
- AllStructurePath
- (select* [this structure next-fn]
- (into [] (r/mapcat next-fn structure)))
- (transform* [this structure next-fn]
- (let [empty-structure (empty structure)]
- (if (list? empty-structure)
- ;; this is done to maintain order, otherwise lists get reversed
- (doall (map next-fn structure))
- (->> structure (r/map next-fn) (into empty-structure))
- ))))
-
-(deftype ValCollect [])
-
-(extend-protocol Collector
- ValCollect
- (collect-val [this structure]
- structure))
-
-(deftype LastStructurePath [])
-
-(extend-protocol StructurePath
- LastStructurePath
- (select* [this structure next-fn]
- (next-fn (last structure)))
- (transform* [this structure next-fn]
- (set-last structure (next-fn (last structure)))))
-
-(deftype FirstStructurePath [])
-
-(extend-protocol StructurePath
- FirstStructurePath
- (select* [this structure next-fn]
- (next-fn (first structure)))
- (transform* [this structure next-fn]
- (set-first structure (next-fn (first structure)))))
-
-(deftype WalkerStructurePath [afn])
-
-(extend-protocol StructurePath
- WalkerStructurePath
- (select* [^WalkerStructurePath this structure next-fn]
- (walk-select (.afn this) next-fn structure))
- (transform* [^WalkerStructurePath this structure next-fn]
- (walk-until (.afn this) next-fn structure)))
-
-(deftype CodeWalkerStructurePath [afn])
-
-(extend-protocol StructurePath
- CodeWalkerStructurePath
- (select* [^CodeWalkerStructurePath this structure next-fn]
- (walk-select (.afn this) next-fn structure))
- (transform* [^CodeWalkerStructurePath this structure next-fn]
- (codewalk-until (.afn this) next-fn structure)))
-
-
-(deftype FilterStructurePath [path])
-
-(extend-protocol StructurePath
- FilterStructurePath
- (select* [^FilterStructurePath this structure next-fn]
- (->> structure (filter #(selected?* (.path this) %)) doall next-fn))
- (transform* [^FilterStructurePath this structure next-fn]
- (let [[filtered ancestry] (filter+ancestry (.path this) structure)
- ;; the vec is necessary so that we can get by index later
- ;; (can't get by index for cons'd lists)
- next (vec (next-fn filtered))]
- (reduce (fn [curr [newi oldi]]
- (assoc curr oldi (get next newi)))
- (vec structure)
- ancestry))))
-
-(deftype KeyPath [akey])
-
-(extend-protocol StructurePath
- KeyPath
- (select* [^KeyPath this structure next-fn]
- (key-select (.akey this) structure next-fn))
- (transform* [^KeyPath this structure next-fn]
- (key-transform (.akey this) structure next-fn)
- ))
-
-(deftype SelectCollector [sel-fn selector])
-
-(extend-protocol Collector
- SelectCollector
- (collect-val [^SelectCollector this structure]
- ((.sel-fn this) (.selector this) structure)))
-
-(deftype SRangePath [start-fn end-fn])
-
-(extend-protocol StructurePath
- SRangePath
- (select* [^SRangePath this structure next-fn]
- (let [start ((.start-fn this) structure)
- end ((.end-fn this) structure)]
- (next-fn (-> structure vec (subvec start end)))
- ))
- (transform* [^SRangePath this structure next-fn]
- (let [start ((.start-fn this) structure)
- end ((.end-fn this) structure)
- structurev (vec structure)
- newpart (next-fn (-> structurev (subvec start end)))
- res (concat (subvec structurev 0 start)
- newpart
- (subvec structurev end (count structure)))]
- (if (vector? structure)
- (vec res)
- res
- ))))
-
-(deftype ViewPath [view-fn])
-
-(extend-protocol StructurePath
- ViewPath
- (select* [^ViewPath this structure next-fn]
- (->> structure ((.view-fn this)) next-fn))
- (transform* [^ViewPath this structure next-fn]
- (->> structure ((.view-fn this)) next-fn)
- ))
-
-(deftype PutValCollector [val])
-
-(extend-protocol Collector
- PutValCollector
- (collect-val [^PutValCollector this structure]
- (.val this)
- ))
-
-
-(extend-protocol StructurePath
- nil
- (select* [this structure next-fn]
- (next-fn structure))
- (transform* [this structure next-fn]
- (next-fn structure)
- ))
-
-
-(deftype ConditionalPath [cond-pairs])
-
-(defn- retrieve-selector [cond-pairs structure]
- (->> cond-pairs
- (drop-while (fn [[c-selector _]]
- (->> structure
- (compiled-select* c-selector)
- empty?)))
- first
- second
- ))
-
-;;TODO: test nothing matches case
-(extend-protocol StructurePath
- ConditionalPath
- (select* [this structure next-fn]
- (if-let [selector (retrieve-selector (.cond-pairs this) structure)]
- (->> (compiled-select* selector structure)
- (mapcat next-fn)
- doall)))
- (transform* [this structure next-fn]
- (if-let [selector (retrieve-selector (.cond-pairs this) structure)]
- (compiled-transform* selector next-fn structure)
- structure
- )))
-
diff --git a/src/clj/com/rpl/specter/protocols.clj b/src/clj/com/rpl/specter/protocols.clj
deleted file mode 100644
index a87cc8a..0000000
--- a/src/clj/com/rpl/specter/protocols.clj
+++ /dev/null
@@ -1,15 +0,0 @@
-(ns com.rpl.specter.protocols)
-
-(defprotocol StructureValsPath
- (select-full* [this vals structure next-fn])
- (transform-full* [this vals structure next-fn]))
-
-(defprotocol StructurePath
- (select* [this structure next-fn])
- (transform* [this structure next-fn]))
-
-(defprotocol Collector
- (collect-val [this structure]))
-
-(defprotocol StructureValsPathComposer
- (comp-paths* [paths]))
diff --git a/test/clj/com/rpl/specter/core_test.clj b/test/clj/com/rpl/specter/core_test.clj
index 5e94f01..0fc9f54 100644
--- a/test/clj/com/rpl/specter/core_test.clj
+++ b/test/clj/com/rpl/specter/core_test.clj
@@ -185,7 +185,7 @@
(for-all+
[v (gen/vector gen/int)
v2 (gen/vector gen/int)]
- (let [b (setval START v2 v)
+ (let [b (setval BEGINNING v2 v)
e (setval END v2 v)]
(and (= b (concat v2 v))
(= e (concat v v2)))
@@ -217,7 +217,6 @@
[i gen/int
afn (gen/elements [inc dec])]
(= (first (select (view afn) i))
- (first (select (viewfn [i] (afn i)) i))
(afn i)
(transform (view afn) identity i)
)))