After more debugging it seems to evaluate fine. Weird stuff you can do too, shown below.
namespace Test (
def f = [ X, Y -> X ]
def g = [ f X -> f X X ]
)
using Test
def main = g (f 1)
Which gives
[marco@stallion src]$ ./egel ../tests/match.eg
1
Okay, for those who assume this is a feature, this is fully intentional. Egel has eager combinator rewriting semantics so when evaluating
g (f 1) it will try to reduce
f 1, which fails since
f is a dyadic function, therefor remains constant. After that
g matches on
f 1 and
f 1 1 is reduced to
1. Completely according to semantics.
I hope to lift that behavior such that I can implement Mathematica style symbolic manipulation, though that has a far more complex operational semantics. But who knows?
No comments:
Post a Comment