Re: double_quotes doesnt return codes in SWI-Prolog



On 2005-05-21, blindsearch <dpatte3@xxxxxxxxxxx> wrote:
> I'm using SWI-Prolog 5.4.7, i've read the manual and the default
> behaviour for double_quotes is to return the code i.e "A" -> 65.

Note that it creates a _list_:

"A" --> [65]

> This works if I'm using the Prolog prompt but in my code, it doesnt,
> I've tried setting it set_prolog_flag(double_quotes,codes)
> it doesnt work, I've tried setting it to all the other possible values,
> nothing works.
>
> Here's my code:
>
> read_entrys("@",Stream) :- % after @, read in the type
> !, get0(Stream,C), read_type(C,Stream).
> read_entrys(_C,Stream) :- % ignore anything else
> read_entrys(Stream).
>
> The first clause never unifies.
> I don't want to resort to read_entrys(64,Stream) ...

You want a character:

read_entrys(0'A, Stream) :-
...

The double-quotes flag works just fine:

:- set_prolog_flag(double_quotes, codes).

codes :-
writeln("codes").

:- set_prolog_flag(double_quotes, chars).

chars :-
writeln("chars").

1 ?- codes.
[99, 111, 100, 101, 115]

Yes
2 ?- chars.
[c, h, a, r, s]

Cheers --- Jan
.



Relevant Pages

  • double_quotes doesnt return codes in SWI-Prolog
    ... This works if I'm using the Prolog prompt but in my code, it doesnt, ... it doesnt work, I've tried setting it to all the other possible values, ... I don't want to resort to read_entrys... ... Prev by Date: ...
    (comp.lang.prolog)
  • How do I restart trial periods for testing software?
    ... Uninstalling it and then installing it again doesnt work, ... Prev by Date: ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: DBNull.Value
    ... >i cant use DBNull.Value ... > Public Property Son_Degisiklik_TarihiAs Date ... Prev by Date: ...
    (microsoft.public.dotnet.general)
  • Re: 180 unispin. go me.
    ... but It doesnt work:( ... Julien Renaud ... kapoute's Profile: http://www.unicyclist.com/profile/8060 ... Prev by Date: ...
    (rec.sport.unicycling)
  • Re: Domain Problems
    ... no the A record as been the www folder since, when i created it three days ... ago and its doesnt work. ... before so i wouldnt know. ... Prev by Date: ...
    (microsoft.public.win2000.networking)