SlideShare a Scribd company logo
Fear and Loathing
with APL
Hi, my name is Yan Cui
aka @theburningmonk
What is APL?
created at IBM in 1957, by Ken Iverson
designed to simplify math notations
“A Programming Language”
What is APL?
famed for use of special symbols
array programming
influenced Mathematica, Matlab, etc.
hey, I’m
learning
APL
what the
hell is an
APL?
have you
lost your
mind?
Conway’s Game of Life
https://www.youtube.com/watch?v=a9xAKttWgP4
“Beauty is in the Eye of the Beholder”
beauty doesn't exist on its own but is created by observers
“…We followed up with two studies on the accuracy
rates of novices using a total of six programming
languages: Ruby, Java, Perl, Python, Randomo, and
Quorum. Randomo was designed by randomly
choosing some keywords from the ASCII table (a
metaphorical placebo). To our surprise, we found that
languages using a more traditional C-style syntax
(both Perl and Java) did not afford accuracy rates
significantly higher than a language with randomly
generated keywords, …”
“An Empirical Investigation into Programming Language Syntax”
- Andreas Stefik and Susanna Siebert
“…We followed up with two studies on the accuracy
rates of novices using a total of six programming
languages: Ruby, Java, Perl, Python, Randomo, and
Quorum. Randomo was designed by randomly
choosing some keywords from the ASCII table (a
metaphorical placebo). To our surprise, we found that
languages using a more traditional C-style syntax
(both Perl and Java) did not afford accuracy rates
significantly higher than a language with randomly
generated keywords, …”
“An Empirical Investigation into Programming Language Syntax”
- Andreas Stefik and Susanna Siebert
http://bit.ly/2eM3Qvr
“A language that doesn't
affect the way you think
about programming, is not
worth knowing.”
- Alan Perlis
“in an era of mainstream programming
languages, APL is a rare opportunity to
truly challenge the way you think about
programming”
- me
Let’s learn some APL
http://tryapl.org/
2 + 2
4
4 - 1
3
+ and - works the way you expect
2 * 3
8
4 * 4
256
but * means power
2 / 3
3 3
and / means replicate
it means replicate the scalar value 3, 2 times
and returns an array of 2 elements
2 × 2
4
4 ÷ 2
2
multiplication (×) and division (÷)
just like in Maths!
x ← 42
y ← 1 2 3 4
assignment (←)
variable names are case sensitive
variables are mutable
x ← 42
x ← 1 2 3 4
x
1 2 3 4
assign multiple values at once
(kinda like pattern matching)
x y z ← 1 2 3
x
1
y
2
but the patterns must match
x y ← 1 2 3
LENGTH ERROR
x y ← 1 2 3
1 2 3 - 3 2 1
¯2 0 2
1 2 3 × 3 2 1
3 4 3
arithmetic operations work on arrays too
1 2 3 + 1
2 3 4
2 × 1 2 3
2 4 6
if one side is scalar then the other side
can be any shape
4 ⌊ 2
2
4 ⌈ 2
4
min (⌊) and max (⌈)
1 2 3 4 5 ⌈ 4
4 4 4 4 5
1 2 3 ⌈ 3 2 1
3 2 3
min (⌊) and max (⌈)
same rules apply for arrays
dyadic
2 ⌈ 4
1 2 ⌈ 3 1
monadic
⌈ 2
⌈ 1 3
⌊ 3 4.1 4.5 5.6
3 4 4 5
monadically, ⌊ means floor
⌈ 3 4.1 4.5 5.6
3 5 5 6
and ⌈ means ceiling
3 2 ⍴ 1 2 3 4 5 6
1 2
3 4
5 6
dyadically, ⍴ reshapes right hand side
rows
columns
⍴ 1 2 3
3
⍴ (3 2 ⍴ 1 2 3 4 5 6)
3 2
monadically, ⍴ returns shape of argument
3 2 ⍴ 1 2 3
1 2
3 1
2 3
⍴ recycles elements to fill space
2 2 ⍴ 1 2 3 4 5 6
1 2
3 4
and ignores additional elements
3 3 ⍴ 1 0 0 0
1 0 0
0 1 0
0 0 1
here’s a neat trick to get diagonals :-P
⍴ 2 2 ⍴ 0 1 0
2 2
⍴ (2 2 ⍴ 0 1 0)
2 2
oh, and APL is read from RIGHT-TO-LEFT
⍴ 2 2 ⍴ 0 1 0
2 2
⍴ (2 2 ⍴ 0 1 0)
2 2
oh, and APL is read from RIGHT-TO-LEFT
+/ 1 2 3
6
btw, / also means reduce
ie, reduce over the array [1, 2, 3] with the plus function
×/ 1 2 3 4 5
120
btw, / also means reduce
and here’s factorials!
Defined Functions
Avg ← { (+/ ⍵) ÷ ⍴⍵ }
anatomy of a defined function
function
name
assignment function
body
Avg ← { (+/ ⍵) ÷ ⍴⍵ }
Avg 1 2 3
anatomy of a defined function
omega ⍵ represents the right argument
Diff ← { (+/ ⍺) - (+/ ⍵) }
3 4 5 Diff 1 2 3
anatomy of a defined function
alpha ⍺ represents the left argument
Plus ← { ⍺ + ⍵ }
Plus/ 1 2 3
6
defined functions can be used with / too
Indexing an Array
Xs ← 1 2 3
Xs[2]
2
APL is one-indexed!
Xs[1 2 1]
1 2 1
Xs[2 2 ⍴ 1 2]
1 2
1 2
indices can be array too
Xs[3 2] ← 6 4
Xs
1 4 6
updating an array
⍳9
1 2 3 4 5 6 7 8 9
index generator
Booleans
1 < 2
1
1 2 3 < 3 2 1
1 0 0
1 is true, 0 is false
yup, works with arrays too ;-)
~1
0
~1 0 1
0 1 0
monadically, ~ means negate
(1 2 3 < 3 2 1) ∧ (1 1 1)
1 0 0
(1 2 3 < 3 2 1) ∨ (1 1 1)
1 1 1
logical AND ∧ and logical OR ∨
(⍳10) > 7
0 0 0 0 0 0 0 1 1 1
+/ (⍳10) > 7
3
count no. of positives
(⍳10) > 7
0 0 0 0 0 0 0 1 1 1
⍳10 > 7
?
are these two expression equivalent?
(⍳10) > 7
0 0 0 0 0 0 0 1 1 1
⍳10 > 7
1
are these two expression equivalent?
nope! remember, APL reads from RIGHT-TO-LEFT!
(⍳10) > 7
0 0 0 0 0 0 0 1 1 1
7 < ⍳10
0 0 0 0 0 0 0 1 1 1
are these two expression equivalent?
Compression
(aka filtering)
1 0 1 / 3 2 1
3 1
1 0 1 / 'iou'
i u
booleans can be used to as a mask
Values ← 1 3 5 7 9
Values > 4
0 0 1 1 1
(Values > 4) / Values
5 7 9
a LINQ-style Where can be written as
Values > 4
0 0 1 1 1
⍳⍴Values
1 2 3 4 5
(Values > 4) / (⍳⍴Values)
3 4 5
and to get the indices instead
1 2 3 ~ 3 4 3 5
1 2
‘ab’ ‘cd’ ‘ef’ ~ ‘cd’ ‘ef’
ab
dyadically, ~ means without
1 1 3 5 3 7 ∊ 1 2 3
1 1 1 0 1 0
'hello world' ∊ 'aeiou'
0 1 0 0 1 0 0 1 0 0 0
dyadically, ∊ checks for membership
Phrase ← ‘hello world’
(Phrase ∊ 'aeiou') / Phrase
eoo
which vowels appeared in a phrase?
2 2 ⍴ 1 2
1 2
1 2
∊ 2 2 ⍴ 1 2
1 2 1 2
monadically, ∊ flattens a matrix
Take & Drop
2 ↑ 1 2 3 4
1 2
2 2 ↑ (3 3 ⍴ ⍳9)
1 2
4 5
↑ to take items from an array
!?
3 3 ⍴ ⍳9
1 2 3
4 5 6
7 8 9
2 2 ↑ 3 3 ⍴ ⍳9
1 2 3
4 5 6
7 8 9
take a 2 (rows) by 2 (cols) matrix
2 ↓ 1 2 3 4
3 4
2 2 ↓ (3 3 ⍴ ⍳9)
9
↓ to drop items from an array
!?
3 3 ⍴ ⍳9
1 2 3
4 5 6
7 8 9
2 2 ↓ 3 3 ⍴ ⍳9
1 2 3
4 5 6
7 8 9
drop first 2 rows and 2 cols
¯2 ↑ 1 2 3 4
3 4
¯2 ↓ 1 2 3 4
1 2
use negative count to take/drop from
end of array
¯2 2 ↑ (3 3 ⍴ ⍳9)
?
¯2 2 ↓ (3 3 ⍴ ⍳9)
?
what about these?
http://tryapl.org/ try it out yourself
Mirrors &
Transportations
3 3 ⍴ ⍳9
1 2 3
4 5 6
7 8 9
given a matrix
3 3 ⍴ ⍳9
3 2 1
6 5 4
9 8 7
mirrors the matrix horizontally
3 3 ⍴ ⍳9
7 8 9
4 5 6
1 2 3
mirrors the matrix vertically
⍉ 3 3 ⍴ ⍳9
1 4 7
2 5 8
3 6 9
transposes the matrix⍉
Outer Products
cartesian product
1 2 3 .+ 4 5 6
5 6 7
6 7 8
7 8 9
. creates a cartesian product
1 2 3 .× 4 5 6
4 5 6
8 10 12
12 15 18
. creates a cartesian product
(⍳3) .= (⍳3)
1 0 0
0 1 0
0 0 1
. creates a cartesian product
(⍳3) .< (⍳3)
0 1 1
0 0 1
0 0 0
. creates a cartesian product
(⍳3) .⌈ (⍳3)
1 2 3
2 2 3
3 3 3
. creates a cartesian product
(⍳3) .+ (⍳3)
2 3 4
3 4 5
4 5 6
. creates a cartesian product
what about this?
http://tryapl.org/ try it out yourself
∊ (⍳3) .× (⍳5)
?
Demo Time…
Conclusions
should I learn APL?
absolutely! it’s the shock to the
system your brain needs
is it gonna help my career?
does it matter?
@theburningmonk
theburningmonk.com
github.com/theburningmonk

More Related Content

What's hot

Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - with ...
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - with ...Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - with ...
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - with ...
Philip Schwarz
 
Functional programming with haskell
Functional programming with haskellFunctional programming with haskell
Functional programming with haskell
faradjpour
 
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
Philip Schwarz
 
Programming Paradigms Which One Is The Best?
Programming Paradigms Which One Is The Best?Programming Paradigms Which One Is The Best?
Programming Paradigms Which One Is The Best?
Netguru
 
Introduction to Functional Languages
Introduction to Functional LanguagesIntroduction to Functional Languages
Introduction to Functional Languages
suthi
 
Sierpinski Triangle - Polyglot FP for Fun and Profit - Haskell and Scala
Sierpinski Triangle - Polyglot FP for Fun and Profit - Haskell and ScalaSierpinski Triangle - Polyglot FP for Fun and Profit - Haskell and Scala
Sierpinski Triangle - Polyglot FP for Fun and Profit - Haskell and Scala
Philip Schwarz
 
The Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iterateThe Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iterate
Philip Schwarz
 
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part ...
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part ...Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part ...
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part ...
Philip Schwarz
 
Stack queue
Stack queueStack queue
Stack queue
Harry Potter
 
Csharp_List
Csharp_ListCsharp_List
Csharp_List
Micheal Ogundero
 
