使用运算符时控制括号 [英] Controlling parenthesis while working with operators

查看:41
本文介绍了使用运算符时控制括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用用户定义的运算符时,Prolog 有时会自动添加/删除涉及这些运算符的表达式的括号.有没有办法控制这个?

When working with user-defined operators, Prolog sometimes adds / removes parenthesis to expressions involving those operators automatically. Is there a way to control this?

非常感谢

推荐答案

括号只是通过描绘添加的.他们不是内部代表的一部分的代码.您可以覆盖描绘以更改事物的打印方式.见描绘文本

The parens are just added by portray. They're not part of the internal representation of the code. You can override portray to change how things are printed. see portray_text

这篇关于使用运算符时控制括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