FlashKeepers

Programming Concepts · College · College and University

Functional Programming Fundamentals

Pure functions, immutability, higher-order functions, currying, monads, functors, recursion and referential transparency.

About this set

39 basic cards for College Programming Concepts. It opens with "What is a pure function?" and "Name one benefit of using pure functions". Study it alongside the other College sets below.

39 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is a pure function?
Show answerA function that always produces the same output for the same input and has no side effects.
Name one benefit of using pure functions.
Show answerThey are easier to test, reason about, and parallelize because they have no hidden dependencies.
What is a side effect in programming?
Show answerAny observable change outside the function other than its return value, such as modifying global state or performing I/O.
Define referential transparency.
Show answerA property where an expression can be replaced with its resulting value without changing program behavior.
Why does referential transparency matter in functional programming?
Show answerIt enables equational reasoning about code, making programs easier to understand, optimize, and refactor.
What is immutability?
Show answerThe property that data cannot be changed after creation; instead, operations return new copies with modifications.
Name one advantage of immutable data structures.
Show answerThey eliminate bugs from unintended mutations, simplify concurrent programming, and enable effective memoization.
What is a higher-order function?
Show answerA function that takes one or more functions as arguments or returns a function as its result.
Give an example of a higher-order function that returns a function.
Show answerA function that returns a customized function, such as a function factory or a decorator.
What are first-class functions?
Show answerFunctions treated as values: they can be assigned to variables, passed as arguments, and returned from other functions.
Define currying.
Show answerThe transformation of a function with multiple parameters into a series of single-parameter functions.
What is one benefit of currying?
Show answerIt enables partial application, allowing you to create specialized functions by fixing some arguments.
What is partial application?
Show answerThe process of fixing some arguments of a function to create a new function with fewer parameters.
How does partial application differ from currying?
Show answerCurrying is a language feature that transforms multi-argument functions into nested single-argument functions; partial application is the practice of fixing some arguments.
What is recursion?
Show answerA function calling itself to solve a problem by breaking it into smaller instances of the same problem.

24 more cards in the app

Study this set free