1. If seen was not given, let seen be a new empty set.

    2. If input is in seen return invalid.

    3. Jump to the appropriate step below:

      If (input) is Number

      1. If input is NaN then return invalid.

      2. Otherwise, return a new key with number and value input.

    For example, the value [10, 20, null, 30, 20] is converted to an with subkeys 10, 20, 30.