-
-
Save rightfold/1e7bf8cb0001203ccabe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def * $*) | |
(def cons $cons) | |
(def head .head) | |
(def tail .tail) | |
(def null $null) | |
(def square (fn (x) (* x x))) | |
(def map | |
(fn (f xs) | |
(if (head xs) | |
(cons (f (head xs)) (map f (tail xs))) | |
()))) | |
(def each | |
(fn (f xs) | |
(if (head xs) | |
(do (f (head xs)) | |
(each f (tail xs))) | |
null))) | |
(each (fn (x) (.log $console x)) | |
(map square \'(1 2 3 4 5))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
global.styx.gl.x1 = (global["*"]); | |
global.styx.gl.x2 = (global["cons"]); | |
global.styx.gl.x3 = ((function () { | |
return arguments[0]["head"].apply(arguments[0], [].slice.call(arguments, 1)); | |
})); | |
global.styx.gl.x4 = ((function () { | |
return arguments[0]["tail"].apply(arguments[0], [].slice.call(arguments, 1)); | |
})); | |
global.styx.gl.x5 = (global["null"]); | |
global.styx.gl.x6 = ((function (x7) { | |
return (global.styx.gl.x1)((x7), (x7)); | |
})); | |
global.styx.gl.x8 = ((function (x9, x10) { | |
return (function (x11) { | |
return (x11 !== null && x11 !== false && x11 !== undefined) ? ((global.styx.gl.x2)(((x9)(((global.styx.gl.x3)((x10))))), ((global.styx.gl.x8)((x9), ((global.styx.gl.x4)((x10))))))) : (new styx.rt.Nil()); | |
})((global.styx.gl.x3)((x10))); | |
})); | |
global.styx.gl.x12 = ((function (x13, x14) { | |
return (function (x15) { | |
return (x15 !== null && x15 !== false && x15 !== undefined) ? ((function () { | |
(x13)(((global.styx.gl.x3)((x14)))); | |
return (global.styx.gl.x12)((x13), ((global.styx.gl.x4)((x14)))); | |
})()) : (global.styx.gl.x5); | |
})((global.styx.gl.x3)((x14))); | |
})); | |
(global.styx.gl.x12)(((function (x16) { | |
return ((function () { | |
return arguments[0]["log"].apply(arguments[0], [].slice.call(arguments, 1)); | |
}))((global["console"]), (x16)); | |
})), ((global.styx.gl.x8)((global.styx.gl.x6), (new styx.rt.Cons((1), (new styx.rt.Cons((2), (new styx.rt.Cons((3), (new styx.rt.Cons((4), (new styx.rt.Cons((5), (new styx.rt.Nil())))))))))))))); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | |
4 | |
9 | |
16 | |
25 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment