I demonstrate a small slice of Rakudo, an implementation of a dynamic language with some advanced features.
During the actual talk I used the REPL to do live demonstrations, often taking suggestions from the audience.
9. class Person {
has $.name;
has $.age;
method say-hi {
say "I am the great $.name! I am $.age years old.";
}
}
my $joe = Person.new( name => 'Joe', age => 37 );
$joe.say-hi
13. my @names = ('Casey', 'Dakota', 'Jaiden', 'Jordan', 'Peyton');
my @names = <Casey Dakota Jaiden Jordan Peyton>;
say "Third: @names[2]"
say @names.join(", ");
14. my %ages = {
Casey => 5,
Dakota => 10,
Jaiden => 15,
};
say "Jaiden is %ages{'Jaiden'}";
say "Jaiden is %ages<Jaiden>";
18. sub counter {
my $n = 1;
-> { $n++ };
}
my &counter_1 = counter();
my &counter_2 = counter();
say &counter_1(); # 1
say &counter_1(); # 2
say &counter_2(); # 1
say &counter_2(); # 2
41. "I swear the only reason we don’t have factorial
as a standard operator in the language, is so
that we can impress people by defining it."
- Carl Mäsak
42. type position syntax
====== ========== ========
prefix before a term !X
infix between two terms X ! Y
postfix after a term X!
circumfix around [X]
postcircumfix after & around X[Y]
43. Get a list of all builtin infix operators
CORE::.keys.grep(/infix/)>>.say
44. Show all the multi dispatches for '+'
&[+].candidates>>.say