ISO/IEC JTC1 SC22 WG17
A comparison of implementations of number_chars/2

A general comparison of syntax, ISO Prolog works.

Query Expected result IF
V5.1B
SWI
5.11.7
YAP
6.2.0
B
7.5#9
GNU
1.4.0
SICStus
4.2.1
MINERVA
2.4
XSB
3.2
Ciao
1.13.0
Section 0 13211-1:1995 Undisputed cases that are not changed by DTC2
number_chars(1.2,['1',.,'2']). succeeds OK OK OK OK OK OK OK OK new OK
number_chars(1.0e9,['1',.,'0','E','9']). succeeds OK OK OK OK OK OK new OK OK new fails
number_chars(1,['0','1']). succeeds OK OK OK OK OK OK new fails OK new fails
number_chars(1,[a]). syntax_error(..) OK OK OK OK OK fails fails OK new fails
number_chars(1,[]). syntax_error(..) OK OK OK OK new OK fails fails OK new fails
number_chars(1,[[]]). type_error(ch.,[]) OK OK new OK OK OK new fails fails ty._e.(d.a.,...) new fails
number_chars(1,[' ',[]]). type_error(ch.,[]) OK OK new OK OK OK new fails fails ty._e.(d.a.,...) new fails
number_chars(1,[0]). type_error(ch.,0) OK sy._e.(..) sy._e.(..) OK new OK new fails fails ty._e.(d.a.,...) new ty._e.(atom,0)
number_chars(1,[_,[]]). type_error(ch.,[]) OK fails fails new fails OK new fails fails ty._e.(d.a.,...) new fails
number_chars(N,[X]). instantiation_error OK OK new OK OK OK OK OK OK OK
number_chars(N,['0'|_]). instantiation_error OK OK new OK OK OK OK OK OK N = 0
number_chars(N,'1'). type_error(list,'1') OK OK OK OK OK OK OK OK fails
number_chars(N,[a|a]). type_error(list,[a|a]) OK OK new OK new OK OK OK ty._e.(list,a) ty._e.(list,a) fails
number_chars(N,[49]). type_error(ch.,49) OK N = 1 N = 1 OK OK OK OK OK fails
number_chars(N,[]). syntax_error(..) OK OK OK OK new OK OK OK OK fails
number_chars(N,['3',' ']). syntax_error(..) N = 3 OK OK OK OK OK OK OK fails
number_chars(N,['3',.]). syntax_error(..) OK OK OK OK OK OK N = 3.0 N = 3.0 fails
number_chars(N,[' ','1']). N = 1 OK OK OK OK OK OK XXX OK fails
number_chars(N,['\n','1']). N = 1 OK OK OK OK new OK OK XXX OK fails
number_chars(N,[' ','0','''',a]). N = 0'a, N = 97 OK OK OK new OK OK OK OK sy._e.(..) fails
number_chars(N,[-,' ','1']). N = -1 OK sy._e.(..) sy._e.(..) OK OK new OK sy._e.(..) sy._e.(..) fails
number_chars(N,[/,*,*,/,'1']). N = 1 sy._e.(..) sy._e.(..) sy._e.(..) OK sy._e.(..) sy._e.(..) sy._e.(..) sy._e.(..) fails
number_chars(N,['%','\n','1']). N = 1 sy._e.(..) sy._e.(..) sy._e.(..) OK sy._e.(..) sy._e.(..) sy._e.(..) sy._e.(..) fails
number_chars(N,[-,/,*,*,/,'1']). syntax_error(..) OK OK OK N = -1 OK OK OK OK fails
number_chars(N,['1',e,'1']). syntax_error(..) N = 10.0 N = 10.0 N = 10.0 OK OK OK N = 10.0 N = 10.0 fails
number_chars(N,['1',.,'0',e]). syntax_error(..) OK OK OK OK OK OK OK N = 1.0 fails
number_chars(N,['1',.,'0',e,e]). syntax_error(..) OK OK OK OK new OK OK OK OK fails
number_chars(N,['0',x,'1']). N = 1 OK OK OK OK OK OK OK N = 1.0 fails
number_chars(N,['0','X','1']). syntax_error(..) OK OK OK new OK OK new OK OK N = 1.0 fails
number_chars(1E1,_). syntax error success success success OK OK OK success OK OK
Section 1 13211-1:1995 8.16.7.3 State according to 8.16.7.3 Errors of 13211-1:1995
number_chars(1,[C]). type_error(ch.,_) OK2 OK2 OK2 new in._e. OK2 OK2 OK2 OK2 OK2
number_chars(1,[C,D]). type_error(ch.,_) in._e. OK2 new OK2 new in._e. OK2 OK2 OK2 OK2 OK2
number_chars(1,[C,C]). type_error(ch.,_) in._e. OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
number_chars(0,[C,C]). type_error(ch.,_) in._e. OK2 new OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
number_chars(10,[C,D]). type_error(ch.,_) OK2 OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
number_chars(100,[C,D]). type_error(ch.,_) in._e. OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
number_chars(N,[X|2]). type_error(list,[_|2]) OK2 OK2 new OK2 OK2 OK2 OK2 OK2 OK2 OK2
number_chars(N,[1|_]). instantiation_error OK2 OK1 new OK1 OK2 OK2 OK2 OK2 OK2 ty._e.(atom,1)
number_chars(V,[1|2]). type_error(list,[1|2]) OK2 OK1 new OK1 new OK2 OK2 OK2 OK2 ty._e.(digit,[1|2]) ty._e.(atom,1)
number_chars([],1). type_error(number,[]) OK1 OK1 OK2 OK1 OK1 OK1 ty._e.(double,[]) OK1 fails
number_chars(1,1). fails OK2 OK2 OK2 OK2 new OK2 new OK1 OK1 OK1 OK1
number_chars(1,[a|2]). fails OK2 OK2 new OK2 new OK2 new OK2 new OK1 OK1 OK1 OK1
number_chars(1,[_|2]). fails OK2 OK1 OK1 new OK2 new OK2 new OK1 OK1 OK1 OK1
number_chars(1,[[]|_]). fails OK2 OK2 OK1 in._e. OK2 new OK1 OK1 OK1 OK1
number_chars(1,[[]|2]). fails OK2 OK2 OK2 OK2 new OK2 new OK1 XXX OK1 OK1
Section 2 DTC2 8.16.7.3 New state according to DTC2 8.16.7.3 and according to 8.16.7.2 Template and modes of 13211-1:1995.
number_chars(1,[C]). C = '1' OK2 OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 ??? OK2
number_chars(1,[C,D]). fails in._e. OK2 new OK2 new OK2 new OK2 OK2 OK2 OK2 ??? OK2
number_chars(1,[C,C]). fails in._e. OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 ??? OK2
number_chars(0,[C,C]). fails in._e. OK2 new OK2 new OK2 new OK2 OK2 OK2 OK2 ??? OK2
number_chars(10,[C,D]). C = '1', D = '0'. OK2 OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 ??? OK2
number_chars(100,[C,D]). fails in._e. OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 ??? OK2
number_chars(N,[X|2]). or instantiation_error OK2 OK2 new OK2 OK2 OK2 OK2 OK2 ty._e.(d.a.,...) new ??? OK2
number_chars(N,[1|_]) or type_error(ch.,1). OK2 OK1 new OK1 OK2 OK2 OK2 OK2 ty._e.(d.a.,...) new ty._e.(atom,1)
number_chars(V,[1|2]). or type_error(ch.,1) OK2 OK1 new OK1 new OK2 OK2 OK2 OK2 ty._e.(d.a.,...) new ty._e.(atom,1)
number_chars([],1). or type_error(list,1) OK1 OK1 OK2 OK1 OK1 OK1 ty._e.(double,[]) OK1 fails
number_chars(1,1). type_error(list,1) OK2 OK2 OK2 OK2 new OK2 new OK1 OK1 OK2 OK1
number_chars(1,[a|2]). type_error(list,[a|2]) OK2 OK2 new OK2 new OK2 new OK2 new OK1 OK1 OK2 OK1
number_chars(1,[_|2]). type_error(list,[_|2]) OK2 OK1 OK1 new OK2 new OK2 new OK1 OK1 ty._e.(d.a.,...) new OK1
number_chars(1,[[]|_]). type_error(ch.,[]) OK2 OK2 OK1 in._e. OK2 new OK1 OK1 ty._e.(d.a.,...) new OK1
number_chars(1,[[]|2]). e.g. type_error(ch.,[]) OK2 OK2 OK2 OK2 new OK2 new OK1 XXX ty._e.(d.a.,...) new OK1
Out of scope of 13211-1, but still of relevance
L=['1'|L], number_chars(N,L). type_error(list,['1'|...])
provided
L=['1'|L] succeeds
halt OK abort halt segv loops halt fails abort

Validated HTML