342

Cards (51)

  • Python
    A language that does not have a static type system
  • C
    • Mainly just workarounds with macros or void
  • C++
    • Templates
  • C#
    • Type parameters and interfaces
  • Haskell
    • Polymorphic types and type classes
  • Static type system
    The types of values have to be determined at compile time / before runtime
  • const double rate = 3.5;
    The value rate is bound at compile time
  • double
    The binding of the keyword double to the data type "double" was done at language design time
  • Memory leak
    Created by declaring an int*, assigning it via malloc, then without explicitly deallocating it, assigning it another value from malloc
  • Yield keyword in C# or Python
    Behaves similar to Lazy lists in Haskell
  • Genetic Functions in C++
    Use the template keyword
  • β-reduction
    The main reduction rule of the semantic of the λ-calculus
  • Runtime stacks
    • Enable recursion, unique sets of parameters, unique sets of local variables
  • Heap memory allocation and deallocation
    Occurs on lines 7 and 17 in the provided C program
  • Static memory
    Referred to on lines 10 and 15 in the provided C program
  • Lambda expressions in C++

    • [](auto x){return x * x}
  • Lambda expressions in C#

    • x => x * x
  • Lambda expressions in Python
    • Lambda x: x * x
  • Lambda expressions in Haskell

    • \x -> x * x
  • List [1,2,3] in Haskell
    Syntactic sugar for 1 : 2 : 3 : [] which is equivalent to 1 : (2 : (3 : []))
  • Sort functions in C

    • void qsort(void *a, size_t n, size_t width, int (*comp)(const void *, const void *));
  • Sort functions in Python
    • sorted(iterable[, key][, reverse])
  • Sort functions in C++
    • template<class RandomAccessIterator, class Compare> void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
  • Sort functions in Haskell
    • sort:: Ord a=> [a]->[a]
  • Sort functions in C#
    • public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector);
  • head :: [a] -> a

    The type of the polymorphic Haskell function head
  • length :: Num n => [a] -> n

    The type of the polymorphic Haskell function length
  • max :: Ord a => a -> a -> a
    The type of the polymorphic Haskell function max
  • maximum :: (Foldable t, Ord a) => t a -> a

    The type of the polymorphic Haskell function maximum
  • select & yield
    The C#/LINQ keywords used to implement generators
  • The statement "The stack is usually larger than the heap" is incorrect
  • Translating the C# generator Quux to Python
    • def quux(seq):
    yield 1
    for n in seq:
    yield 5 * n
  • The yield return statement in the C# generator Quux will be invoked 7 times when the provided code is executed
  • The output of the provided C# code using the Quux generator will be: 1, 5, 25, 75
  • Translating the C# generator Quux to Haskell
    • quux xs = 1 : map(5*) xs
  • Evaluating the Haskell λ-expression (\x -> x * x) (1 + 2) in normal order

    1. (\x -> x * x) (1 + 2)
    2. 1 + 2
    3. 3
    4. 3 * 3
  • Evaluating the Haskell λ-expression (\x -> x * x) (1 + 2) in applicative order
    1. 1 + 2
    2. (\x -> x * x) 3
    3. 3 * 3
  • First order predicate logic
    The theoretical foundation of the Prolog programming language
  • The cut
    The language feature used in Prolog to implement "negation as failure"
  • When applying the negation operator \+ in Prolog, the fact that it is not logically complete has to be considered