Subj : Re: Compiler and an interpreter To : comp.programming From : Gerry Quinn Date : Mon Aug 08 2005 01:33 pm In article , ajo@nospam.andrew.cmu.edu says... > I don't know for sure, but I strongly suspect > nth(i, n) = union(j in nth(i,n-1), nth(i, 1)) - ... > was supposed to read > nth(i, n) = union(j in nth(i,n-1), nth(j, 1)) - ... > > Otherwise, what's the point of mentioning 'j'? > > Once that change is made, I think it's easy to read the expression as > calculating, as you said, > > nth( i, n ) = all neighbours of nth( i, n-1 ), that don't appear in > > nth( i, n-1 ) or nth( i, n-2 ) Well, I figured it out from context. To be honest, I didn't realise what the point of a set union was, because I just thought of "all the unique neighbours of a set" as a single entity. It also led me to use a slightly different algorithm, in which each neighbour is searched for, and added if missing. I suspect my algorithm is faster when a typical atom has few neighbours, and the set_union version is faster when it has many. Where the dividing line is I don't know. - Gerry Quinn .