Article View: comp.lang.functional
Article #1099Re: How do i approach this problem?
From: Ketil Malde
Date: Tue, 18 Feb 2003 06:27
Date: Tue, 18 Feb 2003 06:27
19 lines
1646 bytes
1646 bytes
nospm@uni-koblenz.de writes:
> In article <b2rbba$6dc$1@news.gu.se>, "Konrad Den Ende" <chamsterkonrad@bigfoot.com> writes:
>> [x:xs | xs <- [[1,2,3],[4,5,6]], x <- head xs]
>> I ment the outcome to be [[1,1,2,3],[4,4,5,6]] and i have two questions.
> Prelude> map (\x->head x:x) [xs | xs <-[[1,2,3],[4,5,6]] ]
> [[1,1,2,3],[4,4,5,6]]
How about
map (\(x:xs)->(x:x:xs)) [[1,2,3],[4,5,6]]
i.e. [x | x <- xs] is equivalent to xs.
-kzm
--
If I haven't seen further, it is by standing in the footprints of giants
Technical Details
Message-ID:
<egu1f2rtmx.fsf@sefirot.ii.uib.no>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!uninett.no!nntp.uib.no!not-for-mailReferences:
<b2rbba$6dc$1@news.gu.se> <b2re27$td5$01$1@news.t-online.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 107f24,a907e0b23c6eca41 X-Google-Attributes: gid107f24,public X-Google-Thread: 10f6e0,a907e0b23c6eca41 X-Google-Attributes: gid10f6e0,public X-Google-ArrivalTime: 2003-02-17 22:41:00 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!uninett.no!nntp.uib.no!not-for-mail From: "Ketil Malde" <ketil+@ii.uib.no> Newsgroups: comp.lang.functional,cth.dtek.general Subject: Re: How do i approach this problem? Date: 18 Feb 2003 07:27:02 +0100 Organization: University of Bergen Lines: 19 Message-ID: <egu1f2rtmx.fsf@sefirot.ii.uib.no> References: <b2rbba$6dc$1@news.gu.se> <b2re27$td5$01$1@news.t-online.com> NNTP-Posting-Host: sefirot.ii.uib.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: toralf.uib.no 1045550459 18655 129.177.16.62 (18 Feb 2003 06:40:59 GMT) X-Complaints-To: abuse@uib.no NNTP-Posting-Date: 18 Feb 2003 06:40:59 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley)