Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!decvax!decwrl!ucbvax!HNYKUN52.BITNET!DESMEDT From: DESMEDT@HNYKUN52.BITNET.UUCP Newsgroups: mod.ai Subject: Lisp & lazy evaluation Message-ID: <8606030624.AA27133@ucbvax.Berkeley.EDU> Date: Mon, 2-Jun-86 04:27:00 EDT Article-I.D.: ucbvax.8606030624.AA27133 Posted: Mon Jun 2 04:27:00 1986 Date-Received: Tue, 3-Jun-86 21:32:00 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 21 Approved: ailist@sri-ai.arpa In AIList Digest V4 #134, Mike Maxwell reluctantly prefers the efficiency of a hand-coded "do" construction in Lisp, although mapping a function on a list would be more elegant. Indeed, mapping sometimes causes many unnecessary computations. Consider the following example: (defun member (element list) (apply 'or (mapcar #'(lambda (list-element) (eql element list-element)) list))) One solution to prevent wasteful computation is a "lazy" evaluation mechanism, which computes only as much as is needed by other computations. For example, the mapping in the above example would be performed only up to the point where "or" finds a non-nil value and doesn't want to evaluate any more arguments. Anyway, I don't really want to lecture here, but I want to ask a question: has anyone out there experimented with lazy evaluation in a Lisp system? Are any working systems (or prototypes) available? Any good references to the literature? Koenraad de Smedt desmedt@hnykun52.bitnet