1/11
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
What Is A Pure Function?
A function whose return value depends only on its arguments, with no side effects
Actions that affect the external state of a program, such as modifying a global variable or performing I/O
What Is The Primary Advantage Of Immutable Data Structures?
They prevent unexpected changes to values, eliminating aliasing issues and making code easier to reason about
What is a list comprehension?
A concise way to create lists by applying an expression to each element of a sequence, optionally filtering elements
What is the difference between using if at the end of a comprehension versus within the expression part?
At the end, if acts as a filter, removing elements - within the expression, it conditionally evaluates to one of two values for each element, without changing the number of elements
What is a closure?
A function that “closes over” variables from its enclosing scope, remembering them even after the outer function has finished executing
What is reduce used for?
To apply a two-argument function cumulatively to the items of a sequence, reducing it to a single value
What does zip do?
It takes multiple sequences and returns an iterator of tuples, where the i-th tuple contains the i-th element from each of the input sequences
What is a lambda expression?
An anonymous function defined using the lambda keyword, typically used for short, one-off functions within an expression
What is recursion essential in pure functional programming?
Because pure functional programming avoids mutable variables and loops, recursion is the primary mechanism for repeating operations
Data Flow Model
Functions are nodes, data as edges - powers parallel systems
nonlocal Purpose
Modify a variable in an outer (non-global) scope from within a nested function
Recursive Function Structure
Base Case: Trivial solution, stops recursion
Recursive Step: Call itself with modified args, moving towards base case