Changing elements in a list 
Author Message
 Changing elements in a list

Using Visual Prolog 5.2 for windows, I am attempting to change an object in a
predicate. In the following code, I am trying to change an ' * ' to an ' X '
and frankly I'm completely lost. I have the programming tutorial for Visual
Prolog and it does not give sufficient examples of how to do this. I am very
new to Visual Prolog and would appreciate any help that can be offered.

Thank you
Dave Guimond

DOMAINS
        row = char
        column = integer
        result = char
PREDICATES
        position(row, column, result)
        change(char, integer)
CLAUSES
        position('a',1,'*').    
        position('a',2,'*').
        position('a',3,'*').
        position('b',1,'*').
        position('b',2,'*').
        position('b',3,'*').
        position('c',1,'*').
        position('c',2,'*').
        position('c',3,'*').
        change(Char, Int):-
                position(Char, Int, _):- position(Char, Int, 'X').
GOAL
write("what is your letter? "),
readchar(Char),
write(Char),
write("What is your number?  "),
readint(Int),
write(Int),
change(Char, Int),
nl.



Wed, 14 May 2003 10:38:24 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. confused about adding elements to a list with list.append(otherlist)

2. Deleting list of elements from a list

3. common elements in list of list

4. list -> elements of list

5. changing a list within a subclass of list ?

6. BROWSE: CHANGING FIXED ELEMENT: RESET??? (C5ABC)

7. Changing property of Control USE'ing Array Element

8. changing colors of element in listbox the same time you are inserting them

9. Changing the global size of the graphic elements in a TK program

10. Changing open :element-type without re-opening.

11. How to change a sublist element?

12. change stream element-type on the fly?

 

 
Powered by phpBB® Forum Software