metasoarous / oz

Data visualizations in Clojure and ClojureScript using Vega and Vega-lite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile list/sexpr values to Veg(Lite) expressions

metasoarous opened this issue · comments

See #119

It would be nice if Oz users could use quotes list sexprs to represent their calculations and filters (etc?) instead of having to write psuedo-JS strings. This may not actually be too hard to support.

The list of operations we have to support are here: https://github.com/vega/vega/blob/master/packages/vega-expression/src/parser.js#L359-L453

Those can be specifically handled, with variadic arity handled by recursively nesting calls to the corresponding operation in the produced JS strings.

if expressions actually translate pretty naturally as with other "function" (ahem) like calls, since there's an if(cond, this, that) expression supported.

Using a keyword in function position can translate to object lookup: (:some-attr datum) => datum["some-attr"].