在Prolog中有一段代码,用于将一个txt文件转换为4个列表(3个1D_lists,每行一个,最后一个是2D_list,其余行每行一个子列表。 open('3by3data.txt', read, Str), split_string(Line," ","",L_list1), %Split a line into a list by &
我有一个纯文本文件和几行随机的数据,没有什么特别的。我想知道我将如何逐行阅读这个文件,如下面的伪代码:data = open ("x.txt", read, handle) if line == "stop" then stop reading但是我想跳过文件中的第一行。在我知道的其他语言中非常简单的东西,比如python..ect,我发现从文档中学习非常困难,因为他们似乎希望你在使用它之前已经了解了很多prolog :/
我在SWI-Prolog的库(Sgml)中找到一个谓词xml_quote_attribute/2。此谓词使用第一个参数作为输入,第二个参数作为输出:?- xml_quote_attribute(X, '<abc>').ERROR: Arguments are not sufficiently instantiated再见