我试图使用maplist通过限制每个元素的长度来过滤元素列表,下面是我尝试过的
maplist(atom_length(2,X),[aa,bb,cc,asd],Result).
ERROR: apply:maplist_/3: Undefined procedure: atom_length/4
ERROR: However, there are definitions for:
ERROR: atom_length/2
我希望能得到
Result = [aa,bb,cc]
需要一点帮助。谢谢。
我正在尝试查看对象列表中是否存在INT。在下面我的最大努力中,我创建了一个Person类和他们的成员列表(它们只包含Ids)。我正在检查人员的成员资格列表中是否存在特定的整数。 在下面的代码中,Person属于成员it 1、3和4。我正在尝试创建一个LINQ语句,当给定一个Integer时,如果该整数存在于Person的成员身份中,它将返回TRUE/FALSE值。 我创建了两个场景:x=4应该返回TRUE,而x=6应该返回FALSE,但由于某种原因,它们都返回TRUE。 我做错了什么? public class Program
{
public class Person {
我需要一些帮助,为我的人工智能课的prolog作业。问题是如何为爱因斯坦的谜题编写prolog代码。我知道如何把它写在我自己的书里,但是作业中有一些限制因素。
there are 5 houses
the Englishman lives in the red house
the Spaniard owns the dog
coffee is drunk in the green house
the Ukrainian drinks tea
the green house is immediately to the right of the ivory house
the Old
我正在写一个prolog代码,在中间我想检查列表中的所有元素是否都不包括在某个谓词中
Here is the code:
trap(a).
trap(b).
not_trap([A|B]):-
\+trap(A),
not_trap(B).
not_trap(B):-
\+trap(B).
但是这不管用,谁能告诉我我哪里出错了?谢谢