Haskell
HaskellHaskell
LEC3-DS ALGO(updated).pdf
LEC3-DS  ALGO(updated).pdfLEC3-DS  ALGO(updated).pdf
LEC3-DS ALGO(updated).pdf
MuhammadUmerIhtisham
 
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 4
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 4Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 4
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 4
Philip Schwarz
 
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
Philip Schwarz
 
Basic Sorting algorithms csharp
Basic Sorting algorithms csharpBasic Sorting algorithms csharp
Basic Sorting algorithms csharp
Micheal Ogundero
 
U3.stack queue
U3.stack queueU3.stack queue
U3.stack queue
Ssankett Negi
 
Reasoning about laziness
Reasoning about lazinessReasoning about laziness
Reasoning about laziness
Johan Tibell
 
Monad Fact #4
Monad Fact #4Monad Fact #4
Monad Fact #4
Philip Schwarz
 
Scala 3 enum for a terser Option Monad Algebraic Data Type
Scala 3 enum for a terser Option Monad Algebraic Data TypeScala 3 enum for a terser Option Monad Algebraic Data Type
Scala 3 enum for a terser Option Monad Algebraic Data Type
Philip Schwarz
 
Open addressiing &amp;rehashing,extendiblevhashing
Open addressiing &amp;rehashing,extendiblevhashingOpen addressiing &amp;rehashing,extendiblevhashing
Open addressiing &amp;rehashing,extendiblevhashing
SangeethaSasi1
 

What's hot (20)

Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - with ...
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - with ...Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - with ...
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - with ...
 
Functional programming with haskell
Functional programming with haskellFunctional programming with haskell
Functional programming with haskell
 
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
 
Programming Paradigms Which One Is The Best?
Programming Paradigms Which One Is The Best?Programming Paradigms Which One Is The Best?
Programming Paradigms Which One Is The Best?
 
Introduction to Functional Languages
Introduction to Functional LanguagesIntroduction to Functional Languages
Introduction to Functional Languages
 
Sierpinski Triangle - Polyglot FP for Fun and Profit - Haskell and Scala
Sierpinski Triangle - Polyglot FP for Fun and Profit - Haskell and ScalaSierpinski Triangle - Polyglot FP for Fun and Profit - Haskell and Scala
Sierpinski Triangle - Polyglot FP for Fun and Profit - Haskell and Scala
 
The Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iterateThe Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iterate
 
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part ...
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part ...Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part ...
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part ...
 
Stack queue
Stack queueStack queue
Stack queue
 
Csharp_List
Csharp_ListCsharp_List
Csharp_List
 
Haskell
HaskellHaskell
Haskell
 
LEC3-DS ALGO(updated).pdf
LEC3-DS  ALGO(updated).pdfLEC3-DS  ALGO(updated).pdf
LEC3-DS ALGO(updated).pdf
 
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 4
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 4Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 4
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 4
 
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
 
Basic Sorting algorithms csharp
Basic Sorting algorithms csharpBasic Sorting algorithms csharp
Basic Sorting algorithms csharp
 
U3.stack queue
U3.stack queueU3.stack queue
U3.stack queue
 
Reasoning about laziness
Reasoning about lazinessReasoning about laziness
Reasoning about laziness
 
Monad Fact #4
Monad Fact #4Monad Fact #4
Monad Fact #4
 
Scala 3 enum for a terser Option Monad Algebraic Data Type
Scala 3 enum for a terser Option Monad Algebraic Data TypeScala 3 enum for a terser Option Monad Algebraic Data Type
Scala 3 enum for a terser Option Monad Algebraic Data Type
 
Open addressiing &amp;rehashing,extendiblevhashing
Open addressiing &amp;rehashing,extendiblevhashingOpen addressiing &amp;rehashing,extendiblevhashing
Open addressiing &amp;rehashing,extendiblevhashing
 

Similar to Fear and loathing with APL (oredev)

PERL for QA - Important Commands and applications
PERL for QA - Important Commands and applicationsPERL for QA - Important Commands and applications
PERL for QA - Important Commands and applications
Sunil Kumar Gunasekaran
 
Distributive Property
Distributive PropertyDistributive Property
Distributive Property
Jessca Lundin
 
Linear Programming- Leacture-16-lp1.pptx
Linear Programming- Leacture-16-lp1.pptxLinear Programming- Leacture-16-lp1.pptx
Linear Programming- Leacture-16-lp1.pptx
SarahKoech1
 
Section 8: Symmetric Groups
Section 8: Symmetric GroupsSection 8: Symmetric Groups
Section 8: Symmetric Groups
Kevin Johnson
 
Functional Concepts for OOP Developers
Functional Concepts for OOP DevelopersFunctional Concepts for OOP Developers
Functional Concepts for OOP Developers
brweber2
 
Algorithim lec1.pptx
Algorithim lec1.pptxAlgorithim lec1.pptx
Algorithim lec1.pptx
rediet43
 
Slope
Slope Slope
Slope
lfisher27
 
MA3696 Lecture 5
MA3696 Lecture 5MA3696 Lecture 5
MA3696 Lecture 5
Brunel University
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
greatqadirgee4u
 
Thinking Functionally In Ruby
Thinking Functionally In RubyThinking Functionally In Ruby
Thinking Functionally In Ruby
Ross Lawley
 
Oct8 - 131 slid
Oct8 - 131 slidOct8 - 131 slid
Oct8 - 131 slid
Tak Lee
 
RubyConf Argentina 2011
RubyConf Argentina 2011RubyConf Argentina 2011
RubyConf Argentina 2011
Aaron Patterson
 
A Scala Corrections Library
A Scala Corrections LibraryA Scala Corrections Library
A Scala Corrections Library
Paul Phillips
 
Unit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptxUnit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptx
ssuser01e301
 
Ruby Gotchas
Ruby GotchasRuby Gotchas
Ruby Gotchas
Dave Aronson
 
Advanced s and s algorithm.ppt
Advanced s and s algorithm.pptAdvanced s and s algorithm.ppt
Advanced s and s algorithm.ppt
LegesseSamuel
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
Devaraj Chilakala
 
8.1 Powerpoint
8.1 Powerpoint8.1 Powerpoint
8.1 Powerpoint
TaylorSharp94
 
one main advantage of bubble sort as compared to others
one main advantage of bubble sort as compared to othersone main advantage of bubble sort as compared to others
one main advantage of bubble sort as compared to others
Ajay Chimmani
 
Alegebra Powers Substitution
Alegebra Powers SubstitutionAlegebra Powers Substitution
Alegebra Powers Substitution
Passy World
 

Similar to Fear and loathing with APL (oredev) (20)

PERL for QA - Important Commands and applications
PERL for QA - Important Commands and applicationsPERL for QA - Important Commands and applications
PERL for QA - Important Commands and applications
 
Distributive Property
Distributive PropertyDistributive Property
Distributive Property
 
Linear Programming- Leacture-16-lp1.pptx
Linear Programming- Leacture-16-lp1.pptxLinear Programming- Leacture-16-lp1.pptx
Linear Programming- Leacture-16-lp1.pptx
 
