¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Higher order functions

CASTILLO ZAMBRANO LUIS FELIPE Español

Higher order functions

Contenido del mapa

Higher order functions

  1. The Haskell functions can take functions as parameters and return functions as return values.

  2. Each function in Haskell officially takes only one parameter

  3. Curried functions

    • put a space between two things is simply the application of the function
    • calling a function with very few parameters, we get a partially applied function
      • Infix functions can also be partially applied through the use of "()" sections
    • partial application
      • alling functions with too few parameters
        • we are creating new functions on the fly
  4. Some higher-orderism is in order

    • Functions can take functions as parameters and also return functions.
    • zipWith
      • Take a function and two lists as parameters and then join the two lists by applying the function between the corresponding elements
  5. Functional programming uses higher order functions to abstract common patterns

  6. Maps and filters

    • map takes a function and a list and applies that function to each item in the list, producing a new list.
    • filter
      • a predicate is a function that says if something is true or not
        • is a function that takes a predicate and a list and then returns the list of elements that satisfy the predicate
      • There's no set rule for when to use map and filter versus using list comprehension
  7. Lambdas

    • Lambdas son básicamente funciones anónimas que se utilizan porque necesitamos algunas funciones solo una vez.
    • we make a lambda with the sole purpose of passing it to a higher order function.
      • Like normal functions, lambdas can take any number of parameters
      • Lambdas are usually surrounded by parentheses
  8. Only folds and horses

    • the folds are very useful functions for the encapsulation
      • scanl and scanr are like foldl and foldr, they only inform all the intermediate states of the accumulator in list form.
    • They are something like the map function, only that they reduce the list to some individual value.
      • The functions foldl1 and foldr1 work much like foldl and foldr, only that it is not necessary to provide them with an explicit initial value.
  9. Function application with $

    • the $ function has the lowest precedence
    • convenience so that we do not have to write so many parentheses
    • sqrt (3 + 4 + 9) or sqrt $ 3 + 4 + 9
  10. Function composition

    • means that composing two functions produces a new function that, when called with a parameter, say, x is the equivalent of calling g with the parameter x and then calling f with that result.
    • Note the type declaration. f must take as parameter a value that has the same type as the return value of g

Imágenes y archivos del mapa

  • Higher order functions
  • Higher order functions
  • Higher order functions
  • Higher order functions
  • Higher order functions
  • Higher order functions
  • Higher order functions
  • Higher order functions

Información

Descripción
Mapa Mental sobre Higher order functions, creado por CASTILLO ZAMBRANO LUIS FELIPE el 18/02/2018.
Visitas
1
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?