One of important types of Plezuro is the list. It is an equivalent of .NET List<object> and Java ArrayList<Object>. To create a list, just use square brackets ('[', ']'). In intermediate code it is translated to '::array()'. Elements of a list can be of any type (including list), they are passed by reference, so it is possible that a list contains itself.

$x = [1,2,3,'something',[3,4]];
'x'.dumpl;
x.each({
  args.printl
});
x.each({
  this.printl
});

As you just have seen above, you can print elements of a list in many ways. The simplest way is to use the dumpl function (it is appropriate to any type in Plezuro). Another one is to use the each method. 'args' means all the arguments passed to a function (in this case a tuple (value, index)) and 'this' means the argument #0 (in this case only value).

Now, I guess, you wonder to get access to a specified element of a list (get and set its value). It is pretty simple, like in other languages use square brackets.

$list = [3,9,4];
'list'.dumpl;
list[0].printl;
list[1] = 'abc';
'list'.dumpl;
});

Lists like any other variables are passed by reference.

$a = [0,0,1];
$b = a;
b[0] = 90;
a

Now, how to sort a list?

$x = [4,5,2,90,452,1,-34,20];
x.sort.printl; //sorting just by value
x.orderBy{args%10}.printl; //sorting by last digit (for negative numbers we assume the last digit is negative)

Now, a little more about the indexing. You can access to a piece of a list in a similar way like in Ruby (using '..' operator). For example a[1..4]. The difference is in this case in Ruby it returns elements from index 1 up to index 4 but in Plezuro it returns elements from index 1 up to index 3. Another interesting feature is when using commas, you can access to disjoint pieces of a list (for example first and fourth element). Indexing may return an empty object, a single variable or a tuple. Of course, you can modify an all piece of a list.