For Programmers: Free Programming Magazines  


Home > Archive > Prolog > July 2004 > Re: Little problem please help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Little problem please help
Magellan

2004-07-01, 8:57 am

magellano@poczta.fm (Magellan) wrote in message news:<35b3fce2.0406280042.59ce50e5@posting.google.com>...
> Nick Wedd <nick@maproom.co.uk> wrote in message news:<5h67AOIqir2AFAOv@maproom.demon.co.uk>...


[color=darkred]
> so in this programm suppose that [1,2] is the same sublist as [2,1],
> and [1,1,1] isn't sublist of [1,2,3]. So it's just like a
> lottey-drawin (without repetitions).


This is my mistake, it will be better to suppose that [1,2] isn't the
same sublist as [2,1].
So I ask for help to write predicate sublist which will generate [1,2]
and [2,1] but [1,1,1] isn't sublists of [1,2,3].

I'll be really grateful for help.

Michael
Magellan

2004-07-03, 3:57 pm

bart demoen <bmd@cs.kuleuven.ac.be> wrote in message news:<1088842817.633312@seven.kulnet.kuleuven.ac.be>...

> Try
>
> sublist([],[]).
> sublist([X|R],Sub) :-
> sublist(R,SubR),
> (
> Sub = SubR
> ;
> Sub = [X|SubR]
> ).
>
> and have a look at recent threads in comp.lang.prolog on sublist ...
>
> Cheers
>
> Bart Demoen


Hi
Yes, now it's working like I want it.
Nick, Bart and others who wrote in this topic, you are amazing.

It's nice to know, that somewhere in the world, there are people, who
wants to help and they do this.

Really thank you very much.

Michael
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com