Search:

Submit Article

# Prolog program to define the relation translate(List1, List2) to translate a list of numbers between 0 and 9

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 7462

## Code for Prolog program to define the relation translate(List1, List2) to translate a list of numbers between 0 and 9 in Artificial Intelligence

```domains

list1=integer*
list2=symbol*

predicates

translate(list1,list2)
means(integer,symbol)

clauses

translate([],[]).

translate([],_):-
write("\nError in Input").

translate(_,[]):-
write("\nError in Input").

write(Name,"\n"),
translate(Tail1,Tail2).

means(0,zero).

means(1,one).

means(2,two).

means(3,three).

means(4,four).

means(5,five).

means(6,six).

means(7,seven).

means(8,eight).

means(9,nine).

OUT PUT
=======

Goal: translate([1,2,3],[a,b,c])

a = one
b = two
c = three

Yes

-------------------------------------

Goal: translate([1,2,3,4,5,6,7,8,9],[a,b,c,d,e,f,g,h,i])

a = one
b = two
c = three
d = four
e = five
f = six
g = seven
h = eight
i = nine

Yes
```
Share:

 Milind Mishra author of Prolog program to define the relation translate(List1, List2) to translate a list of numbers between 0 and 9 is from India. View All Articles

 Please enter your CommentComment should be atleast 30 Characters.Please put code inside [Code] your code [/Code]. No Comment Found, Be the First to post comment!