$cat~/glossario/first-class-function.md

First-Class Function

Programação Funcional

Funções são valores: atribuíveis, passáveis e retornáveis.

first-class-function.mdmarkdown
01

seção

Explicação

First-Class Function — Funções são valores: atribuíveis, passáveis e retornáveis.

Funções são valores: assign variable, pass arg, return, store data structure.

Base de JS functional style vs Java pre-lambda.

02

seção

Exemplo

snippetJavaScript
const ops = { add: (a, b) => a + b, sub: (a, b) => a - b };
03

seção

Modo de uso

  • Strategy table dispatch

  • Callback registration

  • Module export function

04

seção

Armadilhas comuns

  • Naming vs referencing

  • this binding when extracted method

05

seção

Termos relacionados