Skip to content

Instantly share code, notes, and snippets.

@cromwellryan
Last active December 19, 2015 18:18
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 cromwellryan/5997317 to your computer and use it in GitHub Desktop.
Save cromwellryan/5997317 to your computer and use it in GitHub Desktop.
defmodule Collections do
def range(start, count), do: range([], start, count)
def range(collection, _current, _count) when _count <= 0, do: collection
def range(collection, current, count) when count > 0, do: collection ++ [current | range(collection, current+1, count-1)]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment