There is no need to quote this. If you also load library(pce) you can write the prettier @display
Good question. For swipl-win I guess we could add something like SHIFT-Ctrl-V to paste in quoted form? For a normal console it gets harder. We could add a command to the command line editor? I recently found myself in a similar situation debugging parsing expressions from the JavaScript mathlife editor.
This seems so useful that I added ^Y to the libedit command line editor to insert the current selection as Prolog quoted value. The quote used is the character before the caret, or single quoted if this is not a quote. So, to paste as back quoted code string, use
`^Y
For the Windows console we could probably do something similar to normal ^V: paste quoted if the character before the caret is a quote?
For now, I extended swipl-win.exe with a ^Y command that is close to what libedit does on Unix-like systems, i.e.:
If the character before the caret is a quote, insert quoted using that quote.
Otherwise insert quoted using a single quote.
The difference is that libedit uses Prolog to implement the command and does the quoting using write_term/2, while swipl-win simply puts a \ before occurrences of the quote character as well as \ in the input.
Possibly you can copy some of that to the Qt based console …
I came up with this, should read whatever is written or pasted, newline and ctrl+d ends the input. Probaply the current_input’s line buffer (4096 characters ) limits how long the atom can be, with very long inputs I noticed problems.