This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-23
Channels
- # aws (4)
- # beginners (14)
- # boot (7)
- # cider (75)
- # clara (87)
- # cljsrn (6)
- # clojure (115)
- # clojure-berlin (2)
- # clojure-dusseldorf (2)
- # clojure-gamedev (8)
- # clojure-italy (15)
- # clojure-russia (9)
- # clojure-spec (46)
- # clojure-uk (195)
- # clojurescript (24)
- # css (44)
- # datascript (19)
- # datomic (18)
- # emacs (6)
- # fulcro (57)
- # hoplon (1)
- # jobs (3)
- # jobs-discuss (37)
- # jobs-rus (3)
- # luminus (6)
- # lumo (28)
- # off-topic (24)
- # onyx (11)
- # planck (8)
- # re-frame (31)
- # remote-jobs (12)
- # rum (10)
- # schema (4)
- # shadow-cljs (28)
- # specter (24)
- # sql (3)
- # tools-deps (34)
- # vim (43)
- # yada (10)
morrrrrrning
morening
Morn’
I usually end up in pieces when writing it…does that count?
yeah, homophones always count
have you considered sxml and specter as a clojure alternative to xpath @lady3janepl ? i haven't done much xml stuff in clojure, but in a previous life https://github.com/mccraigmccraig/rsxml worked out well for me
I… kinda wrote something similar out of desperation, funny how Lisp syntax sticks with you once you get used to it XD (I’m still “in a previous life”)
and from xpath (or a similar tool) I needed a good DSL to begin with, since the data is richer than xml and I wanted to define search patterns for declarative configuration. I’m going to eventually do a Clojure version (crosses fingers) and specter is definitely something I will integrate.
ah neat how are u finding lacinia/graphql? I’ve used it a little and found it to be quite nice
(ah sorry missed the thread: I haven’t used it in depth yet since wrong language at the moment)
dunno - i would generally only use SXML for working with legacy XML data or SOAP apis... i haven't used graphql yet, but it looks pretty cool
I'd be interested if you get a nice write-interface through it. We quickly managed to write a really simple and good read API using graphQL, but we wanted the one API for all interactions and when we tried to build the write API it just because a cludgy mess
ah ok cool. I had some error with input-objects and never had the time to look into why it didn’t work
In terms of mutations, the system in question has (It's a legacy DB, that we were looking to build a new API on the front of to replace the existing XML one) about 60 object types, with a given object's data being spread over anything from 1-5 or so tables (nested lists of sub-objects) and objects being able to be related to each other etc
The read API was really nice and Just Worked using the schema we defined for pretty much everything. We got up to the first 2 or 3 objects for the write API and it was already confusing, so we dropped the idea
ah, i can see why that would start turning into a big mess. I think for the javascript clients i’ve seen you can separate schemas for different aspects of the code base. But so far with my experience with lacinia we just ended up having one edn file. Did you have just one big one? or did you try splitting them up as well?
>with a given object’s data being spread over anything from 1-5 or so tables I guess this is why it became super complicated?
With the read schema you could define all the lower level objects and define their relationships to build up the higher level objects, and that matched how clients wanted to read things and meant mostly the schema defined what they could query and how, with code only doing very basic lookups at the lowest level.
With the write schema we never managed to make it do the same thing. We were effectively implementing in code the same sort of logic that the schema gives you 'for free' on read.
Plus of course on write you have questions like "If fields are optional, and a client doesn't provide it when updating an existing object, does that mean it should be nulled out, or just left with whatever the current value is?"
In XML it's easy, you have to provide all or nothing. But the whole point of graphql is you only ask for (and provide?) the bits you care about
Oh yeah, but sometimes you want to blank a field. Like unsetting a parent/child relationship
And in the XML API you do that by just not providing the <parent>
element, so clients kinda expect that
I think i would guess that the graphql way would be to have a separate mutation for removing that parent/child relationship
But in graphQL maybe you'd have to provide the key, but with value null
? But then you have to know whether the key exists to unset
But our objects are really quite complex. There might be 10-20 relationships like that per object type. We didn't really want to create separate mutations for all of them. The idea was to provide a simpler API than the XML
To me it “felt” like you are supposed to separate a lot of functionality into basic mutations which do maybe one or two things. That way you could start calling them one after another. Thats why i believe mutations are sequential. But i’ve had limited experience really.
Yeah, you're probably right, and if the API was designed from the start as graphQL maybe that is how it would have been done
Like, some things may have to have a parent, so the base object creation should fail if one is not set. But in other things it's optional
I’m going to still investigate more about graphql i reckon. I’m going to look into the more popular js libraries to get a better understanding of what is possible. + reread the spec again. I really enjoyed developing with graphql/lacinia but am pretty much just self taught so its been a bit tricky
For read it was brilliant. I'd definitely consider it if we wanted to provide a read-only API to data
Theres also interesting aspects like having an ID that works across mutations/queries so you can resolve in the object is the same across different calls and things. Like the actual graph aspect of it. I read about it one time but never really found out more 😭
yeah my experience was similar in that I found read to be chefs_kiss.gif
but write was a lot more involved
was only a proof of concept hack anyway, but I wasn't sure if I'd have taken it further
I like that it's giving you the query and the documentation though, so it's like a turbo-charged combo of both REST and OpenAPI/swagger
I'll be interested to see how schema stitching develops, and whether that will fit easily with Lacinia.
yeah at least they use plumatic/schema, which in my experience is quicker to stitch together
The other day I was trying to figure out truffle and graalvm for precisely this reason 😄 (integrating php bits into code primarily in something else)
but… yeah. Most implementations out there (not just in PHP) simply copy the reference implementation of graphql server and possibly also dataloader (for limited batching)
the reference implementation gives you a very restricted view of the context (which field you’re requesting, and what the immediate parent object is)
which is okay when you have a small, shallow schema with relatively few connections. We’ve got a really complicated one (as in, lots of types, and dense in some places) with multiple datasources so query batching is complicated and can depend on larger chunks of the graphql query 🙂
I’ve done a lot of graphql querying - mostly in ruby though as it’s for $client. I quite like it, at least as a client trying to get info out of github!
Though I hate the ruby graphql library in one particular design decision they’ve made - they mandate that your graphql client is a static constant. :face_with_rolling_eyes:
@guy yeah - Rowan is 17 months old, he’s climbing everything. It’s madness. He spent 20 minutes this morning climbing me, so he could get to the radio and fiddle with the controls.
Yeah. I’m currently working a 4 day week, so Wednesdays are my at-home-dad day - it’s awesome, I get a full day a week with him, well worth it.
I just asked 🙂 It helps that my wife works for the same company, and it was a combo of her going back to work, and me dropping down to 4 days.
ahhhh ok cool. Thats true, if you don’t ask you don’t get. OK i’ll be braver next time :thumbsup:
It also helps that I'm a consultant so not generally filling a full time role. But honestly, most full time jobs could be done in 4 days. I'm far more efficient 4 days a week than 5.
My internship was half-time (because I was also full time uni student), after which I transferred to a 4 days-worth week, specifically because I asked
(also found myself more efficient this way, although I worked to 5 days, just shorter workdays)
what I also found was that it killed my career at that place, ie people from the same cohort got promotions and I didn’t because I was a part-timer.
Yeah i’m thinking of working 4 days a week because of my kids really. I don’t mind a pause in career if i can have a better family Quality of life
If you’re male, it probably helps; at the same place I knew an older woman, a working mother who also transferred to not-full-time in order to have more time for her kids, and she got sidelined into non-contributing, busywork projects. (It’s possible they thought I was going the same route and my ask was an indication of me going off on parental leave soon.)
I’m waiting for my youngest to stop the whining phase….. 19 years and counting…might be onto a losing proposition!
Oh: also working at a place for some time before asking seemed to help (ime) with negotiating custom arrangements. I’ve done a period of remote work for a company that officially didn’t have remote work arrangements at the time. Perhaps managers want to see that you can function in normal conditions, and are happy to relax afterwards.
Yeah - I've been at ThoughtWorks for 7 years so have a certain amount of good will there! Also as a company we are working hard to be more family friendly. It's tricky as so much consulting involves travel, but at least we are working on it.
trying to reproduce periodic-seq in clojure.java-time
(take 3 (map #(t/plus (t/zoned-date-time (t/local-date-time 2017 7 1 0) (t/zone-id "UTC"))
(t/months (* 1 %)))
(range)))
(#object[java.time.ZonedDateTime 0x1e217259 "2017-07-01T00:00Z[UTC]"] #object[java.time.ZonedDateTime 0x1202d6f "2017-08-01T00:00Z[UTC]"] #object[java.time.ZonedDateTime 0x624a7121 "2017-09-01T00:00Z[UTC]"])
that specific version is probably good enough for what I need atm. Was just wondering if someone had seen something more specific
if you just want YYYY-MM, do you know that there’s a YearMonth class in java.time ?
eg. (take 3 (iterate #(.plusMonths % 1) (YearMonth/parse "2018-05")))
I ended up with
(defn months-seq
([start]
(map (fn [x] (t/plus (t/zoned-date-time start (t/zone-id "UTC"))
(t/months (* 1 x))))
(range)))
([start end]
(take-while #(t/before? % end)
(months-seq start)))
([start end fmt]
(map #(t/format fmt %) (months-seq start end))))
I think there’s a wrapper in c.j-t
now it is:
(defn months-seq
"Takes t/year-months like: (months-seq (t/year-month 2017 7) (t/year-month) \"yyyy-MM\")"
([start]
(map (fn [x] (t/plus start
(t/months (* 1 x))))
(range)))
([start end]
(take-while #(t/before? % end)
(months-seq start)))
([start end fmt]
(map #(t/format fmt %) (months-seq start end))))
after I figured out I was specifying the format wrong (and it was looking for days of the week)
(* 1 x)
?
changed it again as I want it to be inclusive of the end
(defn months-seq
"Takes t/year-months like: (months-seq (t/year-month 2017 7) (t/year-month) \"yyyy-MM\")"
([start]
(map (fn [x] (t/plus start
(t/months (* 1 x))))
(range)))
([start end]
(take-while #(t/before? % (t/plus end (t/months 1)))
(months-seq start)))
([start end fmt]
(map #(t/format fmt %) (months-seq start end))))
(comment
(months-seq (t/year-month 2017 7) (t/year-month) (t/formatter "yyyy-MM"))
("2017-07" "2017-08" "2017-09" "2017-10" "2017-11" "2017-12" "2018-01" "2018-02" "2018-03" "2018-04" "2018-05"))
I don't get the (* 1 x)
part -- when is that not equal to just x
?
@U04V70XH6 you'd be right of course. I should maths more.
It also helps that I'm a consultant so not generally filling a full time role. But honestly, most full time jobs could be done in 4 days. I'm far more efficient 4 days a week than 5.
I need to get the actual dates sorted but I’ve a friend (some of you have met her - Fiona) whose organising a general tech conference “Build IT Right” in Newcastle in November. CfP will probably be in next few weeks but it anyone fancies a visit to the Toon (should be a budget for expenses for speakers) then I urge you to submit some talks. I’ll post details here once I get more from Fiona. P.S. I’m already budgeting for a decent bottle of wine and a few beers to bribe the two members of the programme committee I know to get one of my talks in!
what's the theme?
@alex.lynham It’s general IT conference so anything related to s/w development and development practices but they’re still working on the streams. There will most likely be an Agile/Lean stream, a UX/UI design stream but I’ve suggested a general Developer stream and maybe architecture.
Ooh, I might have something by then in that case
a nice non-confrontational talk entitled "why you should all stop whining about the parentheses stat and get with lisps right now"
THIS x 1000
OTOH the parens are like walls around our sacred code protecting it from those that would judge a book by its cover
the problem is that many would be excellent developers are insulated from a beneficial exposure to s-expressions by the cloud of baseless derision generated by all those with unthinking attachments to semicolons
@mccraigmccraig surely the less confrontational title is "All wrong languages have too much syntax"?
@otfrom yes, but the "non-confrontational" bit was a lie 🙈
I still feel it is important to place the incorrectness where it belongs, which is with the wrong languages rather than those who don't see the beauty in minimal syntax 😉
(btw, I think other languages are great. I'm just being silly. Pls don't hurt me or take this out of the context of here where being silly about smug lisp weenie history is OK)
@mccraigmccraig you can’t submit that talk…it’s already on my list!
oh heavens no. I would never speak to them. I feel a great affection for them despite the way they cling to error.
@otfrom you used to speak to me when I didn’t grok Clojure!
I saw a great video recently about how religious people are the ultimate nerds, but programmers would likely place in 2nd place 🙂
there are few places in life or software where one thing is objectively better than another thing - s-expressions in place of more syntax is one of those places and yet...

I wonder whether people’s minds would be suddenly blown if you could get it to understand []
instead of ()
or have the parser switch the first symbol encountered with a boundary, if exists later, and allow people to write conj(item, collection)
and java was about as far as Sun thought they could take C++ programmers to lisp and smalltalk
Seriously tho, there has to be a ‘Lisp is all conquering’ talk in me somewhere. Just need to write more parens until it surfaces.
I just remembered - that language spreadsheet needs a "has a decent repl" column. Will have to add one when I'm not pretending to entertain a toddler
it's quite interesting to read the reasons for rejections of different compiler backends for lux in the "sad little pile of bad ideas" column https://trello.com/b/VRQhvXjs/lux
Some of the reasons seem perhaps a little... specious? Maybe that's too strong a word - I suppose the explanations lack context!
he's got too much to do no doubt - but i was surprised that go doesn't have any eval for some reason
My limited experience with it (6 months) suggests that Go lacks many things, but I suppose it's intentionally a small language. My estimation so far would be "good in parts"!
since this API integration i need to do is all SOAP @lady3janepl it looks like i might be porting my rsxml thing to clojure rather soon
not sure whether to say I feel for you because soap, or yay, more useful stuff in clojure 😄
i did Exchange Web Services SOAP with that ruby rsxml lib a while back, and it was ok - building everything with vanilla ruby datastructures was great - very easy to test, and no need for SOAP ceremony in most of the code
I wash my hands with SOAP
SXML clojure stylee : https://gist.github.com/ae21494443bc2a1cc883523a4fe640a6
contrast with the original : https://gist.github.com/51fc7be6a48ef86f65a69baec8521eeb
i wonder if any of the hiccup processors will do the transformation for me
hmm. although i didn't know about data.xml until now
that will do ; https://github.com/clojure/data.xml/blob/master/src/main/clojure/clojure/data/xml/prxml.clj#L50
sometimes the universe seems benevolent
Fwiw offtopic but if you're doing json, jsonista is mad fast compared to data.json or Cheshire
Interesting. Not that speed of json processing has ever been my bottleneck for anything - if I’m doing JSON, I’m probably doing I/O so I’m probably spending far more time on that than string manipulation!