ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-AI
perl-AI
Re: Prolog/Perl variadic predicates
by Lee Goddard other posts by this author
Jul 17 2002 4:40PM messages near this date
Prolog/Perl variadic predicates | AI::Perlog
At 21:35 16/07/2002, Ovid wrote:
> This is a follow up to my previous email 
> re:  http://www.perlmonks.org/index.pl?node_id=181980.
> 
> Since I'm trying to create "Perlog", a Prolog-like implementation in Perl, 
> I've run across an
> issue which could cause some problems.  Specifically, are variadic 
> (varying number of arguments)
> predicates allowed in Prolog?  In other words, can someone do this:
> 
>    foo( bar, baz ).
>    foo( bar, quux, camel ).

Yes. they're essential. Your two predicates would
be foo/2 and foo/3.

 > ...
> If variadic predicates are allowed, what would they be used for?  If I can 
> safely exclude them
> from the Perl implementation, this would make life much easier.

You certainly cannot exclude them from any implimentation
of PROLOG and call it PROLOG - for examples of use, see any
number of textbooks. One thought is a routine that calls
itself with an argument: if there is no argument, it's the
first call.  Agh, not clear, sorry, but I've had a very
busy weekend, and am still a tad drunk (just married).

Good luck -- have you seen the existing Prolog in Perl?

Lee
Thread:
Ovid
Ovid
Lee Goddard
Ovid
Ovid
Lee Goddard
Andreas Marcel Riechert

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved