Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!seismo!ut-sally!utah-cs!shebs From: shebs@utah-cs.UUCP (Stanley Shebs) Newsgroups: net.ai,net.lang.lisp Subject: Re: Common LISP style standards. Message-ID: <3802@utah-cs.UUCP> Date: Thu, 29-May-86 11:20:04 EDT Article-I.D.: utah-cs.3802 Posted: Thu May 29 11:20:04 1986 Date-Received: Sat, 31-May-86 06:35:07 EDT References: <2784@jhunix.UUCP> <3787@utah-cs.UUCP> <545@bcsaic.UUCP> Reply-To: shebs@utah-cs.UUCP (Stanley Shebs) Distribution: net Organization: University of Utah CS Dept Lines: 32 Xref: watmath net.ai:3549 net.lang.lisp:854 In article <545@bcsaic.UUCP> michaelm@bcsaic.UUCP (michael maxwell) writes: >I'm in a little different boat, since we're using Franz rather than Common >Lisp I remember Franz (vaguely)... :-) >A common situation we find ourselves in is the following. We have a long list, >and we wish to apply some test to each member of the list. However, at some >point in the list, if the test returns a certain value, there is no need to >look further: we can jump out of processing the list right there, and thus >save time. Common Lisp provides "some", "every", "notany", and "notevery" functions which all do variations of what you're asking for. They take a predicate and one or more sequences as arguments, and apply the predicate to each element in the sequence, and may stop in the middle. The behavior is sufficiently specified for you to use side effects in the predicate. BTW, if these four functions weren't around, Common Lisp would be smaller. >I suppose I could use "catch" and "throw", but that looks so much like "goto" >that I feel sinful if I use that solution... "Sinfulness" is a silly concept that quite a few folks in the computer community have gotten into - a sort of aftereffect of structured programming. The *real* reason for using higher-level constructs is efficiency, both in programmer and execution time. >Mike Maxwell stan shebs utah-cs!shebs