不带逗号或括号的 maplist() 的替代方法

Alternative to maplist() without commas or brackets

我正在尝试简单地打印一份列表,不带括号或逗号。 思路给出多个列表如:

X = [1,2,3,4,5], [6,7,8,9,10], ...

他们应该这样打印:

1 2 3 4 5

6 7 8 9 10

我有这样的东西:

printing(X) :- maplist(writeln, X).

给出:

[1,2,3,4,5]

[6,7,8,9,10]

....

我也试过这个:

printing(X):-
        atomic_list_concat(X, ' ', Y),
        write(Y).

但是不能正常工作:

ERROR: Type error: `text' expected, found `[1,2,3,4]' (a list)

这样解决了:

刚刚在 atomic_list_concat() 中做了一个小改动:

print_matrix([]).
print_matrix([Row|Rows]):-
  atomic_list_concat(Row, ' ' , TRow),
  writeln(TRow),
  print_matrix(Rows).