🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.lisp.mcl
1 messages
1 total messages Started by Espen J. Vestre Wed, 27 Jan 1993 09:34
shiftf
#675
Author: Espen J. Vestre
Date: Wed, 27 Jan 1993 09:34
33 lines
1924 bytes
MCL's shiftf macro produces unneccesary complicated form in the simple
cases.  The most frequent use of shift, is probably for simple pointer
switching in list structures: Replacing a value while saving the old
value.  (The two-argument (place, newvalue) special case of shiftf used
to have its own name, swapf)

Here's what MCL's shiftf produces:
? (macroexpand '(shiftf (cddr liste) nil))
(LET* ((#:G91 LISTE) 
       (#:G89 (MULTIPLE-VALUE-LIST (CDDR #:G91)))) 
  (DECLARE (DYNAMIC-EXTENT #:G89)) 
  (MULTIPLE-VALUE-BIND (#:G90) NIL 
    (PROGN (CCL::SET-CDDR #:G91 #:G90))) 
  (VALUES-LIST #:G89))

Here's a simpler expansion suggestion (Allegro 4.1 produces something
similar to this):
(LET* ((#:G91 LISTE) 
       (#:G89 (CDDR #:G91))
       (#:G90 NIL))
  (CCL::SET-CDDR #:G91 #:G90)
  #:G89)

The second form has an execution time of appr. 1/3 of the first form,
which may be quite significant for pointer-manipulating programs.

--------------------------------------------------------------
Espen J. Vestre,                          espen@coli.uni-sb.de
Universitaet des Saarlandes,        
Computerlinguistik, Gebaeude 17.2 
Im Stadtwald,                          tel. +49 (681) 302 4501
D-6600 SAARBRUECKEN, Germany           fax. +49 (681) 302 4351
--------------------------------------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads