Created
September 18, 2014 11:56
-
-
Save radiosilence/b65b268e74b24f0ffc79 to your computer and use it in GitHub Desktop.
fucking around with mori
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Download the React DevTools for a better development experience: http://fb.me/react-devtools react.js:4356 | |
DOM fully loaded and parsed uitest.html:40 | |
You are using the in-browser JSX transformer. Be sure to precompile your JSX for production - http://facebook.github.io/react/docs/tooling-integration.html#jsx JSXTransformer.js:12703 | |
_ | |
function (obj) { | |
if (obj instanceof _) return obj; | |
if (!(this instanceof _)) return new _(obj); | |
this._wrapped = obj; | |
} underscore.js:36 | |
mori | |
Object {apply: function, count: function, distinct: function, empty: function, first: function…} | |
var m = mori | |
undefined | |
var vector = m.vector(1,2,3,4,5); | |
undefined | |
vector | |
W {j: null, g: 5, shift: 5, root: be, R: Array[5]…} | |
mori.into_array | |
function (c,e){switch(arguments.length){case 1:return b.call(this,c);case 2:return a.call(this,0,e)}throw Error("Invalid arity: "+arguments.length);} mori.js:6 | |
mori.into_array(vector) | |
[1, 2, 3, 4, 5] | |
var mp = mori.map('v', vector) | |
undefined | |
mp.toString() | |
TypeError: undefined is not a function | |
mp.toString | |
function (){return Lb(this)} mori.js:92 | |
mp | |
V {j: null, Ya: function, r: null, m: null, q: 0…} | |
m.into_array(mp) | |
TypeError: undefined is not a function | |
m.array_map | |
function a(a){var d=null;0<arguments.length&&(d=J(Array.prototype.slice.call(arguments,0),0));return b.call(this,d)} mori.js:263 | |
var mp = mori.hash_map('v', vector) | |
undefined | |
mp.into_array(mp) | |
TypeError: undefined is not a function | |
m.into_array(mp) | |
[WR: Array[2]g: 2i: 167668511j: nullm: nullq: 8196root: beshift: 5__proto__: W] | |
mp | |
xf {j: null, g: 1, root: lf, T: false, Y: null…} | |
m.vals(mp) | |
Yf {V: vf, W: null, q: 0, i: 32374988, toString: function…} | |
m.into_array(m.vals(mp)) | |
[W] | |
m.into_array(m.keys(mp)) | |
["v"] | |
m.clj_to_js(mp) | |
Object {v: Array[5]}v: Array[5]__proto__: Object | |
mp2 = m.merge(mp, m.hash_map('v', m.conj(vector, 'derrr'))) | |
xf {j: null, g: 1, root: lf, T: false, Y: null…} | |
js | |
ReferenceError: js is not defined | |
js = m.clj_to_js | |
function Og(b){if(null==b)return null;if(b?r(r(null)?null:b.$b)||(b.Cb?0:s(Kg,b)):s(Kg,b))return Lg(b);if(b instanceof T)return id(b);if(b instanceof Zb)return""+A.b(b);if(Gc(b)){var c={};b=E(b);for(var d=null,e=0,f=0;;)if(f<e){var h=d.J(null,f),k=P.c(h,0,null),h=P.c(h,1,null);c[Mg(k)]=Og(h);f+=1}else if(b=E(b))Ic(b)?(e=Hb(b),b=Ib(b),d=e,e=O(e)):(e=F(b),d=P.c(e,0,null),e=P.c(e,1,null),c[Mg(d)]=Og(e),b=I(b),d=null,e=0),f=0;else break;return c}if(Cc(b)){c=[];b=E(Kd.a(Og,b));d=null;for(f=e=0;;)if(f< | |
e)k=d.J(null,f),c.push(k),f+=1;else if(b=E(b))d=b,Ic(d)?(b=Hb(d),f=Ib(d),d=b,e=O(b),b=f):(b=F(d),c.push(b),b=I(d),d=null,e=0),f=0;else break;return c}return u?b:null} mori.js:315 | |
js | |
function Og(b){if(null==b)return null;if(b?r(r(null)?null:b.$b)||(b.Cb?0:s(Kg,b)):s(Kg,b))return Lg(b);if(b instanceof T)return id(b);if(b instanceof Zb)return""+A.b(b);if(Gc(b)){var c={};b=E(b);for(var d=null,e=0,f=0;;)if(f<e){var h=d.J(null,f),k=P.c(h,0,null),h=P.c(h,1,null);c[Mg(k)]=Og(h);f+=1}else if(b=E(b))Ic(b)?(e=Hb(b),b=Ib(b),d=e,e=O(e)):(e=F(b),d=P.c(e,0,null),e=P.c(e,1,null),c[Mg(d)]=Og(e),b=I(b),d=null,e=0),f=0;else break;return c}if(Cc(b)){c=[];b=E(Kd.a(Og,b));d=null;for(f=e=0;;)if(f< | |
e)k=d.J(null,f),c.push(k),f+=1;else if(b=E(b))d=b,Ic(d)?(b=Hb(d),f=Ib(d),d=b,e=O(b),b=f):(b=F(d),c.push(b),b=I(d),d=null,e=0),f=0;else break;return c}return u?b:null} mori.js:315 | |
js(mp2) | |
Object {v: Array[6]}v: Array[6]0: 11: 22: 33: 44: 55: "derrr"length: 6__proto__: Array[0]__proto__: Object | |
mp3 = m.merge(mp, m.hash_map('v', m.conj(vector, m.hash_map('x', 'poop')))) | |
xf {j: null, g: 1, root: lf, T: false, Y: null…} | |
js(mp3) | |
Object {v: Array[6]}v: Array[6]0: 11: 22: 33: 44: 55: Objectx: "poop"__proto__: Objectlength: 6__proto__: Array[0]__proto__: Object | |
mp4 = m.update_in(mp3, ['v', 5, 'x'], 'parp') | |
TypeError: undefined is not a function | |
mp4 = m.update_in(mp3, ['v', 5, 'x'], function(val){ console.log("updating", val); return 'parp'}) | |
updating poop VM15715:2 | |
xf {j: null, g: 1, root: lf, T: false, Y: null…} | |
js(mp4) | |
Object {v: Array[6]}v: Array[6]0: 11: 22: 33: 44: 55: Objectx: "parp"__proto__: Objectlength: 6__proto__: Array[0]__proto__: Object | |
mp5 = m.update_in(mp3, ['v', 5], function(val){ console.log("updating", js(val)); return m.hash_map('ziggy', 'stardust')}) | |
updating Object {x: "poop"} VM15741:2 | |
xf {j: null, g: 1, root: lf, T: false, Y: null…} | |
js(mp5) | |
Object {v: Array[6]}v: Array[6]0: 11: 22: 33: 44: 55: Objectziggy: "stardust"__proto__: Objectlength: 6__proto__: Array[0]__proto__: Object | |
mp6 = m.update_in(mp3, ['v', 5], m.hash_map('ziggy', 'stardust')) | |
xf {j: null, g: 1, root: lf, T: false, Y: null…} | |
js(mp6) | |
Object {v: Array[6]}v: Array[6]0: 11: 22: 33: 44: 55: nulllength: 6__proto__: Array[0]__proto__: Object | |
mp6 = m.update_in(mp3, ['v', 4], m.hash_map('ziggy', 'stardust')) | |
xf {j: null, g: 1, root: lf, T: false, Y: null…} | |
js(mp6) | |
Object {v: Array[6]}v: Array[6]0: 11: 22: 33: 44: null5: Objectx: "poop"__proto__: Objectlength: 6__proto__: Array[0]__proto__: Object | |
mp6 = m.update_in(mp3, ['v', 4], 34) | |
TypeError: undefined is not a function | |
mp6 = m.assoc_in(mp3, ['v', 4], m.hash_map('ziggy', 'stardust')) | |
xf {j: null, g: 1, root: lf, T: false, Y: null…} | |
js(mp6) | |
Object {v: Array[6]}v: Array[6]0: 11: 22: 33: 44: Objectziggy: "stardust"__proto__: Object5: Objectlength: 6__proto__: Array[0]__proto__: Object | |
mp7 = m.assoc_in(mp3, ['v', 4], m.hash_map('ziggy', 'stardust')) | |
xf {j: null, g: 1, root: lf, T: false, Y: null…} | |
m.equals(mp6, mp4) | |
false | |
m.equals(mp6, mp7) | |
true | |
m.get_in(mp7, ['v', 4]) | |
xf {j: null, g: 1, root: lf, T: false, Y: null…} | |
m.get_in(mp7, ['v', 4, 'ziggy']) | |
"stardust" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment