Skip to content

Instantly share code, notes, and snippets.

@johnclaus
Created January 1, 2010 21:56
Show Gist options
  • Save johnclaus/267276 to your computer and use it in GitHub Desktop.
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
-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