[racket] filtering syntax

From: Marijn (hkBst at gentoo.org)
Date: Fri Jan 13 08:40:25 EST 2012

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Suppose you have some code like:

(define simple-arith
  (model
   ((a)
    (b (* 3 a))
    (c (+ 5 a b))
    (d (let ((a 9)) (- c a))) )))

which defines the variables a, b, c and d in a ``model'' and how they
can all be calculated from an initial value for a. For example the
following tests would pass:

(simple-arith 'set! 'a 2)
(check-equal? (simple-arith 'get 'a) 2)
(check-equal? (simple-arith 'get 'b) 6)
(check-equal? (simple-arith 'get 'c) 13)
(check-equal? (simple-arith 'get 'd) 4)

To determine an evaluation strategy one needs to know which variable
depends on which other variables. One can then find a topological sort
for this graph and ... My question is how one determines the
dependencies from the above code. The result for the above would be
something like:

   ((a)
    (b a)
    (c a b)
    (d c))

- From there it can be converted from syntax to a plain value for
further processing which I know how to do.

Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8QNEkACgkQp/VmCx0OL2xFVgCfQCNE76n1RlxCIPlTr8QAUfVx
Q9cAn2jzjcOZdkA6wkY804x0jiZaePXU
=pgbv
-----END PGP SIGNATURE-----


Posted on the users mailing list.