Hasty Briefsbeta

Functions Are Asymmetric

a day ago
  • #asynchronous functions
  • #functional programming
  • #C++
  • Functions in programming typically return one value, even if they take multiple arguments.
  • Functional programming languages like Haskell treat functions as always taking one argument and returning one value, using currying.
  • Synchronous functions are asymmetric because they can take multiple arguments but return only one value.
  • Asynchronous functions can be designed to handle multiple values both as input and output, restoring symmetry.
  • The `call_by_need` function is proposed to apply functions to arguments flexibly, trying different argument combinations.
  • A symmetric `then` function for asynchronous operations can accept multiple functions, each contributing to the output.
  • Allowing `then` to handle multiple functions enables returning multiple results or no results, enhancing flexibility.