# Re: Another try

estevedelacebo_at_gmail.com
Date: 02/07/05

```Date: 7 Feb 2005 13:31:23 -0800

```

Hello. You are unifying the Price var with an anonymous var. Using a
single normal var instead of two anonymous ones would do the trick.

Regards

Esteve

Yereth Jansen wrote:
> Sorry for double posting, but my latest answer wasn't exactly useful
and
> I am in quite a hurry. Not of your concern perhaps, but the more for
me
> though.
> I know out of experience that people tend to skip posts that have
> replies already, so below another time my question:
>
> ---
>
> Hello,
>
> I have a problem with a prolog function I've written. The function is

> defined as followed:
>
> selectInStorage(
> part([A,B,C,Price1]),
> [part([A,B,C,Price2])|Tail],
> Tail,
> Price2
> ) :-
> Price2 =< Price1.
>
> selectInStorage(
> part([A1, B1, C1, D1]),
> [part([A2, B2, C2, D2]) | Tail],
> [part([A2, B2, C2, D2]) | Rest],
> _
> ) :-
> selectInStorage(
> part([A1, B1, C1, D1]),
> Tail,
> Rest,
> _
> ).
>
> This is the result of 2 tries in the commandline:
>
> 13 ?-
selectInStorage(part([a,b,c,500]),[part([a,b,c,450])],List,Price).
>
> List = []
> Price = 450
>
> Yes
> 14 ?-
selectInStorage(part([a,b,c,500]),[part([a,b,c,550])],List,Price).
>
> No
> 15 ?-
>
selectInStorage(part([a,b,c,500]),[part([a,b,c,550]),part([a,b,c,450])],List,Price).
>
> List = [part([a, b, c, 550])]
> Price = _G743
>
> Yes
>
> Now clearly, with the last result we are not getting the price we
want.
> The price should've been 450. He does find the right result, but does

> not output Price2 correctly. Anyone any clue what we are doing wrong
here?
>