Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图在另一个函数中调用随机函数。例如我想这样做assert(fact(random()).但它不起作用。如何以这种方式插入随机数?谢谢。
assert(fact(random()).
在 prolog 中,没有像您在代码中尝试执行的功能的概念。你应该做:
random(N), assert(fact(N))
我建议至少阅读前两章立即学习 Prolog!更好地理解搜索和统一。