~statianzo/sevenlangs

sevenlangs/erlang/drivers.erl -rw-r--r-- 325 bytes
2fcd4511Jason Staten day one logic style 1 year, 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-module(drivers).

-record(person, {name, fastest_time = 0.0}).

-export([champion/1]).

fastest(A, B)
    when A#person.fastest_time < B#person.fastest_time ->
    A;
fastest(_, B) -> B.

champion(Drivers) ->
    lists:foldr(fun fastest/2,
		#person{name = "Ghost",
			fastest_time = 9.99989999999999963620e+3},
		Drivers).