noprompt / meander

Tools for transparent data transformation
MIT License
928 stars 55 forks source link

& form doesn't compile under latest commit #199

Closed markaddleman closed 3 years ago

markaddleman commented 3 years ago

The following compiled under 602 but does not compile under the latest commit:

(m/rewrite query
             {:as ?query :aggregates [(m/cata !agg) ...]}
             {& ?query :aggregates [!agg ...]}

             {:op "AVG", :args [{:computed ["deal_count_by_user"]}], :alias ?alias :as ?agg}
             {?agg & :op "AVG", :args [{:computed ["user_count_by_deal"]}], :alias ?alias}

             ?? ??)
noprompt commented 3 years ago

The value of the key ?agg is getting parsed as an :amp node which is intended to be internal to the parser. It doesn't implement many of the multi-methods and when it encountered downstream this becomes a problem.

(meander.syntax.epsilon/parse '{?agg & :op "AVG", :args [{:computed ["user_count_by_deal"]}], :alias ?alias})

{:tag :map,
 :as nil,
 :map {{:tag :lvr, :symbol ?agg} {:tag :amp, :symbol &} ,,,},
 ;;                              ^^^^^^^^^^^^^^^^^^^^^^
 :rest-map nil}