Newsgroups: comp.lang.lisp.x
Path: cantaloupe.srv.cs.cmu.edu!nntp.club.cc.cmu.edu!goldenapple.srv.cs.cmu.edu!das-news2.harvard.edu!news.dfci.harvard.edu!camelot.ccs.neu.edu!news.mathworks.com!gatech!news-relay.ncren.net!hearst.acc.Virginia.EDU!murdoch!usenet
From: sdm7g@Virginia.EDU
Subject: Re: call-cfun
X-Nntp-Posting-Host: bootp-17-17.bootp.virginia.edu
Content-Type: text/plain; charset=US-ASCII
Message-ID: <AF605997-10EBC3@128.143.17.17>
To: "William D. Shannon" <shannon@osler.wustl.edu>
X-Newsgroups-To: nntp://news.virginia.edu/comp.lang.lisp.x
Sender: usenet@murdoch.acc.Virginia.EDU
Content-Transfer-Encoding: 7bit
Organization: University of Virginia
References: <33331030.605F@osler.wustl.edu>
Mime-Version: 1.0
Date: Thu, 27 Mar 1997 22:06:23 GMT
X-Mailer: Cyberdog/2.0b1
X-News-Servers: news.virginia.edu
Lines: 69

On Fri, Mar 21, 1997 5:48 PM, William D. Shannon
<mailto:shannon@osler.wustl.edu> wrote: 
>Running
>
>	(call-cfun "foo" arg1 ... argn)
>
>returns a list of the arguments ((arg1) (arg2) ... (argn)) displayed on
>the monitor.  I will be passing large lists to c functions and would
>like to turn off the printing and just store it in a variable. I would
>like to have the following:
>
>	> (setf a (call-cfun "foo" arg1 ... argn))
>	nil
>	> a
>	((arg1) (arg2) ... (argn))
>
>Is this possible?
>
>Thanks,
>Bill
>

( progn  [ expr... ]  exprn ) 
will evaluate all of the expressions, returning the value of the last, so

( progn ( setf a ( call-cfun "foo" arg1 ... argn )) nil )

will return nil.


You can wrap that sort of pattern into a macro:

( defmacro assign-foo ( symb )
	`( progn ( setf  ,symb ( call-cfun "foo" arg1 ... argn )) nil ))


Replacing "foo" with another function I have on hand, for example: 


( defmacro assign-seq ( symb n )
  `( progn ( setf ,symb ( iseq ,n )) nil ))
ASSIGN-SEQ

> ( macroexpand-1 '( assign-seq a 10 ))
(PROGN (SETF A (ISEQ 10)) NIL)
T

> ( assign-seq a 10 )
NIL

> a
(0 1 2 3 4 5 6 7 8 9)

> ( assign-seq a 20 )
NIL

> a
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)
> 


( I use the same sort of wrappers for a call-cfun that returns 8192 floats
  from  an xray-spectrometer. ) 


- Steve Majewski <sdm7g@Virginia.EDU>



