Article View: comp.lang.prolog
Article #43Re: How to pick elements out of lists?
From: David Barker-Plummer
Date: Tue, 03 Nov 1992 02:01
Date: Tue, 03 Nov 1992 02:01
25 lines
2011 bytes
2011 bytes
In article <ANDKA.92Nov2103650@aste12.IDA.LiU.SE> andka@IDA.LiU.SE (Andreas Kagedal) writes: AK> In article <PLUMMER.92Nov1091801@nutmeg.cs.swarthmore.edu> plummer@cs.swarthmore.edu (David Barker-Plummer) writes: AK> The original poster (Ulrich Mayring) wrote: UM> > Hello netters, I have a problem: UM> > UM> > I have a list and need to recursively pick two elements out of it. I UM> > need every pair of elements in every order, however the order of the UM> > pair itself is not important. It should also be possible to pick an AK> Now I say: AK> This will cause every pair to occur twice, since the order of the pair AK> was not important. A modified version: Your criticism is completely correct, and your code works, although the conventional name for your member/3 predicate is select/3. I interpreted "every pair of elements in every order" to mean that (a,b) and (b,a) should both appear, although on closer insepection this appears to be contradicted by the clause "the order of the pair itself is not important". I read this latter as meaning that it didn't matter what order the pairs were produced. -- Dave
Technical Details
Message-ID:
<PLUMMER.92Nov2210156@nutmeg.cs.swarthmore.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!wupost!gumby!yale!yale.edu!jvnc.net!netnews.upenn.edu!news.cc.swarthmore.edu!plummerReferences:
<1992Oct29.140104.7751@coli.uni-sb.de> <1992Nov1.053612.7414@usage.csd.unsw.OZ.AU> <PLUMMER.92Nov1091801@nutmeg.cs.swarthmore.edu> <ANDKA.92Nov2103650@aste12.IDA.LiU.SE>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!wupost!gumby!yale!yale.edu!jvnc.net!netnews.upenn.edu!news.cc.swarthmore.edu!plummer From: plummer@cs.swarthmore.edu (David Barker-Plummer) Newsgroups: comp.lang.prolog Subject: Re: How to pick elements out of lists? Message-ID: <PLUMMER.92Nov2210156@nutmeg.cs.swarthmore.edu> Date: 3 Nov 92 02:01:56 GMT References: <1992Oct29.140104.7751@coli.uni-sb.de> <1992Nov1.053612.7414@usage.csd.unsw.OZ.AU> <PLUMMER.92Nov1091801@nutmeg.cs.swarthmore.edu> <ANDKA.92Nov2103650@aste12.IDA.LiU.SE> Sender: news@cc.swarthmore.edu (USENET News System) Organization: Swarthmore College, Swarthmore, PA Lines: 25 In-Reply-To: andka@IDA.LiU.SE's message of Mon, 2 Nov 1992 09:36:53 GMT Nntp-Posting-Host: nutmeg.cs.swarthmore.edu