BBL - Basic syntax
B.4. Compound Forms

The fact that functions output values that may be used by other functions makes it possible for the simple syntax of the language to produce complex thoughts. The following example may give you the idea:
<9>> (ASSIGN (a b c) = (1 2 1))
:: 1
<10>> (/ (+ b (SQRT (- (* b b) (* 4 a c)))) (* 2 a))
:: 1.0
In this example, the output of the first multiplication function (* b b), outputting b2, and the second multiplication function (* 4 a c), outputting 4ac, are used by the subtraction function... and so forth. (Note that the Listener has a quirk, only displaying the first value of a multiple assignment -- in reality, all assignments are performed)

Unless you enjoy disentangling parentheses, you should seldom have to concern yourself with this kind of complication. Rather you can use indentation to help you sort out what is inside of what. For example:
<11>> (ASSIGN cog-ids-of-S6803 =
          (FOR-EACH gene IN (GENES-OF S6803)
               AS cog-id = (COG-ID-OF gene)
               WHEN (EXISTS cog-id)
                  COLLECT cog-id))
:: (Results)

Translation:
      Assign to the variable named cog-ids-of-S6803 the result of...
          Considering each gene within the set of all genes of Synechocystis PCC 6803
               After extracting the COG-ID from the gene's information... 
               And only when the gene HAS a COG-ID... 
               Putting it in the list
The result of the loop is given over to the function that assigns a value to a variable.

If you prefer to work linearly, you can accomplish the same result as follows (taking advantage of the asterisk symbol, which represents the immediately preceding result):
<12>> (FOR-EACH gene IN (GENES-OF S6803)
           AS cog-id = (COG-ID-OF gene)
           WHEN (EXISTS cog-id)
              COLLECT cog-id)
:: (Results)

<13>> (ASSIGN cog-ids-of-S6803 = *)
:: (Results)
Back to Table of Contents         Continue