Skip to content

Instantly share code, notes, and snippets.

@pazthor
Created May 8, 2020 01:37
Show Gist options
  • Save pazthor/0c5414537788e5408cb1a45f0354e84c to your computer and use it in GitHub Desktop.
Save pazthor/0c5414537788e5408cb1a45f0354e84c to your computer and use it in GitHub Desktop.
//fsx
// sumar una lista de elementos elevados al qubo
let square n= n*n
let alCubo n = (square n) * n
alCubo (-3)
alCubo (abs -3)
let list = [1;2;3;4]
let list' = [-2 .. 2]
let result = list |> List.map alCubo |> List.sum
let result' = list|> List.sumBy alCubo
let result''= list' |> List.map abs |> List.sumBy alCubo
@edgarsanchez
Copy link

Interesante detalle ese de cubo n = (square n) * n 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment