Created
January 1, 2010 21:56
-
-
Save johnclaus/267276 to your computer and use it in GitHub Desktop.
Solution for Kata Two (Karate Chop) http://codekata.pragprog.com/2007/01/kata_two_karate.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(codekata2). | |
-author('John Claus <johnclaus@gmail.com>'). | |
-export([chop/2]). | |
-import(lists, [member/2]). | |
-import(utilities, [index_of/3]). | |
chop(Elem, List) -> | |
case member(Elem, List) of | |
true -> index_of(Elem, List, 0); | |
false -> -1 | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment