SlideShare a Scribd company logo

Perl 6 For Mere Mortals

Curtis Poe
Curtis PoeFreelance Perl expert. I offer training and consulting in agile development, software testing and Perl. at All Around the World

Many people seem intimidated by Perl 6 because it's so complicated. However, a car can seem complicated if it's explained by a race car enthusiast, but most of us just get in and drive. In reality, Perl 6 isn't that hard and helps to avoid one of the largest class of errors that many programs have: passing data between functions. In the long run, I suspect that Perl 6, given that it runs on the JVM, might become increasingly popular with enterprise clients who want the speed of development of dynamic languages, the ease of deployment with the JVM, and the safety of many "static" languages.

Perl 6 For Mere Mortals

Curtis Poe
Curtis PoeFreelance Perl expert. I offer training and consulting in agile development, software testing and Perl. at All Around the World

Many people seem intimidated by Perl 6 because it's so complicated. However, a car can seem complicated if it's explained by a race car enthusiast, but most of us just get in and drive. In reality, Perl 6 isn't that hard and helps to avoid one of the largest class of errors that many programs have: passing data between functions. In the long run, I suspect that Perl 6, given that it runs on the JVM, might become increasingly popular with enterprise clients who want the speed of development of dynamic languages, the ease of deployment with the JVM, and the safety of many "static" languages.

Perl 6 For Mere Mortals

1 of 94
Download to read offline
Copyright	
  2015,	
  h0p://www.allaroundtheworld.fr/	
  January	
  26,	
  2015	
  
Perl	
  6	
  
A	
  Dynamic	
  Language	
  for	
  
Mere	
  Mortals	
  
CurFs	
  "Ovid"	
  Poe	
  
h0p://allaroundtheworld.fr/	
  
(With	
  the	
  unwiLng	
  assistance	
  of	
  Manuel	
  Cerón	
  h0p://ceronman.com/)	
  
Copyright	
  2015,	
  h0p://www.allaroundtheworld.fr/	
  January	
  26,	
  2015	
  
January	
  26,	
  2015	
   Copyright	
  2015,	
  h0p://www.allaroundtheworld.fr/	
  
Image	
  Courtesy	
  Luc	
  Viator	
  
h0p://www.lucnix.be/	
  
Basic	
  Math	
  
January	
  26,	
  2015	
   Copyright	
  2015,	
  h0p://www.allaroundtheworld.fr/	
  
Basic	
  Math	
  
January	
  26,	
  2015	
   Copyright	
  2015,	
  h0p://www.allaroundtheworld.fr/	
  
Find	
  the	
  volume	
  of	
  the	
  region	
  bounded	
  above	
  by	
  the	
  sphere	
  x^2+y^2+z^2	
  =	
  a^2	
  and	
  
below	
  by	
  the	
  cone	
  z^2	
  sin^2(a)	
  =	
  (x^2+y^2)cos^2(a)	
  where	
  a	
  is	
  in	
  the	
  interval	
  [0,π]	
  
h0p://commons.wikimedia.org/wiki/Category:Integral_calculus#mediaviewer/File:Triple_Integral_Example_2.svg	
  
Solve	
  for	
  "x"	
  
January	
  26,	
  2015	
   Copyright	
  2015,	
  h0p://www.allaroundtheworld.fr/	
  
x	
  =	
  7	
  ÷	
  2	
  

Recommended

À la découverte des Observables - HumanTalks Paris 2017
À la découverte des Observables - HumanTalks Paris 2017À la découverte des Observables - HumanTalks Paris 2017
À la découverte des Observables - HumanTalks Paris 2017Nicolas Carlo
 
FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳Yuri Inoue
 
EuroPython 2015 - Decorators demystified
EuroPython 2015 - Decorators demystifiedEuroPython 2015 - Decorators demystified
EuroPython 2015 - Decorators demystifiedPablo Enfedaque
 
Compiled Python UDFs for Impala
Compiled Python UDFs for ImpalaCompiled Python UDFs for Impala
Compiled Python UDFs for ImpalaCloudera, Inc.
 
Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)
Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)
Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)Uri Laserson
 
The core libraries you always wanted - Google Guava
The core libraries you always wanted - Google GuavaThe core libraries you always wanted - Google Guava
The core libraries you always wanted - Google GuavaMite Mitreski
 
Kotlin collections
Kotlin collectionsKotlin collections
Kotlin collectionsMyeongin Woo
 
Home Automation with Android Things and the Google Assistant
Home Automation with Android Things and the Google AssistantHome Automation with Android Things and the Google Assistant
Home Automation with Android Things and the Google AssistantNilhcem
 

More Related Content

Viewers also liked

Modern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic  Perl ProgrammerModern Perl for the Unfrozen Paleolithic  Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl ProgrammerJohn Anderson
 
Number sequences
Number sequencesNumber sequences
Number sequencesWorserbay
 
Carcinoma rectum the complete aproach to how to investigate and treat a case ...
Carcinoma rectum the complete aproach to how to investigate and treat a case ...Carcinoma rectum the complete aproach to how to investigate and treat a case ...
Carcinoma rectum the complete aproach to how to investigate and treat a case ...nikhilameerchetty
 
Carcinoma rectum
Carcinoma   rectumCarcinoma   rectum
Carcinoma rectumbarun kumar
 
Surgery for Rectal Cancer
Surgery for Rectal CancerSurgery for Rectal Cancer
Surgery for Rectal Cancerensteve
 

Viewers also liked (6)

Modern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic  Perl ProgrammerModern Perl for the Unfrozen Paleolithic  Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl Programmer
 
Number sequences
Number sequencesNumber sequences
Number sequences
 
Number Sequences
Number SequencesNumber Sequences
Number Sequences
 
Carcinoma rectum the complete aproach to how to investigate and treat a case ...
Carcinoma rectum the complete aproach to how to investigate and treat a case ...Carcinoma rectum the complete aproach to how to investigate and treat a case ...
Carcinoma rectum the complete aproach to how to investigate and treat a case ...
 
Carcinoma rectum
Carcinoma   rectumCarcinoma   rectum
Carcinoma rectum
 
Surgery for Rectal Cancer
Surgery for Rectal CancerSurgery for Rectal Cancer
Surgery for Rectal Cancer
 

Similar to Perl 6 For Mere Mortals

Developing Your Own Flux Packages by David McKay | Head of Developer Relation...
Developing Your Own Flux Packages by David McKay | Head of Developer Relation...Developing Your Own Flux Packages by David McKay | Head of Developer Relation...
Developing Your Own Flux Packages by David McKay | Head of Developer Relation...InfluxData
 
Swift: Apple's New Programming Language for iOS and OS X
Swift: Apple's New Programming Language for iOS and OS XSwift: Apple's New Programming Language for iOS and OS X
Swift: Apple's New Programming Language for iOS and OS XSasha Goldshtein
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentAnne Nicolas
 
5 must have patterns for your microservice - techorama
5 must have patterns for your microservice - techorama5 must have patterns for your microservice - techorama
5 must have patterns for your microservice - techoramaAli Kheyrollahi
 
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo Castro
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo CastroHome Automation with Asterisk - Astricon 2015 - Alberto Sagredo Castro
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo CastroAlberto Sagredo Castro
 
Cassandra Summit - What's New In Apache TinkerPop?
Cassandra Summit - What's New In Apache TinkerPop?Cassandra Summit - What's New In Apache TinkerPop?
Cassandra Summit - What's New In Apache TinkerPop?Stephen Mallette
 
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and SparkCrystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and SparkJivan Nepali
 
Steam Learn: Introduction to SWIFT
Steam Learn: Introduction to SWIFTSteam Learn: Introduction to SWIFT
Steam Learn: Introduction to SWIFTinovia
 
Adding 1.21 Gigawatts to Applications with RabbitMQ (DPC 2015)
Adding 1.21 Gigawatts to Applications with RabbitMQ (DPC 2015)Adding 1.21 Gigawatts to Applications with RabbitMQ (DPC 2015)
Adding 1.21 Gigawatts to Applications with RabbitMQ (DPC 2015)James Titcumb
 
What's new in Apache SystemML - Declarative Machine Learning
What's new in Apache SystemML  - Declarative Machine LearningWhat's new in Apache SystemML  - Declarative Machine Learning
What's new in Apache SystemML - Declarative Machine LearningLuciano Resende
 
