Re: algorithm for sorting functional expressions

2006-12-04 Thread Fredrik Lundh
MRAB wrote: > It's left as an exercise for the reader as to how it works. :-) *if* it works, you mean. should the following script really print anything? import random, sys # input variables replaced with zeros L = [ ['b', ['w','z']], ['a', ['z','y']], ['w', ['z','0']], ['z

Re: algorithm for sorting functional expressions

2006-12-04 Thread MRAB
[EMAIL PROTECTED] wrote: > I am trying to write some code that will take a list of functional > expressions, and order them so that those with primitive terms appear > at the beginning of the list and those that are defined by other terms > appear last. > > eg: > getSortedEquations(['b

Re: algorithm for sorting functional expressions

2006-12-04 Thread Fredrik Lundh
Marc 'BlackJack' Rintsch wrote: >> So I suspect that this is a common problem for those familiar with >> partially ordered sets or directed graphs. I'm wondering if anyone else >> is familiar with this problem and knows an efficient algorithm that >> will solve it. It would be good if any such alg

Re: algorithm for sorting functional expressions

2006-12-04 Thread Christian Stapfer
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am trying to write some code that will take a list of functional > expressions, and order them so that those with primitive terms appear > at the beginning of the list and those that are defined by other terms > appear last. > > eg: >

Re: algorithm for sorting functional expressions

2006-12-04 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, chrisguest wrote: > So I suspect that this is a common problem for those familiar with > partially ordered sets or directed graphs. I'm wondering if anyone else > is familiar with this problem and knows an efficient algorithm that > will solve it. It would be good if any su