The document discusses implementing untyped λ-calculus in Haskell. It begins with an introduction to λ-calculus, describing it as an important formal system for functional programming that is Turing complete like the Turing machine. It then discusses Church encoding to represent data types like numbers and booleans in λ-calculus, as well as using fixed point combinators like Y combinator to enable recursion. The document aims to explain λ-calculus and how it can be implemented in Haskell.
Webinar: A bi-objective multiperiod fuzzy scheduling for a multimodal urban t...BRTCoE
2015-02-05 by Paula Ávila
Get the video and more info here:
http://www.brt.cl/webinar-a-bi-objetive-multiperiod-fuzzy-scheduling-for-a-multimodal-urban-transport-system
For the last few hack days, I've been developing a small clojurescript application using a stack that is fairly new to me: quiescent and figwheel. At the last hack day I finished the application and deployed it as a pure-ClojureScript application with no server-side Clojure code.
I'll demo my application, and talk about some of the things I learned in the process. We'll also live code a ClojureScript web application from scratch and deploy it using Amazon S3 static hosting in a matter of minutes.
Webinar: A bi-objective multiperiod fuzzy scheduling for a multimodal urban t...BRTCoE
2015-02-05 by Paula Ávila
Get the video and more info here:
http://www.brt.cl/webinar-a-bi-objetive-multiperiod-fuzzy-scheduling-for-a-multimodal-urban-transport-system
For the last few hack days, I've been developing a small clojurescript application using a stack that is fairly new to me: quiescent and figwheel. At the last hack day I finished the application and deployed it as a pure-ClojureScript application with no server-side Clojure code.
I'll demo my application, and talk about some of the things I learned in the process. We'll also live code a ClojureScript web application from scratch and deploy it using Amazon S3 static hosting in a matter of minutes.
My 2013-03-05 Riviera.rb quines talk slides. I'm afraid there's not much left without the speech and live demos.
Quines are programs (or, more generally, concepts) that reproduce themselves. During this talk we explored how they were possible, what they could look like, how to generate them and how to generalize them,
My slides from the Big Data Applications meetup on 27th of July, talking about FlinkML. Also some things about open-source ML development and an illustation of interactive Flink machine learning with Apache Zeppelin.
Check out these exercises: http://de.slideshare.net/nicolayludwig/3-cpp-procedural-programmingexercises
- Procedural Programming
- Predefined and User defined Functions
- Declaration and Definition of Functions
- Procedural and recursive Function Calling
- Namespaces and separated Function Definitions
- A Glimpse of Separated Compilation and Translation Units
In this talk we are going to show how TDD can help us in our daily work. Through a simple set of steps, we will see how it's possible to write a library without working before on any design. In this way, we will try to explain how are the tests who "suggests" us what to do in each state of development, how they make us focus to take baby steps in order to avoid drawbacks like paralysis by analysis.
Maybe you have done some programming katas (or maybe not) but you do not achieve to see what really TDD brings you. Or it is difficult to you see how to apply it in your daily basis. Whatever your level is, the goal of this talk is trying to show how it is possible to get a software emergent design by only applying some basic TDD rules with tiny unit tests.
--
En este evento vamos a mostrar cómo TDD puede ayudarnos en nuestro trabajo diario. Mediante una sencilla serie de pasos, veremos cómo se puede desarrollar una librería sin tener siquiera un prediseño pensado. De igual forma, intentaremos explicar cómo los tests nos van "sugiriendo" qué hacer en cada estado del desarrollo, cómo nos hacen enfocarnos para tomar pequeños pasos y evitar así, por ejemplo, la parálisis por análisis.
Tal vez hayas hecho algunas katas (o no) y no llegas a ver qué te aporta TDD, o no ves cómo aplicarlo a tu trabajo real, o te parece un poco pérdida de tiempo. Sea cual sea tu nivel, el objetivo es intentar demostrarte cómo practicando una técnica de TDD básica a base sólo de tests unitarios es posible conseguir un diseño emergente.
My talk from SICS Data Science Day, describing FlinkML, the Machine Learning library for Apache Flink.
I talk about our approach to large-scale machine learning and how we utilize state-of-the-art algorithms to ensure FlinkML is a truly scalable library.
You can watch a video of the talk here: https://youtu.be/k29qoCm4c_k
Cilk - An Efficient Multithreaded Runtime SystemShareek Ahamed
Cilk is a C-based runtime system for multi-threaded parallel programming.
Cilk guarantees efficient and predictable performance, Lightweight fork and join.
This describes writing command-line processing for Perl scripts. Don't re-invent the wheel - this problem has been solved. Use Getopt::Long or a similar module from CPAN.
This was presented as one of several "lightning talk" mini-presenations at the Silicon Valley Perl (SVPerl) meeting on Thursday, November 12, 2015 where the primary meeting topic was CPAN, the Comprehensive Perl Archive Network with the tag line "Your project is already half done".
My 2013-03-05 Riviera.rb quines talk slides. I'm afraid there's not much left without the speech and live demos.
Quines are programs (or, more generally, concepts) that reproduce themselves. During this talk we explored how they were possible, what they could look like, how to generate them and how to generalize them,
My slides from the Big Data Applications meetup on 27th of July, talking about FlinkML. Also some things about open-source ML development and an illustation of interactive Flink machine learning with Apache Zeppelin.
Check out these exercises: http://de.slideshare.net/nicolayludwig/3-cpp-procedural-programmingexercises
- Procedural Programming
- Predefined and User defined Functions
- Declaration and Definition of Functions
- Procedural and recursive Function Calling
- Namespaces and separated Function Definitions
- A Glimpse of Separated Compilation and Translation Units
In this talk we are going to show how TDD can help us in our daily work. Through a simple set of steps, we will see how it's possible to write a library without working before on any design. In this way, we will try to explain how are the tests who "suggests" us what to do in each state of development, how they make us focus to take baby steps in order to avoid drawbacks like paralysis by analysis.
Maybe you have done some programming katas (or maybe not) but you do not achieve to see what really TDD brings you. Or it is difficult to you see how to apply it in your daily basis. Whatever your level is, the goal of this talk is trying to show how it is possible to get a software emergent design by only applying some basic TDD rules with tiny unit tests.
--
En este evento vamos a mostrar cómo TDD puede ayudarnos en nuestro trabajo diario. Mediante una sencilla serie de pasos, veremos cómo se puede desarrollar una librería sin tener siquiera un prediseño pensado. De igual forma, intentaremos explicar cómo los tests nos van "sugiriendo" qué hacer en cada estado del desarrollo, cómo nos hacen enfocarnos para tomar pequeños pasos y evitar así, por ejemplo, la parálisis por análisis.
Tal vez hayas hecho algunas katas (o no) y no llegas a ver qué te aporta TDD, o no ves cómo aplicarlo a tu trabajo real, o te parece un poco pérdida de tiempo. Sea cual sea tu nivel, el objetivo es intentar demostrarte cómo practicando una técnica de TDD básica a base sólo de tests unitarios es posible conseguir un diseño emergente.
My talk from SICS Data Science Day, describing FlinkML, the Machine Learning library for Apache Flink.
I talk about our approach to large-scale machine learning and how we utilize state-of-the-art algorithms to ensure FlinkML is a truly scalable library.
You can watch a video of the talk here: https://youtu.be/k29qoCm4c_k
Cilk - An Efficient Multithreaded Runtime SystemShareek Ahamed
Cilk is a C-based runtime system for multi-threaded parallel programming.
Cilk guarantees efficient and predictable performance, Lightweight fork and join.
This describes writing command-line processing for Perl scripts. Don't re-invent the wheel - this problem has been solved. Use Getopt::Long or a similar module from CPAN.
This was presented as one of several "lightning talk" mini-presenations at the Silicon Valley Perl (SVPerl) meeting on Thursday, November 12, 2015 where the primary meeting topic was CPAN, the Comprehensive Perl Archive Network with the tag line "Your project is already half done".
The Book of Joshua is the sixth book in the Hebrew Bible and the Old Testament, and is the first book of the Deuteronomistic history, the story of Israel from the conquest of Canaan to the Babylonian exile.
What Should be the Christian View of Anime?Joe Muraguri
We will learn what Anime is and see what a Christian should consider before watching anime movies? We will also learn a little bit of Shintoism religion and hentai (the craze of internet pornography today).
In Jude 17-23 Jude shifts from piling up examples of false teachers from the Old Testament to a series of practical exhortations that flow from apostolic instruction. He preserves for us what may well have been part of the apostolic catechism for the first generation of Christ-followers. In these instructions Jude exhorts the believer to deal with 3 different groups of people: scoffers who are "devoid of the Spirit", believers who have come under the influence of scoffers and believers who are so entrenched in false teaching that they need rescue and pose some real spiritual risk for the rescuer. In all of this Jude emphasizes Jesus' call to rescue straying sheep, leaving the 99 safely behind and pursuing the 1.
Homily: The Solemnity of the Most Holy Trinity Sunday 2024.docxJames Knipper
Countless volumes have been written trying to explain the mystery of three persons in one true God, leaving us to resort to metaphors such as the three-leaf clover to try to comprehend the Divinity. Many of us grew up with the quintessential pyramidal Trinity structure of God at the top and Son and Spirit in opposite corners. But what if we looked at this ‘mystery’ from a different perspective? What if we shifted our language of God as a being towards the concept of God as love? What if we focused more on the relationship within the Trinity versus the persons of the Trinity? What if stopped looking at God as a noun…and instead considered God as a verb? Check it out…
Lesson 9 - Resisting Temptation Along the Way.pptxCelso Napoleon
Lesson 9 - Resisting Temptation Along the Way
SBs – Sunday Bible School
Adult Bible Lessons 2nd quarter 2024 CPAD
MAGAZINE: THE CAREER THAT IS PROPOSED TO US: The Path of Salvation, Holiness and Perseverance to Reach Heaven
Commentator: Pastor Osiel Gomes
Presentation: Missionary Celso Napoleon
Renewed in Grace
The Good News, newsletter for June 2024 is hereNoHo FUMC
Our monthly newsletter is available to read online. We hope you will join us each Sunday in person for our worship service. Make sure to subscribe and follow us on YouTube and social media.
The PBHP DYC ~ Reflections on The Dhamma (English).pptxOH TEIK BIN
A PowerPoint Presentation based on the Dhamma Reflections for the PBHP DYC for the years 1993 – 2012. To motivate and inspire DYC members to keep on practicing the Dhamma and to do the meritorious deed of Dhammaduta work.
The texts are in English.
For the Video with audio narration, comments and texts in English, please check out the Link:
https://www.youtube.com/watch?v=zF2g_43NEa0
The Chakra System in our body - A Portal to Interdimensional Consciousness.pptxBharat Technology
each chakra is studied in greater detail, several steps have been included to
strengthen your personal intention to open each chakra more fully. These are designed
to draw forth the highest benefit for your spiritual growth.
4. Implementing Untyped λ-Calculus
Who Am I?
What I learned?
▶ 2007∼present: (learning) Haskell
▶ 2006∼present: Ruby
▶ 2005∼2008: C++
▶ 2001∼2004: C
4 / 94
23. Implementing Untyped λ-Calculus
What can Haskell do?
Parallelism vs Concurrency?
▶ par-tutorial
▶ Parallelism ̸= Concurrency
16 / 94
24. Implementing Untyped λ-Calculus
What can Haskell do?
Parallelism vs Concurrency?
▶ par-tutorial
▶ Parallelism ̸= Concurrency
▶ Parallelism is not concurrency
16 / 94
25. Implementing Untyped λ-Calculus
What is λ-Calculus?
dummy
▶ What can Haskell do?
▶ What is λ-Calculus?
▶ Why Implement λ-Calculus?
▶ Let's Implement λ-Calculus
▶ Questions?
▶ References
17 / 94
26. Implementing Untyped λ-Calculus
What is λ-Calculus?
What is λ-Calculus?
An important formal system
for functional programming
18 / 94
30. Implementing Untyped λ-Calculus
What is λ-Calculus?
Turing Machine
Turing Machine
▶ Infinite tape which stores symbols (memory)
22 / 94
31. Implementing Untyped λ-Calculus
What is λ-Calculus?
Turing Machine
Turing Machine
▶ Infinite tape which stores symbols (memory)
▶ Finite action table which represents
(state, symbol) → action (program)
22 / 94
32. Implementing Untyped λ-Calculus
What is λ-Calculus?
Turing Machine
Turing Machine
▶ Infinite tape which stores symbols (memory)
▶ Finite action table which represents
(state, symbol) → action (program)
▶ Robotic arm (CPU with a register which stores
current state)
22 / 94
33. Implementing Untyped λ-Calculus
What is λ-Calculus?
Turing Machine
Turing Machine
▶ Infinite tape which stores symbols (memory)
▶ Finite action table which represents
(state, symbol) → action (program)
▶ Robotic arm (CPU with a register which stores
current state)
■ Read the symbol on the tape at current position
22 / 94
34. Implementing Untyped λ-Calculus
What is λ-Calculus?
Turing Machine
Turing Machine
▶ Infinite tape which stores symbols (memory)
▶ Finite action table which represents
(state, symbol) → action (program)
▶ Robotic arm (CPU with a register which stores
current state)
■ Read the symbol on the tape at current position
■ Write a symbol on the tape at current position
22 / 94
35. Implementing Untyped λ-Calculus
What is λ-Calculus?
Turing Machine
Turing Machine
▶ Infinite tape which stores symbols (memory)
▶ Finite action table which represents
(state, symbol) → action (program)
▶ Robotic arm (CPU with a register which stores
current state)
■ Read the symbol on the tape at current position
■ Write a symbol on the tape at current position
■ Move the tape left or right
22 / 94
46. Implementing Untyped λ-Calculus
What is λ-Calculus?
λ-Complete
λ-Complete
▶ So λ-calculus can do anything TM can do
▶ Plus what λ-calculus can do without a TM
32 / 94
47. Implementing Untyped λ-Calculus
What is λ-Calculus?
λ-Complete
λ-Complete
▶ So λ-calculus can do anything TM can do
▶ Plus what λ-calculus can do without a TM
▶ Thus λ-calculus is Turing complete
32 / 94
58. Implementing Untyped λ-Calculus
What is λ-Calculus?
Church Encoding
Natural Numbers
▶ 0 ≡ λf.λx. x
▶ 1 ≡ λf.λx. f x
▶ ...
▶ n ≡ λf.λx. fn x
40 / 94
59. Implementing Untyped λ-Calculus
What is λ-Calculus?
Church Encoding
Computation with Natural Numbers
▶ succ ≡ λn.λf.λx. f (n f x)
▶ plus ≡ λm.λn.λf.λx. m f (n f x)
41 / 94
61. Implementing Untyped λ-Calculus
What is λ-Calculus?
Church Encoding
Computation with Booleans
▶ and ≡ λm.λn. m n m
▶ or ≡ λm.λn. m m n
▶ not ≡ λm.λa.λb. m b a
▶ if ≡ λm.λa.λb. m a b
43 / 94
63. Implementing Untyped λ-Calculus
What is λ-Calculus?
Y combinator
Y combinator
▶ Discovered by Haskell Curry
▶ y = (λf.(λx.f (x x)) (λx.f (x x)))
45 / 94
64. Implementing Untyped λ-Calculus
What is λ-Calculus?
Y combinator
Y combinator
▶ Discovered by Haskell Curry
▶ y = (λf.(λx.f (x x)) (λx.f (x x)))
▶ y f = (λf.(λx.f (x x)) (λx.f (x x))) f
45 / 94
65. Implementing Untyped λ-Calculus
What is λ-Calculus?
Y combinator
Y combinator
▶ Discovered by Haskell Curry
▶ y = (λf.(λx.f (x x)) (λx.f (x x)))
▶ y f = (λf.(λx.f (x x)) (λx.f (x x))) f
▶ y f = f (y f)
45 / 94
67. Implementing Untyped λ-Calculus
What is λ-Calculus?
Fixed Point Combinator
Fixed Point Combinator
▶ Strict languages need some delay
▶ Z = (λx.f (λv.((x x) v))) (λx.f (λv.((x x) v)))
▶ Discovered by Alan Turing
▶ Θ = (λx.λy. (y (x x y))) (λx.λy. (y (x x y)))
47 / 94
68. Implementing Untyped λ-Calculus
What is λ-Calculus?
Fixed Point Combinator
Fixed Point Combinator
▶ Constructed by Jan Willem Klop
▶ Yk = (L L L L L L L L L L L . . .)
where L = λabcdefghijklmnopqstuvwxyzr. (r (thisisafixedpointcombinator))
48 / 94
69. Implementing Untyped λ-Calculus
Why Implement λ-Calculus?
dummy
▶ What can Haskell do?
▶ What is λ-Calculus?
▶ Why Implement λ-Calculus?
▶ Let's Implement λ-Calculus
▶ Questions?
▶ References
49 / 94
71. Implementing Untyped λ-Calculus
Why Implement λ-Calculus?
dummy
▶ My interest in researching
programming languages
▶ Implementing λ-calculus in Haskell
could teach us a lot in
programming languages
50 / 94
72. Implementing Untyped λ-Calculus
Why Implement λ-Calculus?
dummy
▶ My interest in researching
programming languages
▶ Implementing λ-calculus in Haskell
could teach us a lot in
programming languages
▶ It's my most influential Haskell exercise
50 / 94
73. Implementing Untyped λ-Calculus
Why Implement λ-Calculus?
dummy
Let's Learn Haskell The Hard Way
You a Haskell For Great Good!
51 / 94
76. Implementing Untyped λ-Calculus
Why Implement λ-Calculus?
dummy
▶ No parsing here
▶ Parse tree (S-expression) interpreter only
53 / 94
77. Implementing Untyped λ-Calculus
Why Implement λ-Calculus?
dummy
▶ No parsing here
▶ Parse tree (S-expression) interpreter only
▶ Haskell is also good at parsing
53 / 94
78. Implementing Untyped λ-Calculus
Why Implement λ-Calculus?
dummy
▶ No parsing here
▶ Parse tree (S-expression) interpreter only
▶ Haskell is also good at parsing
▶ e.g. parser combinator and parsec
53 / 94
79. Implementing Untyped λ-Calculus
Let's Implement λ-Calculus
dummy
▶ What can Haskell do?
▶ What is λ-Calculus?
▶ Why Implement λ-Calculus?
▶ Let's Implement λ-Calculus
▶ Questions?
▶ References
54 / 94
105. Implementing Untyped λ-Calculus
Let's Implement λ-Calculus
Function Composition
(.) :: (b -> c) -> (a -> b) -> a -> c
.
above60AndDiv2 :: [Integer] -> [Integer]
above60AndDiv2 = div2 . above60
.
above60AndDiv2 [1..65] -- [30,30,31,31,32,32]
80 / 94
106. Implementing Untyped λ-Calculus
Let's Implement λ-Calculus
Function Composition
compose :: (b -> c) -> (a -> b) -> a -> c
compose g f x = g (f x)
81 / 94
107. Implementing Untyped λ-Calculus
Let's Implement λ-Calculus
Curried functions make function composition powerful,
function composition makes curried function even more useful.
82 / 94