G`JFW2IHZ1F{MDTISBW(}KC.jpg__MACOSX._G`JFW2IHZ1F{MDTISBW(}K.docx
G`JFW2IHZ1F{MDTISBW(}KC.jpg__MACOSX._G`JFW2IHZ1F{MDTISBW(}K.docxG`JFW2IHZ1F{MDTISBW(}KC.jpg__MACOSX._G`JFW2IHZ1F{MDTISBW(}K.docx
G`JFW2IHZ1F{MDTISBW(}KC.jpg__MACOSX._G`JFW2IHZ1F{MDTISBW(}K.docxbenjaminjames21681
 
WISS 2015 - Machine Learning lecture by Ludovic Samper
WISS 2015 - Machine Learning lecture by Ludovic Samper WISS 2015 - Machine Learning lecture by Ludovic Samper
WISS 2015 - Machine Learning lecture by Ludovic Samper Antidot
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6Wim Godden
 
Swift for tensorflow
Swift for tensorflowSwift for tensorflow
Swift for tensorflow규영 허
 
(Slightly) Smarter Smart Pointers
(Slightly) Smarter Smart Pointers(Slightly) Smarter Smart Pointers
(Slightly) Smarter Smart PointersCarlo Pescio
 
Eta lang Beauty And The Beast
Eta lang Beauty And The Beast Eta lang Beauty And The Beast
Eta lang Beauty And The Beast Jarek Ratajski
 
Accessible Web Components_Techshare India 2014
Accessible Web Components_Techshare India 2014Accessible Web Components_Techshare India 2014
Accessible Web Components_Techshare India 2014BarrierBreak
 
Toonz code leaves much to be desired
Toonz code leaves much to be desiredToonz code leaves much to be desired
Toonz code leaves much to be desiredPVS-Studio
 
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);Joel Porquet
 
Data visualization by Kenneth Odoh
Data visualization by Kenneth OdohData visualization by Kenneth Odoh
Data visualization by Kenneth Odohpyconfi
 

Similar to Perl 6 For Mere Mortals (20)

Developing Your Own Flux Packages by David McKay | Head of Developer Relation...
Developing Your Own Flux Packages by David McKay | Head of Developer Relation...Developing Your Own Flux Packages by David McKay | Head of Developer Relation...
Developing Your Own Flux Packages by David McKay | Head of Developer Relation...
 
Swift: Apple's New Programming Language for iOS and OS X
Swift: Apple's New Programming Language for iOS and OS XSwift: Apple's New Programming Language for iOS and OS X
Swift: Apple's New Programming Language for iOS and OS X
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
 
5 must have patterns for your microservice - techorama
5 must have patterns for your microservice - techorama5 must have patterns for your microservice - techorama
5 must have patterns for your microservice - techorama
 
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo Castro
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo CastroHome Automation with Asterisk - Astricon 2015 - Alberto Sagredo Castro
Home Automation with Asterisk - Astricon 2015 - Alberto Sagredo Castro
 
Cassandra Summit - What's New In Apache TinkerPop?
Cassandra Summit - What's New In Apache TinkerPop?Cassandra Summit - What's New In Apache TinkerPop?
Cassandra Summit - What's New In Apache TinkerPop?
 
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and SparkCrystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
 
Steam Learn: Introduction to SWIFT
Steam Learn: Introduction to SWIFTSteam Learn: Introduction to SWIFT
Steam Learn: Introduction to SWIFT
 
Adding 1.21 Gigawatts to Applications with RabbitMQ (DPC 2015)
Adding 1.21 Gigawatts to Applications with RabbitMQ (DPC 2015)Adding 1.21 Gigawatts to Applications with RabbitMQ (DPC 2015)
Adding 1.21 Gigawatts to Applications with RabbitMQ (DPC 2015)
 
What's new in Apache SystemML - Declarative Machine Learning
What's new in Apache SystemML  - Declarative Machine LearningWhat's new in Apache SystemML  - Declarative Machine Learning
What's new in Apache SystemML - Declarative Machine Learning
 
G`JFW2IHZ1F{MDTISBW(}KC.jpg__MACOSX._G`JFW2IHZ1F{MDTISBW(}K.docx
G`JFW2IHZ1F{MDTISBW(}KC.jpg__MACOSX._G`JFW2IHZ1F{MDTISBW(}K.docxG`JFW2IHZ1F{MDTISBW(}KC.jpg__MACOSX._G`JFW2IHZ1F{MDTISBW(}K.docx
G`JFW2IHZ1F{MDTISBW(}KC.jpg__MACOSX._G`JFW2IHZ1F{MDTISBW(}K.docx
 
WISS 2015 - Machine Learning lecture by Ludovic Samper
WISS 2015 - Machine Learning lecture by Ludovic Samper WISS 2015 - Machine Learning lecture by Ludovic Samper
WISS 2015 - Machine Learning lecture by Ludovic Samper
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
 
Swift for tensorflow
Swift for tensorflowSwift for tensorflow
Swift for tensorflow
 
(Slightly) Smarter Smart Pointers
(Slightly) Smarter Smart Pointers(Slightly) Smarter Smart Pointers
(Slightly) Smarter Smart Pointers
 
Eta lang Beauty And The Beast
Eta lang Beauty And The Beast Eta lang Beauty And The Beast
Eta lang Beauty And The Beast
 
Accessible Web Components_Techshare India 2014
Accessible Web Components_Techshare India 2014Accessible Web Components_Techshare India 2014
Accessible Web Components_Techshare India 2014
 
Toonz code leaves much to be desired
Toonz code leaves much to be desiredToonz code leaves much to be desired
Toonz code leaves much to be desired
 
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);
 
Data visualization by Kenneth Odoh
Data visualization by Kenneth OdohData visualization by Kenneth Odoh
Data visualization by Kenneth Odoh
 

More from Curtis Poe

life-off-earth.pptx
life-off-earth.pptxlife-off-earth.pptx
life-off-earth.pptxCurtis Poe
 
Corinna-2023.pptx
Corinna-2023.pptxCorinna-2023.pptx
Corinna-2023.pptxCurtis Poe
 
Corinna Status 2022.pptx
Corinna Status 2022.pptxCorinna Status 2022.pptx
Corinna Status 2022.pptxCurtis Poe
 
Rummaging in the clOOset
Rummaging in the clOOsetRummaging in the clOOset
Rummaging in the clOOsetCurtis Poe
 
Rescuing a-legacy-codebase
Rescuing a-legacy-codebaseRescuing a-legacy-codebase
Rescuing a-legacy-codebaseCurtis Poe
 
Disappearing Managers, YAPC::EU 2014, Bulgaria, Keynote
Disappearing Managers, YAPC::EU 2014, Bulgaria, KeynoteDisappearing Managers, YAPC::EU 2014, Bulgaria, Keynote
Disappearing Managers, YAPC::EU 2014, Bulgaria, KeynoteCurtis Poe
 
How to Fake a Database Design
How to Fake a Database DesignHow to Fake a Database Design
How to Fake a Database DesignCurtis Poe
 
Are Managers An Endangered Species?
Are Managers An Endangered Species?Are Managers An Endangered Species?
Are Managers An Endangered Species?Curtis Poe
 
The Lies We Tell About Software Testing
The Lies We Tell About Software TestingThe Lies We Tell About Software Testing
The Lies We Tell About Software TestingCurtis Poe
 
A/B Testing - What your mother didn't tell you
A/B Testing - What your mother didn't tell youA/B Testing - What your mother didn't tell you
A/B Testing - What your mother didn't tell youCurtis Poe
 
Test::Class::Moose
Test::Class::MooseTest::Class::Moose
Test::Class::MooseCurtis Poe
 
A Whirlwind Tour of Test::Class
A Whirlwind Tour of Test::ClassA Whirlwind Tour of Test::Class
A Whirlwind Tour of Test::ClassCurtis Poe
 
Agile Companies Go P.O.P.
Agile Companies Go P.O.P.Agile Companies Go P.O.P.
Agile Companies Go P.O.P.Curtis Poe
 
Testing With Test::Class
Testing With Test::ClassTesting With Test::Class
Testing With Test::ClassCurtis Poe
 
Logic Progamming in Perl
Logic Progamming in PerlLogic Progamming in Perl
Logic Progamming in PerlCurtis Poe
 
Inheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth VersionInheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth VersionCurtis Poe
 
Inheritance Versus Roles
Inheritance Versus RolesInheritance Versus Roles
Inheritance Versus RolesCurtis Poe
 
Turbo Charged Test Suites
Turbo Charged Test SuitesTurbo Charged Test Suites
Turbo Charged Test SuitesCurtis Poe
 

More from Curtis Poe (19)

life-off-earth.pptx
life-off-earth.pptxlife-off-earth.pptx
life-off-earth.pptx
 
Corinna-2023.pptx
Corinna-2023.pptxCorinna-2023.pptx
Corinna-2023.pptx
 
Corinna Status 2022.pptx
Corinna Status 2022.pptxCorinna Status 2022.pptx
Corinna Status 2022.pptx
 
Rummaging in the clOOset
Rummaging in the clOOsetRummaging in the clOOset
Rummaging in the clOOset
 
Rescuing a-legacy-codebase
Rescuing a-legacy-codebaseRescuing a-legacy-codebase
Rescuing a-legacy-codebase
 
Disappearing Managers, YAPC::EU 2014, Bulgaria, Keynote
Disappearing Managers, YAPC::EU 2014, Bulgaria, KeynoteDisappearing Managers, YAPC::EU 2014, Bulgaria, Keynote
Disappearing Managers, YAPC::EU 2014, Bulgaria, Keynote
 
How to Fake a Database Design
How to Fake a Database DesignHow to Fake a Database Design
How to Fake a Database Design
 
Are Managers An Endangered Species?
Are Managers An Endangered Species?Are Managers An Endangered Species?
Are Managers An Endangered Species?
 
The Lies We Tell About Software Testing
The Lies We Tell About Software TestingThe Lies We Tell About Software Testing
The Lies We Tell About Software Testing
 
A/B Testing - What your mother didn't tell you
A/B Testing - What your mother didn't tell youA/B Testing - What your mother didn't tell you
A/B Testing - What your mother didn't tell you
 
Test::Class::Moose
Test::Class::MooseTest::Class::Moose
Test::Class::Moose
 
A Whirlwind Tour of Test::Class
A Whirlwind Tour of Test::ClassA Whirlwind Tour of Test::Class
A Whirlwind Tour of Test::Class
 
Agile Companies Go P.O.P.
Agile Companies Go P.O.P.Agile Companies Go P.O.P.
Agile Companies Go P.O.P.
 
Econ101
Econ101Econ101
Econ101
 
Testing With Test::Class
Testing With Test::ClassTesting With Test::Class
Testing With Test::Class
 
Logic Progamming in Perl
Logic Progamming in PerlLogic Progamming in Perl
Logic Progamming in Perl
 
Inheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth VersionInheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth Version
 
Inheritance Versus Roles
Inheritance Versus RolesInheritance Versus Roles
Inheritance Versus Roles
 
Turbo Charged Test Suites
Turbo Charged Test SuitesTurbo Charged Test Suites
Turbo Charged Test Suites
 

Recently uploaded

Microsoft Windows Server 2019 - Hands-on Training
Microsoft Windows Server 2019 - Hands-on TrainingMicrosoft Windows Server 2019 - Hands-on Training
Microsoft Windows Server 2019 - Hands-on TrainingVICTOR MAESTRE RAMIREZ
 
Understanding memory in computing part 2.pptx
Understanding memory in computing part 2.pptxUnderstanding memory in computing part 2.pptx
Understanding memory in computing part 2.pptxPravash Chandra Das
 
Alluxio Monthly Webinar | Five Disruptive Trends that Every Data & AI Leader...
Alluxio Monthly Webinar | Five Disruptive Trends that Every  Data & AI Leader...Alluxio Monthly Webinar | Five Disruptive Trends that Every  Data & AI Leader...
Alluxio Monthly Webinar | Five Disruptive Trends that Every Data & AI Leader...Alluxio, Inc.
 
Data Infra Meetup | Uber's Data Storage Evolution
Data Infra Meetup | Uber's Data Storage EvolutionData Infra Meetup | Uber's Data Storage Evolution
Data Infra Meetup | Uber's Data Storage EvolutionAlluxio, Inc.
 
Data Infra Meetup | ByteDance's Native Parquet Reader
Data Infra Meetup | ByteDance's Native Parquet ReaderData Infra Meetup | ByteDance's Native Parquet Reader
Data Infra Meetup | ByteDance's Native Parquet ReaderAlluxio, Inc.
 
Crafting Digital Delights The Evolution of Game App Development Companies.pdf
Crafting Digital Delights The Evolution of Game App Development Companies.pdfCrafting Digital Delights The Evolution of Game App Development Companies.pdf
Crafting Digital Delights The Evolution of Game App Development Companies.pdfFlexsin
 
Student_results_management_system proposel.pdf
Student_results_management_system proposel.pdfStudent_results_management_system proposel.pdf
Student_results_management_system proposel.pdfKhondokerAbuNaim
 
Data Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the Cloud
Data Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the CloudData Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the Cloud
Data Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the CloudAlluxio, Inc.
 
Agile Software Testing the Agilogy Way
Agile Software Testing the Agilogy WayAgile Software Testing the Agilogy Way
Agile Software Testing the Agilogy WayJordi Pradel
 
Generative AI Application Development using LangChain and LangFlow
Generative AI Application Development using LangChain and LangFlowGenerative AI Application Development using LangChain and LangFlow
Generative AI Application Development using LangChain and LangFlowGene Leybzon
 
gitBranchStarategy.pdf
gitBranchStarategy.pdfgitBranchStarategy.pdf
gitBranchStarategy.pdfssuser25afc7
 
Application Scenarios of "doSmartQA -Smart Probing Assistant"
Application Scenarios of "doSmartQA -Smart Probing Assistant"Application Scenarios of "doSmartQA -Smart Probing Assistant"
Application Scenarios of "doSmartQA -Smart Probing Assistant"STAG Software Private Limited
 
Endtest Tutorials - Web Tests - 2 slides
Endtest Tutorials - Web Tests - 2 slidesEndtest Tutorials - Web Tests - 2 slides
Endtest Tutorials - Web Tests - 2 slidesLiviuLupei1
 
OpenChain Legal Work Group - 2024-01-17
OpenChain Legal Work Group -  2024-01-17OpenChain Legal Work Group -  2024-01-17
OpenChain Legal Work Group - 2024-01-17Shane Coughlan
 
Introduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUXIntroduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUXDeeksha Verma
 
Data Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio Edge
Data Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio EdgeData Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio Edge
Data Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio EdgeAlluxio, Inc.
 
OpenChain Webinar #58 - FOSS License Management through aliens4friends in Ecl...
OpenChain Webinar #58 - FOSS License Management through aliens4friends in Ecl...OpenChain Webinar #58 - FOSS License Management through aliens4friends in Ecl...
OpenChain Webinar #58 - FOSS License Management through aliens4friends in Ecl...Shane Coughlan
 
Quarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdfQuarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdfIvelin Yanev
 

Recently uploaded (18)

Microsoft Windows Server 2019 - Hands-on Training
Microsoft Windows Server 2019 - Hands-on TrainingMicrosoft Windows Server 2019 - Hands-on Training
Microsoft Windows Server 2019 - Hands-on Training
 
Understanding memory in computing part 2.pptx
Understanding memory in computing part 2.pptxUnderstanding memory in computing part 2.pptx
Understanding memory in computing part 2.pptx
 
Alluxio Monthly Webinar | Five Disruptive Trends that Every Data & AI Leader...
Alluxio Monthly Webinar | Five Disruptive Trends that Every  Data & AI Leader...Alluxio Monthly Webinar | Five Disruptive Trends that Every  Data & AI Leader...
Alluxio Monthly Webinar | Five Disruptive Trends that Every Data & AI Leader...
 
Data Infra Meetup | Uber's Data Storage Evolution
Data Infra Meetup | Uber's Data Storage EvolutionData Infra Meetup | Uber's Data Storage Evolution
Data Infra Meetup | Uber's Data Storage Evolution
 
Data Infra Meetup | ByteDance's Native Parquet Reader
Data Infra Meetup | ByteDance's Native Parquet ReaderData Infra Meetup | ByteDance's Native Parquet Reader
Data Infra Meetup | ByteDance's Native Parquet Reader
 
Crafting Digital Delights The Evolution of Game App Development Companies.pdf
Crafting Digital Delights The Evolution of Game App Development Companies.pdfCrafting Digital Delights The Evolution of Game App Development Companies.pdf
Crafting Digital Delights The Evolution of Game App Development Companies.pdf
 
Student_results_management_system proposel.pdf
Student_results_management_system proposel.pdfStudent_results_management_system proposel.pdf
Student_results_management_system proposel.pdf
 
Data Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the Cloud
Data Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the CloudData Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the Cloud
Data Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the Cloud
 
Agile Software Testing the Agilogy Way
Agile Software Testing the Agilogy WayAgile Software Testing the Agilogy Way
Agile Software Testing the Agilogy Way
 
Generative AI Application Development using LangChain and LangFlow
Generative AI Application Development using LangChain and LangFlowGenerative AI Application Development using LangChain and LangFlow
Generative AI Application Development using LangChain and LangFlow
 
gitBranchStarategy.pdf
gitBranchStarategy.pdfgitBranchStarategy.pdf
gitBranchStarategy.pdf
 
Application Scenarios of "doSmartQA -Smart Probing Assistant"
Application Scenarios of "doSmartQA -Smart Probing Assistant"Application Scenarios of "doSmartQA -Smart Probing Assistant"
Application Scenarios of "doSmartQA -Smart Probing Assistant"
 
Endtest Tutorials - Web Tests - 2 slides
Endtest Tutorials - Web Tests - 2 slidesEndtest Tutorials - Web Tests - 2 slides
Endtest Tutorials - Web Tests - 2 slides
 
OpenChain Legal Work Group - 2024-01-17
OpenChain Legal Work Group -  2024-01-17OpenChain Legal Work Group -  2024-01-17
OpenChain Legal Work Group - 2024-01-17
 
Introduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUXIntroduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUX
 
Data Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio Edge
Data Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio EdgeData Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio Edge
Data Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio Edge
 
OpenChain Webinar #58 - FOSS License Management through aliens4friends in Ecl...
OpenChain Webinar #58 - FOSS License Management through aliens4friends in Ecl...OpenChain Webinar #58 - FOSS License Management through aliens4friends in Ecl...
OpenChain Webinar #58 - FOSS License Management through aliens4friends in Ecl...
 
Quarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdfQuarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdf
 

Perl 6 For Mere Mortals

  • 2. Perl  6   A  Dynamic  Language  for   Mere  Mortals   CurFs  "Ovid"  Poe   h0p://allaroundtheworld.fr/   (With  the  unwiLng  assistance  of  Manuel  Cerón  h0p://ceronman.com/)   Copyright  2015,  h0p://www.allaroundtheworld.fr/  January  26,  2015  
  • 3. January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   Image  Courtesy  Luc  Viator   h0p://www.lucnix.be/  
  • 4. Basic  Math   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 5. Basic  Math   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   Find  the  volume  of  the  region  bounded  above  by  the  sphere  x^2+y^2+z^2  =  a^2  and   below  by  the  cone  z^2  sin^2(a)  =  (x^2+y^2)cos^2(a)  where  a  is  in  the  interval  [0,π]   h0p://commons.wikimedia.org/wiki/Category:Integral_calculus#mediaviewer/File:Triple_Integral_Example_2.svg  
  • 6. Solve  for  "x"   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   x  =  7  ÷  2  
  • 7. Ruby   $ ruby -e 'puts 7/2' 3 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 8. Python  (2)   $ ruby -e 'puts 7/2' 3 $ python -c 'print 7/2' 3 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 9. TCL   $ ruby -e 'puts 7/2' 3 $ python -c 'print 7/2' 3 $ echo "puts [expr 7/2]" | tclsh 3 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 10. bc   $ ruby -e 'puts 7/2' 3 $ python -c 'print 7/2' 3 $ echo "puts [expr 7/2]" | tclsh 3 $ echo "7/2" | bc 3 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 11. C $ echo 'int printf(const char * restrict format, ... ); int main(void) { printf("n%fn", 7/2); return 0; }' > | gcc -xc - && ./a.out <stdin>:1:82: warning: format specifies type 'double' but the argument has type 'int' [-Wformat] 1 warning generated. 0.000000 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 12. C $ echo 'int printf(const char * restrict format, ... ); int main(void) { printf("n%dn", 7/2); return 0; }' > | gcc -xc - && ./a.out 3 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 13. The  purpose  of  soeware  is  to   help  humans,  not  computers.   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 14. Perl  5   $ perl -E 'say 7/2' 3.5 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 15. Solve  for  "x"   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   x  =  -­‐7  ÷  2  
  • 16. C $ echo 'int printf(const char * restrict format, ... ); int main(void) { printf("n%dn", -7/2); return 0; }' > | gcc -xc - && ./a.out -3 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 17. -­‐7/2   $ ruby -e 'puts -7/2' ? $ python -c 'print -7/2' ? $ echo "puts [expr -7/2]" | tclsh ? $ echo "-7/2" | bc ? $ perl -E 'say -7/2' -3.5 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 18. bc   $ ruby -e 'puts -7/2' -4 $ python -c 'print -7/2' -4 $ echo "puts [expr -7/2]" | tclsh -4 $ echo "-7/2" | bc -3 $ perl -E 'say -7/2' -3.5 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 19. C89  —  ANSI-­‐C  (3.3.5)   When  integers  are  divided  and  the  division  is  inexact  …     if  either  operand  is  nega4ve  …   the  result  …   is  implementa4on-­‐defined.  …   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 20. Solve  for  "x"   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   x  =  .1  +  .2  -­‐  .3  
  • 21. Solve  for  "x"   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   x  =  .1  +  .2  -­‐  .3  
  • 22. Solve  for  "x"   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   x  =  .3  -­‐  .3  
  • 23. Solve  for  "x"   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   x  =  0  
  • 24. Solve  for  "x"   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   0  =  .1  +  .2  -­‐  .3  
  • 25. Perl's  Idea  of  Zero   $ perl -E 'say .1 + .2 - .3' 5.55111512312578e-17 # 0.0000000000000000555111512312578 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 26. One  Divided  by  Zero   $ perl -E 'say 1/(.1 + .2 - .3)' 1.8014398509482e+16 # 18,014,398,509,482,000 # or roughly 18 quadrillian January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 27. Mass  of  the  Sun  MulFplied  by  Zero   $ perl –E 'say 1.99E30 * (.1+.2-.3)' 110467190950203 # 110,467,190,950,203 # Roughly 110 trillion kilograms January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 28. January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 29. Other  Languages   $ ruby -e 'puts 0.1 + 0.2 - 0.3' 5.551115123125783e-17 $ python -c 'print .1 + .2 - .3' 5.55111512313e-17 $ echo "puts [expr .1+.2-.3]"|tclsh 5.551115123125783e-17 $ echo ".1 + .2 - .3" | bc 0 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 30. Perl  6's  Idea  of  Zero   $ perl6 -e 'say .1 + .2 - .3' 0 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 31. Perl  6's  Idea  of  Zero   $ perl6 -e 'say 1/(.1 + .2 - .3)' # Divide by zero in method Numeric at … January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 32. say  WHAT?   $ perl6 > say .3.WHAT (Rat) > say .3.numerator 3 > say .3.denominator 10 > say .3.nude.perl (3, 10) > say 3.1415927.nude.perl (31415927, 10000000) January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 33. But  you  can  forget  about  that   $ perl6 > say .1 + .2 - .3 0 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 34. FuncFons   sub reciprocal { return 1 / shift; } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 35. TIMTOWTEmbarrassYourself   sub reciprocal { return 1 / shift; } sub reciprocal { 1/$_[0]; } sub reciprocal { my $num = shift; return 1/$num; } sub reciprocal { my ($num) = @_; return 1/$num; } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 36. Screw  This   sub reciprocal { return 1 / shift; } sub reciprocal { 1/$_[0]; } sub reciprocal { my $num = shift; return 1/$num; } sub reciprocal { my ($num) = @_; return 1/$num; } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 37. Fibonacci   1.  Start  with  the  list  0,1 2.  Add  last  two  elements   3.  Append  result  to  end  of  list   4.  Go  to  step  2   F0  =  0   F1  =  1   Fn  =  Fn-­‐1  +  Fn-­‐2   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   I'd  credit  the  original  source  if  I  could  find  it.  
  • 38. Fibonacci  –  Hate  Me  If  You  Must   0,  1   0,  1  →  1   0,  1,  1  →  2   0,  1,  1,  2  →  3   0,  1,  1,  2,  3  →  5   0,  1,  1,  2,  3,  5  →  8   0,  1,  1,  2,  3,  5,  8  →  13   …   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 39. Basic  FuncFon  Signatures   sub fib($nth) { given $nth { when 0 { 0 } when 1 { 1 } default {fib($nth-1)+fib($nth-2)} } } say fib(8); # 21 January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 40. Infinite  Loop   sub fib($nth) { given $nth { when 0 { 0 } when 1 { 1 } default {fib($nth-1)+fib($nth-2)} } } say fib(3.7); # … January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 41. Perl  5   sub fib { die unless $_[0] =~ /^d+$/; … sub fib { die unless $_[0] == int($_[0]); … use Regexp::Common; sub fib { die unless $_[0] =~ $RE{num}{int}; … January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 42. Perl  6  –  OpFonal  Type  Checking   sub fib(Int $nth) { given $nth { when 0 { 0 } when 1 { 1 } default {fib($nth-1)+fib($nth-2)} } } say fib(3.7); # Type check failed in binding $nth; expected 'Int' but … January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 43. Infinite  Loop   sub fib(Int $nth) { given $nth { when 0 { 0 } when 1 { 1 } default {fib($nth-1)+fib($nth-2)} } } say fib(-3); # … January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 44. Perl  6  —  Constraints   sub fib(Int $nth where * >= 0) { given $nth { when 0 { 0 } when 1 { 1 } default {fib($nth-1)+fib($nth-2)} } } say fib(-3); # Constraint type check failed for parameter '$nth' … January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 45. Perl  6  —  Subsets   subset NonNegativeInt of Int where * >= 0; sub fib(NonNegativeInt $nth) { given $nth { when 0 { 0 } when 1 { 1 } default {fib($nth-1)+fib($nth-2)} } } say fib(-3); # Constraint type check failed for parameter '$nth' … January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 46. FuncFon  Signatures   1. sub optional {…} 2. sub basic($foo) {…} 3. sub default($foo = 3) {…} 4. sub named(:$name) {…} 5. sub typed(Bool $is_foo) {…} 6. sub constraint(Str $name where *.chars > 0) {…} January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 47. FuncFon  Signatures   subset NonEmptyString of Str where *.chars > 0; sub foo(NonEmptyString $name){…} January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 48. FuncFon  Signatures   subset FirstName of Str where 0 < *.chars < 256; sub FirstName(Firstname $name){…} January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 49. Speed  It  Up   sub fib(NonNegativeInt $nth) { state %fib_for; unless %fib_for{$nth}:exists { given $nth { when 0 { 0 } when 1 { 1 } default { %fib_for{$nth} = fib($nth-1) + fib($nth-2) } } } return %fib_for{$nth}; } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 50. Speed  It  Up   sub fib(NonNegativeInt $nth) { my ( $prev, $next ) = 0, 1; my $result; for 0 .. $nth { $result = $prev + $next; $prev = $next; $next = $result; } return $result; } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 51. Fibonacci  Sequence   F0  =  0   F1  =  1   Fn  =  Fn-­‐1  +  Fn-­‐2   when 0 { 0 } when 1 { 1 } default {fib($nth-1)+fib($nth-2)} January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 52. Speed  It  Up   sub fib(NonNegativeInt $nth) is cached { given $nth { when 0 { 0 } when 1 { 1 } default {fib($nth-1)+fib($nth-2)} } } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 53. MulF  Subs   sub travel_to { my ( $self, $location ) = @_; # my kingdom for MMD :( if ( $location->isa('StationArea') ) { $self->_travel_to_area($location); } elsif ( $location->isa('Station') ) { $self->_travel_to_station($location); } elsif ( $location->isa('Star') ) { $self->_travel_to_star($location); } else { croak("I don't know how to travel to $location"); } } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 54. An  ugly  alternaFve   sub travel_to { my ( $self, $location ) = @_; if ( $location->does('Location') ) { # OVS instead of SVO $location->travel_to($character); } else { croak("I don't know how to travel to $location"); } } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 55. If  I  Used  Perl  6   multi method travel_to(StationArea $station_area) { ... } multi method travel_to(Station $station) { ... } multi method travel_to(Star $star) { ... } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 56. And  the  Fibonacci  Numbers  Again   F0  =  0   F1  =  1   Fn  =  Fn-­‐1  +  Fn-­‐2   multi fib(0) {0} multi fib(1) {1} multi fib($n where * > 1) { fib($n-1) + fib($n-2) } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 57. AsserFng  Return  Types   sub foo() returns Bool { return some-other-func(); # what does this return? } say "Yes" if foo(); # Yes January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 58. AsserFng  Return  Types   sub foo() returns Bool { return "Foo"; } say "Yes" if foo(); # Type check failed for return value; # expected 'Bool' but got 'Str' January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 59. AsserFng  Return  Types   sub foo() returns NonNegativeInteger { return some-other-func(); } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 60. Classes   class Point { has $.x = 0; has $.y = 0; method Str { "[$.x,$.y]" } } my $point = Point.new( x => 5, y => 3 ); say $point.x; # 5 say $point.y; # 3 say "$point"; # [5,3] January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 61. Classes   class Point { has $.x = 0; has $.y = 0; method Str { "[$.x,$.y]" } method set( :$x = $.x, :$y = $.y ) { $!x = $x; $!y = $y; } } my $point = Point.new( x => 5, y => 3 ); say "$point"; # [5,3] $point.set( y => 17 ); say "$point"; # [5,17] January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 62. And  as  you  learn  more  …   class Point { has Real $.x = 0; has Real $.y = 0; method Str { "[$.x,$.y]" } method set( :$x = $.x, :$y = $.y ) { $!x = $x; $!y = $y; } } my $point = Point.new( x => 5, y => 3 ); say "$point"; # [5,3] $point.set( y => "foo" ); # Boom! January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 63. And  as  you  learn  more  …   class Point { has Real $.x is rw = 0; has Real $.y is rw = 0; method Str { "[$.x,$.y]" } } my $point = Point.new( x => 5, y => 3.0 ); say "$point"; # [5,3] $point.y = 17.3; say "$point"; # [5,17.3] January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 64. And  as  you  learn  more  …   class Point { subset PointLimit of Real where -10 <= * <= 10; has PointLimit $.x is rw = 0; has PointLimit $.y is rw = 0; method Str { "[$.x,$.y]" } } my $point = Point.new( x => 5, y => 3.0 ); say "$point"; # [5,3] $point.y = 17.3; # Boom! January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 65. The  default  values  are  silly  …   class Point { subset PointLimit of Real where -10 <= * <= 10; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; method Str { "[$.x,$.y]" } } my $point = Point.new( y => 3 ); # Boom! January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 66. Or  …   class Point { subset PointLimit of Real where -10 .. 10; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; method Str { "[$.x,$.y]" } } my $point = Point.new( x => 5, y => 3.0 ); say "$point"; # [5,3] $point.y = 17.3; # Boom! January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 67. Guess  what  …   class Point { subset PointLimit where -10.0 .. 10.0; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; method Str { "[$.x,$.y]" } } my $point = Point.new( x => 5, y => 3.0 ); say "$point"; # [5,3] $point.y = 17.3; # Boom! January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 68. Simpler   class Point { subset PointLimit where -10.0 .. 10.0; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; } my $point = Point.new( x => 5, y => 3.0 ); $point.y = 7.2; say $point.perl; # Point.new(x => 5, y => 7.2) January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 69. Perl  6  Versus  Core  Perl  5   class Point { subset PointLimit where -10.0 .. 10.0; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; } package Point { use Carp; use overload '""' => &Str, fallback => 1; sub _pointlimit { my ( $class, $num ) = @_; unless ( $num >= -10 && $num <= 10 ) { croak "…"; } } sub new { my ( $class, $x, $y ) = @_; my $self = bless { x => undef, y => undef } => $class; $self->x($x); $self->y($y); return $self; } sub x { my ( $self, $x ) = @_; $self->_pointlimit ($x); $self->{x} = $x; } sub y { my ( $self, $y ) = @_; $self->_pointlimit ($y); $self->{y} = $y; } sub Str { my $self = shift; return sprintf "[%f,%f]" => $self->x, $self->y; } } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 70. Perl  6  Versus  Moose   class Point { subset PointLimit where -10.0 .. 10.0; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; } package Point { use Moose; use overload '""' => &Str, fallback => 1; use Moose::Util::TypeConstraints; subtype "PointLimit" => as 'Num' => where { $_ >= -10 && $_ <= 10 } => message { "$_ must be a Num between -10 and 10, inclusive" }; has [qw/x y/] => ( is => 'rw', isa => 'PointLimit', required => 1, ); sub Str { my $self = shift; return sprintf "[%f,%f]" => $self->x, $self->y; } } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 71. Perl  6  Versus  C++   class Point { subset PointLimit where -10.0 .. 10.0; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; } #include <iostream> #include <sstream> class Point { double x_, y_; public: Point (double x, double y) : x_(constrain(x)), y_(constrain(y)) {} double x () const { return x_; } double y () const { return y_; } void x (double num) { x_ = constrain(num); } void y (double num) { y_ = constrain(num); } friend std::ostream & operator<< (std::ostream & stream, const Point & point) { stream << '[' << point.x() << ',' << point.y() << ']'; return stream; } private: static double constrain (double num) { if (num < -10 || num > 10) { std::stringstream ss; ss << "'" << num << "' is not a real number between -10 and 10, inclusive"; throw(ss.str()); } return num; } }; int main () { try { Point point(5, 3); std::cout << point << std::endl; point.y(17.3); } catch (const std::string & error) { std::cerr << error << std::endl; } } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 72. Perl  6  Versus  Java   class Point { subset PointLimit where -10.0 .. 10.0; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; } public class Point { private static final double X_MIN = -10.0, X_MAX = 10.0; private static final double Y_MIN = -10.0, Y_MAX = 10.0; private double x, y; public Point(double x, double y) throws IllegalArgumentException { setX(x); setY(y); } public double getX() { return x; } public double getY() { return y; } public void setX(double x) throws IllegalArgumentException { if (x < X_MIN || x > X_MAX) throw new IllegalArgumentException("…"); this.x = x; } public void setY(double y) throws IllegalArgumentException { if (y < Y_MIN || y > Y_MIN) throw new IllegalArgumentException("…"); this.y = y; } @Override public String toString() { return String.format("[%.1f,%.1f]", x, y); } } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 73. Perl  6  Versus  Python  3   class Point { subset PointLimit where -10.0 .. 10.0; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; } class PointLimit: def __init__(self, name): self.name = name def __get__(self, point, owner): return point.__dict__.get(self.name) def __set__(self, point, value): if not -10 < value < 10: raise ValueError('Value %d is out of range' % value) point.__dict__[self.name] = value class Point: x = PointLimit('x'); y = PointLimit('y'); def __init__(self, x, y): self.x = x self.y = y def __str__(self): return "[%f,%f]" % (self.x, self.y) January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 74. Perl  6  Versus  Javascript   class Point { subset PointLimit where -10.0 .. 10.0; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; } function definePointLimit(point, name) { Object.defineProperty(point, name, { set: function (value) { if (value < -10 || value > 10) throw 'Value ' + value + ' is out of range'; point['_' + name] = value; }, get: function () { return point['_' + name]; } }); } function Point(x, y) { definePointLimit(this, 'x'); definePointLimit(this, 'y'); this.x = x; this.y = y; } Point.prototype.toString = function() { return '[' + this.x + ',' + this.y + ']'; } var point = new Point(5, 5); point.y = 100; // Boom! January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 75. Perl  6  Versus  Ruby   class Point { subset PointLimit where -10.0 .. 10.0; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; } class Point POINT_RANGE = -10..10 attr_constrained x: POINT_RANGE, y: POINT_RANGE def initialize @x = 0 @y = 0 end def to_s "[#{x},#{y}]" end private def self.attr_constrained(attrs_and_constraints) attrs_and_constraints.each do |attr, constraint| attr_reader attr define_method(:"#{attr}=") do |value| raise "#{value} is not a valid value for #{attr}" unless constraint === value instance_variable_set :"@#{attr}", value end end end end January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 76. Perl  6  Versus  Go   class Point { subset PointLimit where -10.0 .. 10.0; has PointLimit $.x is rw = die '$.x is required'; has PointLimit $.y is rw = die '$.y is required'; } package point import "fmt" import "errors" type Point struct { x, y float64 } func NewPoint(x, y float64) (*Point, error) { p := &Point{x, y} if !IsValid(x) { return nil, errors.New("Point x out of range!") } if !IsValid(y) { return nil, errors.New("Point y out of range!") } return p, nil } func IsValid(p float64) (result bool) { if p >= -10 && p <= 10 { result = true } return } func (p *Point) String() string { return fmt.Sprintf("[%v,%v]", p.x, p.y) } func (p *Point) SetX(x float64) (float64, error) { ox := p.x if !IsValid(x) { return ox, errors.New("Point out of range!") } return ox, nil } func (p *Point) SetY(y float64) (float64, error) { oy := p.y if !IsValid(y) { return oy, errors.New("Point out of range!") } return oy, nil } func (p *Point) GetX() float64 { return p.x } func (p *Point) GetY() float64 { return p.y } January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 77. For  day-­‐to-­‐day  code,    Perl  6  is  more  correct  than  Perl  5   Perl  6  is  safer  than  Perl  5   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 78. Review   •  Math  that  works   •  FuncFon  signatures   •  Subsets   •  Proper  classes   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 79. Summary   •  Perl  6  is  large   •  So  is  Perl  5   •  Common  features  "baked"  into  Perl  6   •  Proper  OO   •  Easy  to  read   •  Safer   •  Very  powerful   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 80. Resources   •  h0p://www.perl6.org/   •  h0p://doc.perl6.org/   •  h0p://design.perl6.org/   •  h0p://learnxinyminutes.com/docs/perl6/   •  irc.freenode.net  #perl6   January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 81. January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   Thank  You!  
  • 82. January  26,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   Bonus  Slides?  
  • 83. Infinite  Lazy  Lists   constant @primes = grep { .is-prime }, 1 .. *; say @primes[^10]; # 2 3 5 7 11 13 17 19 23 29   January  25,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 84. Infinite  Lazy  Lists   constant primes = grep { .is-prime }, 1 .. *; say primes[^10]; # 2 3 5 7 11 13 17 19 23 29   January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 85. But  it  worked  when  I  tested  it!   open my $fh, '<', $file or die "Can't read $file: $!"; foreach (<$fh>) { print if /abcd/; } January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 86. This  is  lazy   my $fh = open($file); for $fh.lines -> $line { say $line if $line ~~ /abcd/; } January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 87. So  is  this   my $fh = open($file); for $fh.lines.grep({/abcd/}) ->$line { say $line; } January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 88. Lazy  Fibonacci  Numbers   my @fib = 0, 1, * + * ... *; say @fib[^$num]; January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 89. Lazy  Fibonacci  Numbers   my @fib = 0, 1, * + * ... *; say @fib[^$num]; January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 90. ArithmeFc  Sequences   my @sequence = 0, 2 ... *; say @sequence[^10]; # 0 2 4 6 8 10 12 14 16 18 January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 91. Geometric  Sequences   my @sequence = 2, 4, 8 ... *; say @sequence[^10]; # 2 4 8 16 32 64 128 256 512 1024 January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 92. Complex  Sequences   my @f = 0, 1, -> $a,$b {$a+$b} ... *; say @f[^10]; # 0 1 1 2 3 5 8 13 21 34 January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 93. Complex  Sequences   my @f = 0, 1, * + * ... *; say @f[^10]; # 0 1 1 2 3 5 8 13 21 34 January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/  
  • 94. January  21,  2015   Copyright  2015,  h0p://www.allaroundtheworld.fr/   Thank  You!  (for  real,  this  Fme)