diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-08 08:17:46 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-08 08:17:46 +0000 |
commit | 5b33dc5c5a87fff146951ca0543bf558454c331d (patch) | |
tree | 12f24d56b0480e97e1cae474ee03c0d4798cfe93 /sca-cpp/trunk/modules/js/htdocs/util.js | |
parent | d621604a7732497afcb0378c61ac5614a014a01d (diff) |
Simplified list component by using a reference per element. Automatically setup app links and garbage collect unused components.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1079291 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/js/htdocs/util.js')
-rw-r--r-- | sca-cpp/trunk/modules/js/htdocs/util.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sca-cpp/trunk/modules/js/htdocs/util.js b/sca-cpp/trunk/modules/js/htdocs/util.js index 2521b82311..336248d34c 100644 --- a/sca-cpp/trunk/modules/js/htdocs/util.js +++ b/sca-cpp/trunk/modules/js/htdocs/util.js @@ -129,7 +129,7 @@ function assoc(k, l) { } /** - * Map and filter functions. + * Map, filter and reduce functions. */ function map(f, l) { if (isNil(l)) @@ -145,6 +145,12 @@ function filter(f, l) { return filter(f, cdr(l)); } +function reduce(f, i, l) { + if (isNil(l)) + return i; + return reduce(f, f(i, car(l)), cdr(l)); +} + /** * Split a path into a list of segments. */ |