#clojure logs

2014-06-10

00:00PigDudeeven more than the stacktraces -,-
00:09PigDudeprobably people with questions like these use other testing tools eventually
00:17justin_smithwell, since a standard function can call is, you can construct your test such that you pass args or even an env map describing the values you need to each of those functions
00:28ddellacostaI can't use destructuring in deftype/defrecord args, huh
00:34amalloyddellacosta: you mean the fields held by a deftype? indeed you can't. but you can in the args passed to a protocol function or interface method
00:34ddellacostaamalloy: yeah, I was talking about the fields. I guess what I've got here is a smell that I'm probably doing something wrong design-wise, though.
00:36gratimaxddellacosta: you should probably extract that destructuring logic into another function
00:36amalloyyeah, that'd be pretty weird. you wouldn't want to be able to support something like (deftype Foo [[x & y :as z]]) - what fields get stored for real, and what gets computed on the fly? it's antithetical to the performance goals of deftypes
00:37PigDudejustin_smith: but then your tests fail in one big function?
00:37PigDudejustin_smith: (one big test)
00:38ddellacostaamalloy, gratimax: what I've got is a lot of configuration values getting passed in, which should probably be defined by the type user by extending the type with another protocol
00:38ddellacosta...or something like that. Alternatively, I may just pass in a single opts hash-map for those options that make sense
00:38amalloyddellacosta: or just define a function that builds these records. don't use (Foo. x y z) as your public-facing api, expose something nicer
00:40gratimaxddellacosta: I use maps for config and have functiosn that operate on those maps in cases like this
00:40ddellacostaamalloy, gratimax: yes, I suppose that's a good strategy--just have a config! function that takes an option map or something, and returns an instance of this thing.
00:40ddellacostastill, can't help but think this is a bit ugly
00:41amalloywhy in the world would it be a bang function?
00:41gratimaxddellacosta: what does it mutate? why the bang?
00:41amalloy(defn build-the-thing [config] (TheThing. (whatever config)))
00:41ddellacostaamalloy, gratimax: ...why would it not? It's mutating state by creating an instance of a thing, is it not?
00:41justin_smithPigDude: not really, your deftest can pass whatever data to the individual test functions it needs to run, which should be fairly modular. If you need the same setup for multiple deftests, then once again you can use a function that sets up that data for you (since you shouldn't be testing based on side effects in one test in the next test anyway, their order should be unimportant)
00:42gratimaxddellacosta: unless you're using a previous thing and changing its state, then no
00:42amalloyif allocating objects mutated state, everything in clojure would have a bang
00:42justin_smithPigDude: most convenient is likely a function (or maybe a few for parameterization) that returns a map of options
00:42justin_smithor you can just def the map if they are going to be the same options
00:42amalloylike, conj makes a new list
00:43PigDudejustin_smith: but you can't have your cake and eat it too, either you have no failure locality, or you have failure locality as you said, and so all you see is line 234 in test-project (your big test function)
00:43PigDudejustin_smith: sorry for being obtuse
00:43PigDudejustin_smith: is there somesmall example of this?
00:43ddellacostagratimax, amalloy: huh, okay...never thought of it that way. I guess this seemed different for some reason, but that's a good counterpoint.
00:44ddellacostagratimax, amalloy: anyways, in the end I'm not sure that the config fn is saving the user much if they still have to pass in a big bunch of options
00:44gratimaxddellacosta: just interested.. what's your use case?
00:45ddellacostagratimax: initializing a set of configuration variables for a database + messaging related lib
00:45ddellacostagratimax: to be very general
00:46justin_smithPigDude: https://github.com/caribou/caribou-core/blob/master/test/caribou/test/model.clj each defn tests a different kind of thing, then they are called in deftests that parameterize (in this case across db backends since they are not fully compatible in the sql they support) - when I get an error in the tests it tells me which backend was being tested, and which function in that test was being run
00:46justin_smithPigDude: pardon some of the weird naming please, a coworker was stoned when writing some of those tests
00:46gratimaxddellacosta: you could possibly do stuff like korma hand have 'defdb' or something that mutates an internal variable and have operations on that
00:47ddellacostagratimax: trying to avoid doing anything like Korma actually...haha. But more to the point, the database config is just a small part of it.
00:48gratimaxyou do (defdb {:db "korma"
00:48gratimax :user "db"
00:48gratimax :password "dbpass"})) and then every subequent operation modifies that
00:48gratimaxoh, ok
00:48PigDudejustin_smith: standard operationg procedure, of course. the trouble is running htis test so i can see what happens when it fails ... i don't hvae these servers around, etc.
00:48PigDudejustin_smith: i see the technique, looks reasonable
00:48ddellacostagratimax: there is database config, then past that ways for subscribing to messages, and flags for related behavior (filtering and whatnot). I just have to find the right way to organize it all.
00:49PigDudejustin_smith: but i fear when the test fails you are seeing failure: postgres-tests, not failure: collection-map-test
00:49justin_smithPigDude: that's what test/testing is for
00:49justin_smithI get both messages
00:49justin_smithI promise
00:49justin_smiththose tests break a lot, so I have to make sure they give me reasonable output :)
00:49gratimaxddellacosta: if all you're doing is initializing then reading from config, I would keep the config to simple maps with accessor functions
00:50PigDudei wish i could run them but i'm not ready to configure mysql/postgres on localhost to run this :\ do you have an example of failure output?
00:50mdeboardAre vars considered harmful?
00:50PigDudefine if not, this is a nice example
00:50mdeboardI thought I read something saying ~that recently
00:50justin_smithPigDude: well you could run h2, but that would require the bootstrap stage
00:50justin_smithone sec, I'll make one break
00:51PigDudejustin_smith: clojure testing seems very "seat-of-your-pants"
00:51gratimaxso your api would be something like 1. (defthing mything {:config "x" :other-config "y"}) 2. (subscribe! mything :my-message ...) 3. (filter mything :my-message ...)
00:51mdeboarddynamic vars, I guess.
00:51PigDudejustin_smith: with projects inventing their own schemes
00:51PigDudejustin_smith: as does this one
00:51gratimaxmdeboard: depends on use case, like everything
00:51ddellacostagratimax: yeah, the basic thing that I'm wrestling with is that I have this central...thing that gets passed around--it has to know both about database stuff as well as messaging stuff. And I'm having trouble keeping it clean while still allowing the user to configure it simply. So I'm still searching for the right design principle here...we'll see. In any case, thanks for the help, also thanks to amalloy.
00:51PigDudejustin_smith: (and mine)
00:52mdeboardOh, I misunderstood the thing.
00:52justin_smithPigDude: it's just higher order functions being used to permute over some options, this is a pretty standard thing, and given we have pervasive statelessness and immutability, we don't actually need a lot of the other unit testing conventions
00:53gratimaxddellacosta: is the user going to create multiple things? if yes I would do like korma, if no, I would pass it around
00:53gratimaxddellacosta: final option is a macro like (withthing mything (subscribe! :my-message) (filter ...) ...)
00:53justin_smith(until we have stateful / mutating code, then yeah maybe you should check out junit or midge or whatever)
00:53ddellacostagratimax: the user needs to be able to set up a message queue, subscribe to messages, and then update a database which triggers messages getting sent out. Definitely trying to avoid a config macro...something we've considered though.
00:55gratimaxddellacosta: I see. I probably don't know enough about the project to give you any more useful advice. good luck anyway
00:57ddellacostagratimax: yeah, I probably have to go into more detail before I can solicit useful feedback...but thanks, I appreciate getting your thoughts! It's helpful nonetheless.
00:57PigDudejustin_smith: i agree about the strengths of immutability and fp for testing, i find tests very easy and reliable to write in erlang, but i am waiting for (or might work on :)) something in clojure like eunit+ct
00:57PigDudejustin_smith: i think it's nice to have some conventions even in a powerful language
00:58mdeboardhere's what I was thinking of http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope
01:00PigDudejustin_smith: btw this caribou library is neat
01:00justin_smithPigDude: it's pretty huge
01:00PigDudehehe
01:00justin_smithlein new caribou gets you a MRM (map relational model), an interactive web based cms for lay-users, a default schema bootstrapped...
01:01justin_smithalso the cms is totally own-dogfood built in the lib itself
01:01justin_smithit's too big and too bloated and too frameworky, but it helped me get a lot of work done and was definitely a fun learning experience
01:01PigDudeutil/dbize is useful for something i am doing
01:02PigDudethis technique
01:02justin_smithand also, despite the massive ram usage, it performs very well
01:02justin_smitheven has a caching image resizer with s3 integration built in, full kitchen sink
01:02PigDudeif you care about ram you aren';t using clojure
01:02justin_smithheh
01:03justin_smithOK I fixed the logging level so the test output wasn't a huge spew of noise, now to make a test fail and share the output
01:03PigDudety so much
01:04justin_smithnp, this matters to me, because if I am wrong and there is a better way to do this, then you'll make something better, and we all win
01:05justin_smithso there are some stray printlns that I totally need to delete, but I think the location and context of what failed is very clear here https://www.refheap.com/86426
01:06justin_smithsee how I get a line number, but also the test name and the testing statement- it is unambiguous where things were when it failed
01:10justin_smithas well as the file name, of course
01:13PigDudejustin_smith: not too bad
01:14PigDudejustin_smith: so the (testing strings get you there
01:14PigDudejustin_smith: i like it!
01:14skinkittenthanks justin_smith lots of help earlier today
01:14justin_smithskinkitten: np
01:14skinkittengoing to learn a lot from you
01:14justin_smithPigDude: also, is takes an optional string argument, if you want to provide even more context
01:14justin_smithskinkitten: with any luck
01:15PigDudeyea i always use that
01:15andyfand the string can be dynamically built at test run time with str, format, etc.
01:15PigDudeis this the official clojure.test docs? http://richhickey.github.io/clojure/clojure.test-api.html
01:15PigDudeit's confusing how the docs are everywhere
01:15andyfyes
01:15seancorfieldthe richhickey repo is old
01:15andyfoh, wait, no, that is the old one as sean said
01:16PigDudeyea that was my fear, that these richhickey github io pages are all out of date
01:16seancorfieldhere http://clojure.github.io/clojure/clojure.test-api.html
01:16PigDudethanks, i'll go there
01:16andyfThat said, the up to date official docs aren't necessarily more explanatory than the old out of date one :)
01:16PigDudethis helps a lot, i was getting pretty frustrated and making some ugly testing schemes
01:17justin_smithI put many hours into those caribou.model tests, I wonder how many useful clojure.test features or idioms are missing from there
01:19skinkitten:)
01:21seancorfieldWe started out using clojure.test at World Singles but now we only use it for our WebDriver stuff since it feels very imperative - do stuff, assert something observable, do more stuff, assert something observable...
01:21seancorfieldWe switched to Expectations about 18 months ago
01:21mdeboardhaha
01:22mdeboardreminds me of that SNL skit from years ago, "Lowered Expectations"
01:22mdeboardhttps://www.youtube.com/watch?v=6xLsRI7-hBs
01:22mdeboards/SNL/MadTV/
01:24justin_smithseancorfield: interesting - I found my tests were mostly about asserting some property of a returned data structure (other than fixtures, but the point is that those abstract the procedural setup from the functional values)
01:26skinkittenhi seancorfield :)
01:26seancorfieldExpectations makes it easy to test a bunch of things about a returned value, all at once
01:26skinkittenI remember you from programming language DEC 2013
01:26seancorfieldHiya skinkitten - enjoying Clojure now?
01:27skinkittengreat course, learned a lot from you ^^ I hope you're doing great . yes I am, it is a nice language, reminds me of racket
01:29seancorfieldskinkitten yeah, life is good... spent the day working with Mark Engelberg's Instaparse to create a way to specify our search rules in "English" :)
01:30seancorfieldskinkitten what have you been working on since PL?
01:36weiwhat’s a good way to create a lookup map from a list? e.g. lookup by id ({:id 1 :data 123}, {:id 2 :data 456}) => {1 {:id 1 :data 123}, 2 {:id 2 :data 456}}
01:37andyfwei: (group-by :id lst) is close to what you ask for
01:38mdeboardooh
01:38andyfexcept that each map value is a vector of values with the same value of the function.
01:38andyfwow, I didn't edit that sentence before sending it
01:38mdeboardhaha
01:39mdeboardI invented my own way of doing that... https://github.com/mattdeboard/ticket-to-ride/blob/master/src/ttr/board.clj#L262
01:39mdeboardI needed an index based on the values of multiple keys
01:40mdeboardi'm sure there's a function out ther ethat does exactly what i need already, does group-by take a func?
01:40mdeboardsho nuff
01:40mdeboardI'm even using it here https://github.com/mattdeboard/ticket-to-ride/blob/master/src/ttr/board.clj#L322
01:40mdeboardoh well, for tomorrow.
01:41weithanks. basically just need a function for updating an element in a list, would be nice if it’s constant time
01:42wei,(into {} (for [[k v] (group-by :id '({:id 1 :data 123}, {:id 2 :data 456}))] [k (first v)]) )
01:42clojurebot{1 {:id 1, :data 123}, 2 {:id 2, :data 456}}
01:42weikinda verbose though
01:43PigDudeseancorfield: cool, i'll look at expectations
01:44andyfwei: There is a function often called map-vals that many people have defined that does what everything except the group-by call in your example does.
01:44skinkittenseancorfield, amazing! I've been completing coursera courses! I can't get enough of them, upcoming are algorithms and a principles of computing by rice. programming in a lot of languages is fun, these past days I've been programming in ruby,python,racket,clojure :D
01:44andyfwell, almost everything: (map-vals (group-by :id lst) first)
01:45andyfor probably actually the other way around on args: (map-vals first (group-by :id lst))
01:45weiright. map-vals should come with clojure :)
01:46andyf(defn map-vals [f m] (into {} (for [[k v] m] [k (f v)]))
01:46andyfoften redefined, and yes, it wouldn't be bad if it were in core
01:47andyfhttps://github.com/jonase/eastwood/blob/master/src/eastwood/util.clj#L9-L23
01:47amalloyandyf: https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L422 is a more general group-by that allows you to do those steps all at once, without the intermediate list of things you don't care about
01:48seancorfieldskinkitten cool, i've done a lot of languages over the years, but i like working mostly in clojure/script nowadays :)
01:48weithese are quite useful functions (as the name claims)
01:49weiamalloy: ^
01:49andyfamalloy: amalloy/useful has issues and pull requests, but flatland/useful does not. Should interested parties file issues against flatland/useful?
01:49mdeboardholy crap
01:49mdeboardawesome.
01:50amalloyandyf: i don't know, really. flatland/useful used to be the official home, but in the geni layoffs i took it
01:50seancorfield,(into {} (map (juxt :id identity) '({:id 1 :data 123} {;id 2 :data 456})))
01:50clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
01:50amalloyi'm still used to linking to flatland, and don't really think of it as mine; but we split up the flatland repos so that our personal github pages don't look so lonely
01:50seancorfieldoops
01:51seancorfield,(into {} (map (juxt :id identity) '({:id 1 :data 123} {:id 2 :data 456})))
01:51clojurebot{1 {:id 1, :data 123}, 2 {:id 2, :data 456}}
01:51weiamalloy: groupings does not seem to compile in clojurescript: if-let requires exactly 2 forms in binding vector
01:51seangrovewei: It's about time I left the country, thinking about Korea - you still out that way?
01:51weithere’s no if-let in there though, weird
01:51andyfwei: if-let is in core
01:52andyfwei: sorry, wasn't following your meaning carefully enough.
01:53amalloyhuh, should compile fine. dunno what's wrong
01:53weiseangrove: yup, in Beijing now. we should meet up!
01:58skinkittenseanaway, nice :)
03:16ddellacostaseangrove: stopping in Japan?
03:16danielcomptonWhen upgrading leiningen (or most other CLI apps), why does it show "Do you want to continue [Y/n]" with a capital Y and lowercase N?
03:17ddellacostadanielcompton: I assume that indicates the default
03:17danielcomptonddellacosta: that makes complete sense
05:55silasdavisI need something like a sorted-map, but with the ability to lookup the neighbours of a particular key
05:56silasdavisso for example if the map had
05:56silasdavis{:aa 1 :ab 3 :cd 4}
05:56silasdavisI cna find out that the left neighbour of :ac would be :ab and the right :cd
05:57silasdavisIt would be fine if I had to first :ac, and thenn somehow get the previous
05:58Glenjaminsilasdavis: have a look at clojure.data.avl
05:58Glenjamini think that does what you describe
05:59silasdavisah perfect
05:59silasdavisyes I think it does
05:59silasdavisthanks
06:07silasdavisis there any performance difference between using destructuring, [head & tail], to get the first/rest of a seq (actually a vector in this case) vs using the functions?
06:12clgvsilasdavis: might be (depending on the concrete access). you are on the safe sight by using the API function of data.avl
06:13john2xis vector a sequence?
06:14clgvjohn2x: what sequence property are you interested in?
06:16clgv&(->> [] class ancestors sort)
06:16john2xclgv: I'm just confused when tutorials/books/docs talk about functions working on sequences.. e.g. whether I should explicitly (seq ..) a vector when a function expects a sequence, etc..
06:17clgvjohn2x: functions working on sequences do call "seq" themselves usually
06:17clgvjohn2x: seq+next in recursion or lazyseq tail is a common pattern
06:18john2xoh ok.. and `seq` works on vectors.. so sequences mean anything that can be seq'd?
06:18clgvjohn2x: in summary those functions work on vectors but the reult is not a vector anymore
06:19clgvonly exception are mapv (for one sequential datstructure) and filterv
06:19clgv,(seq [4 7 9])
06:20clojurebot(4 7 9)
06:21clgvjohn2x: yes in that context sequences and things you can get sequences from are meant
06:22john2xclgv: thanks. makes a lot more sense now..
07:15clgvI still wonder why this happens: "ClassCastException [trace missing]" - after reevaluation of the namespace I get no exception traces anymore :(
07:36danielcomptonAs a Clojure project grows in age, probability that it will write its own version of dissoc-in approaches 1 http://crossclj.info/search?q=dissoc-in
07:38noidiheh
07:42clgvdanielcompton: well isnt there a jira ticket for dissoc-in?
07:43danielcomptonhttp://dev.clojure.org/jira/browse/CLJ-1063
07:43danielcomptonAffects 1.4
07:43danielcompton:)
07:43clgvha right, thats the one I created ;)
07:51mduerksendidn't know about crossclj - how cool is that! :)
07:52clgvhmm does crossclj index clojars? since there are definitely some functions on github that I do not find with it
07:52phillordIs any one else getting crashes from lein help release (for the new version) or is it just me?
07:52clgvphillord: was there an update?
07:53phillord2.4.0
07:53phillordwhich includes a release task:-)
07:53clgvlein 2.3.4: lein help release => Task: 'release' not found
07:54phillordyes
07:54phillordit's 2.4.0
07:58clgvno I mean thats the result with 2.3.4 ;)
07:59phillordyes, I would have guessed that would be the result
08:00phillordas the release task is new in 2.4.0
08:00CookedGryphonphillord: yeah, i got a stack overflow for lein help release
08:00phillordit takes 5 minutes to overflow for me, which is the strange thing
08:06engblomIs lein still used? It seem to pull down an old version of Clojure
08:07kzarengblom: Lein is still used, clojure version generally depends on project.clj. Also have you tried `lein upgrade`?
08:12engblomkzar: It must have been updated very recently. I also did 'lein upgrade' last week and then it was still using 1.5. Now it is using 1.6
08:13kzarCool OK
08:17engblomI have JDK installed myself, but if I want to deploy a clojure project somewhere, is JRE enough?
08:18engblomHow is the compilation happening? Is it outputting java-code which then javac compiles or is clojure directly outputting java bytecode for jre?
08:18Bronsaengblom: the compiler emits jvm bytecode directly
08:19engblomBronsa: Thanks!
08:28deathknightHey guys, it just occurred to me that collaborating on an open source project might not be unlike being in a corporation in Eve-Online or a clan in a game. I'm an amateur and think being in a collaborative environment would be advantageous to my learning. What is a project that one recommends that I contributing to?
08:28mdrogalisdeathknight: Leiningen, perhaps.
08:29deathknightsweet, that has a pretty active community
08:35sdegutisIs lein ring uberjar still the recommended way to compile simple ring-baed Clojure web apps?
08:37hyPiRiondeathknight: If you have any questions re: leiningen problems, feel free to ask over at #leiningen
08:38hyPiRiondeathknight: In addition, xeqi -- which knows a fair bit of lein stuff, wanted to pair with people: http://nelsonmorris.net/2014/04/07/saturday-remote-pairing.html
08:38deathknightawesome!
08:38deathknightThis helps so much, hyPiRion
08:38deathknightthank you
08:38hyPiRionno problem, hope it helps
08:39deathknightIt does, tremendously
08:39hyPiRionI'll try to be more active over there and help people after this week is over, too. (Currently in my last week of my master's thesis)
08:39mdrogalishyPiRion: Your tweets scare me.
08:40hyPiRionmdrogalis: I'm afraid I'm going crazy
08:40mdrogalisYou can join Donny K.
08:40mdrogalisI think he'd punch me if I called him that.
08:40sdegutisIs it natural that the bigger a project gets, the less control I want to give to third-party libraries over how it's launched and executed?
08:40sdegutis(i.e. lein ring)
08:49caternsdegutis: why don't you want lein ring?
08:50sdegutisIt's not that I don't want it.. it's that I don't know what it's doing, and that means I have less control over my project.
08:50sdegutisAlso, I see that when I run lein ring uberjar, it adds a :main task to my project, but Lein complains that there's no :aot for it. The solution for this would be more obvious if I added :main by myelf.
09:30mdedetrichhey I am getting familiar with clojure + light table, and I was wondering if there is a list of default keymaps for paredit, or is it something you have to manually configure (and if so, is there an idea config I can get from somewhere?)
09:31Glenjaminmdedetrich: LT inherits a bunch of keybinds from codemirror
09:31mdedetrichGlenjamin: can you provide me with a link?
09:32Glenjamineverything LT-specific is the in the "Default/User Keymaps" page
09:32mdedetrichGlenjamin: ah brilliant, thank you!
09:33Glenjaminthis might help
09:33Glenjaminhttps://bitbucket.org/glenjamin/dotfiles/src/master/LightTable/settings/user.keymap?at=master
09:33Glenjaminthose are my keybind overrides
09:34mdedetrichGlenjamin: yeah there doesn't seem to be anything spefic to paredit in the default section
09:36mdedetrichbut thanks for the help, looks like I got some exploring to do
09:54silasdavisis using a keyword as a function to access record fields going to be any slower than using the java interop directly?
09:54silasdavisi.e.
09:54silasdavis(.children node) vs (:children node) for some record node
09:55tesmarI am addicted to 4clojure.com
09:55silasdavisand which, if either, is prefered
09:55tesmarit’s awesome and a great challenge
09:58pjstadigsilasdavis: i would suspect that (.children node) would be faster, but as always with speculation it should be profiled
09:59pjstadigsilasdavis: there are other considerations like that using (.children node) won't allow you to process non-record maps, so it creats more brittle code
09:59pjstadig*creates
10:00silasdavisyeah I'd prefer symbol access if the difference is anything other than neglible
10:01silasdavisdoes anyone know how to clear all assignments in lighttable? I keep restarting it to get a clean repl
10:01pjstadigclojure does some work to make keyword callsites fast, so i'm not certain that it *would* be non-neglible
10:17honzawhat's the standard way of installing java on osx these days? i seem to be stuck on java 6
10:28justin_smithhonza: oracle or openjdk should have installers for download that just work™
10:35stuartsierrasilasdavis: Keyword access is always preferred.
10:36stuartsierraUnless you're using the record in a hot loop, there should be no visible difference.
10:42canweriotnowI’m working on implementing an OAuth2 provider in a ring/compojure app. I’ve been playing with https://github.com/pelle/clauth but I was wondering if anyone had found/created any better solutions for this?
10:52philandstuffcanweriotnow: I'm interested in this too, particularly around building OpenID Connect providers and consumers
10:53philandstuffit's probably worth investigating java libraries that you could call from clojure
10:57gfrederickswhy does cider-nrepl use snapshots? do emacs people hate concrete versions?
10:58gtrakthere will be a stable release in a couple weeks.
10:58cbpits pretty much like auto update man
10:58cbpevery 24 hours
10:59gtrakI do like that aspect of it, when we're not breaking people (sorry) :-)
10:59gtrakit's also been discussed to have a separate dev branch
11:01gfredericksI prefer to only update my dev tooling when I'm in the mood to do so
11:02gfredericksemacs' package manager thing seems to make this difficult too
11:02gtrakgfredericks: yea, that's hell. I'm going to rework mine with el-get when I get a chance.
11:02gtrakbut I've been running cider from a git checkout.
11:02gtraksince I hack on it.
11:16tvanhensIs using lein run an acceptable way to run an app in production or is it preferred to build to uberjar?
11:17llasram1000x the latter
11:17nixntvanhens: it depends on how the underlying webserver runs (security-wise)
11:17hyPiRionUnless you have good reason to use `lein run` over uberjaring, use uberjar
11:18tvanhensgotcha thanks.
11:18Glenjaminthere's a gotcha with uberjars
11:18Glenjaminin that any jvm-opts you'll need to include in your "java -jar" command
11:19tvanhensas in anything we have defined in the project.clj jvm-opts we'll need to run manually with java -jar?
11:19gfredericksyeah; and it reduces your ability to depend on other lein features, like aliases
11:20tvanhenswhat about command line arguments, is there a way to pass those in?
11:21hyPiRiontvanhens: `java [ options ] -jar file.jar [ arguments ]`
11:21gfredericksyeah, java -jar supports that
11:22gfrederickswhile you're at it, you can also avoid AOT via `java [ options ] -cp file.jar clojure.main -m my.main.namespace [ arguments ]`
11:22tvanhensgfredericks whats the upside of that?
11:23technomancyit's easy to mess up AOT
11:23hyPiRionavoiding AOT bugs
11:24technomancyhowever, avoiding AOT also adds to your startup time
11:25gfredericksleiningen does not have a changelog?
11:25technomancygfredericks: it's pronounced NEWS.md
11:25kzarTrying to get started with stasis. I'm doing (stasis.core/slurp-resources "resources/public/" #".*") at the repl to see how things work. It's returning an empty array-map though despite there being a file in resources/public/index.html
11:25hyPiRionwhen it comes to AOT, you're sort of between Scylla and Charybdis.
11:25gfrederickstechnomancy: oh that is an interesting pronunciation; thamks
11:26tvanhensThanks guys that was a ton of help :) Are there any resources that are good for reading up about AOT and uberjars in general?
11:26technomancyAOT is fine as long as it never happens in a development context
11:26technomancyso if you have a build server, you should be safe
11:26kzar(I'm trying to migrate my site from jekyll to something clojurey, don't have to use stasis)
11:26gfredericksoh hey I am mentioned in the news
11:26hyPiRiongfredericks: in the changelog*
11:26technomancygfredericks: front page
11:26technomancyextra, extra, read all about it
11:26hyPiRionwe just spell it funny
11:27gfredericksour CI started failing when it silently switched to using 2.4.0 and I'm trying to figure out why
11:27hyPiRionOh, that's a lot of new names on the list
11:30bacon1989Does anyone know where I could find an example of clojure running in an android project?
11:30technomancyhyPiRion: that's the best part of the new release =D
11:30arrdemhyPiRion: 30+ https://groups.google.com/forum/#!topic/clojure-dev/l1hF94fFNN4
11:30bacon1989I can't seem to get it working without getting null pointer exceptions
11:31bacon1989here's an example of what i'm trying to do http://pastebin.com/4zsXjmw5
11:31Frozenlockbacon1989: Would the clojuredroid tutorial be enough, or do you want a production application?
11:32bacon1989Frozenlock: I want to include the runtime in an existing android application, I can't seem to find documentation on that
11:32hyPiRionarrdem: I was thinking about Leiningen, in the changelog
11:32hyPiRionAlthough that is really neat too
11:32bacon1989there doens't appear to be an example of it anywhere
11:33Frozenlockbacon1989: https://groups.google.com/forum/#!forum/clojure-android (That's the limit of my knowledge) :-p
11:34bacon1989Frozenlock: that's helpful, thank you
11:34bacon1989I'm really trying to figure out if my problem is with dalvik, or if it's with my function calls in the example I gave you
11:34Frozenlock(slurp "some-url") gives me a connection error. Is there a way to specify which interface should be used?
11:34bacon1989I kind of followed this article http://stackoverflow.com/questions/2181774/calling-clojure-from-java
11:35FrozenlockNetwork interface
11:35clgvwas there leiningen 2.4.0 annoucement on the ML? seems I missed that
11:38justin_smithFrozenlock: you may want to check out java.net.URL and its api
11:39Frozenlockjustin_smith: Will do, thanks
11:39justin_smithfor example it has a version of the openConnection() method that takes a proxy argument
11:39justin_smith~javadoc java.net.URL
11:39clojurebotI don't understand.
11:39justin_smith(wondering if that works ... nope)
11:39FrozenlockI reading now http://docs.oracle.com/javase/7/docs/api/java/net/URL.html
11:40Frozenlock*I'm
11:40FrozenlockThat's weird.. I was expecting the OS to chose the interface with the web access for this :-/
11:40Frozenlockchoose
11:41justin_smithwhat did your arg to slurp look like? I assume it include protocol etc.?
11:42Frozenlock(slurp "http://google.ca&quot;) => java.io.IOException: Server returned HTTP response code: 504 for URL: http://google.ca
11:43bacon1989I guess my basic question is, how do I read data into the clojure runtime?
11:43justin_smithbacon1989: what kind of data? for clojure edn literals, clojure.edn/read
11:43gtrakbacon1989: what kind of data?
11:43gtrakjustin_smith: lol
11:44bacon1989sorry, i'll be more detailed
11:44systemfaultFrozenlock: 504??! o_O
11:44gtrakbig data? little data? orange data?
11:44nixnit's always hot data
11:44canweriotnowphilandstuff: that’s a good idea… I’ll have to take a look. thanks
11:44justin_smithgtrak: dada data
11:44cbp~big data
11:45clojurebotI don't understand.
11:45justin_smith~bigdata
11:45clojurebotExcuse me?
11:45cbpdammit clojurebot get with the times
11:45gtraknice cooled glass of data.
11:45justin_smith:P
11:45justin_smith~cloud
11:45clojurebotexcusez-moi
11:45justin_smith~botsmack
11:45clojurebotclojurebot evades successfully!
11:45Frozenlocksystemfault: I know... not everyday you see a 504 :-p
11:46systemfaultFrozenlock: From Google, indeed.
11:46bacon1989I'm in java, and I want to load a string into the clojure runtime, and then call it. There appears to be a function clojure.lang.RT.loadResourceScript(filepath), but I want to just load a 'string' into the clojure runtime
11:46gtrakbacon1989: eval+read-string
11:47bacon1989my code looks like this http://pastebin.com/TheJsqCE
11:47bacon1989gtrak: i'm not making a repl just yet
11:47gfredericksso I'm using leiningen 2.3.4
11:48gfrederickswhich depends on pomegranate 0.2.0
11:48gfredericksyet it downloads pomegranate 0.3.0
11:48gfredericks(and presumably uses that)
11:48gtrakbacon1989: well, what do you mean call it? sounds like that's what you want from the pastebin
11:48gfrederickshow can I figure out why? If a plugin depends on 0.3.0, can that override leiningen's own dependency?
11:48bacon1989gtrak: on line 23, that line needs to be loaded into the runtime
11:49bacon1989there's a function for loading a 'file', but no function for loading a 'string' that i'm aware of
11:49stuartsierrabacon1989: You would need Clojure.var("clojure.core", "read-string") and Clojure.var("clojure.core", "eval")
11:49bacon1989any ideas?
11:49bacon1989stuartsierra: ahh ok
11:50stuartsierrabacon1989: But it looks like you're working on Android, and I doubt that Clojure's `eval` will work at all on Android.
11:51bacon1989stuartsierra: are you sure? i've heard of people being pretty successful getting a clojure-repl working
11:51stuartsierraAlthough, now that I think of it, someone demonstrated a Clojure REPL on Android, but it was very slow.
11:51bacon1989ya
11:51bacon1989i saw that
11:51bacon1989i'm ok with slow startup times
11:51gtrakbacon1989: there's no faster path to load code than eval.
11:52gtrakaside from AOT
11:52gfrederickstechnomancy: if I add a {:mirrors {"central" {...}}} to my user profile, should I expect pomegranate to blow up with the error msg "Multiple mirrors configured to match repository"?
11:53technomancygfredericks: hrm; I've never used mirrors, but I think the answer is no
11:53technomancygfredericks: is this new in 2.4.0?
11:53gfrederickskthx; staring at the pomegranate source now
11:53gfrederickstechnomancy: well I think it applies to uses of pomegranate 0.3.0, which is supposedly new in 2.4.0
11:53gfredericksI'm getting 0.3.0 using leiningen 2.3.4 but haven't figured out why yet
11:54gfredericksthis pomegranate code might be buggy
11:59gfrederickstechnomancy: easiest way for me to run leiningen with an alternate version of pomegranate? is there a checkouts for the plugin classpath?
12:00mdeboard,(group-by :id [{:id 1 :name "foo" :banana "potato"} {:id 2 :name "foo" :banana "fistula"}])
12:00clojurebot{1 [{:name "foo", :id 1, :banana "potato"}], 2 [{:name "foo", :id 2, :banana "fistula"}]}
12:00mdeboardRight, so is there a group-by that will group by compound keys
12:00gfrederickslike two keys at once?
12:00mdeboard,(group-by [:id :banana] [{:id 1 :name "foo" :banana "potato"} {:id 2 :name "foo" :banana "fistula"}])
12:00clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer>
12:00mdeboardright
12:00gfredericksmdeboard: use juxt
12:00sdegutisHow do you all usually compile your web app and upload it?
12:01mdeboardI wrote one last night but I assume there's an easier way
12:01sdegutisI have an alias called "compile-all" that runs "cljsbuild once", "garden once", "ring uberjar", and then I push the resulting .jar file up to the server.
12:01bacon1989alright, so this is what i've got so far, I seem to be getting closer. Error on line 25 http://pastebin.com/MYjs5gFF
12:02bacon1989java.lang.UnsupportedOperationException
12:02bacon1989any ideas?
12:02sdegutisBut it seems like this isn't what Leiningen :aliases were meant for... is there some other more canonical way?
12:02nullptr`TIL about garden
12:02nullptr`(inc sdegutis)
12:02sdegutisaww the one time, and lazybot isnt here :(
12:02hyPiRionRaynes: ^
12:02hyPiRionyou had one job.
12:02sdegutisit's okay, let's just remember that I have 1
12:03bacon1989is it possible I need to generate the string in clojure using 'def'?
12:03clgvmight have been famous last words? :P
12:04ambrosebsclgv: made my own fork, works great.
12:05clgvambrosebs: did lazybot get jealous of your fork and just quit? :P
12:05ambrosebsI miss lazybot too :(
12:05justin_smithbacon1989: the string does not need to be bound to a var, getting it read and evaled will suffice
12:06justin_smithbacon1989: clojure uses java datatypes
12:06devnwhat do people use for automatically rerunning specific clojure.test tests?
12:06justin_smith,(class "hello")
12:06clojurebotjava.lang.String
12:06devn(aka a watcher so I can edit a test, save, and have it rerun)
12:06bacon1989justin_smith: but in my example, it's throwing an error
12:06devnlike midje's `lein midje :autotest`
12:07mdeboardgfredericks: Here's how I wrote it (though I have that inner anon func broken out into a separate one) https://gist.github.com/mattdeboard/9e60a7dd4d101fa368dc
12:07mdeboardhow would that be different with juxt
12:07technomancydevn: after-save-hooks
12:07justin_smithbacon1989: you are calling foo with one string
12:07justin_smithyou should be calling it with two strings
12:08justin_smithbecause it takes two string args
12:08justin_smith(line 37)
12:08bacon1989justin_smith: ah yes, I changed it
12:08bacon1989it's failing before that though
12:09bacon1989i can't get the eval.invoke(... to work correctly
12:09bacon1989it expects a 'form'
12:09justin_smithbacon1989: the string you pass to read_string has two forms
12:10bacon1989the error is along the lines of java.lang.UnsupportedOperationException: can't load this type of class file, compiling:(NO_SOURCE_PATH:0:0)
12:10justin_smith,(read-string "(ns user) (defn foo)")
12:10clojurebot(ns user)
12:10justin_smithnotice it only gets the first form
12:11justin_smithyou need to split that into one string per form
12:11bacon1989ok, i'll give it a shot
12:11justin_smith(this is probably not addressing your problem at hand, it is another error in your code)
12:13justin_smithanother nitpick - that map.invoke should not actually do anything, because you are not using the return value and map is lazy
12:15bacon1989justin_smith: they're tests, but yeah
12:16bacon1989i read something stating that what I want to do is impossible with dalvik
12:16justin_smithOK
12:16justin_smithmaybe try this with the jvm first
12:16justin_smithfor sanity's sake?
12:16justin_smiththen if you have a working java version, then see how dalvik handles it?
12:20Glenjaminto people tend to use tools.trace, or is there a better way of introspecting 3rd-party code when debugging?
12:27arrdemif you're feeling brave you could try single stepping with eclj...
12:27arrdembut tracer or tools.trace seems to be the current goto
12:28Glenjamincheers, is there any tooling for jumping to source quickly as well?
12:28bbloomarrdem: there's no way to single-step with eclj :-(
12:28arrdembbloom: T_T
12:28Glenjamini tried lein ubersource, but it appears that LT doesnt index target/ - will probably have to poke around the settings
12:28bbloomarrdem: eventually the meta-circular interpreter will be able to do that
12:28bbloomarrdem: by treating "eval" as an effect you can intercept
12:29arrdembbloom: hum... really I just want to see a single cycle interpreter built using TANAL's ASTs.
12:30arrdem'cause then we can build a real GDB like debugger.
12:32bbloomarrdem: if you want to attach to & debug running jvm programs, you need a very different approach than eclj or whatever you could do with an analyzer's ast
12:32bbloomyou need to have origin information on the bytecode
12:32Glenjaminarrdem: when you said tracer, were you referring to clojure.contrib, or something else?
12:32bbloomarrdem: similar to source maps for js
12:33bbloomarrdem: debugging with an interpreter is a very different approach
12:33arrdembbloom: for debugging JVM interop sure.
12:33arrdems/JVM/$HOST/g
12:35visofhello
12:36AWizzArdHi visof.
12:37mdeboardhi
12:37mdeboardvisof
12:37mdeboardwe have awaited your return, as the prophecy foretold
12:37arrdemheh
12:38alejandrohey there, does anyone have a good way of setting environment variables via clojure?
12:39visofif i have a string with this format "<x> <y> \"Hello\"\n<xx> <yy> \"hello\nworld.\"\n<a> <b> <z>\n" , how can i get triples [["<x>" "<y>" \"Hello\"], ["<xx>" "<yy>" \"hello\nworld.\"], ["<a>" "<b>" "<z>"]] ?
12:40technomancyalejandro: you can't set env vars on the jvm
12:40visofeven if the string big but in this format
12:40justin_smithalejandro: there are hacks, via interop, but it simply isn't an operation that is portable to all jvm hosing operating systems
12:40gtrakalejandro: what do you mean setting? for processes that are started via the JVM?
12:40justin_smithalejandro: this is why people use System/setProperty and System/getProperty
12:41alejandrogtrak: just for the clojure process itself. it's really for unit testing more than anything else
12:41justin_smiththis is withing your own process that is, you can trivially set env for a child though
12:41gfredericksmdeboard: you would just say (group-by (apply juxt ks) m)
12:41alejandrojustin_smith: cool, I'll look at those and see if I can use them for what I need
12:41justin_smiththen use System properties instead of environment
12:41gfredericksmdeboard: or in your earlier example, (group-by (juxt :id :banana) [...])
12:41gtrakalejandro: use environ to grab system properties conveniently.
12:41mdeboardgfredericks: Well cool
12:41gfredericksmdeboard: note that group-by takes an arbitrary function, not a key
12:43Glenjaminvisof: a couple of clojure.string/split calls should do it
12:43visofGlenjamin: there is a newlines inside strings
12:43visof\"hello\nworld.\"
12:44bacon1989I wonder if I can grab the clojure file generated from lein-droid, and use it normally like clojure.jar for the JVM
12:44mdeboardgfredericks: Although that doesn't quite fit my use case w/o writing more code, but that is useful info
12:44alejandrogtrak: justin_smith: so is it better to do config options via system properties for JVM apps?
12:44alejandroe.g. port settings or database urls?
12:45justin_smithalejandro: if you want to change them from within the same process, yes
12:45Glenjaminvisof: i see, you probably want to take a CSV parsing library and tell it that spaces are commas
12:45gfredericksmdeboard: it does what you were asking about though, right?
12:45mdeboardThough that's really close. I essentially want an inverted index for a collection of hash maps, and your example gets that.
12:46Glenjaminalejandro: you can read environment variables for those cases, why do you need to set them?
12:46justin_smithalejandro: though a common idiom for that stuff is to use a "config map" in clojure, which is a map (or atom around a map) in a var that is accessed by or passed to various code
12:46mdeboardThere's just a couple more transformations I'd need to apply (e.g. (for [[k v] ...] (set k) (vals v)))
12:46GlenjaminPORT=1234 lein run
12:46Glenjaminetc
12:46justin_smithGlenjamin: he mentioned testing
12:46alejandroGlenjamin: yeah, mostly just to be able to test those settings
12:47Glenjaminah, so you can always alter-var-root #'environ/env
12:47justin_smithalejandro: another thing is if you make an abstraction around the config grabber, you can make it return an arbitrary value for tests
12:47gfredericksmdeboard: prismatic/plumbing has some useful map creation fns
12:47Glenjaminor as justin_smith said, wrap access to env via a var you're happy to modify - or pass the env into you app, and pass it differently for tests
12:48stuartsierrak
12:48hyPiRionGlenjamin: You mean with-redefs I presume?
12:48hyPiRionalter-var-root changes it permanently.
12:48Glenjamindepends on scope i guess, i have an alter-var-root at the top of my scratch repl for when i forget to set up env vars
12:48mdeboardgfredericks: I think for now I'm ok with my group-by-many, does what I need and is concise-enough for me to not be ashamed of it haha https://gist.github.com/mattdeboard/9e60a7dd4d101fa368dc
12:48hyPiRionGlenjamin: right, I was thinking about for tests
12:49Glenjamindepends if its tests in a subset of repl, or tests in their own process i suppose
12:49Glenjaminbut yeah, with-redefs makes more sense
12:50deathknightSimilar to Nelson Morris, are there any other programmers publicly looking to periodically pair with others? (src: http://nelsonmorris.net/2014/04/07/saturday-remote-pairing.html)
12:51arrdemdeathknight: 404'd
12:51justin_smithdeathknight: some local clojerks pdx folks have been doing something similar I think
12:51bacon1989one thing I really can't figure out, why don't people include a binary of their work?
12:51bacon1989I found this: https://github.com/clojure-android/clojure
12:51justin_smitharrdem: in erc I had to take off the ) manually
12:51bacon1989which should work with dalvik, but there's no included .jar file?
12:51deathknight:)
12:51arrdemjustin_smith: herp a derp. good catch.
12:51bacon1989is there some sortof benefit to compiling something like this
12:52gfredericksmdeboard: oh yeah, your function is different in a couple ways
12:52bacon1989it's going to be a running in a runtime that isn't going to change
12:52justin_smithbacon1989: mvn -q package inside that repo should do the trick
12:52justin_smithI think
12:52gfredericksmdeboard: if you care about perf you probably want to change that to an (into {} ...)
12:52gfredericksinstead of merge
12:53mdeboardgfredericks: Why's that?
12:53mdeboardidk the perf profile of assorted techniques
12:53arrdemmdeboard: into leverages transients where merge doesn't.
12:53justin_smithmdeboard: into uses transients, merge does not
12:53mdeboardDoes it have something to do with transients?
12:53arrdemlololol
12:53Glenjamini think its transients
12:53justin_smithand as we all know, hobos work hard
12:54mdeboardI asked last night about transients, not clear what that means exactly
12:54arrdem༼ つ ◕_◕ ༽つ GIVE TRANSIENTS ༼ つ ◕_◕ ༽つ
12:54mdeboardIt was like `set` vs. `set!`
12:54arrdem /s
12:54arrdemmdeboard: transients are explicitly single threaded mutable datastructures that can be finalized to normal immutable collections
12:55hyPiRionTransients are the best
12:55mdeboardarrdem: "Finalized"?
12:55justin_smithmdeboard: transients are for usage in place in a local context where there can be no threading issues, and they are modified instead of copied
12:55mdeboardI'm reading clojure.org/transients atm
12:55mdeboardAh I see
12:55justin_smithok, that will explain it better than we do
12:55hyPiRionmdeboard: any "update" operation on a transient invalidates the transient and returns a new one.
12:56hyPiRionwell, it should, at least.
12:56arrdemhyPiRion: whaaa I thought the whole point was update in place, which defeats that.
12:56arrdems/defeats/conflicts with/g
12:56mdeboardSo, it's killing transients
12:56bacon1989brb
12:56gfrederickshyPiRion: that sounds pretty wrong
12:57justin_smitharrdem: technically transients are "allowed" to update in place
12:57gfredericksalmost all updates on a transient return the same object
12:57gfredericksjust not guaranteed to
12:57justin_smithbut they are not bound to
12:57justin_smithyou must use the return value of all transient ops
12:57arrdemhum...
12:57hyPiRiongfredericks: I don't mean the implementation detail, rather
12:57arrdemthis seems like a poor choice of update semantics..
12:57gfredericksclojurebot: transients update operations |return| the same object except in this one case
12:57clojurebotc'est bon!
12:58arrdemthat doesn't even work... you can't express the "invalidation" of an object on the JVM. I can still totally hold a pointer to the "old" value and you can't force me to give it up
12:59arrdemyou can write your API such that the old value is subsequently useless/self-banning... but why...
12:59arrdemit's not like you can (memset &obj 0)
13:00hyPiRionarrdem: Sure, you cannot express the invalidation on the JVM, but it's there semantically (not technically, because you can usually bash in place)
13:01hyPiRionthe general idea is that any update operation on a transient "invalidates" it and that the return value must be used in its place if you want to continue to do update it
13:02mdeboardI changed (apply merge to (into {}
13:02mdeboardNo transients were killed
13:02arrdemI guess the point of this is that it forces the update semantics of transients to mesh with those of normal datastructures so you don't have silly people like me trying to abuse in-place update behavior to build fully mutable datastructures and to in-place updates on them.
13:03arrdemyour code has to be functional in structure, it just _happens_ that the implementation details provide update in place.
13:03hyPiRionright
13:03mdeboardso I assume into is a macro that calls persistent!
13:03justin_smitharrdem: more likely, its the fact that persistant needs to be a single bit flip operation
13:03gfredericksthey don't all the time though; people come in with bugs because they bash transients
13:03mdeboard,(docs into)
13:03clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: docs in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:03mdeboardwhatever idiot
13:03hyPiRiongfredericks: yeah
13:03arrdemjustin_smith: well there's that too.
13:03justin_smitharrdem: and because of this you have to keep the persistent semantics, including the ability to return a new object sometimes
13:03gfredericks,(let [t (transient {})] (dotimes [n 40] (conj! t n n)) (persistent! t))
13:04clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/conj!>
13:04gfredericks,(let [t (transient {})] (dotimes [n 40] (assoc! t n n)) (persistent! t))
13:04clojurebot{0 0, 1 1, 2 2, 3 3, 4 4, ...}
13:04mdeboardlol
13:04hyPiRiongfredericks: return its length
13:04gfredericks,(let [t (transient {})] (dotimes [n 40] (assoc! t n n)) (keys (persistent! t)))
13:04clojurebot(0 1 2 3 4 ...)
13:04mdeboardall this sturm und drang for a Ticket To Ride simulator
13:04justin_smithor reduce + on it
13:04gfredericks,(let [t (transient {})] (dotimes [n 40] (assoc! t n n)) (reduce +(keys (persistent! t))))
13:04clojurebot28
13:05gfredericksthe lesson is that some of the keys turned negative
13:05arrdemwat
13:05cbpdoes leiningen let you inject code in files?
13:05justin_smithlol
13:06justin_smithcbp that sounds like a terrible idea
13:06justin_smithbut I am sure you could do it with some system calls in an :injection key in proejct.clj
13:06justin_smithbut don't please?
13:06cbpjustin_smith: i know but.. clojurescript
13:06mdeboard¸ . ø ¤ º ° º ¤ ø . ¸ justclojurethings ø ¤ º ° º ¤ ø . ¸
13:06justin_smithmaybe what you really want is a preprocessor plugin, and to use its output?
13:07technomancycbp: not into files, but into any given eval-in-project call
13:07arrdemjustin_smith: :injections come on get it right /s
13:07cbpokies
13:07eraserhdWhat is the recommended way to make a custom exception? :gen-class or proxy?
13:08technomancycustom exceptions are =(
13:08eraserhdI'm going to suspect :gen-class, but that's kind of icky.
13:08technomancydefinitely icky
13:08technomancyuse ex-info instead
13:08eraserhdAha.
13:08eraserhdThat sounds like what I'm trying to do anyway.
13:09justin_smitharrdem: sorry, an :injections key just parsed wrong mentally, but you're right
13:09justin_smitheraserhd: probably ex-info, or maybe reify
13:09gfrederickshow can I debug where the deps on my leiningen vm are coming from?
13:09gfrederickslike `lein deps :tree` for plugins&stuff
13:10justin_smithgfredericks: there is a mvn command for plugin dep tree
13:10justin_smithdunno about lein though
13:10technomancygfredericks: right now you have to just move :plugins to :dependencies
13:11roothi, how do i perm change value in list ?
13:11justin_smithtechnomancy: that's too bad
13:11justin_smithroot: make a different list, or use a java.util.ArrayList and maybe you shouldn't be using clojure
13:11eraserhdtechnomancy, justin_smith: Exactly what I'm looking for, thanks.
13:11technomancyjustin_smith: nah, it's a golden opportunity for a new contributor to step up
13:12gfrederickstechnomancy: kthx
13:12justin_smithheh
13:12umpajustin_smith good point
13:15umpaif I name new list by same name as old one, what happens to the old list ?
13:15justin_smithumpa: if it is not bound in some other scope, it can be garbage collected
13:17justin_smithumpa: if you have some ns level var that needs to be updated, it should be wrapped in an atom or ref, rather than just calling def again
13:17umpahow ?
13:17justin_smith,(def l (atom ()))
13:17clojurebot#'sandbox/l
13:17alndvszaCan anyone help me with a problem I am having with Korma?
13:17clgvthats the right moment to suggest one of the books or online tutorials ;)
13:17cbp~anyone
13:17clojurebotanyone is anybody
13:17justin_smith,(swap! l conj 1)
13:17clojurebot(1)
13:17cbp~botsmack
13:17clojurebotclojurebot evades successfully!
13:18clgv~anybody
13:18clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
13:18justin_smithclgv: good point about the books / tutorials
13:18clgvcbp: listen to the bot ;)
13:18alndvszalol
13:19alndvszai create a new app with using luminus, when i try do a select on a mysql table called user, i get the following error: check the manual that corresponds to your MySQL server version for the right syntax to use near '.* FROM "users" WHERE ("users"."id" = 1) LIMIT 1
13:19alndvszaits like the SELECt is being left off the front?
13:20justin_smithalndvsza: can you make a paste of the relevant part of your code?
13:22umpa(def 1 (atom ())) did not work for some reason
13:22umpa(def 1 (atom ()))
13:23AWizzArdumpa: that would be in Java something like: 1 = new java.util.HashMap();
13:23alndvszajustin_smith: https://gist.github.com/anonymous/f9a12fb49bd8585c4738
13:23AWizzArdumpa: you can’t change the value of 1.
13:23clgvumpa: there are pretty good introductory books and online resources about clojure that would save you a lot of pain (judging from that question)
13:23justin_smithAWizzArd: more like ArrayList :)
13:23alndvszaits the defualt code from the luminus template
13:23justin_smithsorry, I picked a bad name for it when I used l in my example, my bad
13:24justin_smithbut still l != 1
13:25clgvjustin_smith: that's a fun choice for a variable name in a written exam choosing the "appropriate" font. you only need to use it in some numerical comparisons :D
13:25justin_smithheh
13:26alndvsza(sql-only (select users (limit 1))) returns "SELECT \"users\".* FROM \"users\" LIMIT 1", wtf
13:26justin_smithweird
13:28alndvszaif i run that line without sql-only i get the error.... use near '.* FROM "users" LIMIT 1' at line 1
13:28alndvsza*hits head on table*
13:29umpahow do I update value in a hash-map ?
13:29justin_smithumpa: I think you should find a good tutorial on immutability and data structures in clojure
13:30umpajustin_smith I tried going clojure Koans but still have trouble grassping some of the concepts
13:31justin_smithclojure can be great, but it requires a different approach to programming, where instead of mutating some variable, you pass values to functions that return another value as a result
13:31cbpumpa: maybe try this http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome
13:31johnwalkersend-off uses a fixed-size threadpool
13:31johnwalkerhow are the actions being sent to the threadpool allocated?
13:32justin_smithcbp: nice link, bookmarking for future reference, thanks
13:32johnwalkeris it first come first serve?
13:33johnwalkerfor example, if i have multiple agents
13:33alndvszaanyone using Clojure with mysql that can give me an alternative to korma?
13:33mdeboardalndvsza: jdbc direct?
13:33johnwalkeractually nevermind, i get how it works
13:33justin_smithalndvsza: if you have some sql knowledge, clojure.java.jdbc is fine
13:33johnwalkerthere's one global threadpool but each agent has its own queue
13:33justin_smithjohnwalker: exactly
13:33johnwalkerthat makes sense, sorry. rubber-ducking
13:33alndvszaah, alright
13:34johnwalkerthanks justin_smith
13:34johnwalkerthats a pretty solid way to do it
13:34hyPiRionalndvsza: I like yesql, you could check that out
13:34alndvszai will indeed
13:34justin_smithjohnwalker: http://clojuredocs.org/clojure_core/clojure.core/agent the docs here are for an old version but not out of date
13:35justin_smithalso you can get a lot from the links here, if you haven't seen it http://clojure.org/cheatsheet
13:37johnwalkerahh, i did see those
13:37johnwalkerclojuredocs is the w3schools of clojure these days
13:37canweriotnowlol
13:37justin_smithnow now, it's not that bad
13:38umpanice thanks for the links guys
13:38johnwalkerit's not that bad, but there are a striking similarities
13:39alndvszahah, this is quite a novel approach, SQL in sql files!
13:39johnwalkerclojuredocs is the first hit on google and whenever i click it by accident i bounce
13:39justin_smithjohnwalker: there is always clojure.repl/source
13:40johnwalkerwhy don't i use that more often
13:40johnwalkerthat told me accidentally what i needed to know lol
13:40johnwalkerer
13:40johnwalkerexactly*
13:41johnwalkeri wish that worked with java classes too
13:41technomancyor M-. if you're in cider
13:41justin_smithyou hotshots and your unstable almost-working editor integrated tooling
13:41johnwalkerM-. throws an error ._.
13:42johnwalkerwrong type argument sequencep
13:42technomancywell, assuming a stable version of cider =(
13:42johnwalkeroh, it DOES work
13:42johnwalkerit jumps to source
13:42justin_smithjohnwalker: all the problems that are not caused by having too old a version of cider, are caused by having too new a version of cider
13:42justin_smithther is no stable version
13:42johnwalkerit just throws an error if there isn't a string at point
13:43gtrakjohnwalker: M-. will work with java in recent ciders, but you need the source artifacts in your dependencies.
13:43technomancyjustin_smith: 0.5.0 has treated me well
13:44sdegutisdoes anyone else pronounce "fn" as "effin"?
13:44technomancywhich is coincidentally the version on marmalade
13:44sdegutisor is it just no one?
13:44gtraksdegutis: yes
13:44gtrakdefn and fn rhyme
13:44justin_smithtechnomancy: cool, I will maybe check it out sometime - I am subscribed to their github issues and have a timer set to check out the latest stable whenever the "everything broke" messages stop coming
13:44johnwalkergtrak: i will have to look into that because that sounds extremely good
13:45gtrakjohnwalker: it's quite magic
13:45gtrakwe'll have a stable release soon!
13:45justin_smithgtrak: and I know you've been pushing for that, and I am grateful
13:45gtrakon the order of weeks.
13:45technomancyjustin_smith: it's really unfortunate that the docs recommend melpa =(
13:45cbp:-(
13:45gtrakjustin_smith: yea, gotta break a few eggs.
13:46cbpbbastov has a thing for melpa. His prelude thing defaults to it
13:46technomancycbp: he also has a pretty severe disregard for stability
13:46technomancythe two seem to go hand-in-hand
13:46arrdemtechnomancy: "pretty severe" would seem to be an understatement.
13:47technomancyarrdem: I keep telling myself "at least there is a maintainer now"
13:47gtrakyea.. he assumes everyone using cider is like him.
13:47gtrakriding git emacs and melpa for everything :-)
13:48gtrakand caring about emacs
13:48johnwalkerto be fair, bbatsov is a boss
13:48gtrakI've found him very pleasant, actually, I just have to keep on top of stability or there would be even less than there is.
13:49hiredmanin what sense?
13:49gtraklike, they added an ASM dep which broke cider-nrepl a while back, for the java navigation.
13:49gtraksince large java projects contain something that contains ASM
13:50gtraknow it uses the java compiler API anyway.
13:52gtrakgfredericks: any luck on tools.nrepl since we last talked?
13:52gtrakI'll probably hit it this week.
13:52nullptrt
13:52gfredericksgtrak: nopes
13:56lemonodortechnomancy: the new version of lein looks great. i was excited to try “lein release” but i’ve tried it on 2 different packages of mine, on os x and linux, with a clean ~/.lein/profiles.clj, and in each case it dies with a StackOverflowError: https://www.refheap.com/86444
13:56lemonodorany idea what i might be doing wrong?
13:58technomancylemonodor: yeah, this is a bug that only manifests from the uberjar of the 2.4.0 release: https://github.com/technomancy/leiningen/issues/1554
13:58technomancywill push out a 2.4.1 release soon; in the mean time you can run from a checkout of lein
13:59gfrederickshaving some trouble haxing lein
13:59gfredericksI wanted to change the pomegranate dependency and run lein that way
13:59lemonodortechnomancy: perfect, thanks
13:59gfredericksso I'm using the /bin/lein in the leiningen project to launch it
13:59gfredericksbut am not seeing the changed dep
13:59gfredericksalso if I tweak the version string in /project.clj, `lein --version` doesn't change
14:02technomancygfredericks: try running `lein install` from the leiningen-core dir
14:03gfredericksROGER
14:06gfredericksI think I have offended leiningen
14:07arrdemthe gods frown
14:07mdeboardheyyyyyyyyyy satan!
14:07mdeboard(south park)
14:07mdeboard,(south park)
14:07clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: south in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:07gfredericksyou know what I bet I can accomplish this by just sneaking an alternate jar of the same version of pomegranate into ~/.m2
14:08gfrederickswhat could possibly go wrong
14:08technomancychecksums
14:09arrdem(inc technomancy)
14:09gfredericksurm
14:09lazybot⇒ 112
14:09gfrederickswill they necessarily go wrong?
14:09arrdemgood lord
14:09gfredericksI just need some way to debug my damn build tool
14:09arrdemRaynes: did you patch karma to be shared?
14:09arrdem$karma arrdem]
14:09lazybotarrdem] has karma 0.
14:09mdeboard$karma arrdem
14:09lazybotarrdem has karma 29.
14:09arrdemthat would be a yes
14:09mdeboard$karma mdeboard
14:09lazybotmdeboard has karma 6.
14:09mdeboard:(
14:09Raynesarrdem: That's not a bug, it's a feature.
14:10RaynesKarma was always meant to be per-channel.
14:10arrdemRaynes: I didn't say it was a bug, it was just unexpected behavior.
14:10RaynesWe're talking about shared karma between channels?
14:10cbp$karma cbp
14:10lazybotcbp has karma 8.
14:10arrdemoh. herp derp. I'm thinking I'm in -offtopic
14:10cbptake that mdeboard !!!
14:10gfredericksarrdem: quick quick say something about clojure
14:10mdeboard(dec cbp)
14:10lazybot⇒ 7
14:10mdeboard(dec cbp)
14:10lazybot⇒ 6
14:11mdeboard$karma cbp
14:11lazybotcbp has karma 6.
14:11arrdemgfredericks: nope sorry I _am_ offtopic
14:11cbpwat
14:11mdeboard(+ 2 cbp)
14:11mdeboard(inc cbp)
14:11lazybot⇒ 7
14:11cbpwho will stand for this injustice!
14:11mdeboard(inc cbp)
14:11lazybotDo I smell abuse? Wait a while before modifying that person's karma again.
14:11mdeboardlol, sorry.
14:13mdeboard(inc cbp)
14:13lazybotDo I smell abuse? Wait a while before modifying that person's karma again.
14:13mdeboardfine.
14:13RaynesLazybot don't mess around
14:14arrdemstrictest lazy bot ever
14:14gfredericksdoes leiningen not get its own dependencies from ~/.m2?
14:15technomancygfredericks: bootstrapping lein is tricky. it has to cache its classpath in order to be self-hosting.
14:15technomancysee the .lein-classpath file in the checkout
14:15gfredericksI'm using a regular install now
14:15gfredericksdoes it use an uberjar?
14:15technomancyyeah
14:15gfredericksconsarnit
14:15gfredericksthere goes that tactic
14:16gfredericksis there a way I can sneak a user.clj onto the classpath?
14:16technomancyyou need a checkout for that
14:16technomancythe uberjar is on the bootclasspath
14:17technomancyfor speeeeeeed reasons
14:17gfrederickswait can't I add to the classpath by messing with my lein script?
14:18technomancyyou can, but the bootclasspath always wins over regular classpaths
14:18gfredericksdoes leiningen supply a user.clj though?
14:18gfrederickscan't I still sneak in a monkeypatch before leiningen's clojure code actually runs?
14:20gfrederickshaha it worked
14:20arrdem(inc crowbars)
14:20lazybot⇒ 1
14:20gfredericksno monkeys are safe from my patches now
14:21gfredericksproblem solved
14:21gfrederickstechnomancy: thanks
14:21gfredericks(inc technomancy)
14:21lazybot⇒ 113
14:22dgleesonhello all. I'm wrote a middleware that does authorization. It requires that my war be installed in the main application, because it handles putting a Shiro subject on the session. This is causing a bunch of my unit tests to fail. I've been trying to figure out a way to only load that middleware when I'm in the tests that test it, and disable the middleware when I'm not testing the middleware. If I just try to define the (handler/app routes) again compoj
14:35devn,(* 3. 2.)
14:35clojurebot6.0
14:35devnwat
14:37johnwalkerdev you reminded me of cedric greevey's trick
14:37johnwalker,(def .3 0.4)
14:37clojurebot#'sandbox/.3
14:37johnwalker,(+ .3 0.4)
14:37clojurebot0.8
14:38gfredericksleiningen in duplicating the mirrors list before passing it to pomegranate
14:40justin_smithdgleeson: make a middleware wrapper that passes the handler unchanged under one env, and does the proper action in the other
14:40justin_smithdgleeson: then of course give it its own independent unit test (middleware are just data transforms, so this is trivial)
14:41justin_smith(fn [handler] (fn [request] (if should-wrap? (f (handler request)) (handler request))))
14:44dgleesonjustin_smith: I'll give it a go. Thanks!!
14:46gfrederickswoooh it is meta-merge
14:46gfredericksthere's a lein that merges the project map with a modified version of itself
14:47justin_smithitself meaning lein?
14:47justin_smith(if only)
14:47gfrederickslein does (meta-merge project (assoc project ...))
14:47gfredericksthis should be okay for mirrors because it's a map
14:47gfredericksand (merge m m) should give you m
14:47gfredericksbut somebody has transformed the map into a seq of kvpairs
14:47gfredericksso it turns into duplicates that offends pomegranate
14:47gfredericksso my question is
14:48gfrederickswhich is the real problem? leiningen merging a project with itself, or the mirrors entry getting de-mapped?
14:49justin_smithit sounds to me like the mirrors entry being de-mapped is a bug
14:50gfredericksit seems weird to me to expect that merging a project with itself will never cause problems
14:51gfredericksunless projects are assumed to belong to a semilattice amirite distributed systems hipsters haha wooo
14:52gfredericksmaybe I'll try to figure out which one of these actually changed in the new release
14:53gfredericksthe self-merge: https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/project.clj#L631-633
14:54gfrederickslooks like the self-merge is new in 2.4.0
14:55gfredericksand I bet the same effect could be gotten by merging with a single-entry-map instead of associng onto the project and merging that back into the project
15:01justin_smithgfredericks: sounds like you have enough info to write a failing unit test that demonstrates the issue
15:02amalloygfredericks: mirrors gets turned into a seq of kv pairs for the same reason that dependencies and repos do: so that you can specify precedence
15:02amalloythe canonical format is a seq of pairs; that project.clj accepts a map is just for user convenience in the most ocmmon case where you don't care about order
15:02gfredericksamalloy: good to know
15:02amalloyor, anyway, i know that's true of deps and repos, and assume from your conversation that it applies to mirrors to
15:02amalloyo
15:03gfredericksmy guess is that this self merge is not necessary
15:03technomancygfredericks: oh man, that is weird
15:04gfrederickstechnomancy: https://github.com/technomancy/leiningen/commit/f5305ab47b0953969b2b6a6822888e25fa8517c9
15:05technomancywe need to meta-merge because :repositories or :plugin-repositories could have :replace or :displace
15:05technomancybut we don't want to do it to the whole map
15:05gfredericksright
15:05gfredericksso the second arg to meta-marge could be a singleton map?
15:05gfredericksvia select-keys I guess?
15:06technomancy(update-in project [:repositories] meta-merge (:plugin-repositories project)) would be my instinct
15:06gfrederickstechnomancy: what's the best angle for regression-testing this?
15:07gfredericksmaybe a high-level "I can run something on a project with a mirror"?
15:07amalloytechnomancy: i think (meta-merge project {:repositories (:plugin-repositories project)}) is probably slightly better?
15:07amalloyi guess it's about the same, never mind
15:09gfrederickstechnomancy: any chance this would fit with the 2.4.1 you mentioned earlier?
15:09technomancygfredericks: definitely going into 2.4.1
15:09technomancythanks for catching this
15:09gfredericksw0000h
15:09bbloomi'm having a hard time loading a google closure lib w/ cljs... i've followed dnolen_'s instructions here: http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html but the library does not seem to get included in the output
15:10technomancy:mirrors would make a good regression test as would attempting to use a plugin that's in :plugin-repositories and not in ~/.m2
15:10dnolen_bbloom: got a gist of your ns form?
15:11amalloytechnomancy: interestingly, because of the bizarre way that some-fn handles multiple arguments, https://github.com/technomancy/leiningen/blob/d8634b22/leiningen-core/src/leiningen/core/project.clj#L120 is equivalent to ((some-fn nil? displace? replace?) left right)
15:11bbloomdnolen_: it's this library: https://raw.githubusercontent.com/google/tracing-framework/master/shims/wtf-trace-closure.js and i'm simply doing (:require [WTF])
15:11cbp,(a/b/c)
15:11clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: a, compiling:(NO_SOURCE_PATH:0:0)>
15:11technomancymetamerge! http://www.deviantart.com/art/MEGAMERGE-Celled-199279278
15:11bbloomdnolen_: manually invokign js-dependencies shows it finds the file
15:12bbloomaaahhh 404 in the network tab
15:12bbloomit's not copying it to the output, it's trying to use it from the resources directory
15:13speiDoes anyone know if reducers/fold can parallelize over reducers/take?
15:14dnolen_bbloom: (:require ...) likely won't work w/o deps.js
15:14technomancygfredericks: can you test master?
15:14gfredericksummm
15:14gfrederickslet's see :)
15:14bbloomdnolen_: my browser is loading deps.js
15:14stuartsierraspei: reducer parallelism depends on the *source*, not what operations you do.
15:14dnolen_bbloom: the dep.js for wtf-trace-closure.js?
15:14dnolen_each library needs to provide it
15:15dnolen_bbloom: even so, I'm not sure how good this stuff is since it's not something I've ever used
15:15dnolen_it may need more work
15:16bbloomdnolen_: does the filename need to match the provide statement?
15:16bbloomie do i need to rename to WTF.js ?
15:16dnolen_bbloom: you may - that might have been part of cemerick's patch
15:17bbloomdnolen_: this is pretty hairy
15:17dnolen_speaking of which it might be worth relaxing it if the library location can be determined from deps.js
15:17cemerickdeps.js is only used for the goog stdlib stuff
15:17dnolen_bbloom: well you have two resolutions mechanisms - google's laissez faire deps.js and the classpath
15:18bbloomdnolen_: ideally, i'd just like to stick a .js file in a particular place and have require just work
15:18bbloomis there a reason that can't happen?
15:18cemerickbbloom: yes, the name in :require has to match the goog.provide in the file, and the classpath location of the file
15:18speihere is an example where using reducers/take slows down a computation https://gist.github.com/ship561/8c8b1fa60a4937bbce8a
15:18dnolen_bbloom: not really interested in allowing people put stuff in random locations
15:19dnolen_bbloom: open to novel ideas on how to resolve libraries with non classpath layouts
15:19dnolen_well google closure libraries
15:19dnolen_not ClojureScript ones
15:20bbloomdnolen_: the way i hoped it worked (maybe it does work this way? kinda) is that i'd specify a search path of closure lib roots
15:20gfrederickstechnomancy: looks goooood
15:20dnolen_bbloom: its needs to work for libs in JARs too
15:20amalloyhave you tried looking at the source of r/take, spei?
15:20bbloomdnolen_: sure, that's jsut a search path with a ".jar:" in the filename :-)
15:21dnolen_bbloom: not really excited about that
15:21dnolen_bbloom: anyways this is a project
15:21technomancygfredericks: thanks
15:21bbloomdnolen_: sure. don't care about solving the general problem right now... want to solve my particular issue
15:22dnolen_bbloom: if you just want to solve your problem ... layout wtf into classpath conventions
15:22bbloomdnolen_: but i also need to serve the file so the browser can get it outside of advanced builds
15:22stuartsierraspei: Not sure, but `reducers/take` uses an Atom to keep track of how many values have been consumed, which may slow down the overall process.
15:22bbloomi have a /public/js directory, i guess ineed to add that to the class path?
15:22dnolen_bbloom: however that won't work if the lib does the multiple provide thing which is sadly allowed by Closure
15:22bbloomdnolen_: it provides many things, bbut they are all within 'WTF'
15:23dnolen_bbloom: why wouldn't you just have it be a part of your build?
15:23dnolen_it's a 3rd party lib
15:23speiamalloy: I have tried looking at the source. I'm not that great with clojure but as far as I can tell, reducers/take returns a reducible which should allow r/fold to work in parallel
15:23dnolen_pack into a JAR where the files respect classpath conventions
15:23dnolen_done
15:23bbloomdnolen_: what does "part of your build" mean?
15:23dnolen_bbloom: produce a JAR of the lib
15:23bbloomdnolen_: i can't get it to work without that added complexity... one step at a time
15:23bbloomthe compiler can find it if i put it in /resources/WTF.js
15:23speithough this example is simple, once I use r/take, r/fold only uses 1 thread
15:24dnolen_bbloom: anything else is going to be more complicated
15:24bbloombut the browser can't b/c i'm serving static js from /public/js/
15:24dnolen_bbloom: I'm telling you the simplest thing
15:24dnolen_make it a part of your build
15:24bbloomdnolen_: how will that file get served to the browser then?
15:24amalloyspei: reducibles and foldables are separate things, and fold is a stronger requirement
15:25dnolen_bbloom: like all your other CLJS files
15:25bbloomdnolen_: i'm serving them w/ a wrap-file handler from target/public
15:25amalloyin particular, most foldables must know exactly how large they are in order to divide and conquer efficiently. how can (take 5000 xs) be split up? how many items does it have?
15:25bbloomdnolen_: i don't want to serve all java resourdces
15:25speioh. perhaps that is where I misunderstood on reducers work.
15:26dnolen_bbloom: if the 3rd party lib is a part of your build everything magically works
15:26gfrederickstechnomancy: here's the other half of our issue: https://github.com/groupon/DotCi/issues/14
15:26stuartsierraamalloy: (Thanks for taking on that answer.)
15:26dnolen_there is not difference between JS libs and CLJS libs
15:26bbloomdnolen_: i don't understand what it means to be "part of my build"
15:26dnolen_bbloom: if you include core.async as a dep, it's a part of your build
15:26speiwell, I assumed that (take 5000 xs) would return a reducible of 5000 items
15:26amalloybut it doesn't! what if xs only has 10 elements?
15:26dnolen_bbloom: core.async is a JAR that includes CLJS sources that respect classpath conventions
15:26dnolen_bbloom: just do the same for this closure lib
15:27bbloomdnolen_: where do i put .js files in such a case?
15:27bbloomin the src dir?
15:27speii see. thanks
15:27dnolen_except it's just JS source that respect classpath conventions
15:27dnolen_bbloom: oh yeah you can do that too
15:27amalloyand anyway, even if it did have over 5000 elements, it's not really feasible to communicate back to the foldable source which parts of itself to fold
15:27dnolen_bbloom: just put the wtf source in your project in the write folders
15:27dnolen_s/write/right
15:27amalloyyou're welcome, stuartsierra. i'm a little fuzzier on this stuff than i was when i was submitting reducer patches, but i still remember enough to be useful
15:28stuartsierraamalloy: Not as fuzzy as I am, clearly. The distinction between foldable and reducible is one I missed.
15:29bbloomdnolen_: that doesn't seem to work. it's searching for src/WTF.js which doesn't make any sense
15:29bbloomdnolen_: js files seem to be treated very differently than cljs files
15:29technomancygfredericks: have you tried checking bin/lein into your project?
15:30gfredericksum
15:30gfrederickshm
15:30dnolen_bbloom: it should work, I've tested it a bit with my own stuff
15:30dnolen_bbloom: I do note that wtf.js declares a single segment namespace
15:30gfrederickstechnomancy: that would require the CI server have something in the project on its PATH, no? which would be weird?
15:30bbloomdnolen_: is that an issue?
15:30dnolen_which has seen very little love in the CLJS compiler
15:30dnolen_bbloom: unknown, I never do it
15:30bbloomugh.
15:30dnolen_and most other people don't either
15:31bbloomwell WTF.js is by a team at google... sooo
15:31gfrederickstechnomancy: unless you think it's likely it has <project>/bin on the path
15:31technomancygfredericks: not assuming you control the command to initiate the ci run
15:32gfredericksoh hey
15:32dnolen_bbloom: I don't have time to poke around at it today, but I can take a look on Friday
15:32hyPiRiongfredericks: hey I did some tricks to get hello swearjure working
15:32gfrederickstechnomancy: actually I think this is failing before it ever gets to my code; the CI server runs `lein pprint` for funsies
15:32gfrederickshyPiRion: legit tricks or cheating tricks?
15:32bbloomdnolen_: i'm going to try to get it working locally, but i would prefer to produce a cljs-wtf library that i can just add as a :dependency and :require
15:32hyPiRiongfredericks: legit -- https://github.com/hyPiRion/hello-swearjure/blob/master/.travis.yml
15:33hyPiRionI'm just dling lein, build and run it from a specific checkout
15:33gfredericksoh I thought you were talking about bootstrapping swearjure or something
15:33dnolen_bbloom: sure, one fix at time though, and there are several here
15:33gfredericksyeah I do control the part that runs my build, but like I said this fails pre-build on `lein pprint`
15:33hyPiRionhrm, alright
15:34hyPiRionI just entered in the middle of the conversation
15:36technomancygfredericks: checking in rebar is pretty common in the erlang world
15:36technomancyI can't see any downsides to doing the same for lein
15:37technomancybut I haven't tried it
15:37technomancyexcept for lein, which obviously has bin/lein checked in =)
15:39stuartsierraI used to check in bin/lein around the time of the 1.x => 2.x transition.
15:39stuartsierraSpecifically for CI builds, as I recall.
15:40technomancystuartsierra: any gotchas?
15:41stuartsierratechnomancy: Worked fine, as far as I remember.
15:41stuartsierraI still do the same thing when I'm distributing materials for training courses. Only downside is the difficulty of running Lein without fast/reliable Internet access, e.g. at a hotel.
15:42bbloomdnolen_: what causes entries to be added to deps.js ?
15:42dnolen_bbloom: it needs to be constructed beforehand
15:43dnolen_bbloom: google closure and third party jars ship with it
15:43gfredericksstuartsierra: you mean just the first time?
15:44stuartsierragfredericks: Even after. I've had problems even if I specify a :local-repo and pre-cache everything.
15:44gfrederickshmmm
15:45stuartsierraEspecially with artifacts that aren't in a public repo, like Datomic Pro.
15:45gfredericksare there tests in leiningen that actually launch another jvm?
15:45stuartsierraEven if they're cached, Leiningen tries to download them again.
15:46technomancygfredericks: tons
15:47gfredericksI must find myself one of these tests and paste its code
15:47gfrederickswait I meant launch another leiningen jvm
15:47gfredericksi.e., run the script
15:47gfredericksI'm worried that the only way to test this is by actually adding things to the classpath
15:47gfrederickswhich is rather side-effecty=
15:49technomancygfredericks: no tests for bin/lein iirc unfortunately
15:50gfrederickstechnomancy: is this testable otherwise? the bug is in load-plugins, which...probably loads plugins.
15:50gfredericksI guess I can with-redefs something somewhere probably
15:52sdegutisMy website is 54 MB big :)
15:52sdegutisPerhaps this is not ridiculous. Although it does at first glance appear so.
15:52bbloomdnolen_: this is the issue: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L711
15:52bbloomdnolen_: that's getting a relative path between an input file and an output file
15:53mercwithamouthwhat do you all think of fireplace compared to cider?
15:54angusiguessI'm using fireplace + dispatch and am diggin' it.
15:54bbloomdnolen_: in my case, that's adding a whole bunch of extra ../../ to the path
15:54angusiguessStill not using it the same way I'd use a repl but it works pretty well.
15:58mercwithamouthangusiguess: hmm i may give it a look see. i'm fairly comfortable with emacs/cider as well but i've used vim for years. i am at a point where i'm very productive in emacs though
15:59mordocaiHey, is there an easy way to get the source of an anonymous function for debugging/output purposes? Like, (def x [#(+ %1 %2)]) then (print-source (first x)) and get "(fn [x y] (+ %1 %2))" essentially? I know the repl function source exists, but it only seems to work on named functions that originate from a .clj.
15:59amalloymordocai: no
16:00amalloyfunctions don't have source code attached
16:00mordocaiamalloy: That's what I thought, but wanted to double check. Thanks!
16:03bbloomdnolen_: i just monkey-patched cljs using with-redefs to rewrite the path to be correct & unblock me. if you're up for it, i'll help come by and help you fix this up on friday. thanks for the help
16:10bacon1989hello guys, I really want to get clojure working within an existing android project. The plan is to query a server for updates, and download scripts. These scripts would then be loaded into the clojure runtime. I started by building a dalvik version of the clojure runtime from here https://github.com/clojure-android/clojure, and tried a few methods to try and load a file from external storage, which can be seen here:
16:10bacon1989http://pastebin.com/xLVV0p7v
16:11bacon1989the file 'main.clj' includes nothing else but this: (defn foo [a] (str "Hello " a "!"))
16:11bacon1989I feel like i've exhausted my efforts, and i'm doing something clearly wrong
16:13bacon1989The error i'm getting is when I call load-string on the slurped file, it gives me a java.lang.NullPointerException, compiling:(null:1:1)
16:15sverihi, Lets say I want to construct a map and the map should contain a certain key / value pair only if the value is not nil, what is the idiomatic way to do this? this is what comes to my mind: http://pastebin.com/n3gEvLE9
16:16amalloysveri: (merge m (when v {k v}))
16:16dnolen_bbloom: sure!
16:19johnwalkerwhen does send-off occur within a swap! ?
16:19johnwalkeris it after swap! finishes like in dosync?
16:19sveriamalloy: thats shorter and looks nice, thank you
16:19stuartsierrajohnwalker: Whenever you call it. Atoms don't coordinate with Agents like Refs do.
16:20johnwalkerdarn
16:20stuartsierrasveri: (if v (assoc m k v) m)
16:20gfredericksjohnwalker: and the swap function can be retried too, so it really shouldn't have any side effects, including send-off
16:21johnwalkergfredericks: yeah, that was exactly my concern
16:21johnwalkerwell, found a use for refs. thanks gfredericks, stuartsierra
16:22gfredericksjohnwalker: do you know about watcher fns?
16:23johnwalkeri do. they're executed after a successful swap, right?
16:24johnwalkerit would make sense here, but it feels weird using them
16:24johnwalkeryou see old state and new state, but not the difference between them
16:25johnwalkeri realize you can encode part of the difference within the state, but it doesn't feel right
16:26rurumatehow to refer to the ns declared above my code? *ns* seems to refer to clojure.core at runtime
16:26fifosineI'm having trouble following the Om tutorial that swannodette wrote. Does anyone know of any other good Om tuts out there?
16:27gfrederickstechnomancy: any estimates when 2.4.1 appeareth?
16:30johnwalkerfifosine: this doesn't have a tutorial, but if you raise an issue here then emallson will probably point you to the slides
16:30johnwalkerhttps://github.com/emallson/comment-example
16:31angusiguessmercwithamouth: let me know how it goes!
16:37johnwalkeroh i know
16:37johnwalkerahh shit nevermind, that's a stupid idea
16:43ShayanjmDoes anyone else here using light table IDE?
16:58technomancygfredericks: 1-3 days I think
16:59tvanhenshow do you include resources in an uberjar?
16:59johnwalkerhow can you find out the arguments passed to an agent that caused it to fail?
17:00gfrederickstechnomancy: roger, thanks
17:08devntechnomancy: https://github.com/ato/clojars-web/pull/214
17:08devnPR out! :)
17:09tvanhensDo resource relative paths change in an uberjar?
17:10akhudekdevn: that looks nice
17:11Bronsa(inc devn)
17:11lazybot⇒ 18
17:12kzarIs there a simple way to tell if a file is binary / ascii in Clojure?
17:13devnakhudek: thanks dude. we think so too. the comps are a bit better, so there are more tweaks coming, but this is a good start.
17:15dbaschkzar: the naive way would be to see if all the bytes are 127 or less, but there are java tools to guess file types without looking at all the content
17:16kzardbasch: Oh I just tried slurping a binary file and it worked OK
17:17kzar:) Clojure is nice
17:19hiredmanuh
17:21gfredericksfor binary files you probably want to deal with bytes (like a byte array) instead of characters (like a string); slurp only does the latter
17:22kzarFor my purposes it's fine, I'm just looking for ascii files starting with a specific string to process in a special way
17:22kzarI thought I'd have to rule out binary files myself but as they're passed as a string .startsWith works fine
17:25tvanhensdoes slurp use the classpath when resolving file locations?
17:30cbptvanhens: no
17:30tvanhensWhats the best way of reliably refering to a file so it doesn't change in or out of an uberjar
17:30tvanhensI seem to be able to only get it to work one way or another
17:31kzartvanhens: I think clojure.java.io/resource
17:31hiredmanclojure.java.io/resource
17:31cbpput it inside resources and use io/resource
17:32tvanhensgotcha its inside resources but I wasn't using io/resource lemme give that a go
17:32tvanhensthank you
17:37kzarTrying to get a list of all the files in a directory and sub-directories thereof. I'm getting an error about there not being a matching File ctor. (file-seq (java.io.File. (clojure.java.io/resource "public/")))
17:39johnwalkertry
17:39johnwalker(clojure.java.io/file "public")
17:39hiredmankzar: resource does not return something you are allowed to make a file out of
17:39johnwalker(-> "public/" clojure.java.io/file file-seq)
17:40hiredmanresource reads things via a classloader, which basically presents a simple key/value read only api
17:40hiredmannot like files at all, no way to do any kind of listing
17:40johnwalkerand public should be in the same directory as your src directory
17:40johnwalkeri'm pretty sure file-seq is just (seq (.listFiles file))
17:41johnwalkerbut i haven't looked at the source
17:41hiredmanno
17:41hiredman,(doc file-seq)
17:41clojurebot"([dir]); A tree seq on java.io.Files"
17:41hiredmanit is recursive
17:41johnwalkerahh gotcha
17:42kzarSo public contains my html etc for my website, I'm porting my site from static site generator jekyll. I've put public in resources/public. Don't mind not using clojure.java.io/resource but was trying to do things in an idiomatic way I guess
17:42johnwalkertry "resources/public/" as your directory, then
17:42hiredmankzar: something that is a resource is read via a classloader, that means that content could be basically anywhere, not just files on disk
17:43kzarIn my shoes would you put that stuff in resources/public?
17:43hiredmankzar: definitely
17:44kzarphew ok
17:44hiredmankzar: but I know how resources work, and would not try to make one a file, or listing it like a directory
17:45kzarWell does it really matter if I just do as johnwalker suggested? I don't think my site will ever be an uberjar
17:45hiredmanresouces are a thing, you give it a name, you get inputstream over the bytes from that name or nil
17:45hiredmanI dunno, why are you listing the contents of public anyway?
17:46johnwalkeri'm not sure i would put the stuff in resources/public
17:46kzarhiredman: So with Jekyll any file that starts with "---\n" some YAML and then "\n---\n" is formatted based on the YAML
17:46kzarso that YAML sets the template being used, the file format like markdown etc
17:47kzarif there isn't that YAML "front matter" at the start the file is copied straight over into the output directory
17:47kzarif there is the file is processed and the output written to the output directory
17:47kzarSo I am attempting to map over all the files, if .startsWith "---" then process, otherwise copy etc
17:48hiredmanI think you are confusing things
17:48johnwalkerwouldn't it make more sense to pass this directory as an argument to your program?
17:48hiredmanyou have a program to do static site generation, and some data that it operates on, but those are distinct things
17:49hiredmanso when you run the program, you give it arguments like --in somedir and --out someotherdir
17:50hiredmanso that data is definitely not part of the program and even if you did uberjar the program, it doesn't go in the jar
17:50bbloomheh, i suspected this *might* be the case, but it seems like cljs' immutable maps are dramatically faster than objects for use as dictionaries for even a few dozen keys
17:51kzarso long story short you'd put public outside of the resources directory
17:51kzar?
17:51kzar(What you said made sense)
17:51hiredmansure
17:52wolfcorekzar: wouldn't it be easier to use grep + pipes to move the non-YAML files and then work on the rest?
17:53kzarhiredman: Would you put your config files in the resources directory? (setting stuff like api keys)
18:06amalloykzar: i don't think you can safely slurp a binary file. if it contains byte sequences that are not legal utf-8, i think you get an exception
18:06kzarcrap OK
18:08wolfcorekzar: not sure if I understand what you are trying to do, but
18:08wolfcorekzar: find . -type f -exec awk 'FNR==1 && /^---$/ {print FILENAME}; FNR>1 {nextfile}' {} + | xargs -I{} mv {} dest
18:09wolfcorekzar: that would move all files that have the first line with "---\n" to dest/
18:09amalloywell, maybe not? i expected ##(String. (byte-array (map unchecked-byte [0xc3 0x28])) "UTF-8") to break, but it doesn't look like it just puts in a replacement character
18:09lazybot⇒ "�("
18:11johnwalkeryeah thats right
18:11johnwalkerexpect to be confused as hell when you call slurp on a file with a bom
18:18deathknightno tests for bin/laden
18:24johnwalkerif you do (locking <atom here> )
18:24johnwalkerdo swap!s and reset!s have to wait?
18:24johnwalkeron that atom's lock to finish?
18:28xaloysiushi
18:28johnwalkerdo swap!s and reset!s outside locking have to wait? *
18:28bbloomjohnwalker: don't lock an atom
18:29bbloomjohnwalker: in fact, you should never use locking at all, if you can help it
18:29amalloyjohnwalker: you seem to be doing a lot of complicated concurrency stuff. perhaps if you posted a more general question ("how do i do X, it seems like using a future and atom and agent can't be right"), you could get an answer that doesn't need this crazy stuff
18:29bbloomjohnwalker: and by "if you can help it" i mean "you almost certainly really do not need to use locking ever"
18:30xaloysiusfirst time on IRC not sure this is where a question like this is appropriate but basically I am putting together a REST API that will be doing basic CRUD operations. i want to use a nested JSON format so that OOP clients can easily use de/serialization with my API. Is there a good library to transform flat relational data (a map) into nested json if I provide it with mappings?
18:30johnwalkerdarn, seemed like an easy solution
18:30johnwalkerthis problem isn't too hard, but i'm still having trouble with it
18:31justin_smithjohnwalker: using atoms correctly as intended is easier than using locking correctly
18:31cbpjohnwalker: what are you trying to do?
18:31johnwalkeri'm trying to track the state of concurrent file uploads
18:32johnwalkerso the way i've modeled this problem is that at any point you have a set of files that are being sent to some server
18:32johnwalkerso what i wanted to do was store a hashmap from files to futures within an atom
18:33justin_smithso you use swap! to insert a new entry when an upload starts, and check the future to see if the upload is done?
18:33johnwalkerchecking whether a file has finished uploading or is still in the works would just be (realized? (@file-map file))
18:33johnwalkerthats right
18:33justin_smithright
18:34justin_smithif that's all you need, that's easy with an atom
18:34dbaschxaloysius: check out cheshire
18:34johnwalkerwell, the problem is - how do you handle timeouts?
18:34justin_smithjohnwalker: well, if you do a retry, cancel the old future, and swap! in a new one
18:35justin_smithjohnwalker: for a simple cancel, cancel the future, and (swap! files dissoc file)
18:35justin_smithif the future is where the timeout happens, even easier, no need to do the canceling logic elsewhere
18:36amalloyjustin_smith: "cancel the future and swap in a new one" is not easy to do thread safely, by the way
18:36justin_smithoh, ok
18:37justin_smithamalloy: is it not a question of waiting for future-cancel to return? where is the trick?
18:37amalloyi mean, it's not impossible, and with a ref instead it's fairly easy (your dosync dissocs the future, then returns it); but with an atom, how do you cancel the future and remove it, all in one operation, given that it may be retried?
18:38johnwalkerwith an atom, i think it's still possible so long as you do future-cancel outside of the swap
18:38amalloyyou don't want to cancel the same future many times, or cancel a future that some other thread just put in there, if they beat you to the punch of retrying
18:38johnwalkerbut it's fragile
18:38johnwalkerpossible for me*
18:39johnwalkermileage may vary ._.
18:39xaloysiusdbasch: would i use the factory functionality in cheshire?
18:39johnwalkerso this is actually a good place to use refs?
18:40johnwalkeri've stayed away since stuart halloway implied that you have a bad design if you're using them
18:40amalloymost of the time that i actually use refs, it's for this reason: i'd like to swap! an atom, but return something other than its new value
18:41amalloyyou can fake that up with an atom, but refs are more convenient for it. i'm not actually using any of the nice STM features
18:41dbaschxaloysius: you’d probably use generate-string, do you have an example of what your nested map looks like?
18:42johnwalkercalls inside dosync need to be pure too
18:42johnwalkercan future-cancel really fit somewhere here?
18:43amalloyjohnwalker: the layout i was suggesting was (future-cancel (dosync (let [f (get @m k)] (alter m dissoc k) f)))
18:43dbaschamalloy: do you know anyone who’s actually using STM for all its power and glory? I’m curious because I don’t know any projects that do
18:44amalloyi've never heard of a compelling use
18:44johnwalkerwow, that's pretty slick
18:45dbaschit would be useful in scenarios like financial order settlement in high volume exchanges, but I doubt anyone is doing that in Clojure
18:45johnwalkeri don't see any problems
18:45johnwalkerthanks amalloy, justin_smith
18:45justin_smithand thanks amalloy
18:45justin_smith(inc amalloy)
18:45lazybot⇒ 121
18:46johnwalker(inc amalloy)
18:46lazybot⇒ 122
18:46johnwalker(inc justin_smith)
18:46lazybot⇒ 46
18:46dbaschif I were to build a bitcoin exchange in Clojure, I’d consider using STM
18:46amalloyit's raining karma!
18:46amalloydbasch: i dunno, anything large-scale enough to benefit from STM can usually benefit more from a transactional database anyway
18:47justin_smithdbasch: use something less reliable, like php, then you can steal btc and blame it on hackers or gremlins
18:47xaloysiusdbasch: {"subscription_canceled":0,"primary_email":"test1@test.com","payment_cycle_end":1431550550,"payment_cycle_start":1399668950,"id":1111,"country":{"name":"United States","id":1,"code":"US","currency":1},"card":{"exp_year":2222,"exp_month":12,"type":"Visa","last_four":"1111"},"plan":{"name":"xxxxx","renewable":0,"price":0.00,"id":1}}
18:47amalloygremlins are well known hackers
18:47johnwalkerlol
18:47dbaschamalloy: yes, but in the case of bitcoin sometimes you don’t need a db because the blockchain is the ultimate db
18:47dbaschthat’s for external transactions
18:48dbaschbut in that case you probably wouldn’t need stm either
18:48dbaschperhaps in something close to HFT for bitcoin?
18:48xaloysiusdbasch: thats a basic case - it could get arbitratily deep
18:50johnwalkerwell, this makes me sad
18:51johnwalkerrefs make it easy to cancel these things, but you can't start them haha
18:52johnwalkeryou would have to start your future before the dosync, but you don't know for sure if you really need to trigger an upload beforehand
18:52xaloysiusdbasch: thats just a mock - i may rearrange the levels/data types later. preferably a solution would be easily changeable. i hacked together a solution but it reminded me too much of a janky ORM so i ditched it and am looking for something cleaner
18:52johnwalkerbecause the server might already have the file ._.
18:52dbaschxaloysius: use parse-string on that (properly escaped as a string) and you’ll get a nice map
18:53xaloysiusdbasch: im fine with converting to-from clojure data and json. what i'm having issues with is the impendance mismatch which is usually solved by an ORM
18:53johnwalkerthis hurts my brain.
18:53johnwalkercan i use locking with refs? haha
18:54xaloysiusit would be nice if there was a way to bolt an ORM-like solution that consumed edn or something onto the side of this thing.
18:54dbaschxaloysius: but why do you care about an ORM? are you going to interact with another system that needs to parse the data into objects of a class?
18:54xaloysiusyeah legacy java applications
18:54xaloysiusotherwise id go straight edn
18:54dbaschxaloysius: in clojure we usually don’t bother much with ORM
18:55justin_smithdbasch: xaloysius: well you can use java orm from clojure
18:55cbpthat sounds mad fun
18:55xaloysiusjustin_smith: was trying to avoid the overhead of a full ORM if possible
18:55justin_smithxaloysius: yeah, edn can be simple if you don't need java compate (as described above)
18:56justin_smithand from a java compate perspective, you could always implement some magic java interface for grabbing the data using clojure classes and make java happy that way
18:56justin_smiththat may be easier than using the java built stuff
18:57johnwalkerbbloom: is locking OK for refs?
18:57johnwalkeri just need to ensure that the ref in question's value hasn't changed while i do something messy
18:58dbaschjustin_smith: yeah, that seems like the best compromise
18:58johnwalker(locking <ref> (something_messy) (dosync <something-pure-involving-ref>))
18:58justin_smithjohnwalker: what if you had a dedicated thread for dispatching the upload jobs, so that part of the job could be strictly single threaded
18:58xaloysiusjustin_smith: yeah thats what I was thinking. it would be nice if I could just have a simple way to go from relational -> object-ish structure but i guess thats why they say the impedance mismatch is a PITA
18:59justin_smithif you are only starting tasks from that one thread, you don't need a lock
18:59justin_smithand starting the tasks should not be a bottleneck on throughput at all, given the filesystem is involved here
18:59justin_smith(plus network, of course)
18:59johnwalkerjustin_smith: i was thinking about something like (async/thread (<!! ) (future ..))
19:00justin_smiththis is the kind of thing core.async is for
19:00justin_smithjynx
19:00johnwalkerbut this doesn't really solve the problem because the issue is starting tasks and cancelling them
19:00justin_smithor just a SynchronizedQueue
19:00xaloysiusperhaps clojure is the wrong tool to use here... thanks anyway
19:00justin_smithxaloysius: well, caribou has a map relational modeler for a subset of edn
19:01johnwalkerwell, i know i'll shoot my eye out if i do blocking io with core async
19:01justin_smithxaloysius: it won't make java happy though
19:01johnwalker*with the go blocks of core async
19:01justin_smithjohnwalker: you would dispatch jobs from that one thread
19:01justin_smithnot do any of the work in it
19:02justin_smiththe idea is if that thread is the only one starting / stopping, and has an ordered queue of stop / start events, then you have no threading issues around those aspects
19:03johnwalkeri think you're right
19:03johnwalkersomething like (>!! manager "hi, shut down/start thread for file x if it exists)
19:03justin_smithright
19:04justin_smithand make sure no actual work is done there, just dispatch
19:04justin_smiththen it can't bottleneck, can't deadlock, and can't go out of sync
19:05johnwalkeryep, this is the way to go
19:05johnwalkeram i allowed to inc you again?
19:05johnwalkerlol
19:05amalloy~guards
19:05clojurebotSEIZE HIM!
19:06johnwalkerspeaking of guards, what happened to cedric greevey
19:06justin_smithjohnwalker: glad I could help, I've just recently read Java Concurrency in Practice so all this stuff is fresh on my mind
19:06johnwalkeri've asked this so many times. did he just get bored and start trolling some other group?
19:07johnwalkeri'm going to order my copy
19:08johnwalkeris that goetz's book?
19:08johnwalkeroh it is
19:09justin_smithyeah, it is really good
19:14tvanhenswhats the difference between the standalone and the snapshot jar created by lein uberjar?
19:15technomancytvanhens: snapshot is part of the version
19:15technomancystandalone just means uberjar
19:16tvanhenswhat do you mean by part of the version. What is the function of the snapshot jar?
19:17technomancyit's a jar of the snapshot version
19:18aperiodictvanhens: the snapshot jar just has your project's code and resources. it needs to be created first before the uberjar can be created. the standalone one is the uberjar with all the dependencies
19:18tvanhenscool that makes sense. Thanks :)
19:33johnwalkerfor what it's worth, i wound up using core async and refs
19:33johnwalkerlol
19:34justin_smithcool
19:51andyf_Bronsa: ping?
19:52Bronsaandyf_: hi
19:53andyf_I continue with my insolent nature of asking questions after being confused & wrong too often ... :-)
19:54andyf_About your suggested Eastwood simplification by using :raw-forms, is there an easy way to have the fully qualified vars in the pre-macro expanded version of the expr?
19:54Bronsaheh, no worries, ask away
19:54Bronsauh
19:55andyf_I'd like to know not only that it was defmulti, say, but that it was clojure.core/defmulti
19:55Bronsaright
19:57Bronsaandyf_: uhm I guess I could do it on the tools.analyzer side but that doesn't feel right to me
19:58Bronsaif you give me a minute I'll give you a way to do it in analyze-ns
19:59andyf_If I get back the full env from the analyzer, and I am only wanting to fully qualify the first symbol, not some nested one, would that be straightforward to resolve in the env?
19:59caternOh god no the latest clojure-mode update is so uncolorful
19:59Bronsaandyf_: yeah that's what I'm thinking of
19:59caternPlease help me #clojure
20:00caternIt's so dull
20:00andyf_catern: Can't roll back? Find the color settings & tweak them to your liking?
20:03caternI don't want to roll back but I think I must
20:03amalloyi don't like updating emacs packages. if it was good enough for 2010 it's good enough for me
20:04Bronsaandyf_: http://sprunge.us/KRYC?clj something like that should work I think
20:06andyf_Grazie. Will try that out
20:06Bronsauhm wait you really don't need to back up the env
20:07Bronsaandyf_: unfortunately since clojure namespaces are global mutable state, if you have (ns foo) (defmacro defmacro ..) that would resolve the defmacro as foo/defmacro rather than c.c/defmacro
20:08Bronsaandyf_: but that's some perverse and horrible code anyway so I don't think we should really care
20:09Bronsaandyf_: http://sprunge.us/hUfZ this is a bit better
20:09andyf_But saving a copy of the env just before each (analyze form) is the way that would even handle the perverse case?
20:10Bronsathat's why I put it there in the first snippet
20:10Bronsabut then I remembered about ana.jvm/update-ns-map!
20:10Bronsaoh well wait nevermind.
20:11Bronsaandyf_: it's too late and I'm thinking rubbish. the first example is ok and should work fine
20:12andyf_I'll give it a go, and try it out on the perverse example to see what happens. Thx
20:14Bronsaandyf_: ok, but if it doesn't work for that, I wouldn't spend time on trying to fix it. even trying to AOT that code with che clojure compiler fails so why should we bother
20:14Bronsaandyf_: not the lack of (:refer-clojure :exclude [defmacro]) on the ns decl
20:14Bronsanote*
20:15andyf_Ok
20:19andyf_The completely unexpected Clojure slogan: We can mutate _anything_.
20:19andyf_(But usually have the good taste and sensibility not to.)
21:06devnxeqi: hola sir
21:15xeqidevn: hola
21:19devnxeqi: how goes?
21:20devnxeqi: i dropped a reply on that PR. we can discuss on a google hangout or something if you'd like. my goal is to get this first PR pushed through so we can make future PRs related to this effort a bit lighter and more modular.
21:21devnxeqi: but im a reasonable chap, so let's chat if that sounds unreasonable. :)
21:26xeqidevn: I get that. Personally I'm big on having master be in a deployable state, in case of emergency like XSS vuln found.
21:27xeqiI'd love to have this on a branch that you could PR to and then just do a ff merge onto master
21:27devnxeqi: Agree, but IMO the pages in question are basically what they are in prod right now
21:27devnDashboard is basically the same. a couple of ul's for projects and groups
21:27devny'know?
21:28xeqitrue
21:28xeqiI'd push for "add new project" to be visually different so it doesn't look like its in the list of projects, but I don't know thats worth continuing to block over
21:28xeqiesp since bendyworks sounds committed
21:29devnxeqi: that's an easy fix. I can hit that right now.
21:30xeqithen I'm happy to +1 with the future changes planned
21:30xeqidevn: what made you guys decide to redesign clojars?
21:31xeqi*you people
21:31devnxeqi: it's been something i've wanted to do for a long time but never got around to it. we also have hired design folks at bendyworks, but we haven't had a lot of recent opportunities to work /together/ on something
21:31devnwe also have a bunch of people hot on clojure, are pretty community-focused as a company, etc.
21:36xeqidevn: I've had a list of UI items I think would provide a better user experience for awhile. Is there someplace I should braindump that at?
21:37devnxeqi: yeah dude, we should start a google doc or maybe an issue for it that we can create issues off of? your call.
21:38xeqilike hiding SSH key on signup/profile behind some advanced section. (ssh keys aren't required unless you ssh deploy, which should rarely happen for new people since `lein deploy clojars` works)
21:38devnah yeah i think i saw an issue related to that
21:38devn"re-authenticate for key changes" or something along those lines
21:38devnseems like that's ripe for it's own section
21:38devnwhere we could protect it with a re-auth
21:40xeqik, I'll think about making a google doc for now. None of them need to be gospel or anything so not worried about a formal issue
21:40xeqidevn: thanks for doing this
21:41xeqiits been #3 on my list of things to fix about clojars if I ever get a large amount of time for it
21:41xeqi(the UI refresh)
21:41devnxeqi: im happy to just have a more polished clojars. i think it makes people feel like it's a bit more credible, and AFAIK practically everyone in the damn community uses it, so we should make it look nice
21:43devnxeqi: there's a longer-term thing here which i think we might be able to tackle /at some point/, but right now i sort of need to play the middle between a designer and the style. enlive for testing and hiccup for templating make this kind of a pain for a lot of designers to work on it
21:43mdedetrichim just getting started with light table, does anyone know what the key is for selecting an expression
21:44devnxeqi: in some ways i think xpath + plain html templates might be a better way to go in order to encourage more people to hack
21:45devnin the meantime im happy to play the middle, but in the long term it might get more people involved if they didn't need to learn about enlive selector state machines to fix a broken test :)
21:46xeqidevn: have an example project w/ xpath + html?
21:47devnxeqi: somewhere around here. i mean, enlive could do straight HTML as well. i think for testing the enlive stuff can stop some people pretty cold in their tracks, and by people i mean designers
21:47devnlaser does it, etc.
21:47devnso the main thing is i guess xpath or css for the integration test side of things
21:48xeqidevn: ah, yeah
21:48devnclj-taxi (is that the right project?) does what i think more people would be familiar with on the integration side
21:48xeqiI think there was some discussion on a kerodon issue about having other ways to select things, but requires some redesign work
21:48devnmakes it a bit easier to step through finding an element, etc.
21:49xeqiclj-webdriver's taxi api
21:49devnbecause i even had some issues setting up my REPL to test certain things
21:49devnmainly due to fixtures
21:50devni think the setup docs have gotten worlds better. i remember not being able to figure out how to run the project years ago
21:50devnbut there are a couple of pieces missing which i haven't completely figured out
21:50devnlike, in the repl, the proper way to be able to run scp.clj tests while in the REPL
21:50xeqiheh, I think it got better, and then worse again when I did the search/download counts
21:51devnah, i didn't know if that was you! here's a big question that i'd love your input on...
21:51devnxeqi: let's just say, pie in the sky, we wanted to make clojuresphere + clojars
21:52devnare the query times right now prohibitive for some things in the existing DB?
21:53xeqiI will admit to not tracking performance, everything seems fast enough
21:53devnim imagining github api integration to try and find the "top 10 projects hosted on github this week"
21:54devnso you could query for most watched, intersected with the most watchers, or something
21:54devnerr most downloads*
21:54stasiomodthat = cool idea
21:54xeqi(#1 of the things to fix was finding a revenue stream to be able to handle a dev+ops person for monitoring, any crashes, time to work on things)
21:55xeqietc
21:55devnoh, well shit... i think we can figure out #1.
21:56xeqiso back to you're pie in the sky project...
21:56xeqi*your
21:56devnhaha
21:57devnwriting checks my ass can't cash
21:57devnbut yes, let's continue!
21:57xeqiI don't see anything there that would be problematic query wise
21:58xeqias far as time
21:58devni imagine clojuresphere as having most of what clojars.org should have. "who uses this dep? of those users, sort them by github relevance, etc"
21:58devnit introduces a metric ton of github API info
21:58devnbut with some caching, seems pretty doable
21:58xeqiwe actually want to remove the underlieing sqlite db and replace it with something else
21:59devndatomic :X
21:59devnsorry, i just can't help myself
21:59xeqibad license
21:59xeqithought it actually would be awesome
21:59devnwhat does the open source side of the datomic license look like?
21:59devni thought that was free and clear
22:00devnbut probably not: "MIT or BSD or GPL if you're an open source project"
22:00xeqidevn: you mean datomic-free that isn't open source?
22:00devn:X
22:01xeqiand I don't recall the other restrictions. only memory/h2 storage? limited to 3 connections? I think
22:01devnwell, we had to try. let the record show we want to use datomic but won't due to licensing restrictions
22:01devnpostgres. it works.
22:01xeqithat would be my vote
22:01devnwhat is doing search right now?
22:02devni think i saw clucy in there as a dep?
22:02xeqilucene
22:02xeqiyep
22:02_atolucene
22:02devnwhat do y'all think of elasticsearch?
22:02_atooverkill :)
22:02devnfair enough
22:02xeqiI have heard lots of good things about it, but know nothing
22:02_ato$ du -sh index
22:02_ato6.5M index
22:03devni used elastisch on getclojure.org
22:03devnwith a nice custom query parser/tokenizer/etc.
22:03devnif we ever want to do advanced search it seems like it might not be a terrible idea
22:03devnelastisch from the clojurewerkz folks is really nice. just sayin'
22:04devnbtw: hi _ato! :)
22:04xeqiin general we've limited adding new features to the clojars api (such as the ones in clojuresphere). I'm neither for or against bringing in more, but it would be low on my list of things to work on
22:04xeqi*clojars api -> clojars ui
22:04xeqia real api would be nice though
22:05_atohi :)
22:05devnxeqi: oh man, please put that in whatever google doc you're brain dumping into
22:05devndetails of what you'd expect much appreciated
22:05xeqihaha
22:05devnwe have some API aficionados who i think might get a kick out of it
22:06xeqimainly based off what I know people have requested and are screenscraping for
22:06devnyeah, one more damn good reason to have some google analytics
22:06devnit'd be nice to know when we're getting scraped so we can build an API for whatever they're after
22:07devnwith the exception of whatever baidu is doing ;)
22:08xeqi$latest compojure
22:08lazybot[compojure "1.1.8"] -- https://clojars.org/compojure
22:08xeqi^ screen scraping https://github.com/Raynes/lazybot/commit/ff013c4b177ec2e3fce43f8513b6503c8f1469f2
22:09arrdemit'd be nice if clojars explicitly listed the "latest" png rather than being some backdoor unlisted feature I see some cool people using and others not :P
22:09xeqiarrdem: true, but I have no idea where to put that
22:10xeqione of many UX enhancements to be done
22:10arrdemxeqi: even just having a link to it from the project page would be enough
22:10devnarrdem: what do you mean latest png?
22:11_atohttps://clojars.org/compojure/latest-version.svg
22:11arrdem^ that
22:11devnoh duh, i always forget about that
22:11arrdemright
22:11arrdemand it isn't mentioned anywhere on clojars.org that I've ever seen
22:11arrdemso I always forget to use it.
22:11devnwe will take care of that :)
22:11arrdem<3
22:11arrdemthanks guys, stay awesome
22:11devnthanks for mentioning that
22:11devnin fact, if you dont mind, make an issue and assign to me if one doesnt exist
22:12devn(on clojars-web)
22:12devnarrdem: ^
22:15devnxeqi: comment + fix for the "Add New Project" thing pushed
22:19_atoAdded latest-version.svg to the about page FAQ for now so there's at least some reference to it
22:19devn_ato: could it be added on the jar page?
22:19devn"Add this code to your GitHub markdown to XYZ..."
22:20_atodevn: sure
22:21_atoif you can think of a good way to fit it in, that'd be cool with me
22:21devnI'm going to pass it to our designers. Mic and Kelly will probably have some thoughts on how to go about adding it.
22:22devnbut I'll own the issue and make sure we find a home for it
22:23_atocool, thanks for you and the others hard work on this stuff :)
22:23devn_ato && xeqi: mic will get the typekit domain thing fixed within the next hour just FYI
22:24devn_ato: yeah dude, i think im probably at least as happy as you. i've wanted to get this done for maybe 2 years and the stars aligned
22:24devn*virtual high five*
22:24_ato:D
22:25devn_ato: now, you just owe me a clojure 1.6 version of your widefinder 2 solution
22:25devni always kind of find myself wondering what that same code looks like in 1.6
22:25xeqihaha
22:25devn:D
22:25_atohah, oh man
22:27devn_ato: tall order, eh?
22:27devnhow long did that take you originaly, anyway? that was in? 1.1? 1.2?
22:28_atoI'd completely forgotten about that
22:28_ato1.0 I think
22:28devni know you were casting to (int ...) all over the place
22:28devnand i think there was some unchecked math in there
22:29_atoyeah... can probably remove a whole bunch of the type hinting at the very least
22:29devni know it's ancient, but i remember being like: "wow, this doesn't look very much like clojure!"
22:29devnbut i suspect it's gotten better
22:30devnto the point where it might not look like a crazy aussie martian wrote it ;)
22:30devndefrecord, deftype weren't around then either
22:30xeqidevn: ! just saw the search page
22:33xeqihaha, it needs some help. just a plain list atm
22:34devnahhh shite.
22:34devnyeah, not cool. the /projects page styles should probably be applied here as well
22:35devni think i can fix this quick, but i need to figure out how to get this looking right locally
22:36xeqidevn: np, there are comments for grabing an index file and stats file now
22:36devni was trying to use the results of `lein test` in dev
22:36devnbut no dice
22:37xeqihappy to help since I messed this part of setup up and must not have documented it
22:37devnxeqi: so just to be clear, when you use the all.edn from clojars.org
22:37devnyou're running using `lein ring server`?
22:37devnand using the test data from the README instructions?
22:41xeqidevn: stepped away for a moment, let me got ahead and pull a clean copy locally
22:42devnxeqi: i think im missing something in the directions, because i still cannot get search results
22:42devnim going to blow away my data/ dir
22:43xeqidevn: did you have the index from ato/clojars-web#197 ?
22:43lazybotsearch lein-garden with lein-garden -- https://github.com/ato/clojars-web/issues/197 is closed
22:44xeqimonopolizing #clojure for the past hour
22:46devnxeqi: we're technically on topic :)
22:46devnxeqi: where do i drop this index?
22:47_atodata/index/
22:48arrdemlittle late to the party but an issue is now open.
22:50devnthanks arrdem
22:50xeqidevn: clone, db migrate, copy index, copy stats, lein ring server = search locally for me
22:50devnxeqi: perfect. i just caught up with you.
22:51devnxeqi: do you see those "/clojure-utils ..." items?
22:51devnwhere they seem to have no group?
22:52devnthe href is to "clojure-utils", not sure what's up with that
22:52xeqiyeah
22:53_atoah
22:53_atothat index is probably old
22:53_atobefore stuff got fixed
22:53xeqiI think that was ato/clojars-web#132
22:53lazybotparent poms aren't parsed for search results -- https://github.com/ato/clojars-web/issues/132 is closed
22:54devngotcha
22:54xeqi_ato: haha, just realized you cherrypicked that from me. I thought you had fixed it
22:56sneak_peekanyone have any experience with any of the following ORM-like libraries? Carte, Oyako, Caribou-api
22:56_atoyeah, it was kind of weird, it sent me a notification like you had closed the issue when it was really the cherry-picked commit doing it :)
22:56devnsneak_peek: a little teenie bit
22:56devnsneak_peek: whatcha thinkin' about?
22:57umpawhat do you use instead of counters in while loops ?
22:57sneak_peekdevn: trying to overcome the relational-object impedance mismatch :/
22:58sneak_peekdevn: I need to take flat data and change it into a nested JSON structure. I use sqlingvo to build my sql queries just want something that will map my flat data to nested data
22:59devnumpa: im guessing you want `loop` + `recur`
22:59sneak_peekdevn: could roll my own based on cristophe grand's suggestions here (https://groups.google.com/forum/#!topic/clojure/X6BVq_RRY1A) but thought I'd check on existing libraries first
22:59xeqiumpa: depends on the purpose of the counter. I'm more likely to use something like map-indexed
23:00devn,(loop [cnt 0] (if-not (= cnt 3) (recur (inc cnt)) (println "done")))
23:00clojurebotdone\n
23:00devn,(loop [cnt 0] (if-not (= cnt 3) (do (println cnt) (recur (inc cnt))) (println "done")))
23:00clojurebot0\n1\n2\ndone\n
23:01devnbut yeah, listen to xeqi. map-indexed
23:02devn,(for [[idx x] (map-indexed vector (repeat 10 "X")) :when (< 5 idx)] x)
23:02clojurebot("X" "X" "X" "X")
23:03devnbut that makes little sense...
23:03devn,(map second (take 4 (map-indexed vector (repeat 10 "X"))))
23:03clojurebot("X" "X" "X" "X")
23:03umpalet me try it
23:05devnxeqi: temporary fix pushed to style the results at least a little bit
23:05devnsearch results*
23:05devnumpa: if you post some example code that could be helpful
23:06xeqitechnomancy: ^ I can haz redeploy?
23:06sneak_peekdevn: any quick feedback on those libraries - even just which you like best
23:06technomancyxeqi: pulling the latest rev of the PR to the instance running on 8002?
23:07devnsneak_peek: honestly, none of the above :X
23:07sneak_peekdevn: any suggestions
23:07xeqitechnomancy: yes please
23:08technomancysure; on it
23:08devnsneak_peek: idk man, i would avoid trying to do what you normally do
23:08devnsneak_peek: check out honeysql
23:09devnsneak_peek: or datomic.
23:09devnhonestly. probably check out datomic.
23:10sneak_peekdevn: :) not sure i can sneak datomic into a polyglot shop quietly. ill hack away at this. thanks for the suggestions
23:10technomancyxeqi: redeployed
23:10devnxeqi: technomancy: _ato: I was just talking with designer folk and we're going to make our logo size smaller, but if you guys decide to deploy tonight NBD, we'll just hit it next
23:11technomancyone thing is that the 8002 deploy doesn't point to the full repo, so it can't parse URL etc from the pom
23:11umpahttps://www.refheap.com/86465 here is the loop
23:11technomancymaybe that was being overly paranoid, but I didn't want it connected to live data
23:12ddellacostasneak_peek: I've used honeysql a lot, I like it because it's a very lightweight layer on top of clojure.java.jdbc, and you can always drop down into raw SQL if you need to.
23:13sneak_peekddellacosta: ill definitely give that a look - i checked out korma but felt like it tried to do too much at once
23:14devn,(doseq [group (partition 3 (range 10))] (println group))
23:14clojurebot(0 1 2)\n(3 4 5)\n(6 7 8)\n
23:14devn,umpa that code has the same result as yours
23:14clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: umpa in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:14devnwhoops
23:14ddellacostasneak_peek: I personally feel the same way about Korma; I think it's too heavy as a DSL and adds very little
23:14ddellacostasneak_peek: while introducing complexity and under-the-covers statefulness that can be hard to debug
23:14devnsneak_peek: im not a huge korma fan. honeysql has worked for me.
23:15umpahaha
23:15ddellacostasneak_peek: all in all I think that one should either simply embrace SQL in Clojure-land, or move to something like datomic where the challenges are shifted elsewhere
23:15devn(inc ddellacosta)
23:15lazybot⇒ 3
23:16xeqitechnomancy: thanks
23:17technomancyxeqi: should be easy to update; just `git fetch devn; git checkout devn/reskin; lein2 uberjar; cp target/... /tmp/reskin/...` and ctrl-c+up+ret in window 0
23:17devnI wrote a fairly query heavy toolkit about 4 months ago in clojure and just embraced SQL. As long as you protect yourself from trying to build your own ORM, you'll be fine. Queries can be namespaced and separated from your code. Once you just give in and give up on ORMs, you find that the world is a simpler place to live in.
23:17devnsneak_peek: ^
23:17xeqidevn: search and new project are good enough for me to +1. looking forward to seeing future changes
23:17ddellacostadevn: definitely
23:18devnxeqi: yeah, we won't be leaving those pages that way, but they're good enough for a day. you can expect a PR pretty much every day for the rest of the week
23:20sneak_peekdevn: ddellacosta: I want to definitely get there. my first inclination was to expose an edn API which would allow me to use a very thin wrapper to create my sql calls. I am currently using sqlingvo for sql generation. supporting legacy applications (Java) is the issue
23:21ddellacostasneak_peek: it's best simply to focus on your data rather than try to wrap it up; it becomes more natural as you get more comfortable with it. However, I don't have a great solution for supporting legacy apps--at least there hopefully Clojure lessens the pain through its interop features.
23:23devntechnomancy: xeqi: I just noticed something that I need to fix
23:23devnI don't believe non-canonical forks are now italicized. Can you confirm?
23:25devnor is this because the full pom map is not available?
23:26sneak_peekddellacosta: will probably spend the weekend experimenting with this. thanks!
23:27ddellacostasneak_peek: hope it goes well! I'll add one thing about HoneySQL vs. other DSLs (including sqlingvo, it seems) which I think puts it ahead: it produces an intermediary hash-map for which is manipulable, which can be very useful. But definitely depends on your use-case.
23:27ddellacosta*for SQL
23:28sneak_peekddellacosta: interesting. i took a quick look - does it not have update/insert/delete support or is that because those are relatively simple operations from a data/string manipulation standpoint
23:29ddellacostasneak_peek: it does actually, it's just that the docs don't reflect it: https://github.com/jkk/honeysql/pull/20
23:30sneak_peekddellacosta: nice! ill definitely try it out
23:31xeqidevn: doesn't look italizied to me
23:31sneak_peekddellacosta: might also try my hand at creating a simple data mapper that will operate on the data post-query. if i manage to make it work cleanly I'll throw it up on github. username is prachetasp
23:32xeqidevn: <a class="fork" ...>, so I think its a css issue
23:32ddellacostasneak_peek: what do you mean, data mapper?
23:32taliosaftermorning all
23:33ddellacostasneak_peek: I would be wary of doing too much to the data past what your app/business logic dictates...just based on experience.
23:33sneak_peekddellacosta: taking the flat relational data and placing into a nested form that can be exposed as json to legacy OOP applications
23:33sneak_peekddellacosta: if i can't make it lightweight then I'll abandon that route - but i need to be able to support those applications without too much overhead
23:34talioswhats the best clojure sql generation lib out there days? sqlkorma or something more shiny? looking for good composition/reuse
23:34ddellacostasneak_peek: ah. Well, I don't want to be negative and squelch exploration, you should give it a shot and see what you discover. I've had bad luck with those kinds of general approaches, but in the end I think it really depends on the use-case.
23:35ddellacostasneak_peek: but will be interested to see what you come up with!
23:36jonasentalios: yesql seems like an interesting approach. But it's not really a sql *generation* library
23:36jonasenhttps://github.com/krisajenkins/yesql
23:37sneak_peekwhat if i approached the issue from this angle. what is best way to implement a public-facing JSON API in clojure. or is it not well suited to that task
23:37ddellacostajonasen: yeah, really interesting approach that. Doesn't fit with what we're doing but cool thinking outside the box
23:38taliosjonasen - ahhh, yeh - looks nice, but not quite what I'm after.
23:38ddellacostasneak_peek: Clojure is great for that! (JSON API)
23:40sneak_peekddellacosta: but not if I can't get the data into a format that makes it easy for OO languages to de/serialize since the majority of clients are going to be written in them
23:40devnsneak_peek: sounds like already know about edn
23:41taliosjonasen - a clojure wrapper around jooq would almost be ideal for what I'm after actually ( using jooq at the moment on this small project, which is all java, nice - apart from some of the unweildy type signatures when you deviate the norm
23:41ddellacostasneak_peek: I don't see why you need to do anything other than spit out flat records such that a database would produce. How is that hard to consume?
23:42talioseuuu - don't let the REST NAZI's here you say that!
23:42taliosoh wait - I'm one of them.
23:42ddellacostatalios: but, this has nothing to do with REST, does it?
23:42ddellacostatalios: sorry, dunno if you were responding to me or not
23:42taliosJSON API sounds very RESTy related :)
23:43sneak_peekddellacosta: talios: whoops yeah forgot to mention that part
23:43sneak_peekits an HTTP REST API
23:43taliosbut yes - on the basic level, serialize to JSON and let it fly. Links and other stuff can come ontop. Or you could serialize to something like HAL that includes links etc. in the payload.
23:43taliosreally should update the clojure api for HalBuilder
23:44taliosalso really should release a new version of HalBuilder itself.
23:44sneak_peekddellacosta: so how does the flat representation translate cleanly into an everything-must-be-an-object language like Java. just have one giant flat object?
23:45ddellacostasneak_peek: I don't understand, I thought we were talking about HTTP? You don't have to worry about objects if you are just talking about pushing something out to a restful API
23:45taliosless object, more structure. a clojure map/list structure translates to JSON fine...
23:45ddellacostatalios: yeah, exactly
23:46talioswhich, if given a known structure, could be deserialized INTO a object/class for java clients, or a Map
23:47sneak_peekddellacosta: talios: the json serialization is trivial but im thinking about ease of use for people creating clients in OO languages. I do not want to impose a burden on them to create custom deserializations
23:48taliosthey wouldn't need to - deserialize to a Map - and if they WANT to have a fixed model, they can.
23:48ddellacostasneak_peek: but they will have to anyways. You can't anticipate how people will use the API. All you can do is give them a clean data structure to work with, which is infinitely preferable to some kind of object-mapping interchange thing anyways
23:48amalloyjust output json. everyone in every language is well used to consuming json-y stuff
23:48amalloyor edn, whatever
23:49sneak_peekanyone know of an API that does flat json like this?
23:49taliosour entire system :)
23:49taliosmy simple sample API on http://www.gotohal.net/restbucks does it to. a bit more richer JSON structure as its HAL+JSON tho
23:49ddellacostasneak_peek: flickr is just records. Most APIs I've used are just records actually. For example: https://www.flickr.com/services/api/flickr.blogs.getList.html
23:50amalloyevery api in the world? i don't understand the question. like, for example http://www.reddit.com/r/AskReddit.json
23:50amalloyor github's api. it's all json
23:51talioshttp://www.gotohal.net/restbucks/api/orders is a sample order-list resource on my sample API
23:51taliosHAL+JSON adding links.
23:52ddellacostaamalloy: I guess sneak_peek is talking about some kind of hierarchy vs. flat representation, not so much the format. But flat doesn't make it any harder to parse the relationships as long as there are IDs involved.
23:59sneak_peekddellacosta: sorry bout that - internet connection crapped out
23:59ddellacostasneak_peek: no worries.
23:59sneak_peekddellacosta: was something like this what you were talking about? e.g. prefixing with the entity name? {"user.name": "xxx", "account.balance": 10}