[plt-scheme] Modelling molecules

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Mon Nov 7 07:14:18 EST 2005

Seems like you want a graph, which additional restrictions
on edges to model the constraints on bonds.

In psuedo-ML and pseudo-Scheme:

 Molecule = (list-of bond)
 Bond = Single target | Double target

 carbon x y = Molecule (list (Double x) (Single x))

 ;; Is benzene 6 molecules?  I forget.
 benzene = 
   letrec carbon1 = carbon carbon2 carbon6
          carbin2 = carbon carbon1 carbon3
          carbon6 = carbon carbon5 carbon1  

You'll need to delay evaluation of the RHS of the letrec to
avoid a cycle.


PS: Please trim you reply when you post; we don't need to
see the whole digest.

--- geb a <geb_a at yahoo.com> wrote:

> I'm not sure if this is off-topic, but I've been
> trying to come up with a good representation for
> molecules like the benzene molecule.  Ideally, the
> representation in scheme should include the fact that
> any given carbon atom has both a single and double
> bond as well as a Hydrogen attached.  The structure
> should include the ring nature of benzene (not worried
> about bond angles yet but they probably should be
> considered.
> I've thought of using the shared environment.
> Does anyone have any ideas?
> Dan

Email: noelwelsh <at> yahoo <dot> com   noel <at> untyped <dot> com
AIM: noelhwelsh
Blogs: http://monospaced.blogspot.com/  http://www.untyped.com/untyping/

Yahoo! Mail - PC Magazine Editors' Choice 2005 

Posted on the users mailing list.