~statianzo/sevenlangs

sevenlangs/erlang/words.erl -rw-r--r-- 277 bytes
2fcd4511Jason Staten day one logic style 1 year, 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
-module(words).
-export([count/1]).

count(S) -> count(S, true, 0).

count("", _, Total) -> Total;
count([$ |Tail], _, Total) -> count(Tail, true, Total);
count([_|Tail], false, Total) -> count(Tail, false, Total);
count([_|Tail], true, Total) -> count(Tail, false, Total + 1).