[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
evaluates differently on different operating systems
From: |
michael j pan |
Subject: |
evaluates differently on different operating systems |
Date: |
Sun, 09 Nov 2003 22:03:06 -0800 |
User-agent: |
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5) Gecko/20031007 |
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.
*************************************
%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).
pgpWYnm8gMbYQ.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- evaluates differently on different operating systems,
michael j pan <=