Skip to content

Instantly share code, notes, and snippets.

@mlankenau
Created November 25, 2015 16:19
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 mlankenau/77e10eb3dcce210ecc36 to your computer and use it in GitHub Desktop.
Save mlankenau/77e10eb3dcce210ecc36 to your computer and use it in GitHub Desktop.
prims = Stream.unfold({2, []}, fn {next, list} -> if(Enum.any?(list, &(rem(next, &1) == 0)), do: {nil, {next+1, list}}, else: {next, {next+1, [next|list]}}) end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment