by galaxyLogic · 3y ago · 0 comments
Use |> for the Hack proposal
and -> for F# -style.
const slowSum = (lst: {x: number}[]) =>
switch(list) {
[{x}, ...y] -> x + slowSum(y) //not tail recursive
[{x}, {x: y}] -> x + y //alias second x to y
[{x}] -> x //handle length 1
[] -> 0 //handle length 0
}|> is the best operator