This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-31
Channels
- # bangalore-clj (3)
- # beginners (15)
- # boot (128)
- # cider (4)
- # cljs-dev (12)
- # cljsjs (1)
- # clojure (105)
- # clojure-austin (5)
- # clojure-canada (6)
- # clojure-italy (5)
- # clojure-russia (14)
- # clojure-spec (70)
- # clojure-uk (21)
- # clojurebridge (3)
- # clojurescript (264)
- # cloverage (6)
- # cursive (4)
- # data-science (6)
- # datomic (10)
- # dirac (5)
- # editors (30)
- # events (3)
- # hoplon (9)
- # klipse (7)
- # leiningen (3)
- # luminus (4)
- # off-topic (9)
- # om (5)
- # om-next (1)
- # onyx (1)
- # parinfer (2)
- # perun (28)
- # re-frame (5)
- # ring (1)
- # rum (11)
- # spacemacs (2)
- # specter (10)
- # sql (3)
- # uncomplicate (4)
- # untangled (67)
- # vim (2)
- # yada (1)
I guess I’m not really sure what your imagined library would do for you that’s worthwhile…?
hi guys
i have got an error: java.lang.IllegalArgumentException: Parameter declaration "->" should be a vector, compiling:(core.clj:1:1) Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration "->" should be a vector, compiling:(core.clj:1:1)
and nothing helpful to debug this error, which line for example
what this error refer?
is there a way to get which line?
@abdullahibra you should have something that indicates the line in your full stack trace but from the message I would search the namespace for uses of the thread first macro ->
and see if you have naything that looks like this:
(defn fn-defn
-> ......)
Which should be:
(defn fn-defn [args]
(-> ....))
So there is nothing that looks like @agile_geek 's suggestion in your core.clj?
i'll check
(defn foo->foo-bar [] ) isn't write name?
foo->foo-bar ?
@abdullahibra that should be fine
provided you have the vector for args, which you do in that example
As you can see in ClojureBot snippet above that defn
evals fine
Would fail if there were spaces before the ->
agile_geek got it
@abdullahibra do share
i was defining: (def x (-> h :hello :world)) as (defn x (-> h :hello :world)
most likely typo error
@abdullahibra that would be it. Glad you found it.
thanks man
has anyone of you tried (with success) uncomplicate.neanderthal
on Ubuntu (specifically 14.04)? I'm having troubles with libatlas I can't get through
hi guys, is kibit very popular around here? https://github.com/jonase/kibit
I use it on occasion
but more so when I was newer to clojure
i wonder whether one can't somehow expand macros by some way of invoking the compiler, as clearly it is the compiler's know-how
@bostonaholic thanks for the feedback, I might give it a try 🙂
What is the fastest/idiomatic way to return true for the first value of set A in set B? I know I can do a set intersection but that’s O(length set A). Loop or reduce maybe?
intersection seems to be lazy (defined via reduce), so doing (first (intersection a b)) is O(len_A) is only in worst case
the only thing lazy in the clojure language is lazy seqs, clojure.set operates on sets(it doesn't throw errors if you don't pass sets, but you will get surprising undefined behavior if you do) -> clojure.set is not lazy
anyone know when euroclojure vids will be online?
I had a general question about organizing functional projects, so I posted it on reddit and would be curious for some discussion/resources if anyone has any cool ideas they'd like to share! https://www.reddit.com/r/Clojure/comments/5adkib/best_practices_for_organizing_project_directories/
@josh.freckleton I tend to follow the “module” guideline. But I personally don’t like to split things like logic.clj
and just use the comments.cljs
namespace directly. Then I nest inside it implementation details when necessary
I think the most important thing for having an “organized file structure” is consistency and everyone in a team agreeing to abide by it.
@roberto agreed. and assuming a green-field project and you get to choose the format, how do you organize?
@andrewhr that makes sense, i'd probably do the same. have you scaled up any projects like that? I'm curious if that scales, or if the choices shift when a project grows.
https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html I was just reading this which might give a different insight, although indirectly. I think it's good.
@josh.freckleton just a few "domain" modules, micro-service-ish
I think that article addresses the “logical organization” while @josh.freckleton question is more about the “file organization"
you know, I've seen that article a few times but never commited to reading it. I will now.
an experiment I ran, on the vein of clean architecture, was also creating a “module” called rt
for runtime concerns. Components like SQS consumers and thread-polls
because you can have a “hexagonal architecture” and still organize the files by “type"
@Roberto I think they could be used to drive one another. Uncertain though. But I could see my business logic going under a prefix, use cases in another.
What about MVC? That is an "implementation"-based structure, and I find it starts to bug me when I'm hunting down "related" files across an increasingly complex file structure. does anyone talk about that problem, and mitigating it with the MVC "pieces" living in a module, instead of in an "implementation" grouping? (or something better)
@roberto I think I was encouraging an implementation detail styled layout, where there's less duplication of entities due to the structure that's created by the clean architecture.
that makes sense, but fails when I inherit code, or haven't worked on it for a while. it's hard to search for files I've never seen/forgotten about
@josh.freckleton maybe I'm misunderstanding the complaint. Related code by entity?
@dominicm I don't think I have a complaint... just curious how these things scale. For ex: I'm working on a side project right now that's split out largely by implementation 1st, module 2nd, and it's hard to know where all the code lives that is all related "semantically"
@roberto I think we've misunderstood each other. I'm talking about db/too.clj
threads/too.clj
> db/too.clj
threads/too.clj
this is what you'd advocate then? (in general probably, since it's not "one-size-fits-all")
@josh.freckleton when I search by file, I can ignore the subdirectory. So I can search by the 2nd level only, if they match in the semantic way I think you're describing. Though this only works in the MVC style you originally described.
> I've found that layout leads to 20 definitions of what a user is. this sounds like an important insight to your view, but I don't get what you mean...
could you explain?
@josh.freckleton the user that threads expects, is subtly different to that of database, because they're coming from different places. This might be being caused by some other effect (slow enrichment, poorly defined contracts)
I think that the clean architecture essentially gives you a better 1st level to jump off. This means the 2nd level doesn't have to duplicate the entity name so much. This, to me, is a sign of clearer boundaries between functions, and therefore decomposing of your logic.
I'm getting an error that I'm finding a bit baffling:
user> (require '[clojure.repl :as r])
nil
user> (r/pst (Exception.) 10)
clojure.lang.ArityException: Wrong number of args (2) passed to: repl/pretty-pst
Calling r/pst
with either of the other arities it supports works fine. Looking at the Clojure source code, it unambiguously supports an arity of two (namely a Throwable and an integer for how many levels deep to print).
And...what on earth is this repl/pretty-pst
thing? "pretty-pst" appears literally nowhere in the clojure source code.
I don't get it.Anyone else encountered this before, or have a guess as to what might be going wrong?
what version of clojure @eggsyntax
{:major 1, :minor 9, :incremental 0, :qualifier “alpha13”}
works for me
1.9-alpha12 -- but I checked back to 1.8, and it ostensibly supported that arity both then and now.
Haven't tested to see if I still get the error under 1.8, but that'll be one of my next steps.
@bostonaholic when you say "works for you", you mean you can call (r/pst (Exception.) 10)
without getting that error?
works for me on a 1.9.0-alpha12, I’m running it under lein repl
Ah, you don't say... very interesting, thanks. That shifts my priorities for investigation for sure.
@eggsyntax pretty-pst is not part of Clojure
I think that’s maybe an external pst printer?
https://github.com/AvisoNovate/pretty/blob/master/src/io/aviso/repl.clj ?
It doesn't appear in our codebase either -- but it's definitely an issue with something in our codebase, maybe a lib that tries to make REPL stuff nicer.
I’m guessing you have that installed via lein user.clj or boot profile or something
That seems plausible 🙂. Don't think we use it directly (although I could be misremembering), but maybe we use something that in turn uses pretty
.
it’s included in ultra
Bingo. timbre
has a dependency on io.aviso/pretty
, which replaces repl/pst via (reset-var! #'repl/pst pretty-pst)
, but doesn't support all the same arities.
I'll file an issue w/ pretty
& ask them, if they're going to override common clojure fns, to at least support the full set of arities 😛
nice find @eggsyntax
Thanks! But props mainly to @alexmiller, who figured out the specific library that was causing the problem.