Generalisation of wantarray
