defmodule ASCII do
def is_printable(charlist) do
charlist
|> Enum.map(&printable?/1)
|> Enum.all?
end
defp printable?(c) do
(32 <= c) and (c <= 126)
end
end
^o^ > iex practice_11_1.exs
Eshell V8.0 (abort with ^G)
Interactive Elixir (1.3.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> ASCII.is_printable('hello')
true
iex(2)> ASCII.is_printable('hello\n')
false