Re: Problem with phrase/3: help examples not working

Carlo Capelli <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CABty9wy-VSYRdUfQe9whANqDzVXv=XEy2Zb6ucOFvJjMQ5n9Ow@mail.gmail.com>
Hi Fran

integer//1 is defined in library(dcg/basics) and double quoted literals
have changed a lot in latest versions (7.x).

?- use_module(library(dcg/basics)).
%   library(pairs) compiled into pairs 0.00 sec, 22 clauses
%  library(lists) compiled into lists 0.02 sec, 122 clauses
% library(dcg/basics) compiled into dcg_basics 0.03 sec, 201 clauses
true.

?- string_codes("123 ready", Cs),phrase(integer(N),Cs,P).
Cs = [49, 50, 51, 32, 114, 101, 97, 100, 121],
N = 123,
P = [32, 114, 101, 97, 100, 121].




2014-02-12 12:50 GMT+01:00 Francisco José Gallego Durán <
[email protected]>:

> Hi everyone,
>
>    I am pretty new to this list, but I have been playing with prolog for
> several years and using Swi-Prolog quite a lot. (I implemented a game
> called PLMan<
> http://plman.i3a.ua.es/downloads/category/1-game?download=1%3Aplman>that
> we use to teach logic and prolog programming to our students at the
> University of Alicante).
>
>    I have a machine with Arch Linux and SWI 6.2.6 32bits multithreaded, and
> looked at help(phrase) to find this example:
>
> *    | ?- phrase(integer(X), "42 times", Rest).
> |*
> *    | X = 42
> |*
> *    ||Rest_=_[32,_116,_105,_109,_101,_115]____*
>
>
>    I copied it down to the interpreter and got this answer:
>
> *?- phrase(integer(X), "42 times", Rest).*
> *ERROR: phrase/3: Undefined procedure: integer/3*
> *ERROR:   However, there are definitions for:*
> *ERROR:         integer/1*
> *   Exception: (7) integer(_G550, [52, 50, 32, 116, 105, 109, 101, 115],
> _G578) ? *
>
>
>    Did I do something wrong, or is it just an outdated-help case?
>
>    I take this opportunity to thank Jan for his work in creating and
> maintaining SWI-Prolog. We have been using it for years and it has worked
> flawlessly :).
>
> Cheers,
> Fran.
>
>
> ----------------------------------------------------------------------------------------
> *Francisco José Gallego Durán*
> Dpto. de Ciencia de la Computación e Inteligencia Artificial // Universidad
> de Alicante
> (+34) 965903400 (Ext. 2073)
>
> ----------------------------------------------------------------------------------------
> -------------- next part --------------
> HTML attachment scrubbed and removed
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.