diff --git a/exercises/practice/secret-handshake/.meta/examples/secretHandshake.example.u b/exercises/practice/secret-handshake/.meta/examples/secretHandshake.example.u index 3144b99..c40ace1 100644 --- a/exercises/practice/secret-handshake/.meta/examples/secretHandshake.example.u +++ b/exercises/practice/secret-handshake/.meta/examples/secretHandshake.example.u @@ -13,11 +13,15 @@ secretHandshake.commands encodedMessage = match and message 16 != 0 with true -> cmds false -> List.reverse cmds - [ - (1, List.cons Wink), - (2, List.cons DoubleBlink), - (4, List.cons CloseYourEyes), - (8, List.cons Jump) + + commands : [(Nat, [Command] ->{} [Command])] + commands = [ + (1, acc -> List.cons Wink acc), + (2, acc -> List.cons DoubleBlink acc), + (4, acc -> List.cons CloseYourEyes acc), + (8, acc -> List.cons Jump acc) ] + + commands |> List.foldLeft collectCommand [] |> reverseOrNot encodedMessage