Store a lot less state
This commit is contained in:
parent
3507385d6c
commit
3913522cc3
3 changed files with 49 additions and 70 deletions
|
|
@ -36,12 +36,17 @@ let doesLightHavePowerAfterInteractions light interactions =
|
|||
|> Seq.tryLast
|
||||
|> Option.defaultValue false
|
||||
|
||||
let tryGetLastRemoteInteraction interactions =
|
||||
let tryGetLastBedroomRemoteInteraction interactions =
|
||||
interactions
|
||||
|> Seq.indexed
|
||||
|> Seq.choose (fun interaction ->
|
||||
|> Seq.choose (fun (index, interaction) ->
|
||||
match interaction with
|
||||
| index, Interaction.RemoteInteraction remoteInteraction -> Some(index, remoteInteraction)
|
||||
| Interaction.RemoteInteraction remoteInteraction ->
|
||||
match remoteInteraction with
|
||||
| RemotePressedOnButton
|
||||
| RemotePressedOffButton
|
||||
| RemotePressedLeftButton -> Some(index, remoteInteraction)
|
||||
| RemotePressedRightButton -> None
|
||||
| _ -> None)
|
||||
|> Seq.tryLast
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue