SlideShare a Scribd company logo
Rakudo 楽土
Polyglot Programming DC 2014
Brock Wilcox
awwaiid@thelackthereof.org
bwilcox@optoro.com
Big language. Lots of stuff.
Object Oriented (Ruby, CLOS)
Data/Function Oriented (Haskell, Clojure)
Operator Oriented (APL, J)
Sigil Oriented (Ruby, Perl)
Optional Static Typing (Common Lisp)
Multi Dispatch (Clojure, Haskell)
Normal Stuff
Fancy Stuff
Insane Stuff
Normal Stuff
· Garbage collected
· Curley, semi-colony
· Class object system
· Roles (like interfaces, mixins, traits)
· Scalars, lists, hashes, sets
· Block scoping, closures, anon funcs
class Animal { }
class Dog is Animal { }
role Logging { }
class Dog does Logging { }
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
Sigils / Twigls
$joe # scalar
$!name # private instance var
$.name # public instance var kinda
@people # list
%phonebook # hash
&lookup # callable block
Scalars, Lists, Hashes
my @names = ('Casey', 'Dakota', 'Jaiden', 'Jordan', 'Peyton');
my @names = <Casey Dakota Jaiden Jordan Peyton>;
say "Third: @names[2]"
say @names.join(", ");
my %ages = {
Casey => 5,
Dakota => 10,
Jaiden => 15,
};
say "Jaiden is %ages{'Jaiden'}";
say "Jaiden is %ages<Jaiden>";
Ruby-style DSL blocks
sub doit(&thing) {
say "I say...";
&thing();
}
doit { say "hello" }
Closures / Lambdas
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
Fancy Stuff
· Optional Static Typing
· Introspection and MOP
· Advanced subroutine argument declarations
· Multi dispatch (both type and value based)
· Generators
· Lazy evaluated lists
· Partial application / currying
· Concurrent multi-version module usage
my $x = "fishies"
my Int $x = "fishies" # ERROR
sub add_only_ints(Int $x, Int $y) {
$x + $y
}
Multi-dispatch
(pattern matching)
multi sub add_stuff(Int $x, Int $y) {
$x + $y
}
multi sub add_stuff(Str $x, Str $y) {
$x ~ $y
}
Meta Programming / Introspection
# Get the class
say 3.WHAT # (Int)
# Get the heirarchy
3.^mro
# Get the methods
3.^methods
Insane(ly awesome) Stuff
· Operator overloading
· Meta/Hyper operators
· Chained comparisons
· Adverbs
· Grammars
· Junction values
· Unixy MAIN
· Macros
· Whatever-star
· Placeholder variables
Operator-Oriented
5 + 7
Meta/Hyper Operators
$x += 5
$x -= 5
$x *= 5
$x /= 5
my $x = 5
$x = $x.is-prime
$x .= is-prime
[+] <5 7 23 21 32>
# 88
<1 2 3 4> <<+>> <5 6 7 8>
# 6 8 10 12
<1 2 3 4> «+» <5 6 7 8>
# 6 8 10 12
<1 2 3 4> «*» <5 6 7 8>
# 5 12 21 32
User-defined operators
sub infix:<⋄> ($a, $b) {
$a >= $b ?? $a !! $b;
# or: $a max $b
}
17 ⋄ 42
my $x = 7;
$x ⋄= 3;
sub postfix:<!>($n) {
[*] 2..$n;
}
6! # 720
"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
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]
Get a list of all builtin infix operators
CORE::.keys.grep(/infix/)>>.say
Show all the multi dispatches for '+'
&[+].candidates>>.say
Random Stuff
2 < $x < 10
$x = 5|7
if $x == 5 { say "yep" } else { say "nope" }
$x = 5&7
if $x.is-prime { say "yep" } else { say "nope" }
@stuff.map: { $^a + 2 }
@stuff.map: { $^fish + $^sticks }
-> $x { $x + 2 }
<2 3 4 5 4> <<+>> 2
<2 3 4 5 4>.map: -> $x { $x + 2 }
<2 3 4 5 4>.map: * + 2
use MONKEY_TYPING;
augment class Int {
method infix:<⋄> ($v) {
self min $v
}
}
In-progress features:
· Non-blocking IO
· Inline concurrency
· Autothreading
· Advanced macros
· Improving JVM integration
THE END
Oh yeah. Almost forgot.
Rakudo is an implementation of Perl6

More Related Content

What's hot

On Functional Programming - A Clojurian Perspective
On Functional Programming - A Clojurian PerspectiveOn Functional Programming - A Clojurian Perspective
On Functional Programming - A Clojurian Perspective
looselytyped
 

What's hot (17)

Crystal Rocks
Crystal RocksCrystal Rocks
Crystal Rocks
 
Intro to F#
Intro to F#Intro to F#
Intro to F#
 
1st CI&T Lightning Talks: Writing better code with Object Calisthenics
1st CI&T Lightning Talks: Writing better code with Object Calisthenics1st CI&T Lightning Talks: Writing better code with Object Calisthenics
1st CI&T Lightning Talks: Writing better code with Object Calisthenics
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
 
On Functional Programming - A Clojurian Perspective
On Functional Programming - A Clojurian PerspectiveOn Functional Programming - A Clojurian Perspective
On Functional Programming - A Clojurian Perspective
 
Generating Power with Yield
Generating Power with YieldGenerating Power with Yield
Generating Power with Yield
 
Writing a compiler in go
Writing a compiler in goWriting a compiler in go
Writing a compiler in go
 
PostgreSQL table partitioning
PostgreSQL table partitioningPostgreSQL table partitioning
PostgreSQL table partitioning
 
PHP 101
PHP 101 PHP 101
PHP 101
 
tutorial7
tutorial7tutorial7
tutorial7
 
Object-Oriented Programming with PHP (part 1)
Object-Oriented Programming with PHP (part 1)Object-Oriented Programming with PHP (part 1)
Object-Oriented Programming with PHP (part 1)
 
Functional Programming in PHP
Functional Programming in PHPFunctional Programming in PHP
Functional Programming in PHP
 
003 scripting
003 scripting003 scripting
003 scripting
 
Introduction in php part 2
Introduction in php part 2Introduction in php part 2
Introduction in php part 2
 
Kotlin For Android - Functions (part 3 of 7)
Kotlin For Android - Functions (part 3 of 7)Kotlin For Android - Functions (part 3 of 7)
Kotlin For Android - Functions (part 3 of 7)
 
What's New In C# 7
What's New In C# 7What's New In C# 7
What's New In C# 7
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 

Similar to Rakudo

Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
Loïc Descotte
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
Dmitry Buzdin
 

Similar to Rakudo (20)

Softshake 2013: 10 reasons why java developers are jealous of Scala developers
Softshake 2013: 10 reasons why java developers are jealous of Scala developersSoftshake 2013: 10 reasons why java developers are jealous of Scala developers
Softshake 2013: 10 reasons why java developers are jealous of Scala developers
 
Migrating to Puppet 4.0
Migrating to Puppet 4.0Migrating to Puppet 4.0
Migrating to Puppet 4.0
 
Php & my sql
Php & my sqlPhp & my sql
Php & my sql
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable Lisp
 
Perl tutorial final
Perl tutorial finalPerl tutorial final
Perl tutorial final
 
Scala - en bedre og mere effektiv Java?
Scala - en bedre og mere effektiv Java?Scala - en bedre og mere effektiv Java?
Scala - en bedre og mere effektiv Java?
 
Pune Clojure Course Outline
Pune Clojure Course OutlinePune Clojure Course Outline
Pune Clojure Course Outline
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?
 
PHP and MySQL
PHP and MySQLPHP and MySQL
PHP and MySQL
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
Scala for Java Programmers
Scala for Java ProgrammersScala for Java Programmers
Scala for Java Programmers
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
PHP PPT FILE
PHP PPT FILEPHP PPT FILE
PHP PPT FILE
 
ppt7
ppt7ppt7
ppt7
 
ppt2
ppt2ppt2
ppt2
 
name name2 n
name name2 nname name2 n
name name2 n
 
ppt9
ppt9ppt9
ppt9
 
Ruby for Perl Programmers
Ruby for Perl ProgrammersRuby for Perl Programmers
Ruby for Perl Programmers
 
name name2 n2
name name2 n2name name2 n2
name name2 n2
 

More from awwaiid

More from awwaiid (8)

2015-10-07 PPDC HTTP Adapters
2015-10-07 PPDC HTTP Adapters2015-10-07 PPDC HTTP Adapters
2015-10-07 PPDC HTTP Adapters
 
2016-05-12 DCRUG React.rb
2016-05-12 DCRUG React.rb2016-05-12 DCRUG React.rb
2016-05-12 DCRUG React.rb
 
Random. Kinda.
Random. Kinda.Random. Kinda.
Random. Kinda.
 
Mad Science: Polyglot Bridges
Mad Science: Polyglot BridgesMad Science: Polyglot Bridges
Mad Science: Polyglot Bridges
 
A Partial Multiverse Model of Time Travel for Debugging
A Partial Multiverse Model of Time Travel for DebuggingA Partial Multiverse Model of Time Travel for Debugging
A Partial Multiverse Model of Time Travel for Debugging
 
RailsGirls DC 2012 - Debugging
RailsGirls DC 2012 - DebuggingRailsGirls DC 2012 - Debugging
RailsGirls DC 2012 - Debugging
 
NoiseGen at Arlington Ruby 2012
NoiseGen at Arlington Ruby 2012NoiseGen at Arlington Ruby 2012
NoiseGen at Arlington Ruby 2012
 
PPW2007 - Continuity Project
PPW2007 - Continuity ProjectPPW2007 - Continuity Project
PPW2007 - Continuity Project
 

Recently uploaded

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
Alluxio, Inc.
 

Recently uploaded (20)

SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 

Rakudo