You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
325 B
17 lines
325 B
5 years ago
|
-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).
|