CNMAT / CNMAT-odot

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

eval with lambda variables #313

Closed ramagottfried closed 8 years ago

ramagottfried commented 8 years ago

I'd like to refer to a lambda variable in a expression stored in a string -- but it looks like eval treats the variable name as a string? or am I missing the way to do this?


----------begin_max5_patcher----------
566.3ocqT0zbaCBD8rzuBFtT6YTczWwJsyjq8buW2oCRZSMwHPEPdral7euv
JoDqXONtt8Bn8oE3w6srOEFPKU6.Ck7Yx2HAAOEFDfPdffg3.ZCaWkfYvznU
plFPZoQ8+yB6rHtPo1XHB9Ff.aYBB2H+fE+riY4xeRrqABmrko4rRADQJ6rD
qFXVCga6WHiXrZWtiatfKgJUmDOgzAvVMXbDvsoJ4OzPksm8Y4YKhiHYww9o
wAx2GVkrqgKEfEuDICfF6dAfrm9ZZpN6XdwCn7ZLIU4ierXLyVlsZsiqGSgz
B7zSus.ITlmE907bXneH5BEZm9XUR5+B+SNl+4mg+IE4dFeWBR+7wwWzv9c1
tuE5ymVxbd0Uc4TKp4lVAa+Q0Q23JAbyqn2Txzj6I7UznURLvi5BOa0wI0I+
lWoDJ8v8zeylL7xU7Akz9.qBNz88XF9uQrjzEwWpTm89Rc5xkHCtEqXxu6bh
80JzvtV8hJUM3S7jp88uUsaXsyVIIDAqorlMiG4CH3i4Y9UL2GOOhvLvulEG
kD6.leRaY4egsL4g6+IaI8XaI48skjzdao3S3Tb747kuzIDekUsAb8DmDMwu
v0iZya51hrviO0DMpNc03QL7vk7JKpAiqoJ1C7fbRljyZdcMHOTxbu478dQs
H9jESWJaRt.1jckroWpXssaAsYXKQh3preruXoHBC4x9PzkoZXKeLe7LnLsy
fsN2sS22lb2x99ezF26AsriiEOg9S94v+HTItFO
-----------end_max5_patcher-----------
maccallum commented 8 years ago

You have to wrap the expression in a lambda and pass i to it:


----------begin_max5_patcher----------
564.3ocqTEraaCCC8r8WAgtrD.uTKa2jhAzq67tuTLHaqtnFYIOI4fjUz+8I
QaujzlrlFrKRlOSJ8HeT743HRodK2Rfu.eGhhdNNJBgB.QC1QjF11JIyhtQp
zMMbkijz+OGeqCwkZ8ZKHEq4.eCSBBq5SN7yNlSn9I3VwAArgYDrRIOAJ6bf
yvYNKHb8Ax.qy38c7vkBEuR2ovaHa.rk4pV4c5GFdkqm44E4yRSfrEo31sKB
a4dC3ggfTcMBkj6vbftGT24FQSGPstcRNlRizPTil5xm97BR.5k33vRxEVx7
YpSqHmm+zEEAFeGEoew35Gg8zKg8EiX8A510x6I.oj4q5vCWQxomUKrsR1t2
zQbiWL86KIRVSYMahHAtojYf6AwzkjjkJzxS8zSp24CfOpUtGYU7C0n.lU7a
DilMK8cKsYymG1n2hcHyouWwMjDUZo1LbJXvGtbX3mPFNnnme1h90Vv4aaMy
pz07fimrpe++np2vZmrTAve+ev..Vaqb2jPzIAO8XSS.lk+qIoIzTOvzSpRy
+epRzLTkxxQUhll9AkILr8KmWlxdqLQOqL80No7arp0b+PuirNR9vaBqMuZb
JltA7i0TqtyTMdECD.1y2Zt0O0zO4zO3XuO4G4yJQcMWcXE2+TLLbEypzS1a
coro3BXC8JYSeox2vsgarCGIRDei9S8Z4hDzTn5MQ8hX3aDi9iSGHLiuSx4a
i5L8C81d2bRen9mGFUm.6VhC27Kw+APeLfJv
-----------end_max5_patcher-----------