Re: Sublists question

From: Nick Wedd (nick_at_maproom.co.uk)
Date: 03/20/04


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


Relevant Pages

  • Re: Sublists question
    ... >>to square one, being more understood, how do I generate this List? ... > Then write a predicate which, given P and Q, yields a list of a Q ... Anyways, this is what I understood from you suggestion Nick, what do ...
    (comp.lang.prolog)
  • Re: Sublists question
    ... >>to square one, being more understood, how do I generate this List? ... > Then write a predicate which, given P and Q, yields a list of a Q ... Anyways, this is what I understood from you suggestion Nick, what do ...
    (comp.lang.prolog)
  • Re: JSH: SF: Finally, surrogate factoring
    ... So completing the square w.r.t y first yields ...
    (sci.math)
  • Re: JSH: SF: Finally, surrogate factoring
    ... So completing the square w.r.t y first yields ...
    (sci.math)
  • Re: How many/which wedges?
    ... The irons are designed ... to be square at the impact point. ... That yields a launch angle of roughly ...
    (rec.sport.golf)