Uploaded by ishaankapoor004

COMP1100

advertisement
COMP1100
Week 1
Sets
no order
no multiplicity
Strings are finite lists
no restriction of membership.
these are ordered.
Set of strings is infinite.
In product of sets sets can be finite or infinite
elements.
product contains every possible combo of
Union is a or b or in both.
Disjoint unions
In this course we use left right.
Function
every element of domain is related to an element of codomain
Id is identity function
Zero/1/true etc
Projection
does nothing gives back same thing.
constant function takes whatever and gives a constant value.
can be right or left projection
Injection is on sum set so every element of sum set contains left or right in it. So if we get output
only a left or right it’s called injection.
run g first then f
called function of functions.
“F is a function from A->B” it meant A->B was a set of functions.
Rest slides confusing please refer google
LAB01
Note that all file names in Haskell begin with a capitalised letter.File that we created in lab01
folder Area.hs.
addOne :: Integer -> Integer
is type signature of function.
areaRect :: Integer -> Integer -> Integer
areaRect ln br = ln*br
highlighted is input, separated by commas.
LAB 01
Decimals can be denoted by float or double.
In this course we use double. DON’T USE FLOAT.
WEEK 2
Download