Fork me on GitHub
#clojure
<
2015-07-13
>
zane03:07:13

Anyone know if transit-clj accepts java.time.ZonedDateTime instances?

zane03:07:16

I'm guessing it doesn't.

zane03:07:49

Yep, doesn't work. Not supported: class java.time.ZonedDateTime.

zane03:07:27

Now that I think about it, what's the future of the #inst literals and java.time.Instant?

mikethompson04:07:55

Prismatic Schema question ... how would I represent a sorted-map ?

Petrus Theron08:07:39

Is anyone working on something like GraphQL for Clojure that integrates with Datomic/Postgres/Firebase?

colin.yates08:07:07

@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.

colin.yates09:07:52

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?

sp3n09:07:38

graphql + datomic in clojure

sp3n09:07:53

but it looks like a prototype more than anything

mikethompson09:07:01

@petrus: our target database is rethinkdb.

mikethompson09:07:27

realtime changefeeds, a functional query language, etc

mikethompson09:07:45

Nothing to show just yet

sp3n09:07:57

@mikethompson: is that with a graphql query syntax? 😮

nek10:07:42

@mikethompson: thanks for sharing! looks very interesting

mikethompson10:07:21

@sp3n: we won't be trying to replicate graphql, no

mikethompson10:07:50

But have a look at how rethinkdb queries compose

mikethompson10:07:05

(and can be represented in data)

nek10:07:15

I was playing with something a little bit similar a couple of days ago. https://github.com/thejsj/rethinkdb-chat but no immutability there 😞

sp3n10:07:25

will do, thanks simple_smile

jstaffans10:07:03

@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

jstaffans10:07:18

but just fumbling around at the moment ..

jstaffans10:07:15

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

kachayev10:07:12

@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

kachayev10:07:16

I use https://github.com/Engelberg/instaparse to parse queries, but it’s a thin layer

jstaffans11:07:05

@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.

ericnormand12:07:33

does anyone know how to set the default indentation in clojure-mode?

ericnormand12:07:51

I want the default to be a two-character indent, not lined-up args

robert-stuttaford12:07:38

that sounds like a rule-change, rather than changing a numerical value

ericnormand12:07:59

that's what I was afraid of 😞

robert-stuttaford12:07:08

most of these are from as protocols, such as with Om and component

robert-stuttaford12:07:24

it’s quite annoying, but it’s not that hard to add to this list and just keep going

ericnormand12:07:36

yes, but I want that as the default

ericnormand12:07:40

meaning for all forms

ericnormand12:07:01

I am tired of lining up arguments

robert-stuttaford12:07:45

why not just live with the lined up args?

ericnormand12:07:26

I suppose I could add everything from om.dom

robert-stuttaford12:07:29

if you put the first arg on the next line, then it’ll do no indentation - treating it just like a normal list

robert-stuttaford12:07:11

yeah. you’re probably going to get your quickest win by adding all om.dom stuff yourself

robert-stuttaford12:07:24

a quick trim, rather than a full shave simple_smile

ericnormand12:07:08

clojure mode gets confused by #js

ericnormand12:07:14

it thinks it's two forms 😞

robert-stuttaford12:07:16

yeah. one of the reasons i don’t like using om.dom. too low-level-y

robert-stuttaford12:07:12

i get why you’re using it, though; for your lispcast

ericnormand12:07:14

I think I'm going to fake it by writing #js{}

ericnormand12:07:08

prints out again with the space

robert-stuttaford12:07:25

that’s handy to know

slipset12:07:54

@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

robert-stuttaford12:07:22

yeah, slipset, he’s busy making code for teaching on a http://lispcast.com lispcast

robert-stuttaford12:07:59

i presume Eric doesn’t want to suggest that om-tools or any other add-ons are necessary for building om apps

robert-stuttaford12:07:09

huh. https://github.com/circleci/frontend used to just use om.dom but it looks like they went with a hiccup syntax too

ericnormand12:07:12

I like that library

ericnormand12:07:22

but I'm trying to keep the deps down to a minimum

colin.yates12:07:26

@nberger - that’s the one - thanks

ericnormand12:07:07

dependencies and levels of indirection

cfleming13:07:14

@ericnormand: I think clojure-defun-style-default-indent is what you want.

ericnormand13:07:42

I think that's working

Pablo Fernandez15:07:21

When using rign’s memory-store for session, does it send some kind of id as a cookie?

Pablo Fernandez16:07:18

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?

bostonaholic16:07:32

in memory means no 🍪

Pablo Fernandez16:07:17

bostonaholic: how does it know how to assign the same session to the person in a second request?

trptcolin16:07:51

it's just a random identifier / opaque value so encrypting/signing doesn't make sense

maio16:07:59

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?

abtv17:07:24

maio, it might be the new version of cider can solve the problem, but I'm not sure

zphds19:07:42

Guys, why is the PSQLException in line 5 in this gist not getting caught? https://gist.github.com/sudharsh/6801838e92bc0fc0a985

zphds19:07:04

It's late and am scratching my head

zphds19:07:08

evaluating the map form on the repl throws a PSQLException

zphds19:07:56

got the answer from #C03S1KBA2, lazy-seq 😄

mj_langford21:07:31

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?

mateusz-fiolka21:07:15

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?

mj_langford21:07:54

will capture the printed value as the return

mj_langford21:07:03

useful with pretty-print at times too

arrdem21:07:43

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.

mj_langford21:07:23

I could believe I just misinterpreted this error

mj_langford21:07:55

I will try them again, and verify this functionality is/isn’t this before going further again

arohner21:07:08

@mj_langford: I’m certain schema supports that

arohner21:07:35

{:foo String, (s/optional-key :bar) s/Int, s/Keyword s/Keyword}

arohner21:07:58

(s/optional-key :bar) is for when you know the required type of the value

arohner21:07:54

{s/Keyword s/Keyword} allows other entries, both the key & value schema must validate

alejandro21:07:58

I’m wondering when it’s more efficient to use a volatile! vs. an atom? Does anyone have experience with the two?

arrdem21:07:41

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.

alejandro21:07:17

Maybe a different question, but is the cost of synchronizing threads (with a lock or BlockingQueue) generally higher than CAS?

arrdem21:07:47

I need an "Only You Can Benchmark It" ala smokey the bear...

alejandro21:07:00

Yeah, I did benchmark it simple_smile

alejandro21:07:26

And the BlockingQueue to update a volatile is slower than just an atom swap

alejandro21:07:35

But I was surprised by that, hence why I’m asking here

alejandro21:07:38

Obviously my intuition was wrong as to the performance costs, and now I’m trying to understand why

gtrak21:07:14

@alejandro: memory barriers (volatile) are slow, CAS can be done without cache misses, that might explain it.

gtrak21:07:41

' 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.'

gtrak22:07:06

blockingqueue means multiple threads, CAS is single?

alejandro22:07:52

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

alejandro22:07:09

So I think multiple threads in both?

arrdem22:07:30

doesn't swap! occur in the calling thread?

arrdem22:07:46

where as using the blocking queue would force serialization and descheduling of workers?

gtrak22:07:03

serialization?

arrdem22:07:10

well scheduler serialization

arrdem22:07:33

rather than having several workers running at once doing CAS you now have one worker at a time all the time.

alejandro22:07:57

arrdem, so if I’m understanding, you’re saying the benefit may come from the ability to reorder the updates?

arrdem22:07:47

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".

arrdem22:07:29

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

arrdem22:07:03

right because if you've got a blocking queue in play you'll be doing block/yield everywhere which increases scheduling churn

alejandro22:07:02

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?

bronsa22:07:09

this issue has been bugging me ever since volatile were introduced, upvotes would be welcome simple_smile

gtrak22:07:02

is the old definline AOT bug still a thing?

bronsa22:07:49

@gtrack the bug affected only definline though, :inline has never had issues

gtrak22:07:38

fixed in 1.7, nice!

bronsa22:07:58

and it wasn't even a definline bug, that was just a symptom 😛 see http://dev.clojure.org/jira/browse/CLJ-1330

gtrak22:07:06

right, was just there

arrdem22:07:23

ugh yeah that one

gtrak23:07:04

@alejandro: seems like that answers the question