Tango DeRailed,DeActive Nomen est Omen ?
Bjoern
nanali at nospam-wanadoo.fr
Sun Mar 2 01:13:18 PST 2008
Hi Julio,
> OK, I've read most of what you suggested, and also found this post on
> the Sendero forum wich seems very interesting:
> http://www.dsource.org/forums/viewtopic.php?t=3580
Oh, that's indeed interresting.
> When you say "implement LISP like lists in D" are you suggesting adding
> LISP lists to the language or in a library? Because I think it a list of
> Variants as implemented on Tango would provide the same functionality.
Lisp like list are able to contain other lists and that is afaik not
doable using a list of variants.
A snippet :
module lisplist;
alias void* POINTER;
/**
A CONS is a data structure that can construct lists.
It consists of two cells, called the "car" cell and the "cdr" cell.
A CONS is to symbolic processing what a binary digit is to numerical
processing.
By combining CONS we can form lists, binary trees, hierarchies,
and an infinite number of other useful data structures.
*/
struct CONS // A CONS is two pointers
{
POINTER car;
POINTER cdr;
}
alias CONS* LIST; // A LIST is a pointer to a CONS
/** cpush (cons push)
Adds a CONS to the head of a list
modify the cdr cell of *z to point to *lst.
Set lst to point to the CONS z and return a pointer to the CONS.
*/
LIST cpush(CONS *z, LIST *lst)
{
z.cdr = *lst;
return *lst = z;
}
---------------
You can imagine that this datatype is very flexible. The idea is to use
this type to implement "RowSet".
As said it is just an idea, or inspiration if you like, may be not worth
the effort but I'd like to give it a try.
I guess I will add some more functionalty to the snippet this afternoon.
pop, cpop, reverse, merge and publish it using this forum-thread.
Bjoern
More information about the Digitalmars-d
mailing list