# How to make it write all of a list

**URL:** <https://swi-prolog.discourse.group/t/how-to-make-it-write-all-of-a-list/9322>\
**Category:** Help!\
**Tags:** bug, how-to\
**Created:** [September 25, 2025, 8:19pm UTC](https://swi-prolog.discourse.group/t/how-to-make-it-write-all-of-a-list/9322 "2025-09-25T20:19:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://swi-prolog.discourse.group/u/martin)\
**Post date:** [September 25, 2025, 8:19pm UTC](https://swi-prolog.discourse.group/t/how-to-make-it-write-all-of-a-list/9322/1 "2025-09-25T20:19:42Z")

</div>

I’m using: SWI-Prolog version 9.3.31.

I want the code to: make the interpreter write lists without “…”.  
E.g. it should write “[did, she]” instead of “[did|…]”.

Is there a way to do this with version 9.3.31 ?

In older versions of Swi Prolog, I could press the “w” key to start “write\_mode”.

This would make it write lists in full, instead of shortening them to “[myatom|….]” for example.

So pressing “w” would stop it writing a list like this:

?- myrule(A).

A = test([did|…]).

?-

This no longer works. When I press the “w” key, it still says “[write]”, as shown here, next, but it doesn’t change how it writes lists.  
For example, after I press “w”, it says “[write]”, but when I enter the next input, it still writes some terms like “test([myatom|…])”.

?- day(A).  
A = monday ;  
A = tuesday ;  
A = wednesday ;  
A = thursday [write]  
A = thursday ;  
A = friday ;  
A = saturday ;  
A = sunday.

?-

```prolog
% your code here

```

---

<div class="post-metadata">

**Author:** ![Frank\_Schwidom](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/frank_schwidom/32/7662_2.png) [@Frank\_Schwidom](https://swi-prolog.discourse.group/u/Frank_Schwidom)\
**Post date:** [September 25, 2025, 10:41pm UTC](https://swi-prolog.discourse.group/t/how-to-make-it-write-all-of-a-list/9322/2 "2025-09-25T22:41:43Z")

</div>

You can do the following:

Option A: use write

> (ins)?- length( L, 100).  
> L = [\_, \_, \_, \_, \_, \_, \_, \_, \_|…].
> 
> (ins)?- length( L, 100),write(L).  
> [\_315186,\_315192,\_315198,\_315204,\_315210,\_315216,\_315222,\_315228,\_315234,\_315240,\_315246,\_315252,\_315258,\_315264,\_315270,\_315276,\_315282,\_315288,\_315294,\_315300,\_315306,\_315312,\_315318,\_315324,\_315330,\_315336,\_315342,\_315348,\_315354,\_315360,\_315366,\_315372,\_315378,\_315384,\_315390,\_315396,\_315402,\_315408,\_315414,\_315420,\_315426,\_315432,\_315438,\_315444,\_315450,\_315456,\_315462,\_315468,\_315474,\_315480,\_315486,\_315492,\_315498,\_315504,\_315510,\_315516,\_315522,\_315528,\_315534,\_315540,\_315546,\_315552,\_315558,\_315564,\_315570,\_315576,\_315582,\_315588,\_315594,\_315600,\_315606,\_315612,\_315618,\_315624,\_315630,\_315636,\_315642,\_315648,\_315654,\_315660,\_315666,\_315672,\_315678,\_315684,\_315690,\_315696,\_315702,\_315708,\_315714,\_315720,\_315726,\_315732,\_315738,\_315744,\_315750,\_315756,\_315762,\_315768,\_315774,_315780]  
> L = [_, \_, \_, \_, \_, \_, \_, \_, \_|…].

Option B: change the options:

> (ins)?- set\_prolog\_flag( answer\_write\_options, [quoted(true), portray(true), max\_depth(500), spacing(next\_argument)]).
> 
> true.
> 
> (ins)?- length( L, 100).  
> L = [\_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_, \_].

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [September 26, 2025, 6:42am UTC](https://swi-prolog.discourse.group/t/how-to-make-it-write-all-of-a-list/9322/3 "2025-09-26T06:42:05Z")

</div>

The use of portray/1 (print) vs plain write and the `max_depth` option has been decoupled. If you type `?`, you get

```prolog
  Possible actions:
  ; (n,r,space,TAB): redo | t: trace&redo
  *: show choicepoint | . (c,a,RET): stop
  w: write | p: print
  +: max_depth*5 | -: max_depth//5
  b: break | h (?): help

```

So, if the answer is short, use `+`. Repeat until you see enough. The idea is to avoid flooding the output. The default of 10 is indeed sometimes a bit short, but it is unlikely that you want 10 million elements printed to the console. For example, I think you prefer this output over waiting for long to flood the terminal:

```prolog
105 ?- numlist(1, 10 000 000, L), sum_list(L, Sum).
L = [1, 2, 3, 4, 5, 6, 7, 8, 9|...],
Sum = 50_000_005_000_000.

```

---

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://swi-prolog.discourse.group/u/martin)\
**Post date:** [September 26, 2025, 11:21am UTC](https://swi-prolog.discourse.group/t/how-to-make-it-write-all-of-a-list/9322/4 "2025-09-26T11:21:21Z")

</div>

Thank you Frank and Jan.

You have answered my question fully.
