On 11/05/2014, at 4:09 PM, Shayne Fletcher wrote: > > On Sun, May 11, 2014 at 2:06 AM, srean <srean.l...@gmail.com> wrote: > Sounds fantastic ! > > A little more reading leads to the Floyd-Warshall and a general transitive > closure algorithm. I'm still thinking do depth-first search to warm up and > settle on a graph representation then move on to those.
Well the graph representation doesn't have many choices, its a map from integers to a set of integers, with the roots in the initial closure set. You basically do a recursive descent, except that you don't if the integer is already in the closure. It's about 10 lines of code. I think Felix is generating the map in the form of a Hashtbl from integers to lists of integers, but I'll check. The hard bit is generating the dependencies. There are some tricky rules: a variable which is a parameter is always considered used. Technically this isn't necessary but its very tricky to get calls to work right otherwise: for direct calls you can omit the argument, for calls through a closure you can't (because you don't know the actual function). This is a "Srean Uncertainty". An argument with a side-effect might be omitted if the parameter is lost, and that certainly happens if the function is inlined. And it certainly doesn't if the call is via a closure. If you don't know, you can't tell if the side-effect will be lost or not. Of course the moral is .. if it hurts, don't do it :) -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language