wolframite icon indicating copy to clipboard operation
wolframite copied to clipboard

Association[RuleDelayed[...]] is not supported

Open holyjak opened this issue 5 months ago • 0 comments

This works:

(wl/eval (w/MessageName w/Interpreter "noknow"))
"The Wolfram Knowledgebase is not available. Try again later."

but this fails

(wl/->clj "Association[RuleDelayed[\"MessageTemplate\", MessageName[Interpreter, \"noknow\"]]]")
(AssertionError) at wolframite.base.parse/parse-hash-map

because currently the parse code only supports Rule and not RuleDelayed. Such an association is returned for example when running (wl/eval (list (w/Interpreter "City") "San Francisco, US")) while offline.

How to fix?

  1. Treat RuleDelayed just as Rule, i.e. turn it into {"MessageTemplate" -> (MessageName Interpreter "noknow"))}
  2. Treat is specially - perhaps replacing it with delay: {"MessageTemplate" -> (delay (wl/eval (MessageName Interpreter "noknow"))))} ? Though an eval inside is ugly...
  3. Treat is as Rule but somehow mark it s rule delayed - with metadata, or wrapping it in delay as-is ((delay (MessageName ...)); i.e. not to do anything, but an indication that something can be done, ...

holyjak avatar Sep 23 '24 13:09 holyjak