Skip to content

Instantly share code, notes, and snippets.

@johnclaus
Created January 1, 2010 21:58
Show Gist options
  • Save johnclaus/267277 to your computer and use it in GitHub Desktop.
Save johnclaus/267277 to your computer and use it in GitHub Desktop.
Random utility functions
-module(utilities).
-author('John Claus <johnclaus@gmail.com>').
-export([index_of/3]).
% Hacked element index retrieval function which is unavailable in Erlang's stdlib
index_of(_, [], _) -> not_a_member;
index_of(Item, [Item | _], Index) -> Index;
index_of(Item, [_ | T], Index) -> index_of(Item, T, Index + 1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment