Subject: Re: What is a type error?
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 17 Jul 2006 03:39:44 -0500
Newsgroups: comp.lang.perl.misc,comp.lang.python,comp.lang.java.programmer,comp.lang.lisp,comp.lang.functional
Message-ID: <EJydnZRij7pN0SbZnZ2dnUVZ_sKdnZ2d@speakeasy.net>
Joachim Durchholz  <jo@durchholz.org> wrote:
+---------------
| INSERT cannot be expressed in terms of assignment. INSERT creates a new 
| record; there's no way that assignment in a language like C can create a 
| new data structure!  The same goes for DELETE.
+---------------

Well, what about "malloc()" & "free()"? I mean, if your
"database" is a simple linked list, then INSERT is just:

    ROW *p = malloc(sizeof *p);
    p->field1 = value1;
    p->field2 = value2;
    ...
    p->fieldN = valueN;
    database = cons(p, database);		/* Common Lisp's CONS */

and DELETE is just:

    ROW *p = find_if(predicate_function, database); /* CL's FIND-IF */
    database = delete(p, database);		/* CL's DELETE */
    free(p);

[There are single-pass methods, of course, but...]


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607