You don't understand what the following means`````` 1 ^..^ 5 `````` It means a Range of values from 1 to 5 excluding 1 and 5.`````` 1 ~~ 1^..^5; # False 5 ~~ 1^..^5; # False 1.000001 ~~ 1^..^5; # True 4.999999 ~~ 1^..^5; # True `````` It is short for`````` Range.new( 1, 5, excludes-min => True, excludes-max => True ) `````` One of the benefits if you want to get the first 10 items from an array is that you can use the numbers 0 and 10`````` @a[ 0..^10 ] `````` It also means you don't have to do so many +1 or -1 when generating a sequence`````` \$n+1 .. \$m-1 \$n ^..^ \$m `````` We don't have to declare ranges with a number past the end like Python`````` range(0,n+1) 0..\$n `````` … but we can if it increases clarity`````` range(0,m) 0..^\$m `````` Since we don't use prefix ^ for anything else, we have it as shorthand for the above`````` 0..^\$m ^\$m `````` ---Perl 6 doesn't have a Z=> operator. It has a Z meta-operator and a => operator.`````` my %hash = @keys Z[=>] @values; `````` short for`````` my %hash = zip( @keys, @values ).map: -> ( \$key, \$value ) { Pair.new( \$key, \$value } `````` I would like to know which of those you can scan over and be sure it is correct without much thought.We also don't have a += operator, instead = is also a meta-operator`````` \$i += 2; \$i [+]= 2; # more explicit, but identical `````` Which means that if you modify an existing infix operator or add a new one, you get something like += for free.`````` sub infix:< +++ > ( \$l, \$r ) { \$l + 1 + \$r } \$i +++= 1; `````` Note that since operators are so simple, we don't have to re-use operators for completely different operations. Just add a new one.---Sigils and Twigils allow us to know the scope of a variable and that it is a variable, at a glance.`````` sub value () { 10 } submethod BUILD ( \$value ) { \$!value = \$value || value # ^ ^ ^ # | | \_ not a variable # | \__________ subroutine scoped # \_____________________ class scoped } `````` There are also compile time "variables"`````` say \$?LINE; `````` and dynamic variables (thread local)`````` say %*ENV; `````` This makes it so that when you modify a dynamic variable, it is immediately obvious that is what you are doing.`````` sub foo () { \$*foo = 42; } my \$*foo = 0; foo(); say \$*foo; # 42 sub bar () { \$bar = 42; # compile-time error } my \$bar = 0; bar(); say \$bar;``````

Applications are open for YC Summer 2019

Search: