lots of musicposting!!! mostly rock and metal

My last.fm page, @filenine! These are my 5 most recently played songs!


cohost (teehee!)
cohost.org/filenine
going to brazil?
youtu.be/MhtbZ9uZ9_I

filenine-blog
@filenine-blog

Introduction

Haskell is built on functions, and all functions in Haskell can be represented using lambda expressions.

You might remember functions from algebra, like

f(x)=x3
where f is the name of a function that takes in the variable x and outputs the value x3. f is the name, x is the input, and x3 is the output.

The important thing that makes f a function is that if you put the same value in it, you always get the same result. One input cannot give you two different outputs. In other words, a function tells you how to take its input and map it to an output. This is an important concept in functional programming.

In the lambda calculus, this function becomes

λx.x3
which is an abstraction where the part to the left of the dot is the head and the part to the right of the dot is the body. The head has a lambda and an input variable (the argument), while the body has an expression. If a variable in the body's expression appears in the head, it is bound to the head and will take the value of the input argument.

Unlike the named function f(x)=x3, the lambda abstraction λx.x3 doesn't have a name—it's an anonymous function.


filenine
@filenine

I'm working through a Haskell textbook and posting my notes. Check it out from time to time, and please do offer suggestions, corrections, or additions if you have any.


You must log in to comment.
Pinned Tags