Skip to content

Instantly share code, notes, and snippets.

@robkuz
robkuz / gist:6132845
Last active December 20, 2015 12:39
Some really bad play on words with clojure
(defn even-or-odd []
(let [x (atom 1)]
(fn []
(cond
(even? @x) (println "I am even")
(odd? @x) (println "I am odd"))
(swap! x inc))))
(def I-am-even-odder (even-or-odd))
(I-am-even-odder)
defn average
numbers
/
apply + numbers
count numbers
defn average
numbers
/
apply + numbers
count numbers
defn average
numbers
/
apply + numbers
count numbers
var foo,
_this = this;
foo = function() {
return _this.bar;
};
foo = => @bar
somemethod: function() {
var _this = this;
return function() {
return _this.someCall();
};
}
somemethod: ->
=> @someCall()
A = (function() {
function A() {
var _this = this;
this.somemethod = function(paramlist) {
return A.prototype.somemethod.apply(_this, arguments);
};
}
A.prototype.somemethod = function(paramlist) {
class A
somemethod: (paramlist) => doSomethingHere();