Skip to content

Instantly share code, notes, and snippets.

@Betawolf
Created February 23, 2016 14:18
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 Betawolf/c88ec3e0e8be8eb676c6 to your computer and use it in GitHub Desktop.
Save Betawolf/c88ec3e0e8be8eb676c6 to your computer and use it in GitHub Desktop.
Squash a string using filter() and a single call to string()
function squash(str)
lc = 0
return string(filter(str) do x
if x != lc
lc = x
return true
end
return false
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment