File psl-1983/3-1/util/f-dstruct.red artifact 6a29e1ffaf on branch master


% Fast Defstruct Improvements;
% M.L. Griss
% Load after Defstruct to redefine basic Selectors

FLUID '(DefGetFn!* DefPutFn!* !*DefFnAsExpr);

LoadTime <<
 DefGetFn!*:='IGetv;
 DefPutFn!*:='IPutv;
 !*DefFnAsExpr:=NIL;>>;

% RHS selector (get fn) constructor.
lisp procedure MkSelector( Name, Slotnum );
   If !*DefFnAsExpr then 
         putd( Name, 'expr,
	 list( 'lambda, '(Struct), List( DefGetFn!*, 'Struct, SlotNum ) )  )
    else Putd(name,'macro,
         list('lambda,'(struct), 
            List('LIST,MkQuote DefGetFn!*,'(Cadr Struct),MkQuote SlotNum)));

% LHS depositor (put fn) constructor.
lisp procedure MkDepositor( Name, Slotnum );
begin scalar PutName;
    PutName := intern concat( "PUT", id2string Name );
   If !*DefFnAsExpr then 
    putd( PutName, 'expr,
	list( 'lambda, '(Struct Val),
	      List( DefPutFn!*, 'Struct, SlotNum, 'Val ) )  )
    else Putd(PutName,'macro,
         list('lambda,'(struct), 
            List('List,MkQuote DefPutFn!*,
                   '(Cadr Struct),
                      MkQuote SlotNum,
                        '(Caddr Struct)
))
                );

    put( Name, 'Assign!-Op, PutName );

    return PutName
end;

END;


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]