Alternatively, getting all (non-unique) subsequences might be good too. The result for input [1 2 1] would be
[[1] [2] [1] [1 2] [1 1] [2 1] [1 2 1]]
I also considered all substrings, but I suppose that can be achieved reasonable well with few, like
_,f{)ew~}
Not particularly golfy, but certainly doable. In fact, getting all subarrays as in subsets can be done from there with :$_&, so getting an operator for subsequences might actually be more useful. I'm not sure how I'd implement that conveniently at the moment.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Alternatively, getting all (non-unique) subsequences might be good too. The result for input
[1 2 1]
would beI also considered all substrings, but I suppose that can be achieved reasonable well with
few
, likeNot particularly golfy, but certainly doable. In fact, getting all subarrays as in subsets can be done from there with
:$_&
, so getting an operator for subsequences might actually be more useful. I'm not sure how I'd implement that conveniently at the moment.