Haskell is Not For Production and Other TalesKatie Ots
Some say it was written exclusively for Unix-bearded wizards with PhDs. Some say only 10x programmers and unicorns can decipher its many operators. Some say any coding problem it touches will be saved from callback hell and find everlasting peace. The Haskell programming language has long been the subject of myths and misconceptions. Nonetheless it has been adopted by a slew of companies big and small, including Facebook, which has a large Haskell deployment and dozens of engineers using the language.
In this keynote, Katie will explore some of the pervasive stereotypes about the poster child of statically typed functional programming and compare and contrast them with her experiences working as a Haskell developer on the open-source Haxl project, which is used to fight spam at Facebook. As the former journalist investigates which stories stack up, she’ll share insights on what functional programming and Haskell have to offer, the challenges that come with their use, and where the ecosystem could be improved.
Presentation I gave at a Rust Austin meetup in November 2018 about exploring different approaches for interpreting custom DSLs in Rust with varying speed characteristics and associated safety issues.
As a result of an engine rewrite with focus on more efficient data structures, PHP 7 offers much improved performance and memory usage. This session describes important aspects of the new implementation and how it compares to PHP 5. A particular focus will be on the representation of values, arrays and objects.
Haskell is Not For Production and Other TalesKatie Ots
Some say it was written exclusively for Unix-bearded wizards with PhDs. Some say only 10x programmers and unicorns can decipher its many operators. Some say any coding problem it touches will be saved from callback hell and find everlasting peace. The Haskell programming language has long been the subject of myths and misconceptions. Nonetheless it has been adopted by a slew of companies big and small, including Facebook, which has a large Haskell deployment and dozens of engineers using the language.
In this keynote, Katie will explore some of the pervasive stereotypes about the poster child of statically typed functional programming and compare and contrast them with her experiences working as a Haskell developer on the open-source Haxl project, which is used to fight spam at Facebook. As the former journalist investigates which stories stack up, she’ll share insights on what functional programming and Haskell have to offer, the challenges that come with their use, and where the ecosystem could be improved.
Presentation I gave at a Rust Austin meetup in November 2018 about exploring different approaches for interpreting custom DSLs in Rust with varying speed characteristics and associated safety issues.
As a result of an engine rewrite with focus on more efficient data structures, PHP 7 offers much improved performance and memory usage. This session describes important aspects of the new implementation and how it compares to PHP 5. A particular focus will be on the representation of values, arrays and objects.
PHP 7 – What changed internally? (PHP Barcelona 2015)Nikita Popov
One of the main selling points of PHP 7 is greatly improved performance, with many real-world applications now running twice as fast… But where do these improvements come from? At the core of PHP 7 lies an engine rewrite with focus on improving memory usage and performance. This talk provides an overview of the most significant changes, briefly covering everything from data structure changes, over enhancements in the executor, to the new compiler implementation.
PHP 7 – What changed internally? (Forum PHP 2015)Nikita Popov
One of the main selling points of PHP 7 is greatly improved performance, with many real-world applications now running twice as fast… But where do these improvements come from?
At the core of PHP 7 lies an engine rewrite with focus on improving memory usage and performance. This talk provides an overview of the most significant changes, briefly covering everything from data structure changes, over enhancements in the executor, to the new compiler implementation.
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, ItalyPatrick Allaert
We all have certainly learned data structures at school: arrays, lists, sets, stacks, queues (LIFO/FIFO), heaps, associative arrays, trees, ... and what do we mostly use in PHP? The "array"! In most cases, we do everything and anything with it but we stumble upon it when profiling code. During this session, we'll learn again to use the structures appropriately, leaning closer on the way to employ arrays, the SPL and other structures from PHP extensions as well.The impact that PHP 7 should have on data structures will be introduced as well.
JavaFX Your Way: Building JavaFX Applications with Alternative LanguagesStephen Chin
JavaFX is more than a language. It is also a platform for building immersive applications with graphics, animation, and rich media. In this session, you will see how you can leverage JavaFX from a host of different JVM languages, including Java, JRuby, Groovy, Scala, and Clojure.
How to write rust instead of c and get away with itFlavien Raynaud
Ever tried optimizing a slow Python application and thought: “Oh! I wish I could just write this bit it in Rust”? Well, turns out you can! Let’s discuss why Rust is a better choice than C, how to use Rust to make your apps lightning fast and how to get away with it; without your users even noticing.
As Infrastructure Engineers at Yelp, the challenge we face everyday is: scale. Yelp is mostly a Python shop, so our work often revolves around making Python applications run faster. Until now, we have been using different techniques: faster interpreters, or, more often, C code.
Given its safety guarantees, performance and promise of better tooling than C, we decided we had to give Rust a try. The initial results helped reinforce that there was a lot of opportunity for Rust to play an important role in our production code.
Yelp heavily relies on the Apache Avro serialization format for its internal infrastructure. During the talk, we will show how we implemented avro-rs, an Avro serialization/deserialization library in Rust, how we were able to call it from Python (and in theory from any other language) with very little code, using tools such as cbindgen, CFFI and Milksnake.
This talk would outline how easy it is to write interoperable code in a performant language like Rust and why a company should invest in Rust, over the many other available alternatives, to run production services.
The Perforce Web Content Management System development team, lacking a pre-existing solution in PHP, designed and implemented their own object model and record layer to ease the interaction of the system with the Perforce Server. This session will focus on how users can access files in Perforce via a simple CRUD API, the subsystems exposed, and their usage.
PHP 7 – What changed internally? (PHP Barcelona 2015)Nikita Popov
One of the main selling points of PHP 7 is greatly improved performance, with many real-world applications now running twice as fast… But where do these improvements come from? At the core of PHP 7 lies an engine rewrite with focus on improving memory usage and performance. This talk provides an overview of the most significant changes, briefly covering everything from data structure changes, over enhancements in the executor, to the new compiler implementation.
PHP 7 – What changed internally? (Forum PHP 2015)Nikita Popov
One of the main selling points of PHP 7 is greatly improved performance, with many real-world applications now running twice as fast… But where do these improvements come from?
At the core of PHP 7 lies an engine rewrite with focus on improving memory usage and performance. This talk provides an overview of the most significant changes, briefly covering everything from data structure changes, over enhancements in the executor, to the new compiler implementation.
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, ItalyPatrick Allaert
We all have certainly learned data structures at school: arrays, lists, sets, stacks, queues (LIFO/FIFO), heaps, associative arrays, trees, ... and what do we mostly use in PHP? The "array"! In most cases, we do everything and anything with it but we stumble upon it when profiling code. During this session, we'll learn again to use the structures appropriately, leaning closer on the way to employ arrays, the SPL and other structures from PHP extensions as well.The impact that PHP 7 should have on data structures will be introduced as well.
JavaFX Your Way: Building JavaFX Applications with Alternative LanguagesStephen Chin
JavaFX is more than a language. It is also a platform for building immersive applications with graphics, animation, and rich media. In this session, you will see how you can leverage JavaFX from a host of different JVM languages, including Java, JRuby, Groovy, Scala, and Clojure.
How to write rust instead of c and get away with itFlavien Raynaud
Ever tried optimizing a slow Python application and thought: “Oh! I wish I could just write this bit it in Rust”? Well, turns out you can! Let’s discuss why Rust is a better choice than C, how to use Rust to make your apps lightning fast and how to get away with it; without your users even noticing.
As Infrastructure Engineers at Yelp, the challenge we face everyday is: scale. Yelp is mostly a Python shop, so our work often revolves around making Python applications run faster. Until now, we have been using different techniques: faster interpreters, or, more often, C code.
Given its safety guarantees, performance and promise of better tooling than C, we decided we had to give Rust a try. The initial results helped reinforce that there was a lot of opportunity for Rust to play an important role in our production code.
Yelp heavily relies on the Apache Avro serialization format for its internal infrastructure. During the talk, we will show how we implemented avro-rs, an Avro serialization/deserialization library in Rust, how we were able to call it from Python (and in theory from any other language) with very little code, using tools such as cbindgen, CFFI and Milksnake.
This talk would outline how easy it is to write interoperable code in a performant language like Rust and why a company should invest in Rust, over the many other available alternatives, to run production services.
The Perforce Web Content Management System development team, lacking a pre-existing solution in PHP, designed and implemented their own object model and record layer to ease the interaction of the system with the Perforce Server. This session will focus on how users can access files in Perforce via a simple CRUD API, the subsystems exposed, and their usage.
Scalable and Flexible Machine Learning With Scala @ LinkedInVitaly Gordon
The presentation given by Chris Severs and myself at the Bay Area Scala Enthusiasts meetup. http://www.meetup.com/Bay-Area-Scala-Enthusiasts/events/105409962/
Are you Java Developer? Are you currently in a project where Javascript language is used? Do you feel that something is wrong with this language, as it looks a bit like a Java, but acts completely differently (as almost as it was designed to be confusing and completely not deterministic)? Do you test or even TDD your Java code, but write your Javascript code as its 1996 all over again? Do feel that basically you are doing something wrong there, reinventing the wheel? Well, fear no more, since this lecture is here to help. We will start introducing key concepts of the language, showing that Javascript is to Java, as a ham is to hamburger. We will move later on to test driven development, showing how easy it is to test Javascript code with all the goodies we know from Java world. At the end we will finish introducing DI concepts in Javascript, so that you will never write code in the global namespace ever again. So the true question remains: are you ready to call yourself Javascript developer?
Bio: Software engineer, programmer, developer. Experienced with Java ecosystem. Currently having tons of fun at work with Scala, Akka, Apache Spark and distributed cloud computing.
Ruby is amazing. It has a huge standard library and a core choc full of weird and wonderful things. In this talk, given at the Ipswich Ruby User Group, I give a whimsical nonstop tour through some of the more obscure parts of Ruby.
Выступление в рамках спецкурса "Немейнстримовые технологии разработки", читаемого в НГУ. http://bit.ly/mainstreamless
Аудио дорожка работает, но нужно иметь некоторое терпение, так как грузится она не моментально.
Most developers are aware about design patterns. The difficulty is not in understanding them but in getting an intuitive understanding of when and how to apply them. In this session, we'll go through a case study of how a tiny interpreter (of course written in Java) may implement different design patterns.
The link to source code is:
https://github.com/CodeOpsTech/InterpreterDesignPatterns
Can't Miss Features of PHP 5.3 and 5.4Jeff Carouth
If you're like me you remember the days of PHP3 and PHP4; you remember when PHP5 was released, and how it was touted to change to your life. It's still changing and there are some features of PHP 5.3 and new ones coming with PHP 5.4 that will improve your code readability and reusability. Let's look at some touted features such as closures, namespaces, and traits, as well as some features being discussed for future releases.
Hadoop est devenu une référence dans l’univers du BigData, et MapReduce, un nouveau paradigme pour exploiter les données. Implémenter directement les traitements de données avec MapReduce donne certainement le plus de flexibilité, mais cela revient à utiliser de l’assembleur. Cascalog est sans doute l’alternative la plus concise. Basée sur Clojure, cette solution vous laisse dans un environnement familier (la JVM) tout en vous apportant une abstraction fort utile par le biais de la programmation logique.
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...Adam Mukharil Bachtiar
This file contains explanation about introduction of dev pascal, data type, value, and identifier. This file was used in my Algorithm and Programming Class.
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...Naresha K
There are several instances where Groovy and Kotlin take different approaches to implement Effective Java. As a participant, you walk away appreciating the simplicity with which these JVM languages empower the developers. The talk also provides food for thought - how languages can influence its users to adopt good practices.
This is an quick introduction to Scalding and Monoids. Scalding is a Scala library that makes writing MapReduce jobs very easy. Monoids on the other hand promise parallelism and quality and they make some more challenging algorithms look very easy.
The talk was held at the Helsinki Data Science meetup on January 9th 2014.
Scala is becoming the language of choice for many development teams. This talk highlights how Scala excels in the world of multi-core processing and explores how it compares to Java 8.
Video Presentation: http://youtu.be/8vxTowBXJSg
4. Rakudo Perl 6: What You Can Do Today
What is Perl 6?
Take the things that make Perl great…
Practical - focus on getting the job done
Multi-paradigm – because there isn't one
approach that's good for all problems
Linguistic influences – because it's a
programming language
Making the easy things easy and the hard
things possible
5. Rakudo Perl 6: What You Can Do Today
What is Perl 6?
Build a new Perlish language that is…
More regular – less special cases
More readable and more maintainable
More expressive
More OO, more functional, more
declarative, more parallel…
Easy things even easier
Harder things even more in reach
6. Rakudo Perl 6: What You Can Do Today
1 Specification, Many Implementations
Unlike Perl 5, Perl 6 has a written language
specification
No "official" implementation
Like Perl 5, Perl 6 has a language test suite
A conforming implementation should pass
the test suite
A kind of "executable specification"
Currently around 40,000 tests
8. Rakudo Perl 6: What You Can Do Today
What is Rakudo?
The most actively developed Perl 6 compiler
Implements a large portion of the Perl 6
specification (though still some way to go)
Today passing over 30,000 tests from the
Perl 6 specification test suite (though the
suite is still growing ☺)
Currently targets the Parrot Virtual Machine
Later in the year, we plan to target at least
one other platform too
9. Rakudo Perl 6: What You Can Do Today
How Rakudo Works
Written in…
NQP (Bootstrapped subset of Perl 6)
Compiler core (grammar and AST construction),
some of the meta-model, module location/loading)
Perl 6
The majority of the built-ins and operators
Parrot Intermediate Language
Some lower-level builtins and "glue"
C
Dispatchers, signature binder, other VM
customizations and glue
10. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: Parsing
First, Rakudo parses your program
Parser is written in Perl 6 Regexes
token statement_control:sym<if> {
<sym> :s
<xblock>
[ 'elsif's <xblock> ]*
[ 'else's <else=.pblock> ]?
}
Some scary stuff…
Might discover new operators during parse
Have to run BEGIN blocks immediately
11. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: AST Construction
Whenever we finish parsing something (for
example, an if statement), we run an "action
method"
This builds an Abstract Syntax Tree
A representation of the program that is
abstracted away from the language syntax
Most action methods build up a more
complex AST using smaller bits made by
things we already parsed
12. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: AST Construction
if $x == 42 { say "The answer!"; }
13. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: AST Construction
if $x == 42 { say "The answer!"; }
PAST::Var.new(
:name('$x'),
:scope('lexical')
)
14. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: AST Construction
if $x == 42 { say "The answer!"; }
PAST::Var.new( PAST::Val.new(
:name('$x'), :value(42)
:scope('lexical') )
)
15. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: AST Construction
if $x == 42 { say "The answer!"; }
PAST::Op.new(
:pasttype('call'),
:name('&infix:<==>'),
…
)
PAST::Var.new( PAST::Val.new(
:name('$x'), :value(42)
:scope('lexical') )
)
16. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: AST Construction
if $x == 42 { say "The answer!"; }
PAST::Op.new(
:pasttype('call'),
:name('&infix:<==>'),
…
)
PAST::Var.new( PAST::Val.new(
:name('$x'), :value(42)
:scope('lexical') )
) PAST::Val.new(
:value('The Answer!')
)
17. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: AST Construction
if $x == 42 { say "The answer!"; }
PAST::Op.new(
:pasttype('call'),
:name('&infix:<==>'),
… PAST::Op.new(
) :pasttype('call'),
:name('&say'),
…
PAST::Var.new( PAST::Val.new( )
:name('$x'), :value(42)
:scope('lexical') )
) PAST::Val.new(
:value('The Answer!')
)
18. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: AST Construction
if $x == 42 { say "The answer!"; }
PAST::Op.new( PAST::Block.new( … )
:pasttype('call'),
:name('&infix:<==>'),
… PAST::Op.new(
) :pasttype('call'),
:name('&say'),
…
PAST::Var.new( PAST::Val.new( )
:name('$x'), :value(42)
:scope('lexical') )
) PAST::Val.new(
:value('The Answer!')
)
19. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: AST Construction
if $x == 42 { say "The answer!"; }
PAST::Op.new( :pasttype('if'), … )
PAST::Op.new( PAST::Block.new( … )
:pasttype('call'),
:name('&infix:<==>'),
… PAST::Op.new(
) :pasttype('call'),
:name('&say'),
…
PAST::Var.new( PAST::Val.new( )
:name('$x'), :value(42)
:scope('lexical') )
) PAST::Val.new(
:value('The Answer!')
)
20. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: AST Construction
if $x == 42 { say "The answer!"; }
PAST::Op.new( :pasttype('if'), … )
PAST::Op.new( PAST::Block.new( … )
:pasttype('call'),
:name('&infix:<==>'),
… PAST::Op.new(
) :pasttype('call'),
:name('&say'),
…
PAST::Var.new( PAST::Val.new( )
:name('$x'), :value(42)
:scope('lexical') )
) PAST::Val.new(
:value('The Answer!')
)
21. Rakudo Perl 6: What You Can Do Today
How Rakudo Works: Code Generation
We take the AST and produce intermediate
code for the target platform
Today, we can only produce code in this
stage for the Parrot VM
Architecture means that we'll be able to add
more backends in the future
Can also insert optimization and program
analysis phases at any point in the
compilation pipeline
22. Rakudo Perl 6: What You Can Do Today
Examples:
What You Can
Do Today In
Rakudo
23. Rakudo Perl 6: What You Can Do Today
Examples
We'll look at a range of small, everyday
programming problems and for each one
show…
The Perl 6 code that solves it
The output that code gives when run
Hopefully, a good way for you to start to
grasp some of the new syntax and features
Show of some cool Perl 6 features ☺
All examples shown today work in Rakudo
24. Rakudo Perl 6: What You Can Do Today
Problem
Say "Hello, world"
Solution
say "Hello, world!"
Output
Hello, world!
25. Rakudo Perl 6: What You Can Do Today
Problem
Read input from the console
Solution
print "Enter your name: ";
my $name = $*IN.get;
say "Hi $name!";
Output
Enter your name: Jonathan
Hi Jonathan!
26. Rakudo Perl 6: What You Can Do Today
Problem
Check a value is in a given range
Solution 1
loop {
print "Enter a number from 1 to 10: ";
my $num = $*IN.get;
unless 1 <= $num <= 10 { say "Fail!" }
}
Output
Enter a number between 1 and 10: 3
Enter a number between 1 and 10: 42
Fail!
27. Rakudo Perl 6: What You Can Do Today
Problem
Check a value is in a given range
Solution 2
loop {
print "Enter a number from 1 to 10: ";
my $num = $*IN.get;
unless $num ~~ 1..10 { say "Fail!" }
}
Output
Enter a number between 1 and 10: 3
Enter a number between 1 and 10: 42
Fail!
28. Rakudo Perl 6: What You Can Do Today
Problem
Add up a list of numbers
Solution
my @nums = 1, 5, 7, -2, 3, 9, 11, -6, 14;
say [+] @nums;
Output
42
29. Rakudo Perl 6: What You Can Do Today
Problem
Check if a list is sorted
Solution
my @a = 1, 1, 2, 3, 5, 8;
my @b = 9, 4, 1, 16, 36, 25;
if [<=] @a { say '@a is sorted' }
if [<=] @b { say '@b is sorted' }
Output
@a is sorted
30. Rakudo Perl 6: What You Can Do Today
Problem
Iterate over a list
Solution
my @cities = <Lisbon Tokyo Seoul Riga>;
for @cities -> $city {
say "I've been to $city";
}
Output
I've been to Lisbon
I've been to Tokyo
I've been to Seoul
I've been to Riga
31. Rakudo Perl 6: What You Can Do Today
Problem
Iterate over the keys and values of a hash
Solution
my %distances =
Bratislava => 1084,
Stockholm => 442;
for %distances.kv -> $city, $distance {
say "$city is $distance km away";
}
Output
Bratislava is 1084 km away
Stockholm is 442 km away
32. Rakudo Perl 6: What You Can Do Today
Problem
Check if any of a list of test scores is a pass
Solution
my @a = 75, 47, 90, 22, 80;
my @b = 61, 77, 94, 82, 60;
my @c = 45, 59, 33, 11, 19;
if any(@a) >= 60 { say "Some passes in A" }
if any(@b) >= 60 { say "Some passes in B" }
if any(@c) >= 60 { say "Some passes in C" }
Output
Some passes in A
Some passes in B
33. Rakudo Perl 6: What You Can Do Today
Problem
Check if all of a list of test scores are passes
Solution
my @a = 75, 47, 90, 22, 80;
my @b = 61, 77, 94, 82, 60;
my @c = 45, 59, 33, 11, 19;
if all(@a) >= 60 { say "All passes in A" }
if all(@b) >= 60 { say "All passes in B" }
if all(@c) >= 60 { say "All passes in C" }
Output
All passes in B
34. Rakudo Perl 6: What You Can Do Today
Problem
Check if none of a list of test scores is a pass
Solution
my @a = 75, 47, 90, 22, 80;
my @b = 61, 77, 94, 82, 60;
my @c = 45, 59, 33, 11, 19;
if none(@a) >= 60 { say "No passes in A" }
if none(@b) >= 60 { say "No passes in B" }
if none(@c) >= 60 { say "No passes in C" }
Output
No passes in C
35. Rakudo Perl 6: What You Can Do Today
Problem
Get a random item from a list
Solution
my @drinks = <wine beer vodka>;
say "Tonight I'll drink { @drinks.pick }";
Output (results should vary ;-))
Tonight I'll drink vodka
36. Rakudo Perl 6: What You Can Do Today
Problem
Shuffle a list into a random order
Solution
my @competitors = <Tina Lena Owen Peter>;
my @order = @competitors.pick(*);
for @order { .say }
Output (results should vary ;-))
Peter
Lena
Owen
Tina
37. Rakudo Perl 6: What You Can Do Today
Problem
Write and call a subroutine with parameters
Solution
sub greet($greeting, $name) {
say "$greeting, $name!";
}
greet("hello", "masak");
Output
hello, masak
38. Rakudo Perl 6: What You Can Do Today
Problem
Write a subroutine that only takes a number
Solution
sub double(Num $n) { 2 * $n }
say double(21);
say double("oh no I'm not a number");
Output
42
Parameter type check failed; expected Num,
but got Str for $n in call to double
39. Rakudo Perl 6: What You Can Do Today
Problem
Use multi-subs to react differently by type
Solution
multi double(Num $n) { 2 * $n }
multi double(Str $s) { $s x 2 }
say double(21);
say double("boo");
Output
42
booboo
40. Rakudo Perl 6: What You Can Do Today
Problem
Compute factorial (recursively)
Solution
multi fact($n) { $n * fact($n - 1) }
multi fact(0) { 1 }
say fact(1);
say fact(10);
Output
1
3628800
41. Rakudo Perl 6: What You Can Do Today
Problem
Compute factorial (using a meta-operator)
Solution
sub fact($n) { [*] 1..$n }
say fact(1);
say fact(10);
Output
1
3628800
42. Rakudo Perl 6: What You Can Do Today
Problem
Add a new factorial operator (so 10! works)
Solution
sub postfix:<!>($n) { [*] 1..$n }
say 1!;
say 10!;
Output
1
3628800
43. Rakudo Perl 6: What You Can Do Today
Problem
Declare a class with attributes and a method
Solution
class Product {
has $.name; # Attr + accessor
has $!price; # Attr only
has $.discount is rw;
# Attr + lvalue accessor
method get_price {
return $!price - $!discount;
}
}
44. Rakudo Perl 6: What You Can Do Today
Problem
Instantiate a class and call a method on it
Solution
my $prod = Product.new(
name => "Beer",
price => 500,
discount => 60
);
say $prod.get_price;
Output
440
45. Rakudo Perl 6: What You Can Do Today
Problem
Get/set attributes through accessors
Solution
say $prod.name;
$prod.discount = 40;
say $prod.get_price;
$prod.name = 'Wine';
Output
Beer
460
Cannot assign to readonly variable.
46. Rakudo Perl 6: What You Can Do Today
Problem
Call a method on every object in a list
Solution
my @products =
Product.new(name => 'Beer', price => 500),
Product.new(name => 'Wine', price => 450),
Product.new(name => 'Vodka', price => 1600);
my @uc_names = @products>>.name>>.uc;
for @uc_names { .say }
Output
BEER
WINE
VODKA
47. Rakudo Perl 6: What You Can Do Today
Problem
Introspect a class to find its methods
Solution
my @meths = Product.^methods(:local);
for @meths>>.name { .say }
Output
get_price
discount
name
48. Rakudo Perl 6: What You Can Do Today
Problem
Sort an array of objects by result of a method
Solution (Example 1)
my @products =
Product.new(name => 'Beer', price => 500),
Product.new(name => 'Wine', price => 450),
Product.new(name => 'Vodka', price => 1600);
my @sorted = @products.sort(*.name);
for @sorted { .name.say }
Output (Example 1)
Beer
Vodka
Wine
49. Rakudo Perl 6: What You Can Do Today
Problem
Sort an array of objects by result of a method
Solution (Example 2)
my @products =
Product.new(name => 'Beer', price => 500),
Product.new(name => 'Wine', price => 450),
Product.new(name => 'Vodka', price => 1600);
my @sorted = @products.sort(*.get_price);
for @sorted { .name.say }
Output (Example 2)
Wine
Beer
Vodka
50. Rakudo Perl 6: What You Can Do Today
Problem
Find minimum and maximum values from a list
Solution (Example 1)
my @temperatures = -3, 5, 7, 2, -1, -4, 0;
say "Minimum was " ~ @temperatures.min;
say "Maximum was " ~ @temperatures.max;
Output (Example 1)
Minimum was –4
Maximum was 7
51. Rakudo Perl 6: What You Can Do Today
Problem
Find minimum and maximum values from a list
Solution (Example 2)
my @products =
Product.new(name => 'Beer', price => 500),
Product.new(name => 'Wine', price => 450),
Product.new(name => 'Vodka', price => 1600);
say "Cheapest: " ~ @products.min(*.get_price).name;
say "Costliest: " ~ @products.max(*.get_price).name;
Output (Example 2)
Cheapest: Wine
Costliest: Vodka
52. Rakudo Perl 6: What You Can Do Today
Problem
Paper, Scissor, Stone game
Solution (Part 1)
class Paper { }
class Scissor { }
class Stone { }
multi win(Paper, Stone) { "Win" }
multi win(Scissor, Paper) { "Win" }
multi win(Stone, Scissor) { "Win" }
multi win(::T, T) { "Draw" }
multi win(Any, Any) { "Lose" }
53. Rakudo Perl 6: What You Can Do Today
Problem
Paper, Scissor, Stone game
Solution (Part 2)
say win(Paper, Paper);
say win(Scissor, Stone);
say win(Stone, Scissor);
Output
Draw
Lose
Win
55. Rakudo Perl 6: What You Can Do Today
What is Rakudo *?
Rakudo is making great progress
Steadily implementing more of the spec
Steadily passing more and more tests
Fixing lots of bugs
Number of active developers is growing
So far we have been very much focused on
building Rakudo
Rakudo * is a release where we instead
focus on what early adopters need
56. Rakudo Perl 6: What You Can Do Today
What will the release include?
We make a compiler release every month;
by contrast, Rakudo * is a distribution
release including:
The Rakudo compiler, of course ☺
Tool for downloading, installing and
updating modules
A range of Perl 6 modules that help you
achieve some common tasks (e.g. HTTP
client/server, database connectivity, web
things, YAML…)
57. Rakudo Perl 6: What You Can Do Today
What will the release include?
We are also aiming to include a couple of
other projects…
Zavolaj! – a module that lets you write
some basic pure Perl 6 bindings to C
libraries; we built a MySQL client with it
Blizkost – a Perl 5 Parrot bridge layer
that will allow you to use Perl 5 modules
from within Perl 6
58. Rakudo Perl 6: What You Can Do Today
What Rakudo * Will Do Well
Rakudo has good coverage of a lot of the
Perl 6 specification…
Wide range of built-in operators, types and
functions
Subs, signatures and multiple dispatch
Object orientation, including classes,
roles, introspection and much more
Perl 6 regexes and grammars (it's the
same engine we use to parse Perl 6!)
59. Rakudo Perl 6: What You Can Do Today
Weaker Areas
Rakudo * will have a lot to offer, and should
be useful for a range of tasks
However, it's not The Full Perl 6, and of
course has some weak spots, including:
Missing support for threading
No native types support
Fairly slow – not much work on
optimization yet, and no optimizer
64. Rakudo Perl 6: What You Can Do Today
Want to learn more?
Get Rakudo Perl 6 from:
http://www.rakudo.org/
Lots of Perl 6 resources can be found at:
http://www.perl6.org/
Join the friendly IRC channel:
#perl6 on irc.freenode.org
Write modules, write applications, jump into
the evolving Perl 6 community and make
your mark on it ☺