Welcome to interactive River Trail.

Type some JavaScript into the input field at the bottom of the page and press enter. The result will appear below. To get some inspiration, here are some River Trail one liners:

Create your first array:

var first = new ParallelArray(1,2,3,4);

If you then type


You will get the string representation of your first ParallelArray as output:

[ 1 2 3 4 ]

Or you can create the same array using a comprehension:

var second = new ParallelArray(4, function f(idx) { return idx+1; });

Some more idioms to play with:

increment: var result = first.map(function f(val) {return val+1;})
add: var result = first.combine(function f(idx,snd) {return this.get(idx)+snd.get(idx);}, second)
sum: var result = first.reduce(function f(a, b) {return a + b;})


PS: This page uses the sequential library implementation of River Trail. You won't need the extension but there will be no speedup either.