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.8#5
GNU
1.4.0
SICStus
4.3beta1
MINERVA
2.4
XSB
3.5.0 rev. 8235
Ciao
1.13.0
Section 0 13211-1:1995 Undisputed cases that are not changed by Cor.2
1 number_chars(1.2,['1',.,'2']). succeeds OK OK OK OK OK OK OK OK new OK
2 number_chars(1.0e9,['1',.,'0','E','9']). succeeds OK OK OK OK OK OK new OK OK new fails
3 number_chars(1,['0','1']). succeeds OK OK OK OK OK OK new fails OK new fails
4 number_chars(1,[a]). syntax_error(..) OK OK OK OK OK OK new fails OK new fails
5 number_chars(1,[]). syntax_error(..) OK OK OK OK new OK OK new fails OK new fails
6 number_chars(1,[[]]). type_error(ch.,[]) OK OK new OK OK OK new OK new fails ty._e.(d.a.,...) new fails
7 number_chars(1,[' ',[]]). type_error(ch.,[]) OK OK new OK OK OK new OK new fails ty._e.(d.a.,...) new fails
8 number_chars(1,[0]). type_error(ch.,0) OK sy._e.(..) sy._e.(..) OK new OK new OK new fails ty._e.(d.a.,...) new ty._e.(atom,0)
9 number_chars(1,[_,[]]). type_error(ch.,[]) OK fails fails new fails OK new OK new fails ty._e.(d.a.,...) new fails
10 number_chars(N,[X]). instantiation_error OK OK new OK OK OK OK OK OK OK
11 number_chars(N,['0'|_]). instantiation_error OK OK new OK OK OK OK OK OK N = 0
12 number_chars(N,'1'). type_error(list,'1') OK OK OK OK OK OK OK OK fails
13 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
14 number_chars(N,[49]). type_error(ch.,49) OK N = 1 N = 1 OK OK OK OK OK fails
15 number_chars(N,[]). syntax_error(..) OK OK OK OK new OK OK OK OK fails
16 number_chars(N,['3',' ']). syntax_error(..) N = 3 OK OK OK OK OK OK OK fails
17 number_chars(N,['3',.]). syntax_error(..) OK OK OK OK OK OK N = 3.0 N = 3.0 fails
18 number_chars(N,[' ','1']). N = 1 OK OK OK OK OK OK OK OK fails
19 number_chars(N,['\n','1']). N = 1 OK OK OK OK new OK OK OK OK fails
20 number_chars(N,[' ','0','''',a]). N = 0'a, N = 97 OK OK OK new OK OK OK OK sy._e.(..) fails
21 number_chars(N,[-,' ','1']). N = -1 OK sy._e.(..) sy._e.(..) OK OK new OK sy._e.(..) sy._e.(..) fails
22 number_chars(N,[/,*,*,/,'1']). N = 1 sy._e.(..) sy._e.(..) sy._e.(..) OK sy._e.(..) OK new sy._e.(..) sy._e.(..) fails
23 number_chars(N,['%','\n','1']). N = 1 sy._e.(..) sy._e.(..) sy._e.(..) OK sy._e.(..) OK new sy._e.(..) sy._e.(..) fails
24 number_chars(N,[-,/,*,*,/,'1']). syntax_error(..) OK OK OK N = -1 OK OK OK OK fails
25 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
26 number_chars(N,['1',.,'0',e]). syntax_error(..) OK OK OK OK OK OK OK N = 1.0 fails
27 number_chars(N,['1',.,'0',e,e]). syntax_error(..) OK OK OK OK new OK OK OK OK fails
28 number_chars(N,['0',x,'1']). N = 1 OK OK OK OK OK OK OK N = 1.0 fails
29 number_chars(N,['0','X','1']). syntax_error(..) OK OK OK new OK OK new OK OK N = 1.0 fails
30 number_chars(1E1,_). syntax error success success success OK OK OK success OK OK
47 number_chars(1,['.'|_]). fails inst._e. OK OK inst._e. OK OK OK inst._e. OK
48 number_chars(N,[+,'1']). syntax error N = 1. N = 1. N = 1. OK OK OK new N = 1. N = 1. fails
49 number_chars(N,[+,' ','1']). syntax error N = 1. OK OK OK OK OK new OK OK fails
50 number_chars(N,['''',+,'''','1']). syntax error OK OK OK OK OK OK OK OK fails
51 number_chars(N,['11']). type_error(ch.,_) OK ty._e.(ch._co,'11') OK OK OK OK OK N = 1 fails
52 number_chars(N,['1.1']). type_error(ch.,_) OK ty._e.(ch._co,'11') OK OK OK OK OK N = 1 fails
53 number_chars(1+1,['2']). type_error(number,1+1) success OK OK OK OK OK ty._e.(double,1+1) fails OK
Section 1 13211-1:1995 8.16.7.3 Old state according to 8.16.7.3 Errors of 13211-1:1995
31- number_chars(1,[C]). type_error(ch.,_) OK2 OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
32- number_chars(1,[C,D]). type_error(ch.,_) in._e. OK2 new OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
33- number_chars(1,[C,C]). type_error(ch.,_) in._e. OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
34- number_chars(0,[C,C]). type_error(ch.,_) in._e. OK2 new OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
35- number_chars(10,[C,D]). type_error(ch.,_) OK2 OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
36- number_chars(100,[C,D]). type_error(ch.,_) in._e. OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
37- number_chars(N,[X|2]). type_error(list,[_|2]) OK2 OK2 new OK2 OK2 OK2 OK2 OK2 OK2 OK2
38- number_chars(N,[1|_]). instantiation_error OK2 OK1 new OK1 OK2 OK2 OK2 OK2 OK2 ty._e.(atom,1)
39- 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)
40- number_chars([],1). type_error(number,[]) OK1 OK1 OK2 OK1 OK1 OK1 ty._e.(double,[]) OK1 fails
41- number_chars(1,1). fails OK2 OK2 OK2 OK2 new OK2 new OK2 new OK1 OK1 OK1
42- number_chars(1,[a|2]). fails OK2 OK2 new OK2 new OK2 new OK2 new OK1 OK1 OK1 OK1
43- number_chars(1,[_|2]). fails OK2 OK1 OK1 new OK2 new OK2 new OK1 OK1 OK1 OK1
44- number_chars(1,[[]|_]). fails OK2 OK2 OK1 in._e. OK2 new OK1 OK1 OK1 OK1
45- number_chars(1,[[]|2]). fails OK2 OK2 OK2 OK2 new OK2 new OK1 OK1 OK1 OK1
Section 2 Cor.2 8.16.7.3 New state according to Cor.2 8.16.7.3 and according to 8.16.7.2 Template and modes of 13211-1:1995.
31 number_chars(1,[C]). C = '1' OK2 OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
32 number_chars(1,[C,D]). fails in._e. OK2 new OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
33 number_chars(1,[C,C]). fails in._e. OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
34 number_chars(0,[C,C]). fails in._e. OK2 new OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
35 number_chars(10,[C,D]). C = '1', D = '0'. OK2 OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
36 number_chars(100,[C,D]). fails in._e. OK2 OK2 new OK2 new OK2 OK2 OK2 OK2 OK2
37 number_chars(N,[X|2]). or instantiation_error OK2 OK2 new OK2 OK2 OK2 OK2 OK2 OK2 new OK2
38 number_chars(N,[1|_]). or type_error(ch.,1). OK2 OK1 new OK1 OK2 OK2 OK2 OK2 OK1 ty._e.(atom,1)
39 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)
40 number_chars([],1). or type_error(list,1) OK1 OK1 OK2 OK1 OK1 OK1 ty._e.(double,[]) OK1 fails
41 number_chars(1,1). type_error(list,1) OK2 OK2 OK2 OK2 new OK2 new OK2 new OK1 OK1 reg OK1
42 number_chars(1,[a|2]). type_error(list,[a|2]) OK2 OK2 new OK2 new OK2 new OK2 new OK2 new OK1 ty._e.(l.,2) new OK1
43 number_chars(1,[_|2]). type_error(list,[_|2]) OK2 OK1 OK1 new OK2 new OK2 new OK2 new OK1 ty._e.(d.a.,...) new OK1
44 number_chars(1,[[]|_]). type_error(ch.,[]) OK2 OK2 OK1 in._e. OK2 new OK2 new OK1 OK1 reg OK1
45 number_chars(1,[[]|2]). e.g. type_error(ch.,[]) OK2 OK2 OK2 OK2 new OK2 new OK2 new OK1 ty._e.(d.a.,...) new OK1
Out of scope of 13211-1, but still of relevance
46 L=['1'|L], number_chars(N,L). type_error(list,['1'|...])
provided
L=['1'|L] succeeds
halt OK abort halt segv OK new halt fails abort
quad
Validated HTML