Functional programming
No description yet. This curated deck is ready for daily study.
Card preview (16)
what are integers
numbers with their negative counterparts including zero ( -1 . -2, -3 , 0 , 1 2 3 )
what are domain
A set of which the function input are chosen
What is codomain
This is the set of which output from a functionional programming
What are natural numbers
Start with 0 upward 1 , 2 , 3 ,4
What is rational numbers
This can represent fractions
What is irrational number
This cannot be represented as a fraction
WHat is high order functions
Functions that take a function as an argument or returns a functions as a result or both
What is map
Takes a second function and applies the list of elements before returning the new list
WHat is fold
Reduces the list to a single value
What is filter
Returns the elements of the list to adhere to the condition given
Features of a functional program
High order function Immutable Stateless
Describe how the total function works to add up all of the numbers in a list. total [] = 0 total (x:xs) = x + total (xs)
It uses recursion It splits the list to an head and tail The recursion ends when the list is empty
What is a first class object
This are objects that appear in an expression , be assigned to a variable or arguement. They can be passed as an argument or returned as the result of another function e.g integers , floating points, characters and strings
What is partial function application
A function can take only one input. one of the arguement is fixed , leading to a more restricted and specialised function
what is functional composition
This is the act of combining two functions to create a new function.
What is the benefits of functional compostion
The user is able to use the functions separately and in conjuction as long as they both share the same domain and range