Show Changes Show Changes
Edit Edit
Print Print
Recent Changes Recent Changes
Subscriptions Subscriptions
Lost and Found Lost and Found
Find References Find References
Rename Rename
Administration Page Administration Page
Search

History

9/19/2008 6:48:08 AM
FLWCOM-jwdavidson
6/11/2008 6:01:16 AM
-194.7.161.130
11/23/2007 2:58:07 PM
JohnDavidson-66.78.121.128
10/4/2007 5:21:57 PM
-210.21.12.94
4/27/2006 9:13:41 AM
Herby-195.91.54.87
List all versions List all versions

RSS feed for the FlexWiki namespace

Related Topics

Array Demo
.

What information is available about an Array?

The Array type has the following members:

Array Append(Array array)
Answer this array after the supplied array has been appended on the end.
Array Collect(Block block)
Evalute the given block once for each object in the array; answer a new array containing the result of each block evaluation.
Integer Count
Answer the number of objects in the array
Object IsEmpty
Answer true if this object is empty, else false
Object Item(Integer index)
Answer the item at the given index
Array Reverse
Answer a new array that is in reverse order of the original array
Array ReverseSort
Sort the array; answer a new array (that is sorted)
Array ReverseSortBy(Block block)
Sort the array; evaluate the block for each object in the array to determine the object used to order that item in the sort
Array Select(Block block)
Evaluate the block for each item in the array; answer a new Array that includes on those objects for which the block evaluated to true.
Array Snip(Integer maxCount)
Answer a new array that is a copy of this array, but trimmed to have no more than the given number of objects.
Array Sort
Sort the array; answer a new array (that is sorted)
Array SortBy(Block block)
Sort the array; evaluate the block for each object in the array to determine the object used to order that item in the sort
String ToOneString
Answer a single string that is the concatenation of all of the objects in the array converted to strings
Object ToPresentation
Convert this object to a Presentation
Array Unique
Answer the unique elements in this array

Examples

Append

 [1,2,3].Append([4,5,6]).Collect{each | ["        *", each, Newline]}

Item

 [1,2,3].Item(0)
1

Sort

 [2,1,3].Sort
123
 ["a", "c", "d", "b", "b"].Sort
abbcd

Count

 [1,2,3].Count
3

ToOneString

 [1,2,3].ToOneString
123

Nested arrays

 [1,2,[4,3,2,1]].Item(2).Count
4

Collect

Apply the block parameter to each element in the array and return a new array. Collect is a method which is very functional programming-like in nature. Think of it working a bit like foreach in C# or VB.

Help
Answer
 ["a","aa","aaa"].Collect{each | each.Length}
123

SortBy

Sort "one", "two", "three", "four", "five" according to the length of each string:

 ["one", "two", "three", "four", "five"].SortBy{each | each.Length}.Collect{each | [each, Newline]}.ToOneString
two

one

four

five

three

Notice that SortBy is not a StableSort.

Unique

 [1,2,3].Append([2,3,4,5,6]).Unique.Collect{each | ["        *", each, Newline]}

Multiple Keyword OR Selection

 :SelectCategoryTopics:{ keyword |
   namespace.Topics.Select{ each |
     each.HasProperty("Category") }.Select{ each |
       each.GetProperty("Category").Contains(keyword) }.Collect{ each | each }
 }
 SelectKeyword("Formatting").Append(SelectKeyword("Examples")).Unique
   .Collect{each | ["        *", each.Name, Newline]}
With

Discussion

FlexWiki.ArrayDemo(1:53) : No such property or function: Array.Union

Is MichaelStamenov right? -- JamesRoeSmith.

FlexWiki.ArrayDemo(1:21) : No such property or function: Array.Union

Not logged in. Log in

Welcome to the home of FlexWiki, a collaboration tool, based on WikiWiki, implemented using Microsoft .NET technologies

This is FlexWiki, an open source wiki engine.

This site supports the new NoFollow anti-spam initiative.
Change Style

Recent Topics