~statianzo/sevenlangs

ref: c079ef120d60b3abc5051f0dcbdc7d1a3d2c5a1d sevenlangs/erlang/drivers.erl -rw-r--r-- 325 bytes
c079ef12Jason Staten maps and records oh my 2 years 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).