Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -module(day2).
- -export([test/1]).
- test(Word) ->
- lists:foldl(match_words, 0, Word).
- match_words(Word, Acc) ->
- Vowels = [$a, $e, $i, $o, $u],
- Closure = fun( X, Acc ) ->
- vowel_match(Word, X, Acc)
- end,
- lists:foldl(Closure, Acc, Vowels).
- vowel_match(Char, Vowel, Acc) ->
- case Char == Vowel of
- true ->
- io:format("Test true? Acc: ~p\n", [Acc]),
- Acc +1;
- false ->
- io:format("Test False? ~p == ~p\n", [Char,Vowel]),
- Acc
- end.
Add Comment
Please, Sign In to add comment