Skip to content

Instantly share code, notes, and snippets.

@aybabtme
Created March 14, 2013 22:51
Show Gist options
  • Save aybabtme/5165949 to your computer and use it in GitHub Desktop.
Save aybabtme/5165949 to your computer and use it in GitHub Desktop.
func ones(s bitstring) integer {
if null(s) { return 0 }
else if size(s) == 1 { return s[0] }
else { return s[0] + ones( s[1,end] ) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment