#clojure logs

2014-06-12

00:02umpaAny way to keep score with immutable seqs ?
00:05jonasenumpa: not sure what you mean
00:07umpajonasen: now I manually mutate (atom ()). Maybe there is a better way to keep score for a two player game ?
00:09jonasenumpa: An atom is probably the way to go
00:11umpa,(doc partial)
00:11clojurebot"([f] [f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & ...]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args."
00:11amalloyjonasen: i think it's too early to conclude that. it could easily be a lazy seq of scores or game states, or a state variable that you reduce or loop over
00:12jonasenamalloy: thats true
00:13umpa,(doc lazy-seq)
00:13clojurebot"([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. See also - realized?"
00:14umpathat (doc lazy-seq) is kind of lazy
01:09umpawhat if the state depends on the score ?
01:12dbaschumpa: the score is part of the state, isn’t it? you’re asking what if the state depends on the state, which is a tautology
01:14umpadbasch: score is the only state ?
01:14dbaschhow should I know?
01:15umpait just sounds like one big recur loop
01:15dbaschumpa: is your game single-threaded?
01:17umpai don't make use of threads no
01:17dbaschumpa: in that case you can keep your score in an immutable structure
01:18dbaschyou can recur with the new score at the end of each “round”
01:18umpathis might be a good opportunity to learn about states
01:19dbaschimagine a jeopardy game for example, where for each round the three contestants are given the chance to guess in order
01:19dbaschthere’s no concurrency, and at the end of the round you have the updated scores of the three players
01:23umpaok, in my case the 2nd round would take each player's scores and create a new state according to the score of each player
01:24dbaschumpa: yes, that sounds like a regular recur based on the computation that happened during the sequential evaluation of the loop
01:26umpais that optimal in clojure ? clojure.org/state talks about alter, commute and send
01:28dbaschumpa: optimal for what? if you have no concurrency, you don’t need to worry about that
01:29umpadbasch: i'm yet to see an example of concurrency, but at this point just figuring best practices
01:30dbaschumpa: you usually know when you need concurrency
01:31dbaschumpa: if you can model your game without concurrency and it performs well, you don’t need concurrency
01:32dbaschumpa: a typical example of concurrency is when you want to provide a service to different people and you don’t want to keep them waiting
01:33dbaschalthough that’s typically done with a parallel implementation, which is more than just concurrency
01:33umpadbasch: would running two recur loops at the same time be an example of concurrency
01:33dbaschumpa: it would be concurrent if you cannot predict the order in which operations take place
01:34dbaschyou mean running two loops at the same time in two different threads?
01:34dbaschthat would be parallelism, but if they don’t interact with each other they are not necessarily concurrent
01:35umpahmm
01:35dbaschan example of concurrency could be a busy intersection, where at each “turn” an indeterminate number of cars can go through
01:36Jaoodclojure is dead: http://uautoinsurance.com/b/yclanguages-cm465/
01:36dbaschand if you could turn back time and restart the flow of traffic, it might happen differently every time
01:37dbasche.g. you have cars 1, 2 and 3 trying to cross north-south, and cars 4 5 6 east-west
01:37dbaschone possibility would be 1 4 2 5 3 6
01:37dbaschanother one would be 1 2 3 4 5 6
01:38dbaschcars 1 and 4 are concurrently trying to access the intersection at the beginning
01:38dbaschif you have a loop that takes one car from each direction and makes it go through, you have no concurrency issues
01:39dbaschif on the other hand you just put the cars in there and something makes them go through for you in a way that you cannot predict the order, that’s concurrency outside of your control
01:42umpaso its not ([1 4][2 5][3 6]), that would be parallelism ?
01:48dbaschumpa: in this case there probably wouldn’t be parallelism, because we can assume that only one car moves at a time
01:48dbaschtwo cars cannot move at the same time
01:48umpaJaood: Wit.AI is actually the only one I would be interested in working for from that list
01:48Jaoodumpa: parallelism is just a technicque to perform an operation more faster
01:49dbaschumpa: the point is that parallelism and concurrency are different things, often combined
01:50dbaschwhen programming nondeterministic access to resources, you usually care about concurrency
01:51dbaschfor example, let’s suppose your cars decide to cross in whichever order they negotiate on their own, because they are autonomous
01:51umpaok
01:51dbaschif you want [1 2 3] to always be together, you could impose a condition that they move “atomically"
01:51dbasche.g. 1 4 5 6 2 3 would not be a possible order for crossing the intersection
01:52dbaschyou could have 1 2 3 4 5 6 or 4 5 6 1 2 3
01:52dbasch(if [4 5 6] are also atomic)
01:52dbaschor 4 1 2 3 5 6 might be allowed if you care about the atomicity of 1 2 3 and not the others
01:53dbaschthat’s when you start using synchronization with things like atoms
01:54dbaschthe important question is whether someone could observe your system during the transition and find it in an inconsistent state, or not
01:54dbaschif there are no observers but you, it’s a moot question
01:55johnwalkeroh hi dbasch
01:55dbaschhi johnwalker
01:55johnwalkersmall world
01:55umpanice dbasch
01:56dbaschthe world of clojure is still pretty small :)
02:01umpadbasch: now the terms futures, promises, delays, atoms, refs make more sense
02:01dbaschcool
02:17IbrahimAsomewhat abstract question, hope it's appropriate: i notice umpa mentioned wit.ai, and that article mentions that they think perhaps they can iterate faster on machine learning algorithms with clojure?
02:17IbrahimAas a first year graduate student working on machine learning and starting to dabble in clojure for fun, i can't see how/why clojure would be particularly better for machine learning than something more numerically oriented like matlab or python?
02:18IbrahimAbut im certainly curious if anyone is doing that kind of thing
02:18IbrahimAi've done some scheme before and i always recall people saying lisps were good for AI, but i never really saw why they said that
02:19IbrahimAthere's certainly some elegance to sexps which makes them nice languages to work with, especially if you use emacs, but i dont see how that relates to AI
02:20dbaschIbrahimA: I personally don’t think that any language is better than any other for AI, what matters most are whatever libraries people have written
02:20IbrahimAright
02:20IbrahimAi agree completely, with the minor point that some languages have better syntax for eg. linear algebra
02:21IbrahimAbut python doesn't, and yet there's plenty of numerical stuff for it
02:21dbaschIbrahimA: python is useful because of SciPy
02:21IbrahimArighto
02:21IbrahimAi just want to understand where the "lisp is good for AI" meme comes from
02:21dbaschhonestly I don’t know
02:21IbrahimAis it more of a correlation vs causation thing, maybe just happens that early ai pioneers liked lisp?
02:22dbaschIbrahimA: yeah, at the time you didn’t have many good choices
02:22IbrahimAthat sounds like the case from this SO post: http://stackoverflow.com/questions/130475/why-is-lisp-used-for-ai
02:22umpaor perl, lisp lost popularity when AI proved to be not very promising
02:23umpaback in 70s
02:23dbaschIbrahimA: have you checked out incanter?
02:23IbrahimAi barely know clojure at this point
02:23IbrahimAerr
02:23johnwalkeris there a way to make the charts in incanter look nice?
02:23IbrahimAi mean, i've barely started learning
02:24IbrahimAand honestly, if i were to switch away from matlab it'd probably be to python/numpy
02:24dbaschjohnwalker: the charts in the incanter examples look nice enough to me, at least better than what I can do with R
02:24IbrahimAclojure im learning completely for fun
02:25johnwalkerthey're ok, but for example
02:25johnwalkerhttp://data-sorcery.org/2010/04/04/new-chart-theme/
02:25dbaschIbrahimA: I know a company that was doing statistical software in clojure and switched to python because incanter wasn’t there yet for their particular needs
02:25IbrahimAyeah, the python numpy/scipy/pandas ecosystem is pretty strong
02:25dbaschjohnwalker: I like those charts
02:25johnwalkerif you look at the sin wave's they're all janky looking, and i didn't see a way to control the legend
02:26IbrahimAi mean, really i prefer ruby as a language over python, but i dont think sciruby is anywhere close to replacing scipy
02:26IbrahimAi hope i dont start a language flame war :P
02:26IbrahimAforget i said anything
02:26dbaschIbrahimA: don’t worry about it. Who can argue about personal preferences.
02:26johnwalkerthere isn't really a flamewar threat
02:27IbrahimAi've managed to derail #emacs with random topics like that, though i think #emacs exists to be derailed
02:27dbaschthere’s a pretty big intersection of domains for which using python, clojure or ruby is a matter of preference
02:27IbrahimAmhm
02:28IbrahimAthankfully in these days of modern hardware we don't have to care as much about performance 90% of the time :D
02:29umpayou do if its a mobile device
02:31dbaschIbrahimA: the main reason I like clojure is repl-driven development on the jvm
02:31IbrahimAyea
02:32dbaschjohnwalker: yes, that sine chart doesn’t look particularly pretty
02:32umpaoptimized recursion is nice as well
02:49hellofunkanyone know why simply restarting a REPL would cause this exception to go away: FileNotFoundException: Could not locate compojure__init.class or compojure.clj on classpath
03:06ddellaco_hellofunk: could just be weirdness with dependencies getting loaded...I've seen that happen. namespace state can get messed up in the repl, unfortunately.
03:09hellofunkddellaco_ ok seems like a rather basic and fundamental aspect to how clojure works, i would expect that to be more stable
03:14hellofunkddellacosta when using Om is it better to use directly DOM stuff like #js {:onClick ... or to use goog closure's event listening abstractions?
03:15ddellacostahellofunk: regarding namespaces in repl, I recommend reading this article for a bit better context: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
03:16ddellacostahellofunk: re: Om, I've found it's a lot better to lean on React's events as much as possible.
03:17ddellacostahellofunk: depends on what you're doing--in some cases you have to do some event handling outside of the React lifecycle. But generally, if you can use the React event handlers, components logic will be a lot cleaner.
03:17ddellacosta*component logic
03:18hellofunkddellacosta thanks. i see in om tuts that basic js/document getElementById is used for things like om/root rather than a goog closure abstraction as well.
03:20ddellacostahellofunk: as far as actually getting stuff from the DOM, I tend to use a library that makes that easy on top of Om--if I had my choice I'd use Dommy (https://github.com/Prismatic/dommy), but we use Domina in the app I work on at work day-to-day. David Nolen falls back on the default built-in DOM stuff a lot, but I suspect that has more to do with not wanted to bring in other dependencies than anything (although he d
03:20ddellacostaoes use Google Closure stuff in his tutorials/example code too when it's appropriate, since it is "built-in").
03:21ddellacostahellofunk: however, if you find yourself doing a ton of DOM stuff outside of React, I would suggest you ask yourself if you aren't doing something that would be easier by working within the React lifecycle and managing your data vs. fiddling with the DOM.
03:21ddellacostahellofunk: ...that's based on my experience up until now. YMMV.
03:23hellofunkddellacosta thanks, i guess there is always a non-react part that must load the html element that om has control over, but i guess relying on built-in DOM for that is excusable
03:24ddellacostahellofunk: ah, yeah, the very initial load to hand something off to root requires that. But if that's all you're doing of course it doesn't make sense to add another DOM lib dependency to your app.
03:58hellofunkddellacosta Dommy and Domina would be similar tools to Goog Closure for accessing DOM *outside* React, then right?
04:00ddellacostahellofunk: yeah, they are both just DOM manipulation libs. Dommy has some templating and AJAX stuff as well I believe. Google Closure is quite a bit more full-featured however, and includes an extensive set of UI widgets as well as mamy other utilities.
04:00ddellacostahellofunk: self-promotion but this is a pretty good survey of the DOM libs out there: http://davedellacosta.com/cljs-dom-survey
04:01hellofunkddellacosta oh cool, i'll read that
04:13ddellacostahellofunk: oh sorry, I was wrong, Dommy doesn't have any AJAX stuff--I was thinking of event handling, rather.
06:34clgvafair in primatic/plumbing the result of lazy-compile can be treated as usual clojure map. but I only get nil values when applying `select-keys` on it
06:43clgvwell, unrelated error. the map behavior is fine
07:18sveriHi, I am wondering if its possible to run clojure tests (testing java code) as part of a junit test suite? Has anyone experience with this?
07:20andyfBronsa: ping
07:20Bronsaandyf: hi
07:21andyfSaw your comment. I can do a quick test on this, but the reason I changed mapv to loop is that I had this idea that with mapv, the *ns* value would get 'captured' once at closure creation time, and not update during each call to that closure.
07:21andyfTesting out that guess now
07:22engblomIf I need to change the nth value in a list, is there a ready function for that?
07:22Bronsaandyf: that's not the case, mapv is eager
07:22andyfYeah, I wasn't worried about lazy/eagerness of mapv.
07:23andyfBut does (fn ...) capture values of free vars, or only references to them?
07:23andyfscratch the "only"
07:24agarmanengblom: update-in
07:24agarman,(update-in [1 [2 [3]]] [1 1] inc)
07:24clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
07:24agarman,(update-in [1 2 3] [2] inc)
07:24Bronsaandyf: (fn [] *ns*) resolves *ns* at call time
07:24clojurebot[1 2 4]
07:25Bronsaandyf: you'd need something like (let [ns *ns*] (fn [] ns)) to capture it at compilation time
07:25andyfok, makes sense. Switching the code back to more like it was and testing
07:25Bronsacool, thanks a lot
07:27andyfShould the recursive call to analyze+eval for statements-expr also have last arg of opts?
07:27andyfit wasn't there before.
07:27Bronsayeah I saw that, good catch
07:27Bronsashould definitely be there
07:27andyfok
07:37andyfpatch attached
07:38Bronsathanks
07:56engblomToday I wrote this function: https://www.refheap.com/86508 . How would you indent this function? Is there anything made in a stupid way that could be done better?
08:04andyfengblom: I did not notice anything being done in a stupid way, but didn't check extremely carefully. Here is another way to structure it using ->> https://www.refheap.com/86510
08:05engblomandyf: Thanks!
08:08andyfI haven't tested, but isn't (update-in (vec heaps) [index] (fn [n] new-heap)) equivalent to (assoc (vec heaps) index new-heap) ?
08:14engblomandyf: Thanks, that made it a bit shorter!
08:14engblomThe function looks like this now: https://www.refheap.com/86511
08:14engblomI corrected one bug I had.
08:17andyfengblom: Instead of flattening out all structure, and then putting it back in with partition, I think you could do something like (apply concat) instead of flatten (partition 3)
08:21engblomandyf: Before flattening and partitioning it back, it is looking like this '(([0 2 1] [1 2 1] [2 2 1]) ([3 1 1] [3 0 1]) ([3 2 0]))
08:21engblomIt is a list of lists of vectors
08:23engblom,(apply concat '(([0 2 1] [1 2 1] [2 2 1]) ([3 1 1] [3 0 1]) ([3 2 0])))
08:23clojurebot([0 2 1] [1 2 1] [2 2 1] [3 1 1] [3 0 1] ...)
08:23engblomIt is not becoming what I want the end-result to be.
08:23andyfYou mean you prefer that the result is a list of lists, rather than a list of vectors?
08:23engblomEnd-result should be like this: ((0 2 1) (1 2 1) (2 2 1) (3 0 1) (3 1 1) (3 2 0))
08:24engblomYes
08:25andyfOut of curiosity, why?
08:25engblomBecause my other functions already operate over lists, so it is easier to convert this one list of lists, rather than rewrite the other.
08:27andyfok, no problem. Note that many (not all) Clojure functions can work on vectors and lists equivalently, treating them as sequences.
08:28engblomActually, it would not be that difficult for the other ones, now when I look at it.
08:40andyfBronsa: taj/analyze+eval should return :raw-forms just like taj/analyze does, yes? I'm not getting it, but I may be messing something up.
08:40Bronsaandyf: only in the nodes where the form gets macroexpanded, yes
08:41Bronsaandyf: do you have a test case where you're not getting it?
08:41andyftrying to reproduce with original libs
08:43engblomandyf: Now the function is looking like this: https://www.refheap.com/86512 . I made the suggested change to use vectors instead.
08:44andyfTry (-> '(comment 1 2 3) taj/analyze :raw-forms) and then again with taj/analyze+eval
08:45Bronsaandyf: arg I'm an idiot
08:46Bronsaforgot to commit that line
08:47Bronsaandyf: https://github.com/clojure/tools.analyzer.jvm/commit/95d45bc808f1aa299f1f6345e5ac5031a351d147
08:48andyfengblom: I can't speak for everyone, but it is easier for me to follow now.
08:49Glenjamini think you could use mapv instead of map-indexed and assoc
08:49Glenjaminis heaps a vector of ints?
08:51justin_smithquoting the maintainer of cider.el: "the final nrepl.el release is about an year old and I doubt many people are still using it"
08:51justin_smithif only he knew how many of us are still using slime
08:52engblomGlenjamin: Yes, it is!
08:52andyfBronsa: grazie
08:52Bronsaandyf: grazie a te! :)
08:53andyfMy Italian is limited to about 20 words, but that plus 1 year of Latin 30 years ago makes me guess "thanks to you"
08:53Bronsacorrect
08:53engblomGlenjamin: I can find any information about mapv: http://clojuredocs.org/search?x=0&amp;y=0&amp;q=mapv&amp;lib=clojure_core
08:53Glenjamin,(doc mapv)
08:53clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
08:54Bronsaandyf: fun fact: I can't help but read Italian phrases in a really weird accent in my head when I know the persons that's writing them is not a native speaker
08:55Glenjaminfor some reason i really can't seem to follow the combination of for and assoc
08:55andyfOnce in Venice I spoke a few sentences of probably-broken Italian to a vaporetti ticket seller "I would like 4 72-hour tickets", and without me having spoken a single word of English, he said that back to me (in English), and said "You speak very good English"
08:56Glenjaminoh, i think it get it now
08:57Bronsaandyf: ahah
08:58andyfengblom: Unfortunately clojuredocs.org has nothing added to Clojure since version 1.3. That is not a lot of symbols, but mapv is one of them.
08:58arrdem'mornin
08:59BronsaI'd rather have clojuredocs die forever than keep being outdated
08:59engblomWhy is nobody updating clojuredocs?
09:00andyfPeople are updating ClojureDocs for the symbols that are already there, but only the developers can add new symbols. They haven't had the time/interest.
09:00engblomI think they are great as they provide examples for almost everything, so you know you understood the documentation right
09:01andyfSomeone could come out with a replacement if they were interested and had the right skills, but it would take a chunk of time, initially and ongoing.
09:02arrdemengblom: there was a ticket closet on the clojuredocs github page to the effect that there's a clojure rewrite of clojuredocs (it's ruby atm) in the works but "at a point where it's a single committer project" in the last week.
09:02engblomOk
09:02Glenjaminarrdem: do you have a link to the rewrite project?
09:03arrdemGlenjamin: it's not open yet.
09:03Glenjaminoh
09:03arrdemafaik
09:03Glenjaminis it the one that had about 50 essays about it on the mailing list?
09:03engblomI am still trying to get my brain to understand how mapv could be used in my function
09:03Glenjaminengblom: i tend to use the cheatsheet, which links to clojuredocs for old fns, and github api docs for new ones
09:03Glenjaminengblom: i think i was incorrect
09:03arrdemhttps://github.com/zk/clojuredocs/issues/66
09:04Glenjamini didn't realise that the index was used to produce permutations of the original input vector
09:05andyfengblom: My personal favorite variety of the cheatsheet is here: http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html
09:05andyfCan get there from clojure.org/cheatsheet in 2 clicks if you forget that link.
09:15engblomandyf: Thanks!
09:17JokerDoomwhat's up with the # sign in clojure, I can't figure out the pattern, it seems to be used for a bunch of different stuff, what's the deal
09:17Glenjaminthink of it like a modifier
09:18Glenjaminin fact no
09:18broquaintJokerDoom: http://clojure.org/reader#The%20Reader--Macro%20characters
09:18Glenjaminthink of it like the first character in a two-character thing
09:18engblomJokerDoom: You should look up sets and anonymous functions.
09:18Glenjamin#{ = sets, #( = fn, #" = regex, #_ = comment etc
09:19engblom(inc Glenjamin)
09:19lazybot⇒ 5
09:19broquaintSee also - http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/
09:19whodidthisso many syntax
09:21arrdemon the contrary, all reader macros!
09:22engblomThink about this: You could count with only 1 and 0, but then each number becomes quite long to write. That is why we are using 0..9 when forming numbers. Advanced set of elements (which actually are still quite simple) makes shorter code
09:23arrdemalso since #{} does nothing that (into #{} [ .. elements ]) does it's still entirely first class since you can generate the same datastructure, forget clojure.core/set which wraps the constructor.
09:25philandstuffnot quite true, you can't do #{(rand-int 100) (rand-int 100)} as that'll fail at read time
09:26arrdemyeah but that's the reference compiler being shitty, not a fundimental language limitation
09:26philandstuffwait, I got your logic backwards. never mind, carry on
09:26JokerDoomso all uses of pound are reader macros?
09:26JokerDoomk, that makes sense to me
09:27arrdemJokerDoom: all leading uses of #.
09:27arrdem,foo#bar
09:27clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo#bar in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:27JokerDoomYes, leading uses of it definitely
09:27eraserhd_No filter-indexed?
09:27JokerDoomhrm?
09:27eraserhdHrmm..
09:27Glenjamin(map (range) coll) === (map-indexed coll)
09:28Glenjaminoh, filter only accepts one coll
09:28Glenjaminso that doesn't really help you
09:28eraserhdYeah, that too.
09:28JokerDoomthx guys, I think I get it now
09:29justin_smithGlenjamin: "(map (range) coll) === (map-indexed coll)" correct in that they are both erroneous in missing a function
09:29Glenjaminhaha
09:29Glenjamingood point
09:30justin_smith(map 𝑓 (range) coll) === (map-indexed 𝑓 coll)
09:30arrdemif you go throwing out tickets post em here so we can vote 'em up or not.
09:30justin_smithwhy does emacs want 𝑓 to be so tall?
09:31Glenjamin,(defn filter-indexed [f coll] (map second (filter f (map (range) coll)))
09:31clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
09:31Glenjamin,(defn filter-indexed [f coll] (map second (filter f (map (range) coll))))
09:31clojurebot#'sandbox/filter-indexed
09:31Glenjamin,(filter-indexed = [0 2 2 4])
09:31clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn>
09:31Glenjaminbah
09:31Glenjaminsomething like that anyway
09:31hyPiRionheh.
09:32justin_smithGlenjamin: again your example above with map (range)... was missing an f
09:32Glenjaminoh, i forgot the damn function to map again
09:32Glenjamin,(defn filter-indexed [f coll] (map second (filter f (map identity (range) coll))))
09:32clojurebot#'sandbox/filter-indexed
09:32Glenjamin,(filter-indexed = [0 2 2 4])
09:32clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/identity>
09:32Glenjamingah
09:32justin_smithmaybe you want list?
09:32Glenjamin,(defn filter-indexed [f coll] (map second (filter f (map vector (range) coll))))
09:32clojurebot#'sandbox/filter-indexed
09:32justin_smithor vector
09:32Glenjamin,(filter-indexed = [0 2 2 4])
09:32clojurebot(0 2 2 4)
09:32Glenjaminmeh, doesn't work anyway
09:32Glenjaminthe point was supposed to be that you can just define your own filter-indexed trivially
09:33Glenjaminbut maybe its not so trivial
09:33Glenjamin(it is, i'm just not very good at IRC repling)
09:33hyPiRion,(defn filter-indexed [f coll] (map second (filter (fn [[a b]] (f a b)) (map vector (range) coll))))
09:33clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol:   in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:34eraserhd,(defn filter-indexed [f coll] (->> coll (map-indexed (fn [[i v]] [(f i v) v])) (filter first) (map second)))
09:34clojurebot#'sandbox/filter-indexed
09:34Glenjamin,(filter-indexed = [0 2 2 4])
09:34clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/filter-indexed/fn--237>
09:35eraserhdwut?
09:35GlenjaminhyPiRion's seems correct to me, not clear what the error there is
09:36hyPiRionmine works, but I had a nbsp in there
09:36hyPiRion,(defn filter-indexed [f coll] (map second (filter (fn [[a b]] (f a b)) (map vector (range) coll))))
09:36clojurebot#'sandbox/filter-indexed
09:36hyPiRion,(filter-indexed = [0 2 2 4])
09:36clojurebot(0 2)
09:37eraserhdOh. I see what's wrong with mine.
09:37hyPiRioneraserhd: map-indexed uses [], not [[]]
09:37eraserhd,(defn filter-indexed [f coll] (->> coll (map-indexed (fn [i v] [(f i v) v])) (filter first) (map second)))
09:37clojurebot#'sandbox/filter-indexed
09:37eraserhd,(filter-indexed = [0 2 2 4])
09:37clojurebot(0 2)
09:37justin_smith((fn filter-indexed [filt coll] (map second (filter filt (map list (range) coll)))) #(even? (first %)) [:a :b :c :d :e :f :g])
09:37justin_smith,((fn filter-indexed [filt coll] (map second (filter filt (map list (range) coll)))) #(even? (first %)) [:a :b :c :d :e :f :g])
09:37clojurebot(:a :c :e :g)
09:38hyPiRionAnd while we're at it, here's the swearjure version:
09:38hyPiRion(no)
09:38justin_smithheh
09:38eraserhdIs there a swearjure compiler yet?
09:39eraserhdi mean, with swearjure as the target language?
09:39arrdemA Clojure→Swearjure translater?
09:39arrdemhyPiRion: get on this
09:40Glenjaminhttps://github.com/timmc/swearjure
09:40hyPiRionarrdem: I think TimMc actually attempted to
09:40hyPiRionah yeah, there we go
09:40hyPiRionI do have some code which converts a number to a swearjure number, but that's it for my part
09:42eraserhdThere is a keep-indexed, but no filter-indexed.
09:42eraserhdInteresting: http://dev.clojure.org/jira/browse/CLJ-670?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel#issue-tabs
09:43arrdemClojure:Lisp::LSD:Meditation lowut
09:43justin_smith?
09:43arrdemhttps://groups.google.com/forum/#!topic/clojure/uaXwkcjBxkg
09:44justin_smithsounds like a grumpy old lisper
09:44arrdemikr
09:44eraserhd,(defn filter-indexed [f coll] (keep-indexed #(or (f %1 %2) nil) coll))
09:44clojurebot#'sandbox/filter-indexed
09:44eraserhd,(filter-indexed = [0 2 2 4])
09:44clojurebot(true true)
09:44hyPiRionthat's no good
09:44justin_smithcongratulations clojure, welcome to the world of "mindshare" and "popularity"
09:45eraserhd,(defn filter-indexed [f coll] (keep-indexed #(if (f %1 %2) true) coll))
09:45clojurebot#'sandbox/filter-indexed
09:45eraserhd,(filter-indexed = [0 2 2 4])
09:45clojurebot(true true)
09:45kzarAnyone here managed to use the include tag in a Selmer template?
09:45justin_smithmaybe if we modified it to say (true :dat) instead, that would help
09:47eraserhdOh, I didn't understand keep-indexed.
09:47eraserhdThat's a weird function.
09:47hyPiRion,(defn filter-indexed [f coll] (keep-indexed #(if (f %1 %2) %2) coll))
09:47clojurebot#'sandbox/filter-indexed
09:48hyPiRion,(filter-indexed = [0 2 2 4])
09:48clojurebot(0 2)
09:48hyPiRioneraserhd: keep is equivalent to (remove nil? (map f coll))
09:48hyPiRionkeep-indexed is the same, but with map replaced as map-indexed
09:48eraserhd,(filter-indexed even? [nil nil nil nil])
09:48clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/even?>
09:49eraserhd,(filter-indexed #(even? %2) [nil nil nil nil])
09:49clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Argument must be an integer: >
09:49eraserhd,(filter-indexed #(even? %1) [nil nil nil nil])
09:49clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/eval129/fn--130>
09:49hyPiRionand index is first
09:49hyPiRionheh, hard this thing
09:49eraserhd,(filter-indexed (fn [i v] (even? i)) [nil nil nil nil])
09:49clojurebot()
09:49Glenjaminthe true reason why filter-indexed isn't in core ;)
09:49eraserhd,(filter-indexed (fn [i v] (even? i)) [:a :b :c :d])
09:49clojurebot(:a :c)
09:49eraserhdWhy?
09:49hyPiRioneraserhd: oh, nice call.
09:49clojurebothttp://clojure.org/rationale
09:50eraserhdI don't understand how keep-indexed is useful, though. That seems really arbitrary.
09:50hyPiRionYou cannot use keep-indexed to simulate filter-indexed.
09:51hyPiRioneraserhd: keep-indexed is way more useful than when-first though
09:51hyPiRionwhich is the strangest one out there.
09:51justin_smithI think we should run the permutations, and keep all the good ones
09:51Glenjamin,(doc when-first)
09:51clojurebot"([bindings & body]); bindings => x xs Roughly the same as (when (seq xs) (let [x (first xs)] body)) but xs is evaluated only once"
09:51justin_smithswap!-indexed
09:51hyPiRionjustin_smith: commute-indexed
09:54engblomWould anyone want to check up the last function (best-move) and see if there is something stupid done, or something that could be better: https://www.refheap.com/86513
09:55TimMceraserhd: Yeah, I was working on a Clojure -> Swearjure compiler, but then I realized I was wasting valuable hours of my life. :-P
09:55TimMcI'm happy to give pointers to anyone who wants to move it forward, though! It's a fun exercise.
09:56TimMc(If you want to learn more about compilers, that is.)
09:56arrdemTimMc: I think that Bronsa and I have plenty of real work for compiler people, besides our stuff could actually be useful one day
09:56TimMc*nod*
09:57TimMcI would encourage people to work on that instead.
09:57kzarIs selmer a good library for django style templates?
09:58hyPiRionarrdem: are you implying that Swearjure is not useful? What blashpemy.
09:58hyPiRion*blasphemy
09:58arrdemhyPiRion: until we get a TCO compiler totally
09:58eraserhdarrdem: I actually signed the CA because of tools.analyzer/clojurescript, and wanting embedded compilation.
10:00sveriHi, I am wondering if its possible to run clojure tests (testing java code) as part of a junit test suite? Has anyone experience with this?
10:03TimMcsveri: You mean wih mvn test?
10:03TimMcI think the clojure-maven-plugin might provide that.
10:04kzaryogthos: If you have a minute I'm having trouble using the include tag from Selmer https://github.com/yogthos/Selmer/issues/45
10:05sveriTimMc: Hm, We dont use maven here, so, if I understand you correct, I have to look up for a plugin for the build tool we are using and besides that, a plugin that lets me execute that tests in eclipse
10:05yogthoskzar: just commented on the issue on github, you have to use render-file instead of render
10:06TimMcsveri: Or just put in a Makefile that runs junit tests and then lein test. :-P
10:07sveriTimMc: :D ok, thats another option
10:07kzarBut with stasis I've already loaded all the files into a map using slurp-directory (and pre-processed them a bit)
10:07TimMcWhat build tool are you using?
10:07sveriant and gradle
10:17engblomIf I want to check if '([1 2 3] [4 5 6]) contains [1 2 3], is there a ready function i could use?
10:17arrdemClojure core has no O(N) contains scan.
10:18arrdemhowever you can just say (any (map (partial = X) ys))
10:18justin_smith,(some #(= [1 2 3] %) '([1 2 3] [4 5 6]))
10:18clojurebottrue
10:18arrdemor that :P
10:18engblomThanks!
10:19engblomarrdem: (doc any) gives nothing and it is not on the cheat-sheet either.
10:20kzaryogthos: I need to process the contents first (I'm using the Jekyll way of having some YAML at the start of each file setting variables). I then pass the map of variables I've read to selmer for rendering along with the file contents minus the header. Can you think of how I could parse and strip out the yaml, pass the variables through to selmer in a way that I can use include without having to read the file twice?
10:20arrdemengblom: any is some, I just get the name wrong all the time.
10:24justin_smitharrdem: also no need for the map
10:25arrdem,(source some)
10:25clojurebotSource not found\n
10:25justin_smith$source some
10:25lazybotsome is http://is.gd/IAmtiP
10:25arrdemeh gets you the same linear scan, but some will yield on the first positive result
10:25justin_smithright
10:26arrdemWhich is T(N)=N/2 on average
10:26ddellacosta,(some #{[1 2 3]} '([1 2 3] [4 5 6]))
10:26clojurebot[1 2 3]
10:27ddellacostaalso can skip the predicate &
10:27ddellacostaerp
10:27ddellacosta^
10:27justin_smithddellacosta: well, a set is a predicate :P
10:27ddellacostasoo, in the end some would be the more efficient choice regardless, huh?
10:27justin_smithI like them for multiple cases, but for only one match a set seems a little silly
10:28ddellacostajustin_smith: fair enough, you can use a set vs. fn
10:28ddellacostajustin_smith: yeah, suppose that's reasonable
10:28justin_smithddellacosta: some would be more efficient than?
10:28toast,(some irc://irc.freenode.net:6667/#%7B%5B1 2 3]} '((1 2 3) [4 5 6]))
10:28clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
10:28ddellacostajustin_smith: oh, that was directed at arrdem, asking about efficiency of the some solution you wrote vs. his any solution
10:29szymanowskiHi, i've spotted a thing in prismatic's schema that I don't understand, (s/check [s/Int] nil) => nil ; is it feature?
10:29justin_smith,any ddellacosta
10:29clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: any in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:29arrdemddellacosta: hum?
10:29toast,(some irc://irc.freenode.net:6667/#%7B%5B1 2 3]} '((1 2 3) [4 5 6]))
10:29clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
10:29ddellacostawoah, what's going on here
10:29justin_smithtoast, what are you trying to do?
10:29ddellacostacrazytown
10:29arrdemtoast is failing at URLs
10:29justin_smithlooks like a hotkey for [
10:30justin_smithor something
10:30ddellacostatoast, are you a mess bot?
10:30toastI was trying to change the vector to a list
10:30ddellacostaoh
10:30justin_smithtoast - there is pretty much never a reason to turn a vector into a list in clojure
10:30justin_smithat least not explicitly
10:30ddellacostaif you really want to, I suppose you could
10:30ddellacosta,(into '() [1 2 3])
10:30clojurebot(3 2 1)
10:31Glenjaminheh
10:31toast,(some #{[1]} '((1)))
10:31clojurebot[1]
10:31Glenjamininto uses conj
10:31toastno
10:31toastnot programatically
10:31ddellacostanot...programatically?
10:32toastI was changing the vector in ddellacosta's example to a list
10:32philandstuff,(seq [1 2 3]) turns it into a seq, which is close enough
10:32clojurebot(1 2 3)
10:32ddellacostatoast: ah, I see, you wanted to see if it would match on that?
10:32ddellacosta,(some #{[1 2 3]} '((1 2 3) [4 5 6]))
10:32clojurebot[1 2 3]
10:33toastyeah
10:33ddellacostagotcha
10:33toastis there a pred that would return false?
10:33toast(or nil)
10:34toastnot that I need to do this, just idle curiosity
10:34toast;
10:34justin_smith,(#(apply = (map class %&)) [1 2 3] '(1 2 3))
10:34clojurebotfalse
10:34justin_smithchecking for equal type and equal contents together is left as an exercise for the reader
10:35ddellacostathis channel is getting out of hand
10:35llasramddellacosta: How so?
10:35CookedGryphonhi, if I'm using a deftype generated class from Java, and my code has been aot compiled, do I still need to invoke require of the appropriate namespace in java?
10:35TimMcjustin_smith: identical? :-P
10:36justin_smithTimMc: much better, thanks
10:36llasramddellacosta: JOKES????!
10:36llasram~guards
10:36clojurebotSEIZE HIM!
10:36justin_smith,(identical? '(1 2 3) '(1 2 3)) TimMc; probably not what we want here
10:36clojurebotfalse
10:37TimMcjustin_smith: It will work sometimes, though!
10:37TimMc,(identical? '() '())
10:37clojurebottrue
10:37justin_smith~sometimes
10:37clojurebotHuh?
10:38arrdemfriggin really... can you not make a vector with an explicit length?
10:39TimMcWhat, like one filled with nils?
10:39arrdemlooks like even going array to vector incurs O(N) conj's.
10:39ddellacostahmm
10:39TimMc&(count (vec (object-array 5)))
10:39lazybot⇒ 5
10:39TimMc&(class (vec (object-array 5)))
10:39lazybot⇒ clojure.lang.PersistentVector
10:39justin_smithTimMc: but is that calling conj 5 times?
10:40TimMcarrdem: I thought that would just adopt the array.
10:40arrdemTimMc: I'll check core.clj but PersistentVector.java doesn't seem to allow that
10:40TimMc&(let [a (object-array 5), v (vec a)] (aset a 0 :hi) v)
10:40lazybot⇒ [:hi nil nil nil nil]
10:41TimMc^ I think that demonstrates a lack of conj'ing.
10:41justin_smithoh, fascinating
10:41TimMcMileage may vary if array is larger than 32, or if you try to conj to this one.
10:41arrdem,(let [a (object-array 64), v (vec a)] (aset a 0 :hi) v)
10:41clojurebot[nil nil nil nil nil ...]
10:41TimMcI was expecting a LazilyPersistentVector.
10:42arrdem,(drop 30 (let [a (object-array 64), v (vec a)] (aset a 0 :hi) v))
10:42clojurebot(nil nil nil nil nil ...)
10:42arrdemfunky
10:42TimMc&(let [a (object-array 5), v (conj (vec a) :end)] (aset a 0 :hi) v)
10:42lazybot⇒ [nil nil nil nil nil :end]
10:42clgv,(binding [*print-length* 64] (let [a (object-array 64), v (vec a)] (aset a 0 :hi) (prn v)))
10:42clojurebot[nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil]\n
10:42TimMc^ So conj'ing creates a new array. You take the hit at first modification.
10:43arrdemhum...
10:43clgvthe small array optimization is weird
10:43clgvwouldnt be too expensive to just use System/arraycopy there
10:43TimMcRight? It's a *small* array, why wouldn't you just copy it?
10:43clgvTimMc: exactly! jira ticket!
10:43TimMcNot a chance.
10:44clgvor maybe there is already one since the observation is not new ;)
10:44clgvTimMc: why not? windmills?
10:44TimMcThere's probably something about frequent use of vectors to wrap tiny arrays produced during compilation.
10:44TimMcWindmills.
10:45clgv:(
10:46clgvthat's a real weird special case that has almost php quality ;)
10:47Glenjaminwindmills?
10:47TimMcTilting at.
10:47clgv:D
10:48Glenjaminah
10:48Glenjaminthats two new phrases i've learnt in two days here
10:48Glenjaminalthough i forgot what yesterday's was
10:48clgvyeah that was a little indirect, I am glad TimMc knew what I meant ;)
11:11hellofunkYes
11:12justin_smith~coin
11:12clojurebotPardon?
11:13hyPiRionthere is no coin, only (rand 2)
11:13arrdem2d6
11:13clojurebot9
11:13arrdemhyPiRion is a pack of lies
11:13hyPiRion~flip
11:13clojurebotIt's greek to me.
11:13justin_smithhyPiRion: lazybot has a coin command
11:13hellofunk"There is no ass." -- Woody Allen
11:13justin_smithhyPiRion: I had the wrong bot
11:13hyPiRion$coin
11:13lazybothyPiRion: Heads.
11:14fenrock_away$die
11:14justin_smith$coin
11:14lazybotjustin_smith: Tails.
11:14fenrock_away$dice
11:14fenrock_awaywhat, no dice?
11:14hyPiRiondie is probably not something lazybot would do on command
11:14justin_smith$3d6 (rolling up a paladin)
11:14hyPiRionnot intentionally at least
11:15arrdem2d20
11:15clojurebot22
11:15fenrockhaha
11:15fenrock1d6
11:15clojurebot5
11:15arrdem21+3d6
11:15justin_smith1d1
11:15clojurebot1
11:16arrdem3d6+21
11:16clojurebot27
11:16clgv:P
11:16arrdemwow fail roll
11:16arrdem3d6+21
11:16clojurebot31
11:16arrdemthere we go
11:16fenrock1d100
11:16clojurebot70
11:16fenrocki parry the blow
11:16clgv1dLong/MAX_VALUE
11:16clgv:/
11:16clgv;)
11:17TimMc1d८
11:17TimMc:-(
11:17hyPiRion100d100
11:17clojurebot4827
11:17arrdem(inc justin_smith)
11:17lazybot⇒ 47
11:17hyPiRion2147483647d2147483647
11:17hyPiRion=(
11:17arrdemhyPiRion: wat
11:17clgv2147483647d2147483647d2147483647d2147483647
11:18clgvoops :P
11:18llasram1d-6
11:18fenrock1d2147483647
11:18clgv1d9223372036854775807
11:18hyPiRionarrdem: isn't it obvious what I'm trying to do? roll 2**31-1 2**31-1 sided dies?
11:18hyPiRiondice*
11:19fenrockok clojurebot, what's the largest dice you have in your bag?
11:19arrdemhyPiRion: wat
11:19arrdemfenrock: dice is plural...
11:19hyPiRion2d2
11:19hyPiRionoh, it's probably doing my calculation. Hurray!
11:19fenrocki know, someone thought it was rude to say die to the bot
11:19llasramOr hiredman tired of our games
11:20cbp,(+ 1 1)
11:20cbpo gods
11:20fenrockoh dear, bot is busy
11:20justin_smithI think that dice roll is going to take a long time to calculate
11:20clgvhyPiRion: :P well seems that not all plugins have timeouts ;)
11:20arrdemhyPiRion: what have you done
11:21cbpi hope it doesn't have clgv's queued up
11:21clgvlet us hope that clojurebot is on a vserver and not something aws like ;)
11:21hyPiRioncbp: it contains 3 d's, not sure if that would be parsed correctly
11:21clgvcbp: unlikely since the first one is illformated
11:21cbpoh
11:21justin_smithlets cross our fingers that it uses a promoting integral type, so we get a crazy big number, and not a random overflow result
11:21clgvprobably also a lot of boxing unboxing happening there ;)
11:22justin_smithyeah
11:22arrdemBigInts get so big for rollin that die up
11:22hyPiRionjustin_smith: would've crashed by now if that were the case, I think.
11:22sdegutisWe're one step closer to 0-downtime deploys :D
11:22clgvhyPiRion: damn what did I paste there? :P
11:22sdegutisCurrently we can do so as long as there are no database changes.
11:23sdegutisBut I wonder if Datomic makes that even easier if there are database changes...
11:23hyPiRionclgv: I think you did "2147483647d2147483647" d "2147483647d2147483647", i.e. copypaste my query and forgot to remove the d's
11:24fenrock,(println "i'm alive!")
11:25fenrockdo println's normally work, or only returns with meaningful value?
11:25fenrock,(str "hello")
11:25clgvuse lazybot
11:25TimMcBot's not talking.
11:25gtrak&wat
11:25lazybotjava.lang.RuntimeException: Unable to resolve symbol: wat in this context
11:25clgvfenrock: clojurebot is currently busy with important business ;)
11:25clgv&(println "use me!")
11:25Glenjaminoh neat, clojars got web 3.0-ed
11:25lazybot⇒ use me! nil
11:26fenrockwell calculating the hardest paladin hit in the world
11:26clgvGlenjamin: wow!
11:26clgvisnt that 2.0? :P
11:26justin_smithfenrock: ##(nth 100 (iterate str "hello"))
11:26lazybotjava.lang.ClassCastException: clojure.lang.Cons cannot be cast to java.lang.Number
11:26justin_smitherr
11:26justin_smithfenrock: ##(nth (iterate str "hello") 100)
11:26lazybot⇒ "hello"
11:26TimMcjustin_smith: I always get nth's arg order wrong.
11:27cbpclojars got bootstrap'ed
11:27Glenjaminweb 2.0 would be social features
11:27fenrockso & is working, but not , ?
11:27justin_smithTimMc: it's that whole "collection comes last, except for when we don't feel like it" thing
11:27Glenjaminlarge masthead and 3-wide boxes for feature lists is 3.0
11:28justin_smithfenrock: the bot that does , is busy rolling obscene numbers of dice
11:28fenrockah, multibots
11:28gtrak&(Thread/sleep 100000)
11:28justin_smithit must be intentional that clojurebot does not use threads to execute requests
11:29justin_smithgtrak: lol
11:29lazybotExecution Timed Out!
11:29clgvthe "clojars" text color is not optimal yet ;)
11:29justin_smithbots do need naps after all
11:29fenrock&(str "i'm not that stupid")
11:29lazybot⇒ "i'm not that stupid"
11:29Glenjaminxeqi: i think the background colour on the bits to copy-paste on package pages is a tad low contrast
11:29Glenjaminlooks ace in general though :)
11:29clgvjustin_smith: for eval he has a timeout..
11:29justin_smithfenrock: ##"he's also not this stupid"
11:29fenrockhaha
11:30justin_smithfenrock: str on a java.lang.String is kind of silly
11:30gtrak&@(future "TESTING")
11:30lazybotjava.lang.SecurityException: You tripped the alarm! future-call is bad!
11:30gtrakawww
11:30fenrockbut ##"didn't work"
11:30justin_smithright, that's a lazybot thing, not a clojure thing
11:30justin_smith&"OK"
11:30lazybot⇒ "OK"
11:30gtrak&(send (agent) (println "How about agents"))
11:30lazybotjava.lang.SecurityException: You tripped the alarm! send is bad!
11:31gtrakbad syntax anyway, it's for the best.
11:31fenrock&true
11:31lazybot⇒ true
11:31clgvshould work: ##(inc 42)
11:31lazybot⇒ 43
11:32justin_smithI think ## must require a (
11:32fenrock#true
11:32TimMcclojurebot should be restarting shortly. 15 minute restart cycle, right?
11:33fenrock##true
11:33clgvTimMc: ah lol, I thought that were timed sessions...
11:33justin_smithwhere there is alway ##(identity identity)
11:33lazybot⇒ #<core$identity clojure.core$identity@1c34652>
11:33TimMcNah, nuke and reload.
11:33sdegutis,((identity identity))
11:33clgvpretty crafty ;)
11:33TimMcOr rather, the eval service is restarted.
11:33justin_smithsdegutis: too few args
11:34sdegutisjustin_smith: why did not the bot tell me?
11:34clgvTimMc: well currently it is not evaluating ;)
11:34justin_smithsdegutis: it is busy rolling an assload of dice
11:34justin_smithand maybe restarting
11:34sdegutisreally??
11:34lazybotsdegutis: Uh, no. Why would you even ask?
11:34nbeloglazovIs there any reason why 'vec' uses 2 different styles for calling static method: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L354 ? Or is it simply inconsistency?
11:34gfrederickstechnomancy: here's a middle ground for the having-things-refered-in-every-namespace issue
11:35gfrederickstechnomancy: have a hook in the nrepl client or nrepl middleware that preps a namespace only when you switch your repl to it
11:35sdegutisFinally negated our dependency on lein-ring!
11:35sdegutis(Successfully, too.)
11:35TimMcsdegutis: Scroll up, clojurebot is busy rolling some 2147483647-sided dice.
11:35gfredericksthat way you at least aren't mucking in arbitrary lib namespaces you don't care about
11:35tbaldridgenbeloglazov: the LazyPersistentVector works better on things that are already collections (non seqs). So it just wraps the existing structure
11:36sdegutisTimMc: lazybot also answers ,() forms, no?
11:36hyPiRionsdegutis: that's clojurebot
11:36TimMcOnly in private chat.
11:36sdegutis##((identity identity) identity)
11:36lazybot⇒ #<core$identity clojure.core$identity@1c34652>
11:36clgvsdegutis: no
11:36clgv&(inc 42)
11:36lazybot⇒ 43
11:36hyPiRionlazybot: ,()
11:36sdegutis##(take 3 (iterate identity))
11:36lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$iterate
11:36fenrock1d6
11:36justin_smith(nth (iterate identity identity) 100000)
11:36justin_smith&(nth (iterate identity identity) 100000)
11:36lazybot⇒ #<core$identity clojure.core$identity@1c34652>
11:37nbeloglazovtbaldridge: the question why use (. MyClass (method)) and (MyClass/method) in the same method? Why not to use same notation for both cases.
11:37sdegutis##(take 3 (iterate identity identity))
11:37lazybot⇒ (#<core$identity clojure.core$identity@1c34652> #<core$identity clojure.core$identity@1c34652> #<core$identity clojure.core$identity@1c34652>)
11:37gfredericksgtrak: what happens at the nrepl level when I switch my repl namespace?
11:37tbaldridgenbeloglazov: ah, no clue. One is probably older than the other
11:38sdegutis##(->> (iterate identity identity) (take 404) (reduce #(%1 %2)))
11:38lazybot⇒ #<core$identity clojure.core$identity@1c34652>
11:38gtrakgfredericks: hrm :-), probably just an eval, lemme check.
11:38TimMcsdegutis: http://clojure-log.n01se.net/date/2013-04-03.html#19:51b
11:38sdegutisTimMc: :D
11:39gfredericksgtrak: I'm thinking I want a prep-namespace hook of some sort
11:39rkneufeldtpope: In the last little while it seems like cpr has evolved to Require|RunTests. In my case, I feel like it is just running the tests, not requiring the file. Can I ask you what the expected behavior is?
11:42clgv,:back?
11:43fenrockclearly didn't like all those die commands
11:43justin_smithTimMc: ##(identity (identity ((identity nth) (iterate identity identity) (identity 1000000)))) in that same spirit
11:43lazybot⇒ #<core$identity clojure.core$identity@1c34652>
11:47gtrakgfredericks: its' just evaling in-ns
11:47gfredericksgtrak: hmmmmmmmm
11:47gfredericksgtrak: does a middleware seems like the right place to solve this problem?
11:48clgvTimMc: how about NPjure? probably you wont be able to program anything in deterministic polynomial time ;)
11:48clgv+with it
11:48gtrakgfredericks: not sure, I'm guessing you might want to require the ns before switching to it? seems like that might be better with an elisp defcustom.
11:50gfredericksgtrak: I'm talking about referring things after switching to the namespace;
11:50gfredericksthe tricky part being detecting that you've just switched namespaces
11:50TimMcclgv: Hmm?
11:50TimMcWhat would NPjure be?
11:51gtrakoh, hmm.
11:51clgvTimMc: that the problem you cant decide efficiently which programs are written with it ;)
11:52TimMcSorry, still not getting it.
11:52clgvTimMc: NP referring to http://en.wikipedia.org/wiki/NP-complete
11:53gtrakgfredericks: yea, I'm not sure how that would work, since eval itself is a middleware.
11:53gfredericksgtrak: one approach to this is to just shove vars into clojure.core; there's a lib that does that somewhere; seems terrible
11:54gtrakis it that bad to throw it in user?
11:54gfrederickshuh?
11:54gfredericksare you assuming we only use the user namespace at the repl?
11:54gtrakinstead of having extra symbols, just qualify them with user/
11:54gfredericksoooh
11:54gfredericksit's...no fun?
11:55gtrakhahaha
11:55gfredericksa single character namespace might be tolerable
11:55gfredericksu/pprint
11:55gfredericks,(ns u) (def x 42)
11:55gtrakyea, I do that all the time, but u's an alias for a project ns.
11:56justin_smith(ns ∀ ...)
11:56gtrakwe ended up with a util.util namespace after a while, uu :-).
11:56gfredericksI'm wondering what happens when a namespace uses :as u
11:56gfredericksyeah the alias overrides the actual namespace name
11:56gfrederickswhich is good
11:56TimMcclgv: Right, but I'm not getting what you're proposing. A language that does what? Has what characteristics?
11:57gtrakyou can also have aliases with dots in them.
11:57gtrakso go figure.
11:57gfredericks&'//3
11:57lazybotjava.lang.RuntimeException: Invalid token: //3
11:57gfredericks&'//x
11:57lazybotjava.lang.RuntimeException: Invalid token: //x
11:57gfredericksI was hoping it would interpret / as the namespace portion :)
11:58clgvTimMc: no it was no real proposal. since with palindromjure the valid expressions of the language got more complicated - I thought why not make it inefficient to findout whether the expression belongs to the language ;)
11:58clgv*probably inefficient
11:58TimMcAh, hmm.
11:58TimMcYou mean like C++?
11:59clgv:P
12:00TimMcMy understanding is you need a Turing machine to parse C++.
12:00gfredericks(ns =) ; goes well with dvorak
12:00arrdemTimMc: correct, C++ is a context sensitive grammar
12:01TimMcarrdem: I thought CSG wasn't sufficient either.
12:01TimMcI don't know C++ though, so I'm happy to take your word for it.
12:02arrdemTimMc: CSG is the weakest grammar that requires a TM for its implementation..
12:02arrdembeyond that you have undecidable grammars and infinite grammars
12:02arrdemc++ may in fact be undecidable, but I hope not
12:02TimMcOh! We never got into CSGs in my theory of compuation course, so I assumed there was a weaker machine you could use for them.
12:03justin_smithSchroedinger's grammer - the compiler both compiled and failed to compile your code, until you run the program and find out
12:03justin_smith(aka perl for example)
12:03arrdemhehe
12:04hyPiRionTimMc: you can use weaker machines for some specific CSGs, but that's sort of cheating
12:05clgvhuh, outofmemoryexception immanent on 16GB RAM :( I need a better data format than clojure maps for that data...
12:05dbaschout-of-context grammars: where the compiler errors out with “sorry, that was too funny” and posts it to http://www.reddit.com/r/nocontext
12:05justin_smithhah
12:07philandstuffCSGs require linear bounded automata
12:07justin_smithclgv: maybe is vanilla java.util.HashMap, but have a strict handoff semantics (where the map is never modified by a previous owner after being passed to the next function)? but of course you cannot enforce that, it takes discipline to do it properly
12:07philandstuffhttp://en.wikipedia.org/wiki/Linear_bounded_automaton
12:08clgvjustin_smith: yeah or maybe I should start to use a database for that stuff since that looks suitable and I could probably split certain tasks into multiple queries
12:09justin_smithclgv: another option: a core.async go block reading [k v] pairs from a channel
12:09justin_smiththen it is clear that only that block owns the map, and via lexical closure it can't be accidentally tampered with
12:10justin_smithwhere map here is a java.util.HashMap
12:10clgvjustin_smith: that would only help if it served as a pipe between two files but not for the current situation where all the data needs to be in memory
12:10justin_smithclgv: well it could also have a copy on output channel to provide the map to others
12:11clgvI dont think core.sasync would serve me well here
12:11justin_smithor is it that all the data is really too big for one map (and not the gc pressure of clojure map impl being a concern)
12:11justin_smithclgv: just a way to close over the mutable object without increasing size
12:12justin_smithbut if it is really just too much info for a map, even a non-persistent one, yeah use a db, of course (which is effectively a mutable map with a high latency)
12:14tbaldridgeclgv: the caching ability of Datomic might help there. You can walk entities like clojure hashmaps, Datomic will cache commonly accessed data
12:15tbaldridgeclgv: that being said, I haven't the slightest clue about what you're trying to do, so ignore me if I'm saying stupid stuff. :-)
12:16clgvtbaldridge: analysis of data, mostly calculating metrics
12:17tbaldridgeclgv: might be worth looking into then. Roomkey uses Datomic for both online and offline data analysis.
12:20arrdemtbaldridge: thoughts on trying to rewrite multi-arity functions to single-arity functions (where possible mod apply usage) and then tree shaking? I just had the thought that if single arity resolution is possible it may open up inlining opportunities.
12:22Bronsaarrdem: :inline works for multi arities too IIRC
12:22tbaldridgewhy is single-arity conversion a prerequisite for inlining? I think you should be able to just inline the single arity being used.
12:22arrdemBronsa: really? /me checks definline
12:23clgvarrdem: don't use definline just use :inline metadata
12:23arrdemclgv: I know that, but definline has the restriction documentation
12:24clgvarrdem: for itself yes
12:24clgvarrdem: clojure.core has examples for multi-arity inlines
12:25arrdemclgv: looks like vardic is the only thing that inline doesn't support.
12:25cbp,1
12:25clgvarrdem: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L1417
12:26cbpdammit guys
12:27TimMc^ When neither a facepalm or a headdesk will quite express your emotions.
12:28clgv:D
12:29TimMcpalmdesk is of course something else entirely ("Dammit, hyPiRion!")
12:29kzarlaptopwindow
12:30technomancykeyboarddefenestration
12:30arrdemhttp://arrdem.com/i/spock.gif
12:30arrdemfrik
12:30technomancyhttp://p.hagelb.org/spock.gif
12:30cbpuh
12:30technomancyit's cool; I got it =)
12:30cbpstep down son
12:31arrdem(inc technomancy)
12:31lazybot⇒ 114
12:31Bronsaahaha
12:31Bronsa(inc technomancy)
12:31lazybot⇒ 115
12:32hlshipSo, I'm pretty committed to some solutions using core.async
12:32hlshipand I'm getting a bit of pushback
12:32hlshipthe "well, name some high-profile apps that use it"
12:32TimMcugh
12:32hlship(this is JVM, not JS use of core.async)
12:33gtraklol.
12:33gtrakGoogle.
12:33Glenjaminwhat would you use if you didn't use core.async?
12:33TimMcName some high-profile apps that use *Clojure*.
12:33hlshipexactly, it's pretty silly
12:33Kowboyquick, name some high profile apps that use the JVM
12:34technomancy"It's got Tony Hoare's name on it; it's gotta be good."
12:34cbpI can't imagine doing gui without async honestly :-S
12:34gfredericksname some high profile apps
12:34TimMcgfredericks: Naming is hard!
12:34hlshipwithout core.async I would need a significant redesign, and throw lots of cpu/threads/memory at same problem
12:34arrdemcpus are cheap...
12:34TimMcBut, uh... icarus-firewall, there's a name you can use.
12:34gtrakforgiveness instead of permission?
12:35gtrakdatomic must definitely uses it.
12:36tbaldridgemost of datomic predates core.async
12:36gfredericksbest single-character name for a repl util namespace? I'm thinking "u" or "="
12:36tbaldridgeI have absolutely no clue one way or the other, but I'm sure looking at the datomic deps would provide some answers
12:37gfredericksI'd like one of #{"$" "%" "&" "*"} also but I still have to use shift to type them
12:37TimMcgfredericks: .
12:37Bronsagtrak: looking at the datomic pom I don't see a core.async dep
12:37gfredericksTimMc: holy crap I didn't know that worked
12:37TimMcWait, does it?
12:37gfredericksin my repl
12:37arrdem,(require '[clojure.string :as .])
12:37clojureboteval service is offline
12:37TimMcahhhhhhh
12:37hlshipI'm downloading Datomic right now to see what's in it
12:37TimMcI'm sorry I mentioned it.
12:37gfredericks./ is pretty quick for me to type too
12:38TimMcThat's horrifying.
12:38BronsaTimMc: well . is a valid symbol so I don't see why that shouldn't work
12:38arrdemgood grief ./ works..
12:39BronsaI mean you can even (def . 1)
12:39hlshipyes, no sign that Datomic uses core.async
12:39arrdemBronsa: you're still gonna get that cdot patch
12:39TimMcBronsa: I would expect interop to claim it in a bunch of contexts.
12:39BronsaTimMc: in call position, yes
12:39Bronsaarrdem: you'll have to try real hard to convince me on that.
12:39tbaldridgepedestal uses core.async. But I'm not sure if that's "high profile" enough
12:40gfredericksman I'm totally about to do ./
12:40arrdemTimMc: should be ok so long as it's just in symbol/var strings..
12:40TimMcwhat have I done
12:40gfredericksI've already got special neurons dedicated to this key combination thanks to bash
12:41TimMc(./join "a" "bc") -- it's just an accident of the compiler that that isn't turned into (. "a" /join "bc"), right?
12:41clgv1d5
12:41clgv? ;)
12:41arrdemBronsa: I'm open to better aliases for concat
12:41clgvoh ok accidental reply
12:41clgv,(inc 42)
12:41clojurebot43
12:41nullptr`:as . all the things!
12:41clgv^^
12:41Bronsaarrdem: whatever I can reach from my keyboard without using AltGr is fine :P
12:42technomancygfredericks: I like it
12:42arrdemBronsa: dude you just need to use TeX as your input method :P
12:42technomancyit's twisted
12:42BronsaTimMc: not really an accident, .foo works on the symbol name
12:42Bronsaarrdem: rrrright at that point I'd rather AltGr . than \cdot
12:42gfrederickstechnomancy: ./ you mean?
12:42technomancyyup
12:43BronsaTimMc: ie. try (foo/.toString 1)
12:43arrdemBronsa: hah fair
12:43clgv&(read-string "(./join a bc)")
12:43lazybot⇒ (./join a bc)
12:43clgv&(macroexpand-1 (read-string "(./join a bc)"))
12:43lazybot⇒ (./join a bc)
12:44philandstuffis there a way to access clojure's jira over https?
12:44philandstuffand I'm not being paranoid; one of my colleagues owns a wifi pineapple :P
12:45arrdemphilandstuff: have you checked your ethernet for throwing star splitters? :P
12:45TimMcBronsa: Hmm... yeah, true. The interop stuff only takes a swing at already-parsed syntax.
12:46gfredericks,(require '.)
12:46clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate /__init.class or /.clj on classpath: >
12:46BronsaTimMc: my point was that the "." interop thingy only works on the name part of a symbol
12:46TimMcphilandstuff: Ever since a year ago, it's not paranoia, it's common sense.
12:46gfrederickslol apparently I will have to call this file "src/.clj"
12:46philandstuffTimMc: well quite
12:47arrdemgfredericks: please do
12:47TimMcI mean, we already knew, but now we *know*.
12:47TimMcgfredericks: oh jesus
12:47clgvgfredericks: not "..clj"?
12:47gfredericksapparently not
12:47clgvgfredericks: have fun AOTing that thing ;)
12:48clgvor does it convert to __DOT__ ?
12:48gfredericks,(fn . [])
12:48clojurebot#<sandbox$eval123$_DOT___124 sandbox$eval123$_DOT___124@1c7b3c2>
12:48gfredericksin other cases
12:48gfredericksnot namespace names though
12:48gfredericksI wonder how the core team would react to a jira ticket asking for better support for (ns .)
12:48TimMc&(ns-munge ".")
12:48lazybotjava.lang.RuntimeException: Unable to resolve symbol: ns-munge in this context
12:49TimMc&(namespace-munge ".")
12:49lazybot⇒ "."
12:50clgvhaha ^^
12:50Bronsaoh boy ns-munge is really called namespace-munge?
12:50Bronsathat's so inconsistent
12:51gfredericks&(apropos "namespace")
12:51lazybotjava.lang.RuntimeException: Unable to resolve symbol: apropos in this context
12:51arrdemBronsa: jira ticket!
12:51gfredericks&(clojure.repl/apropos "namespace")
12:51lazybot⇒ (*print-suppress-namespaces* namespace namespace-munge file->namespaces namespaces-on-classpath namespaces-in-dir)
12:51clgvBronsa: why? it does not operate on a give namespace
12:51TimMc&(apropos-better 'apropos)
12:51lazybotjava.lang.RuntimeException: Unable to resolve symbol: apropos-better in this context
12:51clgvit's only lengthy
12:51clgv,(use 'clojure.repl)
12:51clojurebotnil
12:51Bronsaclgv: you have a point
12:51clgv,(apropos "namespace")
12:51clojurebot(namespace namespace-munge)
12:51gfredericksnow I need to decide where to setup this special namespace
12:52gfrederickse.g., src/.clj, or my leiningen :repl options, or...
12:52clgvI still wonder why it is not "..clj"
12:53gfredericksclgv: because it turns "." into "/"
12:53gfredericks&(namespace-munge "foo.bar")
12:53lazybot⇒ "foo.bar"
12:53gfrederickssorta
12:54clgv,(require .)
12:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: . in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:54clgv,(require '.)
12:54clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate /__init.class or /.clj on classpath: >
12:55clgv&(clojure-version)
12:55lazybot⇒ "1.4.0"
12:55clgv&(require '.)
12:55lazybotjava.io.FileNotFoundException: Could not locate /__init.class or /.clj on classpath:
12:55TimMcgfredericks: So you have your heart set on (require '.) instead of (require '[my.utils :as .])?
12:55clgvat least ".clj" is a "hidden" file ;)
12:55gfredericksTimMc: yes, because I want it to work everywhere instead of having to prep every namespace I use yn my repl
12:55gfredericksthat's the main problem I'm trying to solve
12:56TimMcI see, so you want a very short way to get it.
12:56TimMcand you don't want keyboard macros or whatever
12:57gfrederickshadn't considered keyboard macros
12:57whodidthisclgv: file name is whatever comes after . i guess
12:58CookedGryphonHey, does anyone know if I can use classes made with deftype in java directly?
12:58CookedGryphonif so how?
12:58gfredericksCookedGryphon: AOT probably? you could also write interfaces in java and code to those, then have the deftype implement them
12:58CookedGryphonnot what I'm trying for
12:59CookedGryphonI'm writing some stuff in java, and want to generate a tuple as defined by clj-tuple
12:59llasramCookedGryphon: By `directly` do you mean e.g. mentioning the `deftype` type by name in the Java source?
12:59arrdemgtrak: the deftype should become <ns path>.MyType from Java's point of view.
12:59llasramCookedGryphon: Oh, for that just use the Clojure API to get the tuple-creating var-function
12:59hiredmanCookedGryphon: sure, just load the clj-tuple namespace and call the clj-tuple functions from java
12:59llasramAnd call it from Java just like you would like from Clojure
12:59gtrakarrdem: thanks :-)
12:59arrdemgtrak: herp derp
13:00CookedGryphonyep, I can do that, I was just wondering if I could actually use the underlying classes it generates directly
13:00llasramBest not to
13:00danneuI run an active forum where I render Markdown posts to HTML and cache them in resources/cache/posts/<post-id>.html. My forum now has 1,172,002 posts. What are the implications of having so many files in an Ubuntu folder?
13:00CookedGryphonfor example the 2-arity implementation of (tuple 2 2) is just (Tuple2 2 2 nil)
13:00CookedGryphonsorry (Tuple2. 2 2 nil)
13:00danneu`ls` takes forever to run and I ctrl-C'd it after 40 seconds
13:01llasramIntroducing a multi-way Java<->AOT-Clojure dependency would make your build sad and tricky
13:01CookedGryphonfair enough, that sounds like my answer
13:01ToxicFrogdanneu: ...are you sure you have the right channel?
13:01CookedGryphonI'll just invoke the clj-tuple/tuple fn, thanks for the discussion
13:03hiredmanCookedGryphon: if you are just looking for jvm tuples boundary has a neat jvm tuple library
13:04danneuToxicFrog: i ask generic dev questions here cuz yall my people
13:04fenrockCookedGryphon: there's good examples of this on page 389 of Clojure Programming.
13:04CookedGryphonhiredman: thanks, but I'm passing into clojure code which makes use of tuple's fast destructuring etc
13:08TimMcdanneu: Probably depends on your filesystem.
13:09TimMcDo a search for something like ext2 directory size
13:09Bronsadanneu: maybe you have something mounted via ssh-fs and it's no longer reachable?
13:10Bronsadanneu: oh sorry I didn't read the first part of your question :)
13:12ToxicFrogdanneu: fair enough
13:12ToxicFrogdanneu: anyways, as you've already noticed doing anything with that dir will be slow as hell. You won't be able to use * in it, since you'll exceed the command line length limit.
13:12ToxicFrogYou may eventually start hitting filesystem limits, although that depends on the fs and what settings it was created with.
13:14umpaHow do you loop recur with sequences as parameters ? https://www.refheap.com/86521
13:17danneuToxicFrog: it's an ext3 disk. folder has 1170377 files which is way above the ext3 limits i find from casual google queries
13:18johnwalkerhow do you use clojure.java.io/writer with a FileWriter?
13:20ToxicFrogdanneu: ext3 doesn't have a maximum number of files per directory, AFAIK, although it does have a maximum per filesystem (based on how many inodes were allocated at fs creation time).
13:20ToxicFrogdanneu: it does have a maximum number of subdirectories per directory, though.
13:21stainthe shell will have limits though
13:21ToxicFrogOh yeah
13:21ToxicFrogHence my comment about not being able to use * in that directory
13:21danneulooks like i'm doing `if (io/resource (str "cache/posts/" (:post/uid post) ".html")) ...` to see if a post exists in that massive directory. i guess i can recreate a massive directoring in a VM to see how long that takes
13:21stainthat's why it is good to use part of the filename/id as subdirectories.. for instance .git/objects/59/1d2525b691251bd9f52848a1e9e2325f013ae2
13:22danneui saw that HN recently moved from a similar system to a /12/12345.html, /12/12346.html
13:23stainI do a similar thing in a zipfile structure I build.. where every data item has a UUID, so I just use the first two characters as subfolder to make it managable
13:23stainI keep those characters still in the filename at the end though (unlike git)
13:25umpastain: danneu: what exactly are you guys talking about?
13:26stain18:00 < danneu> I run an active forum where I render Markdown posts to HTML and cache them in resources/cache/posts/<post-id>.html. My forum now has 1,172,002 posts. What are the implications of having so many files in an Ubuntu folder?
13:27staindanneu: is your io/resource call slow at the moment?
13:27stainas long as you are accessing one and one post it should be fine
13:27stainas you are hand-crafting the filename
13:27stainnot sure why you are doing it through the classpath though
13:27stainyou might have URLClassLoader a bit overworked
13:28stainwhy not just do it as files? I mean you have to write to those files anyway?
13:28stain(or is this bundled inside a WAR or something?)
13:30danneustain: i didnt really have a rhyme or reason for going through io/resource. and it's not even deployed as a jar, just run with lein-ring.
13:31danneui'm going to recreate my server locally in virtualbox to see if it's slow
13:34arrdem(inc amalloy) ;; eclipse suggestion from yesterday
13:34lazybot⇒ 124
13:35danneustain: what do you mean 'just do it as files'?
13:36gfredericks(inc amalloy) ; hangin out here all the time
13:36lazybot⇒ 125
13:38justin_smith(inc amalloy) ; all the cool kids are doing it
13:38lazybot⇒ 126
13:53TimMc&(let [Long String] (instance? Long "abc"))
13:53lazybot⇒ false
13:54TimMc,(let [Long String] (instance? Long "abc"))
13:54clojurebottrue
13:54TimMcniiice, glad that got fixed
13:54TimMc(CLJ-1171)
14:04Glenjamin,*clojure-version*
14:04clojurebot{:major 1, :minor 6, :incremental 0, :qualifier nil}
14:04Glenjamin&*clojure-version*
14:04lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
14:05Glenjamindoes that mean the LHS of instance? cannot be a variable?
14:08amalloyGlenjamin: uhhhhh, he just demonstrated that it can
14:08Glenjaminoh, duh
14:08Glenjamini saw "abc"
14:08Glenjaminand read that as "should be a Long"
14:09Glenjaminthen got confused when i checked the versions
14:09amalloythree letters is pretty long
14:09Jaood(dec amalloy)
14:09lazybot⇒ 125
14:09Jaoodfor recommending eclipse to amalloy
14:09amalloyamalloy: never use eclipse
14:09Jaoodto arrdem :P
14:10Jaood(inc amalloy)
14:10lazybot⇒ 126
14:10TimMcGlenjamin: If you have a lexical shadowing a class, instance?'s inlining would treat it as a literal class name.
14:10Jaoodfor recommending eclipse to amalloy
14:10dbaschthere are always cases for using eclipse
14:10GlenjaminTimMc: yeah, makes sense now - i just read the conditionals the wrong way around
14:10amalloydbasch: it's okay. i know to ignore advice from tricksters like amalloy
14:10TimMcdbasch: It's great for browsing random Java projects.
14:10justin_smithdbasch: "I sure do have a lot of free ram on this computer, whatever shall I do to use it up?"
14:11arrdemelipse solves my primary frustration with Compiler.java, being my inability to visualize the class higherarchy let alone navigate it unaided
14:11dbaschjustin_smith: “I work at the Eclipse foundation and I don’t want to get fired for being a traitor to the cause”
14:11amalloyjustin_smith: for when firefox isn't an option?
14:11justin_smithheh
14:11arrdem16GB, 1.2 in use
14:12JaoodI though IDEA was the sane recommendation when users have a choice
14:13amalloyi'm sure intellij, idea, whatever it is, is fine
14:13dbaschJaood: IDEA was the last IDE that I used, when I had to code in Scala
14:13dbaschI cannot imagine Scala without an IDE
14:14agarmanIDEA isn't at all as impressive now as it was in 2008-2010
14:14dbaschamalloy: it’s totally fine, although it feels like you’re staring at the cockpit of a 747 in terms of controls
14:15amalloydbasch: tried eclipse?
14:15dbaschamalloy: yes but not in the past decade
14:15agarmanif you're not using UML & refactoring (neither of which are useful in Scala or Clojure) IDEA isn't better than Eclipse
14:15dbaschagarman: refactoring is useful in Scala
14:15amalloyit's got a lot of buttons too, i guess is all i was going to say
14:16amalloyit's not as obviously-dominant now as it was when i first tried it in...2003? 2004? but it's still very good for java
14:16agarmandbasch: The Scala IDE for Eclipse is better than what IDEA has for Scala
14:16dbaschagarman: I’ll try it the next time I use Scala, which I hope is never
14:17noncom|2i used to use scala and then switched to clojure
14:17agarmandbasch: I hope to never have to do extensive Scala again... 4 years in hell was long enough for me!
14:17noncom|2i am happy now
14:17dbaschbut everyone in my old team that did Java was very happy with Eclipse
14:17noncom|2(almost)
14:17amalloydbasch will next use scala in Option[Years] time
14:17noncom|2scala eclipse ide is the official one, that's what it is good
14:18dbaschamalloy: where Years is Long or null
14:18noncom|2Long.MAX_VALUE
14:18amalloyah, good old null
14:19noncom|2nil
14:19arrdemNone
14:19amalloya cornerstone of typesafe programming
14:19dbaschyeah, I almost typed nil
14:19noncom|2,((symbol (name :.noSuchMethod)) (Thread.))
14:19clojurebot#<SecurityException java.lang.SecurityException: no threads please>
14:20dbascharrdem: yeah, hopefully that Option will return None
14:20noncom|2,((symbol (name :.noSuchMethod)) (ArrayList.))
14:20clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: ArrayList, compiling:(NO_SOURCE_PATH:0:0)>
14:20noncom|2,((symbol (name :.noSuchMethod)) (java.util.ArrayList.))
14:20clojurebotnil
14:20noncom|2see? ^^
14:20amalloydbasch: that was the joke i was hoping to offer, but i like your Long-or-null better
14:20noncom|2why?
14:20clojurebotwhy is the ram gone
14:21noncom|2why it happens so?\
14:21amalloynoncom|2: http://stackoverflow.com/questions/12281631/what-do-clojure-symbols-do-when-used-as-functions
14:21arrdembecause we use a language that doesn't believe in update in place, next!
14:21dbaschone day I made the mistake of trying to run an open-source project from Twitter written in Scala
14:22amalloyi'm having "fun" trying to use kafka
14:22dbaschoh, they retired it now https://github.com/twitter/snowflake/
14:22noncom|2amalloy: is there a way to dynamically generaet a java class interop method to call?
14:22ystaeldbasch: which part was the mistake? "open-source", "twitter", "scala", or "run"?
14:22dbaschamalloy: Kafka is arguably the best OS project released by my former employer
14:23dbaschystael: open-source and Twitter, probably
14:23amalloydbasch: linkedin, presumably, not apache?
14:23justin_smithnoncom|2: what do you need to generate?
14:23dbaschamalloy: yes, LinkedIn
14:23dbaschamalloy: Voldemort is pretty good too
14:23noncom|2a java class has many methods, i want to create a method call from a :keyword that someone passes to my func
14:23amalloynoncom|2: in general if you're trying to do that you've already made a mistake
14:24noncom|2what would you propose?
14:24dbaschnoncom|2: what’s the broader picture?
14:24amalloyjust calling methods on the object directly. what is the point of an intermediary who converts :size to .size?
14:25amalloybut, yes, reconsidering the broader picture will probably lead you to a better answer than my random instincts
14:26noncom|2i want to encapsulate the work with the object because i do not want to make the user to import the class
14:27noncom|2i want to create a wrapper for this class: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/utils/MeshBuilder.html
14:28dbaschnoncom|2: but if the user is sending you things like :capsule or :circle or :box you’re not really encapsulating anything
14:28amalloy(inc dbasch)
14:28lazybot⇒ 6
14:28noncom|2well, maybe i will later have a map with {:circle 10 10 10 10 ...]
14:28noncom|2sorry, i meant }
14:29noncom|2maybe i want to build something upon it
14:29noncom|2if the methods were clojrue functions that would be easy
14:29noncom|2but them java methods are different
14:29dbaschnoncom|2: I would start by thinking about the api I want to present to the user, and then think about a clean way to do that
14:30dbaschif you’re going to simply put sugar around the java api, might as well just let them use the java api
14:30noncom|2ummm.. the user just writes or generates a set of declarative instructions, just as i have said above
14:30noncom|2yeah, i agree with you
14:31noncom|2but sometimes sugar means much too. and this is not only sugar, this will help to write cleaner drawing routines
14:31dbaschnoncom|2: do you need to expose the entire api, or just a small subset?
14:31noncom|2ideally all api. overtime this will be required anyway..
14:31noncom|2currently i am leaning towards a condp :)
14:32dbaschnoncom|2: if you’re adding methods that do things that the api doesn’t, then I would write those in idiomatic clojure
14:32dbaschnoncom|2: for the rest, I’d just give the user the option to go down to java, like the rest of clojure does
14:33noncom|2ummm, you see, these sequences of calls like [:circle 20 20 20 20] will be generated from sort of data that resembles a bytecode or DNA
14:33noncom|2so that :circle is a building block as well as 20
14:33noncom|2homoiconicity
14:34noncom|2i just need an automata there
14:34noncom|2which will pick the right method by the keyword
14:34noncom|2so condp is the simplest
14:35AeroNotixA colleague wants to use an IDE for Clojure, I heard there was some good integration between some IDE and a plugin
14:35AeroNotixanyone know?
14:35noncom|2eclipse + ccw
14:35AeroNotixccw?
14:35noncom|2or emacs
14:35JaoodAeroNotix: cursive
14:35dbaschnoncom|2: why is it less work to generate those sequences than to generate the actual clojure code that calls the java api?
14:35clojurebotccw is http://code.google.com/p/counterclockwise/
14:35AeroNotixnoncom|2: he's not an emacs user
14:35cbp,1
14:35clojurebot1
14:36noncom|2dbasch: the sequences will be generated automatically, from sound or eeg
14:36AeroNotixthanks noncom|2
14:36noncom|2(this is a very simplifies explanation)
14:36cbpI tried ccw to teach a coworker a few months ago and it was very underwhelming
14:36systemfaultCursive or lighttable :P
14:37systemfaultAnything touching eclipse sucks (my opinion)
14:37amalloysystemfault: that's a sucky opinion (objectively)
14:37dbaschnoncom|2: I’m out of ideas :)
14:38systemfaultamalloy: Could very well be. But the day I switched to IntelliJ, I had no more problem with bad third-party plugins.
15:07dagda1I have this query which is running pig slow in production. Can anyone suggest any pointer as to how I might improve it? http://sqlfiddle.com/#!12/33cd7/20
15:10amalloyyou seem to have accidentally posted a sql optimization question to #clojure, dagda1
15:10dagda1haha
15:10dagda1amalloy: please feel free to answer in clojure :)
15:19danneuDo jvm opts passed via command line override :jvm-opts in project.clj?
15:19technomancydanneu: how do you pass jvm opts via the command line?
15:24danneutechnomancy: when you compile an uberjar, are :jvm-opts 'baked in' to the jar as default opts when you `java -jar app.jar`?
15:24amalloydanneu: no, you can't do that. you're the one typing java, so you get to pass the jvm opts
15:25technomancyyeah, what he said
15:25danneuoh, i see. so :jvm-opts is just used by `lein` commands
15:37cbpdoes anyone have a fn handy to walk the body of a macro, find an expression and do a kind of update-in?
15:39sveriHi, I am reading in a file with "with-open" with this contents: key: value\n key2: value2... and want to convert it to a map {key value key2 value}. I made it so far that I can convert each line to one single map: http://pastebin.com/698gRiu5 But I have trouble reducing it into one single map, can someone help me please?
15:41allenj12so does hiccup and enlive replace html completely/ or atleast mostly?
15:44justin_smithallenj12: well they produce and interpret html. Whether you still use html directly probably depends on the skillset of the people you collaborate with.
15:45justin_smithallenj12: for example I did not use either very much when working on web stuff, because I worked with frontend developers who did not know clojure at all
15:45allenj12justin_smith: gotcha so if im doing this solo, would i need/be recommended to use any html?
15:46justin_smithallenj12: you would probably end up learning some html whether or not you meant to (much like I learned java despite myself by using clojure enough)
15:47justin_smithbut I mean hiccup is html, it just has some tags embedded in it
15:47justin_smithand those tags produce more html...
15:47allenj12justin_smith: yea i know that i was just wondering if there was any real point in making any html files directly
15:47dbaschsveri: you shouldn’t be using doseq. What does your file look like?
15:48dbaschsveri: is it “colon-separated values” ?
15:50justin_smithsveri: would lines have the same keys, or would a key be unique across all lines?
15:50sveridbasch: yea, I just found out reduce is better and am fiddling with it :D
15:50sveridbasch: justin_smith I am not sure how it will look exactly, so I am taking a split function here
15:53Jardahas anyone created a sqlkorma store for clauth?
15:55justin_smith,(reduce (fn [mp line] (reduce (fn [m [k v]] (assoc m k v)) mp (partition 2 (clojure.string/split line #":")))) {} ["a:0:b:1" "c:2:d:3"]) ; sveri - maybe soemthing like this?
15:55clojurebot{"d" "3", "c" "2", "b" "1", "a" "0"}
15:56justin_smithsveri: but if multiple lines may have the same keys, you probably want to do an something liek update-in m [k] (fnil conj []) v or however that is done
15:57dbaschsveri: how about https://www.refheap.com/86526
15:57dbasch(assumes no repeated keys)
15:58justin_smith,(reduce (fn [mp line] (reduce (fn [m [k v]] (update-in m [k] (fnil conj []) v)) mp (partition 2 (clojure.string/split line #":")))) {} ["a:0:b:1:c:hello" "c:2:d:3"])
15:58clojurebot{"d" ["3"], "c" ["hello" "2"], "b" ["1"], "a" ["0"]}
15:58justin_smithworks with repeated keys
15:59sverijustin_smith: dbasch thats both awesome solutions :-) I wonder which day will be the day my head starts to think of them himself :D
15:59justin_smithsveri: work from the inside out, and always visualize the shape of the data - eventually it is like legos
16:00dbaschsveri: one step at a time :) first, remember that doseq returns nothing, so you don’t want to use it if you’re trying to transform one thing into another
16:00justin_smithsveri though I tend to go overly generic and just reach for my favorite building blocks - so my solution will work but not be the most concise / elegant / clear
16:00dbaschdoseq is for side effects, e.g. printing stuff to stdout
16:01sveriyea
16:01dbaschyou have a line-seq, and you want to convert it into another structure via application of functional transformations
16:01sveriI get that, understanding the difference between doseq and reduce is the easiest part :D
16:01justin_smithsomeone should really make a clojure flavored pharmaceutical commercial spoof (side effects may include the mutation of values in another thread or printing to stdout, ask your tech director if clojure is right for you)
16:02dbaschmy thinking was: first, split every line into two pairs, then convert those pairs into a map where each pair is a mapping
16:03dbaschsorry, split every line into a pair
16:03justin_smithdbasch: oh, was it really one pair for a line? that would have been easier than my overgenerlization then
16:03dbasch(inc justin_smith )
16:03lazybot⇒ 2
16:04justin_smithis inc sensitive to paren placement or something?
16:04justin_smith$karma justin_smith
16:04lazybotjustin_smith has karma 47.
16:04dbasch(inc justin_smith)
16:04lazybot⇒ 48
16:05dbaschlazybot’s parsing clearly is
16:05dbasch(inc )
16:05dbasch(inc )
16:05lazybot⇒ 1
16:05dbaschhaha
16:05justin_smith(inc significant white space )
16:05lazybot⇒ 1
16:05allenj12domina hasnt seem to be updated recently, why is that?
16:06justin_smith$karma significant white space
16:06lazybotsignificant has karma 0.
16:06dbasch$karma
16:06dbasch$karma
16:06justin_smithdbasch: your client is not sending trailing white space
16:06dbasch$karma ;
16:06lazybot; has karma 0.
16:06justin_smith$karma
16:07dbasch$karma ;
16:07lazybot has karma 0.
16:07dbasch$karma ;
16:07lazybot has karma 0.
16:07justin_smithodd
16:07dbaschjustin_smith: the convert-line-to-map-entry function implied that it was one pair per line
16:08clojurebotGabh mo leithscéal?
16:08justin_smithdbasch: yeah, sometimes I code faster than I read
16:09dbaschclojurebot: one day you’ll |learn| that not everything can be solved with the Irish language.
16:09clojurebotOk.
16:18TimMcjustin_smith: I'll do the voice if someone else wants to provide a good mic. :-P
16:20justin_smithheh
16:41sveriHm, I have generated a template with enlives deftemplate function, now I would like to store that in a html file on disk, but deftemplate returns a persistentvector, anyone knows if there is a method to convert it? Or do I have to do it by hand?
16:43sverinevermind, doseq over the vetcor and writing the result just does the trick
16:50stephenjudkinswhat are good OSS clojure projects to read?
16:52technomancymaybe syme if you want a small web app
16:53justin_smithstephenjudkins: flatland/useful is pretty great
16:54nDuffstephenjudkins, ...if you're interested in clojurescript with core.async, I found the dots game implementation by Bruce Hauman to be a good one -- thorough walkthrough of the code and the process of refactoring it in his blog.
16:56hiredmanhttps://github.com/liebke/analemma is nice, small, was created as an example of using clojure, does lots of datastructure fiddling, and you get to draw pictures
16:56hiredman(but it hasn't been touched in 3 years)
16:57justin_smithanalemma is pretty cool, yeah
16:57justin_smithand very easy to use
16:58justin_smith(it even makes animated svg)
16:58hiredmanoh, neat, I haven't seen the animated bits
16:59justin_smithhttp://liebke.github.io/analemma/ animations here
17:00stephenjudkinsthanks for the links, all
17:05cbp/
17:16gfrederickshuh. so having a "src/.clj" apparently isn't working
17:17justin_smithsrc/..clj maybe?
17:18hiredmanthe arc of history is long but it bends toward justice
17:18gfredericksI guess it's worth a try
17:18justin_smitheven better would be if you namespace was my...something.other such that the containing directory would have to be parallel with its parent
17:18gfredericksnope ..clj doesn't work either
17:19gfredericksI'm just going to have to use user.clj
17:27technomancygfredericks: can you use load instead of require?
17:27technomancynot that it's a thing I'd recommend
17:34gfrederickstechnomancy: yeah that totes works; not sure how to do that as a library though
17:34gfredericksoh wait
17:34gfrederickshm
17:34gfredericksI'm not sure I attempted load correctly
17:35amalloygfredericks: what tomfoolery are you up to here?
17:35gfredericksamalloy: trying to gain myself repl utils that work from everywhere but without being too evil
17:35gfredericksreferring things everywhere is hard, so I settled on (ns .)
17:35gfredericksthen I can use ./foo from everewhere
17:36technomancythe tommest of foolery
17:36hiredmanis refering things everywhere actually hard?
17:37gfrederickshiredman: I think so
17:37hiredmancan't you just alter the refer function to refer your code when it refers clojure.core?
17:37technomancymonstrous
17:37gfrederickshiredman: yeah there are techniques like that that definitely work, but changing EVERY namespace (including all lib namespaces) rather than just the ones I actually end up using is a lot scarier
17:38technomancygfredericks: have you tried adding a cider hook for the change-namespace command there?
17:38hiredmangfredericks: maybe it should be custom nrepl middleware
17:38gfrederickstechnomancy: nope
17:38hiredmantechnomancy will tell you all about nrepl discover
17:39gfrederickshiredman: I was imagining that, but gtrak told me namespace changes are done by simply evaling (in-ns ...)
17:39gfredericksso that'd be weird to intercept
17:39gfrederickstechnomancy has told me about nrepl-discover every time I've brought this up, except for today
17:39amalloygfredericks: you're attempting black magic, right? does "weird" matter?
17:39hiredmangfredericks: oh, but with custom middleware you can intercept (foo) and load gfredericks.utils and run (gfredericks.utils/foo) instead
17:39gtraknrepl-discover is not 'mature' enough to make it into cider yet, heh, heh.
17:39gfredericks./ has the advantage of not being dependent on my tooling
17:40hiredmanfah
17:40gtrakI'm pretty sure that just means 'not my code'.
17:40hiredmanyou are always dependent on tooling
17:40gfrederickshiredman: that only works if it's a top-level call
17:40ludwig`is it possible that component local state in om is entirely broken?
17:40arrdemgtrak: now there's damning with faint praise..
17:40gfrederickshiredman: yeah but I can easily end up running code in various contexts
17:42{blake}I thought there were :when bindings for let. (Not when-let, I know that's a thing.) My REPLs are disagreeing.
17:42amalloy{blake}: no, there aren't
17:42gfrederickshiredman: e.g., somebody in a web browser via session, or in a deployment with a raw clojure.main
17:42gfrederickss/somebody//
17:42{blake}amalloy, Dammit. I should've known you'd take their side.
17:42arrdem{blake}: for has :when
17:43amalloyarrdem: another entry in "weird things programmers say"
17:43{blake}arrdem, That's probably where I'm getting the idea from, thanks.
17:43amalloy{blake}: egamble has a macro that includes :when and various other nonsense in a let-binding
17:43arrdemamalloy: heh
17:43amalloy$google egamle let-else
17:43lazybot[guitar chords, guitar tabs and lyrics - chordie] http://www.chordie.com/song.php
17:43amalloy$google egamble let-else
17:43lazybot[egamble/let-else · GitHub] https://github.com/egamble/let-else
17:44hiredmangfredericks: session should really be using nrepl
17:45{blake}Ooh. Guitar tabs.
17:46gfrederickshiredman: agreed
17:46{blake}amalloy, Thanks.
17:49NikenticAny tips on how to reslove function from a string?
17:50arrdemplease don't, use a static dispatch table and resort to clojure.core/resolve if you know what you're doing.
17:50TEttingerNikentic, yeah it uh can be a pain with namespaces
17:51gfredericksamalloy: I guess by weird I meant unreliable; sensitive to client changes, doesn't necessarily work across clients, etc
17:53hiredmangfredericks: so what would you put in such a bag of tricks?
17:54gfrederickshiredman: if you're asking what goes in the namespace: https://github.com/gfredericks/repl-utils/blob/master/src/com/gfredericks/repl.clj
17:54gfredericksthe best one is the bg macro at the bottom
17:55hiredmanhuh
17:57amalloygfredericks: canonizing a record seems like a dangerous plan
17:57amalloyin that it won't print as a record
17:58gfredericksamalloy: totes; I just added that today
17:58gfredericksamalloy: it's just for pretty-printing, so not too risky
17:59amalloygfredericks: your hack could be to add all these functions to clojure.core
17:59amalloythen you wouldn't need to refer them
17:59gfredericksamalloy: yeah I've tried that
17:59gfredericksamalloy: you have to be careful about doing it before *any other* namespace boots up
17:59gfredericksand it still has the universality disadvantage, of modifying namespaces you'll never need to touch
18:00amalloybut it can't do anything bad to those namespaces
18:00amalloyjust cause them to get a warning about overwriting a var
18:00gfredericksno but I'll get warnings from clojure.repl about dir already being defined and crap like that
18:02hiredmanbut, I mean, come on, how often do you really use dir?
18:02gfredericksa lot
18:03technomancywhy not just use tab completion?
18:03gfredericksautocomplete in cider is super janky and I want to turn it off
18:03technomancyseriously, afaik everything in clojure.repl is obsoleted by cider
18:03amalloytechnomancy: apropos
18:03technomancynot auto-complete, just regular completion
18:03gfrederickstechnomancy: I don't think that really applies
18:04gfredericksif I don't know the name of a function
18:04technomancyamalloy: huh... I didn't realize that got moved to clojure.repl, but touche
18:04gfredericksjust what namespace it is in
18:04technomancygfredericks: you can still use tab completion
18:04technomancyalias/ TAB
18:04gfrederickson what basis does it figure that out?
18:04gfredericksoh crap that works
18:05gfrederickshow does that work
18:05technomancyit's the same algorithm with "" as the input
18:05amalloytechnomancy: not that i actually use apropos, or anything in clojure.repl. but whenever i say "just use emacs, bro" someone complains about apropos
18:05amalloyit's fun to be on the other side for a change
18:05technomancyheh
18:06technomancytime to add apropos it to cider I guess
18:06gfredericksjust added debug-repl break! and unbreak! as well
18:06amalloymost of my programs could use an unbreak!
18:06gfredericks:P
18:06technomancydebug-repl *really* needs cider support
18:06technomancyerr
18:07technomancynrepl-discover support I mean =D
18:07amalloyso, i left (future (while true (swap! a inc))) running for about 20 hours. any guesses how high it's gotten?
18:07gfredericksyou're talking about my debug-repl or some other identically named project?
18:07technomancygfredericks: talking about the original debug-repl
18:07arrdemamalloy: I'm sure it hasn't overflowed ;P
18:07gfredericksalex-and-georges?
18:07amalloyoh, i actually used inc'
18:07amalloyso it can't
18:07technomancygfredericks: yeah
18:07gfrederickstechnomancy: I rewrote that as nrepl middleware
18:08technomancyoh right
18:08technomancyanyway, not being able to M-x that and bind it to an emacs binding is sadface
18:08gfredericksI was trying to factor out an nrepl-mux functionality when I ran into nrepl boogs
18:09gfrederickssomeday gtrak will just fix them for me
18:09amalloyokay well you all failed to guess anything, so [spoiler]: 2851591830804
18:09gfredericksamalloy: also brazil just won 3-1
18:09gfredericksthat's another way of counting things
18:10technomancygfredericks: man, it feels kinda nice not to be the person referenced in that sentiment
18:10gtrakgfredericks: what did I do this time?
18:10arrdemaaaah I need to start watching the cup
18:10technomancyarrdem: a watched cup never boils
18:10gfredericksgtrak: declare your desire to git into the nrepl bug
18:10gtrakhaha
18:10amalloygfredericks: you just angered hordes of people who are excited enough about football to watch the game, but not so excited that they mind tivoing it
18:10gtrakyea, I just wanted CLJS to work, look what happened
18:10gfrederickstechnomancy: man thank goodness gtrak wrote leiningen what would we do without him
18:11gtraklol wut.
18:11gfredericksamalloy: those hordes of people aren't part of my mental model of the world
18:11amalloyit turns out they're pretty laid back anyway
18:12gfrederickshah
18:13brehauthuh apparently sportsball is on in my office and i hadnt even noticed
18:13arrdem"sportsball"
18:13arrdemDota is the only real sport besides CouterStrike amirite? :P
18:13devnAnyone want to hear a cool rant about LSD and Clojure? Here's the link...
18:13devn;)
18:14arrdemdevn: -_-
18:14arrdemdevn: where's that lsd and systems programming article..
18:14technomancybest sportsball: https://en.wikipedia.org/wiki/FIRST_Robotics_Competition
18:14devnList comprehensions dude. So groovy.
18:14arrdem$google lsd unix systems programming
18:14lazybot[Famous quotations about the Unix operating system] http://www.linfo.org/q_unix.html
18:14gtrakI remember he came on the list initially and was like, 'hi guys, I'm going to do some cool things later'
18:15technomancygtrak: whom?
18:15devngtrak: it's cool. he's not being a jerk about it
18:15gtrakthe LSD Clojure blog post.
18:15allenj12justin_smith: hey if i use hiccup for everyithng, does that mean its being re loaded every time a user accesses a page? or does it cache it?
18:15gtrakyea, he seems nice, it's just not good manners, maybe inadvertently.
18:16devni mean, it could make for an interesting discussion
18:16devnbut not on a huge public ML
18:16justin_smithallenj12: I forget if / how much / hiccup caches. you could put a memoize around your hiccup function
18:16justin_smithor put varnish in front of your server with smart parameters on it
18:16devn"This one time..." :X
18:16gtrakhonestly I hoped there would be more talk about neurochemical aspects of LSD and Clojure.
18:16allenj12justin_smith: varnish?
18:16justin_smithvarnish is a universal caching layer you put in front of a web server
18:16devngtrak: i think the "ugh, don't post this here" probably stopped any interesting conversation from happening
18:17hiredmanI dunno that hiccup caches anything, but it does try to generate as much html at macro expansion time as it can
18:17justin_smithmost clojure web servers should have at least nginx in front in production, and may benefit from having varnish in front too
18:17devngtrak: there are some pretty interesting LSD programming experience reports i read a long while ago
18:17amalloyyeah, exactly what hiredman said. no caching, but clever pre-generation
18:18gtrakdevn: I bet if you posted a thoughtful response it would blow over, I don't have much to say.
18:18gtrakalso I'm curious :-)
18:19allenj12justin_smith: hmm kk ill look more into that once im done with this, thanks dude
18:19philandstuffam I missing something or is there a reason that butlast isn't lazy?
18:19devngtrak: i suppose this channel is logged and public
18:19allenj12justin_smith: ill also try to find out more about hiccup and letya know if i fond anything
18:19devnbut again, im not so hot on chatting LSD in a public ML
18:19gtrakhaha
18:20arrdem^^ yeah.... why would you think this is a good idea...
18:20amalloyphilandstuff: i'm not aware of any good reason; you can use (drop-last coll 1) if you want
18:20justin_smith"we would consider for this position, but according to the Internet you used LSD once"
18:20devn"HI DEVIN I WORK WITH A LARGE BAY AREA TECH COMPANY AND WE FOUND YOUR GITHUB PROFILE. IT ALSO LOOKS LIKE YOU'RE INTERESTED IN LSD. YOU MIGHT BE A PERFECT FIT. HAVE TIME TO CHAT ABOUT THE OPPORTUNITY?"
18:20arrdemhaha
18:20gtrakso, what we're saying is thoughtful responses are less likely than usual.
18:20justin_smithlol
18:21justin_smith(inc devn)
18:21lazybot⇒ 19
18:21devngtrak: lol i just think it's kind of a weird forum for it
18:22devncan you imagine recruiters reaching out based on a healthy interest in psychedelics?
18:22philandstuffamalloy: oh awesome, thanks :)
18:23philandstuff(inc amalloy)
18:23lazybot⇒ 127
18:23devni am not interested in those kinds of things /these/ days, but i wonder what kind of company you'd wind up with if you hired a bunch of "experienced" engineers
18:23devnif you get what im layin' down
18:24technomancyclojurebot: are you experienced?
18:24clojurebotExcuse me?
18:24philandstuffamalloy: and drop-last defaults n to 1, so I can just do (drop-last coll)
18:24arrdemheh
18:24philandstuff,(drop-last [1 2 3])
18:24devnhaha technomancy
18:24clojurebot(1 2)
18:24arrdemdevn: well if they're youngish you get dogecoin, reddit and pineapples on everything.
18:24cbp`clojurebot was offended
18:25technomancysorry clojurebot; I didn't mean to pry
18:25gtrakdevn: sounds 'innovative'
18:25devnyeah, a real "heady" crew
18:26justin_smithor just your typical Portland startup
18:26shaunhi, can someone explain what "pending state" means in Om, in the context of the `get-state` function? https://github.com/swannodette/om/wiki/Documentation#get-state
18:27umpais this an optimal loop recur?
18:28umpa,(defn looper [x y] (loop [x1 x, y1 y] (if (< x1 5) (let [x1 x1](println x1) (recur (inc x1) y1)))))
18:28clojurebot#'sandbox/looper
18:28umpa,(looper 1 1)
18:28clojurebot1\n2\n3\n4\n
18:29Bronsaumpa: that let is useless and you never use y1
18:29gtrakumpa: you don't need to loop either, recur will hit the top of the fn.
18:29umpaBronsa: how to do without let ?
18:30justin_smithumpa: the recur creates a new binding
18:30justin_smithyou don't need let for that
18:30Bronsaumpa: (defn looper [x y] (when (< x 5) (println x) (recur (inc x) y)))
18:30Bronsay is still useless though
18:31justin_smithBronsa: I assumed it is a simplification of some code where y did something
18:31Bronsajustin_smith: you're probably right
18:31umpajustin_smith: is correct
18:45shaunNevermind about the Om question, pending state is explained by the distinction between `get-state` and `get-render-state`
18:47amalloyincidentally, has anyone ever looked at the implementation of drop-last? it's a pretty neat way to do it, i've always thought: it's not immediately obvious how to remove the last N items of a collection while being as lazy as possible
18:49Bronsaamalloy: yeah I've always thought drop-last was really cool
18:50justin_smithamalloy: oh wow, that is really cool
18:51amalloyoh, interesting. looked at one of the commits that affected drop-last, and apparently at the time (if x y z) was a macro that just expanded to (if* x y z) for some reason
18:52hiredmanamalloy: when nil punning went away
18:52hiredmanif become a macro that expanded to if*, and if would check for nil punning and warn
18:52amalloyhah, neat
18:52hiredmanclojure: days of future past
18:55amalloyhiredman: in this context by nil punning you mean that empty seqs used to be falsey, right?
18:59cbp`(inc drop-last)
18:59lazybot⇒ 1
19:00BronsaI wonder if there's a way to write drop-last without realizing the whole seq
19:01justin_smithBronsa: well, drop-last is already lazy and you can't know where the end is until you hit it, right?
19:01Bronsait would require a lazyseq type that was also counted
19:01Bronsawhich sounds counterintuitive
19:02justin_smithbut there are many cases where the seq should be lazy, but you know the max length at creation time
19:02justin_smithie. when lazy-seq is abstracting over map on an expensive calculation - you know the size of the input, but don't want all the results unless you need them
19:03justin_smiths/know/may know
19:03Bronsaright
19:03Bronsathe issue there is that some lazy functions would be able to preserve this info while others wouldn't, e.g. map vs filter
19:04justin_smithbut in that case you still could know an upper bound
19:04brehautBronsa: i think that haskell achieves something like what you are talking about with its rewrite rules
19:04Bronsathat would be pretty useless justin_smith
19:05Bronsajustin_smith: for a drop-last, at least
19:06justin_smithright, but I can think of other situations where hypothetically knowing an upper bound would be useful
19:08dbaschjustin_smith: more obvious case: (range some_big_number)
19:09amalloycounted lazy seqs are pretty hard to work with, but a counted reducer is somewhat viable
19:10amalloyeg, in http://dev.clojure.org/jira/browse/CLJ-993 i include Counted for my Range reducer
19:10justin_smithdbasch: sure, but we often use lazy operators on vectors or even maps via seq
19:11dbaschjustin_smith: you’re right. A real-life case that comes to mind is a vector of imap envelopes for which you want to get the contents lazily
19:15gfredericksshould I use auto-complete-mode in the repl buffer?
19:18cbpwhen I did that it would randomly create massive amounts of new lines which was pretty annoying
19:18cbpI've been told it's because of popup.el
19:18cbpcompany mode works fine though
19:21mdeboardhi, Can anyone recommend a good lightweight testing library? I'm modeling a board game and I'm getting to the point where there's too much code for me to test everything by hand :P
19:21gfredericksclojure.test is the lightweightiest
19:21mdeboardI used midje a couple years ago with a cascalog thing but idk if that's still a good choice
19:21amalloymidje has never been lightweight
19:22gfredericks"midge is a lightweight set of maven coordinates to locate a heavyweight testing library"
19:22mdeboardgfredericks: Is tehre a caveat there or?
19:22mdeboard(wrt clojure.test)
19:22gfredericksmdeboard: it's missing a few things that feel obvious, but they're not major; it's simple enough that you can pretty well understand what it's doing
19:23justin_smithclojure.test is good. it is simple.
19:23justin_smithgfredericks: what occurs to you as missing from clojure.test?
19:23mdeboardSomeone linked http://jayfields.com/expectations/ the other day
19:24gfredericksjustin_smith: docstrings on tests
19:24gfredericksthe order of args to is feels pretty backwards
19:24dbaschif I’d written that library, I would have called it Inquisition
19:25mdeboardEvery time I see "Expectations" i think of old SNL skit, "Lowered Expectations"
19:25justin_smithgfredericks: that is what clojure.test/testing is for
19:25gfredericksfixtures can be a little weird
19:25gfredericksjustin_smith: extra nesting just to add the docstring?
19:26justin_smithI like it because it nests and allows multiple descriptions in one test
19:26amalloy&(macroexpand '(clojure.test/are [x y] (let [y (+ x y)] (= y x)) 0 0))
19:26lazybot⇒ (do (clojure.test/is (let [0 (+ 0 0)] (= 0 0))))
19:26justin_smithit's more than a docstring, it is also part of what prints on failure
19:27gfredericksjustin_smith: yeah that's what I mean by docstring
19:28hiredmanamalloy: there used to be no such thing as an empty seq, there was just nil
19:28hiredmanthere was no lazy-seq macro, there was this lazy-cons thing
19:29hiredmansubtlety different
19:37mdeboardNo let-binding with deftest ?
19:39justin_smithmdeboard: huh? I use let in deftest all the time
19:39mdeboardI see
19:40justin_smithanother thing I do that may be more counterintuitive, is make a defn that calls test/is and run it inside a deftest
19:40mdeboardone o' them watchacall pebcak errors on my part
19:40justin_smithahh
19:43allenj12can someone tell me whats going on here? (defmacro defpage [page-name & body] '(def page-name (memoize (fn [] (html5 ~@body))))) ;; body is not being recognized, why?
19:43allenj12woops
19:43allenj12i ment here ?
19:43allenj12https://www.refheap.com/86533
19:43allenj12yea
19:44justin_smithdo you want ` instead of ' ?
19:45dbaschyou probably want to unquote page-name as well
19:45justin_smithalso, if you leave [] out, then the caller of defpage can decide if and what arguments should be provided for a given page
19:45allenj12dbasch: i did but then it complains that page-name is not a symbol
19:46mdeboardI think clojure.test is plenty good for my needs atm
19:46justin_smith~'page-name
19:46clojurebotHuh?
19:46justin_smithor maybe '~page-name
19:46justin_smithI forget now
19:46allenj12why would you quote it just to unquote it
19:47Bronsa`~'a
19:47Bronsa,`~'a
19:47clojurebota
19:47Bronsa,`a
19:47clojurebotsandbox/a
19:47dbaschallenj12: actually, why is that even a macro?
19:47justin_smithbecause it is an argument, but it is an argument used as a symbol, not evaluated for avalue
19:47justin_smithbecause he wants to make a def for a certain symbol
19:47Bronsajustin_smith: with def actually there's no need for ~'
19:47Bronsa,*ns*
19:47clojurebot#<Namespace sandbox>
19:48Bronsa,(def sandbox/a 1)
19:48clojurebot#'sandbox/a
19:49allenj12so i tried '~page-name ~'page-name as well and same problem
19:50allenj12page-name not a symbol for def
19:50justin_smithoh yeah, ~page-name actually works
19:51justin_smithmy bad
19:51dbaschallenj12: btw, what is body? can you give a usage example?
19:51justin_smith(defmacro defpage [page-name & body] `(def ~page-name (memoize (fn [] (html5 ~@body)))))
19:52allenj12its hicuup code
19:52justin_smithdbasch: idiomatically, it would be the body of a function, or some other (do ...)
19:52allenj12i know the problems
19:53allenj12I used ' not ` im a dumbass
19:53allenj12lol
19:55dbaschwith ` and ~page-name it works fine for me
19:56allenj12dbasch: yea as i said before i accidentally used '
19:57allenj12dbasch: i feel dumb
19:57dbaschallenj12: that’s what macroexpand-1 is for :)
19:57dbaschit tells you before other people tell you :P
19:57justin_smithallenj12: an idea, you could turn the args list into [name args & body] and replace the (fn [] ...) with (fn ~args ...) then an individual defpage could decide what arg list to take
19:58allenj12justin_smith: good idea, thanks? btw memoizing like that should work right?
19:58justin_smithin case you eventually want dynamic content of any sort
19:58justin_smithyeah, memoize makes a map from args to results
19:59justin_smithso a new arg means looking up a different result
19:59justin_smithjust don't expect memoize to work with things that randomize their output or depend on things that are not args
20:00justin_smithso if you have anything like social activity or whatever that will vary with page loads, they should come in as args for memoize to work properly
20:00allenj12justin_smith: yea alright thanks! if i cant run this all the way through all try varnish like you mentioned
20:02johnwalkerjustin_smith: ordered my copy of jcip :)
20:02allenj12justin_smith: actually what if some of the pages i write are static, would i still benefit from memoize
20:04justin_smithabsolutely
20:04justin_smithjohnwalker: awesome
20:04justin_smithallenj12: even more so, since that way it only needs to generate once, and there is only one value in the table to look up
20:07allenj12justin_smith: awsome
20:14nkozohow do you run "lein test" only for clojure test in a project (in this case, Prismatic Schema) that also compiles to clojurescript (using cljx)
20:15justin_smithnkozo: you can use test selector metadata on your test definitions, and use lein test :foo to run only tests with metadata foo
20:15justin_smithnkozo: oh, this is someone else's codebase? hopefully they have defined selectors, or you could add them I guess
20:16nkozomm, I don't see any selector, the tests are defined in a .cljx file
20:27cpetzoldnkozo: so you want to run the clj tests and not the cljs ones?
20:27nkozocpetzold: exactly
20:27cpetzoldyou can temporarily comment out this line: https://github.com/Prismatic/schema/blob/master/project.clj#L17
20:28nkozocpetzold: oh, I see, thanks!
20:28cpetzoldnp :)
20:28cpetzoldout of curiosity though, why don’t you want to run the cljs tests?
20:29justin_smithprobably because of making changes to clj and not cljs and cljs takes a long time to run?
20:29justin_smithjust a guess
20:30nkozoyes, an because I'm making some changes in the clj version temporary incompatible with the cljs one
20:32boovhi
20:32boovwhere i can find young girls?
20:33boovwhere i can find young girls?
20:34boovwhich one holocaust was your favourite one?
20:38TEttingeryeah that'll work...
20:38TEttingerseems to be more trolls lately
20:39mdeboardrussia
20:39TEttingerhe was from poland
20:45allenj12is there any site that explains how to have leiningen to update localhost on file save? i remember running into one but cant find it now
20:49bob2as in reload your code?
20:49allenj12bob2: as in re compile the clojurescript file and re fresh local host
20:49allenj12bob2: pretty much just restart everything
20:50allenj12bob2: i remember a guy doing it with :alias and adding something to his script but i forget how
20:50allenj12bob2: and using a light table connection
20:55allenj12this is gonna drive me net
20:55allenj12nuts
21:02allenj12i remember he called the alias lein up
21:02allenj12still cant find it tho
21:07devnhow do you get "\space" from \space?
21:07devni cant brane good. i have the dums
21:08brehaut,(str \space)
21:08clojurebot" "
21:08brehautprobably not
21:08brehaut,(pr \space)
21:08clojurebot\space
21:08devndoy, thanks dude
21:08justin_smith,(pr-str \space)
21:08clojurebot"\\space"
21:09justin_smithpr-str is awesomesauce
21:09devn,(with-out-str (pr \space))
21:09clojurebot"\\space"
21:09justin_smith,(pr-str \ )
21:09clojurebot"\\space"
21:09devnoh weird, i swear i tried pr-str and it didn't work
21:10allenj12where is a good site to find out to set up leiningen to recompile clojurescript and to refresh localhost on save?
21:12nDuffallenj12, I'd suggest using figwheel for that.
21:14nDuffallenj12, ...see http://rigsomelight.com/2014/05/01/interactive-programming-flappy-bird-clojurescript.html
21:14devnhonestly, the reason i wanted this is a bit silly, but... in this particular case I'd like to use destructuring on a map for characters
21:14allenj12nDuff: awsome thank you :)
21:14devnbut alas, we only have strs, syms, keys
21:14justin_smithno chars, it's an outrage
21:15nDuff(though, err, *grumble* re: asking for a link about doing X, as opposed to just "how do I do X?")
21:15devnwhy /dont/ we have :chars, :ints, etc.?
21:15justin_smith:ints would imply that the symbol '1 would not be bound to 1, which sounds evil to me
21:16justin_smithbut yeah, :chars makes sense
21:16justin_smith,(= '1 1)
21:16clojurebottrue
21:16nDuff...note that figwheel goes beyond just reloading the page completely from fresh, and actually tries to keep state across code revisions. :)
21:17devnjustin_smith: yeah i can dig that
21:19justin_smithnow I am remembering amalloy_'s evil reflection trick to change the value of one of the integers...
21:20devnhaha, i was just thinking about that today
21:26jack_rabbitdevn, what's the trick?
21:31justin_smith,(let [five (long (int (+ (int 1) (int 4)))), field (nth (.getDeclaredFields Long) 3)] (.setAccessible field true) (.set field five (int (+ (int 1) (int 4)))))
21:31clojurebotnil
21:31justin_smith,(range 10)
21:31clojurebot(0 1 2 3 4 ...)
21:31justin_smith,(range 2 6)
21:31clojurebot(2 3 4 5)
21:32justin_smithhmm
21:32justin_smithahh
21:32justin_smiththat was the undo :)
21:32justin_smith,(let [field (nth (.getDeclaredFields Long) 3)] (.setAccessible field true) (.set field 5 2))
21:32clojurebotnil
21:32justin_smith,(range 2 6)
21:32clojurebot(2 3 ...)
21:32justin_smith(inc 5)
21:32lazybot⇒ 1
21:33justin_smith,(inc 5)
21:33clojurebot3
21:33_atonice
21:33johnwalker,(inc .4)
21:33clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .4 in this context, compiling:(NO_SOURCE_PATH:0:0)>
21:33justin_smith,(+ 5 5)
21:33clojurebot4
21:33johnwalker(def .4 4)
21:33johnwalker,(def .4 4)
21:33clojurebot#'sandbox/.4
21:33johnwalker,(inc .4)
21:33clojurebot2
21:33john2xis there a similar emacs plugin for core.test like Midje's plugin? where I can do `C-c ,` to run a fact?
21:33justin_smith,(dec 5)
21:33clojurebot1
21:34johnwalker,(inc *1)
21:34clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.lang.Number>
21:35johnwalkerjohn2x: use projectile with clojure-mode
21:35johnwalkeroh, you want a particular test to run
21:35justin_smithjohnwalker: because of the way clojurebot evaluates, *1 is usually not bound
21:36johnwalkerjustin_smith: was worth a shot :)
21:37john2xjohnwalker: yes, e.g. run the test under the cursor
21:38johnwalkerhave you tried clojure-test-mode?
21:39johnwalkerC-c M-, runs a deftest
21:40justin_smithone thing to note is that every deftest actually creates an fn of no args, and you can call that fn to run the test and see its result
21:41justin_smith,(do (require '[clojure.test :as test]) (test/deftest f (test/testing "this fails" (test/is false))) (f))
21:41clojurebot\nFAIL in (f) (NO_SOURCE_FILE:0)\nthis fails\nexpected: false\n actual: false\n
21:42justin_smith"expected: false actual: false"
21:42justin_smithworst kind of failure
21:43johnwalkerwhen i run it i just get nil
21:43justin_smithin clojure.test no output means success
21:43justin_smithyou don't get the summary, since it is just one test
21:43johnwalkerwhen the test breaks i also get nil
21:43justin_smithno printed output?
21:44johnwalkeroh, i do get output
21:44johnwalkerstill weird though
21:44justin_smithall testing does is print, what else would it do?
21:45johnwalkeri dunno, return :fail or :success
21:46allenj12figwheel is pretty picky lol
21:55allenj12i think figwheel is broken, when i try lein figwheel, i get the error is output-dir in resources QMARK. but when i check the function that sends this error all it does in (.startsWith (get-in build [:compiler :output-dir]) (str "resources/")
21:55allenj12:output-dir "resources/public/js"
21:55allenj12is my lein
21:59justin_smithand you have a resources/ directory I assume?
22:00johnwalker:x
22:02allenj12justin_smith: yea definatley
22:04nDuffallenj12, *shrug*. figwheel works well for me; did have to follow the setup directions with a certain (nontrivial) level of care. If your code is public, I might have time to look at it in a bit.
22:05allenj12nDuff: its just the project.clj right? ill link it
22:06nDuffallenj12, ...well, that's not the _only_ thing that can matter. Would prefer a full reproducer, TBH.
22:07allenj12nDuff: wait would it matter i have no starting html file? there all being generated by hiccup right now
22:07allenj12nDuff: buildings closing brb 10 min
22:12gfrederickscider-nrepl just started breaking with an unresolved var in clojure.tools.trace
22:14cbpwell on the bright side, I'll make sure not to update for now
22:15gfredericksit's a snapshot you update all the time
22:15justin_smithsomeone should make one of those static sites "is-the-current-cider-broken.com"
22:15cbpoh crap youre right
22:16justin_smithpage will just be the word "yes", or maybe the word "no"
22:16cbpjustin_smith: lol
22:17justin_smithbackend would be a ring server, that periodically pulls from cider, and runs an emacs batch with some elisp that checks if stuff works
22:17cbp(inc justin_smith)
22:17lazybot⇒ 49
22:18justin_smithhttp://isitraining.in/portland <- are these things still cool?
22:18justin_smithhttp://isitraininginportland.com/ <- less serious / lower effort version
22:19allenj12im back
22:20gfredericksI'm still here
22:22allenj12gfredericks: :)
22:23allenj12nDuff: hey does it matter that my html files are being generated by hiccup and there are non actually saved
22:25tvanhenshow do I refer to a directory using resources so it will be compatible with an uberjar?
22:26gfredericksclojure.io/resource
22:26gfredericksand the /resources directory in your project
22:26tvanhensI'm using resource and it works for lein run
22:26tvanhensbut when I make an uberjar
22:26nullptr`http://isitraining.in/downinafrica
22:26tvanhensit fails to run that task
22:27gfrederickstvanhens: how does it fail?
22:27nullptr`justin_smith: useless!
22:27justin_smithwhat are you doing with the result of io/resource?
22:27justin_smithnullptr`: lol
22:27justin_smithtvanhens: a common mistake is to call io/file or make a java.io.File out of the result of io/resource
22:27justin_smiththis works if a resource is on disk, but not in a jar
22:27tvanhensusing io/file to convert it into a file object and then using file-seq to get everything
22:28justin_smith(io/input-stream (io/resource "something")) works in both cases
22:28justin_smithyou cannot use io/file on a jar resource
22:28tvanhenscool let me try that thanks justin
22:31tvanhensnow I'm getting a file not found exception even in development
22:31tvanhensodd thing is the file it says is missing is there
22:31tvanhensthe path its showing is right
22:31TEttingerjustin_smith: is it raining? http://dl.dropboxusercontent.com/u/11914692/dogeweather/weather.html?place=portland
22:32justin_smithit was overcast all day, I saw no actual rain
22:33justin_smithbut the "is cider broken" site should definitely do it doge style
22:33TEttingermy thing is kinda open source
22:33TEttingerit doesn't have a server side
22:33justin_smithoh, is that yours?
22:33TEttingernot really
22:34TEttingerdogeweather was credited to the people in the bottom right of the page
22:34TEttingerbut it used php for no good reason
22:34TEttingerI refactored it to pure JS API calls and HTML
22:34justin_smithI like the var names http://dl.dropboxusercontent.com/u/11914692/dogeweather/js/jquery.dogeweather.js
22:34justin_smithnice job
22:35tvanhensjustin_smith any common errors that lead to file not found when it exists where the uri it says it doesn't exist?
22:35justin_smithtvanhens: remember that inside a jar, it is not a file
22:35justin_smithit is a resource
22:35devnwho has a sweet way to generate this sequence? '((2 3) (3 4 5) (4 5 6) (5 6 7) (6 7))
22:36tvanhensIt stopped working outside the jar though
22:36tvanhensthats where I'm getting the error
22:36justin_smithtvanhens: are you asking for it relative to the resource (class) path?
22:36justin_smithie. if it is resources/macros/sloth.gif you need to ask for (io/resource "macros/sloth.gif")
22:37tvanhensthe folder is ./resources/db/schema from the project root I'm refering to it as db/schema in resource
22:37justin_smithoh, so what you want is a handle to the containing directory
22:37justin_smithI don't know if that is portable between resource and fs actually, I haven't tried it
22:38tvanhensah interesting
22:38cbpdevn: i don't get it
22:38justin_smiththere should be some way to abstract over that
22:39TEttingerdevn, the 2-element subseqs are odd
22:39tvanhensyeah really what I need is a way to get all the items within a "folder" in an uberjar
22:39tvanhensthat also works in development
22:40TEttingerresources
22:40TEttingerthere's a way to declare it in project.clj
22:41xeqidevn: looks like a constant, I'd just use it like that
22:41devncbp: TEttinger: If you give me an upper and lower bound, and then you give me a number, I want to hand you back an interval that doesn't violate the bounds
22:41cbpdevn: here's one way tho ##(map seq [[2 3] [3 4 5] [4 5 6] [5 6 7] [6 7]])
22:41lazybot⇒ ((2 3) (3 4 5) (4 5 6) (5 6 7) (6 7))
22:41tvanhensTEttinger I'm using a resources directory. Problem is iterating over all the items in a folder in resources
22:42Jaoodcbp: use the range man
22:42TEttingerah.
22:42devnso like, if the range is 2-8 (exclusive on the end), then if you give me 7, I want to give you back (6 7)
22:42justin_smithTEttinger: what he wants is to iterate the contents, inside a jar
22:42justin_smithoh, he just said that
22:42devnif you give me 2, then i want to give you (2-3)
22:42devnif you give me 3, i can give you (2 3 4)
22:42devnand so on
22:43tvanhensIf theres a way to list all items in a directory in resources within a jar then I could figure out a workaround
22:43devntvanhens: there is
22:43devnerr i havent been following along, but my understanding is that you can get at that stuff
22:44devni bet michaniskin knows the answer to this
22:46TEttinger##((fn [start end] (map (fn [item] (filter #(and (>= % start) (< % end)) [(dec item) item (inc item)])) (range start end))) 2 8)
22:46lazybot⇒ ((2 3) (2 3 4) (3 4 5) (4 5 6) (5 6 7) (6 7))
22:46michaniskintvanhens: devn: https://github.com/tailrecursion/boot.core/blob/master/src/tailrecursion/boot/deps.clj#L17-L21
22:47michaniskin:)
22:47justin_smithtvanhens: there is a .getProtocol method on java.net.URL
22:47justin_smithwhich is the class returned by io/resource
22:47TEttinger##((fn [start end] (map (fn [item] (filter #(and (>= % start) (< % end)) [(dec item) item (inc item)])) (range start end))) 5 15)
22:47lazybot⇒ ((5 6) (5 6 7) (6 7 8) (7 8 9) (8 9 10) (9 10 11) (10 11 12) (11 12 13) (12 13 14) (13 14))
22:47justin_smithtvanhens: you can check if the protocol is "file" and do the directory scan as file, and otherwise there may be some other action that works
22:48devnmichaniskin: nice!
22:48devnmichaniskin to the rescue
22:48tvanhensmichaniskin giving that a go thanks
22:48michaniskinit's expecting a JarFile object there
22:48TEttinger(inc michaniskin)
22:48lazybot⇒ 1
22:49TEttingerdevn, what was that non-violating-bounds fn work?
22:49TEttinger*does that
22:50devnTEttinger: oh, i missed that
22:50devnlet me try that out
22:50justin_smithtvanhens: michaniskin: so I guess if .getProtocol is file, you use io/file and fileseq to get the contents, otherwise you use entries if it is inside a jar
22:51TEttingerdevn, that's with ## as the equivalent to , for lazybot instead of clojurebot btw
22:51devnTEttinger: like a charm
22:51devnthanks dude
22:51devni feel like there's /got to be a better way!/ *pounds fist*
22:51justin_smithI feel like something like this should be in clojure.java.io too, since accessing something in a directory at dev time and in a jar at deploy time is common enough
22:52devna modified partition would be nice
22:52tvanhensI guess slightly higher level question: is storing the schemas for my db in a jar not the best idea in the world?
22:52devnversion coupling
22:52justin_smithtvanhens: with caribou we get the schemas for the db from the db
22:53justin_smithat boot
22:53justin_smith we kind of reify things though to make the sql db be more "homoiconic" I guess
22:53tvanhensinteresting
22:53justin_smithand more clearly self describing
22:54justin_smithso we have a table called model, and another called field
22:54justin_smithand each row in model has many fields
22:54justin_smithetc.
22:54devnTEttinger: maybe a reduce would be simpler?
22:55michaniskinanyone here familiar with sonatype aether?
22:57justin_smith,((fn [input] (concat [(take 2 input)] (partition 3 1 input) [(take-last 2 input)])) (range 5 15)) devn
22:57clojureboteval service is offline
22:57justin_smith&((fn [input] (concat [(take 2 input)] (partition 3 1 input) [(take-last 2 input)])) (range 5 15)) ; devn
22:57lazybot⇒ ((5 6) (5 6 7) (6 7 8) (7 8 9) (8 9 10) (9 10 11) (10 11 12) (11 12 13) (12 13 14) (13 14))
22:57justin_smithmichaniskin: I know alembic.still is much easier to use
22:58devnjustin_smith: yeahhhh, im being picky and should just move on
22:58michaniskinjustin_smith: what i want is to get a list of jars on the classpath, sorted in dependency order
22:58michaniskinjustin_smith: alembic uses pomegranate, no?
22:58justin_smithI think so, yeah
22:59TEttingerI love how good #clojure is at shaving yaks on these kinds of problems
22:59TEttinger(inc justin_smith)
22:59lazybot⇒ 50
22:59michaniskinfor the life of me i can't figure out how to do that simple thing without a ton of gratuitous calls to resolve-dependencies
22:59justin_smithmichaniskin: I think some of the abstractions here may help you actually https://github.com/pallet/alembic/blob/develop/src/alembic/still.clj
23:00michaniskinthe aether/resolve-dependencies function doesn't provide a true dependency graph
23:00justin_smithoh, and that is what alembic is using, yeah
23:00justin_smithwell they wrap it - what is wrong with aether/resolve-dependencies?
23:01michaniskinjustin_smith: aether/resolve-dependencies returns the information you'd want for something like `lein deps :tree`
23:01michaniskindeps :tree doesn't give you a true deps graph, it elides info you're not interested in when you're debugging deps issues
23:02xeqimichaniskin: you're looking for something more then https://github.com/cemerick/pomegranate/blob/master/src/main/clojure/cemerick/pomegranate/aether.clj#L790 ?
23:02michaniskinxeqi: yes, that only gives you info about which things aether chose, but it elides a lot of info you need to make a true dep graph
23:03xeqi"true dep graph" ?
23:03justin_smithmichaniskin: what about going through all the deps, loading the pom.xml for each, and doing your own graph calculation then?
23:03michaniskinfor instance, if you specify foo/bar and foo/baz in your project dependencies, and both of those depend on foo/quux, it will only show foo/quux as a child of one or the other, not both
23:03xeqiah, right
23:04michaniskinso yes, i could bring in xml parsers and everything
23:04justin_smithI hope that's not what you need to do
23:04michaniskinbut it seems unlikely that there's no way to just do it via aether
23:04xeqiI ended up needing that info in pedantic... let me find where it was
23:04michaniskincurrently i gave up and just do aether/resolve-dependencies individually for each dep
23:05michaniskinand then i do the topo sorting
23:11xeqiugh, its been so long since I've delved into the aether area
23:13michaniskinxeqi: https://github.com/xeqi/pedantic/blob/master/src/pedantic/core.clj#L81 that guy looks promising
23:13xeqimy recollection is you have to inject a DependencyGraphTransformer that will gather the info you want and then "return" it through an atom
23:13michaniskinperhaps the :ignored ones are the deps i'm looking for?
23:13xeqiand it looks like http://wiki.eclipse.org/Aether/Transitive_Dependency_Resolution says a similar thing
23:13michaniskinthe ones that are hidden by resolve-dependencies?
23:14xeqi:ignored would be a dep w/ a version that wasn't choosen, so yes
23:15xeqithough I wrote this stuff >1year ago, so don't take it as gospel
23:15michaniskinwhew! this is hopeful :)
23:15michaniskinmy current project has a ton of dependencies, and it's taking forever to do it my naive way
23:16johnwalkerdevn: what is this cloclogo you're working on?
23:16johnwalkeris this for core.typed?
23:16xeqiyour naive way was the same way my proof of concept code for lein-pedantic worked, before I actually dove into aether's api
23:17xeqiwhich was mostly undocumented around this stuff :p
23:19michaniskinxeqi: where does the session come from?
23:19michaniskinxeqi: in the use-transformer function
23:20xeqimichaniskin: hmm, lein just uses cemerick.pomegranate.aether/repository-session https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/classpath.clj#L291
23:21michaniskinxeqi: dude thank you. i owe you a beer at the next conj!
23:22tvanhensis there a way to use globbing with io/resource?
23:23xeqimichaniskin: heh, I hope you're able to crib together what you need. I feel like I'm grabbing just enough straws to point you somewhere but not actually 100% this is exactly it
23:23xeqithough I'm getting more confident this is the right area as I stare at it
23:24michaniskintvanhens: https://github.com/tailrecursion/boot/blob/master/boot-classloader/src/tailrecursion/boot_classloader.clj#L76-L77
23:24michaniskintvanhens: that takes a pattern and path both strings, and boolean result
23:24michaniskinit has an unfortunate dependency on Ant, but it works with < java7
23:25justin_smithtvanhens: what about creating a compile time task that records the resources that should be loaded, based on the directory contents?
23:25michaniskinin java7 there is nio stuff to do glob matching on Path objects
23:25justin_smithmichaniskin: you can get a Path from a jar resource? that's cool
23:26michaniskinjustin_smith: well i'm not sure about that, but i was assuming you could make one that would allow you to decide if the resource matches or not
23:26justin_smithmichaniskin: wait, javadoc for path makes it look filesystem specific
23:26justin_smithahh, based on a list of resources for example
23:26michaniskinjustin_smith: you could do (.getPath (io/file "foo/bar")) and the file doesn't need to exist
23:26justin_smithright, then you can use path matching
23:27michaniskinxeqi: thanks, i've been at this for a while now, i feel like this may be the breakthrough lol
23:27tvanhensoy this bit is ending up a lot more complicated than I thought it would be
23:28xeqimichaniskin: what are you building?
23:29michaniskinxeqi: i'm overhauling boot: https://github.com/tailrecursion/boot-ng
23:29michaniskinxeqi: i have "pods" working now (not fully tested though, so ...)
23:29michaniskinpods are a way to dynamically start a child boot session in a segregated classloader
23:30michaniskinfrom within boot itself, so a task can do its actual work in the pod
23:30michaniskinbasically each task can now load whatever deps it needs to do its work without needing to pollute the classpath of other tasks or the project
23:31michaniskinbut the build process itself (which has no deps of its own) runs in your project
23:31allenj12is domina still used?
23:31allenj12seems a while since it was updated
23:31Jaoodallenj12: looks like react wrappers took oever
23:32michaniskinallenj12: how was your hoploning?
23:32Jaood*over
23:34justin_smith,(.getPathMatcher (java.nio.file.FileSystems/getDefault) "glob:*.clj")
23:34clojurebot#<CompilerException java.lang.ClassNotFoundException: java.nio.file.FileSystems, compiling:(NO_SOURCE_PATH:0:0)>
23:34justin_smith&(.getPathMatcher (java.nio.file.FileSystems/getDefault) "glob:*.clj")
23:34lazybotjava.lang.ClassNotFoundException: java.nio.file.FileSystems
23:34allenj12Jaood: so like om then
23:35justin_smithold jvms :(
23:35allenj12michaniskin: hehe pretty great so far :) although only have done a little since we last talked
23:36allenj12michaniskin: right now im playing with a couple things
23:36justin_smithmichaniskin: that looks really cool!
23:36justin_smith(the boot project that is)
23:36michaniskinjustin_smith: the actual production version is here: https://github.com/tailrecursion/boot
23:37michaniskinit works, you can try it out!
23:37justin_smithvery nice
23:37JaoodI though everyone here was against running clojure script
23:37Jaoods
23:37allenj12why?
23:37clojurebotwhy not?
23:37Jaoodclojurebot: why yes?
23:37clojurebotCool story bro.
23:38Jaoodclojurebot: thanks
23:38clojurebotthe best way to thank your friendly #clojure resident is with (inc nick)
23:38Jaood(inc clojurebot)
23:38lazybot⇒ 40
23:38justin_smithhaha
23:38justin_smith$karma lazybot
23:38lazybotlazybot has karma 26.
23:38michaniskinjustin_smith: you can do cool things like this: https://github.com/tailrecursion/hoplon-demos/blob/master/google-maps/build.boot
23:38justin_smithman, clojurebot is totally winning
23:38michaniskinthat's the build script for a hoplon web app thing
23:39justin_smithnice
23:39Jaoodmichaniskin: is boot meant to be use with external dependecies too?
23:39michaniskinJaood: boot is a build tool, like leiningen
23:40michaniskinyou can use it to pull in external dependencies
23:40michaniskin(set-env! :dependencies '[[foo/bar "0.1.0"]])
23:40Jaoodmichaniskin: oh, the was reading just the first about running clojure scripts
23:40Jaood*part
23:41Jaoodwith the shebang
23:41michaniskinyeah i mean in lisp, all you need for a build tool is a way to run lisp code and bring in dependencies
23:41michaniskinall the build stuff is just functions you can call
23:41xeqimichaniskin: ah, I thought about trying to do some similar container type things with lein and how it handles tool/project seperation
23:41xeqiended up postponing it due to native deps and possibly something else
23:42michaniskinxeqi: it's tricky. i currently have things talking to each other through sockets and evaling things in repls lol
23:42michaniskinxeqi: i'm not really concerned with native deps i guess
23:43xeqisockets and evaling? I was leaning towards using classlojure and eval-in-classloader
23:43xeqiah right
23:43xeqiclojure's namespaces are global
23:43michaniskinxeqi: i started with that route
23:43xeqi*namespace list
23:44michaniskinbut i found that things leaked between sibling classloaders
23:44michaniskinand there was no way to communicate upward in the tree without sockets
23:44Jaoodnice how all the hoplon demos have a a view live option
23:44xeqiso that made sharing objects between classloaders couldn't keep diffent loaded namespaces seperate
23:44michaniskinlike with classlojure the child can't pass messages up to the parent
23:45xeqiyep, just returning
23:45hellofunkre
23:45michaniskinso now i have a master process that starts many children who communicate with each other via sockets and repls
23:46Jaoodmichaniskin: is hoplon planning on using react?
23:46michaniskinJaood: it's compatible with react, meaning you can embed react in there if you want
23:47michaniskinbut there hasn't been a need so far
23:47michaniskinin my work anyway
23:47michaniskinfar more useful to me has been being able to use jquery plugins and things like that
23:48michaniskinJaood: the dom diffing, virtual dom, and dirty checking isn't necessary with hoplon because of the javelin cells thing
23:49michaniskincells are evaluated in a dependency graph, which is the alternative to dirty checking
23:51Jaoodmichaniskin: I see, gonna read on the javelin stuff to understand that approach
23:52michaniskinJaood: https://github.com/tailrecursion/javelin