meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
noprompt 2020-01-08T03:20:18.010500Z

[meander.epsilon "0.0.364"]
• Allow nil for internal partitions function

yuhan 2020-01-08T06:59:26.013100Z

I think I've triggered some sort of pathological case with pattern parsing/macroexpansion

yuhan 2020-01-08T07:00:56.014200Z

(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)

yuhan 2020-01-08T07:05:13.016300Z

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

noprompt 2020-01-08T07:11:17.017200Z

@qythium I’ll take a look at this tomorrow. Thanks for reporting the issue.

jimmy 2020-01-08T15:44:51.017700Z

(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.

nlessa 2020-01-08T19:34:27.021600Z

Hi, beginning to use meander and tried these: ((r/until = (r/attempt (r/rewrite [[?x]] ?x))) [[[[[:a 1]]]]]) =&gt; [:a 1] ((r/until = (r/attempt (r/rewrite [[?x]] ?x))) [[[[:a 1]]]]) =&gt; [[:a 1]] I expected both return [:a 1]. It seems I am missing some basics here...

nlessa 2020-01-09T13:18:15.039100Z

Thanks,Joel, clarified for me!

👍 1
noprompt 2020-01-08T22:49:15.024100Z

Because the rule fails when you hit these cases

((m*/rewrite [[?x]] ?x) [:a 1])
;; =&gt; #meander.epsilon/fail[]
((m*/rewrite [[?x]] ?x) [[:a 1]])
;; =&gt;  #meander.epsilon/fail[]

noprompt 2020-01-08T22:49:32.024300Z

It passes for this case

((m*/rewrite [[?x]] ?x) [[[:a 1]]])

noprompt 2020-01-08T22:51:53.024500Z

The pattern

[[?x]]
won’t match [:a 1] or [[:a 1]] because neither are a singleton vector of a singleton vector.

noprompt 2020-01-08T22:52:34.024700Z

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.

noprompt 2020-01-08T23:04:26.025400Z

@jimmy @qythium I have a patch to address the macroexpansion problem.

noprompt 2020-01-08T23:09:46.025700Z

(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       {&amp; (m/seqable %profile ...)}}]
       (defproject _proj-name _proj_version &amp;
         (m/app #(apply hash-map %) %project-map)))
     :success)))
;; "Elapsed time: 39.376381 msecs"

noprompt 2020-01-08T23:10:36.026200Z

The patch I have only partially solves the problem but its the best I can do give my time constraints at the moment.

👏 1
noprompt 2020-01-08T23:19:40.027400Z

[meander.epsilon "0.0.373"]
• Improves macroexpansion performance of patterns using m/with.

noprompt 2020-01-08T23:19:53.027700Z

@qythium @jimmy ☝️

noprompt 2020-01-08T23:22:41.030Z

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.

yuhan 2020-01-08T23:26:50.030900Z

That was really quick, thanks!

yuhan 2020-01-08T23:28:20.032200Z

Would you recommend staying away from with or restricting its use in certain ways?

yuhan 2020-01-08T23:29:26.033Z

I assumed from the hiccup parser example that it was pretty robust for use

noprompt 2020-01-08T23:57:35.033500Z

@qythium No. Please use it liberally and report issues as they arise.