简体   繁体   English

prolog 列表域和标签列表

[英]prolog lists of lists domain and labeling

L=[[X,Y,Z],[1,A,B],[2,C,D]], L ins 1..3, all_different(L), label(L). L=[[X,Y,Z],[1,A,B],[2,C,D]], L ins 1..3, all_different(L), label(L)。

I just want to fill the variables in the lists of the list with values.我只想用值填充列表列表中的变量。 Is there any solution to get the elements of the list (which are lists) in an easier way than get_element_at(L,1) and so on?是否有任何解决方案可以比get_element_at(L,1)等更简单的方式获取列表的元素(它们是列表)?


get_element(LL,M,N,Element) :-
        length([_|L01],M),
        length([_|L02],N),
        append(L01,[L|_],LL),
        append(L02,[Element|_],L).

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM