<div class="gmail_quote">Let's see... </div>
<div class="gmail_quote"> </div>
<div class="gmail_quote">cinits [] = [[]]<br>cinits (hd:tl) = [] : [ hd : rest | rest <- cinits tl ]</div>
<div class="gmail_quote"> </div>
<div class="gmail_quote">Well, ehm, I'm trying to understand "map" in "map" functions, however I do understand list comprehensions. But I don't think I can write "any" "map" in "map" function into a list comprehension can I?</div>
<div class="gmail_quote"> </div>
<div class="gmail_quote">2009/4/14 Daniel Fischer <span dir="ltr"><<a href="mailto:daniel.is.fischer@web.de">daniel.is.fischer@web.de</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Am Dienstag 14 April 2009 10:39:28 schrieb Tsunkiet Man:<br>
<div class="im">> Hello,<br>><br>> I can hardly imagine how the following code works:<br>><br>> cinits :: [a] -> [[a]]<br>> cinits [] = [[]]<br>> cinits (x:xs) = [] : map (x:) (cinits xs)<br>><br>
> can someone give me a good explaination?<br><br></div>Perhaps it's easier to follow as a list comprehension:<br><br>cinits [] = [[]]<br>cinits (hd:tl) = [] : [ hd : rest | rest <- cinits tl ]<br>
<div>
<div></div>
<div class="h5"><br>><br>> (I understand it a bit, but it's really hard for me to figure out how a map<br>> in a map function works.)<br>><br>> Thank you for your time,<br>><br>> Tsunkiet<br><br>
</div></div></blockquote></div><br>