CNMAT / CNMAT-odot

Multi-paradigm Dynamic Programming
Other
115 stars 11 forks source link

Calling a lambda from a lambda is doing some funny business when lists are involved... #214

Closed ilzxc closed 10 years ago

ilzxc commented 10 years ago

This is difficult to explain. Please see attached patcher:

----------begin_max5_patcher----------
832.3oc4XszbZCCD9L7qPiNAScA+BiIyvw1oWZmdqG.lNBakDkXjXjkI1MS+
uW8vN1jvqPfjl1K1n0q28y69seVl6a2BNmkiSgfK.S.sZce6VszlTFZUttEb
AJOJAkpcCFwVr.SEPKy0D3bg19m3bFGPnfuhxA+fPiY2YAREbD8JL.QSuCyu
n5lVhDQWSnW8SNNRXRdf+fd1V.yQWGe8I6d1fYk2ykLpHk7KrxcGW4kMloYK
HzDrPCNmRijXMjXyu4iN9vFAfhVnC.7K3jUXAIBA9FNC+.t33T4yFRPXz0vl
mBNdiTGsKO7.vjHfkIpfPEttje0b85d1JC+tca0AqWZQdElWHTkN.61cUN8r
sqKmgCOYUSuWd0zy1oFZuWplmkho6ynXdNpKrdwjzkInhmTY5unnOJNV9yov
Dzh4wnNfI4VfhYVfbvG.EftSgVSoJ+RHoBUUx2BLXlxFEmJvw8uLiF0+Nh35
9HNGUjtdvjgQFqx7zAjOYBPVPUgW9KG4u.cqxgPFupfZBUUNmB8KlBqPeBgh
iXYT8if+dkZbFoO4MT2PGFr+FpoAHJVhMABBaRa2YudzoPEJTC6ffMN3n5cQ
rDF23scSmj20VGwbNJhCNeIuWDKFqbbarmwGJ6YLPcpCPQg.c2EGZ7IlCMFr
sT0A7.75djLrgFBVnqdg+QPv9bVRx2QQ2hkhWqs5fIdN1mLlmmyIk3492ohU
DJIYiQohmoVtQd0JTRFVIyM3wWoLgi1HOZvdeKdoRkandWQirOqJUCOAug27
9RGuv+yTpzbmwu.tyijiTwqCvUN5Yx0S3Taz+JvNYh8rxbaV5nTDORNXoVlm
9kOgguIZYgmLpom2+BRYJ5Pkbylj0zzkcp83uu87VJ8Td5LuIofmQ+88nHht
eMtdCK0C1aWdotG13FqGoK2vSCCl88bbcayPtaf+a3FV7eEHAMmW0tnqSO5u
AQWkT1WmYjxx3QUOtU6vBTmoXYCiP05NMbZzZ9bMINFSa9gbRs.z7DrtLr4O
k6PgS3AflguZnw+.PSvQhFSmCsbo7y3SKCoFHxo2aLbh.K8RB0rTS2fb7JRk
+FGPb47fPNLjwMzs7.eXaUd9c6+.P9gyeA
-----------end_max5_patcher-----------
ilzxc commented 10 years ago

Here's a slightly augmented version of the trouble case:

<pre><code>
----------begin_max5_patcher----------
618.3ocqU1zbaBCDF9L9WwN5j8TpAbnj3LiO1N8R6za8fsmLxvZGkBRdDBan
Yx+8pOfXbSbhmL9hfcY0qd0pGfGG3QVIpwRBbKLG77dbfmmMkIgWarGofVml
SKskQREEEHWQ7cOSg0Ja9uJkBIv3vOn0vuY7LwdenTIo7MHP4k6Q4scSZKUk
dOiu4NIlpbK9UgiC8aGmDEaunCfksSYsfqJY+EMUGMQ+XWZdUAimiJq2hZSx
xrNRr5gOGES5I.mVXEf7cLeGpXoT3mXE9rsjXodqQULAum0Rhux5solwv1gm
Ml1AhJUmE570Z4lU13wglDOMXfYv+L6whwYrxs4zlWzkCJZBnYY5aWPxoEqx
nCg409PyRenF9Dz.iVP7WvM0kyJUlMPrO7kklbbrTgYAqq3oA6Yp6CnRIso7
Xwzxn0pccFB0ymC5MqQd8cQ56fQcqwA8B1iLYlN9UEqSCs+NHhSBkVhNcbto
y1KHwMurl9qyzttSNiiohJtsEk7dLVzMNT65qsQgwuOk4NfUMaQmPDR+i+2D
.mdI3uarNMI4UAPCajJxERW0g8KROqShpQeHvDq2JGmJxPSgmhNmctz4LvbY
HXPTXzawnytjL5rKBiNCNkaGBOuCGcZB9n4eHe+I+wH7DGfeyDGfO4C.3eqJ
O+Wzz+f5OzeTzYC9QgWLx+pnKJ3OoG3aKw1d+ueBZatl7G+1PonRl10j51lv
gUJSefx318QuhldTM2yxxPd++Vn+ZOcUNZadguvczsa2gxxVIsNQ+V4Ct8sE
FH5iBWn8ffHwcrt5cEPkZTQoarUR24PcRLYfYcdZv+vYpkAJ
-----------end_max5_patcher-----------
</code></pre>
maccallum commented 10 years ago

fixed---this was subtle. The part of the code that was building up the lexical environment for the lambda function was evaluating the arguments that were to be bound in that lexical environment in the context of the new environment, not the old. This may fix some other weird behavior that we've seen...