Perfect Developer basic tutorial 3 | This page last modified 2011-10-29 (JAC) |
1. Simplify the following expressions, assuming that x and y are sequences, i, j and k are integers and that all indices and parameters are in bounds:
seq of int{i, j, k}[1]
x.drop(i).take(j)
[Hint: use the slice member function]x.take(i)[j]
x.drop(i)[j]
x.drop(i).head
x.take(i).last
(i..j)[k]
(x ++ y)[i]
[Hint: use a conditional expression]j
x.slice(i, j)
x[j]
x[i + j]
x[i]
x[i - 1]
i + k
([i < #x]: x[i], []: y[i - #x])