What is functional programming Flashcards
Define functional programming
Style of programming in which baisc method of computation is the application of functions to arguments
what did FP bring along
new reasoning principles new abstractions new design patterns new algorithms elegant code
Examples of FP commercial applications
Integrated circuit design (recursion)
natural language processors
robotic controllers
problems with programming languages
fundemental issue - many program languages were designed decades ago and havent significantly changed - designed for old architectures
What are imperative languages
algorithms are expressed by a sequence of commands
- high level ones express compurtations ina hardware independent way
What are side effects
large and complete software systems have side effects - those that occur in one subprogram can affect things other places. Can be brought about by variable assignment
Concurrency vs parallelism
conc - single cpu multitasking
parallelism - speed up via N computations in parallel
Functional concurrency
indirect references to immutable data structures
- concurrency semanticcs for those references
- automatic/enforced
- no locks in user code
why functional programming?
states are immutable
functions are pure and referentially transparent - can’t have side effects
recurion
first class citizens and higher order functions are used extensively
Benefits of functional programming
auto storage management
improves reability
enhances programmer productivity
facilitates code reuse
Software crisis - describe
bugs are common and widely accepted
putchasing new versions and pathces are also accepted
hardware is now cheaper
most softeare is still unreliable, unmanageable and unprovable
Computer science solutions to software crisis
Software engineering now proof tecniques to prove correctness parallel processing automated SE quantum computing