#clojure logs

2014-03-05

00:06SegFaultAXSince we were talking about clojars earlier, RubyGems' AWS bill: https://www.dropbox.com/s/3v13d2g8klwer3d/AWS%20-%20RubyCentral%20-%20Feb2014.pdf
00:07dissipateSegFaultAX, wow, guess clojure isn't nearly as popular as ruby
00:08dissipateSegFaultAX, oh and look, they are using a CDN. fancy that.
00:08SegFaultAXdissipate: No reason to be a dick about it.
00:11dissipateSegFaultAX, i offered to donate. was turned down. how is that being a dick?
00:13SegFaultAXdissipate: That's not the part people took issue with. It's the perceived tone of what you're saying. It /feels/ like you're being hostile because that's the tone that comes across from the text.
00:14dissipateSegFaultAX, sorry about that. i really do want to donate.
00:15_ato2wow 6126 GB out, $735 / month.
00:15SegFaultAXdissipate: No apology necessary.
00:21xeqiSegFaultAX: theres a Q/A going on about it at https://news.ycombinator.com/item?id=7345279
00:22SegFaultAXxeqi: Yea the maintainer has some good insights.
00:48Null_AMan, the team that i'm only is vouching to rewrite the whole codebase because as far as I'm concerned it's negativity towards clojure
00:49Null_Amakes me sad
00:50dissipateNull_A, any more details on the situation? how large is the code base?
00:50Null_AI can't really say too much
00:51Null_Ait's on the order of a tens thousands of lines
00:52Null_Athe cite reasons like not enough tooling, like intellij not working with clojure
00:53dissipateNull_A, damn, that's a lot of LOC for a clojure app
00:53Null_Ayup
00:54Null_Athey want to rewrite in C++, so good luck with that
00:54dissipateNull_A, so a big app was written and they just now started complaining? are these the managers?
00:54Null_Athey might be digging their grave
00:54dissipateNull_A, bwahahaha
00:54Null_Ait's a long story
00:54dissipatecee plus plus
00:54Null_Amanagement is certainly playing a role
00:54dissipateOMG, i can't imagine a 10,000 line clojure app in C++
00:55Null_Abecause they say it's hard to hire clojure programmers
00:55Null_Abut also other engineers on the team just aren't accepting clojure in general, some more than others
00:55dissipateNull_A, it probably is if their projects are boring
00:55Null_AI think it comes down to them not taking the time to actually learn it..
00:55Null_Athey keep saying it's not intuitive
00:55Null_Athese are not functional programmers by school
00:56dissipateNull_A, they will indeed dig their own grave
00:56dissipateit is probably going to be an absolute nightmare porting that code to C++
00:57dsrxhow did 10k LOClj get written without anyone learning clojure?
00:57Null_Athey're definitely going to try and chop away certain aspects of the system if they port it
00:57ddellacostaseriously, sounds like one or a few engineers railroaded the rest into using Clojure.
00:57Null_Atehre's no way the could do a verbatim port in C++, i doubt that project would ever see the light of day
00:58Null_Athey're making different tradeoffs in the new system, e.g. consuming way more RAM
00:58dissipateddellacosta, yeah, sounds like it to me.
00:59Null_Adsrx: it was me and a couple other people
01:00Null_Adsrx: but they all left except for me, and we hired new people
01:04dissipateNull_A, these new people were hired without finding out of they wanted to do Clojure development?
01:10Null_Adissipate: yup
01:10dissipateNull_A, well, damn. i wish i was one of them.
01:11ddellacostaNull_A: are you in the U.S.? What city (if you can say)?
01:11Null_Ai'm in U.S. yah
01:11Null_Addellacosta: why do you ask?
01:12RaynesNull_A: That van that has been sitting outside your place...
01:12Null_Adissipate: send me your resume :)
01:12Raynes(that's him)
01:12ddellacostaNull_A: just curious. I see a lot of folks on the Clojure mailing list interested in jobs, when jobs pop-up. Most of the jobs are in the U.S. as far as I can tell. I'm wondering why whoever did the hiring there didn't post the position(s) on the Clojure mailing list.
01:12ddellacostaRaynes: sssh!!
01:12ddellacostano one is supposed to know
01:12dissipateNull_A, do you guys allow working remote?
01:13Null_Adissipate: outside of US? not likely
01:13dissipateNull_A, i'm in the U.S. San Diego to be more precise.
01:14Null_Adissipate: are you open to moving?
01:15koreth_I recently convinced a friend of mine who runs a startup in China and is having trouble finding good developers that he should try migrating his app over to Clojure and advertising for Clojure programmers instead of Java ones, on the theory that they are small in number but high in quality and eager to find jobs. So if any of you guys want to learn Chinese...
01:15dissipateNull_A, unfortunately, no. i'm too tied down to San Diego with family and other stuff.
01:15Null_Ahm, I don't think it would work :(
01:16dissipateNull_A, :(
01:16dissipatekoreth_, doesn't it take years to really learn Chinese?
01:18dissipatekoreth_, a startup on Java? that doesn't sound good
01:18koreth_dissipate: Yes and no. You can be functional enough to get by in a matter of months if you're dedicated and you're immersed 24x7. But reading takes a long time to learn which is a big hindrance to learning quickly.
01:19dissipatekoreth_, yeah, i can see how learning 30,000 characters would be a speed bump
01:19koreth_dissipate: My friend isn't a technical person (it's a startup in the medical field and he's an MD) and the architect he hired initially had him on .NET. So Java is a step up.
01:20koreth_dissipate: 3500-5000 is more typical for a college-educated person. Only a small handful of academics actually know 30,000 characters, though that many do indeed exist.
01:21koreth_But that's still a lot.
01:21dissipatekoreth_, does this 'architect' actually write code?
01:22koreth_No, the guy was a complete bozo who talked a good talk. He's long gone. But the Chinese educational system is churning out Java programmers like crazy right now and that's pretty much what you get unless you're looking for something else in particular.
01:23dissipatekoreth_, perhaps he should look for Scala developers
01:24cespare|homeIs there a function that can apply f to coll and return the first result which is not nil?
01:24koreth_That'll be my second suggestion if Clojure doesn't work out. The reason I suggested Clojure in particular is because it seems more likely to select for way-above-average programmers than Scala will (just due to Scala being much more popular) and I think what he needs now is some higher-skill people to round out his team, which is basically all junior devs.
01:25cespare|homeI can do (first (map ... I suppose.
01:25dissipatekoreth_, if i were doing a startup, i would do Clojure and Python, perhaps with some C sprinkled in
01:26koreth_His people seem like they're not stupid, just really inexperienced, so I think they could come up to speed and be productive in Clojure.
01:26Null_AI think clojure might be weeding out bad programmers
01:26Null_Aif they can't compute all the higher level abstractions in their head
01:26cespare|homeor maybe it just breeds elitist bullshit
01:27Null_Ahaha
01:27Null_Aor maybe both
01:27koreth_Definitely some of both.
01:27Null_AOne of the quotes I heard from someone at the office "It's true that 1 line of clojure translates to 5 lines of C++, but at least with the C++ I know what's going on"
01:28Null_Aor that "succinct code" is actually used with negative connotation
01:28koreth_They obviously don't do C++ template programming.
01:28segmondn #elixir-lang
01:29koreth_If I were starting from scratch and wanted a C++-ish "kitchen sink" language I'd take a serious look at D instead. Haven't done anything real with it but it seems much more well-thought-out than C++.
01:29dissipateNull_A, are you kidding me? OOP is a tangled mess.
01:30alewcespare|home: ,(some identity [nil nil nil nil "yay"])
01:31alewcespare|home: it will also ignore false though
01:35Null_Adissipate: i know i feel like they want to bring to team back to the dark ages
01:36Null_AI know C++ very well, i written way more C++ than clojure, and there's a reason I haven't written any c++ in a few years
01:36Null_Arich hickey speaks the same gospel
01:37bellkevddellacosta: can I trouble you with a quick oauth2 question?
01:38cespare|homealew: thanks
01:50dissipateNull_A, did you know that not even Bjarne Stroustrup has memorized the entire syntax of C++
01:50Null_Alol
01:50Null_Ano
01:51dissipateNull_A, yep. i don't understand the desire for huge syntaxes.
01:51Null_Adissipate: me neither, i don't understand the desire for english looking syntaxes either (ruby)
01:52Null_Ait doesn't help me program
01:52Null_Ai'd rather learn simple rules
01:52dissipateNull_A, Perl
01:53dissipateNull_A, is there any legitimate need for a language to have a huge syntax?
01:54Null_Adissipate: maybe it helps certain kinds of people think better dunno
01:54Null_Athere's more 'landmarks' for their brain to pick up on *shrug*
01:55notostracaheh, APL has a very straightforward syntax. it just goes left and right in very strange ways...
01:56notostracaI don't think that simple syntax necessarily means easy to read
01:57notostracait does however allow you to use macros without making your hair ignite
01:57dissipatenotostraca, yeah, but there are a ton of symbols. it's pretty much unreadable.
01:57notostracadissipate, are you talking about clojure here?
01:57notostracabecause I have had that complaint ledged against clojure I've showed to people
01:58dissipatenotostraca, no, APL
01:59dissipatenotostraca, clojure has a lot to learn in the core libs, but that's unavoidable.
02:00notostracayeah that's kinda the point of APL, it was to use terminology from math (including many symbols) rather than the traditional short ASCII names of the time
02:01notostracaI think when I program in clojure I do sometimes side with terseness over clarity...
02:01dissipatenotostraca, well, that failed
02:01dissipatenotostraca, good luck reasoning about APL programs
02:02notostracaoh yeah, there's no way to do that
02:02notostracabut my point is, the precedence rules are _barely_ more complicated than clojure's
02:03notostracalike lisp, it's a "syntax? what syntax?" language
02:03notostracabut it still manages to be very very hard to read
02:04dissipatenotostraca, no, but all of the symbols in APL are part of the core of the language
02:04dissipatenotostraca, i consider those syntax.
02:05dissipatenotostraca, and the rules for those symbols are quite complex
02:06dissipatenotostraca, nonetheless, APL itself has pretty much died out. there is a more modern successor called J that is backed by a company.
02:06notostracathat's much like saying map is syntax (in fact, it's the double dot in APL)
02:06notostracaI know
02:06dissipatehttp://www.jsoftware.com/
02:06notostracaJ is GPL now actually, not sure if it's still heavily backed
02:07dissipatenotostraca, there is actually a pretty cool 'kit' you can download for J that has tutorials and other goodies
02:07dissipateseems quite interesting for doing 3D programming
02:07notostracabut I think you missed my point
02:07dissipatenotostraca, which is?
02:09notostracaJ and APL have (IIRC) the same rules for precedence, which is their only syntax. Lisp has prefix notation, J and APL have two kinds, one reads arguments from one side (monadic) and one from boths sides (dyadic)
02:09seancorfieldI saw the J talk at Lambda Jam last year and found it a lot less readable than APL
02:09notostracathis can be described a lot more easily than C++ syntax of course, but it's still very very hard to follow the path a program takes
02:11notostracaI think clojure's in the sweet spot of tersness and readability, but it took me a long time to get proficient enough to think that
02:13dissipatenotostraca, but you have to take into account the complexity of the builtins. J's builtins are very complex.
02:16muhoowhy does david use (fn [] foo) in om examples instead of (constantly foo) ?
02:18apgwozhi all -- I'm having a problem with 1.5.1. I get an IllegalAccessError when trying to require clojure.string/replace
02:18apgwoz(require '[clojure.string :refer [replace]])
02:18apgwozIllegalAccessError replace does not exist clojure.core/refer (core.clj:3849)
02:19apgwozYet, :refer [replace-first] works fine.
02:21ambrosebsapgwoz: hmm have you tried a `lein clean`?
02:21apgwozi have not. i'll try now.
02:22apgwozha!
02:22apgwozyes, that worked. thanks ambrosebs!
02:22ambrosebsapgwoz: :)
02:22ambrosebsyou just can't explain that
02:23apgwozhehe. i guess not.
02:24apgwozsort of like old macs, in which the solution was always to repair permissions.
02:29jjroIs it possible to write macro so that (= [ (my-macro :a) ] [ [:a] [:a] ])
02:32jjrothe problem I'm trying to solve is following: [:body
02:32jjro (current-user user)
02:32jjro (logo)
02:32jjro (topmenu)
02:33jjroI would like to combine current-user, logo and topmenu as a list elements after :body
02:43mr-foobarCan I use lein to point to a folder as a dependency ?
02:57ddellacostamr-foobar: you probably want one of two things--checkouts (https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies) or to just use lein install in a different project directory.
02:57ddellacostamr-foobar: not sure how else you'd use lein to pull in third-party code, but perhaps there's a way.
02:58ddellacostabellkev: sorry I was in a meeting. :-(
03:00mr-foobarddellacosta: checkouts solves it. thx !
03:00ddellacostamr-foobar: great!
03:01ambrosebs,`[:body ~@(concat [1 2] [3 4])]
03:01clojurebot[:body 1 2 3 4]
03:01ambrosebsjjro_: ^^ does that help?
03:22mheldhey y'all
03:22mheldwe're hiring clojure guys and data scientists at my company -> http://weft.io
03:22mheldanybody in BOS or SFO looking for gigs?
03:24KneivaBrotherhood of Steel
03:26koreth_Any Laser experts in the house? I am getting a NullPointerException from what I think is a super-simple usage of the API. Clearly I am doing it wrong but I'm too dumb to see where the mistake is. Stripped-down example at http://pastebin.com/bamMDWXB
03:27ddellaco_mheld: what does "Clojure guy" mean (in terms of what you expect people to know)?
03:27ddellaco_mheld: not that I'm looking right now, just curious
03:29ohcibihi.. i have a simple question about -> which I want to google for... how to google for ->? 8-))
03:29mheldddellaco_: honestly, as long as you can manage yourself (aligned with the interests of the company), we don't particularly care
03:29ohcibii.e. what is the name of this operator, i know it has a special name but I forgot it
03:29ambrosebsohcibi: thrush iirc
03:29mheldddellaco_: we're a clojure shop, so, of course we'd like it if you knew at least a little clojure
03:29clgvohcibi: just ask here ;)
03:29mheldddellaco_: but it's all learnable
03:30clgvmheld: where are you located?
03:30mheldBOS + SFO
03:30minikomihi
03:30clgvah ok
03:30ohcibiclgv: usually i'd like to google before asking here 8-)) but the question is simple: how to pass any further arguments to one method in the chain?
03:30clgvohcibi: for example like ##(->> (range 7) (map inc) (filter even?))
03:30lazybot⇒ (2 4 6)
03:31ohcibiclgv: exactly.. so I actually was loooking for ->>?
03:31clgvohcibi: in words just write the function call without the first argument for -> and without the last argument for ->>
03:32clgvohcibi: I dont know. the choice of -> vs ->> is only about where the threaded data is inserted in the subsequent calls
03:32maxthoursieohcibi: it's called the threading macro
03:32clgv#(-> 20 (- 5) (* 2))
03:33clgv,(-> 20 (- 5) (* 2))
03:33clojurebot30
03:34koreth_,(->> 20 (- 5) (* 2))
03:34clojurebot-30
03:34ohcibiah, now I understand.. so in order to apply any additional arguments I just write a normal function call instead of just the function symbol
03:35ohcibie.g. (-> some-initial-return-value (another-method-with params))
03:35clgvohcibi: yes.
03:35koreth_ohcibi: exactly like that
03:35ohcibiokay.. thank you
03:36clgvin fact the no-args scenario without the list is a comfortable special case
03:37ohcibithe example I had at hand were about JFrame pack! and show! interop with seesaw. neither pack! nor show! needed any additional arguments and without the name I felt unable to google further 8-)
03:38ohcibiso knowledge now
03:38clgvohcibi: that's one of the cases where clojuredocs.org could have helped you. just for future reference^^
03:39clgve.g. http://clojuredocs.org/clojure_core/clojure.core/-%3E
03:39ohcibiclgv: still.. what should I have entered into the searchbox?
03:39ohcibioh
03:39ohcibik
03:39ohcibididnt tried it like that..
03:39koreth_Speaking of clojuredocs.org, anyone know what's up with it? It's still stuck on 1.3.
03:39ohcibilucky guy
03:39ohcibigoogle sends you rightaway to 1.2.0
03:39ohcibi(in most of the cases)
03:40clgvkoreth_: there were rewrite intentions but seems as if the participating guys didnt mange to get it done yet
03:40clgvmaybe they are to ambitious
03:41clgv*too
03:45clgvkoreth_: https://github.com/zk/clojuredocs
03:46clgvkoreth_: or maybe that one https://github.com/dlokesh/clojuredocs-docset
03:47koreth_I heard they were rewriting it but I can't find any indication of what the holdup is. Just lack of time to put into it, or are there specific things that contributors could help out with?
03:48koreth_The open issues on Github don't seem to answer the question.
03:49charewhat does -> mean in (->Book "title" "author")
03:49clgvwell that's the problem. they do not seem to communicate the problems.
03:49clgvchare: it is a constructor function for the deftype/defrecord called Book
03:50clgvchare: I think it means as much as convert args to object
03:51clgvkoreth_: https://groups.google.com/forum/#!searchin/clojure/%22clojuredocs.org%22|sort:date/clojure/eryt7REIp6o/E-IMIGv3rPYJ
04:04Pate_I'm busy doing 4clojure.com problem #100 to calculate the Least Common Multiple of a variable number of positive integers *or ratios*. How does LCM apply to ratios, when the definition of an LCM is "the smallest positive integer that is divisible by both a and b"?
04:04Pate_e.g. one of the unit tests is: (== (__ 3/4 1/6) 3/2)
04:04Pate_where is the function we are solving for.
04:05Pate_*__
04:05Pate_4clojure link: http://www.4clojure.com/problem/100
04:10minikomi@Pate_ if it helps, ,(mod 1/3 1/6)
04:11dpathakjPate_: consider what a sensible definition of 'least common multiple' for fractions expressed in common terms might be. write the two fractions in common terms. you have 9/12 and 2/12. now what would a least common multiple mean?
04:11ohcibiPate_: if you have two numbers and b, you are searching for the smalles n in a*n = x && b*n = x, only n has to be an integer
04:11Pate_right, but 3/2 is not an integer?
04:12ohcibiPate_: 3/2 is a or b, not n
04:12Pate_(== (__ 3/4 1/6) 3/2)
04:12ohcibi3/2 is a, 1/6 is b.. now I almost said too much 8-)
04:13Pate_No, 3/4 is a and 1/6 is b.
04:13Pate_compare to the other answers:
04:13ohcibiPate_: sorry, right 3/4
04:13Pate_(== (__ 2 3) 6)
04:13Pate_(== (__ 5 3 7) 105)
04:15ohcibiPate_: forget what I said..
04:18ohcibiPate_: http://www.edugain.com/blog/2011/06/26/lcm-of-fractions/ first result on google
04:18ohcibisearching lcm fractions
04:18Pate_I found that, but I'm confused by the definition link (to wikipedia), which states that the LCM is "the smallest positive integer that is divisible by both a and b".
04:20ohcibiPate_: right, but the sentence you are refering to starts with "lcm of two integers a and b"
04:20ohcibiso again, wikipedia is incomplete
04:20dpathakjPate_: the wikipedia article is not general enough then. what you need to do is think of an alternate definition
04:21dpathakjI think it is going to be worth your while to write them both with a common denominator, then imagine what the world would be like if it were 'scaled up' so that common denominator were 1
04:22ohcibithe pasted article has exactly this in its last line
04:47AmnesiousFunesIs just about any graphic unicode character legal in Clojure symbols?
04:56Pate_how do I instantiate a new Ratio without using (/ a b) ?
05:04dpathakjPate_: why do you need to do that? you don't for the 4clojure problem you are on.
05:05Pate_yeah, I don't. But I was thinking about this: (map denominator [(/ 3 2) (/ 5 4) (/ 10 1)]
05:05Pate_which would break because of the (/ 10 1)
05:05Pate_...but on second thought, (denominator (/ 3.2 5)) also doesn't work
05:15pyrtsaWhich one is more idiomatic, (apply concat colls) or (mapcat identity colls)?
05:17jballancpyrtsa: why not benchmark them?
05:18pyrtsaHmm, looks like mapcat is implemented like (apply concat (apply map f colls)), so I guess it's better to just (apply concat ...).
05:20jballanc:)
05:21jballanc,(source mapcat)
05:21clojurebotSource not found\n
05:21jballancd'oh
05:21jballanc,(source clojure.core/mapcat)
05:21clojurebotSource not found\n
05:21jballanchrmph
05:22jballancwonder if lazybot is a better behaved bot
05:23jballanc&(source mapcat)
05:23lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
05:23pyrtsa&(clojure.repl/source mapcat)
05:23lazybot⇒ Source not found nil
05:24jballancpfft...useless bots
05:25pyrtsaHmm, a non-variadic (defn cat [colls] (apply concat colls)) would be a nice addition to clojure.core.
05:35dsrxwhy, when you can (apply concat [...])?
05:49ddellaco_jballanc: if the bots returned the source IRC would be a completely unreadable mess.
05:50jballancvery true :)
05:50jballancbut they could at least gist it for you
05:50ddellaco_jballanc: that would be pretty nice.
05:50jballanc...oooh...brb, patching clojurebot
05:50jballanc:P
05:50ddellaco_heh
05:50pyrtsadsrx: I think a flatten-once (which cat is!) is a common enough function to be one of its own. Forgive the contrived example but for instance, it's clumsy to (map (partial apply concat) xs).
05:50jballanc(eh, who am I kidding...I *really* don't have the time :-/)
07:01honzais there some kind of limit on the number of keys a map can have? i'm trying to create one with about a million keys and it kills the program
07:02honza(without any exceptions, just an exit code of 1)
07:03Anderkent,(count (reduce #(assoc %1 %2 %2) {} (range 1000000)))
07:03clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
07:03Anderkentoh :P
07:05Anderkent,(count (into {} (map vector (range 1000000) (range 1000000))))
07:06clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
07:06Anderkentbah
07:09honzabahaha
07:09jballanchonza: you probably really don't want to do that
07:10jballancyou have to remember that a map is going to try and keep its load-factor around 0.5-0.7
07:16clgvAnderkent: works like a chram overhere, just a matter of how much memory you give your jvm
07:16clgv*charm
07:38mping_hi
08:12joegallofindfn
08:12joegallohmmm...
08:13AeroNotixclgv: http://www.urbandictionary.com/define.php?term=chrum
08:17clgvAeroNotix: luckily I had an "a" in that word^^
08:27AeroNotixclgv: :)
08:28joegallo$findfn 1 2
08:28lazybot[clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc']
08:28joegallo$findfn 1 [2 3] 4 (1 2 3 4)
08:28lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn
08:28joegallo$findfn 1 [2 3] 4 '(1 2 3 4)
08:29Anderkent,(doc inc')
08:29clojurebot"([x]); Returns a number one greater than num. Supports arbitrary precision. See also: inc"
08:29lazybot[]
08:29Anderkentha. Didn't even know about it
08:29joegallodon't worry, Anderkent, i wasn't looking for inc, i was making sure i knew how findfn worked ;)
08:29joegallo$findfn 1 [2 3] '(1 2 3)
08:29fredyr$findfn [2 3 5 7 11]
08:30lazybot[clojure.core/list* clojure.core/cons]
08:30lazybot[]
08:31joegallo$findfn [2 3] 4 '(2 3 4)
08:32lazybot[clojure.core/conj clojure.core/merge]
08:32joegallo,(merge [2 3] 4)
08:32clojurebot[2 3 4]
08:33joegalloyikes
08:34opqdonutthat's so cool
08:36opqdonutoh, right, you can conj maps into maps and merge is basically just into
08:36lvhHi!
08:36lvhHow do I test ^:private fns?
08:36lvhI suppose, perhaps a better question: how do I import them?
08:36opqdonut,(into {:a 1 :b 1} [{:a 2 :c 3} {:d 4}])
08:36clojurebot{:a 2, :b 1, :c 3, :d 4}
08:36opqdonutlvh: you can refer to them with #'name.space/function
08:36opqdonutlvh: our codebase has a (with-stolen [fun-name] ...) macro that does that for you
08:37opqdonutbut I'm not aware of a library that has something like that
08:37lvhopqdonut: Ah. That's a reader macro, right? So I don't need to require the namespace or anything?
08:38opqdonutthat's a reader macro, yes. you will obviously need to use/require the namespace to make sure it is loaded
08:44shep-werklvh: to be /that guy/, why test private functions?
08:44lvhshep-werk: I want to check if they work
08:44shep-werkTest the public interfaces, or move the private function somewhere public
08:44lvhI just don't want to expose them as api
08:44shep-werk[this is something I've spent time arguing in Ruby-land :-)]
08:44opqdonutunit tests for implementation are valuable
08:45shep-werkmove them from myproject.core to myproject.impl
08:45shep-werkcore is your api
08:45lvhmaybe I'm amking things private that shouldn't really be, idk
08:45opqdonutsure that's the workaround
08:45shep-werkimpl isnt publically consumable
08:45shep-werkopqdonut: my argument is that it's not a workaround
08:45opqdonutthe thing I hate about .impling is that it makes reading the code nonlocal
08:46shep-werkin OOP land, my first reaction is to move private methods into a new object that is public
08:46shep-werkthere, the important thing is that the state held by the original object is still private
08:46shep-werkbut the implementation (the new object) can be public
08:46opqdonutwell the thing I hate about reading java code is that it is so nonlocal :)
08:46shep-werkMy FP experience is far less extensive though
08:46tbaldridge+1 for using two namespaces
08:47opqdonutthe .impl solution fits some namespaces, but private functions definitely have their place IMO
08:47shep-werkand honestly, I would stay away from "impl" namespace; I bet there's a better, semantic, useful name
08:47tbaldridgealmost every time I create a private defn I want a time machine later....so I can go back and time and kick myself for doing that again.
08:47tbaldridge*in time
08:48opqdonutwhy?
08:48clojurebotwhy not?
08:48tbaldridge+1 clojurebot
08:48shep-werkI agree that private fns are useful, but if they are, you should be able to test them completely through whatever public interface uses them
08:48tbaldridgeopqdonut: I try to trust my users. If they want to muck around with a private function, they should be free to do so. If it's really not part of the public api it should be in a different ns
08:49tbaldridgebut still open for a user to muck around with.
08:50tbaldridgeTo me, making something private is like telling a user "I know more than you....you don't want this".
08:50opqdonut for a utility-like library private things might not make less sense, but for a product yes
08:51opqdonuterrr
08:51opqdonuts/less//
08:51shep-werktbaldridge: agree; that's something I hit as a developer-user - "I want to take what you did and stick it back together in some different way"
08:51noidiI agree in principle, but I don't mind ^:private, as it's so easy to bypass
08:52tbaldridgeagreed, and I absolutely hate it when that developer-user is me, and I'm limited by someone else's close-minded view of how their code should be used. Especially when that person is also me :-)
08:52noidijust call #'some.ns/some-private
08:53noidiI think Clojure's access protection mechanism is the best of both worlds. it prevents you from depending on implementation details *accidentally*, but makes it easy to do so if you really want to.
08:53ior3ktbaldridge: are you talking in general, or when developing libraries?
08:53tbaldridgeior3k: both.
08:54tbaldridgeI literally have never used ^:private and later gone back and said "I'm glad I did that".
08:54opqdonutI have
08:54opqdonutwhen somebody else has used less time wrapping their head around the api because it's smaller
08:54tbaldridgeopqdonut: can/should be done by using a impl ns
08:54opqdonutbut I am working in a single large code base, we can always just make things public if we need them
08:55opqdonut.impl works sometimes, but sometimes it just breaks up the flow of the code
08:55opqdonuthave to continuously jump back and forth between two nss when reading
08:55chouserwhen I can change the api of a fn without worrying about users, because it's marked ^:private.
08:55tbaldridgealso, done via a impl ns.
08:56tbaldridgecore.async does this, anything in clojure.core.async is more or less fixed. Everything else is subject to change without notice.
08:56chouserso we're not arguing about private fns, but over the mechanism?
08:56lvhtbaldridge: oh, hi; I just wanted to say that you are an inspiration to a newbie clojurist, please keep up the good work
08:57tbaldridgechouser: what I don't want is the language saying "no you can't do that". Or making it harder in some way. with a impl ns all I really need to do is :require the impl ns
08:57chouser#'shrug
08:57ToBeReplacedtbaldridge: interesting perspective; in python, the accessibility of private-by-convention made it so that libraries in the stdlib couldn't change private functions because (dumb) third party libs would break
08:57tbaldridgewith ^:private I have to use the #' hack (and then remember to deref values) or go back and change the code.
08:57ior3kI think private fns are great to limit the size of each module's public api *in application code*, where things can be easily changed
08:58tbaldridgeToBeReplaced: but did Python actually put those private fns somewhere else?
08:58opqdonutior3k: that's what I've been trying to say
08:58ToBeReplacedtbaldridge: so similar to an impl namespace, and it caused a lot of problems in the evolution of the lang
08:58ior3kthe act of switching an fn from private to public says something to readers
08:58ior3k(during code review)
08:58ToBeReplacedtbaldridge: no, but does that matter? impl.foo or _foo seem similar... i guess easier to see "you're doing something dangerous!" with impl
08:59lvhtbaldridge: nah; they're usually on the same object.
08:59ddellacostathe only use I've found for private functions is as small helpers for my larger kind-of-imperative-wraps-a-complex-process function, which I usually test itself so I'm not testing the private functions. As others have observed usually if I find that I can't test a private function without...testing a private function, it should be public.
08:59tbaldridgeToBeReplaced: right, I understand now, the _thing. So yeah, in that case I would say, change it and let the broken libs fix themselves. This is pretty much the way Clojure has done it all along. Use a private API be prepared to be less portable.
09:01ToBeReplacedtbaldridge: right, so that was the idea with python... except that decision was unrolled and it was decided that private functions could not change in the stdlib because even though everyone was warned, removing them still caused problems
09:01ToBeReplacedtbaldridge: maybe there's a distinction there between "core" and "everything else" though
09:01ior3kddellacosta: I don't know... I think the larger the public api is, the more chance there is for increased coupling. I think making fns public so they can be tested is *complecting* (heh) 2 different things
09:02opqdonutagreed
09:02ior3k1. that there is value in testing a given fn and 2. that there is value in making an fn public
09:02ddellacostaior3k: let me rephrase--if I find that I'm trying very hard to test the behavior of a private function, and I can't get at it for some reason, it shows me my design is wrong. I suppose it's not necessarily case that it means that those functions should be public--but it does mean probably *something* should that isn't.
09:03ddellacosta*should be
09:03opqdonuthow is accessing private fns hard in tests? just #'
09:03opqdonutor were you talking about some other language perhaps
09:03ior3kddellacosta: to me that's usually an indication that the fn is doing too much
09:03ddellacostaopqdonut: the point is that you if you are testing private functions you are testing the wrong thing. I agree with shep-werk.
09:03ddellacostaior3k: yep, definitely.
09:05shep-werkToBeReplaced: the python thing is interesting, but I can see the same thing happening in Clojure
09:05shep-werkat least, it's technically possible, and it's not hard to access ^private functions, right
09:06shep-werkin Java, you have to use reflection to get at them, and IMO it's too painful, so it's less likely there
09:08ToBeReplacedshep-werk: i think the access is easy enough that anyone who wants it can get it... i think with clojure as small as it is, few will depend on it. i think if clojure gained much wider adoption, we'd see lots of it, mirroring the python history
09:09shep-werkToBeReplaced: perhaps, but I have a feeling that clojure might get away with it too - you can just move the old/broken fns to a new lib & namespace and folk can use them
09:09shep-werkunlike in OOP where they would be more tied to the class
09:10shep-werkmaybe :-)
09:10ToBeReplacedand the packaging is a much better story, so you might be right
09:11ddellacostaToBeReplaced: Clojure's packaging > Python's? I hear people complaining about Python a lot but
09:11ddellacosta...don't know much about it's packaging options
09:11ddellacosta*its
09:16ToBeReplacedddellacosta: not necessarily "worse"... just that it makes things like "need two different versions of library x" impossible
09:17ddellacostaToBeReplaced: ah, okay. Not that I find that particularly simple in Clojure, but I guess it's possible.
09:17ToBeReplacedddellacosta: it used to be a really bad story, then virtualenv became popular maybe 6 or 7 years ago and it got very reasonable
09:17ddellacostaToBeReplaced: ah, okay. I'll have to read up on that...heard of it but don't know much about it.
09:18ToBeReplacedddellacosta: yeah i've never done it in java / never had to, but it oddly came up often for me in python
09:21ToBeReplacedddellacosta: unrelated to public/private, but having the jvm is big edge for distribution on internal infrastructure as well... in python we're only recently getting "wheels" (full support wasn't there last year)... before that you had to roll your own for precompiled libs on your platform
09:26shep-werkToBeReplaced: you mean two versions at the same time used by the same app? or just two versions installed on the system somewhere?
09:29ToBeReplacedby same app is nigh-impossible in python... i think you could hack the classloader?... it's hard in java but i thought possible?
09:30ToBeReplacedon the system it is impossible in python (no more than one version per python version), but virtualenvs help salvage that when writing applications... when writing libraries, it's a blocker
09:30shep-werkthat is also my understanding; but was willing to be surprised by python :-)
09:31honzajballanc: load factor?
09:32honzaclgv: Anderkent: I don't get out of memory errors at all - it just dies; this is with 6GB of xmx
09:39clgvhonza: but you should get those. maybe there is a very general try-catch somewhere that suppresses them
09:40honzaclgv: no try catch, it's right in the core's main - but i'll keep looking
09:40clgvhonza: as I said, 1 million keys is no problem here
09:40clgvhonza: 10 million works as well
09:41honzaclgv: what's your -Xmx?
09:41honza(or other JVM args)
09:41clgvhonza: (count (into {} (map vector (range 10000000) (range 10000000)))) though there is some garbage collection going on
09:41clgvplain "lein repl" without any project
09:41honzaok
09:42clgvI have a 16GB RAM here though
09:42opqdonutjvm uses 1/4 ram as the default heap size IIRC
09:42opqdonut(maximum heap size, that is)
09:42rurumatehow to convert IPersistentList to a java collection?
09:43opqdonutit already implements the java List interface
09:43honza8gb ram here, plain lein repl dies with 10M
09:43clgvrurumate: sth like that (doseq [x pst-lst] (.add java-coll x))
09:43clgvhonza: with OOM?
09:43honzaclgv: yes, sorry
09:43clgvhonza: thats expected then ;)
09:45honza1M works on 8gb Xmx, weird
09:45honzayour (count ... example works, not my original code
09:45honzaessentially, i'm loading a big ass json file, which is about 500MB
09:46honzabut it's becoming clear that i'll have think of a different solution
09:48shep-werkhonza: http://stackoverflow.com/questions/444380/is-there-a-streaming-api-for-json ?
09:48shep-werkstream it instead of loading all at once, maybe?
09:48honzashep-werk: tried that, no luck :(
09:49shep-werksad times
09:49honzait's a deeply nested map, so it just hates me
09:49shep-werkIs it a single 500MB key? :-D
09:49honzaLOL
10:10jballanchonza: if you have a map with 3mil entries, it will allocate space for no fewer than 4mil entries
10:10honzajballanc: oh i see
10:11jballanchonza: that's the hashmap's load-factor...the fuller a map gets, the more likely collisions become, the less like O(1) lookups are
10:11jballancso hashmaps tend to keep lots of extra space around
10:11honzaright, right
10:11jballancif you have a set of fixed size, a hashmap is actually a really inefficient data structure
10:21CookedGryphonhey, is it possible to do cider-jack-in with a profile, without just running lein repl :headless separately?
10:44fowlslegs,(def mi (atom "mi"))
10:44clojurebot#'sandbox/mi
10:44fowlslegs,(swap! @mi str/replace #"(\w+)" "$1u")
10:44clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: str, compiling:(NO_SOURCE_PATH:0:0)>
10:44fowlslegs,(swap! @mi clojure.string/replace #"(\w+)" "$1u")
10:44clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Atom>
10:45fowlslegsHow do I order this correctly if I want "mi"->"miu"
10:45fowlslegsNvm
10:46fowlslegsI just needed to get the @ out of there.
10:54gfrederickshas anybody used incanter on 64-bit ubuntu?
10:54clgvgfredericks: yes but only older versions
10:55clgvI still have it as dependency for legcy code but dont use it that often... currently I depend on 1.5.2
10:58bootheadHi folks, is it acceptable to ask about recruiting clojurians here? (I'm not a recruiter by the way)
11:00llasramboothead: I'm not sure I've seen it done, but you won't get kicked for it (modulo being disruptively obnoxious)
11:00llasramboothead: You might have better luck sending a message to the Clojure users mailing list. It's relatively common there
11:01bootheadllasram, I shall do my best not to be obnoxious :-) I'm trying to get the lay of the land really - being quite new to clojure and not really part of the community in London
11:04bootheadllasram, my general question is about the state of the client side clojure(script) eco system. I have a backend implemented in Haskell and I'd like to realise some of the FP benefits with the front end as we have with the back
11:04gfredericksclgv: okay interesting; I imagine you never saw any errors about needing lib3fortran3?
11:05llasramboothead: Interesting. There are some Clojurescript people here, although I'm not one of them. I believe there's also a #clojurescript
11:05gfredericksI have this problem on a fresh project with ubuntu 12.04, and it seems odd to me that other folks aren't having the problem
11:05bootheadoooh shiney! thanks for the steer - I didn't realise there was another channel!
11:08clgvgfredericks: no. but I have never used any matrix capabilities of incanter
11:23gfrederickshmm
11:24gfredericksclgv: I get the problem for (stats/linear-model [1 2 3] [4 5 6])
11:25clgvgfredericks: did you see https://groups.google.com/forum/#!msg/incanter/wzjQ0qZNuT0/oESo3vDyACUJ ?
11:28gfredericksclgv: looks relevant
11:28gfredericksthanks
11:28gfredericksI'm in the category of having successfully installed libgfortran3 but still having the issue
11:29clgvhumm maybe some path issue?
11:31clgvgfredericks: weird. the linear-model example from the group post just works here
11:32clgvgfredericks: Linux Mint 16 which is based on Ubuntu 13.10
11:33clgvgfredericks: libgfortran is installed in /usr/lib/gcc/x86_64-linux-gnu/4.8/ and /usr/lib/x86_64-linux-gnu/
11:33fowlslegsHow do I use the back reference \n to change the nth match for a capturing block, e.g., "miiiuiiii"->"miiiuiu", where I'm changing the third "iii" string to "u"? Can someone show me with str/replace? Thanks.
11:43supersymI can do first, second on a hash-map but what's the idiomatic way to get nth?
11:43rasmusto,(nth 2 {:a 1 :b 2 :c 3})
11:43clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.Number>
11:43technomancysupersym: nth on a hash-map doesn't make sense
11:43rasmusto,(nth {:a 1 :b 2 :c 3} 2)
11:43clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap>
11:43technomancythey're not ordered
11:44rasmusto,(nth (seq {:a 1 :b 2 :c 3}) 2)
11:44clojurebot[:b 2]
11:44supersymok so first and second don't either then?
11:44rasmustobut yeah, doesn't make sense
11:44technomancysupersym: they don't make sense, but they're supported more or less on accident
11:44bbloomeh, first makes a little sense
11:44bbloomit's essentially "sample one"
11:44supersymah alright then... thanks
11:44bbloomw/o randomness of any kind
11:45supersymbbloom: true
11:46gfredericksclgv: I only see fortran in the latter of those two paths
11:53myguidingstarhi all, I'm new to core.logic. What is 'unique' optional argument to 'lvar' for?
11:54gfredericksRaynes: fs requires java 7?
11:57hiredman_myguidingstar: use fresh
11:58muhooi upgraded to om 0.5.1 and my advanced compilation is giving errors: "Use of undeclared Var om.core/IAtom"
11:58myguidingstarhiredman_, I'm seeing this http://jonase.github.io/kibit-demo/#32
11:58muhooalso, the advanced compiled app crashes with the dreaded "Uncaught TypeError: Cannot read property 'object' of undefined "
11:59myguidingstarand trying to comprehend the lvar there
11:59muhooin core.cljs type->str
11:59muhooclues?
11:59muhoodnolen_: ^
12:00muhoothis was from om 0.5.0 -> 0.5.1 works perfectly on 0.5.0
12:00dnolen_muhoo: you need to use CLJS 2173
12:00dnolen_muhoo: and you also need to clean out your stale build
12:01muhooi did lein cljsbuild clean will upgrade to 2173, thanks!
12:02myguidingstarhiredman_, anw, I know fresh already but sometimes we need more control, right?
12:06hiredman_myguidingstar: if kibit proceeds via unification, then it must be the same as (lvar)
12:07myguidingstarhiredman_, Ok, but can you answer my very first question?
12:08mikerodbbloom: seq on a hash-map is consistent though right?
12:08dnolen_myguidingstar: it's so that var equality isn't tied to reference equality, useful when building Datalog style syntax
12:08bbloommikerod: only in that it's deterministic and hash-map is immutable
12:09bbloommikerod: if you add or remove items to it, there's no promises about the order remaining consistent in any useful way
12:09dnolen_'(?x ?x), using (lvar '?x false) means that both occurrences of ?x are considered the same
12:09mikerodbbloom: that makes sense
12:10myguidingstardnolen_, I'm afraid I don't get it. I haven't touched Datalog, either
12:10mikerodbbloom: I remember reading a heated discussion over if: (= m (zipmap (keys m) (vals m))) ; was always true
12:11hiredman_dnolen_: but if kibit is doing the pattern thing via unification, any not ground lvar will unify with anything else, so why do that?
12:11mikerodI think this would rely on seq to be consistent
12:11myguidingstaris there any other use case?
12:11dnolen_myguidingstar: there's not much more to explain, I'm also not understanding why you need to know this implementation detail?
12:11bbloommikerod: i'd imagine that the implementation achieves that invariant and it's unlikely to break
12:11rasmustomikerod: I remember that too, I was told yesterday that keys/vals is dependable
12:12mikerodhttp://dev.clojure.org/jira/browse/CLJ-1302
12:12mikerodI followed this one day
12:12dnolen_hiredman_: if you don't do it then the unification map is going to be ugly
12:12fowlslegs,(clojure.string/replace "miiiuiiii" #"(iii){1}" "u")
12:12clojurebot"muuui"
12:12rasmustofowlslegs: hah, that's a good chapter
12:12mikerodThen Rich said "keys order == vals order == seq order"
12:13fowlslegsI'm trying to get "miiiuui" can someone help me w/regex?
12:13bbloommikerod: and this patch was apparently applied: http://dev.clojure.org/jira/secure/attachment/12760/clj-1302-2.patch
12:13mikerodyeah, I noticed the " in the same order as (seq map)" part
12:14hiredman_mikerod: has been saying that for years
12:14myguidingstardnolen_, cos I don't get that part of kibit demo. Well, I should come back to this later
12:14mikerodand I started thinking, can (seq map) change from call to call; that doesn't seem to make sense
12:15fowlslegsrasmusto: I'm trying to evolve an algorithm that will solve it.
12:16rasmustofowlslegs: I'm not sure if regex is the best option here. can you treat it like a seq of symbols and partition it to find all of the possible substitutions?
12:16dnolen_myguidingstar: that's probably for the best :)
12:17rasmusto,(partition 3 1 '[m i i i u i i i i])
12:17clojurebot((m i i) (i i i) (i i u) (i u i) (u i i) ...)
12:17fowlslegsrasmusto: This must work for any arbitrary string.
12:17szymanowskihi, how can i see all the protocols that a Record satisfies?
12:18fowlslegsI need to figure out how to replace the nth instance of a matched block.
12:18fowlslegs,(clojure.string/replace "miiiuiiii" #"(iii)" "u")
12:18clojurebot"muuui"
12:18rasmustofowlslegs: well yeah. You can treat the string as a seq then. ##(partition 3 1 "miiiuiiii")
12:18lazybot⇒ ((\m \i \i) (\i \i \i) (\i \i \u) (\i \u \i) (\u \i \i) (\i \i \i) (\i \i \i))
12:18rasmustoI'm saying that regex might be hard because it's greedy
12:18hiredman_myguidingstar: imagine it as a really annoying way to write (let [v (lvar)] (rule [`(+ ~v 1) `(inc ~v)]))
12:20hiredman_which, ugh, they have the let and still do it for no reason in the second example, :/
12:20jonasenhiredman_: as in the example below
12:21hiredman_jonasen: right, but in the example below there is no reason for the arguments pass to lvar
12:21mikerodI guess where I was going with that is, is Clojure `seq` consistent when called with the same obj, unchanged
12:21jonasenhiredman_: you mean the false in (lvar 'x false)?
12:22hiredman_jonasen: I mean all of the arguments
12:22dnolen_hiredman_: sorry I'm not actually really looking at the kibit, just explaining why the feature exists at all :)
12:22hiredman_dnolen_: sure
12:24myguidingstarhiredman_, that makes sense
12:24jonasenhiredman_: you mean that it's possible to use unification directly, and skip the 'rule' function entirely? as in this "quiz": https://github.com/jonase/kibit-demo/blob/master/src/kibit_demo/quiz.clj
12:25hiredman_jonasen: no, it looks like it is required due to the way prepare works, it just isn't required in the example on that slide
12:26supersym\q
12:26hiredman_basically, it seems like implementation details are leaking backwards from the implementation into what are supposed to be simplified examples
12:27Raynestechnomancy: http://rain.ifmo.ru/~olegfink/ocaml.html
12:28jonasenhiredman_: those slides describe the implementation.
12:29hiredman_jonasen: I imagine the stuff after Rule v.2 (slide 42) does, but does the stuff on slide 33?
12:31jonasenhiredman_: slide 33 describes a first (flawed) implementation attempt. It's an attempt to explain what ?x (and 'prepare') is
12:33hiredman_myguidingstar: right, so you should skip over the flawed implementation slides :)
12:34myguidingstar:> anw I learnt something new
12:34myguidingstarthanks jonasen for the demo
12:39edwAnyone seeing freezes with the latest Emacs 24.4 + CIDER?
12:39jonasenhiredman_: myguidingstar: At the meetup I was going to buy a beer to the first person who solved the question at: https://github.com/jonase/kibit-demo/blob/master/src/kibit_demo/quiz.clj but I didn't have time to show it... It's not difficult at all but it took me a while to figure out.
13:06johnjelinekhihi all :)
13:06johnjelinekgot a core.async question: https://www.refheap.com/52528
13:06johnjelinekwhy does my channel reader only get the first response?
13:06rasmustofun fact: hihi means goodbye
13:07johnjelinekrasmusto: in what language?
13:07rasmustodanish
13:07johnjelinekrasmusto: learned something new today :) thanks
13:08rasmustotechnically its hejhej :p, and its conversational
13:08johnjelinekahh, that's not quite the same thing
13:08johnjelinekmaybe you can help me with my core.async question?
13:08rasmustoI'm reading the code, don't know how helpful I can be
13:09johnjelinekperhaps I need a while true in there
13:09johnjelinekor some way to loop
13:10rasmustojohnjelinek: yeah, I believe that's true
13:10johnjelinekrasmusto: ahh, got it
13:10rasmustodo you mean to call data-request in data-caller?
13:10johnjelinekdata-request makes an HTTP request
13:10johnjelinekdata-caller initiates the request and listens on the channel
13:10rasmustooh, I just didn't see a quote-request called
13:11rasmustoer, defined
13:11johnjelinekI got it to work with (doseq [_ (range 2)] ...)
13:12johnjelinekexample call: (quote-caller {:my-options})
13:12johnjelinekso, let's say I didn't know how many responses to expect, what would I need to do in that scenario?
13:13rasmustodoens't a channel emit nil when things are done writing to it?
13:13rasmusto(I've done a few async tutorials, that's the extent of my knowledge)
13:13johnjelinekgotcha
13:13johnjelinekdunno ... I think nil's are not allowed on channels
13:14edwLooks like the cider-eldoc integration in the latest cider is freezing emacs.
13:19terpaola
13:20terpaola pessoal
13:20johnjelinekquestion: when is (do necessary?
13:20terpaare you fron
13:20johnjelinekit seems sometimes I can stack expressions and it executes everything
13:20johnjelinekother times I need a do
13:20rasmustojohnjelinek: when you need to do multiple things. fn has an implicit one
13:20rasmustoas does let
13:20terpai from brazil
13:21johnjelinekahh, I see
13:21johnjelinekthanks
13:21terpa?
13:21dkinzerjohnjelinek: like for instance when you want the consequent or alternative in an if expression to d more than just one thing.
13:22johnjelinekdkinzer, rasmusto: so I can remove the do at line 7 here? https://www.refheap.com/52528#L-7
13:23rasmusto,(macroexpand `(doseq [a [1 2]] (prn a) (prn "blah")))
13:23clojurebot(loop* [seq_27 (clojure.core/seq [1 2]) chunk_28 nil count_29 ...] (if (clojure.core/< i_30 count_29) (clojure.core/let [sandbox/a (.nth chunk_28 i_30)] (do (clojure.core/prn sandbox/a) (clojure.core/prn "blah")) (recur seq_27 chunk_28 count_29 (clojure.core/unchecked-inc i_30))) (clojure.core/when-let [seq_27 (clojure.core/seq seq_27)] (if (clojure.core/chunked-seq? seq_27) (clojure.core/let [c__...
13:23rasmustojohnjelinek: ^ there's a do in there somewhere
13:24johnjelinekI see
13:25amalloyrasmusto: amusingly, the 'do in the macroexpansion is unnecessary too
13:25amalloysince it's (let [x y] (do ...))
13:25rasmustoamalloy: hah, good point!
13:27amalloybut it's there for a good reason, i suspect: `(do ~@xs) is an easier base case for the recursion than trying to avoid the do
13:29dkinzerdo's are also kind of unnessary since one can do the same thing using an anonymous function. But then maybe that doesn't get evaluated in order and that's the point of dos. Not sure.
13:30rasmusto,(macroexpand `(fn [] (prn "foo") (prn "bar")))
13:30clojurebot(fn* ([] (clojure.core/prn "foo") (clojure.core/prn "bar")))
13:30rasmusto,(macroexpand `(fn* ([] (prn "foo") (prn "bar"))))
13:30clojurebot(fn* ([] (clojure.core/prn "foo") (clojure.core/prn "bar")))
13:33dkinzer,(fn [] (prn "foo") (prn "bar"))
13:33clojurebot#<sandbox$eval101$fn__102 sandbox$eval101$fn__102@1f6d265>
13:37bbloomnaming things is *hard*
13:37dkinzer,((fn [] (prn "foo") (prn "bar")))
13:37clojurebot"foo"\n"bar"\n
13:37rasmustobbloom: what are you naming?
13:37johnjelinekbbloom: it's one of the two difficult computer science challenges
13:37dkinzerwhat's the other hard part?
13:37bbloomI've got "Handlers", but a subset of the things that it manipulates might be called "Handles"
13:38johnjelinekdkinzer: cache invalidation
13:38bblooma service which handles messages, vs an opaque reference indirection thinggie
13:38bbloomHandler and Handle are clearly the best words separately, but together, it's confusing as hell
13:38edwbbloom: You're giving me classic Mac programming flashbacks. Pascal!
13:39rasmustobbloom: Handlee?
13:39AimHereFor added value, call the thing being handled the Handlee
13:39dkinzer:) funny I had a cache issue today. Something was sticking around longer than needed.
13:39AimHereDamn
13:39AimHereBeaten
13:39johnjelinekdkinzer: :)
13:39bbloomheh. "Message" works just fine there :-P
13:40bbloommaybe i should rename "Handle" to some synonym and just do the comp sci world a favor by helping disambiguate
13:40bbloomWe've got Pointers, References, and Handles... let's add "Grips" or "Hilts"
13:40AimHereKnob
13:41bbloomhaft, shank, stock, shaft, grip, handgrip, hilt, helve, butt; knob
13:41hyPiRionbbloom: yeah, rename it to butt. No ambiguity there
13:41hyPiRionor shaft, for that matter.
13:41bbloompointers, references, and butts
13:41bbloomclearly the correct answer.
13:41AimHereThere needs to be more butts, knobs and shafts in computer jargon
13:43edwbloom: Sling? What attaches to a handle? A baggage tag?
13:44nopromptheh, just tabbed over and saw this discussion.
13:44noprompti'm all for butt.
13:45johnjelinekhttps://www.refheap.com/52538
13:45bbloomstupid english and your words.
13:45johnjelinekhow should I make aggregate so that it becomes a collection of responses from the channel?
13:51johnjelinekno thoughts?
13:51johnjelinek#(println %) prints each message from the channel, but I want to build up a list
13:57sdegutisI've never gotten around to learning core.async because either I never had a need for it, or I don't understand what it is sufficiently enough to realize I do have a need for it.
14:00systemfaultHmm, core.async is what made me want to learn clojure :P
14:01systemfaultThe videos by Tomothy Baldridge and the one by Rich Hickey on youtube were awesome.
14:01johnjelineksystemfault: wanna help me with my question? https://www.refheap.com/52538
14:02johnjelinekI use take! to pass the channel to a function and I want that function to be able to build an aggregate
14:02johnjelineka list or vec
14:03ptcekI am trying to put regex as a key into a map, seems it is not possible. So just put there the pattern and get back regex with re-pattern? Any better way to do it?
14:04systemfaultjohnjelinek: I'm still learning, I don't think I'm at a point where I could help you
14:04Pate_where should I ask about the average costs of hosting Datomic on AWS' DynamoDB?
14:04johnjelineksystemfault: ok, thanks
14:06johnjelinekhuzzah! I got it with an atom
14:07justin_smithjohnjelinek: if you want the aggregate to be accessible as it is being built you probably want to pass the reading loop a ref or atom that it will put things onto
14:07justin_smithif you are OK with it just returning it when done, you can have it construct a lazy seq that it eventually returns
14:08johnjelinekhow would I have it construct the lazy seq? I've got the scenario using an atom working
14:08zanesI'm trying to use Slamhound through slamhound.el / nREPL. It appears to launch its own Java process, which is weird because the README seems to indicate that it should be using the nREPL session instead. Anyone have insight into this?
14:11justin_smithsomething like (loop [result ()] (if-let [new (<! channel)] (recur (cons new result)) result)) ... that's just a sketch mind you
14:11justin_smiththere is probably some more appropriate looping function I am forgetting that you could use for that
14:12chouserIs that similar to (repeatedly #(<! channel)) ?
14:12justin_smithdifference being you know when you are done
14:13justin_smithrather than it being always implicitly infinite
14:13justin_smith(take-while identity (repeatedly #(<! channel))) maybe?
14:13justin_smiththat is cleaner
14:16yong1Hey guys I have a design question I was hoping someone can help me with.
14:16yong1Basically I have an online algorithm that takes in its previous internal state, a new piece of data, and outputs a new internal state and the result. The problem is that these online algorithms can depend on child online algorithms, which might be repeatedly used. So managing the state of your children manually becomes a chore, and will cause repeated computations of the child algorithms.
14:17yong1Some sort of memorization will solve this problem, but it seems too "magical", not to mention potential problems with GC. Is there a well known Clojure pattern for dealing with this scenario?
14:18justin_smithwell, there is the memoize function
14:18justin_smiththere is also core.cache with it's protocol if you want to be fancier about what cached values to keep vs. drop and when
14:19justin_smithhttps://github.com/clojure/core.cache
14:19yong1Yeah I looked into that
14:19yong1Hmm, I don't like that it's hiding the state in some hidden hash table
14:19justin_smithI tried to use core.cache and either a) I am not skilled enough to use it properly b) it is overengineered or c) all of the above
14:20yong1with unpredictable behavior
14:20justin_smithwhich one is unpredictable?
14:20justin_smithmemoize is predictable - same args give you the same result
14:20yong1unpredictable with regards to memory usage
14:20yong1part of the reason I want an online algorithm is to save memory in the first place
14:20justin_smithit's predictable if you know how often your args will be unique
14:21yong1Weak refs might work
14:21justin_smithbut not very nuanced in terms of how to keep its usage small
14:21justin_smithsounds like a least-used or ttl based cache may be useful for that?
14:22yong1Yeah I can certainly make memoization work. I just wonder if there is a better way or if there is a more specific name other than memoization.
14:24justin_smithhttps://github.com/clojure/core.cache this either has what you want, or has the tools to build what you want
14:25justin_smithI think, as I mentioned I tried to use it at one point and gave up on it (likely because I did not sufficiently understand what I was trying to do)
14:25dbaschsdegutis: this is how I ended up solving my authorization / redirect problem: https://www.refheap.com/52547
14:26yong1well, thanks. I'll probably go with memoization of some sort
14:26joegalloptcek: no, there isn't, sadly.
14:27joegallojava.util.regex.Pattern uses the default hashCode/equals from object, so you can't use instances of them like values
14:27joegallo,(= #"foobar" #"foobar")
14:27clojurebotfalse
14:27joegallo,(.pattern #"foobar")
14:27clojurebot"foobar"
14:27joegallowill give you a string, though, which you could use
14:28joegalloand then you can re-pattern it back to a regex later, as you've figured out
14:28joegallohttps://bugs.openjdk.java.net/browse/JDK-7163589
14:30pjstadigyeah, but should #"foo" be equal to #"[f][o][o]"?
14:30pjstadigin general you can't compare the equality of programs, and regexen are programs
14:31joegalloperhaps i'm naive, but i think it would be fairly reasonable to have the hashCode and equals be based on the text of the thing
14:31joegallobut you're right -- that wouldn't be an indication of whether the patterns were truly and deeply equal in the sense of "doing the same thing"
14:33pjstadigwell even comparing strings wouldn't work
14:33joegalloenlighten me
14:34pjstadigbecause the same pattern string with different flags can do different things
14:34pjstadigit may seem wrong, but it's The Right Thing for regexen to have identity equality semantics
14:35johnjelinekwhat's a good way to time (without blocking) the time it takes for a future to complete?
14:35joegallopjstadig: i accept your rebuttal
14:36pjstadigjoegallo: look. i'm not saying i like it :)
14:36joegallo:)
14:41steckerhalteram I doing something wrong here? (.connect (java.net.Socket.) (java.net.InetSocketAddress. (java.net.InetAddress/getByName "google.com") 80) 500)
14:41sdegutisdbasch: looks good
14:42justin_smithyou probably want to hold onto that socket
14:42justin_smithbut I assume you were already doing so
14:43steckerhalterah... I see what you mean
14:43steckerhalterthanks
14:43justin_smithit's an oo / mutation thing, not a functional thing. You need that mutated object before you do anything else :)
14:44mklappstuhlhow do I update dependencies in a leiningen project?
14:44johnjelinekhow would I catch exceptions in core.async?
14:44mklappstuhlfound lein-search but thats 3 years old
14:44justin_smithchange the numbers in project.clj and run lein clean
14:44johnjelinekI'm issuing 26 HTTP requests, and my channel is only sending back 21-23 responses
14:44mklappstuhljustin_smith: is there no automatic way of detecting outdated deps?
14:44justin_smithor do you mean automatically find the latest deps?
14:44mklappstuhljustin_smith, yes
14:45justin_smithhttps://github.com/xsc/lein-ancient
14:45justin_smithbut you still need to edit the deps in project.clj manually
14:45justin_smithoh wait, it even has :interactive
14:45justin_smithweird
14:47mklappstuhljustin_smith, nice that was exactly what i was looking for
14:51FluffumsI'm a complete beginner, but I'm looking to learn Clojure by setting up a basic web application on a Koding.com VM. Would someone mind pointing me toward a resource that might help me figure out how to get my ring server configured to serve up pages? I've run "lein new compojure myblog" successfully, and "lein ring server-headless" seems to be working, but if it's working, I can't figure out the URL for the starter page (such as ht
14:52matthavenerFluffums: i think the default is http://localhost:3000/
14:53matthaveneroh, koding.com VM, it would be your http://&lt;yourvmiporhostname&gt;:3000/
14:53Fluffumsmatthavener: Since this is a headless cloud-based VM...
14:53FluffumsRight.
14:53FluffumsBut http://daneweber.kd.io:3000 is no good. :-(
14:53matthaveneri think server-headless spits out the port its listening on, if its not 3000
14:53matthavenerrun "hostname" on your VM and see what it gives you
14:54justin_smithalso, 3000 is likely not open by default
14:54Fluffumsvm-0.daneweber.koding.kd.io
14:55FluffumsAnd when I start the ring server, it says it's listening on port 3000.
14:55justin_smithbest practice is to run something like nginx, listening on 3000 and serving on 80 - it has security features that ring lacks
14:55justin_smithbut for the meantime, check that port 3000 is open
14:56justin_smithtry wget localhost:3000 from the vm shell
14:56matthaveneryeah it looks like some koding.com thing is intercepting everything
14:56justin_smithif that works, then it's a port issue
14:57justin_smithanother trick is to use the -L argument to ssh in order to forward the remote port to a local port
14:57justin_smithmuch more secure than letting randoms access ring directly
14:58FluffumsAhh. Looks like Koding is the problem here. "wget localhost:3000" gets me the hello world index.html file.
14:58justin_smithright
14:59justin_smithso you need to put up something like nginx, or open up the port
14:59justin_smiththe former is preferable
14:59justin_smithshort term, ssh -L will totally work
14:59FluffumsWhy nginx? (I'm looking at the site now...)
15:00justin_smithit has security features that ring's various backends lack
15:00FluffumsApache is probably just as good for my beginner purposes though, right?
15:00justin_smithpersonally I would put nginx in front of apache, but sure
15:00justin_smiththough I don't know that apache has some advantage over nginx (unless you already know the config syntax or something)
15:01Fluffums(already installed and working fine with PHP/Ruby/Python)
15:01justin_smithsure, then no harm in using apache
15:06gfredericksis anybody familiar with the details of how clutch compiles CLJS views?
15:07ptcekjoegallo: thanks for confirming the fact :)
15:08ptcekIf I use some lib from clojars, can I redefine it's method from within my program while running?
15:09nopromptdnolen_: IDisplayName just needs to return a string right?
15:10ptcek%s/method/function
15:10dnolen_noprompt: yep
15:11nopromptdnolen_: hmm, ok we're still seeing <Unknown> :(
15:11dnolen_noprompt: you need to use React Dev Tools from master
15:12nopromptdnolen_: ah, gotcha.
15:12nopromptthanks!
15:12justin_smithptcek: check out robert-hooke for doing such things cleanly
15:12justin_smithhttps://github.com/technomancy/robert-hooke/
15:13nodenameWhat is this :scope "provided" in some of Om's :dependencies?
15:13nopromptnodename: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
15:16nodenamethanks
15:16ptcekjustin_smith: nice tip, thanks
15:17nooniandnolen_: awesome work with the :instrument option!
15:18nopromptdnolen_: it's kind of bittersweet. because updating to 0.5.1 means we have to update cljs which means austin doesn't work.
15:19firefauxis there a way in seesaw to set a fixed height for a widget, but allow the layout manager to set the width?
15:19firefauxI know I could do :size [x :by y], but I want a variable width
15:21dnolen_noonian: pretty useful.
15:22firefauxI guess I could use :minimum-size and :maximum-size, and just use the same height for both, but that's pretty hacky
15:22dnolen_noprompt: right you're just waiting on the next CLJS release to fix Austin.
15:23nopromptdnolen_: yep. :(
15:24dnolen_noprompt: i mean if you want to keep developing you can just run ./script/build on ClojureScript and work off master
15:24dnolen_noprompt: sync'ing the next ClojureScript release with Clojure 1.6 seems like a good idea
15:24gfrederickshooray prismatic/plumbing is going to get update
15:25nopromptdnolen_: when is that scheduled to land?
15:25nopromptdnolen_: i mean it's not a big deal, we can just used livereload or something. it's a team thing so i can't expect everyone to work off master.
15:25dnolen_noprompt: soonish, 1.6-RC1 is probably going to happen this or next week and I suspect 1.6 shortly thereafter
15:25nopromptotherwise that'd be fine.
15:26muhoowhat's the difference between a channel and a port?
15:26nopromptdnolen_: this is fine though, most of the people on the team are still new to working w/ a repl anyway.
15:27dnolen_muhoo: I think the idea is that a port would have more specific constraints, read/write only
15:29muhoothe async docs were confusing me. it talks about ports in positions i've always sen channels used (and referred to as channels)
15:29dnolen_muhoo: that's exactly right though
15:31bbloomports are not reified in core.async
15:31bbloomwould be nice if they were
15:32bbloommuhoo: http://golang.org/ref/spec#Channel_types is a good resource
15:32akaso as a newer clojure dev I setup the workflow mentioned here http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
15:32bbloomGo reifies "ports" in their type system
15:32akait seems odd that I can't have a sing (def) in any of the project's namespaces for it to work
15:33akais that right or am I missing something?
15:33bbloommuhoo: essentially, a port is either the read or write end of a channel, which Go accomplishes not by using a different object at runtime, but by type constraints
15:33muhoooh, i think lamina does that. there's a concept of a channel pair, which is a read and a write
15:33bbloomyeah, so in a dynamic language, you don't have the type system to help you
15:34bbloomso there are two ways to reify the concept: 1) you can wrap a bidirectional channel in one of two wrapper objects that only implement the read or write half of hte channel protocols
15:34bbloomor 2) you can create a composite bidirectional channel out of two halfs
15:34muhoothat makes a lot more sense, thanks
15:34bbloomi wish core.async did either, b/c then you'd get a runtime error if you try to read or write to the wrong type of port
15:36bbloomas it is now, you can get undefined behavior if you violate the read/write contract of a function
15:36bbloomi'd rather define the behavior to be an exception :-)
15:38bob2_aka, not really clear what you're trying to do
15:38novocharHow should I go about writing e2e tests for my Om app?
15:42muhoolive that there are mix, mute, and solo functions in async. can tell rich was an audio engineer at one time.
15:43bbloommuhoo: i'd guess that he literally added those functions so that he could mix, mute, and solo audio in harmonakit
15:43muhoothen again, working with immutability in clj, datomic, etc, is a lot like using protools. all the takes are there, structural sharing
15:48nooniandnolen_: yeah, i was already trying to build something like that on top of om and this should make what i'm trying to do much easier
15:55akabob2_: I followed Stuart's guide for (reset) in the repl but as far as I can tell it requires me to not use `def` at all more
15:55akaI ust wanted to confirm that was correct but I think I found a blog post explaing it all
15:57dissipatei figured out how to fix 'shuffle'. i think i'm going to do implement this.
15:57stuartsierraaka: Using `def` itself is not the problem. The problem is having application state in mutable global Vars, like `(def … (atom …))`
15:57dnolen_noonian: yeah it seems like several people were so happy that my idea was a common case
16:01dissipatei think 'shuffle' should be implemented as an infinite sequence that uses core.async to block on lack of entropy available in the system. each time enough entropy becomes available to fill in the next spot in the collection, the shuffled collection gets 1 more value added to it, until it fills up.
16:02dissipatefrom the infinite sequence you can 'take' as many shuffled collections as you want. any input on this idea?
16:02Pate_is anyone running Datomic in a Docker container for dev?
16:03akastuartsierra: I believe I understand the reasons behind but I'd like to confirm that would mean I wont be using the def aside from in my user.clj and in the repl
16:03dissipatePate_: which part of Datomic?
16:03Pate_the transactor + H2
16:03stuartsierraaka: It really depends on what your app is doing with the def.
16:03Pate_well, I'm still new to Datomic so I may misspeak on the different parts, but I understand the hosted part is storage + transactor.
16:04llasramdissipate: I have a hard time imagining when I'd want that vs just sampling with replacement
16:04llasramOr just (mapcat shuffle ...)
16:04stuartsierraWhen you change a file and call `reset`, tools.namespace will 1) find all files/namespaces that have changed; 2) find all their dependencies; 3) delete all those namespaces; 4) reload all those source files.
16:04dissipatellasram: what do you mean by 'sampling with replacement'?
16:04llasramdissipate: http://en.wikipedia.org/wiki/Sampling_with_replacement
16:05noonianif you resample you are sampling from the same set, not the set minus the item you just sampled
16:06dissipatellasram: so you are saying you wouldn't want to use 'shuffle' at all, or that you wouldn't use my version of 'shuffle'?
16:07llasramdissipate: If understood your proposal correctly, it would yield essentially the same result as `(mapcat shuffle (repeat coll))`
16:07llasramdissipate: I have a hard time imagining when I'd want that result, and wouldn't just be satisfied with the entropy quality of the verbatim code example
16:08akastuartsierra: I was storing default values to be used in functions in the current namespace. I cleared all that out and it's working now and cleaner. Thanks for the explination I get it now.
16:08dissipatellasram: no it would not. the current version of 'shuffle' in the core is broken. it uses Java's 'shuffle', which does not generate all potential permutations of a collection.
16:08llasramAh, I missed that
16:08llasramWell, or more specifically, wasn't aware of that issue with `shuffle`
16:09llasram(The Java stdlib shuffle.) Do you have a reference with details?
16:09dissipatellasram: to put it bluntly, the current implementation of 'shuffle' shoves under the rug underlying issues regarding entropy pools on common systems
16:09turbofaili can see returning a lazy sequence, maybe, but an infinite lazy sequence of shuffle elements doesn't seem to make sense
16:10dissipatellasram: http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#shuffle(java.util.List)
16:10llasramdissipate: Ok.... What are you doing where this is a problem?
16:10llasramOOC
16:10turbofailbut if you want a truly evenly random permutation you're just going to have to wait for enough entropy to get the whole thing anyway
16:11turbofailso the lazy sequence aspect of it is kind of pointless
16:11dissipatellasram: the documentation is vague, but the bottom line is, if your collection is too large, the underlying pseudorandom number generator will wrap back around before it can generate all possible permutations
16:11johnjelinekdakrone: hey :) are you around?
16:12dakronejohnjelinek: for a little bit, yes
16:12llasramdissipate: Sure -- I was just curious if you have a specific application where this is problematic
16:12dissipatellasram: it's a major problem for scientific and statistical calculations and especially for applications like online casinos where uniform distribution of permutations must be generated
16:12johnjelinekdakrone: I get "Connection reset" exceptions often with clj-http, even with {:throw-exceptions false}
16:13johnjelinekis this exception not meant to be included in the {:throw-exceptions false} flag?
16:13llasramdissipate: Fair enough, although inability to control the source of randomness or random seed makes it pretty useless for those applications anyway
16:13dissipatellasram: for instance, in your population example, suppose i want to shuffle 7 billion elements representing humans on earth
16:13dakronejohnjelinek: that's Apache throwing the exception, so you'll need to handle catching that yourself, :throw-exceptions is meant to have clj-http not throw an exception on an HTTP error code
16:14dissipatellasram: this version of 'shuffle' would tap directly into the truly random entropy pool on the system and use core.async to block until the pool had enough entropy to generate a random value for the next value in the sequence
16:15johnjelinekdakrone: I notice there is a message in the exception that says it will retry the request, do you know how many times this retry will happen?
16:16dissipatellasram: i realize that if the entropy pool is not generating enough entropy, it could block for significant amounts of time, but that would expose the problem at the OS and hardware layer where it should be exposed.
16:16dakronejohnjelinek: search for ":retry-handler" on https://github.com/dakrone/clj-http/ and there's an example, that might work for you
16:18johnjelinekdakrone: nice -- do you know what the default retry count is though?
16:18dissipatellasram: what is your honest feedback on this approach?
16:19dakronejohnjelinek: I am going to hazard a guess and say 3, but I don't know off the top of my head
16:20johnjelinekdakrone: ok, thanks :)
16:23johnjelinekdakrone: copied the retry example and got: "Got:Got:Got: Got: Got:Got: Got: #<#<UnknownHostExceptionUnknownHostException#< UnknownHostExceptionjava.net.UnknownHostException: api.tradestation.com> #<"
16:23johnjelinekpretty strange
16:24dakronejohnjelinek: you can use the :ignore-unknown-host? option also
16:45myguidingstarHi all, I'm an emacs novice and learning core.logic. I want some functions ending with "o" (like membero) in current buffer to have that 'o' in subscript form
16:45myguidingstarhow can I do that?
16:45dsrxyay, font locking
16:45dsrxI don't think emacs can render subscript text, though I might be wrong
16:46dsrxoops, I am wrong
16:47myguidingstarok, we may use some unicode char instead
16:47myguidingstarbut how can I do that? Please help with some elisp
16:47danielszmulewiczmyguidingstar: You could do what we do with lambdas: http://www.emacswiki.org/emacs/pretty-lambdada.el
16:47danielszmulewiczmyguidingstar: Your elisp has been served :-)
16:48myguidingstarthanks a lot danielszmulewicz
16:48myguidingstarbtw, I remember something like some elisp code at the end of a Clojure source file
16:49myguidingstar(emacs will ask when open that kind of file)
16:49myguidingstarwhat is it?
16:50TimMcmyguidingstar: File-local variables?
16:51TimMcThat's the closest I can think of, but I'm no emacs expert.
16:51bob2_that'd be it
16:52myguidingstarthat's it, thanks TimMc
17:23justin_smithbuffer-local? or is there really such a thing as file-local?
17:23justin_smithoh, yeah, never mind, yeah file local it is
17:40mikerodHow do I connect Visual VM to a leiningen REPL?
17:44rasmustomikerod: just launch it. It'll show you one for leiningen's jvm and one for your app (iirc)
17:45mikerodrasmusto: hmm it doesn't look like I'm not seeing the app process. I'll keep digging.
17:50abaranoskyanyone know about Clojure :line metadata?
17:50abaranoskyis there anywhere to go read up on it, especially on which forms get the metadata added?
17:54bbloomabaranosky: LispReader.java (and Compiler.java) is pretty all you'll find
17:54bbloomabaranosky: and i guess you need to check core.clj too, since various macros have to shepard that data around to vars
17:55abaranoskybbloom: cool, reading now :)
18:11gfredericksdoes anybody think it would be cools if data.csv took higher-level args?
18:11dnolen_huh running React on the JVM via JDK Nashorn seems promising
18:11gfredericks(or is there another CSV lib that does this?)
18:13dnolen_seangrove: ^
18:13seangrovednolen_: Very interesting
18:13seangroveSlightly bonkers, but pragmatic if it works
18:14dnolen_seangrove: seems fast enough to actually work in production, way faster than Rhino
18:15seangrovednolen_: Better than Nodyn as well, then?
18:15dnolen_seangrove: Nodyn was a joke
18:16dnolen_seangrove: this invoke dynamic thing is pretty crazy
18:16seangrovednolen_: I read good things about Nashhord when searching for a way to run React on the JVM
18:17dnolen_seangrove: once JVM is warm only seem 2X-4X slower than React under JavaScriptCore
18:17dnolen_which is
18:17dnolen_INSANE
18:17dnolen_and V8 too
18:21seangrovednolen_: Heh, makes me feel sad for Meteor et al. Love the idea of not needing phantom for SEO.
18:22akawow that's exciting to think of
18:23akaOm serverside
18:23seangroveHrm, I suppose it also means we could run most of our smoke tests server side too
18:24qbghmm... Om + CSS generation = true separation of presentation and content?
18:25muhooi'd be interested to see what happens when someone applies the om/react model to... android. or objc
18:25qbgor swing :p
18:26muhooor some replacement for swing, sure.
18:26seangroveqbg: What do you mean CSS generation? Something like SASS/Garden?
18:26muhooi think this is a bomb in the world of UI that will explode everything
18:27qbgseangrove: Not precisely. Local css like you generate local markup using Om
18:27seangroveqbg: Shadow-dom like?
18:28muhoosome good old-fashioned shiva-like creative destruction.
18:28qbgseangrove: yes
18:29seangrovemuhoo: Maybe. I think the breakthrough will be in the tooling that can be built on top of Om. You can have IB-like interactions for designers, and smalltalk-like development experience with devs, with composable, reusable components
18:29akaI can't wait to add 500 smooth animated clocks to every site and app I make
18:29muhooseangrove: yep, i'm about to lift your draggable window out of omchaya :-)
18:30seangrovemuhoo: It needs a lot of polish, but that's the idea ;)
18:30seangroveIf we had IB, you'd just add it to your library, drag it in, configure its options, and save your presentation layer
18:30muhoo~ib
18:30clojurebotexcusez-moi
18:31seangrovemuhoo: Interface Builder
18:31muhoo~ib is interface builder
18:31clojurebotAck. Ack.
18:32seangrovemuhoo: They were ahead of their time, but this is *eactly* the kind of thing Om is well-suited for http://www.youtube.com/watch?v=ouzAPLaFO7I
18:32bbloomdnolen_: nice. the react-page project seems not to have gotten much love. would be awesome if the clj community can carry the ball forward there
18:32akawhoa omchaya is cool and a nice reference
18:33seangrovemuhoo: If there's a protocol for components to expose their keys/types/etc., then this kind of tooling just falls out
18:33seangrovemuhoo: Also, all of the components in Omchaya should basically be spun out into om-components, like om-stack-panel
18:33muhooi was thinking about that today, be nice if tehre were a clojars/maven repo for components
18:34dnolen_bbloom: yeah, agreed
18:34seangrovemuhoo: They're just libraries like anything else
18:34seangrovebbloom: Which React page is this?
18:34patchworkHmm… I have a simple ring handler that is returning {:status 404 :body "<html><body><h1>404</h1></body></html>" :headers {"Content-Type" "text/html"}}, but in the browser it shows up blank
18:34patchworkAnyone else seen that?
18:34bbloomseangrove: https://github.com/facebook/react-page
18:34muhooon a more practical level, i was wondering how i'd put css into a component in a lein project so that others could use it transparently
18:34patchworkweird
18:34seangrovebbloom: Got it, thanks.
18:34patchworkSeems like it should be the simplest thing ever
18:35muhooi could see building a component as just pure cljs, and om-sync is a great example of how easy it is to pull one in. but what about the css or other includes?
18:35seangrovepatchwork: What happens when you cURL it?
18:35muhooi'm not sure how that'd work with the lein/jar model of dependencies
18:35seangrovemuhoo: Ah, yes. I think there will be some standardization around that eventually
18:36seangrovemuhoo: I think it does. Some function that spits out preprocessor-friendly css that can be mangled/compiled in with the user-provided css
18:36patchworkseangrove: Says 404 not found, content-length 0 … ?
18:36ior3kmuhoo: I'm generating everything (HTML/CSS + the rest) in the client with Om + Garden. Not sure if that's what you're talking about but I love it
18:36muhooior3k: that'd work, thanks
18:36muhooi haven't messed with garden yet but it looks great.
18:36seangrovenoprompt Sure seems to like it ;)
18:36muhooit's his thing, no?
18:37seangroveYeah, just teasing a bit
18:37patchworkseangrove: curl output here: https://www.refheap.com/52598
18:37nopromptseangrove: ?
18:37muhoois there going to be a cljs meetup or bof at cljwest?
18:37seangrovebof?
18:37muhooseems like there is so much exciting stuff in om specifically, a bof might be fun
18:37muhoo~bof is birds of a feather
18:37clojurebotRoger.
18:37seangrovemuhoo: We moved the CLJS meetup from the Monday after to the day after so Clojure/west people could join in
18:38muhoothurday night, augh, can't make that. oh well.
18:38seangrovepatchwork: Not sure, sorry
18:38muhoohmm, wait, cljwest is thursday/friday. so the meetup is saturday?
18:39seangrovemuhoo: Meetup is 27th, Clojure/west ends 26th
18:40muhooah. got it. no thursday for me. i see cljswest is mon-wed.
18:42seangrovemuhoo: Are you going to Clojure/West, and are you normally out here?
18:42seangrovemuhoo: If you're interested in an Om/Omchaya unsession, please mention it here https://github.com/cognitect/ClojureWest/wiki/Clojure-West-Unsessions
18:42nopromptobjective j. eesh
18:42muhooright, i guess BOF's are called "unsession" now
18:43seangrovenoprompt: Regardless, they were amazing for what they pulled off ;)
18:43nopromptseangrove: oh no kidding and it looks like they're still working on it.
18:43seangrovenoprompt: It was too heavy, too early, etc. But the ideas were brilliant. We can bring in the best bits of those now.
18:43seangrovenoprompt: Nah, they were bought by Motorala, one of the cofounder is at Stripe now, the other two left a long time ago
18:44muhoo~bof is "birds of a feather", an old-fart name for "unsession"
18:44clojurebotAck. Ack.
18:45bbloomfor some reason, both of those terms set off my marketing bullshit fuzzy hippy good times alarm
18:45`cbp$google unsession
18:45lazybot[Unsession - Minnesota.gov] https://mn.gov/governor/unsession
18:46`cbpEverything is so clear now
18:46muhoobbloom: bof's date back to the IETF and IEEE conferences in the Ancient Times
18:46rasmustounsession is a session??
18:46lazybotrasmusto: What are you, crazy? Of course not!
18:46muhoo~botsnack
18:46clojurebotthanks; that was delicious. (nom nom nom)
18:46muhoowrong bot :-/
18:46bbloom~unbotsnack
18:46clojurebotI don't understand.
18:47bbloomyou wouldn't.
18:47muhoohahaha
18:47muhoobot of a snack
18:48seangrovebbloom: You could edit the unsession page with a title of "Synergistic free-love commune of ideating"
18:49muhoobasically a bunch of nerds sitting around drinking beer and talking shop.
18:50muhoolike IRC, but in person
18:50noprompthaha
18:51rasmustowhos bringing clojurebot?
18:53justin_smithmuhoo: it's more fun to kick someone in person
19:07patchworkSo our project is pulling in [fs "1.1.2"], but doesn't show up anywhere in our > lein deps :tree (we are including [me.raynes/fs "1.4.5"] explicitly)
19:07patchworkProbably AOT compiled somewhere?
19:08patchworkHow to I begin looking for such a thing?
19:08RaynesI'm not sure how it could possibly not show up in lein deps :tree if it is in your dependencies, particularly in the profile in which you're running `deps :tree`
19:08xeqipatchwork: any plugins?
19:08Raynespatchwork: Is this a Github project?
19:08patchworkRaynes: Yes
19:08RaynesMay I see it pwetty pwease <3
19:09patchworkRaynes: Here you go https://github.com/caribou/caribou-development
19:09patchworkxeqi: Yeah, three plugins
19:10patchworkApparently the bug only shows up when using lighttable (which includes its own version of fs which conflicts with ours)
19:10dnolen_it will be funny to have to wrap native Clojure data structures in ClojureScript protocols to get ClojureScript interop
19:10RaynesOh, yeah.
19:10RaynesLight table is all kinds of magics.
19:11RaynesI wouldn't trust anything light table tells me about my dependency tree :P
19:11patchworkWell, it's just that it fails
19:11patchworkI wouldn't care what it told me if it works : P
19:11RaynesWhat fails?
19:12patchworkRaynes: https://github.com/caribou/caribou-core/issues/21
19:12xeqipatchwork: https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/project.clj#L10
19:12patchworkxeqi: You found it!
19:13RaynesOh yes.
19:13patchwork(inc xeqi)
19:13lazybot⇒ 11
19:13patchworkThank you greatly
19:13seangrovednolen_: (clj->cljs) ? :)
19:13patchworkI thought I had hunted through all the project.clj's of my dependencies, but apparently I forgot that one
19:13Raynespatchwork: Any version that doesn't have my name before it is too old to be used with the ones that do have my name behind it :p
19:14Raynes(because of namespace changes, in particular)
19:14patchworkRaynes: You have become master of fs!
19:14patchworkThanks for the help
19:14Raynesxeqi did the hard part
19:15patchworkNow the only question is why lein-cljsbuild is using such an old fs
19:15patchworkbut at least I can exclude it
19:17justin_smiththey should get a PR to update it
19:37shoepie_dnolen_: if i have a cursor to my app state, what's the best way to om/transact! on items in a vector in that cursor?
19:38shoepie_dnolen_: i see om.core/transact! takes korks but i'm manipulating a vector...
19:41dsrx2korks?
19:46qbg,(assoc [1 2 3 4] 1 7)
19:46noonianshoepie_: you can pass vector indices as part of the korks that om/transact! takes i believe
19:46clojurebot[1 7 3 4]
19:46dsrxwhat the heck are korks?
19:47qbgkeyword or keywords
19:47dsrxah, like a fn that [& {:keys [...]}] ?
19:47noonianif you pass in a vector for korks you can think of it as the path in the nested data structure that is your app state
19:47shoepie_noonian: what if i wanted to do all the elements?
19:47rasmusto~korks
19:47clojurebotNo entiendo
19:48qbgshoepie_: You could pass in the empty vector
19:48dsrxoh, it's an argument named that in omitself
19:48noonianif you app is an atom like this: (atom {:vec [1 2 3]}) you could do (om/transact! app [:vec] (fn [v] ["my" "new" "vec"]))
19:49noonianwhich is really the case that om/update! is intended for
19:49noonian(om/update! app :vec ["my" "new" "vec"])
19:49shoepie_noonian: huh, never would've guessed that
19:50shoepie_noonian: so if i wanted to update certain indices...
19:50shoepie_(om/transact! app [:vec [1 2 3] (fn ...
19:50nooniando that in the function you pass to om/transact! and give it the whole vector
19:51noonian(om/transact app :vec (fn [old-vec] (mapv (fn [e index] ...) old-vec (range))))
19:51noonianand do you index specific logic in the ...'s
19:52danielszmulewiczSpeaking of Om, when I use sablono, React complains about missing "key" prop in the array, this happens only for dynamic children (build-all).
19:52nooniani've been getting that also, but it doesn't seem to affect anything
19:53nooniani don't think i use build-all anywhere though
19:53shoepie_noonian: that's basically what i'm doing now
19:53shoepie_noonian: my vector contains maps and in my transact i'm returning a new vector of the changed maps
19:54noonianshoepie_: if you only want to change the third element say, you could do (om/transact! app [:vec 2] (fn [ele] ...))
19:54danielszmulewicznoonian: yeah, but I'd like to get to the bottom of this. Why isn't this happening when using the original dom notation?
19:54shoepie_noonian: then i om complains: "No protocol method ITransact.-transact! defined for type cljs.core/PersistentArrayMap"
19:55shoepie_noonian: so it must not like that i'm replace those values with persistant maps (i assume they were originally cursors ?)
19:55noonianthat means you are calling transact! on a raw map, when it needs a cursor
19:55noonianyeah
19:55shoepie_noonian: still a little fuzzy how and when cursors are cursors
19:56nooniananything om passes to the functions you pass to transact! or update! will be a cursor unless they are primitive js types like string or number
19:56noonianalso, the first parameter to your component fns will be a cursor
19:56shoepie_here's my transact (still messy)
19:56shoepie_ (om/transact! app-state :event-types (fn [event-types] (map (fn [et] (assoc et :editing true )) event-types))))
19:56shoepie_:event-types is the vector
19:57danielszmulewiczshoepie_: this might help clear things up regarding cursors: https://gist.github.com/asolove/8322218
19:57qbgIs app-state your atom?
19:57shoepie_just trying to set and editing flag
19:57shoepie_yeah
19:57danielszmulewiczshoepie_: Basically an atom with a couple of "methods"
19:58shoepie_danielszmulewicz: cool, thanks
19:58echosaI asked around about private functions (defn-) and testing because I've been making everything public (defn) so that I can write unit tests. However, I've been told that I can test private functions using #'. This certainly does work, but leads me to ask: what's the point of defn- if it can so easily be worked around with #'?
19:59qbgechosa: So you have to go out of your way?
19:59technomancyechosa: private is about communicating expectations of stability, not about literally hiding vars
20:00hiredman~private
20:00clojurebotnot even once
20:00echosatechnomancy: Ah. See, since it uses the JVM, I thought it would act more Java-like in respecting privates.
20:00seancorfieldGroovy ignores private too...
20:01echosaqbg: It's not that much otu of the way to change (my-func) to (#'name.space/my-func).
20:01technomancyechosa: but at least if you do that and it breaks, you understand it's your fault
20:01technomancynot the fault of the author of the lib
20:03echosaFair enough. So I should make my classes as they should be, with things that should be private declared with defn-, and use #' to test them as desired. However, production (non-test) code should respect the private-ness (basically, working on the honor system). Yeah?
20:03technomancyclasses?
20:03echosas/classes/clj files
20:03technomancyit's fine to work around private as long as you take responsibility for dealing with the consequences
20:04technomancynot something I'd get in the habit of doing, but there are situations where it's justified
20:05echosawould you, personally, consider unit tests a justified situation?
20:05technomancyyeah
20:05echosaOk good. I'm glad that's your answer. :-)
20:05technomancyprivate is about communicating from the author of a piece of code to the consumers
20:06echosaBecause that's what I'm leaning towards, and at least I'm not alone.
20:06technomancyif you're the author, then you presumably don't need to communicate with yourself
20:06echosaprivate is more about the outward API, then
20:06jimrthy2___?jimrthy
20:06hiredmanprivate is gross, don't use it
20:07echosahiredman: What's your reasoning?
20:07technomancyanother strategy is to not care if other peoples code breaks
20:07hiredmanhttp://clojure-log.n01se.net/date/2014-03-01.html#02:01b
20:07technomancyin that case, private isn't very useful
20:08hiredmanechosa: if you read forward from there, I explain to the last guy to ask
20:09hiredmanbasically http://clojure-log.n01se.net/date/2014-03-01.html#02:14b
20:13echosaMost useful thing I've read in that thread so far: "defn- only exists because it's hard to get rid of.. but there's no def- and clojure/core has repeatedly rejected calls for it"
20:15technomancyechosa: that's silly. encouraging people to be explicit about the difference between unstable implementation details and an API with a promise of stability is really important if you want to build up a functional ecosystem where things aren't constantly breaking
20:16hiredmantechnomancy: depedency management is important for that
20:16echosatechnomancy: agreed... I find that quoted statement useful because it shows an interesting different in def/defn/defn-
20:16echosaAt this point, I still think I'll mark functions that are only used in their host namespace as def-
20:17echosaI find it clearer to read as far as my own code goes, to know if it's an "external" or "internal" function, from the namespace's view
20:17technomancyhiredman: sometimes you are stuck pulling in new versions of things transitively even though you only want a new version of one lib
20:17technomancyclojure isn't nix
20:17technomancyechosa: that's not what it means
20:18technomancyit's about an explicit guarantee of stability, not about whether it's used outside the host namespace
20:18echosamind you, I'm not creating widely used libs here. I have a single project (my first) and everythign is internal to the project. Nothing will be pulled out into a separate, resuable lib. (At least, not anytime soon).
20:18hiredmantechnomancy: if you have to upgrade, you have to upgrade, the supposedly stable api is really just as likely to have changed
20:18technomancyhiredman: yeah, if you don't take stable apis seriously
20:18technomancywe can do better than that
20:18echosatechnomancy: I don't understand what you are talking about with "stability". Stability of what?
20:18technomancyechosa: you can have things that aren't used outside the host namespace that are still intended for end-user consumption
20:19technomancyyou can have things that are used outside the host ns that aren't intended for external consumption
20:19technomancyclojure doesn't have a good way of signifying the latter, but I personally like adding :internal metadata
20:19hiredmantechnomancy: even if someone is using semenatic versioning to communicate breakage of "public apis" you could still be transitively forced in to ugrading
20:19technomancyhiredman: it's about managing expectations
20:20technomancyyou should be able to know what you're getting into
20:20technomancyyou can suck at communicating expectations, or you can make an effort at doing a good job
20:21hiredmanwhat does - communicate?
20:21quizdrwhy do I get this error about contains? not working on list when I'm passing a vector to it? https://www.refheap.com/52622
20:21technomancyhiredman: if you're doing it right, it means "this could change at any time"
20:21qbg,(doc contains?)
20:22clojurebot"([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."
20:22echosatechnomancy: that's not how I woudl read - at all, but I think I see what you're saying, from an API development standpoint.
20:22rasmusto,(contains? [1 2 3] 0)
20:22clojurebottrue
20:22hiredmanbecause conj builds lists when starting with nil
20:22quizdroh i see
20:23seancorfieldquizdr: your `if` only has one arm - so the else is nil
20:23echosaIf I were making a library for others to use, I would consider defn- as functions only I (the developer) should use (internal use only), and defn as functions anyone should (outward, external API)
20:23seangroveechosa: Even though you might think that, you should basically never use defn-
20:23technomancyseangrove: bullshit
20:24seangroveIt's really rare that authors are right about that
20:24quizdrseancorfield good catch
20:24cespareI find myself using (fn [f x] (f x)) as the pred of a condp -- am I missing something obvious that's simpler?
20:24seangrovetechnomancy: It should definitely be used very, very sparingly
20:24seancorfieldquizdr: this works: https://www.refheap.com/52627
20:24technomancyif you're writing a library and considering making a change, it's really valuable to be able to know whether the thing you want to change is used by downsteam codebases or just your own code
20:25technomancyif you don't have this information, you're either going to be stuck with ugly backwards compatibility hacks that aren't necessary, or you're going to break everyone's code
20:25seangrovetechnomancy: It's pretty common to need to use the private functions underneath the public functions to get something I need done, but because the author thought I shouldn't be able to access it even though I know the risks, I have to fork the library
20:25technomancyplease be responsible
20:25seangrovetechnomancy: Nah, docstrings. Put warnings, but let people handle it if they need to
20:25technomancyno one bothers with docstrings
20:25seangrovetechnomancy: Then you can't shed too many tears for them
20:25technomancyyou don't need to fork a library to use private defns
20:25technomancythat's silly
20:25seancorfieldquizdr: actually no it doesn't... it doesn't error but it doesn't give the "right" answer...
20:25seangrovetechnomancy: How do you do it then?
20:26technomancyseangrove: seriously?
20:26seancorfieldquizdr: contains? doesn't do what you think :)
20:26seangrovetechnomancy: Well, short of monkey patching?
20:26technomancyseangrove: #'lib/thingy
20:26mischovSame way you test private functions.
20:26clojurebotGabh mo leithscéal?
20:26echosaI've written docstrings for every (I think) function in my app (except unit test functions, of course)
20:26technomancyworks great, and visually signals that you're doing something that will probably break
20:27technomancyit's not like private defns are actually inaccessible
20:27echosaYeah, the #' thing is what people said I could use to call my functions from test namespaces.
20:27seangrovetechnomancy: I think I've tried to call them before and I get an error
20:27seangrovetechnomancy: #' side-steps that?
20:28technomancyseangrove: yeah, easy
20:28echosaSure does.
20:28seangrovetechnomancy: Well, I appreciate the lesson, even though the delivery method was pretty harsh
20:28seangroveStill, good to learn
20:29seancorfieldquizdr: try (contains? [1] 1) and you'll be surprised :)
20:29echosahiredman quote form the link he posted: "private is from conceit of being a grand architect of software, instead of acknowledging the wrapper library you are releasing will save a some guy at a start up and afternoon, and then he'll have to rip it out in 2 months anyway, because the assumptions in it don't match his use"
20:30technomancyechosa: if it took more than two characters to sidestep private I'd be inclined to agree
20:30technomancywhich I guess is true in Java, but not here
20:30echosaAPI design is a whole field on it's own, but just because some people can't design a decent public API doesn't mean you should necessarily just Public All The Things!
20:30nooniandoesn't it also work to just fully qualify the namespace of the private defn?
20:30echosatechnomancy: technically, it takes two characters *and* the namespace... ;-)
20:31echosanoonian: I believe you need boht.
20:31technomancyechosa: eh, you're already doing that, right? no one uses :use anymore =)
20:31clojurebotExcuse me?
20:31echosa*both
20:31quizdrseancorfield got it, thanks
20:32echosaI actually haven't used :use. I've used :refer and :import. (and only used :import for core.typed)
20:32dsrx:use is no longer really necessary
20:32seancorfieldechosa: so you'll :refer :as x and then (#'x/foo ...)
20:32seancorfielder :require :as
20:32dsrxwell maybe it is, but I think :refer :all should cover all its uses
20:32technomancyechosa: oh, :refer is basically :use
20:32technomancy:refer :all is only for tests
20:33noonian:refer :all is just as bad as :use
20:33seancorfieldagreed
20:33dsrxi agree with that
20:33echosaI actually don't use :as either, except I did for one third party lib (lanterna)
20:34echosacan someone explain :refer vs :use and why they're bad (or at least, why :refer :all is bad)? I have some preconceptions as to why, but I'd like other thoughts and explanations.
20:34nooniani tend to use both :refer and :as, names eventually conflict, and i like that from the leiningen repl if you've used :as x you can tab complete x/ to see all the fns in the ns
20:35dsrx:refer :all can be bad because you can't easily tell where a var comes from
20:35dsrxand conflicts, etc
20:35noonianif someone else looks at your code and sees you calling functions that aren't defined in the ns or explicitly refered to from other namespaces there is no easy way to figure out where those functions are defined
20:36echosa:as just assigns a short name to a namespace, right? It's just there to reduce typing?
20:36Wild_Catechosa: yes
20:37echosaI mean, even if you use :as, you could still call that function without the namespace/:as prefix, right? It doesn't force you to use whatever you supplied to :as?
20:38noonianyes, either by first using :refer or by fully namespace qualifying it
20:39seancorfieldIf you avoid :all, then all names in your code are either a) local to that namespace b) invoked via namespace-qualification (or alias-qualification) or c) explicitly listed in a :refer in your ns declaration.
20:39seancorfield(or they're from clojure.core)
20:40echosaI understand and agree with the benefit of only pulling in/referring/using/whatever the functions that are *actually* used in the source that follows.
20:41echosaand just to be clear and sort of come full circle, out of curiosity really, does :refer :all only pull in public functions?
20:41noonianthe worst is when documentation for libraries uses :use in the examples
20:41echosaI know that's a dumb question, but I want to be clear.
20:42noonian*cough* lobos...
20:43dsrxa lot of older libraries do that I've noticed
20:43dsrxe.g. https://github.com/dakrone/clojure-opennlp
20:43echosastill not fully getting :use vs :refer
20:44dsrxer well, that's using the use function, not :use in the ns macro I guess
20:45seancorfieldechosa: :use == :require with :refer :all
20:46echosaOh... so (:use name.space) == (:require [name.space :refer :all])?
20:47seancorfieldnoonian: I think a lot of libraries documented the usage in the REPL and most people do (or used to) simply (use 'the.library) and start playing...
20:47seancorfieldechosa: yes
20:47dsrxi'm not sure what (:use (my.lib this that)) does -- does it use both my.lib.this and my.lib.that ?
20:47seancorfieldhence :refer :all is just as "evil" as :use
20:47nooniandsrx: its equivalent to (:use my.lib.this my.lib.that)
20:48dsrxk
20:50seancorfieldTIL: (require '[clojure [string :as s] [set :as t]]) works...
20:50devn:refer :all is not "evil"
20:50seancorfielddevn: no more so than :use is what I meant
20:50noonianmaybe "adversarial" is a better word
20:51devnseancorfield: even then though, i think there are damn good reasons to use :use
20:52devni tend to prefer :require :as, but there are cases where it makes sense to just use the darn thing.
20:52devni guess my most recent example is :refer :all with honeysql.helpers
20:53devnas long as the ns you're doing it in serves a narrow purpose
20:53noonianyeah, i agree with that
20:54noonianbut even if i'm referring to everything, i tend to just use gigantic refer vectors
20:54devnotherwise it looks like garbage to read
20:55devnlike (-> (h/select ...) (h/where ...) (h/from ...)) etc
20:55devnit's the reason a lot of c programmers drop the * on the left
20:56devnlike const char* x, vs const char *x
20:56muhooso, what's the trick to getting the react dev tools to work with om?
20:56devnactually i dont know if that's an argument in either direction, but in the case of the ns prefix, i feel like there's a consistent cognitive load of needing to parse every single x/foo
20:57devnif there are a ton of them it gets annoying quickly
21:01muhoospeaking of sidestepping, i noticed rich alter-var-root-patched overtone in his harmonikit project.
21:04muhoo~korks
21:04clojurebotExcuse me?
21:04muhoo~korks are keywords or a seq of keywords, like update or update-in, c.f. om docs
21:04clojurebotexcusez-moi
21:05muhoo~korks are keywords or a seq of keywords (like update or update-in) used in om i.e. transact! and update!
21:05clojurebotexcusez-moi
21:06muhoo~korks is keywords or a seq of keywords (like update or update-in) used in om i.e. transact! and update!
21:06clojurebotIn Ordnung
21:06ddellacosta~korks
21:06muhoo~korks are keywords or a seq of keywords (like assoc or associn) used in om i.e. transact! and update!
21:06clojurebotTitim gan éirí ort.
21:06oRaCuLaR13~korks
21:06clojurebotkorks is keywords or a seq of keywords (like update or update-in) used in om i.e. transact! and update!
21:07oRaCuLaR13~korks
21:07ddellacostahmm
21:07clojurebotkorks is keywords or a seq of keywords (like update or update-in) used in om i.e. transact! and update!
21:07muhoofix it if it's wrong :)
21:07oRaCuLaR13~juxt
21:07clojurebotjuxt is a little hard to grok but it's the best thing ever
21:07muhoo~java logging
21:07clojurebotjava logging is clown shoes
21:07muhooi love that one so much.
21:07oRaCuLaR13lol
21:07ddellacostait's not, actually, the best thing ever
21:07muhootimbre by the way, is awesome
21:07muhoo~timbre
21:07clojurebotCool story bro.
21:08muhoo~timbre is awesome if you are tired of java logging (c.f. java logging)
21:08clojurebotAck. Ack.
21:08seangroveddellacosta: Pretty close
21:08ddellacostaseangrove: I find I use it (juxt) surprisingly infrequently...maybe I'm doing it wrong. comp, on the other hand, is super cool.
21:09ddellacostaand I love me some threading macros
21:10oRaCuLaR13can anyone comment on how they represent objects without resorting to java interop? do you find maps to be enough or do you frequently resort to defrecord?
21:11seangroveoRaCuLaR13: Definitely just maps
21:12seangroveddellacosta: comp, partial, and juxt are a wild threesome
21:14ddellacostaoRaCuLaR13: definitely what seangrove says, but depends on your use-case. What do you mean by "object?"
21:16oRaCuLaR13ddellacosta: I'm translating parts of an interpreter from Java to Clojure. In Java I've got a base object for the "Program" to interpret, but there's variations in forms that "Programs" can take. Thus an inheritance/polymorphism pattern.
21:16oRaCuLaR13ddellacosta: I'm having trouble expressing that in Clojure with just maps, short of putting a key/value to encode the type of program. but that seems poor taste.
21:17seangroveoRaCuLaR13: Probably just maps and multimethods then
21:18seangroveoRaCuLaR13: You essentially just need to call different forms of the same function depending on the type/shape of your data, right?
21:21oRaCuLaR13seangrove: that's right. For instance, a ComponentProgram and a RecordProgram should get their bytecode from the database in the same way, but they should initialize themselves from the database in different ways. You're saying I should use a single function for something like initialize, and then use a multimethod with de-structuring to look into the map and choose which form is appropriate?
21:23seangroveoRaCuLaR13: That's certainly one way. You can also get polymorphism from protocols, but I'd start with the multimethod approach
21:23seangroveoRaCuLaR13: You can see it used to good effect in the clojurescript compiler (written in clojure)
21:25oRaCuLaR13seangrove: alright thanks i'll take a look.
21:25seangroveoRaCuLaR13: No problem, sounds like a cool project
21:28oRaCuLaR13yeah i'm creating an open source alternative runtime engine for peoplesoft. Eventually i want to start a company that involves taking some of oracle's lunch money away, i think targeting peoplesoft could be one way to do it.
21:28seancorfielddevn: another possible good use is monger.operators since you generally want all of them... although I might still :refer [..] there
21:39charewhat is the difference between using Java through something like (. foo bar 7 4) vs (.bar foo 7 4)
21:39muhoowow peoplesoft. haven't heard that name since 1999
21:40muhoowhen they were the Big Thing. shortly after netscape had imploded and lost its Big Thing status.
21:41chouserchare: no difference.
21:44seancorfieldugh! peoplesoft... adobe used a bunch of their stuff when i worked there :(
21:53oRaCuLaR13yeah they're not the Big Thing anymore but peoplesoft isn't going anywhere. esp when IBM owes them a ton for convincing non-technical managers to buy AIX rather than something that doesn't blow, which is everything but AIX
22:04seangrovebbloom: Even if VirtStackPanel hasn't worked out yet, the scroll view is very nice!
22:11brehaut(source number?)
22:11brehaut&(source number?)
22:11lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
22:11oRaCuLaR13(def source 1337)
22:12brehaut,(number? nil)
22:12clojurebotfalse
23:08firefauxis there a function which, given another function f(x, y, z, ...), returns a function g(..., z, y, x) ?
23:08firefauxi.e. it reverses the order of the arguments
23:09brehautnot in the standard library
23:09firefauxoh
23:09firefauxactually
23:09firefauxI guess I could do something like
23:09amalloyfirefaux: remember that's not what functions look like in clojure :P
23:09firefaux(fn [f & args] (apply f (reverse args)))
23:09segmondhow different is clojure 1.1.0 vs 1.6?
23:09amalloybut it's easily written: (fn reverse [f] (fn [& args] (apply f (reverse args))))
23:09amalloysegmond: monumentally
23:10segmondok, thanks. i'll try and get the latest then.
23:10firefauxamalloy: I know :P
23:10firefauxmy brain's still partly in math mode right now
23:10amalloysegmond: don't use your package manager
23:10segmondyeah, i did. i just downloaded lein
23:10amalloydownload lein and let it get clojure for you
23:11amalloygreat
23:11segmondtrying to figure out how to use it
23:11segmondhow do i make it get clojure?
23:11amalloywell, it already has! just run `lein repl`
23:11firefauxoh
23:11firefauxright
23:11segmondyou are right, it has 1.5.1
23:11segmondis that good enough?
23:12firefauxI made a function that takes the arguments
23:12firefauxnot one that just takes the function
23:12amalloy1.5.1 is latest stable
23:12firefauxand whoa, there was a huge delay in the chat for me for a second
23:12amalloyit's what most folks are using
23:12firefauxgot like 8 messages in an instant
23:13insamniacblame the NSA
23:14amalloyoh haha, my version of reverse is broken because i wrote (fn reverse ...) instead of (fn anything-else ...)
23:16firefauxoh yeah
23:16firefauxI just thought you were trying to use a named lambda
23:16firefauxthough I forget exactly how those are formatted
23:16amalloywell i was
23:17amalloybut i accidentally named it reverse, and then tried to use the clojure.core/reverse
23:18firefauxI just wrote it in a way that works
23:18firefauxhere's what I wrote
23:18firefauxwait a sec
23:18firefauxif I paste a 3 line function, will it send 3 posts?
23:18firefauxmaybe I should use tinycode
23:18firefauxI got yelled at once for pasting a somewhat large function
23:18firefauxoh
23:18firefauxI see
23:18amalloy~refheap
23:18clojurebothttps://www.refheap.com/
23:19firefauxyeah, I thought that was odd that you were naming it after reverse
23:19firefauxthough it didn't occur to me that it would shadow the actual reverse function
23:34randall`Hello, quick question. I'm using paredit with the cider repl in emacs. When I try to move to a new line within a form, which I would traditionally do by hitting return, paredit automatically completes the closing parens and then has the repl read it.
23:34randall`I'm sure there's an easy fix, but a 15-minute search effort has failed to produce it.
23:43nopromptrandall`: i turn of paredit in the repl
23:43noprompt*off
23:44nopromptrandall`: but remember you can always just write code in your buffer and evaluate it directly there.
23:44randall`ok! thanks
23:48DenommusI'm trying to use friend as authentication library on a luminus project
23:48Denommusbut I'm kinda confused on the concepts
23:49amalloyrandall`: you can also use C-j instead of RET for editing
23:49Denommusshould I do that in a middleware?
23:49amalloyi don't use paredit at the repl either, but i've gotten into the habit of using C-j pretty often anyway
23:53randall`:amalloy that's exactly what I was looking for! Thank you.
23:54Denommusin better wording: what should I know BEFORE trying to understanding Luminus' and friend's docs?
23:55dissipateis there a 'lint' utility for clojure that enforces good style practices?
23:55seancorfielddissipate: have you looked at Eastwood?
23:56dissipateseancorfield, cool, thanks.
23:57ddellaco_Denommus: I would recommend reading through ring and compojure's wikis, at least enough to get the basic concepts. https://github.com/ring-clojure/ring/wiki https://github.com/weavejester/compojure/wiki
23:58dissipateddellaco_, what about pedastal?
23:59Denommusddellaco_: thanks
23:59ddellaco_dissipate: uh...to understand Luminus? Definitely not. And definitely wouldn't suggest it as a developer's first attempt to build a web app with Clojure...but that's based on the last time I checked out the tutorial (v 2.x I think).
23:59dissipateddellaco_, is the documentation bad?