Skip to content

Instantly share code, notes, and snippets.

@henrik
Last active March 6, 2016 08:44
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 henrik/a21fc19cb1f8fca445e5 to your computer and use it in GitHub Desktop.
Save henrik/a21fc19cb1f8fca445e5 to your computer and use it in GitHub Desktop.
# 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
Copy link

emson commented Mar 4, 2016

I actually make it 248 characters...

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),?.,10,n<2&&"Go code some more,#{c.(99)}"||"Take one down and pass it around,#{c.(n-1)}",o,?.]end

When I put the contents into a file and run the bash command:

wc -c bottles.exs

Do you make the same?
Thanks

@henrik
Copy link
Author

henrik commented Mar 4, 2016

@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