dyna icon indicating copy to clipboard operation
dyna copied to clipboard

argument of with_key doesn't parse correctly

Open jeisner opened this issue 11 years ago • 5 comments

Syntactic bug in implementation of #29. This works:

pathto(start) min= 0                     with_key [start].
pathto(V)     min= pathto(U) + edge(U,V) with_key [V | bestpath(U)].
bestpath(U) = $key(pathto(U)).

But this doesn't:

pathto(start) min= 0                     with_key [start].
pathto(V)     min= pathto(U) + edge(U,V) with_key [V | $key(pathto(U))].

In the second case, the second rule never seems to fire. It may be misparsing the | as "or" rather than list syntax. (To understand the message below, note that the vertices in this graph are 5-letter words such as "black" and "blank".)

Error(s) in rule: <repl>

    pathto(V)     min= pathto(U) + edge(U,V) with_key [V | $key(pathto(U))].

  TypeError:
    when `$key(pathto("black"))` = ["black"]


      pathto(V="blank") min= &with_key((pathto(U="black")=? + edge(U="black", V="blank")=10)=?, [(V="blank" | $key(&pathto(U="black"))=["black"])=?]).

jeisner avatar Jul 17 '13 17:07 jeisner

See also discussion on #15

timvieira avatar Jul 17 '13 22:07 timvieira

Btw, In the mean time you use single quotes '$key' to side-step the bug.

timvieira avatar Jul 17 '13 22:07 timvieira

See also discussion on #15

Ah yes, problem already reported and diagnosed there. But you closed that ticket so I guess the issue will live on here.

jeisner avatar Jul 18 '13 02:07 jeisner

Er, wait, wasn't this fixed by ddb104238deedd498b667ada0bf09273d79f24a7? Jason, can you tell me which version of dyna you're using? "(cd which dyna; git describe --always)" is probably the best way to do that right now.

nwf avatar Jul 18 '13 06:07 nwf

f4d6dd0

jeisner avatar Jul 18 '13 07:07 jeisner