This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-10
Channels
- # beginners (15)
- # boot (15)
- # cider (6)
- # cljs-dev (231)
- # cljsjs (1)
- # cljsrn (26)
- # clojure (147)
- # clojure-argentina (1)
- # clojure-dev (8)
- # clojure-germany (1)
- # clojure-italy (26)
- # clojure-russia (2)
- # clojure-spec (83)
- # clojure-uk (154)
- # clojurescript (123)
- # conf-proposals (3)
- # core-async (5)
- # cursive (26)
- # datascript (21)
- # datomic (120)
- # emacs (2)
- # graphql (9)
- # hoplon (195)
- # instaparse (16)
- # jobs-discuss (1)
- # leiningen (8)
- # luminus (8)
- # lumo (7)
- # off-topic (17)
- # om (7)
- # om-next (3)
- # parinfer (121)
- # pedestal (5)
- # planck (13)
- # re-frame (11)
- # reagent (21)
- # ring-swagger (2)
- # spacemacs (28)
- # uncomplicate (3)
- # unrepl (7)
- # untangled (34)
- # vim (5)
a bidi route is sort of two parts, the routes(the left hand side) which are like a pattern that the url is checked against, and then the handlers (the right hand side) which are returned if the route matches
ResourcesMaybe is a handler, so by the time it is running, routing is "done". Routing ran, determined that ResourcesMaybe is the handler to use
what you want to do is move the resource existence checking from the right hand side (the handlers) to the left hand side (the routes), so existence of the resource is checked for while routing, not after routing
but all that being said, the way I usually solve this problem is by not having it, I put all static resources under a prefix that no other routes start with, so if ResourcesMaybe fails then there isn't anything else to route to
@cjhowe Took me a while, experimenting and searching on Bing, but I think this will help you http://grokbase.com/p/gg/clojure/151d2ffehq/equivalent-of-compojure-resources-in-juxt-bidi
@seancorfield seems like exactly what i need, thanks!
Not sure if I should ask here, i'm using Intellij with cursive, but it seems to be unable to resolve some of my code (like (db/add-message)
. I have been watching a video by @yogthos and it seems he has the same problem in the screen cast. So I'm assuming it is normal?
is there a spec for spec ?
Hey I’m pretty new to clojure and the whole java ecosystem and I’m having some issues using this slack clojar. It’s been telling me that it can’t locate clj_slack__init.class
or clj_slack.clj
on the classpath. I declared the dep in my project.clj file and I checked that it was installed with lein deps :tree
… so at this point I’m lost
@benbot the clj-slack library does not seem to have a namespace clj-slack
, so you can't require it
should it be clj-slack.core ? https://github.com/julienXX/clj-slack/blob/master/src/clj_slack/core.clj#L1
I would like to create a registration form with
ClojureScript
using React-Native
(and Reagent
thereafter). And I would like to include the different components with MaterialDesign, and I do not know how to do it. Do you have any suggestions? I have already found on the Internet, but I did not have much. I just want to create a simple registration form, using ClojureScript
MaterialDesign
ReactNative
.hello everyone, im trying to figure out uncessary dependencies on my project (im using lein)
searching the webs ive found lein deps :tree
but its output is quite large and im not sure where exactly to look
so I have a project, which has :aot :all in the :uberjar profile (in this scenario compiling at runtime was significant, trust me, I measured) but I'd prefer not to have that accidentally interfere with dev if a dev creates an uberjar on their machine. is there any way to either have leiningen delete the .class files after the uberjar is created, or exclude target/classes from the classpath?
I’m a little bit confused — ^bytes is supposed to be a valid type hint and I’m supposed to be able to type hint the return value of a function by hinting the function name, right?
but if I do
(defn ^bytes foo-bytes []
(.getBytes "foo"))
(defn foo-string []
(String. (foo-bytes)))
@michaelblume I didn't know ^bytes was a valid type hint. I've been using ^"[B"
I get an error
I can use it on arguments and it works fine
(defn string-from-bytes [^bytes b]
(String. b))
gives me no problem
it seems odd that I can use it to hint arguments but not return type
@michaelblume don't type hint the var name
maybe create an alias that creates an uberjar outside the target folder, then runs lein clean?
@bronsa cool, thanks, that works
how come type-hinting the name sometimes works?
right
everything that you acn express by type hinting on the var name you can express by type hinting on the argvec, and more
…would it make sense to print a deprecation warning when type hinting the var-name for a release or two, and then disallow it?
var meta is resolved, meta on args and argvec is not and the “special” hints can be used in those locations
we have no plans to stop allowing meta on vars
as it would break existing code
like, type hinting primitive hints won't cause the funcntion return type to be optimized
huh, ok, I’ll try to remember to do that =)
huh, ok, I’ll check if it complains about hinting the var name, if it doesn’t it probably should
@bfabry did you see my aliasing suggestion? would that work for you?
https://dev.clojure.org/jira/browse/CLJ-790 upvote this maybe
@plins You should check out https://github.com/walmartlabs/vizdeps It draws a graph of the info found in lein deps :tree.
@michaelblume it would work, but looking for a solution that won't require me to change anything other than the leiningen project.clj. getting an alias rolled out to all devs, all deploy boxes etc is a chore
oh, you can have aliases in project.clj
@plins as sad as it is, I'm not actually sure all the information required to know whether a dependency is used or not exists statically
I think I actually just need to understand :target-path and :compile-path a bit better and I can make this work
this isnt really a clojure specific question, but I’m curious to hear how to handle it idiomatically (if one exists) in clj. how does one evolve data (domain entities in an application) over time with minimal changes and minimal complexity? https://groups.google.com/forum/#!topic/clojure/hA0so8Fp8lg
also - generally keep your data as flat as possible
finicky nested over "organized" data models are magnets for repeated restructures into a new "better, more organized" structure
you can deprecate keys - move them from required to allowed but not mandatory
@noisesmith any arbitrary nested object can be seen flat w/ namespaced keys, so things go hand in hand
more specifically, say I have some client entity
{:thing ""
:schedule {:start "" :end ""}
are you saying instead to
{:thing ""
:schedule/start ""
:schedule/end ""}
@hcarvalhoaves right - it’s not an absolute but a tendency - and I would discourage using namespaces as if they were a series of nested keys…
then maybe evolving end to “completed” would equal
{:thing "" :schedule/start "" :schedule/end "" :schedule/completed}
?
@hcarvalhoaves what about (s/def ::tree-node (s/keys :req [::left ::right]))
or perhaps more appropriately {:thing "" :schedule_start "" :schedule_end "" :schedule_completed}
but at some point code that renders a view by looking at an entity’s (get-in x [:schedule :start])
, or in a better organized entity (:schedule_start x)
would have to be changed either way, no?
(:schedule/start x)
@bfabry by "nested" I'm thinking document-oriented representation. this tree-node definition is more like a memory model (you're describing the shape of a tree vs. a tree that represents anything in particular - e.g. company org chart)
@noisesmith Can you elaborate on what you mean by "using namespaces as if they were a series of nested keys"
Hi all, I am trying to get the value of a key from a hashmap in clojure but I am getting always nil.
@madstap replacing {:foo {:bar {:baz 0}}}
with {:foo.bar/baz 0}
where there is no foo.bar ns in your app
@alricu can you show how you put the value in and how you get it out?
well, that’s not a hash-map, it’s a vector with a hash-map at index 0
in that example (get-in v [0 :one])
would work
it’s OK - maybe you don’t need the vector part?
Loom (the graph library) has an Edge protocol which has src
and dest
. But when you call add-edges
on a graph it expects the edges in the form [n1 n2]. What's the point of that protocol is i can't easily extend it how I like and instead have to implement nth?
:add-edges*
(fn [g edges]
(reduce
(fn [g [n1 n2]]
(-> g
(update-in [:nodeset] conj n1 n2)
(update-in [:adj n1] (fnil conj #{}) n2)
(update-in [:adj n2] (fnil conj #{}) n1)))
g edges))
(defprotocol Edge
(src [edge] "Returns the source node of the edge")
(dest [edge] "Returns the dest node of the edge"))
; Default implementation for vectors
(extend-type #?(:clj clojure.lang.IPersistentVector
:cljs cljs.core.PersistentVector)
Edge
(src [edge] (get edge 0))
(dest [edge] (get edge 1)))
these seem incompatible. Add edge and destructure [n1 n2] so why bother with defining edge on peristent vector as 0 and 1 elements?
I guess so
The library author coded against his implementation of edges
Which makes the whole thing busted
I am sure you can create a pull request to fix this
anyone using clojure w/ grpc? I've found a few examples on github, but nothing official looking. trying to find some good boilerplate.
anyone watch Stuarts talk on REPL-driven development? https://vimeo.com/223309989
at 16:55 he talks about “REPL at a point of interest”, anyone know a library that does that?
I’m looking at https://github.com/razum2um/clj-debugger, but when I tried that I got weird error involving java.lang.UnsupportedOperationException: Can't type hint a primitive local
…
I guess his code is busted
can you publish whole code and stacktrace
the issue is likely https://github.com/razum2um/clj-debugger/blob/master/src/debugger/core.clj#L12-L16
&env will contain symbols with metadata like {:tag 'long} (where long is a primitive type hint) and the compiler will barf with that error message if you use a symbol like that as the name in a binding
If I want to create a logo for a clojure library that I have been developing. is there any sort of legal issue if I use the same colourscheme as the clojure logo? That is, I use the 2 green and 2 blue colours to colour my logo?
go for it
ok cool, thanks
lol, ok
michaellindon: https://www.cerner.com/-/media/Cerner-Media-folder/Home-Page/logo-2x.ashx?la=en&hash=BC8406D09620541FFB525E9C27687C750297C604 sorry for context
what does t do?
https://raw.githubusercontent.com/michaellindon/sss4clj/master/logo/sss4clj.png
thanks
hehe sorry, i thought Cerner was the name of a clojure library
what dose it do?*
i just chekced the website
do you work for them?