wolframite
wolframite copied to clipboard
Association[RuleDelayed[...]] is not supported
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?
- Treat RuleDelayed just as Rule, i.e. turn it into
{"MessageTemplate" -> (MessageName Interpreter "noknow"))}
- Treat is specially - perhaps replacing it with delay:
{"MessageTemplate" -> (delay (wl/eval (MessageName Interpreter "noknow"))))}
? Though an eval inside is ugly... - 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, ...