Whatever Closure (I)
- Whatever's most powerful usage is the Whatever Closure
- For normal operators -- ones where Whatever has no special meaning
- Passing Whatever as an argument creates a closure
- So for instance,
* + 1
is the same as -> $a { $a + 1 }
-
* + *
is the same as -> $a, $b { $a + $b }
-
@list.grep(* > 10)
returns all the elements of @list
which are greater than 10
-
@list.map(* + *)
returns the sum of each pair of elements in @list
« first
< prev
(29 / 41)
next >
last »