The transformation operator (->) is very powerful and has many uses. It transforms an expression on the left using an expression on the right.
This operator creates a step value when used with a range. A range of 1..10 goes from 1 to 10 with a default step value of 1. A range of 1..10 -> 2 creates the same range with a step value of 2.
Examples
Substitution
x^2 -> 4
x^2+y^2 -> [x=2, y=4]
Unit Conversions
3@miles -> @kilometers
@cups -> @tablespoons
5@hours -> @minutes
30@C -> @F
Sublists with ranges
[1, 2, 3, 4, 5] -> 2..4
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] -> (1..$ -> 2)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] -> (2..$ -> 2)
Substrings with ranges
"Hello World" -> 1..5
"Hello World" -> 6..$
"ABCDEFGHIJ" -> (1..$ -> 2)
Split
"abcdefg" -> []
x+y+z -> []
Join
[a, b, c, d, e, f, g] -> ""
[x, y, z] -> +
[x, y, z] -> *
[x, y, z] -> ^
Transformations
x+y+z -> ^
a*b*c -> +
Appending Lists
[1, 2, 3] -> [4]
[1, 2] -> [3, 4, 5]
[1] -> [2, 3, 4]
Sum
[1, 2, 3, 4, 5, 6, 7] -> +
Product
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] -> *
Deleting elements in a list using the index operator
[1, 2, 3, 4, 5] -> #2
[1, 2, 3, 4, 5] -> #2..4
Inserting elements into a list using the index operator