goto is to structural programming assignment is to functional programming
- functions have to be pure - don't have side-effect
- does not change anything
- does not depend on anything that changes
- we can pass objects to function
- we can create objects within function
- we can return objects from function
- we can pass function to function
- we can create function within function
- we can return function from function
- java - functional style
- haskel - Purely functional - doesn't allow mutability
- state transformation instead of state mutation
- method is a function which belongs to a class or to an object
- a function has 4 things
- name
- return type
- parameter list
- body
- lambda expression - constraint only two items from above
- (parameter list) -> body
- return type is inferred based on the context
- name - who cares - anonymous
- Re-factoring from external to internal iterator
- internal iterator is polymorphic - applies on the collection/list passed
- type is inferred at compile time
- lambdas which receives the data and simply passes it -- office space pattern => change to method references
- tell me what, not how