Prolog基础
Lists in Prolog
- ?- X = .(a, .(b, .(c, []))).
X = [a, b, c]
YesP.S.Recent versions of SWI-Prolog use ’[|]’ instead of . (dot).[a, b, c, d] is the same as [a, b | [c, d]]. - ?- MyList = [1, 2, 3, 4, 5], MyList = [1, _ | Rest].
MyList = [1, 2, 3, 4, 5]Rest = [3, 4, 5]Yes

浙公网安备 33010602011771号