Re: EC_word::arg

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Mon 06 Jan 2003 04:28:26 PM GMT
Message-ID: <3E19AEAA.46EB6A1F@icparc.ic.ac.uk>
Georg Fette wrote:
> 
> I thought, the method I'm interested in does return the nth item of the
> asked list :
> 
> " int EC_word::arg(const int,EC_word&)
> checks whether the EC_word is a compound term and if so, returns its nth
> argument. "


This arg() function works like the arg/3 builtin predicate,
see the reference manual.

You need to understand the difference between a structure
with many arguments and a list:

A structure is something like foo(a,b,c,d,e,f) and for
example this structure's 3rd argument is c.

A list [a,b,c,d,e,f] is a nested structure of list cells,
each of which has just 2 arguments, head and tail. It is
just different syntax for .(a, .(b, .(c, .(d, .(e, .(f, []))))))

-- 
 Joachim Schimpf              /             phone: +44 20 7594 8187
 IC-Parc, Imperial College   /            mailto:J.Schimpf@ic.ac.uk
 London SW7 2AZ, UK         /    http://www.icparc.ic.ac.uk/eclipse
Received on Mon Jan 06 16:30:50 2003

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:20 PM GMT GMT