On Windows 10
Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.14-41-g41ac4a569)
?- Op=mod,A='100',B=a,Expr =.. [Op,A,B].
Op = (mod),
A = '100',
B = a,
Expr = '100'mod a.
Was expecting Expr = mod('100',a)
.
This worked as expected.
?- Op='division',A='100',B=a,Expr =.. [Op,A,B].
Op = division,
A = '100',
B = a,
Expr = division('100', a).
but this did not
?- Op='div',A='100',B=a,Expr =.. [Op,A,B].
Op = (div),
A = '100',
B = a,
Expr = '100'div a.
Currently upgrading SWI-Prolog to latest version, will retest and post.
With recent install of SWI-Prolog
Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.20)
?- Op=mod,A='100',B=a,Expr =.. [Op,A,B].
Op = (mod),
A = '100',
B = a,
Expr = '100'mod a.
?- Op='division',A='100',B=a,Expr =.. [Op,A,B].
Op = division,
A = '100',
B = a,
Expr = division('100', a).
?- Op='div',A='100',B=a,Expr =.. [Op,A,B].
Op = (div),
A = '100',
B = a,
Expr = '100'div a.
As a workaround using
?- Op=mod,A='100',B=a,Expr =.. [op,Op,A,B].
Op = (mod),
A = '100',
B = a,
Expr = op(mod, '100', a).