Re: strange behaviuor
- From: "Geoffrey Summerhayes" <sRuEmMrOnVoEt@xxxxxxxxxxx>
- Date: Thu, 12 Jan 2006 13:35:31 -0500
"Marco" <cimmo@xxxxxxxxx> wrote in message
news:43c68790$0$342$5fc30a8@xxxxxxxxxxxxxxxxxx
>> Works here, sort of.
>> I'd tackle this a different way.
>>
>> generate(N,L,L1) :- length(L,X), X > 0, Y is random(X),
>> remove_nth(Y,L,N,L1).
>>
>> then
>>
>> generate(N,[1,2,3],L1).
>>
>> to get
>>
>> N = 2
>> L1 = [1,3]
>
> Many thanx,
> I'm using SWI-Prolog 5.4.7 and remove_nth doesn't exist...
>
So am I. Exercise for the reader :)
--
Geoff
.
- References:
- strange behaviuor
- From: Marco
- Re: strange behaviuor
- From: Geoffrey Summerhayes
- Re: strange behaviuor
- From: Marco
- strange behaviuor
- Prev by Date: Re: strange behaviuor
- Next by Date: Re: comparison predicates
- Previous by thread: Re: strange behaviuor
- Next by thread: for loop in prolog
- Index(es):
Relevant Pages
|