Loop 
Author Message
 Loop

Hi,

In Visual Prolog with this code I have the error:
E;uebung_1.pro, pos: 19782, 501 Free variable in expression ReResultatAlt

How can I solve it?

Domains
    reResult  = reference real

Predicates
    determ  horsEchelle(INTEGER,INTEGER,reResult)

Clauses
horsEchelle(IntCompteur,IntX,ReResultat):-
    IntX=IntCompteur,!,
     ReResultat=1.
horsEchelle(IntCompteur,_,ReResultat):-
     IntY=IntCompteur+1,
     ReResultat=ReResultatAlt*2,
     horsEchelle(IntY,10,ReResultatAlt).

Goal
horsEchelle(0,10,Resultat).

_____________________________________________________________________

Alessio Ishizaka
Teaching and Research Assistent
WWZ / Information Systems
Petersgraben 51
CH-4003 Basel

phone: ++41 / (0)61 / 267 32 29

www:   http://www.*-*-*.com/
room:  309
_____________________________________________________________________

Ich untersage unter Hinweis auf die Schutzwrdigkeit
meiner Arbeits- und Privatsph?re:

- die Aufnahme meiner Email-Adresse in pers?nliche Adressbcher
  sofern der Absender die Dienste eines sog. Freemail-Providers
  (Hotmail etc.) nutzt
- die Benutzung meiner EMail-Adresse in cc:-Feldern oder
  im to:-Feld neben anderen Adressaten
  Benutzen Sie stattdessen das bcc:-Feld
- die unverlangte Zusendung von Firmen-Exposs, Werbeschriften,
  Preislisten etc.

  http://www.*-*-*.com/
_____________________________________________________________________



Tue, 01 Jun 2004 18:36:50 GMT  
 Loop

Quote:

> Hi,

> In Visual Prolog with this code I have the error:
> E;uebung_1.pro, pos: 19782, 501 Free variable in expression ReResultatAlt

> How can I solve it?

> Domains
>     reResult  = reference real

> Predicates
>     determ  horsEchelle(INTEGER,INTEGER,reResult)

> Clauses
> horsEchelle(IntCompteur,IntX,ReResultat):-
>     IntX=IntCompteur,!,
>      ReResultat=1.
> horsEchelle(IntCompteur,_,ReResultat):-
>      IntY=IntCompteur+1,
>      ReResultat=ReResultatAlt*2,
>      horsEchelle(IntY,10,ReResultatAlt).

> Goal
> horsEchelle(0,10,Resultat).

Try
horsEchelle(IntCompteur,_,ReResultat):-
     IntY=IntCompteur+1,
     horsEchelle(IntY,10,ReResultatAlt),
     ReResultat=ReResultatAlt*2.

GnOM



Tue, 01 Jun 2004 19:07:33 GMT  
 Loop

Quote:

> In Visual Prolog with this code I have the error:
> E;uebung_1.pro, pos: 19782, 501 Free variable in expression ReResultatAlt
>      ReResultat=ReResultatAlt*2,
>      horsEchelle(IntY,10,ReResultatAlt).

I don't know VisualProlog, but in standard Prolog you'd want to use is/2
instead of =/2, and the two goals would have to be swapped.

--

  http://www.bawue.de/~jjk/          fax:+49-7031-464-7351
PGP:       06 04 1C 35 7B DC 1F 26 As the air to a bird, or the sea to a fish,
0x555DA8B5 BB A2 F0 66 77 75 E1 08 so is contempt to the contemptible. [Blake]



Tue, 01 Jun 2004 20:29:22 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. break one loop and skip one iteration of outer loop

2. 2 files: a loop within a loop??

3. Problem with loop inside other loop

4. Impelement for loop and do while loop

5. using while loops within while loops?

6. Fast loop inside a slow loop?

7. Troubles using while loops and case loops

8. For Loop looping only once

9. nested while loops, inside loop not stopping correctly

10. For loop, possible to increment counter/exit loop?

11. changing the value of loop-control variable in loop

12. Loop variable value after loop finish

 

 
Powered by phpBB® Forum Software