[meander.epsilon "0.0.364"]
• Allow nil
for internal partitions
functionI think I've triggered some sort of pathological case with pattern parsing/macroexpansion
(m/match form
(m/with [%profile [!profile-key {:dependencies [[!extra-dep !extra-dep-ver] ..!ndp]
;; :source-paths [!extra-paths ..!nep]
}]
%project-map {:jvm-opts ?main-jvm-opts
:main ?main-ns
:dependencies [[!main-dep !main-ver] ...]
:source-paths (m/or nil [!main-paths ...])
:profiles {& (m/seqable %profile ...)}}]
(defproject _proj-name _proj_version &
(m/app #(apply hash-map %) %project-map)))
:success)
This takes about 6 seconds to macroexpand before evaluating (actual evaluation is <1ms)and uncommenting the 3rd line brings it way up, it's been running for more than 5 minutes and I'm not sure if it will even halt
@qythium I’ll take a look at this tomorrow. Thanks for reporting the issue.
(time
(def x
(macroexpand
'(m/match form
(m/with [%x {:a ?a :b ?b :c ?c :d ?d :e ?e :f ?f :g ?g :h ?h :i ?i}]
%x)
:success))))
Seems to be with and maps combined. Something exponential is going on.Hi, beginning to use meander and tried these:
((r/until =
(r/attempt
(r/rewrite
[[?x]] ?x)))
[[[[[:a 1]]]]])
=> [:a 1]
((r/until =
(r/attempt
(r/rewrite
[[?x]] ?x)))
[[[[:a 1]]]])
=> [[:a 1]]
I expected both return [:a 1].
It seems I am missing some basics here...
Thanks,Joel, clarified for me!
Because the rule fails when you hit these cases
((m*/rewrite [[?x]] ?x) [:a 1])
;; => #meander.epsilon/fail[]
((m*/rewrite [[?x]] ?x) [[:a 1]])
;; => #meander.epsilon/fail[]
It passes for this case
((m*/rewrite [[?x]] ?x) [[[:a 1]]])
The pattern
[[?x]]
won’t match [:a 1]
or [[:a 1]]
because neither are a singleton vector of a singleton vector.Maybe I can help with your particular situation if you give me some information about what you’re interested in doing or what your expectations are.
(time
(macroexpand
'(m/match form
(m/with [%profile [!profile-key {:dependencies [[!extra-dep !extra-dep-ver] ..!ndp]
:source-paths [!extra-paths ..!nep]}]
%project-map {:jvm-opts ?main-jvm-opts
:main ?main-ns
:dependencies [[!main-dep !main-ver] ...]
:source-paths (m/or nil [!main-paths ...])
:profiles {& (m/seqable %profile ...)}}]
(defproject _proj-name _proj_version &
(m/app #(apply hash-map %) %project-map)))
:success)))
;; "Elapsed time: 39.376381 msecs"
The patch I have only partially solves the problem but its the best I can do give my time constraints at the moment.
[meander.epsilon "0.0.373"]
• Improves macroexpansion performance of patterns using m/with
.with
is probably the most difficult part of the language in terms of engineering challenges. It is far and away from being what I would consider good. I’m not happy with the current techniques.
That was really quick, thanks!
Would you recommend staying away from with
or restricting its use in certain ways?
I assumed from the hiccup parser example that it was pretty robust for use
@qythium No. Please use it liberally and report issues as they arise.