evaluates differently on different operating systems
michael j pan <[email protected]>
| Newsgroups | gmane.comp.gnu.prolog.bugs |
|---|---|
| Message-ID | <[email protected]> |
given the attached file,
scheme_term(N, [a, a|b])
gprolog 1.2.16 returns "no" on a "i686 athlon linux" machine.
the correct answer, returned by a "sunos national 5.8 sun4u sparc sunw
ultra-60" machine, should be
['(',a,a,'.',b,')']
and
['(',a,'.','(',a,'.',b,')',')']
--
*************************************
this message is digitally signed.
you can use the public key located at
http://www.cs.ucla.edu/~mjpan/gpg.asc
to verify its authenticity.
*************************************
_______________________________________________
Bug-prolog mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/bug-prolog
gilkerso.pl
(text/plain, 1.2 KB)
%Damon Gilkerson 802-831-346
scheme_term(L, S) :- datum(S, L, []).
datum(S) --> simple_datum(S).
datum(S) --> compound_datum(S).
simple_datum(S) --> boolean(S).
simple_datum(S) --> symbol(S).
boolean('#f') --> ['#f'].
boolean('#t') --> ['#t'].
symbol(S,[S|A], A) :- S\==[], S\=='(', S\=')', S\=='.', S\=='''', atom(S).
compound_datum(S) --> list(S).
list(S) --> abbreviation(S).
list(S) --> ['('], datum_star(S, N),[')'], {integer(N)}.
list([S1,S2]) --> ['('], datum_plus(S1,N),['.'], datum(S2), [')'], {integer(N), list(S2)}.
list(S) --> {var(S)}, ['('], !, datum_plus(S1,N),['.'], datum(S2), [')'], {integer(N), concat(S1,S2,S), atom(S2)}.
list(S) --> {nonvar(S), concat(S1,S2,S), atom(S2)}, ['('], !,datum_plus(S1,N),['.'], datum(S2), [')'], {integer(N)}.
abbreviation([S1,S2]) --> abbrev_prefix(S1), datum(S2).
abbrev_prefix(quote) --> [''''].
datum_star([],0) --> [].
datum_star([S1|S2], N) --> datum(S1), datum_star(S2,N0), {N is N0 + 1}.
datum_star([S1|S2], N) --> datum(S1), ['.'], ['('], datum_star(S2,N0), [')'], {N is N0 + 1}.
datum_plus([S1|S2], N) --> datum(S1), datum_star(S2,N0), {N is N0 + 1}.
concat([L1|[]], S, [L1|S]).
concat([L1|L2], S, [L1|E]) :- L2\=[], concat(L2, S, E).
signature.asc
(application/pgp-signature, 249 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE/ryodRroYev1ySA4RAq/cAJ95S35rSLJG5RTiiqmw1FEwM2eUCACfQyRS Pka/eEZirOTsF/7qSfiS+dw= =vgKy -----END PGP SIGNATURE-----