root / trunk / web / dojo / dojox / lang / functional / sequence.js @ 10
History | View | Annotate | Download (761 Bytes)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.lang.functional.sequence"]){ |
||
9 | dojo._hasResource["dojox.lang.functional.sequence"]=true; |
||
10 | dojo.provide("dojox.lang.functional.sequence");
|
||
11 | dojo.require("dojox.lang.functional.lambda");
|
||
12 | (function(){
|
||
13 | var d=dojo,df=dojox.lang.functional;
|
||
14 | d.mixin(df,{repeat:function(n,f,z,o){ |
||
15 | o=o||d.global; |
||
16 | f=df.lambda(f); |
||
17 | var t=new Array(n),i=1; |
||
18 | t[0]=z;
|
||
19 | for(;i<n;t[i]=z=f.call(o,z),++i){
|
||
20 | } |
||
21 | return t;
|
||
22 | },until:function(pr,f,z,o){ |
||
23 | o=o||d.global; |
||
24 | f=df.lambda(f); |
||
25 | pr=df.lambda(pr); |
||
26 | var t=[];
|
||
27 | for(;!pr.call(o,z);t.push(z),z=f.call(o,z)){
|
||
28 | } |
||
29 | return t;
|
||
30 | }}); |
||
31 | })(); |
||
32 | } |