SlideShare a Scribd company logo
Submit Search
Upload
Login
Signup
Functional perl
Report
Errorific
Follow
Jan. 1, 2013
•
0 likes
•
1,210 views
1
of
59
Functional perl
Jan. 1, 2013
•
0 likes
•
1,210 views
Download Now
Download to read offline
Report
Technology
Unpolished talk on functional concepts in perl.
Errorific
Follow
Recommended
PHP 101
Muhammad Hijazi
156 views
•
26 slides
Selected Bash shell tricks from Camp CDL breakout group
John Kunze
1.3K views
•
15 slides
Codigos
Brian Joseff
254 views
•
4 slides
Class 7a: Functions
Marc Gouw
108 views
•
15 slides
PHP performance 101: so you need to use a database
Leon Fayer
1.7K views
•
41 slides
Python programming : Standard Input and Output
Emertxe Information Technologies Pvt Ltd
5.2K views
•
16 slides
More Related Content
What's hot
Python легко и просто. Красиво решаем повседневные задачи
Maxim Kulsha
1.3K views
•
48 slides
Closure, Higher-order function in Swift
SeongGyu Jo
20.5K views
•
27 slides
Share test
Anton Stuk
131 views
•
3 slides
Functional programming in Python
Colin Su
7.1K views
•
40 slides
Closures
SV.CO
124 views
•
23 slides
Ramda, a functional JavaScript library
Derek Willian Stavis
744 views
•
44 slides
What's hot
(20)
Python легко и просто. Красиво решаем повседневные задачи
Maxim Kulsha
•
1.3K views
Closure, Higher-order function in Swift
SeongGyu Jo
•
20.5K views
Share test
Anton Stuk
•
131 views
Functional programming in Python
Colin Su
•
7.1K views
Closures
SV.CO
•
124 views
Ramda, a functional JavaScript library
Derek Willian Stavis
•
744 views
Beginning Haskell, Dive In, Its Not That Scary!
priort
•
838 views
Linguagem sql
Tic Eslc
•
824 views
Perl6 one-liners
Andrew Shitov
•
7.9K views
Ramda lets write declarative js
Pivorak MeetUp
•
591 views
The secrets of inverse brogramming
Richie Cotton
•
1.1K views
Linux class 15 26 oct 2021
Khawar Nehal khawar.nehal@atrc.net.pk
•
108 views
Functional Pattern Matching on Python
Daker Fernandes
•
5.5K views
Sharper tools with F#
Kevin Avignon
•
196 views
Menu func-sh(1)
Ben Pope
•
29 views
Rakudo
awwaiid
•
789 views
Workshop on command line tools - day 1
Leandro Lima
•
950 views
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...
Philip Schwarz
•
267 views
Workshop on command line tools - day 2
Leandro Lima
•
1.1K views
Road to Power Query NINJA – 1st STEP
Takeshi Kagata
•
1.1K views
Viewers also liked
Crv book n ys
Jaksa Nikodijevic
1.3K views
•
36 slides
Program and Project Management at the New World Trade Center
novacsi
4K views
•
83 slides
How to Build a Tower
alaska150
33K views
•
23 slides
Functional Planning of a Building
Mr. Ramesh Nayaka
21.7K views
•
71 slides
اسس تصميم المباني الادارية Office building design & The Edge Office a Greenes...
Ahmed SHoukry ELhfnawy
27.2K views
•
39 slides
مباني ادارية
freemadoo
88K views
•
75 slides
Viewers also liked
(8)
Crv book n ys
Jaksa Nikodijevic
•
1.3K views
Program and Project Management at the New World Trade Center
novacsi
•
4K views
How to Build a Tower
alaska150
•
33K views
Functional Planning of a Building
Mr. Ramesh Nayaka
•
21.7K views
اسس تصميم المباني الادارية Office building design & The Edge Office a Greenes...
Ahmed SHoukry ELhfnawy
•
27.2K views
مباني ادارية
freemadoo
•
88K views
State of Education in the Philippines 2012
Arangkada Philippines
•
153.5K views
Burj khalifa
Safa Aboelssaad
•
113K views
Similar to Functional perl
Functional Pearls 4 (YAPC::EU::2009 remix)
osfameron
1.4K views
•
184 slides
Simple Ways To Be A Better Programmer (OSCON 2007)
Michael Schwern
966 views
•
177 slides
Perl6 a whistle stop tour
Simon Proctor
143 views
•
24 slides
Perl6 a whistle stop tour
Simon Proctor
71 views
•
24 slides
perl usage at database applications
Joe Jiang
1.2K views
•
33 slides
From Javascript To Haskell
ujihisa
2.1K views
•
39 slides
Similar to Functional perl
(20)
Functional Pearls 4 (YAPC::EU::2009 remix)
osfameron
•
1.4K views
Simple Ways To Be A Better Programmer (OSCON 2007)
Michael Schwern
•
966 views
Perl6 a whistle stop tour
Simon Proctor
•
143 views
Perl6 a whistle stop tour
Simon Proctor
•
71 views
perl usage at database applications
Joe Jiang
•
1.2K views
From Javascript To Haskell
ujihisa
•
2.1K views
Is Haskell an acceptable Perl?
osfameron
•
1.6K views
Writing Maintainable Perl
tinypigdotcom
•
1.3K views
Good Evils In Perl (Yapc Asia)
Kang-min Liu
•
8.9K views
Good Evils In Perl
Kang-min Liu
•
13.8K views
How to write code you won't hate tomorrow
Pete McFarlane
•
82 views
Perl6 Regexen: Reduce the line noise in your code.
Workhorse Computing
•
320 views
Why async and functional programming in PHP7 suck and how to get overr it?
Lucas Witold Adamus
•
1.5K views
Mips1
Stefano Salvatori
•
1.7K views
FP in scalaで鍛える関数型脳
Yuri Inoue
•
612 views
Top 10 php classic traps
Damien Seguy
•
515 views
Internationalizing CakePHP Applications
Pierre MARTIN
•
5.8K views
PHPCon 2016: PHP7 by Witek Adamus / XSolve
XSolve
•
1K views
Refactoring to Macros with Clojure
Dmitry Buzdin
•
3.5K views
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
Workhorse Computing
•
415 views
Recently uploaded
Product Research Presentation-Maidy Veloso.pptx
MaidyVeloso
41 views
•
23 slides
Google cloud Study Jam 2023.pptx
GDSCNiT
489 views
•
56 slides
Mule Meetup Calgary- API Governance & Conformance.pdf
NithaJoseph4
69 views
•
19 slides
Product Research Presentation-Maidy Veloso.pptx
MaidyVeloso
43 views
•
23 slides
How resolve Gem dependencies in your code?
Hiroshi SHIBATA
169 views
•
50 slides
Common WordPress APIs_ Settings API
Jonathan Bossenger
32 views
•
10 slides
Recently uploaded
(20)
Product Research Presentation-Maidy Veloso.pptx
MaidyVeloso
•
41 views
Google cloud Study Jam 2023.pptx
GDSCNiT
•
489 views
Mule Meetup Calgary- API Governance & Conformance.pdf
NithaJoseph4
•
69 views
Product Research Presentation-Maidy Veloso.pptx
MaidyVeloso
•
43 views
How resolve Gem dependencies in your code?
Hiroshi SHIBATA
•
169 views
Common WordPress APIs_ Settings API
Jonathan Bossenger
•
32 views
Solving today’s Traffic Problems with Sustainable Ride Hailing Solution
On Demand Clone
•
44 views
"Stateful app as an efficient way to build dispatching for riders and drivers...
Fwdays
•
48 views
Need for Speed: Removing speed bumps in API Projects
Łukasz Chruściel
•
140 views
Empowering City Clerks
OnBoard
•
101 views
EuroBSDCon 2023 - (auto)Installing BSD Systems - Cases using pfSense, TrueNAS...
Vinícius Zavam
•
81 views
Deep Dive Microsoft Viva Insights - Collabdays Bletchley Park 2023
Chirag Patel
•
18 views
roomos_webinar_280923_v2.pptx
ThousandEyes
•
31 views
"Architecture assessment from classics to details", Dmytro Ovcharenko
Fwdays
•
55 views
UiPath Tips and Techniques for Debugging - Session 3
DianaGray10
•
57 views
"Data Mesh in Kubernetes", Andrii Syniuk
Fwdays
•
17 views
Take Control of Podcasting thanks to Open Source and Podcasting 2.0
🎙 Benjamin Bellamy
•
80 views
GDSC Cloud Lead Presentation.pptx
AbhinavNautiyal8
•
92 views
The Flutter Job Market At The Moment
Ahmed Abu Eldahab
•
44 views
Recommendation Modeling with Impression Data at Netflix
Jiangwei Pan
•
95 views
Functional perl
1.
Functional Programming
Perl Christopher Mckay error@errorific.com
2.
What Am I
3.
What's this talk
all about?
4.
History
5.
How
6.
Why not?
7.
But I don't
use/appreciate/like perl?
8.
Functional Programming is
Easy
9.
So easy sysadmins
do it
10.
In the beginning...
12.
Wrote Pearl Perl
13.
People wanted a
sort function Larry was generous
14.
sort F(a, a), [a]
--------> [a]
15.
@sorted_list =
sort {$_[0] <=> $_[1]} @list
16.
@sorted_list =
sort {$a <=> $b } @list
17.
@sorted_list
= sort {$a <=> $b} @list
18.
sort
String sorting sort {$a cmp $b} Also string sorting sort {$a <=> $b} Sort numerically sort &comparator Sort by function named comparator
19.
sort {
@a = split ///, $a; @b = split ///, $b; ($a[2] <=> $b[2]) || ($a[1] <=> $b[1]) || ($a[0] <=> $b[0]) || 0; } @list_of_dmy_dates
20.
1988 - Perl
2.0 1989 - Perl 3.0 1991 - Perl 4.0
21.
grep F(a, a), [a]
--------> [a]
22.
map F(a), [a] -------->
[a]
23.
1994 – Perl
5.0
24.
memoize F(a) → b
--------------> F(a) → b
25.
List::Util
reduce F(a, b) → b, [a] --------------> b
26.
List::MoreUtils any, all, none,
notall, true, false, firstidx, first_index, lastidx, part, mesh, last_index, insert_after, zip, uniq, apply, indexes, after, after_incl, before, before_incl, firstval, first_value, lastval, last_value, pairwise, distinct, minmax
28.
So Perl evolved
a functional theme
29.
So how do
I make functional stuff in perl instead of just using it?
30.
Lexical scoping
31.
First class functions
32.
That's about it. Your
language does that too right?
33.
So lets write
a function that rolls a die
34.
my $dx =
sub { my ($sides) = @_; return (rand() * $sides) + 1; } my $roll = $dx->(6);
35.
I don't like
rolling 1's though so...
36.
my $cheat =
sub { my ($roll) = @_; if ($roll < 2) { return 2; } else { return $roll; } }
37.
I don't want
to get caught turning the die over though so ...
38.
my $inconspicuous_dx =
sub { my ($sides) = @_; return $cheat->($dx->($sides)); }
39.
my $compose =
sub { my ($fa, $fb) = @_; return sub { return $fa->($fb->(@_)); } }
40.
my $inconspicuous_dx =
$compose->($cheat, $dx); my $better_roll = $inconspicuous_dx->(6);
41.
Monads in Perl Masahiro
Honma (hiratara) YAPC::Asia 2011 Slides are in english Data::Monad
42.
All I ever
need is d6!
43.
my $d6 =
sub { return $inconspicuous_dx->(6); }; my $roll_a_6 = $d6->();
44.
Too lazy to
roll 20d6
45.
my $dice_tower_maker =
sub { my ($die) = @_; return sub { my ($rolls) = @_; return map { $die->() } (1 .. $rolls); } }
46.
my $dice_tower =
$dice_tower_generator->($d6); say join(', ', $dice_tower->(20));
47.
use List::Util; say sum
$dice_tower->(20);
48.
use List::Util; say reduce
{$a + $b} $dice_tower->(20);
49.
So why not
use this stuff for everything?
50.
The compilers not
out to help you
51.
Declaring functions gets
obtuse after awhile
52.
Purity isn't an
option, everything changes
53.
The community loves
objects
54.
If it was
simple in a functional language it probably takes some hacking to make it work in perl
55.
And the language
isn't extensible, yet
56.
Good things are
to come
57.
Perl 6
58.
Static typing
Better syntax Blocks and closures List comprehension Automatic parallelisation Lots more
59.
Thanks Questions?