AI-Prolog

 view release on metacpan or  search on metacpan

data/sleepy.pro  view on Meta::CPAN


swat :-
    i_am_at(Place),
    not(at(fly, Place)),
    print('You swish the flyswatter through the air.'), nl.

    /* Have flyswatter, room is lit, fly is here and alive. */

swat :-
    buzz_off,
    print('The fly escapes into the other room.'), nl.

swat :-
    print('Success! You killed that pesky fly!'), nl,
    retract(alive(fly)).

swat :- /* For debugging... */
    print('You must have forgotten a case!', nl).

make_visible(X) :-
    visible_object(X).

t/40parser.t  view on Meta::CPAN

$parser->getname;
$parser->advance; # skip )
$parser->advance; # skip .
$parser->skipspace;
$parser->getname; # owns
$parser->advance; # skip (
$parser->getname; # owns
$parser->advance; # skip ,
$parser->skipspace;
# not sure of the best way to handle this
is $parser->getname, 'heap o\\\'junk', 'The parser should be able to handle single quoted atoms with escape';
is $parser->current, ')',
    '... and the current character should be the first one after the final quote';
is $parser->_start, 38, '... and have the parser should start at the first quote';
is $parser->_posn, 52, 
    '... and have the posn point to the first char after the last quote';

#
# really ensure that the parser can handle numbers
#



( run in 0.511 second using v1.01-cache-2.11-cpan-c21f80fb71c )