-
Notifications
You must be signed in to change notification settings - Fork 68
PersistentList support #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The failing test with the failing node, simplified: (defn f [self av]
(loop [[f & fs :as fcoll] self
[v & vs :as vcoll] av
ys '()]
(if (or (empty? fcoll)
(empty? vcoll))
(reverse ys)
(recur fs
vs
(cons (f v) ys)))))
(def input '({} ["" -1.5 -Infinity "�\f�"] {(-2 -1) (), {} {#uuid "ebf99b14-3384-4036-b388-130e8e1f917e" 3}} {{{a_P :S4w, 0 :+:3:_X:yl*f} [], (:L_.!6?2E.?/N?_hB) (WIo+.hDH9.M!Q/hO)} []}))
(def ss (repeat (count input) identity))
(= input (f ss input)) |
|
I've found the problem. Working on a fix now. |
|
This one looks OK. Please take a look. Because of doing everything eagerly there is a bit of complexity involved (as opposed to complexity inside Haven't done more benchmarks, but I'd be happy to do them if you have doubts if the performance gained is worth the complexity. |
I think that for this simple cases there's no need to introduce more macros, I'm fine with a bit more code in the implementation. We try to introduce macros only for new syntactic abstractions like
Add them if you want to and have time but I'm fine with merging this contribution without them. |
Will do. I wasn't happy with the CL-like naming anyway.
I was thinking of tackling the undecipherible context not found exception next. Basically asserting |
src/cats/util.cljc
Outdated
| "A collection of utils that used around the library." | ||
| (:require [cats.protocols])) | ||
|
|
||
| (defmacro flattenl-1 [coll] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me this should be a (private) function, not a macro, and live in builtin.cljc.
|
Other than my inline nitpicks, this looks great. Thanks, @muhuk. |
src/cats/util.cljc
Outdated
| (-write writer (cats.protocols/-repr mv)))))) | ||
|
|
||
| (defmacro mapl [f coll] | ||
| "Lie (doall (map f v)) but without the laziness. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might change this to:
Like (do all (map f v)) but eager.
|
OMG @yurrriq you have hurt my fragile ego. I give up. I give up Clojure. I give up open source. I won't even use a computer ever again. jk. Thanks for the detailed review. I see no nitpicks. What I don't respond to below, I'll fix in the next PR.
No, you are not missing anything. I am not happy with the macros either. Following @dialelo's advice I was going to unpack those macros directly into the code. I would rather avoid function calling here. For readability reasons rather than performance. Let me give it a try that way and we can discuss. |
|
Haha you really got me. I was getting nervous up until the jk... Avoiding extra function calls for legibility sounds good to me, though it might be nice to pull out redundant code into functions. Your call. My general threshold is three repetitions before I reach for further abstraction, but maybe that doesn't apply here. |
|
+1e6 for cleaning up the context error messages. That issue seems to get raised fairly often by users. |
|
JS tests are failing in two JDKs. They run fine on my machine though. sadface |
|
Odd. This is a bit out of my wheelhouse, but I've copied (what seems to me to be) the pertinent output here for discussion. |
|
I tried, unsuccessfully, upgrading cljs. If fails during compilation (no timing output). So it wouldn't surprise me if we find no I am out of ideas. |
| result ()] | ||
| (if (empty? c) | ||
| result | ||
| (recur t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick: we should indent this properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
Strange, I haven't been able to reproduce the failure and I don't see anything that could've caused ClojureScript compilation to fail. @niwinz can you take a look? |
|
Should I give up on this? Like @dialelo, I can't reproduce the failure that happens in CI. |
|
Do not worry, this happens because of high memory usage of advanced compilations. We should just disable advanced compilations in tests and the problem will disappear. |
|
Thanks @niwinz . |
|
Nice! |
|
Can somebody merge this? Or tell me what issues it still has, if any? |
|
Thanks for your time @muhuk! |
|
Thanks @dialelo. So, just to be sure; if I want to make other contributions, I should ping you guys with a call to action at every step? Or is there a process with less friction, that I'm failing to see? |
|
I hope you want to make other contributions! It seems to me this is most likely a case of other responsibilities eating up time. Feel free to chime in @dialelo and @niwinz, but I'd say just make a PR that accomplishes a goal the way you want to and then ping someone if we're too slow to review. I'm not sure about the other guys, but sometimes my notifications get buried or I get pulled away by other work. Thanks again for your time and effort, @muhuk, and I look forward to seeing what you do next. 😄 |
|
As @yurrriq points out is a matter of not having time, and sometimes sadly notifications get buried in a pile of other stuff to do. If you want to make other contributions please do so, no need for a call to action in every step. Make the changes that you want in the library and ping us when you think it's time to review and merge. Sorry for the ping-pong interaction in your last PR and thanks for making me see that is a lot of friction that may discourage further contributions. Don't hesitate to propose improvements to our workflow, there's a lot we could do to encourage more contributions. |
Re #142, sequence monad for
PersistentList's.cats.builtin-spec/sequence-applicative-identityfails. I can't understand why, the implementation seems to be correct. I printed even out(eq app (m/fapply (m/pure ctx identity) app)), it'strue. I would appreciate if you can take a look. FWIW it fails both during clj & cljs runs.(time)shows using loops is about 7 times faster than forcing LazySeq's. My understanding is LazySeq in, LazySeq out and PersistentList in, PersistentList out. So I force everything.Please take a look and let me know if there are any changes needed.