|
Perl 6
Perl 6 Operator Tablet: Revision 22
Overview - Chapter: 0:History, 1:Design, 2:Basics, 3:Var, 4:Op, 5:IO, 6:{}, 7:Sub, 8:OOP, 9:Rx, 10:Meta Perl folkore: Perl is an operator based language. Comparison and testing in the scalar contextSmartmatch~~ !~ Equalityeqv eq == === Generic Comparsionbefore after cmp Numerical Comparsion< == > <=> <= >= String Comparsionlt eq gt leg le ge joined comparison3 < $a == $a < 7 is not the same as 3 < $a < 7 because latter is evaled at once and the first in 2 steps (left to right) junctions| & ^ logical selection&& - and see also numerical selection ternary?? !! flipflopff fff file testyadda... context forcing scalar opsbool context? ! numeric context+ - * ? / % %% numerical selectionmin max minmax String context~ x Ops for arrays/listsList generationThe simplest way to create a list is by repeating some values: 'munch' xx 3 # results in 'munch', 'munch', 'munch' In list context the range operator produces lists: @ 2 .. 7 --> 2,3,4,5,6,7 ... sequence operator ZipZ CombinatorsX Hyperops<< >> Reduce[ ] Triangle[\ ] Feed Ops<== ==> Assignment opsself assigning opsprecedence tableintentionally not existing opsmaking own operators
Overview - Chapter: 0:History, 1:Design, 2:Basics, 3:Var, 4:Op, 5:IO, 6:{}, 7:Sub, 8:OOP, 9:Rx, 10:Meta |