This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

paralell assignment problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: 2005-02-08 (03:07) From: skaller Subject: paralell assignment problem
```Does anyone know how to solve the parallel assignment problem?
Name invented by me to describe this problem:

x1,x2,x3..xn = e1,e2,e3 .. en

where ei might contain the variables xj. (Note = here is assignment).

The solution is a sequence of assignments involving
only xi, ei, and ti, where ti are temporaries introduced
to save the values of the expressions. For example,
a solution to

x,y = y,x

is

t = x; x = y; y = t

I seek a solution which minimises the number of assignments.
Note that the relation

i < j == ej doesn't depend on xi

is not transitive. This (a) confuses me enough I can't
see the solution, and (b) is precisely what allows
a temporary to remove a dependence.

--
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850,
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net

```