Re: Integer_division/3....stuck on the recursion part.
- From: "Pierpaolo BERNARDI" <olopierpa@xxxxxxxxx>
- Date: 27 Nov 2005 19:07:47 -0800
sikkwanchu@xxxxxxxxxxx wrote:
> integer_division(_X,0,error).
>
> integer_division(0,_,_).
?
> integer_division(X,Y,Z):-
> X >= Y,
> N is X - Y,
> integer_division(N,Y,A),
> Z = A + 1.
>
> im stuck in where the recurison ends.
What's the result when X < Y ?
Just add a clause which covers this case.
P.
.
- Follow-Ups:
- Re: Integer_division/3....stuck on the recursion part.
- From: NEFuchs
- Re: Integer_division/3....stuck on the recursion part.
- References:
- Integer_division/3....stuck on the recursion part.
- From: sikkwanchu
- Integer_division/3....stuck on the recursion part.
- Prev by Date: Re: Tic-tac-toe extended version
- Next by Date: Re: Sublist Pattern Matching
- Previous by thread: Integer_division/3....stuck on the recursion part.
- Next by thread: Re: Integer_division/3....stuck on the recursion part.
- Index(es):
Relevant Pages
|
|