中缀函数:如何避免在提供的参数周围加上括号

问题描述

我有以下中缀乐趣

root.mainloop()

具有以下用例

infix fun <T> Boolean.then(lazyValue: () -> T): T?
        = if (this) lazyValue() else null

我想改成

(index > 0) then { data[index - 1].id }

,并避免在索引> 0周围加上括号。当前它无法在代码中解析。 有什么办法可以使它工作?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)