Skip to content

Instantly share code, notes, and snippets.

@cheeyeo
Forked from sgrif/gist:7574451
Created August 16, 2014 10:48
Show Gist options
  • Save cheeyeo/b639d0e3b75dac94367e to your computer and use it in GitHub Desktop.
Save cheeyeo/b639d0e3b75dac94367e to your computer and use it in GitHub Desktop.
z = fn
f -> fn
x -> f.(fn y -> x.(x).(y) end)
end.(fn
x -> f.(fn y -> x.(x).(y) end)
end)
end
add_squares = z.(fn
f -> fn
[n|ns] -> n*n + f.(ns)
[] -> 0
end
end)
IO.puts "#{add_squares.([1, 2, 5])}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment