Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!news!gateley From: gateley@rice.edu (John Gateley) Newsgroups: comp.lang.scheme Subject: Re: Why memq vs memv vs member, etc.? Message-ID: Date: 15 May 91 15:55:51 GMT References: <1991May10.230057.15591@Think.COM> Sender: news@rice.edu (News) Organization: Rice University Lines: 31 In-Reply-To: chip@soi.UUCP's message of 13 May 91 13:58:04 GMT In article chip@soi.UUCP (Chip Morris) writes: barmar@think.com (Barry Margolin) writes: >.... This seems to be an area where Common Lisp does what >I'd expect Scheme to do; CL has a single MEMBER function with a :TEST >option, while Scheme has MEMQ, MEMV, and MEMBER. Why not (member > eq?) instead of (memq )? I agree with Mr. Margolin on the style and generality of his proposal. However, I just finished speeding up a large Common Lisp application in which using MEMQ was much faster than using MEMBER (with a :TEST of #'EQ) was quite significant. The overhead of the additional parameters, especially keyword parameters, was alone enough to make a difference. I find this surprising - did you try playing with the speed, safety and other declarations to get high optimizations? The compiler should be able to replace the call (member foo bar :test #'eq) with the call (memq foo bar) fairly easily. Disclaimer - I haven't used Lucid before. On a more general note - how many compilers actually perform optimizations on optional, rest, and keyword arguments? John gateley@rice.edu -- "I've thought the thoughts of little children and the thoughts of men I've thought the thoughts of stupid people who have never been so much in love as they should be and got confused too easily to fall in love again." The Residents and Renaldo and the Loaf