% Copyright (c) 1991 Marcel Roelofs, University of Twente, Enschede, % The Netherlands. % % $Header: list2vector.ch,v 1.2 91/10/23 09:37:31 roelofs Exp $ % @x One should be aware of the fact that the standard REDUCE token reader |token1| is not able to recognize and return a vector as a token. However, on our system |token1| has been replaced by a token reader based on the lisp underneath REDUCE, which \`{\i}s able to read vectors. Moreover, on another configuration at our site which did use |token1| as the token reader, we could patch it in such way that it was also able to read vectors without too much difficulty. The implementation of |save_liebracket| beneath explicitly uses the fact that the token reader used is able to read vectors. If this is not the case |save_liebracket| has to be rewritten in such a way that all commutators to be saved are temporarily stored on a list which can be read by |token1|. In that case the vector structure has to be build up again. This case will be dealt with in a separate change file belonging to this package. The procedure |save_liebracket| has to be available in algebraic mode. @d print_this_property_of(bracketname)=@/ <> @; @u lisp operator save_liebracket; lisp procedure save_liebracket(bracketname,savefile); begin scalar generatorname; check_if_bracketname_is_a_liebracket_in("SAVE_LIEBRACKET:");@/ generatorname:=get(bracketname,'generatorname);@/ rmsubs(); out savefile;@/ write "lisp$"; %Reading the properties should be done in symbolic mode% terpri(); terpri();@/ @; for each property in 'klist . list_of_properties_of_a_liebracket do print_this_property_of(bracketname);@/ write "flag('(",bracketname,"),'full)$"; terpri(); terpri(); for each property in 'klist . list_of_properties_of_a_generator do print_this_property_of(generatorname); @; write "algebraic$ end$";@/ shut savefile; end$ @y One should be aware of the fact that the standard REDUCE token reader |token1| is not able to recognize and return a vector as a token. However, on our system |token1| has been replaced by a token reader based on the lisp underneath REDUCE, which \`{\i}s able to read vectors. Moreover, on another configuration at our site which did use |token1| as the token reader, we could patch it in such way that it was also able to read vectors without too much difficulty. Here, however, we will give an implementation for those systems which have |token1| as their token reader, or which have another token reader uncapable of reading vectors. This means that we have to transform the vectors |info_list| and |vector_structure| into a list and a list of lists, respectively, hence have to be dealt with separately. The procedure |save_liebracket| has to be available in algebraic mode. @d print_this_property_of(bracketname)=@/ <> @; @u lisp operator save_liebracket; lisp procedure save_liebracket(bracketname,savefile); begin scalar generatorname,vector_list; check_if_bracketname_is_a_liebracket_in("SAVE_LIEBRACKET:");@/ generatorname:=get(bracketname,'generatorname);@/ rmsubs(); out savefile;@/ write "lisp$"; %Reading the properties should be done in symbolic mode% terpri(); terpri();@/ @; for each property in 'klist . cddr list_of_properties_of_a_liebracket do print_this_property_of(bracketname);@/ @; write "flag('(",bracketname,"),'full)$"; terpri(); terpri(); for each property in 'klist . list_of_properties_of_a_generator do print_this_property_of(generatorname); @; write "algebraic$ end$";@/ shut savefile; end$ @ With the above procedures saving the vectors |vector_structure| and |info_list| as lists and reading these lists in as vectors is peanuts. The procedures |list2vector| and |vector2list| are already available in PSL, for which this changefile is meant primarily. @= vector_list:=for each el in vector2list get(bracketname,'vector_structure) collect vector2list el; prin2 "put('"; prin1 bracketname; prin2 ",'VECTOR_STRUCTURE,list2vector(for each el in '"; prin1 vector_list; prin2 " collect list2vector el))$"; terpri(); terpri(); vector_list:=vector2list get(bracketname,'info_list); prin2 "put('"; prin1 bracketname; prin2 ",'INFO_LIST,list2vector '"; prin1 vector_list; prin2 ")$"; terpri(); terpri() @z