This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-12
Channels
- # admin-announcements (2)
- # aleph (2)
- # arachne (16)
- # beginners (33)
- # boot (20)
- # bristol-clojurians (6)
- # capetown (4)
- # cider (50)
- # clojure (74)
- # clojure-austin (4)
- # clojure-canada (1)
- # clojure-china (2)
- # clojure-czech (1)
- # clojure-greece (1)
- # clojure-poland (4)
- # clojure-quebec (5)
- # clojure-russia (5)
- # clojure-spec (34)
- # clojure-uk (45)
- # clojurescript (131)
- # cursive (4)
- # datascript (2)
- # datomic (9)
- # editors (2)
- # emacs (2)
- # hoplon (173)
- # jobs (5)
- # lein-figwheel (3)
- # leiningen (1)
- # off-topic (1)
- # om (44)
- # onyx (8)
- # proton (10)
- # re-frame (81)
- # reagent (23)
- # untangled (57)
- # vim (2)
- # yada (8)
Thanks @jsa-aerial --- looks like worth an experiment or two...
how can I provide a default value for an expression that returns nil?
(second '()) ; instead of nil return a default value of 1
@alexmiller: I am planning on creating a protocol to define the interface for my database. For testing purposes I want to mock small bits of functionality. Since reify
doesn't require me to implement all of the methods of a protocol, I'll probably use that to mock necessary functions.
I thought I would need to provide implementations for each protocol method, but it seems that is not the case.
hi folks, i've been writing a lot of clojure lately w/in lein projects and am curious about the most optimal layout of everything
i'd like to be able to have a bunch of different lein projects and then seamlessly include them in others
@benzn are you familiar with the Checkout Dependencies feature? https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies
is it possible for a map to store a value that's generated by a function everytime it's accessed? (def m {:a #(rand 10)})
@macroz i am using the component library, and i would like my component to return a fresh resource everytime someone else calls (:resource component)
if you are just after the keyword lookup pattern @jh398 then you can implement ILookup ... maps implement a whole bunch of other interfaces too, which it doesn't sound like you need
@mccraigmccraig: reimplementing ILookup means it will affect all map access right? seems a bit risky for my usecase?
it wouldn't be a map without a whole bunch more impl, but it would do whatever you want for (:foo thing)
At the moment clojure doesn't have good support for Java 8 streams - which is problematic when java api's adopt this abstraction.... I realise the core team haven't yet got a position on streams; but I'm wondering if there's any speculation on how they might best be integrated into clojure.core (if at all?). In particular I'm wondering whether they'd most likely be supported through transducers
Or is the answer likely to be use a 3rd party api... e.g. https://github.com/ajoberstar/ike.cljj
@rickmoynihan: Why is clojure.core support needed for them?
Well it's not needed as it can be covered by API's (as above) - but many approaches lead to fragmentation - and that damages interop. Historically clojure has always had amazing access to java...
@rickmoynihan: I'm not a java guy, but I'm interested in java 8 streams somewhat, but I don't fully understand what might have been added that Clojure can't interop with.
The sams in ike.cljj, look more like they should be implemented by having functions extend the SAM class. This might be off the mark though.
Oh, you need to be able to say "this is a predicate". I find this strange (on the java side, although I see the utility). 😛
I used to be a java guy, but got out at about java 6... so only have a cursory knowledge of what was introduced in java 8... Basically an API I use from clojure has started releasing builds for java 8 - that use streams instead of iterators etc... so at some point I'll need to port our code to work with it
And I'd rather back the winning horse 🙂
Quick question: Do we have the ability to alias a namespace purely for keywords? i.e without loading a file?
Not at the moment
@danstone: I'm not sure if it's a terrible practice, but you can (clojure.lang.Namespace/findOrCreate 'some.namespace)
and then alias
it. If you have namespaces you never intend to have actual code and only use for naming keywords, that may be a workable solution (at least until there's a real solution in the language).
Has anyone come up with a way to hang docstrings on specs? I'd like to spec a function and give each arg a docstring, and then recover those docstrings later from the result of conform
ing args to the spec.
Maybe I want some kind of registry by tag keyword? But the keywords used as tags in specs are unqualified in all the docs, so I'm not sure that would work.
Adding docstrings to specs is still under consideration
Not sure many people noticed but doc will now look up a spec if you pass it a qualified keyword
That could potentially also report a docstring
I would quite like the ability to add a body to the generated docstring for e.g. a keyword spec, giving some guidance as to the intended use
it looks like alpha9 removed :clojure.spec/any
—is there any documentation on this decision?
Oh, just found it: https://groups.google.com/forum/#!topic/clojure/MrwAx8DCjK8
On this page http://dev.clojure.org/display/design/Never+Close+a+REPL Stuart mentions that reloading multimethods
is an issue. I have noticed in the past that the new impl of multi methods are not used until a hard restart. Do people know if this is still an issue? Is this something solved by tools.namespace
. Thanks
Released the first version of clj-similar https://github.com/vortext/clj-similar it’s /very/ experimental but feedback is most welcome (although I’ll admit the specific use case I made it for won’t be all that common)
@dg I don’t think it’s very idiomatic, but in this case it really is “meta data” in my opinion, and you’re very often not really interested in it
…and that’s Clojure 1.9.0 Alpha 10 in production now! 🙂