perm filename COMMEN[1,LMM]1 blob sn#029047 filedate 1973-03-12 generic text, type T, neo UTF8
  (PROGN (LISPXPRIN1 (QUOTE "FILE CREATED ")
                     T)
         (LISPXPRIN1 (QUOTE "12-MAR-73 03:01:06")
                     T)
         (LISPXTERPRI T))
  (LISPXPRINT (QUOTE COMMENTVARS)
              T)
  (RPAQQ COMMENTVARS ((FNS COLLECT* FIL*)
          (VARS COMMENTS)))
(DEFINEQ

(COLLECT*
  [LAMBDA (FN COMMENTS)
    [APPLY (QUOTE EDITF)
           (LIST FN (QUOTE (LP F *(E (SETQ COMMENTS (CONS (##)
                                                          COMMENTS))
                                     T]
    (CONS FN (CONS (ARGLIST FN)
                   COMMENTS])

(FIL*
  [LAMBDA (FIL)
    (PROG ([FILCOMMENTS (CONS (QUOTE :)
                              (MAPCAR (FILEFNSLST FIL)
                                      (FUNCTION COLLECT*]
           (AL (ASSOC FIL COMMENTS)))
          (COND
            (AL (RPLACD AL FILCOMMENTS))
            (T (SETQ COMMENTS (CONS (CONS FIL FILCOMMENTS)
                                    COMMENTS])
)
  [RPAQQ COMMENTS ([CYCLIC : ((VALENCE (X)
                                       (* This function finds the 
                                          VALENCE of an atom or 
                                          STRUCTURE or STRUCFORM))
                            (FVPARTITION1 (N VL S)
                                          (* This function is a 
                                             sub-function of 
                                             FVPARTITIONS - I'm not too 
                                             sure what it does offhand))
                            (FVPART1 (N MAXSUM MAXOCCUR)
                                     (* Again , i'm not too sure what 
                                        this function does))
                            (MINLOOPS (VALENCELIST)
                                      (* This function computes the 
                                         minimum number of loops that 
                                         any STRUCTURE with the given 
                                         VALENCELIST must have - See 
                                         cycgen paper for derivation of 
                                         formula))
                            (MAXLOOPS (VALENCELIST)
                                      (* This function computes the 
                                         maximum number of loops that 
                                         any STRUCTURE with the given 
                                         VALENCELIST may have - See 
                                         cycgen paper for derivation of 
                                         formula))
                            (SUPERATOMPARTITIONS (CL U)
                                                 (* This function finds 
                                                    all partitions of 
                                                    CL and unsaturation 
                                                    U into superatom 
                                                    parts and remaining 
                                                    atoms, according to 
                                                    the constraints 
                                                    given in the cycgen 
                                                    paper about valid 
                                                    superatom parts - 
                                                    The value is a list 
                                                    of 
                                                 SUPERATOMPARTITION 
                                                    records))
                            (MAXUNSATL (PC U)
                                       (* This function, i think, takes 
                                          a composition list of 
                                          composition lists (pc)
                                          and an unsaturation (U)
                                          and returns a list of the 
                                          maximum unsaturation that may 
                                          be assigned to each 
                                          individual part in pc such 
                                          that the final structures 
                                          will each have correct TOTAL 
                                          unsaturation and a free 
                                          VALENCE of at least one)
                                       (* Note U is either NIL
                                          (normal)
                                          or it is equal to the 
                                          unsaturation IN the case 
                                          WHERE remats is NIL and there 
                                          is only one part here))
                            (COMPUTEFV (U CL)
                                       (* This function computes the 
                                          free VALENCE of a composition 
                                          and saturation - I.e. Any 
                                          STRUCTURE with the given 
                                          composition and unsaturation 
                                          will have the resulting 
                                          number of free valences))
                            (ROWS (LL)
                                  (* Ll is a list of lists - If one 
                                     envisions it as a matrix, this 
                                     function computes the transpose))
                            (BIVALENTPARTITIONS (VL)
                                                (* This function takes 
                                                   a valence list
                                                   (starting with 
                                                          bivalents)
                                                   and partitions
                                                   (CAR VL)
                                                   into
                                                   (number
                                                     of EDGES IN a 
                                                     STRUCTURE built on
                                                     (CDR VL))
                                                   parts))
                            (TRIMZEROS (L)
                                       (* This function takes a list of 
                                          numbers and returns the list 
                                          with trailing zeros removed))
                            (TD (VL J)
                                (* This function takes a VALENCE list 
                                   starting with j-valents and returns 
                                   the TOTAL VALENCE))
                            (M2/2 (N)
                                  (* Silly function - Computes
                                     (n/2)
                                     -1))
                            (LOOPPARTITIONS1 (P VL J)
                                             (* SUBFUNCTION OF 
                                                LOOPPARTITIONS - DONT 
                                                REMEMBER WHAT IT DOES))
                            (JLIST (LL N)
                                   (* AGAIN, I DON'T REMEMBER WHAT THIS 
                                      ONE DOES))
                            (LPROWS (LPP VL)
                                    (* AGAIN, I DON'T REMEMBER WHAT 
                                       THIS ONE DOES))
                            (LOOPPARTITIONS (P VL)
                                            (* THIS FUNCTION FINDS ALL 
                                               LOOP PARTITIONS - I'M 
                                               NOT SURE HOW, THOUGH))
                            (CLPARTLP1 (CL ROW N)
                                       (* Again, i don't remember what 
                                          this one does))
                            (STRUCTURESWITHATOMS (CLL STRUC)
                                                 (* CLL is a list of 
                                                    composition lists 
                                                    the first CL 
                                                    contains bivalent 
                                                    atoms, the second, 
                                                    trivalent atoms, 
                                                    and so forth - 
                                                    Struc is a 
                                                    STRUCTURE - 
                                                STRUCTURESWITHATOMS 
                                                    finds all ways of 
                                                    attaching the given 
                                                    atoms to the 
                                                    STRUCTURE by 
                                                    labelling))
                            (NUMPARTITIONS (N NUMPARTS MINPART MAXPART)
                                           (* This function finds all 
                                              partitions of the number 
                                              N into numparts parts, 
                                              WHERE each part is 
                                              greater or equal to 
                                              minpart and less than or 
                                              equal to maxpart - The 
                                              result is a list of 
                                              partitions, WHERE a 
                                              partition here is a list 
                                              of numbers, the sum of 
                                              which is N))
                            (NUMPARTITIONS* (U MN MAXIMA OCCURLIST)
                                            (* Again, i don't remember 
                                               what this one does))
                            (FVPARTITIONS (FV VL)
                                          (* This function finds all 
                                             ways of partitioning free 
                                             valences fv among the 
                                             "ATOMS" of vl
                                             (vl is a VALENCE list)
                                             according to appropriate 
                                             constraints]
          [STRGEN : ((STARTUP NIL (* This function does all of the 
                                     things necessary to LOAD the 
                                     STRUCTURE generator]
          [CL : ((CLDIFF (CL1 CL2)
                         (* This function computes the DIFFERENCE of 
                            two composition lists - Zero terms are 
                            eliminated))
               (CLCOUNT (CL)
                        (* This function computes the number of 
                           elements IN a composition list))
               [CLPARTS (CL PARTSIZE)
                        (* This function finds all SUB compositions of 
                           the composition list cl1 which are of SIZE 
                           parsizze, and returns a list of the 
                           possibilities - I.e. (CLPARTS
                             '
                             ((A . 3)
                              (B . 2))
                             2)
                           returns
                           (((a . 2))
                            ,
                            ((a . 1)
                             (b . 1))
                            ,
                            ((b . 2]
               (CLPARTITIONSN (CL N MINPARTSIZE MAXPARTSIZE)
                              (* This function finds all partitions of 
                                 CL into N parts WHERE each part has a 
                                 CLCOUNT of at least MINPARTSIZE and at 
                                 most MAXPARTSIZE))
               (CLPARTITIONS (CL PARTSIZES)
                             (* PARTSIZES IS a list of numbers - This 
                                function finds all partitions of CL 
                                into PARTS WHERE each PART IS of the 
                                corresponding SIZE IN PARTSIZES - The 
                                sum of PARTSIZES must be equal to the 
                                CLCOUNT of CL or ELSE the value will be 
                                NIL - The value IS a list of 
                                partitions; a partition IS a list of 
                                composition lists))
               [CLCREATE (L)
                         (* This function takes a list which may have 
                            duplicates, and returns a composition list 
                            which corresponds to it - I.e.
                            (CLCREATE '
                                      (A A A B B C))
                            returns
                            ((a . 3)
                             (b . 2)
                             (C . 1]
               (CLINSERT (ITEM CL)
                         (* This function returns the composition list 
                            CL with "ITEM" inserted))
               (CL=PARTS (CL NPARTS PARTSIZE)
                         (* This function finds all partitions of CL 
                            into NPARTS parts, where every part is of 
                            size PARTSIZE - NPARTS*PARTSIZE must be 
                            equal to the CLCOUNT of CL))
               (CLBYVALENCE (CL)
                            (* CL must be a composition list of things 
                               with a VALENCE - This function returns a 
                               list of composition lists; the first CL 
                               contains those things with VALENCE 2 - 
                               The second those with VALENCE 3, and so 
                               on))
               (CLPARTITIONSL (CL LL)
                              (* Damn if i can remember what this one 
                                 does))
               (CLEXPAND (CL)
                         (* This function is the inverse of CLCREATE - 
                            It takes a composition list and returns a 
                            list with the appropriate number of copies 
                            of each item IN the composition list - I.e.
                            (CLEXPAND ' ((A . 3)
                                       (B . 2)))
                            gives
                            (a a a b b]
          (GENLISP : ((GROUPRADS (RADCLIST)
                                 (* This function takes a composition 
                                    list of lists, and returns all 
                                    possible selections of items from 
                                    those lists; e.g. doing GROUPRADS 
                                    on (((a b C D e) . 3)
                                     ((F g H i) . 2))
                                    will return all lists in which 
                                    three elements come from
                                    (a b C D e)
                                    and 2 elements come from
                                    (F g H i)
                                    - Duplication is allowed; i.e.
                                    (a a a F F)
                                    will be among the resulting lists))
                    (GROUPRADS1 (RADLIST N RADSLIST)
                                (* Subfunction of GROUPRADS))
                    (FIX+ (X)
                          (* Rounds a number upward))
                    (GROUPBY (FN L)
                             (* FN is a functional argument, l is a 
                                list - This function groups l by the 
                                value of FN applied to its elements - 
                                It returns a list of groups - The CDR 
                                of a GROUP contains elements of l which 
                                all have the same value of FN - The CAR 
                                is that value - Can be used to GROUP a 
                                list of atom names by their VALENCE, 
                                for EXAMPLE))
                    [*CARLIST (L)
                              (* (MAPCAR L (FUNCTION CAR]
                    [CDRLIST (L)
                             (* (MAPCAR L (FUNCTION CDR]
                    [LCARLIST (L)
                              (* (MAPCAR L (FUNCTION CARLIST]
                    [LCDRLIST (L)
                              (* (MAPCAR L (FUNCTION CDRLIST]
                    (DELETE (I L)
                            (* Returns l with the first instance of i 
                               deleted))
                    (DIFF (L1 L2)
                          (* Returns the list of elements of l1 which 
                             are not elements of l2))
                    (ORDPAIR (X1 X2)
                             (* Returns either (CONS X1 X2)
                                or
                                (CONS X2 X1)
                                depending on whether x1<x2 or not - 
                                Uses a generalized ordering in which 
                                anumbers are in order numerically, and 
                                less than atoms which are ordered 
                                alphabetically, and are less than lists 
                                which are ordered first by their CAR 
                                and then by their CDR))
                    (MAXREST (VL J)
                             (* Silly function used somewhere - Again 
                                damn if i know))
                    (MAX (X Y)
                         (* MAX of X and Y))
                    (MIN (X Y)
                         (* MIN of X and Y - Uses INTEGER arithmetic))
                    (TWICE (X)
                           (* X*2))
                    (LEQ (X Y)
                         (* Generalized ordering function - See ORDPAIR)
                         )
                    (*PLUS (L)
                           (* L is a list of integers - *PLUS computes 
                              their sum))
                    (LMASSOC (X Y Z)
                             (* This is similar to the ASSOC on the 360 
                                - If there is an element of Y whose CAR 
                                is equal to Y, returns its CDR - 
                                Otherwise returns z))
                    (*MAX (L)
                          (* L is a list of integers - *MAX returns 
                             their maximum]
STOP