#clojure logs

2014-10-30

00:00justin_smithchenglou: kind of figures - and then each of those items would know how to compare to one another
00:01justin_smithstarting with "if they are they same object yes, if they have different hash-codes no" and working forward from there I guess
00:01bbloomoooo i did install the legacy java package on my mac b/c it apparently uninstalled the old sdk
00:02chenglouyeah. Someone ping me if they discover a magical, collision-free hash that can be modified in constant time =)
00:02bbloomwhen i launched intellij for the first time after yosemite
00:02justin_smithchenglou: lol
00:02bbloomcould that have something to do with it?
00:03justin_smithdifferent default heap sizes would be the first difference I would think of
00:06bbloom $ lein pprint
00:06bbloomError occurred during initialization of VM
00:06bbloomToo small initial heap
00:06bbloomhmmm
00:08technomancy32-bit jdk?
00:10bbloomtechnomancy: java -version reports 64-bit server 1.7.0_09
00:11bbloomi'm not sure how to set the system default heap size for jvm
00:12bbloomcomputers hate me
00:13bbloomJAVA_OPTS='-Xmx768M' lein repl <- seems to do the trick
00:13bbloomi guess i can just put that in my shell rc
00:14bbloomtechnomancy: or is that a terrible idea that will break my computer in some unexplained way 6 months from now?
00:22justin_smithRaynes: amalloy: one of you have a template for what the mongodb config for .lazybot/config.clj would look like? I will add it to the default if so, otherwise I will do my best to reverse engineer the config that should be there.
00:25amalloyjustin_smith: does it need any? the lazybot instance in here has no mongodb config. i think it just assumes a mongodb server on localhost:default-port, and that it's allowed to write to the lazybot db
00:25justin_smithamalloy: oh, sounds magic!
00:25justin_smithI'll make sure my db is on the default port then
00:25justin_smithand that I am whitelisted to use the db etc.
00:26justin_smithamalloy: shows how much I know about mongodb (jack shit)
00:27amalloyjustin_smith: the default mongodb config is to just assume the firewall takes care of everything, so that if you can connect to localhost you have permission to do whatever
00:27amalloyit looks pretty clear from lazybot/core.clj that there's nothing configurable at all
00:27justin_smithamalloy: OK
00:27amalloyexcept you can use a db name other than lazybot if you want
00:28dbaschjustin_smith: mongodb is webscale, almost as fast as /dev/null. That’s pretty much all you need to know.
00:28dbaschoh, and it has shards as its magic secret scalability sauce
00:31justin_smithamalloy: weird, when I run > show dbs I see a lazybot db with contents, but @help gives me a connection error? very weird
00:32justin_smithahh, never mind - it's an access control exception
00:32justin_smithI need to do that security settings thing
00:58raspasovhey guys does anyone have any idea about function calls within [let] blocks - long time ago I overheard from someone that they are not the most efficient way of executing fn calls in Clojure - is there any truth to that or it does not matter?
01:00justin_smithraspasov: why would a function call inside a let block be less efficient? function call dispatch can be marginally cheaper if you bind the function within a let block so that you never deref the var at runtime, but even then the speedup should be minor
01:01raspasovI see, ok, I was just wondering if there was any truth in that statement
01:05tolstoy_Andfam.12
01:21andyfLeiningen question: I have a directory in my project containing Clojure source files that I want to be in the classpath while I run ?lein test?, but I don?t want them in :source-paths, and I don?t want them in :test-paths. Why? Because they are not source files for the project, and they are only indirectly files for testing, by being require?d from my regular test files. Any recommendations?
01:26zRecursive,(doc ->>)
01:26clojurebot"([x & forms]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."
01:26justin_smithandyf: isn't test-resources a thing?
01:27andyfjustin_smith: Checking Leiningen docs for such a thing...
01:28justin_smithandyf: it's not in the example proejct.clj, so it likely is not a thing
01:28justin_smithbut you could set a :resource-path under the :test profile I guess?
01:28justin_smith:resource-paths that is
01:28andyfjustin_smith: I have tried putting it into the :resources path in the :dev profile, and that seems to be doing reasonable things, but your suggestion sounds even better.
01:29andyfjustin_smith: Sorry, I meant to say in the :resource-paths in the :dev profile
01:30andyfDo :resource-paths in a profile like :dev or :test, and a "global" :resource-paths, concatenate?
01:30justin_smithandyf: there is a merge that is done of the active profiles
01:30justin_smithI think testing pulls in :dev, :user, :test
01:32andyfDuh, the very first example given in output of "lein help profiles" is adding a directory to classpath in :test profile.
01:32justin_smithoh, nice!
01:32justin_smithhttps://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md this has some good info for showing your effective profile etc. too
01:34andyfYep, lists and vectors are concatenated when merging profiles. Cool. Bob's my uncle.
01:34andyf(inc justin_smith)
01:34lazybot⇒ 111
03:30dopamean_i am having a nightmare of a time trying to send a simple http request
03:30dopamean_i know all the information im sending is accurate because when i do it in the terminal with curl i get the expected response
03:30dopamean_but when using clj-http i get a 400 error every time
03:31sveridopamean_: did you set the :content-type and :accept key values?
03:34dopamean_at first no
03:34dopamean_because i didnt think i needed to for a post request
03:34dopamean_but then i did add it and its still not working. though its a little unclear to me from the api exactly how it wants the information
03:35dopamean_this is the offending code: (client/post spotify-access-token-url {:form_params data})
03:35dopamean_data is a map with all the necessary stuff in it
03:36sveridopamean_: Hm, it's been almost a year since I used this and I remember having had problems too, I don't remember what exactly the problem was, but this solved my problem: :as :json in the options map
03:37dopamean_400
03:52sveridopamean_: I had some success debugging rest services using the postman app from the google chrome store, I know you tried already with curl, but if you dont get closer to the problem I guess it's worth to try it
03:56dopamean_i started with postman
03:56sveriit does work with postman?
03:56dopamean_no
03:56dopamean_which means im not setting something correctly
03:56dopamean_something that curl is doing automatically
03:56sveriyep
03:57dopamean_all i specified for curl was a bunch of -d tags
03:57sveriI guess you just have to figure this out by trial and error
03:57dopamean_and then the url
03:57dopamean_ive been at it for 3 hours
03:57dopamean_https://developer.spotify.com/web-api/authorization-guide/#authorization_code_flow
03:57dopamean_im on step 4 of that
03:57dopamean_requesting the new access token
03:58dopamean_can you read that and tell me if there is something glaringly obvious that im missing?
03:58dopamean_it says send a post request and then it says request body parameters...
03:58dopamean_is that not form-params?
03:59sveriit should be
03:59sveriHowever, this is hard to debug remotely, all I can ask is if you set all the params from step 4 correctly
03:59sveriwhich you did, I guess
04:00dopamean_yup
04:01dopamean_if i left all the params off, just to see what happened, do you tihnk a 400 response would make sense?
04:01sveriI am sorry then, I guess I am of not much value here
04:01dopamean_or should it be something else?
04:01dopamean_its all good
04:02sveriYea, that would make sense
04:04dopamean_hmm
04:04dopamean_i just sort of got it to work
04:04dopamean_in postman
04:04dopamean_changed from "form-data" to "x-www-form-urlencoded"
04:05sverinice, maybe curl does some kind of auto negotiation
04:05dopamean_perhaps
04:05dopamean_now if i can just get clj-http to do the same thing
04:07shemdopamean_: did you check if it does a OPTIONS query first? cljs-ajax/POST does that and had me baffled for a while
04:07dysfuni was going to recommend http-kit which has a quite nice promise-driven API. i'm a bit mystified to find it's not on clojure-toolbox
04:08dysfunoh, it's under servers
04:08dopamean_what do you mean by options query/
04:09shemif i call POST with json content-type, it first does OPTIONS to the same uri
04:10shemand your server endpoint might be confused with that
04:10dopamean_maybe thats whats happening
04:10dopamean_i have no idea
04:16dopamean_well
04:16dopamean_i feel dumb for wasting so much time on this
04:16dopamean_it works fine with http-kit
04:18sveridopamean_: Hehe, I wasted time on much easier things, that's part of programming
05:11jzinedinehey guys, anyone knows about a seed project wiring pedestal service and reagent together?
05:12jzinedineI'm looking for a sample app to start with, and follow the patterns to build my app.
05:49borkdudehttps://gist.github.com/anonymous/53423c327ffda7faf852
06:15celwellI'm using lein-beanstalk, how can I define the application name to be something other than the name I have for my lein project (defproject ...)?
06:18celwellHmmm, looking at the source, this seems promising, will try: https://github.com/weavejester/lein-beanstalk/blob/master/src/leiningen/beanstalk/aws.clj#L50
06:24Glenjaminis anyone around familiar with figwheel? I'm trying to figure out a way to have the :on-jsload callback fire once on initial page load
06:24Glenjaminon a related note, thanks to everyone who recommended reagent to me the other day - it's excellent
06:38OliverJAshi'm learning clojure and have a JS background. i'm familiar with functional-reactive programming. i've used RxJS. can anybody tell me if clojure’s sequence data structures (seq?) are the same concept as what Rx calls "observables"?
06:39TEttingersequences are a very common type in clojure. they can be lazy seqs or finite seqs.
06:40TEttingerlazy seqs you can generate with something like
06:40TEttinger,(repeat "infinite")
06:40clojurebot("infinite" "infinite" "infinite" "infinite" "infinite" ...)
06:40TEttingerand here, clojurebot limits how many items it will print
06:41TEttingeryou could get just two items out of an infinite lazy seq with "take"
06:41TEttinger,(take 2 (repeat "infinite"))
06:41clojurebot("infinite" "infinite")
06:41TEttingerseqs are printed with single parentheses, like lists
06:41TEttingerI'm not sure what observables are, but I hope that clears up a bit
06:42OliverJAshdoes a sequence represent data over time? i.e. can you add new values to the sequence through time, and the data will be "pulled through", like in functional reactive programming?
06:44OliverJAshi think i'm confusing seq and FRP when they are totally different things :)
06:45TEttingeryou might be thinking of core.async (a popular clojure lib)'s concept of channels
06:45mavbozoin core.async, (thread) and (go) return channel
06:45TEttingerI can't explain channels
06:45mavbozowhat can I do with those channel, any easy example?
06:47mavbozo(thread (+ 1 2))
06:48mavbozonever mind, found it myself
06:49mavbozo(def c (thread (+ 1 2)))
06:49mavbozo(<!! c)
06:52shriphanihi, anyone here used core.matrix ? I want to compute a row-sum and I was wondering if a reduce is the right way to go ?
07:06ustunozgurhi all, in cider, what's the easiest way to send C-M-x output to repl?
07:07ustunozgurthat's, I want to see the output in the repl, not in the mini buffer.
07:10mavbozoustunozgur: so far, the solution is to create a elisp function and bind that function to keystroke
07:11mavbozoustunozgur: i found the function in the README of clojure core async tutorial here https://github.com/halgari/clojure-conj-2013-core.async-examples
07:13ustunozgurmavbozo: thanks ,look promising, although cider-find-or-create-repl-buffer seems to be gone. maybe renamed
07:13mavbozoustunozgur: here's my elisp snippet https://github.com/mavbozo/mavbozo-dotemacs/blob/0ca56487242f5b222fc3ac7a7c8c7243b4a1a0a6/mavbozo-custom.el#L149-L164
07:14mavbozoustunozgur: yeah, I still use cider 0.70
07:15ustunozgurthanks a lot.
07:16ustunozgurI slightly modified it to execute the top level form instead.
07:17mavbozoustunozgur: I am still a emacs newb, I would like to see your code, thanks
07:20ustunozgurmavbozo: here you go
07:20ustunozgurhttps://gist.github.com/ustun/0f1a86142b95a391773c
07:20ustunozgurI bound to Alt-Enter
07:20ustunozgurso anywhere within the form will execute the outermost form in repl
07:21mavbozoustunozgur: fantastic! thanks a lot
07:22ustunozgurthis is actually slightly different from how cider sends it to the repl but good enough for my demo purposes.
07:22ustunozgurgiving a talk today to a java user group
07:22ustunozgurthe difference between this and cider's C-M-x is that
07:22ustunozgurif you are in a different namespace in cider it will send that to that namespace
07:22ustunozgurwhereas this will send the code to the current namespace the repl is in.
07:24mavbozoustunozgur: have a great talk!
07:24ustunozgurthank you!
07:28edbondI use lein new with template and it seems old version of template is used.
07:29pandeiroedbond: did you `lein install` the template from a local repo with the same version?
07:29edbondhttps://github.com/magomimmo/om-start-template
07:30edbondpandeiro, no, used lein new om-start as in Readme
07:30pandeiroedbond: or maybe the clojars version is behind the github
07:30edbondmaybe I had an old version
07:30pandeiroedbond: no i think lein new always checks
07:30edbondpandeiro, thanks, I'll check clojars
07:31pandeiroedbond: so you could do `git clone git://github.com/magomimmo/om-start-template && cd om-start-template && lein install`
07:31edbondpandeiro, thanks. Clojars have more recent version that github :)
07:32edbondhttps://clojars.org/om-start/lein-template 0.0.7
07:32edbondhttps://github.com/magomimmo/om-start-template/blob/master/project.clj here is 0.0.6
07:32pandeirowow that's a first
07:32pandeiroi think `lein new ...` should always by default get the latest version from clojars
07:34edbondI have 0.0.7 jar here /home/eduard/.m2/repository/om-start
07:36edbondyes, clojars is a bit behind. Thanks, pandeiro
07:36edbond(inc pandeiro)
07:36lazybot⇒ 2
07:38fairuzhey guys, if let say I open 2 terminals, with one runing lein repl. Then I modify one of my function, and compile using lein compile. Do I need to reload the repl?
07:41clgvfairuz: why dont you just reload the namespace of the function?
07:41clgvfairuz: sounds like what you describe will fail
07:42clgvfairuz: development gets much easier if you have editor and repl integrated since you can use commands like "evaluate that function definition in repl"
07:46TimMcfairuz: None of Leingingen, the default REPL, or Clojure itself will automatically reload code.
07:46fairuzclgv: TimMc: Ok. I'm still learning on how to develop/debugging efficiently using repl.
07:47fairuzso how to reload a namespace?
07:47fairuzredo a (use xxx)?
07:47clgvfairuz: use one of the editor+repl combinations or IDEs
07:47clgvfairuz: with :reload or :reload-all yes
07:49fairuzclgv: Ok cool. Does not want to start an IDE war, but what are recommended IDEs? LightTable is more than enough I suppose?
07:49clgvfairuz: options for dev envs are Emacs+Cider, Vim+Fireplace, Eclipse+Counterclockwise,IntelliJ+Cursive, Nightcode ... maybe others I currently forgot
07:49clgvah right LightTable ^^
07:50TimMcfairuz: My usual pattern is this: lein repl; edit files; (require 'foo.bar.baz :reload); repeat
07:51TimMcI don't use lein compile because I'm not using AOT.
07:51clgvTimMc: you dont use any integrated editor + repl combo?
07:51TimMcNope.
07:51clgvwow O_o
07:52fairuzTimMc: I just want to ask about that :) we actually don't need to compile each time we modify the files right?
07:52TimMcclgv: One f these days I will try setting up cider again, but the last time I tried it all fell apart.
07:52clgvTimMc: I am only using lein repl on remote machines and sometimes if it gets more complicated I connect with my dev env to the remote nrepl
07:52TimMcfairuz: Right, reloading will compile on the fly (not to disk, just in memory.)
07:53clgvTimMc: haha yeah, seems that cider thing breaks often surprisingly
07:53fairuzTimMc: got it
07:53TimMcclgv: I version my .emacs.d so it shouldn't be too bad once I get it working, but I need to get a stable version in there.
07:54clgvTimMc: last posts on the ML suggest that even the stable version might break spontaneously - no idea if thats true
07:54TimMcfairuz: Or usually (require '[foo.bar.baz :as f] :reload) since I'll be calling it a lot.
07:54TimMcclgv: This does not surprise me.
07:55TimMcIt also doesn't really fit with my windowing preferences. I like having my REPL in a totally separate window.
07:56clgvTimMc: yeah thats the setup I use with counterclockwise as well
07:57TimMcBronsa suggested using emacsclient in order to accomplish that, but... eh, another thing to set up the next time I want to work.
07:59clgvTimMc: hehe. I think I'll never leverage the power of emacs since I am not good at remembering many complicated shortcut combinations...
07:59shememacs can sprout several proper windows of course
08:00clgvTimMc: I used it 2 months for the SBCL course exercise I was organizing
08:05TimMcfairuz: Oh, just a tip -- you'll eventually find yourself in a situation where you have fn B that calls A, you rewrite and reload both repeatedly, but you fail to do it in the right order, and it works in your REPL because an old version of A is in memory but B doesn't work with the A on disk.
08:06TimMcYou should be aware that this can happen so that you'll recognize it when it does. (This gets worse with defrecords and deftypes and multimethods -- different symptoms, same essential problem.)
08:07TimMc`lein test` or restarting your REPL will give you a more honest view of the world.
08:14whodidthishow does a human being test a ring middleware that depends on another middleware
08:17foofoobarHi. (first „hello“). Why is this \h instead of h ?
08:18clgvfoofoobar: notation for character literals
08:18clgv,(str (first "hello"))
08:18clojurebot"h"
08:18clgvabove it is a string instead of a character ^^
08:18foofoobar,(str \h)
08:18clojurebot"h"
08:18foofoobarah, okay. thanks
08:18elfenlaidwell, strings aren't sequential by default, but can transform to sequence; and sequence from string is a list of chars
08:19clgvelfenlaid: that's a complicate explanation. strings are arrays of chars on the jvm would suffice ;)
08:19clgvat least internally ;)
08:20elfenlaidow, ok :)
08:22clgv,(mapv #(nth "hello" %) (range (count "hello")))
08:22clojurebot[\h \e \l \l \o]
08:29mavbozowhodidthis: by mocking the required middleware
08:35fairuzTimMc: thanks for the tip. Really appreciate any advice now since I'm just started :)
08:36whodidthisi liked the ((wrap-whatever identity) {:body "my-request"}) approach, whats a cool way of testing something that depends on another, should i just ((mw/wrap-something identity) ((mw/wrap-else identity) {:body "my-request"}))
08:37whodidthisjust request parsing middleware
08:41mavbozowhodidthis:(-> {:body "my-request"} (mw/wrap-else identity) (mw/wrap-something identity))
08:42mavbozowhodidthis: threading macro -> is better
08:42whodidthiscool, always room for some magic
08:43mavbozowhodidthis: better to use threading macro -> in your case
08:43perplexathread-first macro*
08:43perplexa:P
08:47whodidthisalthough if i want to use a threading macro thingie i guess i would have to (as-> {:body ""} _ ((mw/wrap-else identity) _) ((mw/wrap-something identity) _))
08:53clgvfairuz: better make your first steps with LightTable since you have already installed it ;
08:59mavbozowhodidthis: or, (def test-app (constantly {:body ""}))
09:00mavbozowhodidthis: (-> test-app mw/wrap-else mw/wrap-something )
09:16si14how would you translate CLJS app? I've come up with a simple macro, but it's still not obvious how to compile two different artifacts for different languages.
09:17si14of course I can use environ or somethings like this and do TRANLSATION=en lein cljsbuild once production, but this seems a bit messy to me
09:24perplexasi14: you can use #+clj and #+cljs macros, if i understand you correctly
09:24perplexaoh wait, you're actually talking about languages and not clj and cljs ;p
09:24si14perplexa: no, sorry, I meant human languages :) like compiling two different artifacts for English and Esperanto languages
09:25perplexahaha yeah just realised :D
09:25perplexasorry
09:25si14:)
09:25si14thanks for an advice, anyways :)
09:26perplexasi14: i don't understand your use case.
09:27si14perplexa: webapp with i18n
09:27perplexalanguages are something chosen by the client, so shouldn't you include all resources and then decide inside of your application which one to use?
09:27perplexanot at compile time
09:27perplexathat would diminish the purpose of i18n
09:30si14perplexa: I can compile two different artifacts and give a choice on a landing page, I think
09:30si14basically, two different webapps
09:31perplexashouldn't be a different app at all, the logic stays the same, just the strings are different
09:31perplexamaybe use something like https://github.com/ptaoussanis/tower
09:32perplexaand decide which language to use based on browser accept headers
09:34si14perplexa: I also need quite a lot of language-specific resources, so it be unwieldy to include them in app if they will not be needed
09:35ustunozguranyone encountering erros with swing gui (frames) not appearing with cider?
09:36ustunozgurit returns visible=true but the gui is no where in sight
10:01perplexado people actually use type hints?
10:09Glenjamingenerally only to remove reflection on iterop
10:09Glenjaminpersonally
10:22justin_smithperplexa: they can make a massive difference in performance when you need them
10:24perplexajustin_smith: so it's preferable to just add them :)
10:25Glenjamini'd say add this https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L255 to your project.clj
10:25Glenjaminthen do whatever it tells you
10:28perplexaGlenjamin: i'll give it a shot
10:34si14oh wow. pretty epic
10:34si14there are no externs for Web Audio API in Closure Compiler that is used by CLJS
10:36si14(erroneous /me, sorry)
10:36Glenjaminhttps://code.google.com/p/closure-compiler/issues/detail?id=710 looks relevant
10:38zot1question on idiom: i'm trying to do something like update-in, but where the "rhs" also needs the same keyed structure. my raw version is above, and my first attempt at making it generic below. suggestions on how to improve? https://gist.github.com/anonymous/90213a0f47091e287bfc
10:41justin_smithzot: I think there is a misplaced paren in that reduce
10:42zotjustin_smith: could be, it was 'scratchpad' idea, although it at least parsed in the repl, i think
10:42si14Glenjamin: yeah, but it doesn't work now
10:42justin_smith,(reduce +)
10:42Glenjaminyou can just pull in additional externs in the build config
10:42clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/reduce>
10:42justin_smithzot: you should have seen that error
10:43zoti just pasted it again w/ no problem, although there is definitely a paren off. strange.
10:43justin_smithzot: anyway, unless I am mistaken, the paren to the right of ks should be before m1 in that reduce call
10:44zotyep i've fixed it here, and will repaste if useful :)
10:45zotis there a cleaner way to pull it off? the anon func for reduce is … awkward, but i haven't (so far) imagined a better way, other than maybe as a walk that update-in's the peer structure. important to note is that both trees can be sparse, so update-in, or sth else that will create missing structure, is preferred.
10:47justin_smithzot: I like the reduce version (the version of it with correctly balanced parens at least)
10:48zotjustin_smith: ok, good to hear from somebody else… trying to learn with the notion of using func composition instead of tricky anon fns… and this one befuddles ;)
10:49justin_smithzot: I don't see a straightforward way to do this with function composition though
10:50zotjustin_smith: ok — i'm still finding my way in clojure, so sometimes there's a super awesome way that i've just never seen, forgotten, or can't find via google :)
10:51zotjustin_smith: tnx for taking a look!
10:53EvanRis there a type which is just a date, and not a java Date which is taking liberties with midnights and time zone assumptions
10:55zotEvanR: familiar with clj-time?
10:55EvanRno
10:55zotgoogle it. it can probably do what you want, and way way more.
10:55irctchi
10:55irctc:)
10:56EvanRok
10:56irctcis this a place where a newbie can ask questions?
10:56EvanRalso i just discovered java GregorianCalendar
10:57andyf_irctc: yes
10:57ohpauleezirctc: Most certainly!
10:57hyPiRionEvanR: prefer clj-time and joda-time whenever you can
10:58EvanRim reading the doc, it might work
10:59irctci'm looking at https://github.com/aphyr/riemann/blob/master/src/riemann/email.clj at the function (defn email-event i'm trying to understand it
10:59irctcso [smtp-opts msg-opts events] are arguments ok so far :)
11:00irctcthen "(let [events (flatten [events])" what does it means exactly it flattens events and places it in events?
11:00irctci don't get it
11:01Glenjaminirctc: it takes any single item or nested sequence of sequences, and gives you a single sequence of events
11:01irctcwhy is it flattening events at all?
11:01irctcok
11:01irctcso it suspecteed it would be nested i understand
11:01Glenjamin[1 [ 2 ] [3 [4] ] ] => [ 1 2 3 4]; but also 1 => [1] and [1 2] => [1 2]
11:01irctcand i'm allowed to override like this the same variable name?
11:01irctcevents it flattened and named as events again...
11:01Glenjaminyes, a let binding runs in order and can re-bind locals
11:02irctcok
11:02irctcthen this "subject ((get msg-opts :subject subject) events)" what is the first "subject" is it a function i lost it at that point
11:03EvanRclj-time youre my only hope
11:03EvanRat least one industrial time lib may actually make sense
11:04andyf_irctc: I don't know exactly what the args to this function are, but (get msg-opts :subject subject) is an expression that either returns a function, or a value like a map or vector that can be used as a function
11:04andyf_irctc: Whatever that is, it is then called with the argument events, and the return value of that is bound to subject
11:05andyf_irctc: If it makes it clearer, it could be written in two lines instead like so:
11:05andyf_irctc: some-fn (get msg-opts :subject subject)
11:05andyf_irctc: subject (some-fn events)
11:06andyf_irctc: I should have started with your question, though: subject there is just another name that is being bound to a value in the let
11:07irctcok got it about the first subject
11:07irctcyes its an array i missed that so we are bidning 3 items events subject and body
11:08andyf_irctc: yes, the let is binding 3 values to those names
11:08irctcso about the inner "(get msg-opts :subject subject) " its get from map named "msg-opts" the field :subject and the default would be the last "subject" if not found?
11:08andyf_irctc: yes
11:08EvanRsweet
11:08irctcbut can i be sure there is a default "subject"? what if was not bound yet?
11:09justin_smithirctc: if subest was not bound yet, that would not even compile
11:09justin_smith,(get {} :foo foo)
11:09clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:10andyf_It looks like the original value for subject is coming from the :use on line 5
11:10irctcok
11:11irctcis it aggregating somehow the subjects from all the events into a single one? or the body from multiple events into a single one? i don't get how it achieves this..
11:11andyf_irctc: That would be much less obvious if subject were def'd in namespace postal.core, which has (:use postal.core) up near the top, since that will bring in every public def in postal.core into this namespace. That is one reason why many Clojure programmer recommend against an "unlimited" use like that.
11:12irctchmmm
11:12irctci see this
11:12irctcin riemann.common
11:12irctcsubject is also a function named "defn subject"
11:13irctcso wow with a field named subject, a default value, and a function all named subject !! :)
11:13andyf_irctc: Again, I'm not familiar with the exact context here, but I would guess subject is a function. It can take whatever events is (probably a sequence of events), and calculate a subject line, probably a string, to use in an email message.
11:14andyf_irctc: riemann.common/subject is the default function to use for calculating the subject, but it can be overridden by putting a key named :subject into the map msg-opts, whose value is a different function to use instead
11:14irctcso in this"subject ((get msg-opts :subject subject) events)" the first subject is a "string" and third subject is a function!?
11:15andyf_irctc: that would be my guess
11:15irctcoh sorry default
11:15irctcin anyway the main thing that mixed me up is that subjet was a function defined something else i just looked for the concatenation somehwere..
11:15andyf_irctc: I am not claiming that those are the best names to use for clarity of purpose :)
11:15irctc:)
11:16irctcok i think i got some of the subject :)
11:17justin_smithirctc: yeah, the naming here is kind of odd, here is a hopefully less clever and more clear version that does exactly the same thing https://www.refheap.com/92484
11:20irctchttps://www.refheap.com/92484 --> *much more clearer!!*
11:20irctchttps://www.refheap.com/92484 --> *much clearer!!*
11:21andyf_irctc: My inner grammar Nazi thanks you
11:22perplexai there a better way than (* (int (/ x y)) y) to make x a multiple of y?
11:22perplexawithout casting to an int in the middle ;p
11:22clgvjustin_smith: tsktsk to much :use there ;)
11:22irctc:)))
11:22justin_smithclgv: I did not touch the ns form at all
11:22andyf_perplexa: Not much different, but you could use (quot x y) instead of (int (/ x y)) ?
11:22perplexalike, i have x=11, y=2, expected result is 10
11:22justin_smithclgv: it is just there to provide context in the function I reworkd below it
11:23clgv,(- x (mod x y))
11:23clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:23clgvoh comma :P
11:23perplexaah yeah, andyf_! that looks a bit better :) gracias
11:23andyf_clgv: I'm curious -- I understand that 'unlimited' :use's like that are frowned upon in most uses, but do you use them in test code, e.g. (:use clojure.test) ?
11:24perplexaclgv: that also, yes ;p
11:25perplexabut i remember from back when i cam across some C algos that subtraction is usually more expensive than multiplication/division
11:25perplexano idea how jvm handles that, it's probably bad either way :D
11:26andyf_perplexa: I would think that it is usually the opposite, i.e. + and - are fastest integer ops, and multiply and divide are slower. This is likely getting more historical now, as * quot and mod are probably all just as fast as + and - on integer ops on most modern processors.
11:26justin_smithperplexa: with out immutible data structures and laziness and runtime polymorphism, we have much bigger optimization targets than the cost difference of subtract vs. multiply
11:27justin_smith*with our
11:28andyf_clgv: I ask because right now Eastwood warns on all 'unlimited' use's, but I've been wondering whether I should disable that warning for source files in :test-paths
11:28perplexammh :)
11:29cbryanandyf_: or just do :require [... :refer :all]
11:29cbryaneastwood is fine with that
11:29mgaareandyf_: replacing them with (require '[whatever :refer :all]) should shut up eastwood too
11:29mgaaredoh
11:29cbryan;)
11:29Glenjaminheh, i'm not clear why :refer :all is considered nicer than :use
11:30andyf_Sure. My main curiosity is, for people who frown on unlimited :use, do you use them in test code? I do, and it seems relatively common.
11:30justin_smithandyf_: to me :use makes sense if there is a clear "referent" namespace, where your code only makes sense if read in parallel with that namespace (whether you are wrapping it, or testing it, or extending it...)
11:30justin_smithandyf_: but even then, more than one :use is a problem
11:31Glenjamini'd rather just list out the 5 or 6 functions i need
11:31andyf_justin_smith: because? Sorry, not obvious to me why.
11:31Glenjaminit's not that often to have a namespace with more than that many you need to use
11:31andyf_Glenjamin: Even in a test namespace?
11:32Glenjamindo you mean for clojure.test, or for the system-under-test?
11:32justin_smithandyf_: if the namespace is about wrapping / extending / testing one other ns, then it only makes sense in context of that ns and one would be looking at both together, with more than one ns used, that introduces the ambiguity and refactoring difficulty that to me are the real pain points in :use
11:32andyf_Glenjamin: either, but if you have reasons for doing it differently for each, I'm curious.
11:32mgaareandyf_: the more places you have to look to answer the question, "now where did this symbol come from?", the unhappier I get :D
11:32Glenjaminandyf_: well clojure.test, only is, testing and deftest are really used that often i'd have though
11:32Glenjaminsystem-under-test i usually :as to a single letter
11:34andyf_So perhaps if Eastwood never warned about (:use clojure.test), but kept its current warning for such a use of any other namespace, not many people would mind that behavior?
11:35Bronsaandyf_: I :use clojure.test in all my tests
11:35andyf_I look at Eastwood warnings on quite a few projects on a regular basis, so certain warnings I can get tired of seeing, and I imagine others woudld, too.
11:35GlenjaminBronsa: how many different vars from clojure.test do you think you use often?
11:35andyf_Bronsa: You and nearly everyone else :)
11:35BronsaGlenjamin: just is and deftest probably, but it's just too much of a hassle to :refer them
11:35Glenjamini'm interested in whether :use clojure.test is habit, or because it's annoying not to
11:36Bronsaandyf_: which version of t.a.jvm is eastwood using atm?
11:36andyf_Glenjamin: Can't speak for others, but for me it is annoying to pick exactly what I want, even though it is a copy-and-paste if I wanted to go to that trouble.
11:37Glenjamini don't use clojure.test very often, but i'd have expected something like [clojure.test :as test :refer (is testing)] would cover most usage
11:37andyf_Bronsa: Latest Eastwood release 0.1.4 is getting creaky old: t.a(.j) version 0.2.2 :-(
11:37Bronsaandyf_: no I mean SNAPSHOT :P
11:37andyf_Bronsa: Getting real close now to another release. Testing the latest masters of t.a(.j) as we type
11:37justin_smithGlenjamin: most would refer deftest too I think
11:38Glenjaminmm
11:38andyf_I think I just committed that about an hour ago
11:38Glenjaminbut still, not many, out of the, what?, 20 or so vars in there
11:38Bronsaandyf_: ah cool, asking because 0.6.3 should be more than twice as fast than 0.2/0.3
11:38Glenjamini count 29 vars
11:39Bronsa,(require 'clojure.test)
11:39clojurebotnil
11:39Bronsa,(count (ns-interns 'clojure.test))
11:39clojurebot40
11:39justin_smith,(count (ns-publics 'clojure.test))
11:39clojurebot37
11:39andyf_Glenjamin: I think everyone who uses clojure.test uses deftest and is. A fraction use testing, and an even smaller fraction use are
11:39justin_smithuse would only give us the publics, right?
11:40Bronsajustin_smith: ah yeah
11:40andyf_Glenjamin: Past that, I haven't even looked at what else is in clojure.test
11:40justin_smithBronsa: though for compilation tooling you usually care about the interns, I am sure :)
11:40Glenjaminmostly stuff to run tests
11:41justin_smithand fixtures!
11:41justin_smithI guess those count as running stuff actually
11:41Glenjaminfixtures would probably be ok using test/use-fixtures ?
11:42justin_smithGlenjamin: sure, I usually use test/testing too, and in many namespaces I even do test/is
11:49andyf_justin_smith: You've stunned the room into silence with that one. We are all mentally reeling :)
11:50justin_smithhaha
11:58donbonifaciocan I deconstruct a variadic function to a hash? (defn hey [*hash-obj*] ...) and call (hey :name "Lucy" :age 1)
12:02gfredericks(defn hey [& {...}] ...)
12:04cbryanis there a preferred pastebin for this channel?
12:04benzapif I understand correctly, gfredericks is saying that optional arguments when passed to a function are presented as a list after the set of arguments through a defined var (defn [x & args] ...) where 'args' is a list of arguments succeeding the the variable 'x'
12:05nooniancbryan: refheap
12:05justin_smith,((fn [& {a :a b :b}] [a b]) :b 2 :a 1)
12:05clojurebot[1 2]
12:06justin_smithbenzap: he meant that ^
12:06benzapjustin_smith: thank you for clarifying
12:07donbonifaciothanks justin_smith gfredericks
12:07justin_smithdonbonifacio: another thing is that using rest args map destructuring is controversial
12:07benzapi didn't supply a name for defn, so my example is probably confusing
12:07justin_smithdonbonifacio: it is often easier to just use a hash as an argument
12:07cbryanis there a more idiomatic way to write this? the (some? (some ...)) feels wrong https://www.refheap.com/92486
12:07donbonifacioI see
12:08whodidthisif a human being, using yesql, has (defqueries "file.sql") in a file, can the queries be referred to from another file
12:08justin_smithdonbonifacio: for example if you want to provide that set of keys / values to some function, and you have them in a map already
12:08benzapthis actually brings up something that bothers me regarding defprotocol, where you are limited to providing nothing but arguments, with no & rest statements
12:08benzapbut i'm guessing this a limitation when trying to communicate with a java interface
12:08justin_smithwhodidthis: by requiring that namespace and accessing them from said namespace, right?
12:10whodidthisright
12:12justin_smithwhodidthis: yeah, yesql just creates a call to def https://github.com/krisajenkins/yesql/blob/master/src/yesql/types.clj#L51
12:12justin_smithso you can access it as you would any other def from another ns
12:14whodidthissweet
12:24SagiCZ1the other i read something about meta data.. and i wanted to ask, would it be possible to save some kind of benchmark data to some functions in my program, and look for bottlenecks this way? i was thinking, that each time the function gets called, it updates its own metadata, thats possible right? and can i extract this metadata later? i would like to implement this with minimal impact to my existing program
12:24justin_smithSagiCZ1: profilers do a much better version of this
12:24justin_smithjvisualvm comes with the jdk, yourkit is popular (and you can get it free for open source work)
12:25SagiCZ1justin_smith: i've tried a profiler but showed some low level clojure core functions as hot spots.. useless for me
12:26nooniancbryan: i think you can leave off the some? calls since everything in clojure except nil and false is truthy in conditionals
12:26Glenjaminmaybe that means your app isn't slow?
12:27SagiCZ1Glenjamin: there is one of my functions which could be improved from linear to constant time, and the profiler wasnt able to identify this.
12:27cbryannoonian: ah cool! thanks
12:27justin_smithGlenjamin: more likely just a forst / trees issue, with noise from the lower level stuff that the functions are constructed from
12:27GlenjaminSagiCZ1: if it wasn't a hotspot, then it suggests that n is small enough that the constant factor / overhead dwarfs the time complexity
12:28SagiCZ1Glenjamin: i think it suggest, that jvisualvm is maybe good for java but not so much for clojure
12:28Glenjamini've managed to use it very well on clojure, and speed up clojure functions which were bottlenecks
12:29Glenjaminare you running the profile on your app generally, or while running a specific bit of code?
12:29SagiCZ1Glenjamin: it is running some heavy computation that takes minutes to finish
12:29SagiCZ1in the list of functions that the profiler identifies there is non of my own functions..
12:29Glenjaminand you start profiler, run computation, stop profiler?
12:30SagiCZ1yes
12:30Glenjaminare you using the top-down view?
12:30Glenjaminor just looking at self times?
12:31SagiCZ1Glenjamin: i was sorting them by time
12:33Glenjamintry using the top-down view, it'll let you drill down by times that include the timing of the functions that call
12:36SagiCZ1Glenjamin: is there a difference between 'sampler' and 'profiler'? in jvisualvm?
12:36Glenjaminthe only difference i've seen is that i've never got the profiler to work, but i have got the sampler to work :)
12:36SagiCZ1Glenjamin: same here
12:38SagiCZ1Glenjamin: where would i find the top down view?
12:38justin_smithI've seen the profiler work for heap profiling
12:41SagiCZ1Glenjamin: also, is it wrong, that i am profiling the repl running the task?
12:46EvanRis there a function to take a value, return it unless nil, in which case throw an exception
12:46SagiCZ1i have found some info by using the "snapshot" option ... not sure what it all means
12:46justin_smith(assert v)
12:46justin_smitherr, no
12:47justin_smith,(and (assert v) v)
12:47clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: v in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:47EvanRfantastic
12:47EvanR,(assert 3)
12:47clojurebotnil
12:47justin_smithoh wait...
12:47justin_smithnot and
12:47justin_smith,(do (assert 3) 3)
12:47clojurebot3
12:47justin_smith,(do (assert nil) nil)
12:47clojurebot#<AssertionError java.lang.AssertionError: Assert failed: nil>
12:47EvanR,(assert false)
12:47clojurebot#<AssertionError java.lang.AssertionError: Assert failed: false>
12:48EvanRlooks like a function is in order
12:48justin_smiththere is that too - perhaps you want something using nil?
12:48justin_smith,(do (assert (not (nil? false))) false)
12:48clojurebotfalse
12:50EvanRcan i customize the error message
12:51justin_smith,(assert nil "that should not have been nil")
12:51clojurebot#<AssertionError java.lang.AssertionError: Assert failed: that should not have been nil\nnil>
12:51EvanR,(assert false "foo")
12:51clojurebot#<AssertionError java.lang.AssertionError: Assert failed: foo\nfalse>
12:52EvanR,(assert false nil)
12:52clojurebot#<AssertionError java.lang.AssertionError: Assert failed: \nfalse>
12:56justin_smithEvanR: you can also use :pre in functions
12:56EvanRin this case im making sure the result is not nil before returning it
12:56justin_smith,(map (fn [x] {:pre [(not (nil? x))]} x) [0 1 2 nil 3])
12:56clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (not (nil? x))>
12:57justin_smith,(map (fn [x] {:post [(not (nil? %))]} x) [0 1 2 nil 3])
12:57clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (not (nil? %))>
12:57EvanRchecking the input is not nil as a post action?
12:57justin_smiththat's not input
12:57justin_smith% stands for the potential return value
12:57EvanRx?
12:57EvanRoh
12:58EvanRcould be good
12:59justin_smith,(map (fn [x] {:post [(not (nil? %))]} [x]) [0 1 2 nil 3])
12:59clojurebot([0] [1] [2] [nil] [3])
12:59justin_smithdoes not trigger, because not nil any more
13:03justin_smithEvanR: another factor here is that you can decide at runtime whether asserts are checked (and this includes :pre and :post condition asserts)
13:03justin_smithso the consequences there are twofold: you can be more ambitious about assertion and not worry too much about the effect on performance, and if you want real exception handling don't use assertions
13:03EvanRproduction mode seems like the last place i want to omit debug support
13:05EvanRyeah this is not exception handling
13:06justin_smithif you are writing a lib, you should consider the fact that users of the lib are allowed to turn assertions off
13:06justin_smithso assertions should be used as a dev-time verification of correctness of code, rather than a debugging-of-runtime-condition thing (maybe logging is a better fit for that?)
13:07technomancycontracts!
13:07technomancyor something
13:07EvanRif they turn assertions off, it shouldnt matter, because they shouldnt be happening
13:07EvanRthe errors
13:07justin_smithtechnomancy: schema!
13:08technomancyracket!
13:09justin_smithEvanR: well we do have core.typed for typechecking code, and schema for runtime data validation
13:09EvanRi looked at core.typed, i did not understand the filters part
13:09EvanRand schema refers to prismatic?
13:10justin_smithyeah, prismatic/schema provides tools for verifying certain properties of clojure data
13:10EvanRit sounds good
13:10justin_smiththings like "this has to be a map with the :a key having a number value"
13:11EvanRin this particular case, its asserting that what im looking for in a dictionary is actually there
13:11EvanRrather than a structural assertion
13:11justin_smithEvanR: right, so you could describe the dictionary with a schema as always having a value at a particular key
13:11justin_smiththat is a structural assertion
13:11EvanRthe keys are dynamic
13:12justin_smithEvanR: schema doesn't fully describe the data
13:12noonianEvanR: you can do that too i believe
13:12justin_smithit just says "it at least needs this kind of value in this place"
13:12EvanRwhich place?
13:12justin_smiththe one you specify!
13:13justin_smithas I said above, for example you could specify "this is a map, it has a key :a, the value at that key is a number"
13:13justin_smiththat is a schema
13:13EvanRthis is another mismatch on usage of a map
13:13EvanRits not a record, its a lookup table
13:14justin_smithEvanR: then use deftype
13:14EvanRall i can say about it is its a map with String keys and the values are vectors
13:14noonianmaps are often used as records in clojure
13:14EvanRi know this.
13:14EvanRi am not using it as one here
13:14noonianyou can describe what you just said you the schema library is all justin_smith is saying
13:14justin_smithEvanR: and exactly what you said is expressable as a schema
13:15EvanRjustin_smith: runtime checking this fact how often?
13:15EvanRon inserts?
13:15justin_smithEvanR: checking it when you invoke the check, that's up to you, they just provide the checker. I think there is a shortcut for doing it on the arg on each invocation of a function. But you can invoke the checking wherever.
13:16justin_smithEvanR: it's not a typing system, it is a validation tool
13:16noonianyeah, you can either annotate the fns metadata so it is always run with validation or you can only validate it when you want to
13:16EvanRyeah so all i was saying is that a check that the particular key i need is there isnt a schema thing
13:16justin_smithhow not?
13:17noonianwe're talking about the library called schema, not the abstract concept of what a schema is
13:17EvanRits a map from strings to maps, not even known to be non empty
13:18EvanRthats about all i can think of using schema for in this case
13:18noonianwhich is a perfectly valid use case for schema
13:18noonianif you care to ensure that the data you get conforms to the specification you just said
13:18EvanRa runtime lookup that a key is there, that i am already looking up anyway, i dont see a library here
13:18nooniansure, thats up to you
13:19justin_smithEvanR: I can understand if you don't like this abstraction, but this abstraction does address your data validation issue
13:19EvanRso... it equips a map with some extra stuff to never return nil?
13:19EvanRall lookups return something?
13:19justin_smithno
13:19EvanRok because that would seem like a weird role for something called schem
13:19mgaareyou use it to instrument your functions, iirc
13:20EvanRit makes total sense to describe record structures
13:20noonianit doesn't modify a map, it describes what a map at a certain part of your program is expected to look like
13:20justin_smithEvanR: it is an abstract description of a data structure, and a function that tells you whether the input data matches that description
13:20noonianyou annotate the function, not the data
13:20EvanRthe exact structure of my dynamic lookup table at runtime might be describable with dependent types or something
13:21EvanRi would need a program to run to describe exactly which keys are in there
13:21EvanRand really it doesnt matter, as long as im not ending up with an invalid key
13:21justin_smithEvanR: schema doesn't fully describe the keys, but validates that set of properties you ask it to validate
13:22noonian(def my-schema {s/Keyword s/Any}) describes a map of keyword keys to anything
13:22noonianyou could ensure that the values are maps of course
13:22noonianor that the keys are a subset of a specific set of keywords
13:23justin_smithnoonian: or that at least key foo is present, with a value of type F
13:23EvanRyes that makes sense
13:23EvanRthat though would not
13:23EvanRneither would, for my case
13:24noonian'its a map from strings to maps, not even known to be non empty'
13:24noonianyou can describe that easily
13:24EvanRid like an environment that separates the concept of records from A -> B maps to avoid confusion on the topic
13:24noonian{s/Str {s/any s/any}}
13:24EvanRnoonian: not even known to be non empty, is a non-constraint
13:24justin_smithEvanR: in clojure records (as defined by defrecord) are maps
13:25EvanRthe situation is very simple
13:25EvanRjustin_smith: i understand its all the same here
13:25justin_smithnot if you use deftype
13:25EvanRso they are the same but not
13:25justin_smithwhich I brought up before, if you want a type, use deftype
13:26EvanRthat would make sense, today i have not brought up any usecase for a record / type
13:26EvanRyesterday though i was talking about records, and people thought i was wanting to know about lookup tables, uniform keys values
13:26EvanRvery frustrating
13:27justin_smithEvanR: does clojure even have any concept of uniform keys in a lookup table? other than numeric index I guess
13:27EvanRuniform key type
13:27EvanRstring, keyword, number
13:27EvanRthe values is the more interesting thing to be uniform
13:28justin_smithbut we have no abstraction (other than arrays / vectors) that has uniform key type as a property
13:28justin_smithnot to mention values!
13:28EvanRnot unexpected
13:29EvanRdoes prismatic schema allow recursive schemas
13:30justin_smithEvanR: https://github.com/Prismatic/schema/issues/35 addressed here
13:30technomancyamalloy_: I remember you saw a use of flatten in lein that was somewhat justified? was it in lein clean?
13:31EvanRyurg, cyclic data structure is not what i was expecting
13:32justin_smithEvanR: a schema is a data structure, a recursive schema would need to be a cyclic data structure
13:32EvanRseems like a limitation of the schema rep
13:32justin_smithOK
13:33justin_smithEvanR: the set of concerns / interests you have here makes me wonder if you wouldn't prefer using scala over clojure. Not saying "get out of here if you feel that way", just I think scala dev is more aligned with those concerns.
13:33noonianschema supports recursive schemas now: https://github.com/Prismatic/schema/wiki/Recursive-Schemas
13:33justin_smith(inc noonian)
13:33lazybot⇒ 9
13:33nooniani think they just don't guarantee them to be fast when validating
13:33justin_smithnoonian: I guess I found some out of date info
13:33EvanRgood enough
13:34noonianjustin_smith: yeah, that issue was closed at the bottom by an accepted PR :P
13:34justin_smithnoonian: haha, reading ftw
13:35EvanRsince i have all this java stuff set up i guess it wouldnt be out of realm of possibilities to install and try scala
13:35EvanRbut seems scary as hell
13:35justin_smithEvanR: agreed
13:36justin_smithEvanR: for example, this type signature freaks me out https://twitter.com/extempore2/status/430341743779659776
13:37EvanRwtf
13:37robstorythere are scarier things, like clobbering immutable namespace with a single import: https://gist.github.com/wrobstory/60750cec022650bf27b1
13:37justin_smithEvanR: but clojure has its wtfs too, as we both know
13:39justin_smithrobstory: does that prevent the original immutible version from being avaialable, or change which version library code would end up using?
13:40{blake}I'm trying to get a form going with hiccup and keep getting a "Key must be integer" exception.
13:40amalloy{blake}: you have too many parens probably
13:40{blake}Minimal example: (defn test-form []
13:40{blake} (f/form-to [:post "/posts/new"]))
13:40amalloy,([:x] [:y])
13:40clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer>
13:40{blake}amalloy, Too many parens? Unpossible!
13:40EvanRyou can never have too many parens
13:41{blake}Well, that's what I thought. I'm copying and pasting examples from git and elsewhere, and the common thread is that error.
13:42robstoryjustin_smith: for the former, you can still call scala.collection.mutable.Set, and have to do so explicitly. For the latter, I do not believe it would trickle down into lib code. Should stay contained in that particular scope.
13:42{blake}amalloy, Oh...so...okay, that's an error you get when you've executed a function you didn't want and made something a parameter you didn't mean.
13:43amalloywell, when you try to call a vector with something that's not an integer
13:43{blake}I need that macro thing. macroexpand!
13:46{blake}Well, that didn't help.
13:46noonian,(get [1 2 3] :foo)
13:46clojurebotnil
13:46noonianhmm
13:46noonian,([1 2 3] :foo)_
13:46clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer>
13:47amalloy{blake}: i think you need a less minimal example, because that one looks fine
13:48amalloynoonian: get is more forgiving; it works on anything, and never throws an exception
13:48noonianinteresting
13:49amalloywell, "never". you could create a type that responds to get by throwing an exception, but you'd have to do it on purpose
13:51dbasch,(get get get get)
13:51clojurebot#<core$get clojure.core$get@48b1ca>
13:51dbasch^ four get
13:51justin_smithdbasch: I only just now realized it was a rebus
13:52justin_smith,((get get get get) (get get get get) (get get get get) (get get get get))
13:52clojurebot#<core$get clojure.core$get@48b1ca>
13:56turbofailwe need to go deeper
13:58nooniansounds like a job for ben affleck and bruce willis
13:58amalloy,((fn [n] (nth (iterate (fn [get] (get get get get)) get) n)) 10) ;; arbitrarily deep, with example tenth-order usage
13:58clojurebot#<core$get clojure.core$get@48b1ca>
13:59amalloyplus, i got to write *six* gets in a row
14:00justin_smith(inc amalloy)
14:00lazybot⇒ 182
14:22technomancyamalloy: hey, I remember you saw a use of flatten in lein that was somewhat justified? was it in lein clean?
14:23amalloytechnomancy: that's the only use of flatten in leiningen at all, now that i've removed the others
14:23technomancyamalloy: I just got a PR for lein clean that uses it and I almost flipped out
14:23amalloyi'm not really convinced it's justified, but taking it out could break back-compat in ways i'm not competent to diagnose
14:23technomancybut then I took a closer look, and it seems necessary to support both singular and plural paths
14:23technomancy:classes-path vs :source-paths
14:24amalloyyou still don't need a whole flatten for that, just (mapcat (fn [x] (if (coll? x) x [x])) whatever)
14:25technomancytrue, but that's super noisy in comparison
14:25amalloysure. but you can define that somewhere, and then use it in a non-noisy way. call it squish-a-little
14:26justin_smithsounds like we need a version of concat that takes both collections and single items (and would look a lot like amalloy 's anonymous fn above)
14:26hiredmanvenial-flatten
14:26justin_smithhaha
14:27amalloy(inc hiredman)
14:27lazybot⇒ 60
14:29technomancytrying to keep my LOC numbers down here amalloy, geez
14:29amalloydem bytes ain't cheap
14:30technomancyif we get within an order of magnitude of the lines of sbt we won't be allowed to make fun of them as effectively
14:32TimMctechnomancy: Longer lines.
14:33turbofailyou can still make fun of them for taking a ridiculously long time to do anything
14:33technomancyturbofail: let he who is without sin cast the first stone
14:35turbofaillein seems to do most operations significantly faster
14:35turbofaileven with the clojure startup time
14:35EvanRhow would venial flatten know if you really wanted to flatten something or treat it as a "single item"
14:36justin_smithEvanR: it only flattens the args, not any of their contents
14:36TimMcEvanR: coll?
14:37EvanRi guess i should have specified, how would it know if you wanted to flatten a coll
14:37EvanRa subcoll
14:37justin_smithEvanR: if you wanted that, you are calling the wrong function
14:37amalloyEvanR: easy: you don't, or you wouldn't have called venial-flatten
14:38justin_smith,(defn venail-flatten [& args] (apply concat (map #(if (coll? %) % [%]) args)))
14:38clojurebot#'sandbox/venail-flatten
14:38amalloyit's like, how does + know you don't want to multiply one of the items instead?
14:38turbofailasking the important questions
14:38justin_smith,(venial-flatten "a" ["b" "c" ["d"]] ["e" "f"])
14:38clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: venial-flatten in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:38EvanRi misunderstood the purpose here, its concats args
14:38amalloyjustin_smith: s/apply-concat+map/mapcat/
14:38EvanRrather than flattening something
14:38justin_smithahh, yeah
14:38justin_smith,(defn venial-flatten [& args] (mapcat #(if (coll? %) % [%]) args))
14:38clojurebot#'sandbox/venial-flatten
14:39justin_smith,(venial-flatten "a" ["b" "c" ["d"]] ["e" "f"])
14:39clojurebot("a" "b" "c" ["d"] "e" ...)
14:39justin_smithEvanR: right, but it replaces a use case where otherwise flatten got called
14:39EvanRanother thing i was thinking of was, your structure might not have enough info in it to tell an operation what to do with it, would be another style if it did
14:39amalloyi think the version of it that would be useful for lein doesn't take &args, but sure, a general one might
14:40{blake}amalloy, You're right; because the error is in the calling code, which is trying to call the result of the routine.
14:40justin_smithEvanR: yeah, this is reading a config file (project.clj)
14:40justin_smithEvanR: as such it has "conveniences" for the writer
14:40amalloy{blake}: speaking of which: stacktraces!!! so important. it would be pretty easy to have told you that, if you'd gisted a stacktrace along with the error message
14:41{blake}amalloy, OK, I have another opportunity, since it's back. =P
14:41EvanR,(concat [1] [2] [3] [4])
14:41clojurebot(1 2 3 4)
14:41turbofailwe need a "fatten" function. though i'm not exactly sure what it will do
14:41EvanR,(concat [1] [2] 3 [4])
14:41clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
14:42EvanR,(concat [1] [2] #{3} [4])
14:42clojurebot(1 2 3 4)
14:42amalloyturbofail: ##((fn fatten [x] (nth (iterate list x) 10)) 5)
14:42lazybot⇒ ((((((((((5))))))))))
14:42turbofailthis will suffice
14:42EvanR,(concat [1] [2] {3 5} [4])
14:42clojurebot(1 2 [3 5] 4)
14:42EvanRyurg
14:43justin_smith,(seq {4 5 6 7})
14:43clojurebot([4 5] [6 7])
14:43EvanR,{1 2 3}
14:43clojurebot#<RuntimeException java.lang.RuntimeException: Map literal must contain an even number of forms>
14:43justin_smith,(flatten {4 5 6 7})
14:43clojurebot()
14:43EvanRim glad that case is taken care of
14:44amalloyjustin_smith: a classic
14:45{blake}justin_smith, Wow, that's really flat.
14:45justin_smith{blake}: inorite
14:45EvanRvery zen
14:46{blake}So, here's my new "key must be integer" (now! with stack trace!) https://www.refheap.com/92490
14:46justin_smith(dec flatten)
14:46lazybot⇒ -4
14:46{blake}lol
14:46EvanR(dec flatten)
14:46lazybot⇒ -5
14:47{blake}Hiccup seems easy enough to use, but not being able to figure out how to glue it into my ring app is why I started rolling a few simple routines to do my own HTML.
14:51justin_smith{blake}: I think the issue could have to do with the ambiguity of providing a function to be called on the request, vs creating the response inline. I haven't used compojure in ages, but you are clearly directly specifying a response with one route, while naming a function to be called in another
14:52{blake}justin_smith, Hmmmm.
14:54justin_smithwhat happens if you change the first route to do (test-form spreadsheet)
14:54{blake}justin_smith, OK, thanks. Let me see if I can't find out how those are supposed to work together.
14:55csd_Is it necessary to escape user passwords when developing a web app?
14:56mgaarecsd_: are you not hashing user passwords?
14:56csd_i am--good point
14:57EvanRusers should be allowed to put any text they want for a password
14:57csd_how do you guys guard against sql injection
14:57csd_in general
14:58amalloycsd_: always use parameterized queries, of course
14:58amalloynever ever ever ever write (str "insert into x (password) " user-password)
14:59EvanRideally the library doesnt even let you use a string
14:59amalloymeh
14:59csd_amalloy: korma/jdbc are fine though right?
14:59amalloycsd_: sure, as long as you never build query strings yourself
15:00amalloyEvanR: i think it'll be a few more generations before we see a no-strnigs sql library that actually lets you do the things you want to do and is as approachable/flexible as sql
15:00EvanRin clojure?
15:00dbaschpasswords should be hashed as soon as possible on the server, and the plaintext forgotten forever
15:01EvanRif you use a query type which is almost like strings but doesnt support strcat that would do it
15:02EvanRwhere ? and ?? are replaced with args or lists of args
15:02mgaarethen you've lost composability
15:02amalloymgaare: well, you don't really have that with sql anyway. it's not much of a loss
15:03mgaareI felt like this had some good ideas, just didn't quite get there: https://github.com/LauJensen/clojureql
15:04amalloymgaare: right, it's the lisp curse: 20 different people each solving 80% of the same problem
15:05mgaareI've got some ideas for yet another crack at the problem
15:05EvanRjust drop sql the language
15:05dbaschthat happens in every language, someone solves the interesting 80% of something and never gets to the tedious 20% that would take forever
15:06csd_coughlighttablecough
15:06mgaareone insight for me is that combining query generation with query executiotn is a mistake
15:07{blake}csd_ lol
15:08EvanRin what sense are they combined?
15:08amalloydbasch: you've read the lisp curse, i presume?
15:09dbaschyes
15:09mgaareEvanR: in the sense that many libraries are built around doing both together
15:10EvanRim sure youre right but which one are you thinking of
15:10mgaarekorma, clojureql, hyperion are a few off the top of my head
15:11EvanRlooking at korma, wow jeez
15:12EvanRi guess this is for quick and dirty
15:12clojurebotOk.
15:13EvanRyou can wrap these in lambdas, but good luck mixing and matching where clauses
15:13mgaareChris Granger later on said he regretted the way he designed korma, that it was the result of being new to the language and applying too much thinking from elsewhere
15:14EvanRnow im even more curious, elsewhere where?
15:14csd_as someone who just recently used korma id love to know a better alternative
15:14turbofailhoneysql is an example of a library that doesn't combine the two
15:14mgaareother languages
15:14mgaarethere's a lot of ActiveRecord influence in there
15:14EvanRright that one
15:15justin_smithmgaare: ahh, so he was a rubyist?
15:15mgaareyeah, HoneySQL is pretty good
15:15mgaarejustin_smith: I'm not sure of his full background. I know that he used to work at Microsoft on VS
15:16justin_smithmgaare: ahh, you are referring to the general active record concept, not the specific ruby lib called ActiveRecord?
15:16turbofailhoneysql has some issues of its own, don't remember exactly what they were
15:16{blake}"The Lisp Curse" is brilliant. And reminds me of my desire to implement Clojure in Smalltalk.
15:17dbaschaka ORM
15:17dbaschyears ago I had an employee who implemented his own ORM in Java because he didn’t like Hibernate
15:17mgaarejustin_smith: yeah, I just think of ruby's ActiveRecord being so dominant in mindshare that I sometimes use the terms interchangeably
15:17rubber_duckwhy do people bother wrapping up SQL :\
15:18rubber_duckYeSQL takes care of the nasty string embedding issues
15:18rubber_duckone of the primary reasons I use clojure is because it works with data so nicely it's super easy to consume results of raw SQL queries
15:18justin_smithmgaare: from some googling I discover there is also a lib called ActiveRecord for php
15:18dbaschrubber_duck: because at some point people thought that you could abstract away the fact that there was a sql database under your persistent object store
15:19turbofailrubber_duck: sometimes i want to generate queries, not merely paramterize them on data
15:19justin_smithdbasch: because the differences in semantics between your object system and the database are just useless noise, of course :) you can just ignore them
15:19mgaarerubber_duck: ah, yesql looks pretty cool. Hadn't seen this before
15:20rubber_duckturbofail, aside from trying to implement a custom DSL -> SQL compiler I think I'd still rather work with strings
15:20dbaschjustin_smith: there’s even a wikipedia page for the concept http://en.wikipedia.org/wiki/Object-relational_impedance_mismatch
15:21turbofailrubber_duck: suit yourself. i happen to think working with strings is a disaster
15:21EvanR"oop vs relational war"
15:21EvanRcirca 1991
15:21mgaareit reminds me of how things worked with html libraries somewhat... I used enlive for a while, super complex and powerful, eventually said "f it" and went all the way over to selmer
15:22mgaareyesql seems like an overreaction in the same way
15:22rubber_duckEvanR, that's the beautiful part of clojure - there's no OOP - SQL is just another data returning function - you don't care about "keeping your objects synchronized" because you're working with values by default
15:23justin_smithrubber_duck: to be fair there is some OOP, but we can usually avoid it, and it's on the layer of "how to tell jdbc what to do" not on the layer of representing the queries and results
15:24EvanRyeah i tried reading about that stuff in the history books, and it made no sense
15:24EvanRso many assumptions about how you have to do stuff, it was all a figment of their imaginations
15:24amalloyEvanR: a string type that doesn't support concatenation is certainly interesting. you could do even better in haskell, with a newtype wrapper around String such that you can concat query bits with each other but not with user-input strings
15:25bbloommgaare: yesql is only an overreaction if you have a genuine need to abstract over sql dialects or compose queries from fragments
15:25EvanRamalloy: the haskell lib mysql-simple and postgres-simple is what i was thinking of, it overload string literals for this
15:25amalloyright
15:25bbloomif you don't need to abstract over sql dialects, you can use database-specific abstraction and composition mechanisms
15:25amalloyi haven't actually used those, but overloaded strings did seem like the natural thing when you suggested it
15:26EvanRbut the point about it not being as flexible is true, in which case you really want your field names, joins, where clauses, group bys, orders, limits, and unions to be their own types which you just nest
15:26EvanRthats the simple way
15:26EvanRor you could make this sql compiler thing
15:26mgaarebbloom: The pile-of-strings approach is not very resilient to change either
15:26bbloommgaare: the question is: what changes?
15:27bbloommgaare: in my experience it's easier to change sql queries than it is to change ORM invocations
15:27bbloomyou're more likely to get analysis errors trying to execute fixed queries than you are trying to generate queries reflectively from schema
15:28mgaareI think we can agree that ORM is not the way
15:28amalloyit's no coincidence that ORM shares two letters with MURDER
15:28bbloomsure, so ORM is clearly out, but the question is whether or not you want a metalanguage for queries
15:28EvanR"how do i do X" "dont do X" mapper
15:28bbloomkorma etc are decidedly ORM-like
15:28rubber_duckas much as I love clojure reading it's source to reverse engineer protocols/specs makes me want to bang my head against the wall, I wish core.typed was at the point it could be baked in to the language :)
15:28EvanRsql is already a meta language for queries
15:28bbloombut there's stuff like ClojureQL etc that are arguably more composable
15:28EvanRa sucky one
15:29hiredmanreally, you just want something that makes generating sql strings better
15:29EvanRand you always want a better language for doing X rather than beating your keyboard like a caveman
15:29Bronsa,(meta (seq (with-meta (lazy-seq []) {:foo 1})))
15:29bbloomright, but there's always costs
15:29clojurebotnil
15:29hiredmanrelational algebra is fine and good, the result sets you get back from java.jdbc are fine
15:29bbloomcoding directly to a SQL AST may be preferable in some cases
15:29hiredmanbbloom: right
15:29bbloombut SQL wasn't designed to be coded to at the AST level like a lisp was
15:30bbloomso there's naturally some abstract vs concrete syntax mismatch
15:30bbloomso the developer has to bear the weight of that cost
15:30bbloomif you're not metaprogramming queries (or not doing it often) it may not be worth it to pay that cost for all other concrete queries
15:30EvanRuntil some developer makes a better language that other developers recognize as good
15:30hiredmanspeaking of everyone having an 80% solution https://github.com/hiredman/graph/blob/master/src/com/manigfeald/graph/rel.clj is what I wrote last time I had to write a lot of sql joins
15:30mgaareSQL was designed for businesspeople to use, and it was at least more successful at that than the previous efforts at that objective like Cobol
15:30bbloombtw, i'm a big fan of C#'s Linq to SQL
15:31bbloomit's exceptionally well done
15:31EvanRyeah thats a good example
15:31bbloomit has both solid concrete sytnax and is very robust both in terms of reliability and completeness
15:31rubber_duckF# typeproviders look even sexier
15:31hiredmanbbloom: indeed
15:32EvanRfoo to sql compiler
15:32EvanRdesign pattern
15:33justin_smithbbloom: would Linq be usable from clojure-clr?
15:33bbloomjustin_smith: the compiler might be, yeah
15:33bbloomjustin_smith: you'd still need a mapping from a clojure data structure to an Expression data type to invoke the compiler
15:34rubber_duckIn F# type providers basically both the compiler and the IDE can read your DB schema trough a plugin and generate type info and provide code completion off live DB - that's just :O
15:34justin_smithbbloom: that seems more tractable than string based stuff at a glance
15:34bbloomjustin_smith: you'd get a good SQL compiler, but you basically now need a clojure to C# compiler
15:34bbloomwhich is, of course, different than clojure to msil
15:34bbloomlinq operates on an expression tree datatype
15:35bbloomseems like that may be as hard, if not harder, than just compiling to SQL
15:35EvanRexpression trees without further context sounds way easier to deal with than sql text
15:36EvanRbut its c#
15:36bbloombasically, the C# compiler uses the type of an argument to overload the call site to automatically quote the passed expression
15:36bbloomit's basically C#'s macro mechanism
15:36turbofailhm. interesting
15:37bbloomhttp://msdn.microsoft.com/en-us/library/bb397951.aspx
15:37bbloomit's similar to scala's call by name, but scala does not let you inspect a call by name argument
15:37bbloomto do that, you must write a scala compiler plugin
15:41turbofailthis doesn't seem to allow for compile time shenannigans. though on the plus side, it doesn't seem to allow for compile time shenannigans
15:43turbofailthough it also appears you can compile at run time, as in clojure. so the distinction is kind of fuzzy
15:51andyfBronsa: Would you prefer I test latest tools.reader over the revert change you suggested?
15:54Bronsaandyf: yeah
15:56EvanRapt-get installing scala, im feeling bored with life
15:57perplexadoes anybody use clojure to build GUI apps?
15:58perplexaand if yes, what libs do people use? i just saw seasaw but it seems unmaintained
15:58sveriHi, name one beginner friendly .emacs.d repo, at best with an overview of the shortcuts, pleas
15:59andyfA few have created some: Nightcode clooj clj-ns-browser. Seesaw is a good swing lib wrapper
15:59perplexathx andyf!
15:59andyfWhy did it seem unmaintained ?
16:00perplexacommits are from 4-1 year ago
16:01andyfThere is an email list where some q & a still occurs. Not sure if it is still being enhanced.
16:01noonianyou could also go the cljs + node webkit route
16:02perplexabtw andyf, i didn't mean IDEs ;p
16:02amalloyperplexa: sometimes things are just done. seesaw works fine, as far as i know. there's no need to constantly add new bells and whistles to it
16:03perplexai'll give it a try then
16:03andyfSeesaw is not specific to IDEs. They are just examples I knew without looking up more
16:05ustunozgurtry this: google for java rationale
16:06amalloyperplexa: also, it looks like he's been merging pull requests regularly. Last one merged a month or two ago
16:08{blake}Crap. Hiccup doesn't have a date control?
16:08Bronsahttp://sprunge.us/LZTB
16:10EvanRyou know very well source code degrades over time naturally and must be constantly updated to maintain a constant level of workingness
16:10amalloythat's interesting, Bronsa. does the compiler just choose arbitrarily among equally-good overloads?
16:10AimHereEvanR, binary code degrades faster, of course
16:11EvanRlol
16:11Bronsaamalloy: that's what it looks like
16:11seangrove{blake}: I assume you must mean something like hiccup (in clojure) throws an error if you do [:date ...]?
16:11perplexaamalloy: fixing typos in comments ;/
16:11amalloyperplexa: so, it works so well that the only pull requests people are sending him are comment typos, and he's even merging those? where is the bad news?
16:12justin_smith{blake}: seangrove: yeah that confused me too, all hiccup does is output tagged elements, why would it care if it was a date or not?
16:12{blake}seangrove, I'm looking for a "date-field".
16:13Bronsaamalloy: the funnt thing is that it doesn't do that at compile time, those compile into a reflective call
16:13amalloyright
16:13perplexai thought there would be the need to update it, but seems swing is consistent in its api, but i really have no idea :)
16:13seangrove{blake}: Post some code and error output
16:13AeroNotixdakrone: hey when are you going to release clj-http 1.0.2?
16:14{blake}seangrove, Nothing to post. There's no "date-input". Maybe I'm supposed to use "input-field"--but that's a "defn-".
16:14AeroNotixnot trying to rush you but a weird bug between elastisch and clj-http seems resolved when using 1.0.2-SNAPSHOT
16:15seangrove{blake}: Surely it's just [:input {:type "date"}] ?
16:15{blake}seangrove, Like maybe it's supposed to be called (inputfield "date" "mydate")
16:15amalloyBronsa: what order do the methods come out in when you use reflection to look up the methods named foo and bar?
16:16seangroveWeird, I had never even seen this https://github.com/weavejester/hiccup/blob/1.0.5/src/hiccup/form.clj#L89
16:16seangroveI've never used the helper functinos I guess
16:16justin_smith{blake}: I think what you may be missing is that hiccup is really about constructing a fairly straightforward edn that can be translated to html, and you don't need a specific function to create that edn, you can put it in literally or write your own function that outputs edn
16:16seangrovejustin: Did you know about those helper elems?
16:16{blake}justin_smith, Yeah. Sounds plausible.
16:16justin_smithseangrove: I have looked at them, but never really needed them
16:17Bronsaamalloy: yeah they come out in reverse order
16:17amalloyit looks to me like the issue is that (clojure.lang.Compiler/subsumes (into-array [Long]) (into-array [Integer/TYPE])) and (clojure.lang.Compiler/subsumes (into-array [Integer]) (into-array [Long/TYPE])) are both true
16:17{blake}justin_smith, seangrove Leave it to the noob to find the obscure stuff...
16:17justin_smithhehe
16:17amalloyso the compiler considers those both perfect matches, and doesn't bother looking to see if there's another equally-good match
16:18justin_smith{blake}: another approach would be to use the same macros that are being used in the code seangrove linked to
16:18Bronsaamalloy: I gave up months ago trying to understand how all that actually can work, I just accept it does most of the time
16:18amalloya solid plan
16:19{blake}justin_smith, I am using those; that's why I was looking for a "date-field".
16:20justin_smith{blake}: I mean the macros that generate those definitions
16:20justin_smith(it's macros all the way down)
16:21{blake}justin_smith, Till you get to the turtles, anyway. I was thinking about the "input-field" function. Was there a macro I could use instead?
16:22andyfBronsa: Maybe I am getting overly worried by your example, but does that mean that Math/abs could truncate longs to ints with no way to predict?
16:22noonianas long as the last one never gets expanded then you
16:22noonianyou're good right?
16:22{blake}OK, here's a more general-purpose question: I'm used to having a substring function that handles out-of-bounds conditions...gracefully...like (subs "" 0 4) returning "", rather than "HOW DARE YOU!?!" Is there such a thing in Clojure?
16:22justin_smith{blake}: in seangrove's link they use "defelem"
16:23justin_smithgreat simile about system design: "like putting a pig heart in an alligator because mammals are clearly better than reptils"
16:23{blake}justin_smith, So I could make a "defelem date-field", IOW. Yeah... OK, feasible.
16:23EvanRsounds tastey
16:24{blake}It's bacon that eats you!
16:24justin_smithEvanR: there's a cajun place nearby, open real late, you can get a killer mac+cheese+alligator sausage
16:26amalloyandyf: looks possible to me, yes
16:26noonianjustin_smith: where at?
16:27justin_smithnoonian: portland, OR
16:27noonianjustin_smith: i know, i mean where in pdx?
16:27noonianis the cajun place you're talking about
16:28justin_smithmontage, se industrial
16:28nooniani've never had alligator
16:28noonianah right, one of my friends seears by montage
16:29justin_smithit's an intense place, definitely not a laid back atmosphere
16:29Bronsaandyf: yeah it would look like so
16:29Bronsaandyf: OTOH (fn [a] (Math/abs a)) would emit a reflection warning
16:29amalloyandyf: if you decompile (fn [x] (Math/abs x)), it boils down to a reflective call that hinges on clojure.lang.Reflector/paramArgTypeMatch
16:30amalloyand it says that a Long arg matches an int param
16:32amalloyand the way it unboxes is via Long.intValue(), which silently overflows
16:32andyfUncool
16:37andyfBronsa: I suppose it makes sense that the combination of how tools.reader adds more file loc metadata than the Clojure reader, and how syntax quote works, that some code could throw method too large with tools.reader when eval'd but not with standard reader ?
16:37Bronsaandyf: yeah probably
16:37Bronsaandyf: it might choke on the <clinit> method
16:37amalloyandyf: i'm a little surprised. at least in the reflective case, your code is really slow already anyway; Reflector could do an overflow check when unboxing, and throw an exception
16:38andyfI have only seen that occasionally so far. Will let you know if it gets worrisome.
16:38Bronsaandyf: I remember seeing that for midje a while ago
16:39amalloyBronsa: just in general, not for tools.reader, right?
16:39andyfI suppose best workaround would be to disable some of that extra metadata in tools.reader ?
16:40Bronsaamalloy: some midje macros output a *huge* amount of code for even relatively small inputs, tools.reader adds >2x the amount of metadata that LispReader does and that's enough to trigger a methodwhatever exception
16:41Bronsaandyf: ATM there's no way to control what metadata is attached where in tools.reader
16:42andyfI know how to use grep for end-column :-)
16:42Bronsaheh
16:42Bronsaandyf: it's not only end-column/end-line though
16:42Bronsaandyf: tools.reader adds line info on vector/set/map literals too
16:43Bronsaand maybe on symbols or something like that, I don't remember
16:43Bronsaandyf: cljs needs this to emit accurate source-maps
16:43andyfOk. Good to know, but not urgent.
16:44hiredmanon that basis I continue to blame midje for everything
16:46amalloyBronsa: i remember long ago that midje was regularly emitting enough code to break the compiler even using the ordinary reader, so i can't really blame tools.reader for this
16:49TimMcI feel like this is probably a usecase for generative testing. :-)
16:50TimMcOh nvm, you're talking about the sheer quantity of code.
16:50TimMcWe've run into that at work a couple times, but it's slightly our fault.
16:50Bronsaamalloy_lunch: the real issue IMHO is that the compiler doesn't split methods when they start getting big enough they could hit the limit & doesn't compress the data when building the constant table in <clinit>
16:51Bronsathose are both things I'd like to address in tools.emitter.jvm but I have an awful long list of things to do before I can start playing again with t.e.jvm
16:54andyf(zinc Bronsa)
16:54andyf(inc Bronsa)
16:54lazybot⇒ 65
16:54andyfI hope you are not now, or ever, covered in zinc
16:55TimMcunless it's sunscreen
16:55TimMcBronsa: Is there a Jira ticket for that? I'd like to vote for it.
16:55andyfI like to think there are 2.5 people working on Eastwood, and Bronsa is 2 of them :-)
17:00TimMcHah! Who is .5?
17:00andyfMe
17:06BronsaTimMc: no ticket that I'm aware of
17:06technomancy~theology
17:06clojurebotIt's greek to me.
17:07tim___ooh, that's a good one
17:07Bronsaandyf: that's totally untrue and you know it. both eastwood and t.a would be nowhere near what they are now if it wasn't for your hard work
17:08andyfIt's a humbler- than-I-actually-am joke
17:08technomancytim___: not actually the response I was expecting, but that works surprisingly well.
17:09technomancy~geometry
17:09clojurebotTitim gan éirí ort.
17:09technomancy~theology is <reply>Clojure needs some theology and geometry; some taste and decency. I suspect we are teetering on the edge of an abyss.
17:09clojurebot'Sea, mhuise.
17:09technomancy^ what I think of when I hear that midje is emitting enough code to break the compiler
17:12justin_smithtechnomancy: among the many things we have in a lisp that scale to great ends thanks to our compible tools, is space usage
17:13tbaldridgeand it's not just Midge, try using core.match with core.async's go macro...
17:14tbaldridgeor writing any large function in something like core.match or core.async
17:16technomancyone of the many reasons it bums me out that pattern matching isn't part of the language
17:27EvanRim using core.match, should i be worried?
17:29andyfProbably not, unless you mix with core.async and/or large functions
17:30technomancyI can't use it because it would lock all lein plugins into a specific version =\
17:30technomancybut if you don't have a big plugin ecosystem that shouldn't be a problem for you
17:30technomancyit used to have a bunch of AOT bugs, but it sounds like those have been taken care of
17:30andyftechnomancy: Not if you renamed the namespace of the one you use :-)
17:31Bronsaandyf: hah, I was waiting for this comment
17:31justin_smithandyf: and the jar dep too?
17:31andyfI don't recommend that. I am a masichist in some ways.
17:32technomancydon't give me any crazy ideas
17:32technomancyI have plenty of my own, and it gets confusing when I have to tell them apart from other peoples' crazy ideas.
17:32technomancy=)
17:32andyfjustin_smith: No jar dep. copy the source & rename the namespaces
17:33andyfAssuming licenses are compatible
17:33technomancylike what clojure does with asm, I guess
17:33justin_smithoh, of course
17:39amalloyi would support a jar rename of core.match by technomancy. it would have to be called technomatchy or matchnomancy or something
17:39amalloyand it would be sufficiently advanced to be indistinguishable from matchic
17:40justin_smithphil.matchelberg
17:40amalloy(inc justin_smith)
17:40lazybot⇒ 112
17:41andyfAny technology distinguishable from magic is insufficiently advanced.
17:42jamieenglishHi all, I'm looking to build a load testing web app and want to use JMeter as a library, rather than an executable. Is this a bad idea??
17:42lazybotjamieenglish: Uh, no. Why would you even ask?
17:43andyfMan, lazybot has no empathy
17:43justin_smithlazybot, are you silly??
17:43lazybotjustin_smith: Definitely not.
17:44arohnerok, real stupid question. clj-time surely has a date time formatter that will take an #inst, right?
17:44arohner(with the #inst part stripped)
17:44dbaschlazybot is distinguishable from magic
17:44hiredman#inst will actually take a lot of things
17:44arohnerhiredman: my goal is to take a string generated by #inst, and parse into joda (and then later spit joda times into strings that resemble #inst)
17:45jamieenglishWell, lazybot, jmeter is cool as a cli, but there doesn't seem to be much info on using it to programatically build and run load tests :(
17:45arohnerI know I can write the formatter, I'm just amazed it doesn't exist yet
17:45arohneror I'm unable to find it
17:45justin_smithjamieenglish: in case it is not clear, lazybot answers anything ending in ?? with a random yes or no
17:45amalloyjamieenglish: lazybot is a bot; he's just guessing that because your question ended with ?? you are asking something to which the answer is probably "no"
17:45EvanR??
17:45lazybotEvanR: Uh, no. Why would you even ask?
17:45clojurebotCLABANGO!
17:45amalloyjustin_smith: not so!
17:45EvanR???
17:45lazybotEvanR: Yes, 100% for sure.
17:46amalloyis there a way to force lazybot to answer with a yes???
17:46lazybotamalloy: Yes, 100% for sure.
17:46justin_smithamalloy: oh, TIL
17:46EvanR? ?
17:46jamieenglishjustin_smith: I got that :)
17:46amalloyjustin_smith: the ?? ending is the only part of it that seemed to me to be actually a good heuristic; i put in the ??? thing so i could use lazybot as a stooge
17:46EvanR#"\?\s*?\d*$"
17:47justin_smithamalloy: look for a ‽ trigger in my pr for lazybot
17:48technomancywe had someone get super mad at that in #leiningen the other day
17:48technomancybut it was about a windows question and he was actually pretty mad to begin with afaict
17:48amalloyis it possible that amalloy is secretly pulling all the strings behind lazybot‽
17:48lazybot"no, no way that would ever happen"
17:49amalloylol, silly me. put in ""s as if IRC were a clojure repl
17:49justin_smithamalloy: I read the quotation marks as sarcasm
17:49EvanRhhkklklhkjh
17:49hiredman~amalloy
17:49amalloyEvanR: vim is over there
17:49clojurebotamalloy only uses locally sourced, free range electrons
17:50amalloytechnomancy: it's a fun feature, but i probably wouldn't add it today, just because he does occasionally upset people who don't get it
17:51amalloysometimes those people deserve it, but uninformed newbies don't need any extra confusion in their lives
17:51justin_smithjamieenglish: your question piqued my curiosity, and all I find so far is forum threads about whether it would be a good idea (with many people saying it is crazy) and no guides to embedding jmeter, or examples of using it that way.
17:51dbaschamalloy: we can all use more confusion http://www.scientificamerican.com/podcast/episode/confusion-helps-us-learn-12-06-25/
17:51technomancyamalloy: I'd say it's not bad in high-traffic channels where the bot is unlikely to be the only response
17:51sdegutisHi bbloom. Thanks for the fun conversation about religion on Twitter.
17:52technomancybut timezones make it more complicated too
17:52bbloomsdegutis: that isn't appropriate to bring up here
17:52hiredmanI dunno, I mean, I seem to recall hearing that the less informed you are about a topic the more confident you are in your opinions on it
17:52sdegutisOops.
17:52hiredmanso maybe confusion is called for
17:52dbaschnot sure, I’m meta-confused
17:52technomancyrelevant https://twitter.com/geektastic/status/527456651578966017
17:53justin_smithhiredman: dunning-kruger? that's kind of a curve
17:53jamieenglishjustin_smith: thanks for looking. I'll have a quick stab at it and hopefully report back if I get anywhere
17:54technomancy"We come here upon what, in a large proportion of cases, forms the source of the grossest errors of mankind. Men on a lower level of understanding, when brought into contact with phenomena of a higher order, instead of making efforts to understand them, to raise themselves up ...
17:54justin_smithjamieenglish: I bet ##java would have more actual insight
17:54technomancyto the point of view from which they must look at the subject, judge it from their lower standpoint, and the less they understand what they are talking about, the more confidently and unhesitatingly they pass judgment on it."
17:54technomancy^ tolstoy had a good explanation for why people go "ugh parens"
17:54amalloytechnomancy: solution to non-problem: tell lazybot to /nick lazyBOT-this-is-a-BOT
17:54jamieenglishjustin_smith: cheers, I'll try there
17:54technomancyamalloy: nope, people would still miss it.
17:55amalloytechnomancy: a non-solution to a non-problem, then. seems like a good plan
17:57mmeixjustin_smith hyPiRion P.S. to the problem I had yesterday: found another solution without reduce :-) https://www.refheap.com/92493
17:57EvanR/nick NOT-A-BOT
17:58kenrestivowell i for one enjoy lazybot and clojurebot's weird quirkd
17:59hugodbbloom: re your conversation on stevedore, dsl's, etc, I am generally unhappy with stevedore being more than a syntactic translation. I would really like to be able to try using an equivalent of racket's #lang support to have stevedore look more like plain shell, and just add interpolation of clojure values.
18:00amalloymmeix: (defn runs [coll] (flatland.useful.seq/glue conj [] #(= %2 (inc (peek %1))) coll))
18:00hoangelosI'm using the clojure client. Is there a way to get the delete-directory to be recursive?
18:00justin_smithhoangelos: "the clojure client"?
18:01hoangeloswell. it's just a wrapper around the java client...
18:01hoangelosoops
18:01justin_smithhoangelos: what's the referent here?
18:01bbloomhugod: interesting
18:01hoangeloshilarious wrong room
18:01mmeixamalloy (flatland.useful.seq/glue) is new to me ... looks useful though
18:01amalloymmeix: it's super useful for batching of all sorts
18:01kenrestivowell of course it's useful, it's useful.
18:02amalloyand this has the upside that it's lazy-ish, or at least as lazy as partition is
18:02mmeixamalloy thanks! will try
18:03justin_smithmmeix: amalloy: not to be confused with gfredericks/useless
18:03mmeixhow do you people know about sich a lib? I wouldn't know how to search for something like that ..
18:03technomancysame way you solve every problem
18:03clojurebotTitim gan éirí ort.
18:03amalloymmeix: i wrote it
18:03technomancyask on IRC!
18:03justin_smithmmeix: well, amalloy knows about it because he wrote it
18:03justin_smithheh
18:03mmeixah! ok ... so:
18:04dbaschmmeix: now you know about it because you asked
18:04mmeix(inc amalloy)
18:04lazybot⇒ 183
18:04amalloybut useful is broad enough that it has answers to a lot of common problems; it might be worth your while to skim it and take note of anything you might want later
18:04amalloyhttp://flatland.org/useful/
18:04dbaschcontagiousness is the essence of virality
18:05mmeixthanks - this IRC channel is a constant source of wisdom for a beginner ...
18:07amalloyoh nice, i forgot i added flatland.useful.fn/ap
18:08amalloythe number of times i've written something like (-> xs (foo) (bar) (apply update-in [:x] inc)) and then been like "what the heck why doesn't this work"...
18:09amalloyer, except that inc of course doesn't want to be applied; imagine some other function for the example
18:09amalloywhen clearly i should be writing (-> xs (foo) (bar) ((ap update-in) [:x] inc))
18:10mmeixBTW: does anyone know about a introductory tutorial for derive?
18:11mmeix(maybe I should immerse myself into Joy of Clojure for this ...)
18:12mmeixbut for this evening: studying the treasures of flatland :-)
18:13justin_smithmmeix: my suggestion around derive was you can use multimethods to describe behaviors on various kinds of input, and then derive to build heirarchies of things with behaviors
18:13mmeixaha! ok ...
18:13justin_smithmmeix: the embryo of an idea there being that one could model musical domain knowledge about rules that way
18:14justin_smithbut it's not a totally solidified thing, may be hare-brained
18:15mmeixso derive is about multi-methods ...
18:15mmeixworth learning anyway I guess
18:15justin_smithmmeix: yeah, it's about describing a kind of inheritance or taxonomy
18:16mmeixin terms of methods?
18:16justin_smithmmeix: methods use isa? and isa? respects the taxonomies / heirarchies built by derive
18:17mmeixah, it's a more generalized concept
18:17mmeixsomething to let sink in for some days, I guess
18:17justin_smith,(derive ::cat ::animal)
18:17clojurebotnil
18:17justin_smith,(derive ::cat ::heatsink)
18:17clojurebotnil
18:17justin_smith,(isa? ::cat ::animal)
18:17clojurebottrue
18:18justin_smith,(isa? ::cat ::heatsink)
18:18clojurebottrue
18:19mmeixand ::cat would be a method/function ... , or just anything?
18:19mmeixsounds a bit like OO inheritance to my naive understanding
18:19mmeix(I'm really a beginner still...)
18:19justin_smithmmeix: a multimethod could have a method for ::animal
18:20justin_smithmmeix: a bit
18:20mmeixok
18:20amalloymmeix: it kinda is, yes. but it's a small piece of the object model (namely, polymorphic dispatch) without the rest bundled into it
18:20justin_smithright
18:20mmeixah! ::cat would be a dispatch value
18:20amalloyyes
18:20justin_smithmmeix: when provided with ::cat, it would match ::animal
18:21mmeix(light bulb)
18:21mmeixok, something to ponder on
18:21justin_smithin another context, it might match ::heat-sink
18:21justin_smithbecause a ::cat has many purposes, of course
18:21mmeixI guess I have to learn about the :: notation and it's meaning beforehand
18:22justin_smithmmeix: oh, that's pretty simple
18:22amalloymmeix: you can pretend, for this conversation, that ::x is the same as :x
18:22justin_smith,::foo
18:22clojurebot:sandbox/foo
18:22EvanRa keyword which has lower probability of colliding with someone elses
18:22mmeixsort of privileged keyword?
18:23EvanRnamespaces
18:23mmeixok, will read into this
18:24mmeixthanks to all! (again & again)
18:25mmeix(reading & REPLing)
18:28justin_smithdbasch: that object-relational-mismatch wikipedia article you linked has some hilarious barely-hidden edit war argument going on in it
18:32EvanRis there a function to convert an empty array to nil, only if empty
18:32EvanRi love nils
18:32justin_smithseq
18:32amalloy&(doc not-empty)
18:32lazybot⇒ "([coll]); If coll is empty, returns nil, else coll"
18:33EvanR,(seq ())
18:33clojurebotnil
18:33EvanR,(seq (1))
18:33clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
18:33EvanR,(seq '(1))
18:33clojurebot(1)
18:33dbaschjustin_smith: “I am mostly concerned about link to “How Vietnam Can Still Be Won” ... whereas the parent article is genuinely scholarly-like article on issue with OR/M technology, the latter is mostly (self-?)advertising heavily criticized in its comments as valueless.”
18:33amalloycould be seq or not-empty, depending on what you actually need
18:34justin_smithdbasch: wat
18:34EvanR,(not-empty '(1))
18:34clojurebot(1)
18:34EvanR,(not-empty ())
18:34clojurebotnil
18:34dbaschjustin_smith: from http://en.wikipedia.org/wiki/Talk:Object-relational_impedance_mismatch
18:34amalloyEvanR: the difference is what they do when called on [1]
18:34justin_smith,(not-empty [1 2])
18:34clojurebot[1 2]
18:34Bronsa,[(not-empty [1]) (seq [1])]
18:34clojurebot[[1] (1)]
18:34justin_smithyeah, not-empty is a better default if you care about the type of the input
18:34EvanR,(not-empty [1])
18:34clojurebot[1]
18:35justin_smithseq is just the one I use more often / remember more quickly
18:35amalloyi picked not-empty because EvanR said "array"
18:35amalloyand "only if empty"
18:35justin_smithbut there is no such thing as an empty array!
18:35EvanRwell in my mind its an array, but after going through these other standard functions it probably isnt
18:35justin_smithbut vector, yeah
18:35justin_smith:)
18:35SagiCZ1(doc derive)
18:35clojurebot"([tag parent] [h tag parent]); Establishes a parent/child relationship between parent and tag. Parent must be a namespace-qualified symbol or keyword and child can be either a namespace-qualified symbol or keyword or a class. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to, and modifies, the global hierarchy."
18:35EvanRbut not-empty seems more obvious maybe
18:35amalloyEvanR: probably not
18:35amalloyseq is a better default
18:35EvanRtheres no empty arra?
18:35amalloyonly use not-empty if you have some concrete reason to do so
18:35justin_smithEvanR: empty vectors sure
18:36justin_smithbut arrays are fixed size
18:36justin_smithEvanR: what would you do with an empty collection, with no facility for adding new elements?
18:36SagiCZ1if i am frequently acessing last item of some sequence, should i use reverse-chronological list (this accessing its head) or should a vector suffice?
18:36amalloyeither sounds fine, SagiCZ1
18:37justin_smithSagiCZ1: imho vectors are great for that, since you also get the intuitive behavior for first, nth, etc.
18:37EvanRjustin_smith: pass it to something that doesnt have a special case for empty
18:37EvanRmap filter etc work on empty things just fine
18:37SagiCZ1alright thanks
18:37justin_smithEvanR: ? what would that thing do with it? you can't change dimensions of an array
18:38EvanRi dont remember the last time i wanted to change the dimensions of an array
18:38justin_smithEvanR: so what would you do with a 0 length array?
18:38justin_smithI change dimensions of collections all the time
18:38justin_smith,(conj [] 1)
18:38clojurebot[1]
18:38dbaschjustin_smith: here’s the original article they referred to https://web.archive.org/web/20120329012639/http://www.thefreelibrary.com/Object+Relational+Mapping%3B+How+Vietnam+Can+Still+Be+Won-a01073854068
18:38EvanRthats mutating?
18:39justin_smithEvanR: that's making a new collection, with the other as a basis, arrays can't do that
18:39justin_smithvectors can
18:40amalloyi think EvanR's usage is not defined nearly well enough to be giving opinions about what the right way to do things is
18:40EvanRthis is a very interesting way to distinguish between various basically the same thing
18:40EvanRan abstract vector of things which supports "concat" (not mutating, not implying any implementation or optimizations or performance) should really have an identity element
18:41justin_smithOK, just saying that in terms of impl, if there is a way to make a zero length array, I don't know of it
18:41amalloyjustin_smith: ???
18:41lazybotamalloy: Yes, 100% for sure.
18:41amalloy&(object-array)
18:41lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: core$object-array
18:41EvanRthe notion in my mind sort of sounds like why does javascript have empty string
18:41amalloy&(object-array 0)
18:41lazybot⇒ #<Object[] [Ljava.lang.Object;@22b0ded4>
18:41justin_smithamalloy: d'oh!
18:41justin_smiththanks
18:41EvanRbut i did not know java cant make zero length arrays
18:42EvanRthat is interesting
18:42justin_smithEvanR: it can
18:42amalloyEvanR: it does, of course
18:42EvanRalright
18:42amalloyzero-element arrays are not very useful as things to write to, of course
18:42EvanRright... you can write to arrays ;)
18:43EvanRits all coming back to me
18:43EvanRi never even thought about writing to an empty array
18:44dbaschzero-length arrays are useful mostly for api compatibility
18:44dbasche.g. you get an array of search results from a java api, but there are no matches
18:45justin_smithdbasch: good point, I guess I would have expected Null for that, but that isn't handled so well in java
18:46amalloyof course java methods that work with arrays have not been very hip since like java 1.1. collections are a lot more workable
18:46dbaschnull would be bad design, because really you’re getting empty results and you’d have to special-case a null check
18:46dbaschamalloy: I’m talking specifically about Lucene
18:47justin_smithdbasch: my brain is too lispy, sometimes this is a problem
18:47EvanRin lisp, empty list is the same as null?
18:47amalloyEvanR: varies by language
18:48EvanRinteresting choice if it is
18:48justin_smithEvanR: historically (common lisp) it is, and it is reflected in clojure in places
18:48justin_smith,(cons 1 nil)
18:48clojurebot(1)
18:48amalloyEvanR: your background is haskell, right? in common lisp, for example, a list is defined basically like: data List a = Cons a d | Nil
18:49amalloyso the only way you could have an empty list is nil
18:49amalloy(and yes, i got the data declaration wrong, but i think you get the idea)
18:49dbaschalthough the Lucene api has changed, and it looks like the examples are out of date
18:49dbasche.g. “ScoreDoc[] hits = isearcher.search(query, null, 1000).scoreDocs;”
18:50bbloom<3 this clojure 1.7 :warn-on-boxed setting. got some nice wins on some otherwise reasonably well tuned code
18:50EvanRNil being a special symbol for Nil, nevermind, i vaguely remember reading about flamewars over this
18:51dbaschbut Lucene is one of the highest quality java libraries I know of
18:53andyfbbloom: give puredanger mad incs
18:53bbloom(mad-inc puredanger)
18:53bbloom(inc puredanger) ; plus a regular one
18:53lazybot⇒ 20
18:57justin_smithdbasch: other gems of that talk page include the argument that relational databases will inevitably be replaced by systems that tie data to code
18:58dbaschthat would be web scale
18:58dopamean_does anyone know of a good resource for adding things to the session map that ring provides?
18:58justin_smithdopamean_: assoc / assoc-in
18:58dopamean_right
18:58justin_smithdopamean_: it's just a map
18:58dopamean_however i thought i could only add i when a response was being sent or something
18:59justin_smith? you can add it whenever you like, just make sure to supply your modified version to the next stage
18:59dopamean_right thats the part that im confused about
19:00dopamean_the function that responds to the request calls another function that renders some stuff with enlive
19:00justin_smithyou add new data to the request map under the :session key, and then you pass that along
19:00amalloydopamean_: you want a middleware like: (defn with-magic [handler] (fn [req] (handler (assoc-in req [:session :magic] :activated))))
19:00amalloy(or anyway you might want such a thing)
19:01justin_smithdopamean_: {:body (enlive/whatever input) :session (update-session (:session request)) :status 200}
19:01dopamean_damn
19:02dopamean_that seems kind of obvious
19:02justin_smithdopamean_: well, it's using standard clojure data structures, but some of the consequences can be interesting and subtle if you are used to doing things another way
19:03amalloy(inc justin_smith)
19:03lazybot⇒ 113
19:03bbloomhttps://github.com/clojure/clojure/blob/b01adb859c66322c5cff1ca9dc1ad98585f2cdc1/src/jvm/clojure/lang/Compiler.java#L7552-L7553
19:03dopamean_thanks a ton
19:03dopamean_this helps a lot.
19:03amalloyhey, that is my second inc of you today. i must be in a generous mood
19:03bbloom^^ seems like that'll break w/ more than HASHTABLE_THRESHOLD fields (16)
19:05hiredmanbbloom: the bare array map constructor doesn't do any checks
19:05bbloomhiredman: ah yes, it doesn't call assoc
19:05bbloomcool thanks
19:06bbloomalways seemed a tad sketch to me that array map knows about hash map
19:06bbloombut such is the price of avoiding an extra level of indirection, i suspect
19:06andyfbbloom: Not sure why it would break, but Clojure definitely can create array maps larger than the threshold
19:07bbloomandyf: https://github.com/clojure/clojure/blob/b01adb859c66322c5cff1ca9dc1ad98585f2cdc1/src/jvm/clojure/lang/PersistentArrayMap.java#L200-L201
19:07EvanRwhat is "array map"
19:08justin_smithEvanR: one of the concrete implementations underlying clojure's hash-map
19:08andyfNot by that line of code, though :-)
19:08justin_smith,(class {:a 0})
19:08clojurebotclojure.lang.PersistentArrayMap
19:08justin_smith,(class (apply hash-map (range 100)))
19:08clojurebotclojure.lang.PersistentHashMap
19:08EvanRand "hash-map" is referring to just the map { }
19:08dbaschEvanR: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java
19:09bbloomandyf: yeah it's just jamming an array in there directly
19:09EvanRwhats persistent about it, beyond the usual?
19:09justin_smithEvanR: hash-map always creates a PersistentHashMap iirc, but literals can create ArrayMaps
19:09andyfI didn't track down how it happens, but saw some when adding some debug prints when fixing something else
19:10justin_smithEvanR: nothing, the naming differentiates from java stuff that is mutable
19:10justin_smithEvanR: well, nothing beyond the usual "persistent collection" meaning
19:10amalloyit's funny because array-map is one of the things in clojure that isn't really very persistent
19:10danielszmulewiczso many sql abstraction libraries... what's your favorite?
19:11andyfjustin_smith: EvanR: Wikipedia has article with reasonable dean of persistent data struct. It means something.
19:11justin_smithandyf: yes, sorry, I meant persistent in this case just means that, not that persistent was not a meaningful thing
19:11amalloyandyf: heh. "dean of persistent data structures" is a position i'd take
19:12justin_smithandyf: maybe I misunderstood his "beyond the usual" qualifier
19:12andyfDurn auto correct: dean -> defn
19:12EvanRso it means immutable
19:13amalloyEvanR: persistent actually means something stronger than that, but it's often used loosely to include anything immutable
19:13EvanRthis arraymap implementation is nice and simple, i can see how a small map can get some performance out of this
19:13amalloyit's kinda questionable to call PersistentArrayMap "persistent", but not totally wrong either
19:13EvanRi dont know what it means but im guessing it doesnt mean its still there after your jvm shutsdown
19:14EvanRand your computer reboots
19:14justin_smithEvanR: immutible, and also capable of sharing data as needed (though I am not sure if that is neccessary for the definition)
19:14EvanRyep that would be a free benefit of immutable
19:14dbaschEvanR: for that matter, databases are not too persistent in the face of potent magnets
19:14amalloyEvanR: have you read the wikipedia article andyf suggested?
19:15justin_smithEvanR: not quite free - you need the right kind of tree structure to make it really work
19:15dbaschbut persistent has a very specific meaning when it comes to data structures
19:15dbaschthat has little to do with durability
19:15amalloyyou guys are talking at cross purposes, justin_smith/EvanR
19:15justin_smithOK
19:15EvanRwhich article
19:15amalloyhttp://en.wikipedia.org/wiki/Persistent_data_structure
19:16EvanRinteresting
19:16EvanRthe context is an api which "modifies" an object
19:16amalloyjustin_smith was trying to talk about efficient structural sharing, where to EvanR it just sounded like pointer sharing
19:16EvanRim still not fully understanding what that means in clojure
19:17justin_smithamalloy: yeah, because that, to me, is what differentiates persistent data structures for other immutible data structures
19:17dbaschEvanR: there’s a good talk by bbloom about persistent trees
19:17dbaschlet me find it
19:18dbaschEvanR: https://www.youtube.com/watch?v=j649Tr25RyA
19:18dbaschslides http://www.slideshare.net/g33ktalk/software-dendrology-by-brandon-bloom
19:18justin_smithEvanR: maybe not so much about "modifying" an object, as making a variation without needing to copy the entire object in the process, while still not effectively altering the original
19:18amalloythat was a good talk. does he talk about the definition of persistence? i don't remember that part. i guess even so it's a good introduction to the data structures clojure uses to get well-performing persistent values
19:18bbloomdbasch: i'm glad you enjoyed my talk! but i think zach allaun gives the best intro to how the structures work: http://www.infoq.com/presentations/julia-vectors-maps-sets
19:19bbloomi didn't really set out to cover that
19:19justin_smithbbloom: that was like a reverse kanye
19:19bbloomjustin_smith: i'm not going to let you finish, since somebody else did the best thing OF ALL TIME
19:20TEttingerthat thing being https://www.youtube.com/watch?v=bP2FpVKlp1s
19:21TEttingermy brother made that, I just added two frames of video and uploaded it
19:21EvanRok, yeah, it makes sense to have a name for this when immutable is not the default
19:21bbloomit's more than immutable
19:21EvanReven though the apis in clojure ive seen so far dont have much to do with updating in place
19:22bbloomit's about structural sharing
19:22bbloomyou can achieve immutable w/ full clone on all writes
19:22justin_smithEvanR: it's not about mutation
19:22EvanRyeah, the java code to support this stuff has the option to copy or not, or update in place or not
19:22justin_smithEvanR: it's an implementation detail for immutability
19:24EvanRis there anything that does copy on write?
19:24EvanRhmm, i guess thats the default
19:24amalloyEvanR: well, array-map
19:24amalloywhich is why i said it's a bit awkward to call it PersistentArrayMap
19:24EvanRi meant to ask, is there anything that mutates if it knows nobody will be affected
19:24EvanRin place
19:24amalloyEvanR: transients
19:25EvanRok
19:25amalloyfor one example, see the definition of mapv
19:25justin_smithfor values of "it knows nobody will be affected" that include "it's your own fault if you thought you wouldn't be affected"
19:25amalloywhich modifies a transient vector in place until it's ready to return it, then converts it to a persistent
19:26EvanRmap doesnt just do that?
19:26justin_smithmeaning not that transients are sneaky, but there are ways to misuse them if you are not careful
19:26EvanRoh map produces a seq
19:26amalloyEvanR: it can't, because of laziness
19:26EvanRnevermind
19:27EvanRin ruby / javascript you get used to only have one "array"
19:27justin_smithyeah we have list / lazy-seq / queue / vector / array
19:27justin_smithall very distinct
19:27EvanRand map
19:27EvanRdidnt know about queue
19:27justin_smithyeah, that's not even sequential
19:28EvanRi didnt think it was, but its supporting all these sequential interfaces
19:28amalloyEvanR: speaking of ruby, mutability, and being used to having just one array: https://docs.google.com/presentation/d/1mGihUBBIKMQn5Uz-5DvQ1Vu24qSuk3o4yUoPoBZW3tI/edit#slide=id.g432ac727f_023
19:28justin_smith,(into [] (-> clojure.lang.PersistentQueue/EMPTY (conj :a) (conj :b) pop))
19:28clojurebot[:b]
19:29justin_smith^ queue
19:29SagiCZ1can if-let check if all the bindings are not nil? i know it works for one..
19:29amalloyjustin_smith: queue isn't sequential?
19:29justin_smithamalloy: I listed it with the sequential ones
19:29justin_smithI was saying map was not
19:29amalloyoh, i see
19:29EvanRnever use basically anything in ruby's array library
19:30amalloyEvanR: clojure's seq interface is a bit like Foldable. it's not just for things which are sequential, but for things which you can get a sequential view of
19:30EvanRno ! doesnt mean no shenanigans
19:30amalloyman i forget if you are the guy with a haskell background or not
19:30amalloyif not this was a silly comparison
19:30EvanR"haskell background" lol
19:30SagiCZ1,(if-let [a 5 b 6] (println a b))
19:30clojurebot#<CompilerException java.lang.IllegalArgumentException: clojure.core/if-let requires exactly 2 forms in binding vector in sandbox:, compiling:(NO_SOURCE_FILE:0:0)>
19:30EvanRdoes that exist yet
19:30amalloyit's like ruby's enumerable, kinda
19:30SagiCZ1okay
19:30amalloyEvanR: huh? haskell's been around for over a decade
19:31amalloyprobably over two, but i'm not sure
19:31dbaschruby bang is pretty random as an indicator of mutability
19:31justin_smithamalloy: ~2, for sure, I remember hearing about it in the late '90s and it wasn't brand new
19:32dbaschit’s more like “I bet you didn’t expect this to mutate stuff, did you?”
19:32dbaschthere are plenty of bang-less methods that mutate things
19:32EvanRthe similarly named ruby functions keep_if is the opposite of delete_if but doesnt mutate
19:32EvanRfor some reason
19:33technomancyI read ruby bang as a "there's another version of this that's non-destructive; that's probably the one you want" marker
19:33amalloyjustin_smith: 1990 for 1.0, apparently
19:33dbaschtechnomancy: to me it’s more like “read the docs for this because it may do unexpected shit”
19:33justin_smithcool, gonna be on a third decade before we know it
19:34dbaschtechnomancy: e.g. compact and compact! on arrays
19:34EvanRread the docs, then give up and read the source code, if you can
19:34EvanRbecause they write it using instance_eval
19:36hiredman/win 5
19:37justin_smithdbasch: let's change the names to pmap‽ and flatten‽
19:37EvanRamalloy: seq's interface seems to be, "get the next thing" and "unget a thing" https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ISeq.java
19:38EvanRrather than foldable
19:38dbaschwith the bonus that the interrobang makes them harder to type and you have to wait for autocompletion
19:38amalloywell, there's get the current thing and get the rest of the things, which is isomorphic to foldable
19:38noonianits get the next thing, and get everything else
19:38amalloycons is not exactly related to that
19:39EvanRfoldable is about reducing all the things with an accumulator
19:39EvanRthe cons thing is curious
19:40amalloyyes, and? that's the same as head/tail, in that you can implement one in terms of the other
19:41EvanRi dont think you can implement a head/tail with foldable
19:42EvanRmight be wrong
19:49amalloyEvanR: maybe not. it's easy to get head, but getting a tail that preserves the type is harder than i thought. they serve similar purposes, but i guess may not be isomorphic
19:51hyPiRiona tail that preserves type with foldr assumes the underlying structure has a tail in the first place. That's not necessary with foldable
19:52amalloyhyPiRion: i was imagining you could return a new foldable thing which delegates to the first one and ignores the first value of it, or fold over it with a function that knows how to ignore exactly one value
19:52amalloythe first is impossible; the second actually is probably doable now that i think about it
19:52hyPiRionamalloy: oh right, that you can do
19:52amalloybut both of those are really hard if you want to return something of exactly the same type as your input
19:52amalloywhen all you know is that the input is foldable
19:52hyPiRionThat's like, drop for foldables
19:53amalloyhyPiRion: right, which is easy in clojure, but not at all obvious for a more strictly typed thing. like, writing `rest :: Foldable t => t a -> t a` is harder than i thought
19:55SagiCZ1i decided to work with vectors but most clojure functions return seq.. should i always make sure to convert them into a vector?
19:55hyPiRionamalloy: it's possible to return a foldable though (t a -> Foldable a). Don't think you can be isomorphic
19:55amalloyhyPiRion: for sure that's possible, yes
19:55amalloybecause you can just write `rest = tail . toList`
19:56hyPiRionright
19:57amalloySagiCZ1: usually you should work with vectors only when you need some property of theirs that seq doesn't have; at other times, use a seq
19:58SagiCZ1amall
19:58SagiCZ1amalloy: i see, thanks
20:00SagiCZ1take-last sometimes returns something called Clojure.lang.Cons, why?
20:00justin_smith,(type (cons 1 nil))
20:00clojurebotclojure.lang.PersistentList
20:01SagiCZ1i did (take-last n vector-coll) and then (vector-coll index) and that throws clojure.lang.Cons cant be cast to clojure.lang.IFn
20:01hyPiRionjustin_smith: you have it the other way around: Cons returns list, list* returns cons
20:01hyPiRion,(type (list* 1 2 3 ()))
20:01clojurebotclojure.lang.Cons
20:02justin_smithhyPiRion: d'oh, of course, how could I not remember something so simple!
20:02SagiCZ1i dont know if i should care about it or stick to vectors or what :(
20:02justin_smithSagiCZ1: the return value of take-last is not callable, even if its input was
20:03technomancyjust don't pay attention to the class
20:03technomancypay attention to the interfaces
20:03amalloySagiCZ1: take-last is not a thing that vectors can do efficiently. maybe it's time to step back and think about what you need to be able to do to your collections
20:05SagiCZ1i really just need to just add a new value to it sometimes, read last n values from it.. and sometimes i need to trim some old values to keep it from growing too big
20:05justin_smithSagiCZ1: trim from which end?
20:05amalloythat sounds mostly like a queue
20:05justin_smithamalloy: I was wondering, yeah
20:06justin_smith,(into [] (-> clojure.lang.PersistentQueue/EMPTY (conj :a) (conj :b) pop))
20:06clojurebot[:b]
20:06justin_smithreusing an example I shared before
20:06SagiCZ1from the beginning
20:06SagiCZ1queue...
20:06justin_smiththe into is just being used for display purposes - it doesn't print nicely
20:06technomancyclojurebot: queuefish?
20:06clojurebotI don't understand.
20:06technomancyclojurebot: the hell you don't
20:06clojurebotExcuse me?
20:06SagiCZ1wait it totally is queue
20:07technomancybots these days
20:07technomancylazy slackers
20:07SagiCZ1:)
20:07justin_smith~quefish
20:07clojurebotI don't understand.
20:07hyPiRionlazybot: you heard him
20:08SagiCZ1the weird thing about queue is that you usually add new item to the head right? .. but that should be considered the "last" or "newest" item.. which usually has the highest index which is associated with tail in my head
20:09noonianthats an implementation detail of a queue imo
20:09justin_smithSagiCZ1: you can try out variations of what I put in above to see how it works - conj adds to the end, pop takes off the left (peek gets the item you would have popped)
20:10SagiCZ1and is that the only way to create this queue in clojure? there is nothing similar to 'vec', 'vector' or something?
20:10amalloySagiCZ1: curiously enough, no, there is no better way built in
20:11justin_smithSagiCZ1: because you always start with an empty one, right?
20:12SagiCZ1justin_smith: i guess so
20:12justin_smiththough many of us would like a prettier syntax for the empty one built in
20:12justin_smiththat's what technomancy was talking about with queuefish
20:12SagiCZ1,(clojure.lang.PersistentQueue)
20:12clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Class cannot be cast to clojure.lang.IFn>
20:12technomancyjustin_smith: no, this is clearly the deranged utterings of a madman
20:12SagiCZ1,(clojure.lang.PersistentQueue/EMPTY)
20:12clojurebot#<PersistentQueue clojure.lang.PersistentQueue@1>
20:12technomancydon't try to read sense into it
20:13justin_smithSagiCZ1: it's an empty coll, not a function that generates an empty coll
20:13justin_smithoh wait, it also returns itself when you call it? funny
20:13justin_smithnever thought to try that
20:13justin_smithoh wait
20:13justin_smith,(Math/PI)
20:13clojurebot3.141592653589793
20:13justin_smithit's that thingy
20:13justin_smithinterop can be weird
20:13technomancybot quirk?
20:13SagiCZ1wait what, thats odd
20:14SagiCZ1works in my repl too
20:14justin_smithtechnomancy: nope, it's a legacy thing I guess?
20:14technomancyhuh
20:14justin_smithit's always worked
20:14SagiCZ1it was actually a newb mistake, i didnt want to use the parens
20:14justin_smithit's weird
20:14amalloytechnomancy, justin_smith: (Foo/bar) worked before Foo/bar was introduced
20:14justin_smithSagiCZ1: right, then I tried to figure out why it worked :)
20:14justin_smithamalloy: right, legacy
20:14technomancyno kidding
20:14technomancydeep magic from the dawn of time
20:15SagiCZ1i guess i could just make some tiny wrappers for the queue to make it more readible in my code.. what's stopping me right
20:15amalloySagiCZ1: folks usually do
20:15justin_smith,queue-fish
20:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: queue-fish in this context, compiling:(NO_SOURCE_PATH:0:0)>
20:15justin_smith~queue-fish
20:15clojurebotPardon?
20:15SagiCZ1~tired?
20:15clojurebotGabh mo leithscéal?
20:16justin_smithanyway queue-fish is https://groups.google.com/forum/#!topic/clojure-dev/GQqus5Wycno
20:16SagiCZ1thanks
20:19justin_smithI think a readable print is a bigger deal with queues - unlike anything else that is sequential and persistent, they don't have a nice printed representation that shows the contents.
20:20SagiCZ1justin_smith: how come? isnt queue also a sequence of some sort?
20:21justin_smithit is, but it prints ugly
20:21justin_smith,(conj clojure.lang.PersistentQueue/EMPTY 1)
20:21clojurebot#<PersistentQueue clojure.lang.PersistentQueue@20>
20:21justin_smithno hint of the contents
20:21justin_smith,(seq (conj clojure.lang.PersistentQueue/EMPTY 1))
20:21clojurebot(1)
20:22SagiCZ1oh i see
20:26justin_smithbut anyway, if you want to add on one end, and drop from the other, you do definitely want a queue, probably that one
20:26justin_smitheven if it doesn't print nicely
20:27technomancyclojurebot: queuefish is print-method magic to get (conj (conj clojure.lang.PersistentQueue/EMPTY 12) 9) ; -> <-(12 9)-<
20:27clojurebot'Sea, mhuise.
20:27technomancyclojurebot: queue-fish is queuefish
20:27clojurebotc'est bon!
20:28hiredman~queuefish
20:28clojurebotqueuefish is print-method magic to get (conj (conj clojure.lang.PersistentQueue/EMPTY 12) 9) ; -> <-(12 9)-<
20:28hiredman~queuefish
20:28clojurebotqueuefish is print-method magic to get (conj (conj clojure.lang.PersistentQueue/EMPTY 12) 9) ; -> <-(12 9)-<
20:28hiredmanblegh
20:28hiredmansome day
20:29amalloyhiredman: hm?
20:29justin_smith,(seq (conj clojure.lang.PersistentQueue/EMPTY 12 9)) ; bike shedding a factoid
20:29clojurebot(12 9)
20:30technomancyhttp://p.hagelb.org/mrfp.gif
20:30hiredmanamalloy: clojurebot assumes 'is' means equivalence so it is free to permute and infer
20:30amalloyright...which i thought technomancy was using on purpose to create two copies of that factoid
20:31hiredmanbut you also get queuefish is queue-fish out of that too
20:31technomancyI was hoping for a redirect but ... who can fathom the mysteries of clojurebot
20:31technomancydang
20:31justin_smith~queue-fish
20:31clojurebotqueue-fish is queuefish
20:31hiredmanhence my "some day"
20:38Bronsabbloom: the compiler silently ignores type hints in so many places it's not even funny
20:39amalloy*sigh* i just wrote a lexicographic sort for vectors of 1-2 elements out by hand. why didn't i just use some standard sort thingy?
20:40justin_smithamalloy: I am sure your version is unrolled and super-duper optimized
20:40tuftamalloy: at least you haven't typed it in yet
20:42gfredericks,(sort [[1 3] [5 4] [3 3]])
20:42clojurebot([1 3] [3 3] [5 4])
20:42amalloygfredericks: that's fine for 2 elements
20:42amalloytry 1-2
20:42andyfBronsa: t.a.j used to throw on (extend-type (class (log-window-proxy nil)) ...) but latest does not. That sound intentional to you? I think it was.
20:42gfredericks,(sort [[1 3] [5 4] [3]])
20:42clojurebot([3] [1 3] [5 4])
20:42gfredericks,(sort-by (juxt first second) [[1 3] [5 4] [3]])
20:42clojurebot([1 3] [3] [5 4])
20:43amalloyhm, that's a good point
20:43amalloy,(sort [nil 4])
20:43clojurebot(nil 4)
20:43gfrederickswoah did I just show amalloy how to use juxt to solve a problem
20:43gfredericksI think I just beat #clojure
20:43justin_smith(inc gfredericks)
20:43lazybot⇒ 101
20:43andyfAndyf's mind also blown
20:44andyfgfredericks: Wait, you can still hear us? You were supposed to go to the next level.
20:44Bronsaandyf: t.a.j should still throw on that, it's probably getting caught by the wrong-tag handler though
20:44Bronsaandyf: by eastwood's wrong-tag-handler, that is
20:45Bronsa(inc gfredericks)
20:45lazybot⇒ 102
20:45andyfBronsa: Got it. I still need to tweak the wrong tag linter better
20:45gfredericksandyf: hold on let me take out the cartridge and blow in it
20:46andyfgfredericks: No like red/blue pill next level
20:48Bronsaandyf: btw have you seen missing line/col info by any chance?
20:49andyfBronsa: Some but not a lot. I try to improve thosr when I can but I may run out of steam on some of them for nect
20:49andyfNext release , except to create an issue
20:50andyfSteam, meaning enthusiasm for debigging every last thing
20:50andyfI am on fire with typos today
20:51amalloydebigging. apple autocorrect strikes again?
20:51amalloyi can't imagine that's even in their dictionary though
20:51andyfTo manager: yeah I just need to debig my code a bit more and we'll be ready to ship.
20:51gfrederickss/ship/shup/
20:52justin_smith"this is messed up because of a method too large error, time for some debigging"
20:52andyfThat was just iPhone fat fingers
20:52gfredericksandyf: you're halfway to the correct kiwi pronunciation
20:52Bronsaandyf: yeah no worries, I was just asking bcos I saw some missing source info earlier and that shouldn't happen
20:52BronsaI think I have a fix though.
20:53andyfNice
20:58bbloomBronsa: yeah, true
20:59bbloomBronsa: i guess the issue i hit was that the type hints are inconsistent between symbols and class objects
20:59amalloywell, in fairness to me it looks like i at least got the case analysis right on my hand-unrolled compare-via-juxt
20:59dbaschdebigging code embiggens my salary, it’s a perfectly cromulent use of my time
21:00Bronsabbloom: andyf can attest how many open source libs (even big ones) have wrong/useless tags
21:00bbloomyeah, i'm ok with useless tags
21:00bbloomi rather over tag than under if they aren't doing harm
21:00bbloomi'm just not ok with silent slowness that i can't find easily
21:00Bronsabbloom: by useless I mean possibly useful tags in position where the compiler will ignore them
21:00bbloomand i really do believe slow and working is a better default than ONLY FAST but compiler type checking headache trying to get it there
21:01andyfThe rules for which ones are useful are not something I keep on my head even yet
21:01bbloomyeah
21:01bbloomi have this project that has a bunch of bits that need to be super fast, but those bits are also really tricky to get right and have a ton of duplication that macros can solve for me
21:01bbloomgetting fast code generated is proving reasonably tricky
21:02bbloomand it's probably likely i'll convert a bunch of key bits to java to get the maximum perf in some corner cases
21:03bbloomtakes some mental energy to resist the urge to optimize/rewrite like crazy, but it's worth the mental energy savings in being able to work in clojure to start with
21:03dbaschbut sometimes it’s necessary to leave the clojure bike and drive the java minivan
21:04bbloombut fixing some unboxed math right now involved some definlines and whatnot... got me a 40% win on one of the most important fast paths
21:04Bronsanice
21:04bbloomi haven't dug too deep in to the byte code, but i suspect that i can do even better
21:05Bronsa... according to core definline/:inline should be avoided
21:05hiredmancore is so weird
21:07bbloomgiven the commitment to back compat, seems unlikely for definline to go away
21:07hiredmanindeed
21:08bbloomand although it's ugly as hell to template-ize syntax-quote whole functions, it considerably speeds up my inner loop
21:08bbloomi've got 3 definline usages, for a total of about 15 lines of code and 7 call sites in a ~5k program that does some pretty funky low level stuff to begin with
21:09bbloomi'm comfortable w/ the tradeoffs, although i wish for a language that scaled to the lowest level more gracefully
21:09bbloomthat said, clojure is surprisingly graceful at it compared to pretty much any other dynamic language i've ever used (although i've never done any perf work in CL)
21:11turbofailyou can do all sorts of grungy low-level things in SBCL, including going down to assembly
21:11turbofailoh hey look that /msg spammer is back
21:11turbofailzoom__: find a new link at least
21:11TEttingersolo hoy!
21:11TEttingeronly now! can you be spammed
21:18marcuscreohowd
21:18marcuscreohowdy
21:21Bronsaandyf: source-info should be fixed for good now
21:23andyfI'll give it a whirl and see what happens.
21:30mdeboardhiredman: Is techsonian.net related to techsonian.com?
21:46gfredericksdoes clojurescript include a format function these days? if not where would I get one?
21:48justin_smithgfredericks: clojurescript.net lets me use format
21:49gfredericksgrepping the cljs repo suggests it's not provided
21:49gfredericksI think it was in the past though
21:49justin_smithhttp://clojurescript.net/ works in this repl
21:50gfrederickshttp://dev.clojure.org/jira/browse/CLJS-324
21:50gfredericksclojurescript.net is a whole nother impl amirite?
21:51justin_smithoh yeah, it is the self hosting version from kanaka
21:51justin_smithnever mind that then
21:51gfredericksI guess I'll try goog.string.format
21:52gfredericksactually I think that's probably what this code was using implicitly anyhow
22:11csd_Anyone know how to set autoreconnect=true in Korma?
22:21arrdemdbasch: ping
22:21dbaschpong
22:26danneui didn't know assoc could take more than 1 k/v pair. slightly nicer than using merge when the kvs you're merging weren't already in a map.
22:27justin_smithhow would merge be better if they were?
22:28justin_smith,(assoc {:a 0} :a 42 :b 1 :c 2)
22:28clojurebot{:c 2, :b 1, :a 42}
22:28danneuwhen you're actually merging map data
22:28justin_smithmow, merge-with on the other hand
22:28justin_smithoh, I misread
22:29justin_smith*a map
22:30gfredericks,(merge-with #(list %1 %2 %1 %2) {:a 0 :b 5} {:b 7 :c 8})
22:30clojurebot{:c 8, :b (5 7 5 7), :a 0}
22:31gfredericks,(merge-with #(list %1 %2 %1 %2) {:a 0 :b 5} {:b 7 :c 8} {:b 2})
22:31clojurebot{:c 8, :b ((5 7 5 7) 2 (5 7 5 7) 2), :a 0}
22:31gfrederickswee
22:35justin_smith,(defn combine [a & rest] (letfn [(vectorize [v] (into {} (map (fn [[k v]] [k [v]]) v)))] (reduce (fn [a b] (merge-with into a (vectorize b))) (vectorize a) rest)))
22:35clojurebot#'sandbox/combine
22:35justin_smith,(combine {:a 0 :b 1} {:a 42 :b 420} {:a -1 :b 666})
22:35clojurebot{:b [1 420 666], :a [0 42 -1]}
22:36justin_smith,(combine {:a 0 :b 1} {:a 42 :b 420} {:a -1 :b 666 :c 3})
22:36clojurebot{:c [3], :b [1 420 666], :a [0 42 -1]}
23:30ddellacostafolks: https://groups.google.com/forum/#!topic/clojure/AYe1opodrGA
23:31ddellacosta(hope it's okay I push that here)
23:31ddellacosta(let me know if not and I'll abstain)
23:39amalloyddellacosta: seems totally fine to link to once. more than once would probably be uncouth
23:39ddellacostaamalloy: gotcha, thanks--I'll leave it at that. It's on the list so presumably folks will find it there anyways.
23:52TimMcddellacosta: My only feedback is that I don't know why I'd bother clicking the link, other than that I'm a folk. :-P
23:53ddellacostaTimMc: ah, good point. Job posting for Clojure dev/sysadmin devops position. :-)
23:53TimMcBest of luck!
23:53ddellacostaTimMc: thanks!
23:56TimMcHave you tried http://functionaljobs.com/ ?
23:57ddellacostaTimMc: not yet, we are still going through our options
23:57TimMcIf I were looking for a Clojure position, that's probably the first place I'd check, but maybe 'cause I just happen to know about it.
23:59ddellacostaTimMc: hmm, good to know!