Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Given a list of lists, how to drop the last item in each
(sub)list. (Angus Comber)
----------------------------------------------------------------------
Message: 1
Date: Thu, 2 Jan 2014 11:38:59 +0000
From: Angus Comber <[email protected]>
To: Haskell Beginners <[email protected]>
Subject: [Haskell-beginners] Given a list of lists, how to drop the
last item in each (sub)list.
Message-ID:
<caatguhwbfaj8jvfecmzamrog7gqfmbjc5pws+3eqk+qh3pr...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
I have a list like this:
[[1,0,0,0,1,1,1,0,0],[1,1,1,0,1,1,1,0,0],[1,0,1,0,0,1,1,0,0],[0,1,0,0,1,1,1,0,0],[0,0,1,0,1,1,1,0,0],[1,0,0,1,1,1,1,0,1]]
The 'inner' list is a list of 9 items. I want to process the list so that
a list of lists is returned but the 9th element in each inner list is
dropped.
So the function type would be [[a]] -> [[a]]
So to get started I wrote a function like this:
discardparitybyte :: [[Bit]] -> [[Bit]]
But then not sure how to transform the inner list.
I know I can access the first inner element using take 1 list. But how do
I then access/manipulate this inner list?
discardparitybyte (x:xs) = take 9 ??? (take 1 xs) : discardparitybyte ???
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140102/02343f1f/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 67, Issue 2
****************************************