Skip to content

Instantly share code, notes, and snippets.

@suissa
Created February 22, 2020 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suissa/4dbc9a87397faedf54cbb52a83c4e413 to your computer and use it in GitHub Desktop.
Save suissa/4dbc9a87397faedf54cbb52a83c4e413 to your computer and use it in GitHub Desktop.
Demonstração de como criar operações básicas de matemática usando Arrays - divisão - refatorando
const tamanhoDa = (lista) => lista.length
const atéEncontrarOTotal = (total, x ) => n => (total += n) <= x
const dividir = (x, y, total = 0) =>
tamanhoDa(
crieUmaListaDeTamanho(x)
.ePreenchaCom(y)
.filter( atéEncontrarOTotal(total, x) )
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment