Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在PROLOG中将atom转换为没有预定义谓词的字符列表_Prolog_Amzi Prolog - Fatal编程技术网

如何在PROLOG中将atom转换为没有预定义谓词的字符列表

如何在PROLOG中将atom转换为没有预定义谓词的字符列表,prolog,amzi-prolog,Prolog,Amzi Prolog,对于我的课堂作业,我必须编写一个Prolog程序,通过添加“ion”及其变体将动词转换为名词。 我不想在单词中输入字符列表,而是想输入完整的单词,将其转换成一个列表,然后使用它。因为这是一个课堂作业,我们都需要使用老师提供的相同版本的软件 Amzi Prolog 5.0.31 Windows 2001年10月20日21:25:35 版权所有(c)1987-2000 Amzi!公司 在这个版本中,内置谓词atom_chars不起作用 到目前为止,我看到的唯一解决方案是: 1.吸收原子(abc) 2

对于我的课堂作业,我必须编写一个Prolog程序,通过添加“ion”及其变体将动词转换为名词。 我不想在单词中输入字符列表,而是想输入完整的单词,将其转换成一个列表,然后使用它。因为这是一个课堂作业,我们都需要使用老师提供的相同版本的软件

Amzi Prolog 5.0.31 Windows 2001年10月20日21:25:35 版权所有(c)1987-2000 Amzi!公司

在这个版本中,内置谓词atom_chars不起作用

到目前为止,我看到的唯一解决方案是: 1.吸收原子(abc) 2.使用
name/2
谓词获取unicode列表([0w0061,0w0062,0w0063]) 3.逐个元素获取unicode列表,使用名称谓词将每个元素转换为字符,并使用这些元素创建一个新列表。([c,b,a]) 4.颠倒列表([a,b,c])

如果你想一个更简单的方法来做这件事,请帮助我。到目前为止,我的作业代码是:

    /* Program to output the right form of the -ion suffix*/


go:-write('This is a program to derive verb+ion!!!'),nl,
write('If your verb ends with the letter T or TE, enter 1.'),nl,
write('If your verb ends with SE or DE, enter 2.'),nl,
write('If your verb ends with the MIT, enter 3.'),nl,
write('Enter your choice: '),
read(Class),
change(Verb,Noun,Class).
/*第一类动词*/

change(Verb,Noun,1):-
write(' Enter a verb of type 1.'),
nl,
tab(5),
read(Verb),
concat(Verb,[i,o,n],Noun),
write('The noun form is '),
write(Noun),
write(.).

concat([],List,List).
concat([Head|List1],List2,[Head|List3]):-
concat(List1,List2,List3).
/*第二类动词*/

change(Verb,Noun,2):-
write(' Enter a verb of type 2.'),
nl,
tab(5),
read(Verb),
del_two(Verb,Root),
concat(Root,[s,i,o,n],Noun),
write('The noun form is '),
write(Noun),
write(.).


del_two([_,_], []).
del_two([Head|Tail], [Head|NTail]):-
del_two(Tail, NTail).
/*第三类动词*/

change(Verb,Noun,3):-
write(' Enter a verb of type 3.'),
nl,
tab(5),
read(Verb),
del_two(Verb,Root),
concat(Root,[i,s,s,i,o,n],Noun),
write('The noun form is '),
write(Noun),
write(.).

我第一次使用PROLOG。所以请原谅任何小错误。

然后人们讨厌序言。。。你能说服你的老师使用更具活力、更少破坏的实现和版本吗?
name/2
大约在1987年就过时了,这是有充分理由的。否则,就不清楚您想要什么:将一个原子转换为一个字符列表需要一些内置谓词。Amzi是一个谓词
atom\u代码(atom,CharList)
,它可能会以两种方式工作。但是,如果它在您的版本中有效,我找不到相关信息。非常感谢大家的帮助。我在上面提到的方法中成功地编写了没有内置谓词的代码。:)