Section 8: Symmetric Groups
Section 8: Symmetric GroupsSection 8: Symmetric Groups
Section 8: Symmetric Groups
 
Functional Concepts for OOP Developers
Functional Concepts for OOP DevelopersFunctional Concepts for OOP Developers
Functional Concepts for OOP Developers
 
Algorithim lec1.pptx
Algorithim lec1.pptxAlgorithim lec1.pptx
Algorithim lec1.pptx
 
Slope
Slope Slope
Slope
 
MA3696 Lecture 5
MA3696 Lecture 5MA3696 Lecture 5
MA3696 Lecture 5
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
 
Thinking Functionally In Ruby
Thinking Functionally In RubyThinking Functionally In Ruby
Thinking Functionally In Ruby
 
Oct8 - 131 slid
Oct8 - 131 slidOct8 - 131 slid
Oct8 - 131 slid
 
RubyConf Argentina 2011
RubyConf Argentina 2011RubyConf Argentina 2011
RubyConf Argentina 2011
 
A Scala Corrections Library
A Scala Corrections LibraryA Scala Corrections Library
A Scala Corrections Library
 
Unit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptxUnit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptx
 
Ruby Gotchas
Ruby GotchasRuby Gotchas
Ruby Gotchas
 
Advanced s and s algorithm.ppt
Advanced s and s algorithm.pptAdvanced s and s algorithm.ppt
Advanced s and s algorithm.ppt
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
 
8.1 Powerpoint
8.1 Powerpoint8.1 Powerpoint
8.1 Powerpoint
 
one main advantage of bubble sort as compared to others
one main advantage of bubble sort as compared to othersone main advantage of bubble sort as compared to others
one main advantage of bubble sort as compared to others
 
Alegebra Powers Substitution
Alegebra Powers SubstitutionAlegebra Powers Substitution
Alegebra Powers Substitution
 

More from Yan Cui

How to win the game of trade-offs
How to win the game of trade-offsHow to win the game of trade-offs
How to win the game of trade-offs
Yan Cui
 
How to choose the right messaging service
How to choose the right messaging serviceHow to choose the right messaging service
How to choose the right messaging service
Yan Cui
 
How to choose the right messaging service for your workload
How to choose the right messaging service for your workloadHow to choose the right messaging service for your workload
How to choose the right messaging service for your workload
Yan Cui
 
Patterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdfPatterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdf
Yan Cui
 
Lambda and DynamoDB best practices
Lambda and DynamoDB best practicesLambda and DynamoDB best practices
Lambda and DynamoDB best practices
Yan Cui
 
Lessons from running AppSync in prod
Lessons from running AppSync in prodLessons from running AppSync in prod
Lessons from running AppSync in prod
Yan Cui
 
Serverless observability - a hero's perspective
Serverless observability - a hero's perspectiveServerless observability - a hero's perspective
Serverless observability - a hero's perspective
Yan Cui
 
How to ship customer value faster with step functions
How to ship customer value faster with step functionsHow to ship customer value faster with step functions
How to ship customer value faster with step functions
Yan Cui
 
How serverless changes the cost paradigm
How serverless changes the cost paradigmHow serverless changes the cost paradigm
How serverless changes the cost paradigm
Yan Cui
 
Why your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSyncWhy your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSync
Yan Cui
 
Build social network in 4 weeks
Build social network in 4 weeksBuild social network in 4 weeks
Build social network in 4 weeks
Yan Cui
 
Patterns and practices for building resilient serverless applications
Patterns and practices for building resilient serverless applicationsPatterns and practices for building resilient serverless applications
Patterns and practices for building resilient serverless applications
Yan Cui
 
How to bring chaos engineering to serverless
How to bring chaos engineering to serverlessHow to bring chaos engineering to serverless
How to bring chaos engineering to serverless
Yan Cui
 
Migrating existing monolith to serverless in 8 steps
Migrating existing monolith to serverless in 8 stepsMigrating existing monolith to serverless in 8 steps
Migrating existing monolith to serverless in 8 steps
Yan Cui
 
Building a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQLBuilding a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQL
Yan Cui
 
FinDev as a business advantage in the post covid19 economy
FinDev as a business advantage in the post covid19 economyFinDev as a business advantage in the post covid19 economy
FinDev as a business advantage in the post covid19 economy
Yan Cui
 
How to improve lambda cold starts
How to improve lambda cold startsHow to improve lambda cold starts
How to improve lambda cold starts
Yan Cui
 
What can you do with lambda in 2020
What can you do with lambda in 2020What can you do with lambda in 2020
What can you do with lambda in 2020
Yan Cui
 
A chaos experiment a day, keeping the outage away
A chaos experiment a day, keeping the outage awayA chaos experiment a day, keeping the outage away
A chaos experiment a day, keeping the outage away
Yan Cui
 
