;; | --------------------------------------------------------------------------- ;; | LI_GroupLst ;; | --------------------------------------------------------------------------- ;; | Function : Groups a linear list into nested sublists ;; | Argument : [Lst] - the linear list ;; | [LstBeg] - the list begin marker ;; | [LstEnd] - the list end marker ;; | Returns : a list in which anything between the 'LstBeg' and 'LstEnd' is ;; | converted into a sub-list ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun LI_GroupLst ( Lst LstBeg LstEnd / nested_list Lst1 itm ) (setq Lst1 '()) (while Lst (setq itm (car Lst)) (cond ((= itm LstBeg) (setq nested_list (LI_FindNested Lst LstBeg LstEnd nil)) (if nested_list (setq Lst1 (cons nested_list Lst1) Lst (LI_sublist Lst (1+ (length nested_list)) -1) ) (setq Lst1 (append Lst Lst1) Lst '() ) ) ) (T (setq Lst1 (cons itm Lst1) Lst (cdr Lst) ) ) ) ) (reverse Lst1) )