Skip to content

Latest commit

 

History

History
37 lines (35 loc) · 3.47 KB

docs.md

File metadata and controls

37 lines (35 loc) · 3.47 KB

Lambdish Phunctional Docs

Basic functional methods

  • all: Check if all the values of the collection satisfies the function
  • any: Check if any value of the collection satisfies the function
  • apply: Call a function with the desired arguments (a clean way to call closures stored in class attributes)
  • assoc: Associate a value to an array
  • butlast: Returns all the elements of a collection except the last preserving the keys
  • complement: Returns another function that takes the same arguments and has the opposite truth value.
  • compose: Combine multiple function calls in one function
  • dissoc: Dissociate a value of a key in a collection
  • do_if: Returns a callable that will call the given function if the result of applying the callable arguments to the predicates is true for all of them
  • each: Apply a function over all the items of a collection
  • filter: Discriminate the items of a collection for which function is false
  • filter_null: Discriminate the items of a collection for which value is null
  • first: Returns the first element of a collection
  • flatten: Returns a flat collection from a multidimensional collection
  • get: Returns the value of an item in a collection or a default value in the case it does not exists
  • get_in: Returns the value in a nested associative structure or a default value in the case it does not exists
  • key: Returns the key of an item value in a collection or a default value in the case it does not exists
  • instance_of: Returns a checker that validated if an element is an instance of a class
  • last: Returns the last element of a collection
  • map: Apply a function over all the items of a collection and returns an array with the results
  • memoize: Returns a memoized version of a referentially transparent function
  • not: Return the opposite of the function call
  • partial: Fix a number of arguments to a function producing another one with an smaller arity
  • partition: Partition an array into arrays with size elements preserving its keys. The last portion may contain less than size elements.
  • pipe: Takes a set of functions and returns a new one that is the composition of all of them
  • reduce: Returns an accumulated value of iteratively reduce the collection using a function
  • reindex: Returns a new collection with the keys reindexed by a function.
  • repeat: Returns an array with the values of a function executed a certain amount of times
  • rest: Returns all the the elements of a collection except the first preserving the keys
  • reverse: Returns a reversed collection preserving its keys
  • search: Search a value over a collection. Return the first occurrence if found, null if not
  • sort: Sorts a collection using a sorting function
  • some: Check if any value of the collection satisfies the function