How to debug slow lambda response times
How to debug slow lambda response timesHow to debug slow lambda response times
How to debug slow lambda response times
Yan Cui
 

More from Yan Cui (20)

How to win the game of trade-offs
How to win the game of trade-offsHow to win the game of trade-offs
How to win the game of trade-offs
 
How to choose the right messaging service
How to choose the right messaging serviceHow to choose the right messaging service
How to choose the right messaging service
 
How to choose the right messaging service for your workload
How to choose the right messaging service for your workloadHow to choose the right messaging service for your workload
How to choose the right messaging service for your workload
 
Patterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdfPatterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdf
 
Lambda and DynamoDB best practices
Lambda and DynamoDB best practicesLambda and DynamoDB best practices
Lambda and DynamoDB best practices
 
Lessons from running AppSync in prod
Lessons from running AppSync in prodLessons from running AppSync in prod
Lessons from running AppSync in prod
 
Serverless observability - a hero's perspective
Serverless observability - a hero's perspectiveServerless observability - a hero's perspective
Serverless observability - a hero's perspective
 
How to ship customer value faster with step functions
How to ship customer value faster with step functionsHow to ship customer value faster with step functions
How to ship customer value faster with step functions
 
How serverless changes the cost paradigm
How serverless changes the cost paradigmHow serverless changes the cost paradigm
How serverless changes the cost paradigm
 
Why your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSyncWhy your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSync
 
Build social network in 4 weeks
Build social network in 4 weeksBuild social network in 4 weeks
Build social network in 4 weeks
 
Patterns and practices for building resilient serverless applications
Patterns and practices for building resilient serverless applicationsPatterns and practices for building resilient serverless applications
Patterns and practices for building resilient serverless applications
 
How to bring chaos engineering to serverless
How to bring chaos engineering to serverlessHow to bring chaos engineering to serverless
How to bring chaos engineering to serverless
 
Migrating existing monolith to serverless in 8 steps
Migrating existing monolith to serverless in 8 stepsMigrating existing monolith to serverless in 8 steps
Migrating existing monolith to serverless in 8 steps
 
Building a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQLBuilding a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQL
 
FinDev as a business advantage in the post covid19 economy
FinDev as a business advantage in the post covid19 economyFinDev as a business advantage in the post covid19 economy
FinDev as a business advantage in the post covid19 economy
 
How to improve lambda cold starts
How to improve lambda cold startsHow to improve lambda cold starts
How to improve lambda cold starts
 
What can you do with lambda in 2020
What can you do with lambda in 2020What can you do with lambda in 2020
What can you do with lambda in 2020
 
A chaos experiment a day, keeping the outage away
A chaos experiment a day, keeping the outage awayA chaos experiment a day, keeping the outage away
A chaos experiment a day, keeping the outage away
 
How to debug slow lambda response times
How to debug slow lambda response timesHow to debug slow lambda response times
How to debug slow lambda response times
 

Recently uploaded

