We are to define the idea of a fixed list as follows:
- A fixed list is a list of fixed lists.
This definition is recursive so it's useful to look at some examples.
- The empty list
[]
is a fixed list. - And list of empty lists is a fixed list. e.g.
[[],[],[]]
- Any list of the above two is also a fixed list. e.g.
[[],[],[[],[],[]]]
We can also think of these as "ragged lists" with no elements, just more lists.
Task
In this challenge you will implement a function \$g\$ which takes as input an fixed list and as output produces a fixed list.
The only requirement is that there must be some fixed list \$e\$, such that you can produce every fixed list eventually by just applying \$g\$ enough times.
For those more inclined to formulae, here's that expressed as symbols:
\$ \exists e : \mathrm{Fixt}, \forall x : \mathrm{Fixt} , \exists n : \mathbb{N}, g^n(e) = x \$
You can implement any function you wish as long as it meets this requirement.
This is code-golf so answers will be scored in bytes with fewer bytes being the goal
g
must be deterministic, right? I can't randomly generate a fixed list and then say that by runningg
enough times you will get any list you want \$\endgroup\$