Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Haskell - A brief introduction
Search
MetaBroadcast
June 13, 2012
Programming
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Haskell - A brief introduction
Talk given by Fred van den Driessche on 13-06-2012 at MetaBroadcast.
MetaBroadcast
June 13, 2012
Transcript
14 slides
Haskell A Brief Introduction
Pure Functional Lists Lazy • • •
Built-in Types Numbers: 1, 1.234 Booleans: True, False Characters/Strings: 'a',
"asdf" Lists: [1,2,3] Tuples:("jim", 25) • • • • •
Functions double x = 2 * x > double 5
10
Control max x y = if x > y then
x else y max x y | x > y = x | otherwise y
Lists [] 1 : [2, 3] = [1, 2, 3]
[1, 2] ++ [3, 4] = [1, 2, 3, 4] head [1, 2, 3] = 1 tail [1, 2, 3] = [2, 3]g • • • • •
Pattern Matching dblAll [] = [] dblAll (x:xs)= double x
: dblAll xs
Higher-order functions > map double [1, 2, 3] [2, 4,
6] map f [] = [] map f (x:xs) = f x : map f xs
Function Types > :t double double :: Num a =>
a -> a > :t (*) (*) :: Num a => a -> a -> a > :t map map :: (a -> b) -> [a] -> [b]
Currying > :t (*) (*) :: Num a => a
-> a -> a > :t (2*) (2*) :: Num a => a -> a double = 2* dblAll = map (2*)
Data Types data Bool = True | False data Maybe
a = Just a | Nothing data Either a b = Left a | Right b data Tree a = Empty | Node a (Tree a) (Tree b ) • • • •
yesOrNo True = "yes" yesOrNo False = "no" traverse Empty
= [] traverse (Node v l r) = (traverse l) ++ v : traverse r
Laziness fib c n = c : fib n (c
+ n) > fib 0 1 [0, 1, 1, 2, 3, 5, 8, 13, 21 ... > take 5 (fib 0 1) [0, 1, 1, 2, 3]
Laziness > (fib 0 1) !! 900 54877108839480000051413673948383714443800
More Decks by MetaBroadcast
See All by MetaBroadcast
PhotoGlut
metabroadcast
2
400
Machine learning: boldly going where Twitter's APIs don't
metabroadcast
0
160
monitoring: it gets better
metabroadcast
1
610
The ABCs of MetaBroadcast APIs
metabroadcast
0
270
APIs for app developers
metabroadcast
1
170
Polishing Varnish
metabroadcast
0
850
Atlas - 3.0 to 4.0
metabroadcast
0
270
Atlas - owl vs deer
metabroadcast
0
270
Storm - an overview
metabroadcast
0
150
Other Decks in Programming
See All in Programming
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
140
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
220
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
330
React Native에 현대적인 빌드 도구 더하기: Rollipop 구현기
leegeunhyeok
0
180
AI Augmentation Techniques with Liberty
ivargrimstad
1
440
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
120
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
260
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
310
Crash Auto Pipelines
veronikapj
1
410
Performance Optimization With LLMs
xleitix
0
250
Railsバージョンを4倍にした話
optim
0
1k
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
330
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
630
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
Marketing to machines
jonoalderson
1
6k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
660
Building Applications with DynamoDB
mza
96
7.3k
30 Presentation Tips
portentint
PRO
1
470
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
430
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k