Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- spec_max([]) -> 0;
- spec_max(List) ->
- IndexList = [ Elem || Elem <- lists:seq(1,length(List))],
- spec_max(List, IndexList, []).
- spec_max([H|T], [H1|T1], List) ->
- NewList = List ++ [{H1,{H}}],
- spec_max(T,T1,NewList);
- spec_max([], [], List) -> find_max(List).
- find_max(List) ->
- Value = [ Elem || {Index,{Elem}} <- List],
- Max = lists:max(Value),
- IndexMax = [ Index || {Index,{Elem}} <- List, Elem == Max],
- lists:nth(1, IndexMax).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement