[Haskell-cafe] How to get subset of a list?
Dan Weston
westondan at imageworks.com
Thu Nov 30 21:15:40 EST 2006
Your curious example suggests you might be solving a more specialized
problem, like selecting the diagonal of a flattened matrix. In this
case, there are much better (and more efficient) data structures that
enforce invariants (like squareness of a matrix), if that is what you in
fact are doing.
Taral wrote:
> On 11/30/06, Huazhi (Hank) Gong <hankgong at nm.gist.ac.kr> wrote:
>> Thanks, it make sense here.
>> However, like I want to choose s[1,3,6,10] or something like this. Are
>> there
>> some straightforward function or operator for doing this job? The !!
>> operator in haskell seems does not support multiple indecies.
>
> If you're trying to do random access on a list, you should rethink why
> you're using a list.
>
More information about the Haskell-Cafe
mailing list