prolog - 如何在序言中打印空格
问题描述
我需要使用 write() 打印到流中,但我不知道如何打印“空白”空格。例如我想写
10 3
5 3 6
write('10 3') 只写 10 3 (删除多余的空格),我想打印前导空格。有人知道我该怎么做吗?
编辑:我想打印一个包含一些空格和一些数字的字符矩阵。程序的最终目标就是这样。但如果我这样做
?- write(' '), write(' '), write('3')
3
true
我想实现
3
解决方案
Please edit your question with a complete program we can run, and the output you get, and the output you would like to get.
This seems to work for me on SWI-Prolog 7.6.4:
?- write('10 3'), nl, write(' 10 3 '), write('7'), nl.
10 3
10 3 7
true.
推荐阅读
- javascript - 如何将值传递给 sweetalert?
- android - 如何在 Android Xamarin.Forms 中获取附近 WiFi 网络的列表?
- outlook - 自动将发送电子邮件另存为 Adobe PDF 并保存在文件夹中
- python - 如何在元组列表中选择具有特定值的元素
- java - 对 CSV 文件中的重复项进行分组并根据某些值对数据进行排名
- python - 无法在熊猫python中删除CSV中具有不同表格格式的行
- ceph - 为什么 Ceph 通过对象哈希而不是 CRUSH 算法计算 PG ID?
- for-loop - 将像素从图像处理为黑色图像以通过最近邻放大
- asp.net - 每当尝试向本地托管的 API 发送 GET 请求时,邮递员都会坚持发送请求
- java - 如何在android studio中按类别对recyclerview项目进行分组