Recursive parametric object specification?

Suggestions for new Logtalk features

Moderator: Paulo Moura

Post Reply
Posts: 1
Joined: Tue Jul 28, 2009 4:39 pm

Recursive parametric object specification?

Post by RandyHelzerman » Tue Jul 28, 2009 6:09 pm

Hi, I love being able to do things like:

Code: Select all

     get_x(X) :- this(point(X,_)).
But I would also like to be able to do similar things for more recursive data structures. For example, something like this:

Code: Select all

:-object([_|T]), list(T).   % yeah this is ugly, just want to specify the recursive structure
    append(Y,Z) :-
then we could do things like say [1,2]::append([3,4],Z).

For lists, this might be overkill, but suppose you wanted to define an object which was a red-black tree, or another more complex recursive structure....

Anyways, would this make sense, or are there better ways to do it already available?

Paulo Moura
Logtalk developer
Posts: 493
Joined: Sat May 05, 2007 8:35 am
Location: Portugal

Re: Recursive parametric object specification?

Post by Paulo Moura » Tue Jul 28, 2009 6:41 pm

See the "parametric" example in the current Logtalk distribution for a programming example of defining lists as a parametric object: ... metric.lgt
Paulo Moura
Logtalk developer

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest