I have lots of functions that map sets of inputs t...
# thinking-together
d
I have lots of functions that map sets of inputs to values - depending on some rules (if branches). Now I want to enumerate all the rules/code paths; it will help me to analyse, optimise, explain, understand. This can't be new, I guess it should be a thing that's feasible in any functional programming language. Maybe there is a name for this? Or a tool that does this? I'm thinking about writing something, but it seems like a typechecker like tsc would have a lot of related logic, and if I can I'll experiment using some other friendly tool first. Any tips/references please shout, thanks!
j
What you are talking about sounds either like building a control flow graph. Or doing abstract interpretation. Unclear if either those exactly fit what you want to do. But might be some useful starting points.
d
Or it could be content-addressable code, such as in Unison? Where you can hash the paths inside each function, in order to find overlaps?
d
Hm, this might be quite interesting in Unison! Well, a control flow graph is what I need. Apparently there's a big market for proprietary graphing tools along these lines, but for FP an extremely simple one should work. Seems like I'll need to make something myself, but at least I'll learn some things first and give it some context. Thanks to you both!