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.
我已经询问了如何构建一个列表,其中包含按特定字符排序的事实,并且给出的解决方案是 KEY-Value 返回。例如:
1-package(N,3,1).
然而,我真正需要的是访问位置 N 中的变量。我尝试将键与事实分开[K-H|T],H 给我package(N,3,1),但我如何访问 N?
[K-H|T]
package(N,3,1)
只需编写H=package(N,3,1)将 H 与 term 统一package(N,3,1),而不是在参数中返回 H,而是返回 N。
H=package(N,3,1)
另一种方法是直接写: [K-package(N,3,1)|T]而不是 [K-H|T]返回N。
[K-package(N,3,1)|T]