Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!uunet!psinntp!nntp.hk.super.net!news.ust.hk!kean
From: kean@cs.ust.hk (Alex Kean)
Subject: Re: Help with Subset Function
Message-ID: <1995Mar22.030745.11880@uxmail.ust.hk>
Sender: usenet@uxmail.ust.hk (usenet account)
Nntp-Posting-Host: cssu49.cs.ust.hk
Organization: Computer Science, HKUST
References: <3kkn1n$nka@idefix.CS.kuleuven.ac.be>
Date: Wed, 22 Mar 1995 03:07:45 GMT
Lines: 38

In article <3kkn1n$nka@idefix.CS.kuleuven.ac.be> bimbart@CS.kuleuven.ac.be (Bart Demoen) writes:
>
>how about:
>
>[] is the only subset of the empty list
>[A|R] is a subset of the list [A|S] is R is a subset of S
>R is a subset of [A|S] if R is a subset of S
>
>in Prolog:
>
>subset([],[]) .
>subset([A|R],[A|S]) :- subset(R,S) .
>subset(R,[_|S]) :- subset(R,S) .
>
>want more cake ?
>
>Bart Demoen
>

This only works if the list is sorted. Incidentally,
what would be the fastest subset algorithm we can define
using prolog? I mean if I want to perform 500,000 subset
operations in, let say, one second. yes, I did try bitsets.pl
but not satisfactory. I wonder is this limitation of
the current technology of  Prolog and I should do it in C?

Just curious. Thanks.
Alex Kean



-- 
-------------------------------------------------------------------------
Alex Kean 
Department of Computer Science                      Email: kean@cs.ust.hk
The Hong Kong University of Science & Technology    Tel: (852) 235 869 92
Clear Water Bay, Kowloon, HONG KONG                 Fax: (852) 235 814 77
-------------------------------------------------------------------------
