Re: Sublists question
From: Nick Wedd (nick_at_maproom.co.uk)
Date: 03/20/04
- Next message: Jan Wielemaker: "Re: PSP"
- Previous message: Torkel Franzen: "Re: Can all clauses be represented as Horn Clauses?"
- In reply to: zeus: "Re: Sublists question"
- Next in thread: zeus: "Re: Sublists question"
- Reply: zeus: "Re: Sublists question"
- Reply: zeus: "Re: Sublists question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 20 Mar 2004 10:31:16 +0000
In message <f238fff9.0403200117.54cb94b3@posting.google.com>, zeus
<zohar@sheernetworks.com> writes
>3. langford_sublist(N,K,List) should generate the sublist of the
>number N with its K instances spaced correctly. This I guess is back
>to square one, being more understood, how do I generate this List?
>
>langford_sublist(3,1,Sublist) yields Sublist = [1,_,1,_,1],
>langford_sublist(2,2,Sublist) yields Sublist = [2,_,_,2],
>langford_sublist(4,3,Sublist) yields Sublist
>=[3,_,_,_,3,_,_,_,3,_,_,_,3]
You want to write langford_sublist( P, Q, List ). So break it into
simple tasks.
Write a predicate which, given Q, yields a list of Q _s and a Q.
Then write a predicate which, given P and Q, yields a list of a Q
followed by (P-1) of the above.
Nick
-- Nick Wedd nick@maproom.co.uk
- Next message: Jan Wielemaker: "Re: PSP"
- Previous message: Torkel Franzen: "Re: Can all clauses be represented as Horn Clauses?"
- In reply to: zeus: "Re: Sublists question"
- Next in thread: zeus: "Re: Sublists question"
- Reply: zeus: "Re: Sublists question"
- Reply: zeus: "Re: Sublists question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|