From 50000481@plink.cityu.edu.hk Mon Feb 19 07:23:15 2001 Received: from plink2.cityu.edu.hk (carol.cityu.edu.hk [144.214.5.208]) by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f1J6NEZ22097 for ; Mon, 19 Feb 2001 07:23:14 +0100 (MET) Received: from ceciserver (cpct78.cityu.edu.hk) by plink2.cityu.edu.hk (Sun Internet Mail Server sims.3.5.1999.03.02.17.58.p5) id <0G8Z00801R2CIS@plink2.cityu.edu.hk> for prolog@swi.psy.uva.nl; Mon, 19 Feb 2001 14:23:01 +0800 (HKT) Received: from ceciserver (cpct78.cityu.edu.hk) by plink2.cityu.edu.hk (Sun Internet Mail Server sims.3.5.1999.03.02.17.58.p5) with SMTP id <0G8Z0033LR2BO6@plink2.cityu.edu.hk> for prolog@swi.psy.uva.nl; Mon, 19 Feb 2001 14:22:59 +0800 (HKT) Date: Mon, 19 Feb 2001 14:28:08 +0800 From: Cecilia Wong <50000481@plink.cityu.edu.hk> To: prolog@swi.psy.uva.nl Message-id: <001001c09a3d$1fb2d4b0$4e14d690@cityu.edu.hk> MIME-version: 1.0 X-Mailer: Microsoft Outlook Express 5.50.4133.2400 Content-type: MULTIPART/ALTERNATIVE; BOUNDARY="Boundary_(ID_MMlDCaNs9aAlrGr5Wqd++g)" X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Priority: 3 Subject: [SWIPL] keysort This is a multi-part message in MIME format. --Boundary_(ID_MMlDCaNs9aAlrGr5Wqd++g) Content-type: text/plain; charset="big5" Content-transfer-encoding: quoted-printable Hi, I intend to use the "keysort" predicate to sort a list according to = one of the arguments in the list. For example, I have the list, [[a, b, 2], [a, c, 3], [a, b, 1], [b, a, = 5], [d, c, 4], [f, r, 6]]. And I want the=20 resultant list to be sorted like this, [[a, b, 1], [a, b, 2], [a, c, 3], = [d, c, 4], [b, a, 5], [f, r, 6]], according=20 to the last argument of the lists in the list. Can this predicate help? I am really confused about the syntax of using keysort. As the = manual stated, "List is a list of=20 Key-Value pairs (e.g. terms of the functor `-' with arity 2)". Can anyone give an example on how to use this predicate?=20 Thank you very much! Cecilia --Boundary_(ID_MMlDCaNs9aAlrGr5Wqd++g) Content-type: text/html; charset="big5" Content-transfer-encoding: quoted-printable
Hi,
 
    I intend to use the = "keysort"=20 predicate to sort a list according to one of the arguments in the=20 list.
For example, I have the list, [[a, b, = 2], [a, c,=20 3], [a, b, 1], [b, a, 5], [d, c, 4], [f, r, 6]]. And I want the =
resultant list to be sorted like=20 this, [[a, b, 1], [a, b, 2], [a, = c,=20 3], [d, c, 4], [b, a, 5], [f, r, 6]], according
 to the last argument of the lists = in the=20 list. Can this predicate help?
 
    I am really confused = about the syntax of using keysort. As the manual stated, "List is a = list of=20
Key-Value=20 pairs (e.g. terms of the functor `-' with=20 arity 2)".
Can anyone give an example on how to = use this=20 predicate? 
 
    Thank you very=20 much!
 
Cecilia
--Boundary_(ID_MMlDCaNs9aAlrGr5Wqd++g)--