welcome back everybody
to a FB 100 max an
and
let's get started by
giving a little bit of the history of functional programming
when we look at languages like Java I
JavaScript its easy to forget that's the concept of functional programming
are actually quite alt and and they were
invented way me for most of us were
even born and and
here she along to church along her church
and in the 1930s developed the long dark chocolate
and he developed along the car crash as a basis
for and mathematics he wanted to confound away
to described the foundations of mathematics
and it's quite remarkable that it turned out
that his work in the 1930s and became
the basis of most of our programming languages today
if you look at .javascript the language that powers the web
an we all know that in JavaScript functions
are very important so one could say
that the web is powered by the long the congress
an job for eight now
as long the expressions and C plus plus have
as long the expression is there is no programming languages in use today
that doesn't support this concept that
alone to church invented in the 1930s if we go
and a little bit more towards
current times in nineteen fifty John McCarty
and develop less analyst was one of the very first
programming languages ever designed but it was also the first
functional programming languages and John McCarty
loss influenced by the lawn the car class but he also
hat an imperative assignment
English so
in some sense you can say that list what's wrong love the
first modern functional languages that combines
and the idea from the pure love the cock less
which song of the impaired it features and from
at programming languages in nineteen sixty
Peter London developed ish when
israel means if you see what I need
and that was the first purer functional languages
french-language based on the lawn the car crash which means
there was no assignment it was only functions
your functions and in nineteen seventies and the night shift the john bacchus
developed FB which stands for
functional programming and Jon Backes
happened to be Bonner designers fortran
which is was designed around the same time
less and watch a very imperative language
and and he designed this new language in the seventies
that emphasizes higher-order functions
and specifically reasoning about programs
so you want to be able to region about the correctness
of your code and FB and
focused on that in the night in the seventies also
Robin Milner and that you see here
developed and now and ml
also was a a hybrid language that
to ideas from pure functional programming but also
allows imperative assignments and
one interesting detail about ml is dead
a.m. hours originally designed as a scripting language
it was designed as a scripting language to allow people to ride
broach when you're writing mathematical proofs there's a lot of boilerplate
a lot of steps that you have to do and in order to how to make that
and Milner and his coworkers develop and now
such that you could write scripts that we do all these tedious
steps for you one of the and
advances of and now and keep in mind is that this was an
the seventies bus type infringe an
so you could ride to function and the compiler would inferno type for you
an and now also had
Baltimore for types or as we call them and
today mostly generic types where you could have
a list of tea and then instantiate the word endorsed rang arm
perhaps even another list et cetera so these concepts of type inference
and generics are actually very old and it
Duke many many decades for decide ears
to move from at academia
into the mainstream in the same
seventies and eighties david Turner an
developed a number of languages starting with special
and KRC and ultimately culminating
in me Rhonda and these were all lazy functional languages
and we will see the difference between lazy
and strict from show languages later in this course
but david Turner has been extremely influential because
an has called their language that were using in this course
is also a lazy language and it's built
on and much of the work that david Turner has done
on Iran that special and KRC my first French language
ever when I started to study computer science
in the eighties loss at all am so I still
have a special place in my heart for satchel
an an we'll definitely caviar have a look
and one of the later sessions have a deeper look at
session because special in some sense is the mother
of at school
talking about has come an around
an 1987 an
a group of researchers programming language researchers functional language
researchers
and started to the development of Haskell and the idea Ross to
build a standard language that people could use to experiment
an because if you want to experiment with Jay and you type system
it's a lot of work to build the whole infrastructure
of the language departure and chat track for all you want to do
is to study this new type system
now has got sometimes been called
a pager dish for programming language research
and it has served at goal and there's been written many many papers
a.m. where Haskell is used an
as the ship straight to do experiments am but also has school has been quite
successful as a language by itself
and haskell will also be
the language that we will use and ish course and 2003
an scan interesting an
the Haskell 98 report just published so that was quite some years
after an the language Ross finished
and goal of Haskell 98
loss to define stable version of the language
haskell being this research vehicle
has a lot of extensions and in order to make this language
and you now used in the mainstream
the idea Ross that we needed a stable version of the language
that only had features that were
consistent and finished message that people could rely on them
in the meantime ask all have got
evolving but in this course where gonna will be staking
22 has gone 98 subject but
if you're using GHz as you'll see in the next lecture GHz
as many extensions an but that
is
an a topic for a future course the advanced features
we will stick do just Haskell 98
if we look
at this stage of Haskell today and there is the Haskell platform
which you can download and course website will have all the information
about that at the course website of course will also have information
about other ways to run haskell programs
and links to other languages that you can use to do the exercises
but the Haskell platform provides and implementation of the Haskell language
last standard libraries for the major platforms Windows Mac
and Linux and haskell
this Haskell platform is used all across the industry
an to deliver real software
and also as we'll see and
you can seed influence of Haskell on other language
let's finish here
with a small haskell program and
to show the conciseness of Haskell
and this program here
an but it does
is it short list using the quick short algorithm
so here's the go 10 let's go to read and
after a few lectures you will be able to write code like this: yourself
so the first thing when we do it when we shortlist
is dead when we have the ante last that's the first case here
we want to short to the empty list well
the result is the empty list and delicious already sorted
so now the next step here says that if we have a list
excess that starts with value axe
what we do is we first
take all the elements a that are less than axe
we put them in the list goldwater's then we take
all the values be that are larger than X we put them in the list
C
and then what we do is read recursively short
at ads are short twice with the function f
so all the values that are less than X
will be sorted then we short all the values that are larger than X
that was he and then we concatenate
at these two lists wit X in the middle
and you can easily see that
and the affect of this recursion
college that we now get a short list now
to warn you this program
just shows you the algorithmic structure
of quick short Asia it shows you the recursive decomposition
of the shorting the real quick short in an impaired
language doesn't create new lists like here
Sardis to list but it take a single list and mute HD values in place
said only uses the space of that single list
an but still I know if you want to and
study the algorithmic structure quick short
this program is quite elegant an
but of course we started with this program and then we may want to
implement that
in a more efficient way by mutating state
so thank you very much
this was the end of the first lecture and happy hacking
where the exercises and on the website
and see you next week for lecture 2: