some javascript
Nov. 19th, 2013 10:49 am
map = function(list, fun) {
var result = []
for (var i = 0; i < list.length; i++) result.push(fun(list[i]))
return result
}
project = function(list, field) { return map(list, function(x) { return x[field]}) }
// it's projEct, not prOject
// e.g. project(_$$('a[href^="/ecmviewer/ci/member?"]'), 'href')) returns urls from a list of links found by a selector
// and now some lambdas
w = function(x) { return x(x)(x(x)) }
var i = 1.
w(
function(a) {
println(i + ". w called with " + a);
i++
return function(x) {
println(i + ". w1 called with " + a);
i++
}
}
)
(my lambda talk is here)
