Path: utzoo!yunexus!yetti!asst-jos From: asst-jos@yetti.UUCP (Jonathan) Newsgroups: comp.lang.prolog Subject: Ranges of values in Cprolog Message-ID: <242@yetti.UUCP> Date: 4 May 88 18:49:25 GMT Article-I.D.: yetti.242 Posted: Wed May 4 14:49:25 1988 Reply-To: asst-jos@yetti.UUCP (Research Assistants--Jonathan) Organization: York U. Computer Science Lines: 49 I am working with C-prolog 1.5, and have implemented the following predicate for sets. (I use lists to implement sets) :- op(500, yfx, in). X in [X|Rest]. X in [Y|Rest] :- X in Rest. ?- 3 in [1,2,3]. yes ?- X in [1,2,3,4]. X = 1; X = 2; X = 3; X = 4; no ?- I use this (in conjunction with higher level predicates) to return the state of a set of variables, one at a time, (ie. on failure, as in setof/3). I would to implement the this 'in' operator to allow for the following: (The '..' would have the same meaning as it does in Pascal). ?- X in [1 .. 100]. X = 1; X = 2; X = 3; . . . X = 100; no ?- Unfortunately, I keep running into problems when attempting this, and I am tired of hitting my head against a brick wall. Any suggestions??? Thanks in advance. ------------------------------------------------------------------------- Jeffrey Klein BITNET: PROJ15@YUSOL York University UUCP: ...!utzoo!yunexus!yuyetti!asst-jos Toronto, Ontario -------------------------------------------------------------------------