[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
manji sharman06
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
DianaGray10
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
Fwdays
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
Fwdays
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
christinelarrosa
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
ScyllaDB
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
FilipTomaszewski5
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Ukraine
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 

Recently uploaded (20)

[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 

Fear and loathing with APL (oredev)

  • 2. Hi, my name is Yan Cui aka @theburningmonk
  • 3. What is APL? created at IBM in 1957, by Ken Iverson designed to simplify math notations “A Programming Language”
  • 4. What is APL? famed for use of special symbols array programming influenced Mathematica, Matlab, etc.
  • 8. Conway’s Game of Life https://www.youtube.com/watch?v=a9xAKttWgP4
  • 9.
  • 10. “Beauty is in the Eye of the Beholder” beauty doesn't exist on its own but is created by observers
  • 11. “…We followed up with two studies on the accuracy rates of novices using a total of six programming languages: Ruby, Java, Perl, Python, Randomo, and Quorum. Randomo was designed by randomly choosing some keywords from the ASCII table (a metaphorical placebo). To our surprise, we found that languages using a more traditional C-style syntax (both Perl and Java) did not afford accuracy rates significantly higher than a language with randomly generated keywords, …” “An Empirical Investigation into Programming Language Syntax” - Andreas Stefik and Susanna Siebert
  • 12. “…We followed up with two studies on the accuracy rates of novices using a total of six programming languages: Ruby, Java, Perl, Python, Randomo, and Quorum. Randomo was designed by randomly choosing some keywords from the ASCII table (a metaphorical placebo). To our surprise, we found that languages using a more traditional C-style syntax (both Perl and Java) did not afford accuracy rates significantly higher than a language with randomly generated keywords, …” “An Empirical Investigation into Programming Language Syntax” - Andreas Stefik and Susanna Siebert
  • 14. “A language that doesn't affect the way you think about programming, is not worth knowing.” - Alan Perlis
  • 15. “in an era of mainstream programming languages, APL is a rare opportunity to truly challenge the way you think about programming” - me
  • 16.
  • 17.
  • 18. Let’s learn some APL http://tryapl.org/
  • 19. 2 + 2 4 4 - 1 3 + and - works the way you expect
  • 20. 2 * 3 8 4 * 4 256 but * means power
  • 21. 2 / 3 3 3 and / means replicate it means replicate the scalar value 3, 2 times and returns an array of 2 elements
  • 22. 2 × 2 4 4 ÷ 2 2 multiplication (×) and division (÷) just like in Maths!
  • 23. x ← 42 y ← 1 2 3 4 assignment (←) variable names are case sensitive
  • 24. variables are mutable x ← 42 x ← 1 2 3 4 x 1 2 3 4
  • 25. assign multiple values at once (kinda like pattern matching) x y z ← 1 2 3 x 1 y 2
  • 26. but the patterns must match x y ← 1 2 3 LENGTH ERROR x y ← 1 2 3
  • 27. 1 2 3 - 3 2 1 ¯2 0 2 1 2 3 × 3 2 1 3 4 3 arithmetic operations work on arrays too
  • 28. 1 2 3 + 1 2 3 4 2 × 1 2 3 2 4 6 if one side is scalar then the other side can be any shape
  • 29. 4 ⌊ 2 2 4 ⌈ 2 4 min (⌊) and max (⌈)
  • 30. 1 2 3 4 5 ⌈ 4 4 4 4 4 5 1 2 3 ⌈ 3 2 1 3 2 3 min (⌊) and max (⌈) same rules apply for arrays
  • 31.
  • 32.
  • 33. dyadic 2 ⌈ 4 1 2 ⌈ 3 1 monadic ⌈ 2 ⌈ 1 3
  • 34. ⌊ 3 4.1 4.5 5.6 3 4 4 5 monadically, ⌊ means floor
  • 35. ⌈ 3 4.1 4.5 5.6 3 5 5 6 and ⌈ means ceiling
  • 36.
  • 37. 3 2 ⍴ 1 2 3 4 5 6 1 2 3 4 5 6 dyadically, ⍴ reshapes right hand side rows columns
  • 38. ⍴ 1 2 3 3 ⍴ (3 2 ⍴ 1 2 3 4 5 6) 3 2 monadically, ⍴ returns shape of argument
  • 39. 3 2 ⍴ 1 2 3 1 2 3 1 2 3 ⍴ recycles elements to fill space
  • 40. 2 2 ⍴ 1 2 3 4 5 6 1 2 3 4 and ignores additional elements
  • 41. 3 3 ⍴ 1 0 0 0 1 0 0 0 1 0 0 0 1 here’s a neat trick to get diagonals :-P
  • 42. ⍴ 2 2 ⍴ 0 1 0 2 2 ⍴ (2 2 ⍴ 0 1 0) 2 2 oh, and APL is read from RIGHT-TO-LEFT
  • 43. ⍴ 2 2 ⍴ 0 1 0 2 2 ⍴ (2 2 ⍴ 0 1 0) 2 2 oh, and APL is read from RIGHT-TO-LEFT
  • 44. +/ 1 2 3 6 btw, / also means reduce ie, reduce over the array [1, 2, 3] with the plus function
  • 45. ×/ 1 2 3 4 5 120 btw, / also means reduce and here’s factorials!
  • 47. Avg ← { (+/ ⍵) ÷ ⍴⍵ } anatomy of a defined function function name assignment function body
  • 48. Avg ← { (+/ ⍵) ÷ ⍴⍵ } Avg 1 2 3 anatomy of a defined function omega ⍵ represents the right argument
  • 49. Diff ← { (+/ ⍺) - (+/ ⍵) } 3 4 5 Diff 1 2 3 anatomy of a defined function alpha ⍺ represents the left argument
  • 50. Plus ← { ⍺ + ⍵ } Plus/ 1 2 3 6 defined functions can be used with / too
  • 52. Xs ← 1 2 3 Xs[2] 2 APL is one-indexed!
  • 53. Xs[1 2 1] 1 2 1 Xs[2 2 ⍴ 1 2] 1 2 1 2 indices can be array too
  • 54. Xs[3 2] ← 6 4 Xs 1 4 6 updating an array
  • 55.
  • 56. ⍳9 1 2 3 4 5 6 7 8 9 index generator
  • 58. 1 < 2 1 1 2 3 < 3 2 1 1 0 0 1 is true, 0 is false yup, works with arrays too ;-)
  • 59. ~1 0 ~1 0 1 0 1 0 monadically, ~ means negate
  • 60. (1 2 3 < 3 2 1) ∧ (1 1 1) 1 0 0 (1 2 3 < 3 2 1) ∨ (1 1 1) 1 1 1 logical AND ∧ and logical OR ∨
  • 61. (⍳10) > 7 0 0 0 0 0 0 0 1 1 1 +/ (⍳10) > 7 3 count no. of positives
  • 62. (⍳10) > 7 0 0 0 0 0 0 0 1 1 1 ⍳10 > 7 ? are these two expression equivalent?
  • 63. (⍳10) > 7 0 0 0 0 0 0 0 1 1 1 ⍳10 > 7 1 are these two expression equivalent? nope! remember, APL reads from RIGHT-TO-LEFT!
  • 64. (⍳10) > 7 0 0 0 0 0 0 0 1 1 1 7 < ⍳10 0 0 0 0 0 0 0 1 1 1 are these two expression equivalent?
  • 66. 1 0 1 / 3 2 1 3 1 1 0 1 / 'iou' i u booleans can be used to as a mask
  • 67. Values ← 1 3 5 7 9 Values > 4 0 0 1 1 1 (Values > 4) / Values 5 7 9 a LINQ-style Where can be written as
  • 68. Values > 4 0 0 1 1 1 ⍳⍴Values 1 2 3 4 5 (Values > 4) / (⍳⍴Values) 3 4 5 and to get the indices instead
  • 69. 1 2 3 ~ 3 4 3 5 1 2 ‘ab’ ‘cd’ ‘ef’ ~ ‘cd’ ‘ef’ ab dyadically, ~ means without
  • 70.
  • 71. 1 1 3 5 3 7 ∊ 1 2 3 1 1 1 0 1 0 'hello world' ∊ 'aeiou' 0 1 0 0 1 0 0 1 0 0 0 dyadically, ∊ checks for membership
  • 72. Phrase ← ‘hello world’ (Phrase ∊ 'aeiou') / Phrase eoo which vowels appeared in a phrase?
  • 73. 2 2 ⍴ 1 2 1 2 1 2 ∊ 2 2 ⍴ 1 2 1 2 1 2 monadically, ∊ flattens a matrix
  • 75. 2 ↑ 1 2 3 4 1 2 2 2 ↑ (3 3 ⍴ ⍳9) 1 2 4 5 ↑ to take items from an array !?
  • 76. 3 3 ⍴ ⍳9 1 2 3 4 5 6 7 8 9
  • 77. 2 2 ↑ 3 3 ⍴ ⍳9 1 2 3 4 5 6 7 8 9 take a 2 (rows) by 2 (cols) matrix
  • 78. 2 ↓ 1 2 3 4 3 4 2 2 ↓ (3 3 ⍴ ⍳9) 9 ↓ to drop items from an array !?
  • 79. 3 3 ⍴ ⍳9 1 2 3 4 5 6 7 8 9
  • 80. 2 2 ↓ 3 3 ⍴ ⍳9 1 2 3 4 5 6 7 8 9 drop first 2 rows and 2 cols
  • 81. ¯2 ↑ 1 2 3 4 3 4 ¯2 ↓ 1 2 3 4 1 2 use negative count to take/drop from end of array
  • 82. ¯2 2 ↑ (3 3 ⍴ ⍳9) ? ¯2 2 ↓ (3 3 ⍴ ⍳9) ? what about these? http://tryapl.org/ try it out yourself
  • 84. 3 3 ⍴ ⍳9 1 2 3 4 5 6 7 8 9 given a matrix
  • 85. 3 3 ⍴ ⍳9 3 2 1 6 5 4 9 8 7 mirrors the matrix horizontally
  • 86. 3 3 ⍴ ⍳9 7 8 9 4 5 6 1 2 3 mirrors the matrix vertically
  • 87. ⍉ 3 3 ⍴ ⍳9 1 4 7 2 5 8 3 6 9 transposes the matrix⍉
  • 90. 1 2 3 .+ 4 5 6 5 6 7 6 7 8 7 8 9 . creates a cartesian product
  • 91. 1 2 3 .× 4 5 6 4 5 6 8 10 12 12 15 18 . creates a cartesian product
  • 92. (⍳3) .= (⍳3) 1 0 0 0 1 0 0 0 1 . creates a cartesian product
  • 93. (⍳3) .< (⍳3) 0 1 1 0 0 1 0 0 0 . creates a cartesian product
  • 94. (⍳3) .⌈ (⍳3) 1 2 3 2 2 3 3 3 3 . creates a cartesian product
  • 95. (⍳3) .+ (⍳3) 2 3 4 3 4 5 4 5 6 . creates a cartesian product
  • 96. what about this? http://tryapl.org/ try it out yourself ∊ (⍳3) .× (⍳5) ?
  • 99. should I learn APL? absolutely! it’s the shock to the system your brain needs
  • 100. is it gonna help my career? does it matter?