Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion simple-array vs displaced-to

Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!newsfeed.berkeley.edu!ucberkeley!agate.berkeley.edu!agate!not-for-mail
From: t...@famine.OCF.Berkeley.EDU (Thomas F. Burdick)
Newsgroups: comp.lang.lisp
Subject: Re: simple-array vs displaced-to
Date: 17 Jan 2004 12:54:54 -0800
Organization: University of California, Berkeley
Lines: 30
Message-ID: <xcv1xpyjnxd.fsf@famine.OCF.Berkeley.EDU>
References: <bubho8$u56$1@news-reader1.wanadoo.fr>
NNTP-Posting-Host: famine.ocf.berkeley.edu
X-Trace: agate.berkeley.edu 1074372895 42951 192.58.221.246 (17 Jan 2004 20:54:55 GMT)
X-Complaints-To: usenet@agate.berkeley.edu
NNTP-Posting-Date: Sat, 17 Jan 2004 20:54:55 +0000 (UTC)
X-Newsreader: Gnus v5.7/Emacs 20.7

Martin Raspaud <martin.rasp...@wanadoo.fr> writes:

> One would say "why not give as parameter to the processing funtion the 
> big array and an offset ?"
> Well, I don't really like this, it doesn't feel the write way to do it 
> to me.

Incidentally, if you just don't like having to pass three args to your
processing functions, you could wrap it all up in a class:

  (defclass darray ()
    ((array :initarg displaced-to)
     (start :initarg start)
     (end :initarg end)))

  (defun consumer (darray)
    (with-slots (array start end) darray
      (declare (type <x> array))
      (loop for i from start below end
            ...)))

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'