🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1617

(none)

#1617
From: JL Gomez
Date: Mon, 12 Oct 1992 20:33
29 lines
998 bytes
I've been learning PROLOG and building up some list predicates.
 
One of them is a subsequence predicate which returns yes if the elements
in the first list match the elements in the second list.  So, for example
the query:

subseq([a,b],[b,c,a]).

returns no, whereas

subseq([a,b],[a,c,b])

returns yes.  Remember, this is not subset which I can write.  

The others are rotate predicates like:

rotate([a,b,c,d,e],2,X).
X = [c,d,e,a,b]

which rotates right, and then

rotate([a,b,c,d,e,f],-2,X]
X = [e,f,a,b,c,d]

rotates left.
 
Thanks for the help in writing these!
--
gomez@enxuha.eas.asu.edu
Technical Details
Message-ID: <9210122012.AA08759@enuxha.eas.asu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!caen!zaphod.mps.ohio-state.edu!cs.utexas.edu!gateway

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!caen!zaphod.mps.ohio-state.edu!cs.utexas.edu!gateway
From: gomez@enuxha.eas.asu.edu (JL Gomez)
Newsgroups: comp.lang.prolog
Subject: (none)
Date: 12 Oct 1992 15:33:20 -0500
Organization: UTexas Mail-to-News Gateway
Lines: 29
Sender: daemon@cs.utexas.edu
Message-ID: <9210122012.AA08759@enuxha.eas.asu.edu>
NNTP-Posting-Host: cs.utexas.edu