This extension is needed in particular in the context of DCG and CHR.
Yap, SWI, SICStus all have some implementation specific extension to permit the solo character "head tail separator char" (6.5.3) as infix operator. It seems that Yap accepts the subset of SWI, that is also accepted by SICStus. However, the terms are compatible with SWI and not SICStus.
Prolog text | YAP | SWI | SICStus | B-Prolog |
---|---|---|---|---|
Default operators | ||||
(a|b). | '|'(a,b). | '|'(a,b). | ;(a,b). | '|'(a,b). |
f(a|b). | error | f('|'(a,b)). | error | error |
f(a|b,c). | error | f('|'(a,b),c). | error | error |
f((a|b)). | f('|'(a,b)). | f('|'(a,b)). | f(;(a,b)) | f('|'(a,b)). |
f(|). | error | f('|'). | error | error |
f((|)). | error | f('|'). | error | error |
'|'. | '|'. | '|'. | '|'. | '|'. |
[|]. | error | ['|']. ** | error | error |
[a|b|c]. | error | [a|'|'(b,c)]. ** | error | error |
[a|b,c]. | error | [a|','(b,c)]. ** | error | error |
(1;2|3;4). | '|'(;(1,2),;(3,4)). | '|'(;(1,2),;(3,4)). | ;(1,;(2,;(3,4))). | ;(1,'|'(2,;(3,4))) |
current_op(A,xfy,'|'). | A = 1105. | A = 1105. | no | A = 1100. |
current_op(A,xfy,;). | A = 1100. | A = 1100. | A = 1100. | A = 1100. |
(fail|true). | Success | Success | Success | existence_error |
With op(0,xfy,'|'), op(1100,fx,'|'), op(0,xfy,;), op(1100,fx,;). | ||||
|1. | error | '|'(1). | error | error |
'|'1. | '|'(1). | '|'(1). | '|'(1). | '|'(1). |
||. | error | '|'('|'). ** | error | error |
;1. | ;(1). | ;(1). | ;(1). | ;(1). |
;;. | ;(;). | ;(;). | ;(;). | ;(;). |
Prolog text | ECLiPSe default | ECLiPSe limit_arg_precedence | ECLiPSe bar_is_no_atom | ECLiPSe bar_is_no_atom limit_arg_precedence |
---|---|---|---|---|
Default operators | ||||
(a|b). | '|'(a,b). | '|'(a,b). | ;(a,b). | ;(a,b) |
f(a|b). | f('|'(a,b)) | error. | f(;(a,b)). | error |
f(a|b,c). | f('|'(a,b),c) | error. | f(;(a,b),c). | error |
f((a|b)). | f('|'(a,b)). | f('|'(a,b)). | f(;(a,b)). | f(;(a,b)) |
f(|). | f('|') | f('|') | error | error |
f((|)). | f('|') | f('|') | error. | error |
'|'. | '|'. | '|'. | '|'. | '|' |
[|]. | ['|'] | ['|'] | error | error |
[a|b|c]. | error | error | error. | error |
[a|b,c]. | error | error | error. | error |
(1;2|3;4). | ;(1,'|'(2,;(3,4))). | ;(1,'|'(2,;(3,4))). | ;(1,;(2,;(3,4)). | ;(1,;(2,;(3,4)). |
current_op(A,xfy,'|'). | A = 1100. | A = 1100. | A = 1100. | A = 1100. |
current_op(A,xfy,;). | A = 1100. | A = 1100. | A = 1100. | A = 1100. |
(fail|true). | existence_error | existence_error | Success | Success |
With op(0,xfy,'|'), op(1100,fx,'|'), op(0,xfy,;), op(1100,fx,;). | ||||
|1. | '|'(1) | '|'(1) | error. | error |
'|'1. | '|'(1). | '|'(1). | '|'(1). | '|'(1). |
||. | '|'('|'). | '|'('|'). | error | error |
;1. | ;(1). | ;(1). | ;(1). | ;(1). |
;;. | ;(;). | ;(;). | ;(;). | ;(;). |
So it seems, that | is permitted in a very restricted context.