On 11/30/06, Huazhi (Hank) Gong [EMAIL PROTECTED] 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.
Hello Huazhi,
Friday, December 1, 2006, 5:04:10 AM, you wrote:
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.
just change your
Like given a string list s=This is the string I want to test, I want to get
the substring. In ruby or other language, it's simple like s[2..10], but how
to do it in Haskell?
--
View this message in context:
http://www.nabble.com/How-to-get-subset-of-a-list--tf2735647.html#a7631994
Sent from the
On Thu, Nov 30, 2006 at 05:47:43PM -0800, Huazhi (Hank) Gong wrote:
Like given a string list s=This is the string I want to test, I want to get
the substring. In ruby or other language, it's simple like s[2..10], but how
to do it in Haskell?
Use take and drop, from the Prelude:
(ghci
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.
Hank
Stefan O wrote:
On Thu, Nov 30, 2006 at 05:47:43PM
On 11/30/06, Huazhi (Hank) Gong [EMAIL PROTECTED] 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.
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
On 01/12/2006, at 12:47 PM, Huazhi (Hank) Gong wrote:
Like given a string list s=This is the string I want to test, I
want to get
the substring. In ruby or other language, it's simple like s
[2..10], but how
to do it in Haskell?
If your indices are in ascending order, and unique, then