From ... Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!134.222.94.5!npeer.kpnqwest.net!nreader1.kpnqwest.net.POSTED!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: Substring? References: <892f97d1.0108091339.3f808c98@posting.google.com> <892f97d1.0108100559.378527e7@posting.google.com> Mail-Copies-To: never From: Erik Naggum Message-ID: <3206456282836739@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 17 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 10 Aug 2001 18:18:04 GMT X-Complaints-To: newsmaster@Norway.EU.net X-Trace: nreader1.kpnqwest.net 997467484 193.71.66.49 (Fri, 10 Aug 2001 20:18:04 MET DST) NNTP-Posting-Date: Fri, 10 Aug 2001 20:18:04 MET DST Xref: archiver1.google.com comp.lang.lisp:14290 * theglauber@my-deja.com (glauber) > I really hoped that there would be a function to copy an "array slice" > that would map in a low level to a memcpy, but there doesn't seem to > be anything in the arrays dictionary in the spec. You can do better than that. An adjustable, displaced array may be your answer. Suppose you have a string and need to compute a hash value of a substring and the hash function does not take :start and :end arguments. You could wrap the call to the hash function in something like this: (defun funcall-with-substring (function string &key (start 0) end) (let ((substring (load-time-value (make-array 0 :element-type 'character :adjustable t)))) (funcall function (adjust-array substring (- (or end (length string)) start) :displaced-to string :displaced-index-offset start)))) ///