Prolog/Perl variadic predicates
by Ovid other posts by this author
Jul 16 2002 7:35PM messages near this date
Prolog in Perl
|
Re: Prolog/Perl variadic predicates
This is a follow up to my previous email re: http://www.perlmonks.org/index.pl?node_id=1819
80.
Since I'm trying to create "Perlog", a Prolog-like implementation in Perl, I've run across a
n
issue which could cause some problems. Specifically, are variadic (varying number of argume
nts)
predicates allowed in Prolog? In other words, can someone do this:
foo( bar, baz ).
foo( bar, quux, camel ).
I think I have the data structure issue figured out, but if I have to allow for the above sy
ntax,
I'm going to have problems auto-generating code.
I'm *assuming* that anything approaching variadic predicates would be handled with lists, th
ereby
avoiding the problem:
foo( bar, [ baz ] ).
foo( bar, [ quux, camel ] ).
If variadic predicates are allowed, what would they be used for? If I can safely exclude th
em
from the Perl implementation, this would make life much easier.
Cheers,
Curtis "Ovid" Poe
=====
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A
__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com
Thread:
Ovid
Ovid
Lee Goddard
Ovid
Ovid
Lee Goddard
Andreas Marcel Riechert
|