This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-07-13
Channels
- # admin-announcements (296)
- # beginners (19)
- # boot (40)
- # cider (77)
- # clojure (139)
- # clojure-australia (2)
- # clojure-bangladesh (6)
- # clojure-dev (19)
- # clojure-japan (25)
- # clojure-russia (23)
- # clojure-sg (1)
- # clojure-uk (4)
- # clojurescript (131)
- # datomic (41)
- # editors (42)
- # ldnclj (35)
- # off-topic (11)
- # reagent (10)
Now that I think about it, what's the future of the #inst
literals and java.time.Instant
?
Prismatic Schema question ... how would I represent a sorted-map
?
Good morning.
Morning
Is anyone working on something like GraphQL for Clojure that integrates with Datomic/Postgres/Firebase?
@mikethompson: What exactly do you want to enforce in the schema? I expect you will need to write your own checkers and combine them using core/Both (which can take in more than two schemas). One checking the class and one for the required keys maybe.
I recall seeing a Clojure library which printed out JDBC timings but I can’t find it anywhere - any ideas? A non-sl4j based Java one would do in a pinch - any ideas?
@petrus: check this out for a good start: http://hueypetersen.com/posts/2015/02/02/first-thoughts-on-graph-ql/
@petrus: our target database is rethinkdb.
realtime changefeeds, a functional query language, etc
Nothing to show just yet
But we're working on it (via Daniel): https://github.com/apa512/clj-rethinkdb
@mikethompson: is that with a graphql query syntax? 😮
@mikethompson: thanks for sharing! looks very interesting
@sp3n: we won't be trying to replicate graphql, no
But have a look at how rethinkdb queries compose
(and can be represented in data)
I was playing with something a little bit similar a couple of days ago. https://github.com/thejsj/rethinkdb-chat but no immutability there 😞
@petrus: I'm trying to piece together something that would implement the GraphQL spec but abstract away the executor part, to make it pluggable with any backend (be it datastore, microservices or something else). https://github.com/kachayev/muse could possibly work for the execution layer
the type system, query parsing, introspection and other parts seem generic enough that it would make sense to have them as a library, I think
@jstaffans: I’m also working on GraphQL-like backend on top of Muse (i’m author of this library) - as for me it’s a really great fit
I use https://github.com/Engelberg/instaparse to parse queries, but it’s a thin layer
@kachayev: cool! I would love to help out if I can. I think it would be great to get something that fully complies to the spec.
does anyone know how to set the default indentation in clojure-mode?
I want the default to be a two-character indent, not lined-up args
that sounds like a rule-change, rather than changing a numerical value
that's what I was afraid of 😞
i’ve done what you said for a number of known functions here: https://github.com/robert-stuttaford/.emacs.d/blob/master/init.el#L177-L208
most of these are from as protocols, such as with Om and component
it’s quite annoying, but it’s not that hard to add to this list and just keep going
yes, but I want that as the default
meaning for all forms
I am tired of lining up arguments
why not just live with the lined up args?
I suppose I could add everything from om.dom
if you put the first arg on the next line, then it’ll do no indentation - treating it just like a normal list
oh, I know
yeah. you’re probably going to get your quickest win by adding all om.dom stuff yourself
a quick trim, rather than a full shave
clojure mode gets confused by #js
it thinks it's two forms 😞
yeah. one of the reasons i don’t like using om.dom. too low-level-y
i get why you’re using it, though; for your lispcast
right
I think I'm going to fake it by writing #js{}
no space
that works?
prints out again with the space
that’s handy to know
@ericnormand: you are of course aware of https://github.com/Prismatic/om-tools and that their mirror of om.dom has some sugar which removes the need for #js
yeah, slipset, he’s busy making code for teaching on a http://lispcast.com lispcast
i presume Eric doesn’t want to suggest that om-tools or any other add-ons are necessary for building om apps
huh. https://github.com/circleci/frontend used to just use om.dom but it looks like they went with a hiccup syntax too
@slipset: yeah, thanks
I like that library
but I'm trying to keep the deps down to a minimum
@nberger - that’s the one - thanks
dependencies and levels of indirection
@ericnormand: I think clojure-defun-style-default-indent is what you want.
I think that's working
thanks @cfleming
When using rign’s memory-store for session, does it send some kind of id as a cookie?
@pupeno: https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/middleware/session/memory.clj
From that code it looks like it uses a UUID as the key. My follow up question were, is this signed and/or encrypted when sent as a cookie?
in memory means no 🍪
bostonaholic: how does it know how to assign the same session to the person in a second request?
there's a session id as the cookie value, yeah. https://github.com/ring-clojure/ring/blob/d302502ea4da392016963d33bd81028bc761d8c8/ring-core/src/ring/middleware/session.clj#L26-L27
it's just a random identifier / opaque value so encrypting/signing doesn't make sense
some clojure code (figwheel) is eating my CPU when it should be IDLE. what tools should I use to find out what's going on?
Guys, why is the PSQLException in line 5 in this gist not getting caught? https://gist.github.com/sudharsh/6801838e92bc0fc0a985
If I am looking to specify “data structure at least has these fields” is there a particular part of prismatic/schema I’m looking for? If I don’t want to enumerate (or can’t know) all the optionals?
I'm trying to test a function using midje and I would like to verify content that it printlns. Any idea how to do that?
with-out-str
will capture the printed value as the return
useful with pretty-print at times too
mj_langford: aren't schemas just satisfaction predicates? I don't know offhand, but in the various uses of my tagged values library I achieve this by just saying nothing about the total keyset and checking the properties I care about of individual keys.
I could believe I just misinterpreted this error
I will try them again, and verify this functionality is/isn’t this before going further again
@mj_langford: Thank you
@mj_langford: I’m certain schema supports that
{s/Keyword s/Keyword} allows other entries, both the key & value schema must validate
I’m wondering when it’s more efficient to use a volatile!
vs. an atom
? Does anyone have experience with the two?
alejandro: volatile! is intended for use inside of transducer contexts and other constrained local contexts where you need a mutable value for performance. atom is a heavyweight atomic reference appropriate for sharing as an API, a value or across threads.
Maybe a different question, but is the cost of synchronizing threads (with a lock or BlockingQueue) generally higher than CAS?
Obviously my intuition was wrong as to the performance costs, and now I’m trying to understand why
@alejandro: memory barriers (volatile) are slow, CAS can be done without cache misses, that might explain it.
' the overall cost of a volatile read will roughly equivalent of a memory load and can be as cheap as a L1 cache access. However if another core is writing to the volatile variable, the cache-line will be invalidated requiring a main memory or perhaps an L3 cache access.'
so what I benchmarked was essentially several threads putting onto a blockingqueue to a consumer that would update the volatile, vs multiple threads swap!
ing on a shared atom
where as using the blocking queue would force serialization and descheduling of workers?
rather than having several workers running at once doing CAS you now have one worker at a time all the time.
arrdem, so if I’m understanding, you’re saying the benefit may come from the ability to reorder the updates?
alejandro: and locality benefits of not being changing working thread all the time, and the possibility of several threads succeeding in making CAS changes "simultaneously".
that's just my guess tho since I think the thread switching stuff is likely to dominate the actual cost of mutating some storage somewhere even if there is a memory barrier in play
right because if you've got a blocking queue in play you'll be doing block/yield everywhere which increases scheduling churn
speaking of volatile
, I just opened http://dev.clojure.org/jira/browse/CLJ-1777
gtrak and arrdem, thanks a lot for your help! Do you have any recommended reading or non-obvious terms to google to learn more about this stuff?
this issue has been bugging me ever since volatile
were introduced, upvotes would be welcome
and it wasn't even a definline bug, that was just a symptom 😛 see http://dev.clojure.org/jira/browse/CLJ-1330
Relevant to earlier discussion http://stackoverflow.com/questions/3556283/in-java-what-is-the-performance-of-atomicinteger-compareandset-versus-synchron ; gtrak good call on JCIP
@alejandro: seems like that answers the question