Is there a built in function or convention for when you want to do combinations of states concisely?
Given the following:
{
animal: [:dog, :cat],
disposition: [:grumpy, :hungry, :sleepy]
}
I want to make:
[
{animal: :dog, disposition: :grumpy},
{animal: :dog, disposition: :hungry},
{animal: :dog, disposition: :sleepy},
{animal: :cat, disposition: :grumpy},
{animal: :cat, disposition: :hungry},
{animal: :cat, disposition: :sleepy}
]
taking any number of input states, i.e. more than 2.
Others must have solved this before me in an elegant fashion?
Python has an array way of doing it here