Skip to content

Instantly share code, notes, and snippets.

@nurugger07
Created July 9, 2015 14:41
Show Gist options
  • Save nurugger07/6e70d64975b4b640c0b4 to your computer and use it in GitHub Desktop.
Save nurugger07/6e70d64975b4b640c0b4 to your computer and use it in GitHub Desktop.

Problem: 02

Write a function num_to_list/1 that takes a number and returns a string from 1 up to the number joined with commas, e.g:

num_to_list(10) #=> "1,2,3,4,5,6,7,8,9,10"

How about:

def num_to_list(n), do: 1..n |> Enum.join(",")

Problem 2 solution from elixirexperince.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment