• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/30

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

30 Cards in this Set

  • Front
  • Back
What is a functional language? (in contrast to procedural)
Languages that don't concern themselves with state and memory locations. Instead, they work exclusively with values, and expressions and functions which compute values.

The resulting programs are more declarative than procedural ones; i.e. they describe what is to be computed rather than how it should be computed.
What are the 3 primary characteristics of the functional paradigm?
1. Functions are first-class values
2. Higher-order functions
3. Repetition is expressed as recursion (rather than iteration).
What order of evaluation is used in functional languages?
Normal (lazy) order. Expressions are evaluated only when needed. This allows us to build infinite data structures, where only the parts we need are actually constructed.
What is call-by-name evaluation?
The arguments to functions are not evaluated at all — rather, function arguments are substituted directly into the function body
What order of evaluation is used in imperative languages?
Applicative order, an evaluation strategy in which the arguments of a function are evaluated as they are encountered.
What is call-by-value?
An evaluation strategy in which the argument expression is evaluated, and the resulting value is bound to the corresponding variable in the function
What is call-by-reference?
An evaluation strategy in which a function is passed an implicit reference to its argument rather than the argument value itself.
What is copy-restore?
A special case of call-by-reference where the provided reference is unique to the caller. If a parameter to a function call is a reference that might be accessible by another thread of execution, its contents are copied to a new reference that is not; when the function call returns, the updated contents of this new reference are copied back to the original reference ("restored").
How does applicative order treat function terms?
Reduces terms within a function body as much as possible before a function is applied.
What is partial evaluation?
An evaluation strategy in which any sub-expressions that do not contain unbound variables are evaluated, and function applications whose argument values are known may be reduced.
What is encapsulation?
It is both information hiding and protection.
What is overriding?
A type of polymorphism in which a child class overrides the method implementation of the parent class.
What is polymorphic coercion?
A type of polymorphism in which a primitive or object type is cast into being another primitive type or object type.
What is parametric polymorphism (method overloading)?
A type of polymorphism in which a class or classes implement methods that are the same except for the parameters passed to the method. Same name, different signatures.
What is abstraction?
An object-oriented concept which includes both inheritance and composition. With inheritance it involves working at the appropriate level of detail from dog to Lassie. With composition it involves breaking the object into parts such as a car is a body, wheels, seats, etc.
What are operational semantics?
Mathematically rigerous definition of the program functionality, such as lamda calculus. Permits formal analysis of a language through a state transition system.
What are denotational semantics?
A mathematical description of the meaning of a program.
What are axiomatic semantics?
A mathematically rigorous way of validating a program.
5 principles of oo programming
1. Objects

2. Abstraction
Composition

3. Polymorphism
Overloading/overriding

4. Inheritance
Subclassing

5. Encapsulation
Information hiding
Abstraction
Primarily defined by composition. A car is made up of a body, tires, and an engine.
Polymorphism
One name different meanings. Breaks down into overloading and overriding.
Overloading
Reusing the same name of a method with different parameters.
Overriding
Reusing the same method name in subclasses so that the subclass can perform a specific activity with that method.
Decoupling
Preventing interdependencies between objects.
Inheritance
Subclassing. Reusing all the abilities of parent classes in the child classes.
Encapsulation
Information hiding. Restricting access to the internal structure of an object.
Modularity
Allowing the reuse of code by creating modules that perform specific functions.
Three properties of a first class value
1) Passed as a parameter
2) Returned from a subroutine
3) Assigned to a variable
Higher-order function
Takes a function as an argument or returns a function as a result
How can we get "infinite" data structures in functional languages?
Using lazy evaluation (similar to normal order) and functions as first class values. For example, if we want a list of all the prime numbers, we can create it dynamically. We could store the structure as a list of prime numbers, with the last number being a function that generates the next prime number.

If, in general, only the first 5 prime numbers are used, this is efficient, and still handles cases where the first thousand prime numbers are used. In effect, we have ALL of the prime numbers, even though we're only storing a finite set at a time.