diff options
| author | hallgren <hallgren@chalmers.se> | 2010-04-09 14:04:18 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2010-04-09 14:04:18 +0000 |
| commit | 1903fe8bf99cf6f567669a803f4b725478309ad3 (patch) | |
| tree | a87b13e93ec123b46d3116a60288716d318e4656 /src/runtime | |
| parent | 984d67a79ba2140c44290a2fb7bab6998a86dd7a (diff) | |
Some documentation
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/javascript/minibar/support.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/runtime/javascript/minibar/support.js b/src/runtime/javascript/minibar/support.js index 15ccc38d0..b07b03018 100644 --- a/src/runtime/javascript/minibar/support.js +++ b/src/runtime/javascript/minibar/support.js @@ -1,7 +1,11 @@ +/* --- Accessing document elements ------------------------------------------ */ + function element(id) { return document.getElementById(id); } +/* --- JSONP ---------------------------------------------------------------- */ + // Inspired by the function jsonp from // http://www.west-wind.com/Weblog/posts/107136.aspx // See also http://niryariv.wordpress.com/2009/05/05/jsonp-quickly/ @@ -124,7 +128,7 @@ function filter(p,xs) { return ys; } -function implode(cs) { +function implode(cs) { // array of strings to string /* var s=""; for(var i=0;i<cs.length;i++) @@ -147,11 +151,12 @@ function map(f,xs) { return ys; } +// map in continuation passing style +function mapc(f,xs,cont) { mapc_from(f,xs,0,[],cont); } + function mapc_from(f,xs,i,ys,cont) { if(i<xs.length) f(xs[i],function(y){ys[i]=y;mapc_from(f,xs,i+1,ys,cont)}); else cont(ys); } - -function mapc(f,xs,cont) { mapc_from(f,xs,0,[],cont); } |
