Last active
March 6, 2016 08:44
-
-
Save henrik/a21fc19cb1f8fca445e5 to your computer and use it in GitHub Desktop.
Elixir Golf: 99 bottles of beer http://elixirgolf.com/articles/99-bottles-of-elixir/ - https://github.com/emson/elixirgolf/issues/6
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
# 238 chars (newlines count as one char) | |
c=&" #{&1} bottle#{&1>1&&"s"||""} of Elixir" | |
o=" on the wall" | |
for n<-99..1,do: Task.await Task.async fn->IO.puts [inspect(self),c.(n),o,?,,c.(n),". | |
",n<2&&"Go code some more,"<>c.(99)||"Take one down and pass it around,"<>c.(n-1),o,?.]end |
@emson wc -c bottles.exs
tells me 242 – one more for the trailing newline that my editor adds, I think.
Vim g CTRL-G
also agrees, so I'm not sure where the 248 comes from :)
If Windows is somehow involved in this, maybe the newlines become \r\n
, but that should still only add 3 bytes, not 6.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I actually make it 248 characters...
When I put the contents into a file and run the bash command:
Do you make the same?
Thanks