Last active
December 19, 2015 18:18
-
-
Save cromwellryan/5997317 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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