Source

Branch

1/ @DaleCloudman

@VictorTaelin

Ya compress the AST size not the character count..

Not just branches

Foo(a(1,2))
Bar(a(1,2))

Is worse than

Z = a(1,2)
Foo(z)
Bar(z)

2/ @VictorTaelin

@DaleCloudman

no. number of branches.

ast size is not the true measure of complexity because non branching ast nodes can be inferred in linear time

3/ @DaleCloudman

@VictorTaelin

Didn’t follow, what it means to ‘infer’ an AST node in this context?

4/ @VictorTaelin

I mean quadratic time *

I just obsreve that any program without branching can be reconstructed in quadratic time given enough I/O pairs. So I believe measuring complexity from number of branches is more accurate

You can’t build a complex algorithm without branches so, the more branches you have, the more complex your file / algorithm is. If you remove all branches, it becomes trivial and compressible, even if there are still lots of characters

Example:

foo = λa. a + a

and

foo = λa. a + a + a + a + a

have the same underlying complexity, despite one being larger.

or so I think (:

5/ @DaleCloudman

@VictorTaelin

So I’m trying this for Python and there’s lot of edge cases… how do I handle calling foreign code, it ‘optimized’ a max-finding algo by just calling np.max instead of doing the py version lol. and using np.where to avoid ifs…

6/ @DaleCloudman

@VictorTaelin

Ok I think it’s more that a function call is not a branch…