Haskell Flashcards
What do you do in imperative programming
Give a computer a sequence of tasks and it executes these tasks. While executing them it can change state.
What do you do in functional programming?
You dont tell the computer what to do but rather what stuff is. You cant change a variable state
What is functional programming?
Haskell is a purely functional programming language, which means it focuses on describing what things are rather than giving the computer a sequence of tasks to perform. In imperative languages, you set up tasks and can change state during execution. However, in Haskell, you express operations as functions that have no side effects, meaning they only calculate and return results. This approach has benefits like referential transparency, ensuring that the same function with the same inputs always produces the same result. This enables reasoning about program behavior, proving function correctness, and building complex functions from simple ones.
What is lazy in Haskell?
Haskell wont execute functions and calculate things unless its really forced to show you a result
What are programas
transformations on data
what is statically typed
the compiler knows which piece of code is a number which is a string and so on
What is in fix notation
calls a functino in infix with ``
If then else
if bool then res else res
Lists are homogenous
Store data of the same type
How a list
denoted by square brackets and the values in a list are separated by commas
Put strings together
++
cons
bEGINNING Of a list :
get element out of a list
!! indices start at 0
head, tail, last, init