Lecture 2

January 11, 2009

1) Covalent bonds have 80kcal/mole

2) Polar molecules are able to dissolve certain kinds of compounds.

3) Water has energy 5kcal/mole. Thermal energy has 0.6kcal/mole.

4) micell – lipids form in water

5) lipid bilayer – is the way most biological membranes are organized, because biological membranes separate two hydrophilic spaces. In eukaryotic  cells, you want to separate two aqueous layers. When you see a membrane, implicit is the fact that it’s a bilayer.

6) Esterification. Reverse is hydrolysis, reintroduce water.

7) Selective permeability of membranes. Polar molecules cannot go through. Most of our energy is spent in running pumps that keep these concentrations intact inside and outside of the cell.

8) Carbohydrates – one carbon atom roughly per water molecule. Glucose has 6 carbon atoms. Called a hexose. Pentose has 5. Glycerol is also considered a carbohydrate, but its a triose.There are mechanisms to join two glycerol molecules to form a hexose.

9) Hexose isn’t linear. Because of thermodynamic reasons, it likes to cyclise.

10) Stereochemistry refers to the 3d structure of a molecule. Dictated by which atoms are present (tetravalent, trivalent, etc.) as well as thermodynamic considerations. One of the 6 atoms in the cycle is a oxygen, not a carbon, and a CH2OH is relegated to the outside – called extracyclic.

11) What’s the difference between alpha glucose and beta glucose? Whether the hydroxyl is above the plane or below the plane.

12) Glucose and galactose differ in the spatial arrangement of the atoms – particularly the relative positions of the hydroxyl groups. There exist catalysts, called enzymes that can convert one to another.

13) Monosaccharides converted to disaccharides through esterification reaction.

Mendel and the Gene

January 11, 2009

1) Wild type – Individuals with the most common phenotype.

2) Meiosis

3) Proposing that a gene is on the X chromosome is called X-linkage. Proposing that a gene is on the Y chromosome is called Y-linkage. Proposing that a gene is on either sex chromosome is called sex-linkage.

4) The + symbol always stands for the wild type trait.

5) Non-sex chromosomes are called autosomes. Genes on non-sex chromosomes are said to show autosomal inheritance.

6) Studying the organism yeast. Yeast is a fungus, it is a single celled eukaryote, it has a nucleus, it has chromosomes that pair up, its cells to a first order approximation are a lot like your cells. How do you grow yeast? Takes growth medium that has a lot of rich medium. Put yeast cell in the broth. I get culture of yeast.

6) put them on a petri plate that again has nutrients. Dilute it, take a little of the broth, and spread it, so that there are individual cells scattered randomly. and I get a colony all of which descend from a single cell. Called colonies.

7) Life cycle of yeast – has a diploid stage, it can undergo mitosis. Yeast has 16 chromosomes. Humans have 23. yeast also undersgoes meiosis to produce spores. They come in 2 flavors in A and alpha, like male and female. This is identical to the human genetic cycle. turns out that, yeast can also undergo mitosis as a haploid, the haploid cells of yeast, they can continue to grow indefinitely. Your gametes cannot. This is very convenient for geniticists.

8) Yeast can grow on minimal media. with very few macromolecules. It needs a carbon source, which is some sugar that it can ferment, it needs a source of nitrogen, phosphorus, salts and water. Why is it able to grow? It makes them. It is extraordinarily self reliant. You are not.

9) Yeast is not stupid, if you give it amino acids, it will use it. yeast is able to use rich media. Why not always manufacture? Save ATP, = energy. How does it make argenine?

10) Biochemist will find an enzyme that makes argenine. Geniticist will find one that cannot make it. Geneticists wants mutants. Find them by going on a mutant hunt. Grow yeast on a medium that has argenine, and pour them on a plate that has minimal medium w/o argenine. Those that can grow are the ones we are not interested in.

11) Yeasts that are able to grow on minimal media are called prototrophs. Yeasts that need help are called oxotrophs. One way, find those that grow on minimal + argenine, but cannot grow on minimal. We will end up with argenine auxotrophs.

12) The yeast cells we plated, were they haploid or diploid. – haploid. Because, we’ll need a mutation in both copies for the diploid, assuming oxytrophy for argenine is a recessive trait.

13) Suppose we get n colonies, arg1, arg2, … arg n that show oxotrophy for argenine. How many distinct genes does this affect? Are these mutants all in the same gene? A geneticist wants to know what are all the ways to disrupt a cell so that it cannot make argenine.

14) Geneticist do a variety of tests. Tests of recissivity or dominance. Whether the oxotrophy for argenine is dominant or recessive for each colony. Make a cross with wild type. Test each from 1 to n.

15) Lets assume all are recessive. How do I tell if they are on the same gene or not? This is called Test of Complementation. If two mutations complement each other’s effect, they are on different genes. Suppose arg 1 and arg 2 are on different genes. Cross them.

13) So we can make a complementation table. Rows contain arg1 to arg n, and so do colums.The groups that fail to complement define mutations in the same gene. These are called complementation groups because they don’t complement each other. Actually it should be called failure to complement groups.

14) Tests of Epistasis – Suppose a biochemist wanted to test his hypothesis about manufacturing of argenine. A goes to B goes to C goes to argenine. Suppose specific genes were necessary to catalyze specific steps of this biochemical process. The geneticist and biochemist could collaborte with each other to study whether these mutants affected each step of this pathway.

Exercise 2.82

January 10, 2009

(define (apply-generic op . args)
  (let ((type-tags (map type-tag args)))
    (let ((proc (get op ‘type-tags)))
      (if proc
          (proc (map contents args))
          (try-coercion op . args)))))
(define (try-coercion op . args)
  (let ((n (length args)))
    (define (iter count)
      (if (= count n)
          (error “No proc defined for type-tags”)
          (let ((convert-to (stream-ref count args)))
              (let ((current-type (type-tags convert-to)))
                (if (convert-all args current-type)
                    (apply (get op (repeat n ‘current-type)) (convert-all args current-type))
                    (iter (+ 1 count)))))))
    (iter 0))) 

(define (convert-all args current-type)
  (if (null? args)
      (cons ((get-coercion (type-tags (car args)) current-type) (car args)) (convert-all (cdr args) current-type))))

Eval Apply Example

January 10, 2009

The particular problem I would like to look at is

Its the evaluation of

eval quote (((lambda(x) (lambda(y) (+ x y))) applied to 3) applied to 4) in some global environment which I will call e0. 

What we have is a procedure of one argument x which produces as its value a procedure of one argument y which adds x to y. We are applying the procedure of one argument x to 3 so that x should become 3, and the result of that will be a procedure of one argument y, which we will then apply to 4.

To do this we need a global environment,which I’ll call e0, and it will have definitions of +, *, -, /, car, cdr, cons, eq? and everything else. Something the machine is born with.

What does it mean to do this evaluation? First, we will go through all the special forms, this is not a number, this is not a symbol, its not a quoted expression, its not a thing that begins with lambda, its not a thing that begins with cond, therefore its an application of an operator to operands, its a combination.  The combination has an operator and operands.

We transform this to apply of (eval of (quote ((lambda(x) (lambda(y) (+ x y))) 3) in the environment, also e0, (Note here I have evaluated the operator) with the arguments being the result of (evlist the list containing 4 ine0).  e0 is the quoted expression for the data structure which will be the environment goes there. (What this basically does is, when you get a combination, evaluate the operator, evaluate the operand and apply the operator to operand. The evaluation of operands or arguments is done in steps, through evlist. If you see the body of evlist its just the consing of the evaluation of each argument.)

To do this, I have to do first and the second. Lets do the second first. This is first part followed by, the evlist turns into cons of eval of 4 in e0, followed by evlist ‘() in e0.

This is apply of eval of …. eval of 4 is 4, it meets the number criterion, evlist of empty list is the empty list, so what I get is the list 4 (4).

Lets look at the next intersting thing, what do I do to evaluate that expression? Evaluating this is nothing but an application of the operator applied to this operands,its that combination. So its just apply of eval of the operator, and evlist of the operands.

Note that next thing will be a special case because its a lambda expression, why weren’t those earlier things considered lambda expressions, because they were lambda expressions applied to some arguments (operators applied to operands), now its just pure operator that we have settled down to.

Eval of a lambda expression produces a procedure object. (Think of this as an abstract procedure object, with the two circles, and the 2nd circle pointing to the environment.) This abstract object we denote by closure, and environment e0 gets captured in it. Now we have to apply that procedure to the arguments.

However, that procedure is not primitive, its got the tag closure. Therefore, we have to do a bind. A new environment is made, which has as its parent environment, e0, and we’ll call this e1, and x is bound to 3 in e1.

So what our expression transforms into is the eval of the body of the procedure, in the environment e1. Apply (eval (lambda(y) (+ x y) e1) (4)).

I know how to evaluate a lambda. That means I apply the abstract procedure closure (x) (+ x y) with e1 captured in it. Apply that to 4.

That’s easy. That means I have to make a new environment which points to the environment pointed by the procedure, and which binds y to 4. This environment we will call e2. 

Our expression then is evaluate the body in e2. i.e. (eval (+ x y) e2)

But this is an application, therefore it becomes, apply of eval of + in e2, (apply (eval + e2) (evlist ‘(x y) e2)

That is (apply some primitive operator + to the result of evaluating x and y in e2), which is (apply some primitive operator + to 3 and 4) which gives me a 7 magically (since we don’t know +)

See one important ingredient – what’s being passed around, and who owns what and what his job is. eval produces procedure and arguments for apply. Some things eval can do by itself, those are little self things that are not interesting. Eval also evaluates all arguments one after the other, that’s not very interesting. Apply can do certain things by itself, such as +, not very interesting.But if apply can’t apply a procedure, it produces an expression, and an environment, for eval. The procedure and arguments wrap up the state of a computation, and so do expressions and environment.







January 3, 2009

I am not confident I would have got this myself. Its an amazing program. Took some time to analyze too that its a working program.

(define (fib n)
  (cond ((= n 0) 0)
        ((= n 1) 1)
        (else (+ (fib (- n 1))
                 (fib (- n 2))))))

The memoized version of the same procedure is

(define memo-fib
  (memoize (lambda (n)
             (cond ((= n 0) 0)
                   ((= n 1) 1)
                   (else (+ (memo-fib (- n 1))
                            (memo-fib (- n 2))))))))

where the memoizer is defined as

(define (memoize f)
  (let ((table (make-table)))
    (lambda (x)
      (let ((previously-computed-result (lookup x table)))
        (or previously-computed-result
            (let ((result (f x)))
              (insert! x result table)

Sets as Binary Trees

January 2, 2009

(define (adjoin-set x set)
  (cond ((null? set) (make-tree x '() '()))
        ((= x (entry set)) set)
        ((< x (entry set))
         (make-tree (entry set) 
                    (adjoin-set x (left-branch set))
                    (right-branch set)))
        ((> x (entry set))
         (make-tree (entry set)
                    (left-branch set)
                    (adjoin-set x (right-branch set))))))

SICP Exercise 3.21

January 2, 2009

(define (print-queue queue)
  (define (print-list sequence-ptr)
    (if (null? sequence-ptr)
          (display (car sequence-ptr))
          (print-list (cdr sequence-ptr)))))
  (print-list (front-ptr queue)))