Initial commit; does not yet work.
This commit is contained in:
commit
bca0f8492d
600 changed files with 171999 additions and 0 deletions
127
docs/js/compiled/out/clojure/walk.js
Normal file
127
docs/js/compiled/out/clojure/walk.js
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
// Compiled by ClojureScript 1.10.520 {}
|
||||
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.list_QMARK_.call(null,form)){
|
||||
return outer.call(null,cljs.core.apply.call(null,cljs.core.list,cljs.core.map.call(null,inner,form)));
|
||||
} else {
|
||||
if(cljs.core.map_entry_QMARK_.call(null,form)){
|
||||
return outer.call(null,(new cljs.core.MapEntry(inner.call(null,cljs.core.key.call(null,form)),inner.call(null,cljs.core.val.call(null,form)),null)));
|
||||
} else {
|
||||
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.record_QMARK_.call(null,form)){
|
||||
return outer.call(null,cljs.core.reduce.call(null,(function (r,x){
|
||||
return cljs.core.conj.call(null,r,inner.call(null,x));
|
||||
}),form,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__27749){
|
||||
var vec__27750 = p__27749;
|
||||
var k = cljs.core.nth.call(null,vec__27750,(0),null);
|
||||
var v = cljs.core.nth.call(null,vec__27750,(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__27753){
|
||||
var vec__27754 = p__27753;
|
||||
var k = cljs.core.nth.call(null,vec__27754,(0),null);
|
||||
var v = cljs.core.nth.call(null,vec__27754,(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?rel=1582560150219
|
||||
Loading…
Add table
Add a link
Reference in a new issue