Advertisement
Guest User

Untitled

a guest
Apr 1st, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.61 KB | None | 0 0
  1. -record(monitor, {stations, measurements}).
  2. -record(measurement, {date, type, value}).
  3. -record(station, {name, coords}).
  4.  
  5. createMonitor() ->
  6.   #monitor{stations = #{}, measurements = #{}}.
  7.  
  8. addStation(Monitor, Name, Coords) ->
  9.   {monitor, Stations, Measurements} = Monitor,
  10.   Station = #station{name = Name, coords = Coords},
  11.   maps:put(Name, Station, Stations),
  12.   maps:put(Coords, Station, Stations),
  13.   maps:put(Station, [], Measurements),
  14.   {monitor, Stations, Measurements}.
  15.  
  16.  
  17. z takim dodawaniem też nie działa :( :
  18.  Stations#{Name => Station, Coords => Station},
  19.   Measurements#{Station => []},
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement