# Re: solving for pilog variables

```Joe
Yes that's cracked it! I can see you've given values to @A and @B before
solving for @C but in Prolog I wasn't aware that the order mattered...There
again the calculation is being done in Lisp.
As a result of Alex's response this morning I added more parenthesis and
that seemed to solve what I was doing last night. I'll have to check you're
level of bracketing against mine.```
```
Alex
I'm just trying to get Profit from Sales - Cogs and was struggling to
produce a minus predicate in pilog i.e. harnessing picolisps '-'. Sorry for
not being clear.

The problem is...for each item...Sales, Profit etc...I'll rarely have a
single value to work with ...just a list... so the formulae do more than
just get an end result...they also choose which of the numbers in the
various lists "work" together.

Thank you both for your examples. That's really helped.
Best Regards
Dean

On 27 November 2016 at 17:59, Alexander Burger <a...@software-lab.de> wrote:

> Hi Dean
>
> On Sun, Nov 27, 2016 at 05:42:21PM +0000, dean wrote:
> > (prove (goal '(   (^ @X (- (-> @A) (-> @B) )) (equal @A 4) (equal @B 2)
> )))
> > -> NIL
> >
> > -> wasn't the "one" in this case
>
> I'm not sure I understand the problem, but the most natural way for a
> diff predicate is perhaps
>
>    : (be - (@A @B @Diff)
>       (^ @Diff (- (-> @A) (-> @B))) )
>    -> -
>
>    : (? @X 7  @Y 3  (- @X @Y @Res))
>     @X=7 @Y=3 @Res=4
>
>    :  (? (- 10 3 @X))
>     @X=7
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>
```