summaryrefslogtreecommitdiff
path: root/includes/js/dojox/lang/functional/sequence.js
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/lang/functional/sequence.js
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/lang/functional/sequence.js')
-rw-r--r--includes/js/dojox/lang/functional/sequence.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/includes/js/dojox/lang/functional/sequence.js b/includes/js/dojox/lang/functional/sequence.js
new file mode 100644
index 0000000..c5aaa1c
--- /dev/null
+++ b/includes/js/dojox/lang/functional/sequence.js
@@ -0,0 +1,38 @@
+if(!dojo._hasResource["dojox.lang.functional.sequence"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.functional.sequence"] = true;
+dojo.provide("dojox.lang.functional.sequence");
+
+dojo.require("dojox.lang.functional.lambda");
+
+// This module adds high-level functions and related constructs:
+// - sequence generators
+
+// Defined methods:
+// - take any valid lambda argument as the functional argument
+
+(function(){
+ var d = dojo, df = dojox.lang.functional;
+
+ d.mixin(df, {
+ // sequence generators
+ repeat: function(/*Number*/ n, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
+ // summary: builds an array by repeatedly applying a unary function N times
+ // with a seed value Z.
+ o = o || d.global; f = df.lambda(f);
+ var t = new Array(n);
+ t[0] = z;
+ for(var i = 1; i < n; t[i] = z = f.call(o, z), ++i);
+ return t; // Array
+ },
+ until: function(/*Function|String|Array*/ pr, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
+ // summary: builds an array by repeatedly applying a unary function with
+ // a seed value Z until the predicate is satisfied.
+ o = o || d.global; f = df.lambda(f); pr = df.lambda(pr);
+ var t = [];
+ for(; !pr.call(o, z); t.push(z), z = f.call(o, z));
+ return t; // Array
+ }
+ });
+})();
+
+}