# #clojure log - Jun 12 2014

The Joy of Clojure
Main Clojure site
IRC
List of all logged dates

0:02 umpa: Any way to keep score with immutable seqs ?

0:05 jonasen: umpa: not sure what you mean

0:07 umpa: jonasen: now I manually mutate (atom ()). Maybe there is a better way to keep score for a two player game ?

0:09 jonasen: umpa: An atom is probably the way to go

0:11 umpa: ,(doc partial)

0:11 clojurebot: "([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."

0:11 amalloy: jonasen: 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

0:12 jonasen: amalloy: thats true

0:13 umpa: ,(doc lazy-seq)

0:13 clojurebot: "([& 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?"

0:14 umpa: that (doc lazy-seq) is kind of lazy

1:09 what if the state depends on the score ?

1:12 dbasch: umpa: 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

1:14 umpa: dbasch: score is the only state ?

1:14 dbasch: how should I know?

1:15 umpa: it just sounds like one big recur loop

1:15 dbasch: umpa: is your game single-threaded?

1:17 umpa: i don't make use of threads no

1:17 dbasch: umpa: in that case you can keep your score in an immutable structure

1:18 you can recur with the new score at the end of each “round”

1:18 umpa: this might be a good opportunity to learn about states

1:19 dbasch: imagine a jeopardy game for example, where for each round the three contestants are given the chance to guess in order

1:19 there’s no concurrency, and at the end of the round you have the updated scores of the three players

1:23 umpa: ok, in my case the 2nd round would take each player's scores and create a new state according to the score of each player

1:24 dbasch: umpa: yes, that sounds like a regular recur based on the computation that happened during the sequential evaluation of the loop

1:26 umpa: is that optimal in clojure ? clojure.org/state talks about alter, commute and send

1:28 dbasch: umpa: optimal for what? if you have no concurrency, you don’t need to worry about that

1:29 umpa: dbasch: i'm yet to see an example of concurrency, but at this point just figuring best practices

1:30 dbasch: umpa: you usually know when you need concurrency

1:31 umpa: if you can model your game without concurrency and it performs well, you don’t need concurrency

1:32 umpa: 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

1:33 although that’s typically done with a parallel implementation, which is more than just concurrency

1:33 umpa: dbasch: would running two recur loops at the same time be an example of concurrency

1:33 dbasch: umpa: it would be concurrent if you cannot predict the order in which operations take place

1:34 you mean running two loops at the same time in two different threads?

1:34 that would be parallelism, but if they don’t interact with each other they are not necessarily concurrent

1:35 umpa: hmm

1:35 dbasch: an example of concurrency could be a busy intersection, where at each “turn” an indeterminate number of cars can go through

1:36 Jaood: clojure is dead: http://uautoinsurance.com/b/yclanguages-cm465/

1:36 dbasch: and if you could turn back time and restart the flow of traffic, it might happen differently every time

1:37 e.g. you have cars 1, 2 and 3 trying to cross north-south, and cars 4 5 6 east-west

1:37 one possibility would be 1 4 2 5 3 6

1:37 another one would be 1 2 3 4 5 6

1:38 cars 1 and 4 are concurrently trying to access the intersection at the beginning

1:38 if you have a loop that takes one car from each direction and makes it go through, you have no concurrency issues

1:39 if 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

1:42 umpa: so its not ([1 4][2 5][3 6]), that would be parallelism ?

1:48 dbasch: umpa: in this case there probably wouldn’t be parallelism, because we can assume that only one car moves at a time

1:48 two cars cannot move at the same time

1:48 umpa: Jaood: Wit.AI is actually the only one I would be interested in working for from that list

1:48 Jaood: umpa: parallelism is just a technicque to perform an operation more faster

1:49 dbasch: umpa: the point is that parallelism and concurrency are different things, often combined

1:50 when programming nondeterministic access to resources, you usually care about concurrency

1:51 for example, let’s suppose your cars decide to cross in whichever order they negotiate on their own, because they are autonomous

1:51 umpa: ok

1:51 dbasch: if you want [1 2 3] to always be together, you could impose a condition that they move “atomically"

1:51 e.g. 1 4 5 6 2 3 would not be a possible order for crossing the intersection

1:52 you could have 1 2 3 4 5 6 or 4 5 6 1 2 3

1:52 (if [4 5 6] are also atomic)

1:52 or 4 1 2 3 5 6 might be allowed if you care about the atomicity of 1 2 3 and not the others

1:53 that’s when you start using synchronization with things like atoms

1:54 the important question is whether someone could observe your system during the transition and find it in an inconsistent state, or not

1:54 if there are no observers but you, it’s a moot question

1:55 johnwalker: oh hi dbasch

1:55 dbasch: hi johnwalker

1:55 johnwalker: small world

1:55 umpa: nice dbasch

1:56 dbasch: the world of clojure is still pretty small :)

2:01 umpa: dbasch: now the terms futures, promises, delays, atoms, refs make more sense

2:01 dbasch: cool

2:17 IbrahimA: somewhat 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?

2:17 as 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?

2:18 but im certainly curious if anyone is doing that kind of thing

2:18 i'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

2:19 there'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

2:20 dbasch: IbrahimA: I personally don’t think that any language is better than any other for AI, what matters most are whatever libraries people have written

2:20 IbrahimA: right

2:20 i agree completely, with the minor point that some languages have better syntax for eg. linear algebra

2:21 but python doesn't, and yet there's plenty of numerical stuff for it

2:21 dbasch: IbrahimA: python is useful because of SciPy

2:21 IbrahimA: righto

2:21 i just want to understand where the "lisp is good for AI" meme comes from

2:21 dbasch: honestly I don’t know

2:21 IbrahimA: is it more of a correlation vs causation thing, maybe just happens that early ai pioneers liked lisp?

2:22 dbasch: IbrahimA: yeah, at the time you didn’t have many good choices

2:22 IbrahimA: that sounds like the case from this SO post: http://stackoverflow.com/questions/130475/why-is-lisp-used-for-ai

2:22 umpa: or perl, lisp lost popularity when AI proved to be not very promising

2:23 back in 70s

2:23 dbasch: IbrahimA: have you checked out incanter?

2:23 IbrahimA: i barely know clojure at this point

2:23 err

2:23 johnwalker: is there a way to make the charts in incanter look nice?

2:23 IbrahimA: i mean, i've barely started learning

2:24 and honestly, if i were to switch away from matlab it'd probably be to python/numpy

2:24 dbasch: johnwalker: the charts in the incanter examples look nice enough to me, at least better than what I can do with R

2:24 IbrahimA: clojure im learning completely for fun

2:25 johnwalker: they're ok, but for example

2:25 dbasch: IbrahimA: 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

2:25 IbrahimA: yeah, the python numpy/scipy/pandas ecosystem is pretty strong

2:25 dbasch: johnwalker: I like those charts

2:25 johnwalker: if you look at the sin wave's they're all janky looking, and i didn't see a way to control the legend

2:26 IbrahimA: i mean, really i prefer ruby as a language over python, but i dont think sciruby is anywhere close to replacing scipy

2:26 i hope i dont start a language flame war :P

2:26 forget i said anything

2:26 dbasch: IbrahimA: don’t worry about it. Who can argue about personal preferences.

2:26 johnwalker: there isn't really a flamewar threat

2:27 IbrahimA: i've managed to derail #emacs with random topics like that, though i think #emacs exists to be derailed

2:27 dbasch: there’s a pretty big intersection of domains for which using python, clojure or ruby is a matter of preference

2:27 IbrahimA: mhm

2:28 thankfully in these days of modern hardware we don't have to care as much about performance 90% of the time :D

2:29 umpa: you do if its a mobile device

2:31 dbasch: IbrahimA: the main reason I like clojure is repl-driven development on the jvm

2:31 IbrahimA: yea

2:32 dbasch: johnwalker: yes, that sine chart doesn’t look particularly pretty

2:32 umpa: optimized recursion is nice as well

2:49 hellofunk: anyone 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

3:06 ddellaco_: hellofunk: could just be weirdness with dependencies getting loaded...I've seen that happen. namespace state can get messed up in the repl, unfortunately.

3:09 hellofunk: ddellaco_ ok seems like a rather basic and fundamental aspect to how clojure works, i would expect that to be more stable

3:14 ddellacosta when using Om is it better to use directly DOM stuff like #js {:onClick ... or to use goog closure's event listening abstractions?

3:15 ddellacosta: hellofunk: regarding namespaces in repl, I recommend reading this article for a bit better context: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded

3:16 hellofunk: re: Om, I've found it's a lot better to lean on React's events as much as possible.

3:17 hellofunk: 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.

3:17 *component logic

3:18 hellofunk: ddellacosta 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.

3:20 ddellacosta: hellofunk: 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

3:20 oes use Google Closure stuff in his tutorials/example code too when it's appropriate, since it is "built-in").

3:21 hellofunk: 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.

3:21 hellofunk: ...that's based on my experience up until now. YMMV.

3:23 hellofunk: ddellacosta 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

3:24 ddellacosta: hellofunk: 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.

3:58 hellofunk: ddellacosta Dommy and Domina would be similar tools to Goog Closure for accessing DOM *outside* React, then right?

4:00 ddellacosta: hellofunk: 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.

4:00 hellofunk: self-promotion but this is a pretty good survey of the DOM libs out there: http://davedellacosta.com/cljs-dom-survey

4:01 hellofunk: ddellacosta oh cool, i'll read that

4:13 ddellacosta: hellofunk: oh sorry, I was wrong, Dommy doesn't have any AJAX stuff--I was thinking of event handling, rather.

6:34 clgv: afair 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

6:43 well, unrelated error. the map behavior is fine

7:18 sveri: Hi, 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?

7:20 andyf: Bronsa: ping

7:20 Bronsa: andyf: hi

7:21 andyf: Saw 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.

7:21 Testing out that guess now

7:22 engblom: If I need to change the nth value in a list, is there a ready function for that?

7:22 Bronsa: andyf: that's not the case, mapv is eager

7:22 andyf: Yeah, I wasn't worried about lazy/eagerness of mapv.

7:23 But does (fn ...) capture values of free vars, or only references to them?

7:23 scratch the "only"

7:24 agarman: engblom: update-in

7:24 ,(update-in [1 [2 [3]]] [1 1] inc)

7:24 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>

7:24 agarman: ,(update-in [1 2 3] [2] inc)

7:24 Bronsa: andyf: (fn [] *ns*) resolves *ns* at call time

7:24 clojurebot: [1 2 4]

7:25 Bronsa: andyf: you'd need something like (let [ns *ns*] (fn [] ns)) to capture it at compilation time

7:25 andyf: ok, makes sense. Switching the code back to more like it was and testing

7:25 Bronsa: cool, thanks a lot

7:27 andyf: Should the recursive call to analyze+eval for statements-expr also have last arg of opts?

7:27 it wasn't there before.

7:27 Bronsa: yeah I saw that, good catch

7:27 should definitely be there

7:27 andyf: ok

7:37 patch attached

7:38 Bronsa: thanks

7:56 engblom: Today 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?

8:04 andyf: engblom: 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

8:05 engblom: andyf: Thanks!

8:08 andyf: I haven't tested, but isn't (update-in (vec heaps) [index] (fn [n] new-heap)) equivalent to (assoc (vec heaps) index new-heap) ?

8:14 engblom: andyf: Thanks, that made it a bit shorter!

8:14 The function looks like this now: https://www.refheap.com/86511

8:14 I corrected one bug I had.

8:17 andyf: engblom: 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)

8:21 engblom: andyf: 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]))

8:21 It is a list of lists of vectors

8:23 ,(apply concat '(([0 2 1] [1 2 1] [2 2 1]) ([3 1 1] [3 0 1]) ([3 2 0])))

8:23 clojurebot: ([0 2 1] [1 2 1] [2 2 1] [3 1 1] [3 0 1] ...)

8:23 engblom: It is not becoming what I want the end-result to be.

8:23 andyf: You mean you prefer that the result is a list of lists, rather than a list of vectors?

8:23 engblom: End-result should be like this: ((0 2 1) (1 2 1) (2 2 1) (3 0 1) (3 1 1) (3 2 0))

8:24 Yes

8:25 andyf: Out of curiosity, why?

8:25 engblom: Because my other functions already operate over lists, so it is easier to convert this one list of lists, rather than rewrite the other.

8:27 andyf: ok, no problem. Note that many (not all) Clojure functions can work on vectors and lists equivalently, treating them as sequences.

8:28 engblom: Actually, it would not be that difficult for the other ones, now when I look at it.

8:40 andyf: Bronsa: 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.

8:40 Bronsa: andyf: only in the nodes where the form gets macroexpanded, yes

8:41 andyf: do you have a test case where you're not getting it?

8:41 andyf: trying to reproduce with original libs

8:43 engblom: andyf: Now the function is looking like this: https://www.refheap.com/86512 . I made the suggested change to use vectors instead.

8:44 andyf: Try (-> '(comment 1 2 3) taj/analyze :raw-forms) and then again with taj/analyze+eval

8:45 Bronsa: andyf: arg I'm an idiot

8:46 forgot to commit that line

8:48 andyf: engblom: I can't speak for everyone, but it is easier for me to follow now.

8:49 Glenjamin: i think you could use mapv instead of map-indexed and assoc

8:49 is heaps a vector of ints?

8:51 justin_smith: quoting the maintainer of cider.el: "the final nrepl.el release is about an year old and I doubt many people are still using it"

8:51 if only he knew how many of us are still using slime

8:52 engblom: Glenjamin: Yes, it is!

8:52 andyf: Bronsa: grazie

8:52 Bronsa: andyf: grazie a te! :)

8:53 andyf: My Italian is limited to about 20 words, but that plus 1 year of Latin 30 years ago makes me guess "thanks to you"

8:53 Bronsa: correct

8:53 engblom: Glenjamin: I can find any information about mapv: http://clojuredocs.org/search?x=0&y=0&q=mapv&lib=clojure_core

8:53 Glenjamin: ,(doc mapv)

8:53 clojurebot: "([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."

8:54 Bronsa: andyf: 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

8:55 Glenjamin: for some reason i really can't seem to follow the combination of for and assoc

8:55 andyf: Once 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"

8:56 Glenjamin: oh, i think it get it now

8:57 Bronsa: andyf: ahah

8:58 andyf: engblom: 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.

8:58 arrdem: 'mornin

8:59 Bronsa: I'd rather have clojuredocs die forever than keep being outdated

8:59 engblom: Why is nobody updating clojuredocs?

9:00 andyf: People 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.

9:00 engblom: I think they are great as they provide examples for almost everything, so you know you understood the documentation right

9:01 andyf: Someone 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.

9:02 arrdem: engblom: 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.

9:02 engblom: Ok

9:02 Glenjamin: arrdem: do you have a link to the rewrite project?

9:03 arrdem: Glenjamin: it's not open yet.

9:03 Glenjamin: oh

9:03 arrdem: afaik

9:03 Glenjamin: is it the one that had about 50 essays about it on the mailing list?

9:03 engblom: I am still trying to get my brain to understand how mapv could be used in my function

9:03 Glenjamin: engblom: i tend to use the cheatsheet, which links to clojuredocs for old fns, and github api docs for new ones

9:03 engblom: i think i was incorrect

9:04 Glenjamin: i didn't realise that the index was used to produce permutations of the original input vector

9:05 andyf: engblom: My personal favorite variety of the cheatsheet is here: http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html

9:05 Can get there from clojure.org/cheatsheet in 2 clicks if you forget that link.

9:15 engblom: andyf: Thanks!

9:17 JokerDoom: what'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

9:17 Glenjamin: think of it like a modifier

9:18 in fact no

9:18 Glenjamin: think of it like the first character in a two-character thing

9:18 engblom: JokerDoom: You should look up sets and anonymous functions.

9:18 Glenjamin: #{ = sets, #( = fn, #" = regex, #_ = comment etc

9:19 engblom: (inc Glenjamin)

9:19 lazybot: ⇒ 5

9:19 whodidthis: so many syntax

9:21 arrdem: on the contrary, all reader macros!

9:22 engblom: Think 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

9:23 arrdem: also 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.

9:25 philandstuff: not quite true, you can't do #{(rand-int 100) (rand-int 100)} as that'll fail at read time

9:26 arrdem: yeah but that's the reference compiler being shitty, not a fundimental language limitation

9:26 philandstuff: wait, I got your logic backwards. never mind, carry on

9:26 JokerDoom: so all uses of pound are reader macros?

9:26 k, that makes sense to me

9:27 arrdem: JokerDoom: all leading uses of #.

9:27 ,foo#bar

9:27 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo#bar in this context, compiling:(NO_SOURCE_PATH:0:0)>

9:27 JokerDoom: Yes, leading uses of it definitely

9:27 eraserhd_: No filter-indexed?

9:27 JokerDoom: hrm?

9:27 eraserhd: Hrmm..

9:27 Glenjamin: (map (range) coll) === (map-indexed coll)

9:28 oh, filter only accepts one coll

9:28 so that doesn't really help you

9:28 eraserhd: Yeah, that too.

9:28 JokerDoom: thx guys, I think I get it now

9:29 justin_smith: Glenjamin: "(map (range) coll) === (map-indexed coll)" correct in that they are both erroneous in missing a function

9:29 Glenjamin: haha

9:29 good point

9:30 * eraserhd wonders if maybe I should submit my first (and second) feature enhancement tickets.

9:30 justin_smith: (map 𝑓 (range) coll) === (map-indexed 𝑓 coll)

9:30 arrdem: if you go throwing out tickets post em here so we can vote 'em up or not.

9:30 justin_smith: why does emacs want 𝑓 to be so tall?

9:31 Glenjamin: ,(defn filter-indexed [f coll] (map second (filter f (map (range) coll)))

9:31 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

9:31 Glenjamin: ,(defn filter-indexed [f coll] (map second (filter f (map (range) coll))))

9:31 clojurebot: #'sandbox/filter-indexed

9:31 Glenjamin: ,(filter-indexed = [0 2 2 4])

9:31 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn>

9:31 Glenjamin: bah

9:31 something like that anyway

9:31 hyPiRion: heh.

9:32 justin_smith: Glenjamin: again your example above with map (range)... was missing an f

9:32 Glenjamin: oh, i forgot the damn function to map again

9:32 ,(defn filter-indexed [f coll] (map second (filter f (map identity (range) coll))))

9:32 clojurebot: #'sandbox/filter-indexed

9:32 Glenjamin: ,(filter-indexed = [0 2 2 4])

9:32 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/identity>

9:32 Glenjamin: gah

9:32 justin_smith: maybe you want list?

9:32 Glenjamin: ,(defn filter-indexed [f coll] (map second (filter f (map vector (range) coll))))

9:32 clojurebot: #'sandbox/filter-indexed

9:32 justin_smith: or vector

9:32 Glenjamin: ,(filter-indexed = [0 2 2 4])

9:32 clojurebot: (0 2 2 4)

9:32 Glenjamin: meh, doesn't work anyway

9:32 the point was supposed to be that you can just define your own filter-indexed trivially

9:33 but maybe its not so trivial

9:33 (it is, i'm just not very good at IRC repling)

9:33 hyPiRion: ,(defn filter-indexed [f coll] (map second (filter (fn [[a b]] (f a b)) (map vector (range) coll))))

9:33 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol:   in this context, compiling:(NO_SOURCE_PATH:0:0)>

9:34 eraserhd: ,(defn filter-indexed [f coll] (->> coll (map-indexed (fn [[i v]] [(f i v) v])) (filter first) (map second)))

9:34 clojurebot: #'sandbox/filter-indexed

9:34 Glenjamin: ,(filter-indexed = [0 2 2 4])

9:34 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/filter-indexed/fn--237>

9:35 eraserhd: wut?

9:35 Glenjamin: hyPiRion's seems correct to me, not clear what the error there is

9:36 hyPiRion: mine works, but I had a nbsp in there

9:36 ,(defn filter-indexed [f coll] (map second (filter (fn [[a b]] (f a b)) (map vector (range) coll))))

9:36 clojurebot: #'sandbox/filter-indexed

9:36 hyPiRion: ,(filter-indexed = [0 2 2 4])

9:36 clojurebot: (0 2)

9:37 eraserhd: Oh. I see what's wrong with mine.

9:37 hyPiRion: eraserhd: map-indexed uses [], not [[]]

9:37 eraserhd: ,(defn filter-indexed [f coll] (->> coll (map-indexed (fn [i v] [(f i v) v])) (filter first) (map second)))

9:37 clojurebot: #'sandbox/filter-indexed

9:37 eraserhd: ,(filter-indexed = [0 2 2 4])

9:37 clojurebot: (0 2)

9:37 justin_smith: ((fn filter-indexed [filt coll] (map second (filter filt (map list (range) coll)))) #(even? (first %)) [:a :b :c :d :e :f :g])

9:37 ,((fn filter-indexed [filt coll] (map second (filter filt (map list (range) coll)))) #(even? (first %)) [:a :b :c :d :e :f :g])

9:37 clojurebot: (:a :c :e :g)

9:38 hyPiRion: And while we're at it, here's the swearjure version:

9:38 (no)

9:38 justin_smith: heh

9:38 eraserhd: Is there a swearjure compiler yet?

9:39 i mean, with swearjure as the target language?

9:39 arrdem: A Clojure→Swearjure translater?

9:39 hyPiRion: get on this

9:40 Glenjamin: https://github.com/timmc/swearjure

9:40 hyPiRion: arrdem: I think TimMc actually attempted to

9:40 ah yeah, there we go

9:40 I do have some code which converts a number to a swearjure number, but that's it for my part

9:42 eraserhd: There is a keep-indexed, but no filter-indexed.

9:43 arrdem: Clojure:Lisp::LSD:Meditation lowut

9:43 justin_smith: ?

9:44 justin_smith: sounds like a grumpy old lisper

9:44 arrdem: ikr

9:44 * arrdem chuckles

9:44 eraserhd: ,(defn filter-indexed [f coll] (keep-indexed #(or (f %1 %2) nil) coll))

9:44 clojurebot: #'sandbox/filter-indexed

9:44 eraserhd: ,(filter-indexed = [0 2 2 4])

9:44 clojurebot: (true true)

9:44 hyPiRion: that's no good

9:44 justin_smith: congratulations clojure, welcome to the world of "mindshare" and "popularity"

9:45 eraserhd: ,(defn filter-indexed [f coll] (keep-indexed #(if (f %1 %2) true) coll))

9:45 clojurebot: #'sandbox/filter-indexed

9:45 eraserhd: ,(filter-indexed = [0 2 2 4])

9:45 clojurebot: (true true)

9:45 kzar: Anyone here managed to use the include tag in a Selmer template?

9:45 justin_smith: maybe if we modified it to say (true :dat) instead, that would help

9:47 eraserhd: Oh, I didn't understand keep-indexed.

9:47 That's a weird function.

9:47 hyPiRion: ,(defn filter-indexed [f coll] (keep-indexed #(if (f %1 %2) %2) coll))

9:47 clojurebot: #'sandbox/filter-indexed

9:48 hyPiRion: ,(filter-indexed = [0 2 2 4])

9:48 clojurebot: (0 2)

9:48 hyPiRion: eraserhd: keep is equivalent to (remove nil? (map f coll))

9:48 keep-indexed is the same, but with map replaced as map-indexed

9:48 eraserhd: ,(filter-indexed even? [nil nil nil nil])

9:48 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/even?>

9:49 eraserhd: ,(filter-indexed #(even? %2) [nil nil nil nil])

9:49 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Argument must be an integer: >

9:49 eraserhd: ,(filter-indexed #(even? %1) [nil nil nil nil])

9:49 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/eval129/fn--130>

9:49 hyPiRion: and index is first

9:49 heh, hard this thing

9:49 eraserhd: ,(filter-indexed (fn [i v] (even? i)) [nil nil nil nil])

9:49 clojurebot: ()

9:49 Glenjamin: the true reason why filter-indexed isn't in core ;)

9:49 eraserhd: ,(filter-indexed (fn [i v] (even? i)) [:a :b :c :d])

9:49 clojurebot: (:a :c)

9:49 eraserhd: Why?

9:49 hyPiRion: eraserhd: oh, nice call.

9:49 clojurebot: http://clojure.org/rationale

9:50 eraserhd: I don't understand how keep-indexed is useful, though. That seems really arbitrary.

9:50 hyPiRion: You cannot use keep-indexed to simulate filter-indexed.

9:51 eraserhd: keep-indexed is way more useful than when-first though

9:51 which is the strangest one out there.

9:51 justin_smith: I think we should run the permutations, and keep all the good ones

9:51 Glenjamin: ,(doc when-first)

9:51 clojurebot: "([bindings & body]); bindings => x xs Roughly the same as (when (seq xs) (let [x (first xs)] body)) but xs is evaluated only once"

9:51 justin_smith: swap!-indexed

9:51 hyPiRion: justin_smith: commute-indexed

9:54 engblom: Would 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

9:55 TimMc: eraserhd: Yeah, I was working on a Clojure -> Swearjure compiler, but then I realized I was wasting valuable hours of my life. :-P

9:55 I'm happy to give pointers to anyone who wants to move it forward, though! It's a fun exercise.

9:56 (If you want to learn more about compilers, that is.)

9:56 arrdem: TimMc: I think that Bronsa and I have plenty of real work for compiler people, besides our stuff could actually be useful one day

9:56 TimMc: *nod*

9:57 I would encourage people to work on that instead.

9:57 kzar: Is selmer a good library for django style templates?

9:58 hyPiRion: arrdem: are you implying that Swearjure is not useful? What blashpemy.

9:58 *blasphemy

9:58 arrdem: hyPiRion: until we get a TCO compiler totally

9:58 eraserhd: arrdem: I actually signed the CA because of tools.analyzer/clojurescript, and wanting embedded compilation.

10:00 sveri: Hi, 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:03 TimMc: sveri: You mean wih mvn test?

10:03 I think the clojure-maven-plugin might provide that.

10:04 kzar: yogthos: If you have a minute I'm having trouble using the include tag from Selmer https://github.com/yogthos/Selmer/issues/45

10:05 sveri: TimMc: 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:05 yogthos: kzar: just commented on the issue on github, you have to use render-file instead of render

10:06 TimMc: sveri: Or just put in a Makefile that runs junit tests and then lein test. :-P

10:07 sveri: TimMc: :D ok, thats another option

10:07 kzar: But with stasis I've already loaded all the files into a map using slurp-directory (and pre-processed them a bit)

10:07 TimMc: What build tool are you using?

10:07 sveri: ant and gradle

10:17 engblom: If I want to check if '([1 2 3] [4 5 6]) contains [1 2 3], is there a ready function i could use?

10:17 arrdem: Clojure core has no O(N) contains scan.

10:18 however you can just say (any (map (partial = X) ys))

10:18 justin_smith: ,(some #(= [1 2 3] %) '([1 2 3] [4 5 6]))

10:18 clojurebot: true

10:18 arrdem: or that :P

10:18 engblom: Thanks!

10:19 arrdem: (doc any) gives nothing and it is not on the cheat-sheet either.

10:20 kzar: yogthos: 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:20 arrdem: engblom: any is some, I just get the name wrong all the time.

10:24 justin_smith: arrdem: also no need for the map

10:25 arrdem: ,(source some)

10:25 justin_smith: $source some 10:25 lazybot: some is http://is.gd/IAmtiP 10:25 arrdem: eh gets you the same linear scan, but some will yield on the first positive result 10:25 justin_smith: right 10:26 arrdem: Which is T(N)=N/2 on average 10:26 ddellacosta: ,(some #{[1 2 3]} '([1 2 3] [4 5 6])) 10:26 clojurebot: [1 2 3] 10:27 ddellacosta: also can skip the predicate & 10:27 erp 10:27 justin_smith: ddellacosta: well, a set is a predicate :P 10:27 ddellacosta: soo, in the end some would be the more efficient choice regardless, huh? 10:27 justin_smith: I like them for multiple cases, but for only one match a set seems a little silly 10:28 ddellacosta: justin_smith: fair enough, you can use a set vs. fn 10:28 justin_smith: yeah, suppose that's reasonable 10:28 justin_smith: ddellacosta: some would be more efficient than? 10:28 toast: ,(some irc://irc.freenode.net:6667/#%7B%5B1 2 3]} '((1 2 3) [4 5 6])) 10:28 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]> 10:28 ddellacosta: justin_smith: oh, that was directed at arrdem, asking about efficiency of the some solution you wrote vs. his any solution 10:29 szymanowski: Hi, i've spotted a thing in prismatic's schema that I don't understand, (s/check [s/Int] nil) => nil ; is it feature? 10:29 justin_smith: ,any ddellacosta 10:29 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: any in this context, compiling:(NO_SOURCE_PATH:0:0)> 10:29 arrdem: ddellacosta: hum? 10:29 toast: ,(some irc://irc.freenode.net:6667/#%7B%5B1 2 3]} '((1 2 3) [4 5 6])) 10:29 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]> 10:29 ddellacosta: woah, what's going on here 10:29 justin_smith: toast, what are you trying to do? 10:29 ddellacosta: crazytown 10:29 arrdem: toast is failing at URLs 10:29 justin_smith: looks like a hotkey for [ 10:30 or something 10:30 ddellacosta: toast, are you a mess bot? 10:30 toast: I was trying to change the vector to a list 10:30 ddellacosta: oh 10:30 justin_smith: toast - there is pretty much never a reason to turn a vector into a list in clojure 10:30 at least not explicitly 10:30 ddellacosta: if you really want to, I suppose you could 10:30 ,(into '() [1 2 3]) 10:30 clojurebot: (3 2 1) 10:31 Glenjamin: heh 10:31 toast: ,(some #{[1]} '((1))) 10:31 clojurebot: [1] 10:31 Glenjamin: into uses conj 10:31 toast: no 10:31 not programatically 10:31 ddellacosta: not...programatically? 10:32 toast: I was changing the vector in ddellacosta's example to a list 10:32 philandstuff: ,(seq [1 2 3]) turns it into a seq, which is close enough 10:32 clojurebot: (1 2 3) 10:32 ddellacosta: toast: ah, I see, you wanted to see if it would match on that? 10:32 ,(some #{[1 2 3]} '((1 2 3) [4 5 6])) 10:32 clojurebot: [1 2 3] 10:33 toast: yeah 10:33 ddellacosta: gotcha 10:33 toast: is there a pred that would return false? 10:33 (or nil) 10:34 not that I need to do this, just idle curiosity 10:34 justin_smith: ,(#(apply = (map class %&)) [1 2 3] '(1 2 3)) 10:34 clojurebot: false 10:34 justin_smith: checking for equal type and equal contents together is left as an exercise for the reader 10:35 ddellacosta: this channel is getting out of hand 10:35 llasram: ddellacosta: How so? 10:35 CookedGryphon: hi, 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:35 TimMc: justin_smith: identical? :-P 10:36 * ddellacosta was joking 10:36 justin_smith: TimMc: much better, thanks 10:36 llasram: ddellacosta: JOKES????! 10:36 ~guards 10:36 clojurebot: SEIZE HIM! 10:36 * ddellacosta bolts 10:36 * arrdem raises the drawbridge 10:36 justin_smith: ,(identical? '(1 2 3) '(1 2 3)) TimMc; probably not what we want here 10:36 clojurebot: false 10:36 * ddellacosta bangs his head 10:37 TimMc: justin_smith: It will work sometimes, though! 10:37 ,(identical? '() '()) 10:37 clojurebot: true 10:37 justin_smith: ~sometimes 10:37 clojurebot: Huh? 10:37 * TimMc mutters something about induction 10:38 arrdem: friggin really... can you not make a vector with an explicit length? 10:39 TimMc: What, like one filled with nils? 10:39 arrdem: looks like even going array to vector incurs O(N) conj's. 10:39 ddellacosta: hmm 10:39 TimMc: &(count (vec (object-array 5))) 10:39 lazybot: ⇒ 5 10:39 TimMc: &(class (vec (object-array 5))) 10:39 lazybot: ⇒ clojure.lang.PersistentVector 10:39 justin_smith: TimMc: but is that calling conj 5 times? 10:40 TimMc: arrdem: I thought that would just adopt the array. 10:40 arrdem: TimMc: I'll check core.clj but PersistentVector.java doesn't seem to allow that 10:40 TimMc: &(let [a (object-array 5), v (vec a)] (aset a 0 :hi) v) 10:40 lazybot: ⇒ [:hi nil nil nil nil] 10:41 TimMc: ^ I think that demonstrates a lack of conj'ing. 10:41 justin_smith: oh, fascinating 10:41 TimMc: Mileage may vary if array is larger than 32, or if you try to conj to this one. 10:41 arrdem: ,(let [a (object-array 64), v (vec a)] (aset a 0 :hi) v) 10:41 clojurebot: [nil nil nil nil nil ...] 10:41 TimMc: I was expecting a LazilyPersistentVector. 10:42 arrdem: ,(drop 30 (let [a (object-array 64), v (vec a)] (aset a 0 :hi) v)) 10:42 clojurebot: (nil nil nil nil nil ...) 10:42 arrdem: funky 10:42 TimMc: &(let [a (object-array 5), v (conj (vec a) :end)] (aset a 0 :hi) v) 10:42 lazybot: ⇒ [nil nil nil nil nil :end] 10:42 clgv: ,(binding [*print-length* 64] (let [a (object-array 64), v (vec a)] (aset a 0 :hi) (prn v))) 10:42 clojurebot: [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:42 TimMc: ^ So conj'ing creates a new array. You take the hit at first modification. 10:43 arrdem: hum... 10:43 clgv: the small array optimization is weird 10:43 wouldnt be too expensive to just use System/arraycopy there 10:43 TimMc: Right? It's a *small* array, why wouldn't you just copy it? 10:43 clgv: TimMc: exactly! jira ticket! 10:43 TimMc: Not a chance. 10:44 clgv: or maybe there is already one since the observation is not new ;) 10:44 TimMc: why not? windmills? 10:44 TimMc: There's probably something about frequent use of vectors to wrap tiny arrays produced during compilation. 10:44 Windmills. 10:45 clgv: :( 10:46 that's a real weird special case that has almost php quality ;) 10:47 Glenjamin: windmills? 10:47 TimMc: Tilting at. 10:47 clgv: :D 10:48 Glenjamin: ah 10:48 thats two new phrases i've learnt in two days here 10:48 although i forgot what yesterday's was 10:48 clgv: yeah that was a little indirect, I am glad TimMc knew what I meant ;) 11:11 hellofunk: Yes 11:12 justin_smith: ~coin 11:12 clojurebot: Pardon? 11:13 hyPiRion: there is no coin, only (rand 2) 11:13 arrdem: 2d6 11:13 clojurebot: 9 11:13 arrdem: hyPiRion is a pack of lies 11:13 hyPiRion: ~flip 11:13 clojurebot: It's greek to me. 11:13 justin_smith: hyPiRion: lazybot has a coin command 11:13 hellofunk: "There is no ass." -- Woody Allen 11:13 justin_smith: hyPiRion: I had the wrong bot 11:13 hyPiRion:$coin

11:13 lazybot: hyPiRion: Heads.

11:14 fenrock_away: $die 11:14 justin_smith:$coin

11:14 lazybot: justin_smith: Tails.

11:14 fenrock_away: $dice 11:14 what, no dice? 11:14 hyPiRion: die is probably not something lazybot would do on command 11:14 justin_smith:$3d6 (rolling up a paladin)

11:14 hyPiRion: not intentionally at least

11:15 arrdem: 2d20

11:15 clojurebot: 22

11:15 fenrock: haha

11:15 1d6

11:15 clojurebot: 5

11:15 arrdem: 21+3d6

11:15 justin_smith: 1d1

11:15 clojurebot: 1

11:16 arrdem: 3d6+21

11:16 clojurebot: 27

11:16 clgv: :P

11:16 arrdem: wow fail roll

11:16 3d6+21

11:16 clojurebot: 31

11:16 arrdem: there we go

11:16 fenrock: 1d100

11:16 clojurebot: 70

11:16 fenrock: i parry the blow

11:16 clgv: 1dLong/MAX_VALUE

11:16 :/

11:16 ;)

11:16 * justin_smith checks for a random encounter, rolls up a level 30 bitemyapp haskell troll

11:17 TimMc: 1d८

11:17 :-(

11:17 hyPiRion: 100d100

11:17 clojurebot: 4827

11:17 arrdem: (inc justin_smith)

11:17 lazybot: ⇒ 47

11:17 hyPiRion: 2147483647d2147483647

11:17 =(

11:17 arrdem: hyPiRion: wat

11:17 clgv: 2147483647d2147483647d2147483647d2147483647

11:18 oops :P

11:18 llasram: 1d-6

11:18 fenrock: 1d2147483647

11:18 clgv: 1d9223372036854775807

11:18 hyPiRion: arrdem: isn't it obvious what I'm trying to do? roll 2**31-1 2**31-1 sided dies?

11:18 dice*

11:19 fenrock: ok clojurebot, what's the largest dice you have in your bag?

11:19 arrdem: hyPiRion: wat

11:19 fenrock: dice is plural...

11:19 hyPiRion: 2d2

11:19 oh, it's probably doing my calculation. Hurray!

11:19 fenrock: i know, someone thought it was rude to say die to the bot

11:19 llasram: Or hiredman tired of our games

11:20 cbp: ,(+ 1 1)

11:20 o gods

11:20 fenrock: oh dear, bot is busy

11:20 justin_smith: I think that dice roll is going to take a long time to calculate

11:20 clgv: hyPiRion: :P well seems that not all plugins have timeouts ;)

11:20 arrdem: hyPiRion: what have you done

11:21 cbp: i hope it doesn't have clgv's queued up

11:21 clgv: let us hope that clojurebot is on a vserver and not something aws like ;)

11:21 * fenrock wonders who wrote the dice rolling tests

11:21 hyPiRion: cbp: it contains 3 d's, not sure if that would be parsed correctly

11:21 clgv: cbp: unlikely since the first one is illformated

11:21 cbp: oh

11:21 justin_smith: lets cross our fingers that it uses a promoting integral type, so we get a crazy big number, and not a random overflow result

11:21 clgv: probably also a lot of boxing unboxing happening there ;)

11:22 justin_smith: yeah

11:22 arrdem: BigInts get so big for rollin that die up

11:22 hyPiRion: justin_smith: would've crashed by now if that were the case, I think.

11:22 sdegutis: We're one step closer to 0-downtime deploys :D

11:22 clgv: hyPiRion: damn what did I paste there? :P

11:22 sdegutis: Currently we can do so as long as there are no database changes.

11:23 But I wonder if Datomic makes that even easier if there are database changes...

11:23 hyPiRion: clgv: I think you did "2147483647d2147483647" d "2147483647d2147483647", i.e. copypaste my query and forgot to remove the d's

11:24 fenrock: ,(println "i'm alive!")

11:25 do println's normally work, or only returns with meaningful value?

11:25 ,(str "hello")

11:25 clgv: use lazybot

11:25 TimMc: Bot's not talking.

11:25 gtrak: &wat

11:25 lazybot: java.lang.RuntimeException: Unable to resolve symbol: wat in this context

11:25 clgv: fenrock: clojurebot is currently busy with important business ;)

11:25 &(println "use me!")

11:25 Glenjamin: oh neat, clojars got web 3.0-ed

11:25 lazybot: ⇒ use me! nil

11:26 fenrock: well calculating the hardest paladin hit in the world

11:26 clgv: Glenjamin: wow!

11:26 isnt that 2.0? :P

11:26 justin_smith: fenrock: ##(nth 100 (iterate str "hello"))

11:26 lazybot: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to java.lang.Number

11:26 justin_smith: err

11:26 fenrock: ##(nth (iterate str "hello") 100)

11:26 lazybot: ⇒ "hello"

11:26 TimMc: justin_smith: I always get nth's arg order wrong.

11:27 cbp: clojars got bootstrap'ed

11:27 Glenjamin: web 2.0 would be social features

11:27 fenrock: so & is working, but not , ?

11:27 justin_smith: TimMc: it's that whole "collection comes last, except for when we don't feel like it" thing

11:27 Glenjamin: large masthead and 3-wide boxes for feature lists is 3.0

11:28 justin_smith: fenrock: the bot that does , is busy rolling obscene numbers of dice

11:28 fenrock: ah, multibots

11:28 gtrak: &(Thread/sleep 100000)

11:28 justin_smith: it must be intentional that clojurebot does not use threads to execute requests

11:29 gtrak: lol

11:29 lazybot: Execution Timed Out!

11:29 clgv: the "clojars" text color is not optimal yet ;)

11:29 justin_smith: bots do need naps after all

11:29 fenrock: &(str "i'm not that stupid")

11:29 lazybot: ⇒ "i'm not that stupid"

11:29 Glenjamin: xeqi: i think the background colour on the bits to copy-paste on package pages is a tad low contrast

11:29 looks ace in general though :)

11:29 clgv: justin_smith: for eval he has a timeout..

11:29 justin_smith: fenrock: ##"he's also not this stupid"

11:29 fenrock: haha

11:30 justin_smith: fenrock: str on a java.lang.String is kind of silly

11:30 gtrak: &@(future "TESTING")

11:30 lazybot: java.lang.SecurityException: You tripped the alarm! future-call is bad!

11:30 gtrak: awww

11:30 fenrock: but ##"didn't work"

11:30 justin_smith: right, that's a lazybot thing, not a clojure thing

11:30 &"OK"

11:30 lazybot: ⇒ "OK"

11:30 gtrak: &(send (agent) (println "How about agents"))

11:30 lazybot: java.lang.SecurityException: You tripped the alarm! send is bad!

11:31 gtrak: bad syntax anyway, it's for the best.

11:31 fenrock: &true

11:31 lazybot: ⇒ true

11:31 clgv: should work: ##(inc 42)

11:31 lazybot: ⇒ 43

11:32 justin_smith: I think ## must require a (

11:32 fenrock: #true

11:32 TimMc: clojurebot should be restarting shortly. 15 minute restart cycle, right?

11:33 fenrock: ##true

11:33 clgv: TimMc: ah lol, I thought that were timed sessions...

11:33 justin_smith: where there is alway ##(identity identity)

11:33 lazybot: ⇒ #<core$identity clojure.core$identity@1c34652>

11:33 TimMc: Nah, nuke and reload.

11:33 sdegutis: ,((identity identity))

11:33 clgv: pretty crafty ;)

11:33 TimMc: Or rather, the eval service is restarted.

11:33 justin_smith: sdegutis: too few args

11:34 sdegutis: justin_smith: why did not the bot tell me?

11:34 clgv: TimMc: well currently it is not evaluating ;)

11:34 justin_smith: sdegutis: it is busy rolling an assload of dice

11:34 and maybe restarting

11:34 sdegutis: really??

11:34 lazybot: sdegutis: Uh, no. Why would you even ask?

11:34 nbeloglazov: Is 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:34 gfredericks: technomancy: here's a middle ground for the having-things-refered-in-every-namespace issue

11:35 technomancy: have a hook in the nrepl client or nrepl middleware that preps a namespace only when you switch your repl to it

11:35 sdegutis: Finally negated our dependency on lein-ring!

11:35 (Successfully, too.)

11:35 TimMc: sdegutis: Scroll up, clojurebot is busy rolling some 2147483647-sided dice.

11:35 gfredericks: that way you at least aren't mucking in arbitrary lib namespaces you don't care about

11:35 tbaldridge: nbeloglazov: the LazyPersistentVector works better on things that are already collections (non seqs). So it just wraps the existing structure

11:36 sdegutis: TimMc: lazybot also answers ,() forms, no?

11:36 hyPiRion: sdegutis: that's clojurebot

11:36 TimMc: Only in private chat.

11:36 sdegutis: ##((identity identity) identity)

11:36 lazybot: ⇒ #<core$identity clojure.core$identity@1c34652>

11:36 clgv: sdegutis: no

11:36 &(inc 42)

11:36 lazybot: ⇒ 43

11:36 hyPiRion: lazybot: ,()

11:36 sdegutis: ##(take 3 (iterate identity))

11:36 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: core$iterate 11:36 fenrock: 1d6 11:36 justin_smith: (nth (iterate identity identity) 100000) 11:36 &(nth (iterate identity identity) 100000) 11:36 lazybot: ⇒ #<core$identity clojure.core$identity@1c34652> 11:37 nbeloglazov: tbaldridge: the question why use (. MyClass (method)) and (MyClass/method) in the same method? Why not to use same notation for both cases. 11:37 sdegutis: ##(take 3 (iterate identity identity)) 11:37 lazybot: ⇒ (#<core$identity clojure.core$identity@1c34652> #<core$identity clojure.core$identity@1c34652> #<core$identity clojure.core$identity@1c34652>) 11:37 gfredericks: gtrak: what happens at the nrepl level when I switch my repl namespace? 11:37 tbaldridge: nbeloglazov: ah, no clue. One is probably older than the other 11:38 sdegutis: ##(->> (iterate identity identity) (take 404) (reduce #(%1 %2))) 11:38 lazybot: ⇒ #<core$identity clojure.core$identity@1c34652> 11:38 gtrak: gfredericks: hrm :-), probably just an eval, lemme check. 11:38 sdegutis: TimMc: :D 11:39 gfredericks: gtrak: I'm thinking I want a prep-namespace hook of some sort 11:39 rkneufeld: tpope: 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:42 clgv: ,:back? 11:43 fenrock: clearly didn't like all those die commands 11:43 justin_smith: TimMc: ##(identity (identity ((identity nth) (iterate identity identity) (identity 1000000)))) in that same spirit 11:43 lazybot: ⇒ #<core$identity clojure.core$identity@1c34652> 11:47 gtrak: gfredericks: its' just evaling in-ns 11:47 gfredericks: gtrak: hmmmmmmmm 11:47 gtrak: does a middleware seems like the right place to solve this problem? 11:48 clgv: TimMc: how about NPjure? probably you wont be able to program anything in deterministic polynomial time ;) 11:48 +with it 11:48 gtrak: gfredericks: 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:50 gfredericks: gtrak: I'm talking about referring things after switching to the namespace; 11:50 the tricky part being detecting that you've just switched namespaces 11:50 TimMc: clgv: Hmm? 11:50 What would NPjure be? 11:51 gtrak: oh, hmm. 11:51 clgv: TimMc: that the problem you cant decide efficiently which programs are written with it ;) 11:52 TimMc: Sorry, still not getting it. 11:52 clgv: TimMc: NP referring to http://en.wikipedia.org/wiki/NP-complete 11:53 gtrak: gfredericks: yea, I'm not sure how that would work, since eval itself is a middleware. 11:53 gfredericks: gtrak: one approach to this is to just shove vars into clojure.core; there's a lib that does that somewhere; seems terrible 11:54 gtrak: is it that bad to throw it in user? 11:54 gfredericks: huh? 11:54 are you assuming we only use the user namespace at the repl? 11:54 gtrak: instead of having extra symbols, just qualify them with user/ 11:54 gfredericks: oooh 11:54 it's...no fun? 11:55 gtrak: hahaha 11:55 gfredericks: a single character namespace might be tolerable 11:55 u/pprint 11:55 ,(ns u) (def x 42) 11:55 gtrak: yea, I do that all the time, but u's an alias for a project ns. 11:56 justin_smith: (ns ∀ ...) 11:56 gtrak: we ended up with a util.util namespace after a while, uu :-). 11:56 gfredericks: I'm wondering what happens when a namespace uses :as u 11:56 yeah the alias overrides the actual namespace name 11:56 which is good 11:56 TimMc: clgv: Right, but I'm not getting what you're proposing. A language that does what? Has what characteristics? 11:57 gtrak: you can also have aliases with dots in them. 11:57 so go figure. 11:57 gfredericks: &'//3 11:57 lazybot: java.lang.RuntimeException: Invalid token: //3 11:57 gfredericks: &'//x 11:57 lazybot: java.lang.RuntimeException: Invalid token: //x 11:57 gfredericks: I was hoping it would interpret / as the namespace portion :) 11:58 clgv: TimMc: 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:58 *probably inefficient 11:58 TimMc: Ah, hmm. 11:58 You mean like C++? 11:59 clgv: :P 12:00 TimMc: My understanding is you need a Turing machine to parse C++. 12:00 gfredericks: (ns =) ; goes well with dvorak 12:00 arrdem: TimMc: correct, C++ is a context sensitive grammar 12:01 TimMc: arrdem: I thought CSG wasn't sufficient either. 12:01 I don't know C++ though, so I'm happy to take your word for it. 12:02 arrdem: TimMc: CSG is the weakest grammar that requires a TM for its implementation.. 12:02 beyond that you have undecidable grammars and infinite grammars 12:02 c++ may in fact be undecidable, but I hope not 12:02 TimMc: Oh! 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:03 justin_smith: Schroedinger's grammer - the compiler both compiled and failed to compile your code, until you run the program and find out 12:03 (aka perl for example) 12:03 arrdem: hehe 12:04 hyPiRion: TimMc: you can use weaker machines for some specific CSGs, but that's sort of cheating 12:05 clgv: huh, outofmemoryexception immanent on 16GB RAM :( I need a better data format than clojure maps for that data... 12:05 dbasch: out-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:05 justin_smith: hah 12:07 philandstuff: CSGs require linear bounded automata 12:07 justin_smith: clgv: 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:08 clgv: justin_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:09 justin_smith: clgv: another option: a core.async go block reading [k v] pairs from a channel 12:09 then it is clear that only that block owns the map, and via lexical closure it can't be accidentally tampered with 12:10 where map here is a java.util.HashMap 12:10 clgv: justin_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:10 justin_smith: clgv: well it could also have a copy on output channel to provide the map to others 12:11 clgv: I dont think core.sasync would serve me well here 12:11 justin_smith: or 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:11 clgv: just a way to close over the mutable object without increasing size 12:12 but 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:14 tbaldridge: clgv: the caching ability of Datomic might help there. You can walk entities like clojure hashmaps, Datomic will cache commonly accessed data 12:15 clgv: 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:16 clgv: tbaldridge: analysis of data, mostly calculating metrics 12:17 tbaldridge: clgv: might be worth looking into then. Roomkey uses Datomic for both online and offline data analysis. 12:20 arrdem: tbaldridge: 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:22 Bronsa: arrdem: :inline works for multi arities too IIRC 12:22 tbaldridge: why is single-arity conversion a prerequisite for inlining? I think you should be able to just inline the single arity being used. 12:22 arrdem: Bronsa: really? /me checks definline 12:23 clgv: arrdem: don't use definline just use :inline metadata 12:23 arrdem: clgv: I know that, but definline has the restriction documentation 12:24 clgv: arrdem: for itself yes 12:24 arrdem: clojure.core has examples for multi-arity inlines 12:25 arrdem: clgv: looks like vardic is the only thing that inline doesn't support. 12:25 cbp: ,1 12:26 cbp: dammit guys 12:26 * arrdem facedesk 12:27 TimMc: ^ When neither a facepalm or a headdesk will quite express your emotions. 12:28 clgv: :D 12:29 TimMc: palmdesk is of course something else entirely ("Dammit, hyPiRion!") 12:29 kzar: laptopwindow 12:30 technomancy: keyboarddefenestration 12:30 frik 12:30 technomancy: http://p.hagelb.org/spock.gif 12:30 cbp: uh 12:30 technomancy: it's cool; I got it =) 12:30 cbp: step down son 12:31 arrdem: (inc technomancy) 12:31 lazybot: ⇒ 114 12:31 Bronsa: ahaha 12:31 (inc technomancy) 12:31 lazybot: ⇒ 115 12:32 hlship: So, I'm pretty committed to some solutions using core.async 12:32 and I'm getting a bit of pushback 12:32 the "well, name some high-profile apps that use it" 12:32 TimMc: ugh 12:32 hlship: (this is JVM, not JS use of core.async) 12:33 gtrak: lol. 12:33 Google. 12:33 Glenjamin: what would you use if you didn't use core.async? 12:33 TimMc: Name some high-profile apps that use *Clojure*. 12:33 hlship: exactly, it's pretty silly 12:33 Kowboy: quick, name some high profile apps that use the JVM 12:34 technomancy: "It's got Tony Hoare's name on it; it's gotta be good." 12:34 cbp: I can't imagine doing gui without async honestly :-S 12:34 gfredericks: name some high profile apps 12:34 TimMc: gfredericks: Naming is hard! 12:34 hlship: without core.async I would need a significant redesign, and throw lots of cpu/threads/memory at same problem 12:34 arrdem: cpus are cheap... 12:34 TimMc: But, uh... icarus-firewall, there's a name you can use. 12:34 gtrak: forgiveness instead of permission? 12:35 datomic must definitely uses it. 12:36 tbaldridge: most of datomic predates core.async 12:36 gfredericks: best single-character name for a repl util namespace? I'm thinking "u" or "=" 12:36 tbaldridge: I have absolutely no clue one way or the other, but I'm sure looking at the datomic deps would provide some answers 12:37 gfredericks: I'd like one of #{"$" "%" "&" "*"} also but I still have to use shift to type them

12:37 TimMc: gfredericks: .

12:37 Bronsa: gtrak: looking at the datomic pom I don't see a core.async dep

12:37 gfredericks: TimMc: holy crap I didn't know that worked

12:37 TimMc: Wait, does it?

12:37 gfredericks: in my repl

12:37 arrdem: ,(require '[clojure.string :as .])

12:37 clojurebot: eval service is offline

12:37 TimMc: ahhhhhhh

12:37 * arrdem grabs a real repl

12:37 hlship: I'm downloading Datomic right now to see what's in it

12:37 TimMc: I'm sorry I mentioned it.

12:37 gfredericks: ./ is pretty quick for me to type too

12:38 TimMc: That's horrifying.

12:38 Bronsa: TimMc: well . is a valid symbol so I don't see why that shouldn't work

12:38 arrdem: good grief ./ works..

12:39 Bronsa: I mean you can even (def . 1)

12:39 hlship: yes, no sign that Datomic uses core.async

12:39 arrdem: Bronsa: you're still gonna get that cdot patch

12:39 TimMc: Bronsa: I would expect interop to claim it in a bunch of contexts.

12:39 Bronsa: TimMc: in call position, yes

12:39 arrdem: you'll have to try real hard to convince me on that.

12:39 tbaldridge: pedestal uses core.async. But I'm not sure if that's "high profile" enough

12:40 gfredericks: man I'm totally about to do ./

12:40 arrdem: TimMc: should be ok so long as it's just in symbol/var strings..

12:40 TimMc: what have I done

12:40 gfredericks: I've already got special neurons dedicated to this key combination thanks to bash

12:41 TimMc: (./join "a" "bc") -- it's just an accident of the compiler that that isn't turned into (. "a" /join "bc"), right?

12:41 clgv: 1d5

12:41 ? ;)

12:41 arrdem: Bronsa: I'm open to better aliases for concat

12:41 clgv: oh ok accidental reply

12:41 ,(inc 42)

12:41 clojurebot: 43

12:41 nullptr: :as . all the things!

12:41 clgv: ^^

12:41 Bronsa: arrdem: whatever I can reach from my keyboard without using AltGr is fine :P

12:42 technomancy: gfredericks: I like it

12:42 arrdem: Bronsa: dude you just need to use TeX as your input method :P

12:42 technomancy: it's twisted

12:42 Bronsa: TimMc: not really an accident, .foo works on the symbol name

12:42 arrdem: rrrright at that point I'd rather AltGr . than \cdot

12:42 gfredericks: technomancy: ./ you mean?

12:42 technomancy: yup

12:43 Bronsa: TimMc: ie. try (foo/.toString 1)

12:43 arrdem: Bronsa: hah fair

12:43 clgv: &(read-string "(./join a bc)")

12:43 lazybot: ⇒ (./join a bc)

12:43 clgv: &(macroexpand-1 (read-string "(./join a bc)"))

12:43 lazybot: ⇒ (./join a bc)

12:44 philandstuff: is there a way to access clojure's jira over https?

12:44 and I'm not being paranoid; one of my colleagues owns a wifi pineapple :P

12:45 arrdem: philandstuff: have you checked your ethernet for throwing star splitters? :P

12:45 TimMc: Bronsa: Hmm... yeah, true. The interop stuff only takes a swing at already-parsed syntax.

12:46 gfredericks: ,(require '.)

12:46 clojurebot: #<FileNotFoundException java.io.FileNotFoundException: Could not locate /__init.class or /.clj on classpath: >

12:46 Bronsa: TimMc: my point was that the "." interop thingy only works on the name part of a symbol

12:46 TimMc: philandstuff: Ever since a year ago, it's not paranoia, it's common sense.

12:46 gfredericks: lol apparently I will have to call this file "src/.clj"

12:46 philandstuff: TimMc: well quite

12:47 arrdem: gfredericks: please do

12:47 TimMc: I mean, we already knew, but now we *know*.

12:47 gfredericks: oh jesus

12:47 clgv: gfredericks: not "..clj"?

12:47 gfredericks: apparently not

12:47 clgv: gfredericks: have fun AOTing that thing ;)

12:48 or does it convert to __DOT__ ?

12:48 gfredericks: ,(fn . [])

12:48 clojurebot: #<sandbox$eval123$_DOT___124 sandbox$eval123$_DOT___124@1c7b3c2>

12:48 gfredericks: in other cases

12:48 not namespace names though

12:48 I wonder how the core team would react to a jira ticket asking for better support for (ns .)

12:48 TimMc: &(ns-munge ".")

12:48 lazybot: java.lang.RuntimeException: Unable to resolve symbol: ns-munge in this context

12:49 TimMc: &(namespace-munge ".")

12:49 lazybot: ⇒ "."

12:50 clgv: haha ^^

12:50 Bronsa: oh boy ns-munge is really called namespace-munge?

12:50 that's so inconsistent

12:51 gfredericks: &(apropos "namespace")

12:51 lazybot: java.lang.RuntimeException: Unable to resolve symbol: apropos in this context

12:51 arrdem: Bronsa: jira ticket!

12:51 gfredericks: &(clojure.repl/apropos "namespace")

12:51 lazybot: ⇒ (*print-suppress-namespaces* namespace namespace-munge file->namespaces namespaces-on-classpath namespaces-in-dir)

12:51 clgv: Bronsa: why? it does not operate on a give namespace

12:51 TimMc: &(apropos-better 'apropos)

12:51 lazybot: java.lang.RuntimeException: Unable to resolve symbol: apropos-better in this context

12:51 clgv: it's only lengthy

12:51 ,(use 'clojure.repl)

12:51 clojurebot: nil

12:51 Bronsa: clgv: you have a point

12:51 clgv: ,(apropos "namespace")

12:51 clojurebot: (namespace namespace-munge)

12:51 gfredericks: now I need to decide where to setup this special namespace

12:52 e.g., src/.clj, or my leiningen :repl options, or...

12:52 clgv: I still wonder why it is not "..clj"

12:53 gfredericks: clgv: because it turns "." into "/"

12:53 &(namespace-munge "foo.bar")

12:53 lazybot: ⇒ "foo.bar"

12:53 gfredericks: sorta

12:54 clgv: ,(require .)

12:54 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: . in this context, compiling:(NO_SOURCE_PATH:0:0)>

12:54 clgv: ,(require '.)

12:54 clojurebot: #<FileNotFoundException java.io.FileNotFoundException: Could not locate /__init.class or /.clj on classpath: >

12:55 clgv: &(clojure-version)

12:55 lazybot: ⇒ "1.4.0"

12:55 clgv: &(require '.)

12:55 lazybot: java.io.FileNotFoundException: Could not locate /__init.class or /.clj on classpath:

12:55 TimMc: gfredericks: So you have your heart set on (require '.) instead of (require '[my.utils :as .])?

12:55 clgv: at least ".clj" is a "hidden" file ;)

12:55 gfredericks: TimMc: yes, because I want it to work everywhere instead of having to prep every namespace I use yn my repl

12:55 that's the main problem I'm trying to solve

12:56 TimMc: I see, so you want a very short way to get it.

12:56 and you don't want keyboard macros or whatever

12:57 gfredericks: hadn't considered keyboard macros

12:57 whodidthis: clgv: file name is whatever comes after . i guess

12:58 CookedGryphon: Hey, does anyone know if I can use classes made with deftype in java directly?

12:58 if so how?

12:58 gfredericks: CookedGryphon: AOT probably? you could also write interfaces in java and code to those, then have the deftype implement them

12:58 CookedGryphon: not what I'm trying for

12:59 I'm writing some stuff in java, and want to generate a tuple as defined by clj-tuple

12:59 llasram: CookedGryphon: By directly do you mean e.g. mentioning the deftype type by name in the Java source?

12:59 arrdem: gtrak: the deftype should become <ns path>.MyType from Java's point of view.

12:59 llasram: CookedGryphon: Oh, for that just use the Clojure API to get the tuple-creating var-function

12:59 hiredman: CookedGryphon: sure, just load the clj-tuple namespace and call the clj-tuple functions from java

12:59 llasram: And call it from Java just like you would like from Clojure

12:59 gtrak: arrdem: thanks :-)

12:59 arrdem: gtrak: herp derp

13:00 CookedGryphon: yep, I can do that, I was just wondering if I could actually use the underlying classes it generates directly

13:00 llasram: Best not to

13: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:00 CookedGryphon: for example the 2-arity implementation of (tuple 2 2) is just (Tuple2 2 2 nil)

13:00 sorry (Tuple2. 2 2 nil)

13:00 danneu: ls takes forever to run and I ctrl-C'd it after 40 seconds

13:01 llasram: Introducing a multi-way Java<->AOT-Clojure dependency would make your build sad and tricky

13:01 CookedGryphon: fair enough, that sounds like my answer

13:01 ToxicFrog: danneu: ...are you sure you have the right channel?

13:01 CookedGryphon: I'll just invoke the clj-tuple/tuple fn, thanks for the discussion

13:03 hiredman: CookedGryphon: if you are just looking for jvm tuples boundary has a neat jvm tuple library

13:04 danneu: ToxicFrog: i ask generic dev questions here cuz yall my people

13:04 fenrock: CookedGryphon: there's good examples of this on page 389 of Clojure Programming.

13:04 CookedGryphon: hiredman: thanks, but I'm passing into clojure code which makes use of tuple's fast destructuring etc

13:08 TimMc: danneu: Probably depends on your filesystem.

13:09 Do a search for something like ext2 directory size

13:09 Bronsa: danneu: maybe you have something mounted via ssh-fs and it's no longer reachable?

13:10 danneu: oh sorry I didn't read the first part of your question :)

13:12 ToxicFrog: danneu: fair enough

13:12 danneu: 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:12 You may eventually start hitting filesystem limits, although that depends on the fs and what settings it was created with.

13:14 umpa: How do you loop recur with sequences as parameters ? https://www.refheap.com/86521

13:17 danneu: ToxicFrog: it's an ext3 disk. folder has 1170377 files which is way above the ext3 limits i find from casual google queries

13:18 johnwalker: how do you use clojure.java.io/writer with a FileWriter?

13:20 ToxicFrog: danneu: 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:20 danneu: it does have a maximum number of subdirectories per directory, though.

13:21 stain: the shell will have limits though

13:21 ToxicFrog: Oh yeah

13:21 Hence my comment about not being able to use * in that directory

13:21 danneu: looks 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:21 stain: that's why it is good to use part of the filename/id as subdirectories.. for instance .git/objects/59/1d2525b691251bd9f52848a1e9e2325f013ae2

13:22 danneu: i saw that HN recently moved from a similar system to a /12/12345.html, /12/12346.html

13:23 stain: I 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:23 I keep those characters still in the filename at the end though (unlike git)

13:25 umpa: stain: danneu: what exactly are you guys talking about?

13:26 stain: 18: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:27 danneu: is your io/resource call slow at the moment?

13:27 as long as you are accessing one and one post it should be fine

13:27 as you are hand-crafting the filename

13:27 not sure why you are doing it through the classpath though

13:27 you might have URLClassLoader a bit overworked

13:28 why not just do it as files? I mean you have to write to those files anyway?

13:28 (or is this bundled inside a WAR or something?)

13:30 danneu: stain: 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:31 i'm going to recreate my server locally in virtualbox to see if it's slow

13:34 arrdem: (inc amalloy) ;; eclipse suggestion from yesterday

13:34 lazybot: ⇒ 124

13:35 danneu: stain: what do you mean 'just do it as files'?

13:36 gfredericks: (inc amalloy) ; hangin out here all the time

13:36 lazybot: ⇒ 125

13:38 justin_smith: (inc amalloy) ; all the cool kids are doing it

13:38 lazybot: ⇒ 126

13:53 TimMc: &(let [Long String] (instance? Long "abc"))

13:53 lazybot: ⇒ false

13:54 TimMc: ,(let [Long String] (instance? Long "abc"))

13:54 clojurebot: true

13:54 TimMc: niiice, glad that got fixed

13:54 (CLJ-1171)

14:04 Glenjamin: ,*clojure-version*

14:04 clojurebot: {:major 1, :minor 6, :incremental 0, :qualifier nil}

14:04 Glenjamin: &*clojure-version*

14:04 lazybot: ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}

14:05 Glenjamin: does that mean the LHS of instance? cannot be a variable?

14:08 amalloy: Glenjamin: uhhhhh, he just demonstrated that it can

14:08 Glenjamin: oh, duh

14:08 i saw "abc"

14:08 and read that as "should be a Long"

14:09 then got confused when i checked the versions

14:09 amalloy: three letters is pretty long

14:09 Jaood: (dec amalloy)

14:09 lazybot: ⇒ 125

14:09 Jaood: for recommending eclipse to amalloy

14:09 amalloy: amalloy: never use eclipse

14:09 Jaood: to arrdem :P

14:10 (inc amalloy)

14:10 lazybot: ⇒ 126

14:10 TimMc: Glenjamin: If you have a lexical shadowing a class, instance?'s inlining would treat it as a literal class name.

14:10 Jaood: for recommending eclipse to amalloy

14:10 dbasch: there are always cases for using eclipse

14:10 Glenjamin: TimMc: yeah, makes sense now - i just read the conditionals the wrong way around

14:10 amalloy: dbasch: it's okay. i know to ignore advice from tricksters like amalloy

14:10 TimMc: dbasch: It's great for browsing random Java projects.

14:10 justin_smith: dbasch: "I sure do have a lot of free ram on this computer, whatever shall I do to use it up?"

14:11 arrdem: elipse solves my primary frustration with Compiler.java, being my inability to visualize the class higherarchy let alone navigate it unaided

14:11 dbasch: justin_smith: “I work at the Eclipse foundation and I don’t want to get fired for being a traitor to the cause”

14:11 amalloy: justin_smith: for when firefox isn't an option?

14:11 * arrdem checks his memory usage

14:11 justin_smith: heh

14:11 arrdem: 16GB, 1.2 in use

14:11 * arrdem shrugs

14:12 Jaood: I though IDEA was the sane recommendation when users have a choice

14:13 amalloy: i'm sure intellij, idea, whatever it is, is fine

14:13 dbasch: Jaood: IDEA was the last IDE that I used, when I had to code in Scala

14:13 I cannot imagine Scala without an IDE

14:14 agarman: IDEA isn't at all as impressive now as it was in 2008-2010

14:14 dbasch: amalloy: it’s totally fine, although it feels like you’re staring at the cockpit of a 747 in terms of controls

14:15 amalloy: dbasch: tried eclipse?

14:15 dbasch: amalloy: yes but not in the past decade

14:15 agarman: if you're not using UML & refactoring (neither of which are useful in Scala or Clojure) IDEA isn't better than Eclipse

14:15 dbasch: agarman: refactoring is useful in Scala

14:15 amalloy: it's got a lot of buttons too, i guess is all i was going to say

14:16 it'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:16 agarman: dbasch: The Scala IDE for Eclipse is better than what IDEA has for Scala

14:16 dbasch: agarman: I’ll try it the next time I use Scala, which I hope is never

14:17 noncom|2: i used to use scala and then switched to clojure

14:17 agarman: dbasch: I hope to never have to do extensive Scala again... 4 years in hell was long enough for me!

14:17 noncom|2: i am happy now

14:17 dbasch: but everyone in my old team that did Java was very happy with Eclipse

14:17 noncom|2: (almost)

14:17 amalloy: dbasch will next use scala in Option[Years] time

14:17 noncom|2: scala eclipse ide is the official one, that's what it is good

14:18 dbasch: amalloy: where Years is Long or null

14:18 noncom|2: Long.MAX_VALUE

14:18 amalloy: ah, good old null

14:19 noncom|2: nil

14:19 arrdem: None

14:19 amalloy: a cornerstone of typesafe programming

14:19 dbasch: yeah, I almost typed nil

14:19 noncom|2: ,((symbol (name :.noSuchMethod)) (Thread.))

14:19 clojurebot: #<SecurityException java.lang.SecurityException: no threads please>

14:20 dbasch: arrdem: yeah, hopefully that Option will return None

14:20 noncom|2: ,((symbol (name :.noSuchMethod)) (ArrayList.))

14:20 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: ArrayList, compiling:(NO_SOURCE_PATH:0:0)>

14:20 noncom|2: ,((symbol (name :.noSuchMethod)) (java.util.ArrayList.))

14:20 clojurebot: nil

14:20 noncom|2: see? ^^

14:20 amalloy: dbasch: that was the joke i was hoping to offer, but i like your Long-or-null better

14:20 noncom|2: why?

14:20 clojurebot: why is the ram gone

14:21 noncom|2: why it happens so?\

14:21 arrdem: because we use a language that doesn't believe in update in place, next!

14:21 dbasch: one day I made the mistake of trying to run an open-source project from Twitter written in Scala

14:22 amalloy: i'm having "fun" trying to use kafka

14:22 dbasch: oh, they retired it now https://github.com/twitter/snowflake/

14:22 noncom|2: amalloy: is there a way to dynamically generaet a java class interop method to call?

14:22 ystael: dbasch: which part was the mistake? "open-source", "twitter", "scala", or "run"?

14:22 dbasch: amalloy: Kafka is arguably the best OS project released by my former employer

14:23 ystael: open-source and Twitter, probably

14:23 amalloy: dbasch: linkedin, presumably, not apache?

14:23 justin_smith: noncom|2: what do you need to generate?

14:23 dbasch: amalloy: yes, LinkedIn

14:23 amalloy: Voldemort is pretty good too

14:23 noncom|2: a java class has many methods, i want to create a method call from a :keyword that someone passes to my func

14:23 amalloy: noncom|2: in general if you're trying to do that you've already made a mistake

14:24 noncom|2: what would you propose?

14:24 dbasch: noncom|2: what’s the broader picture?

14:24 amalloy: just calling methods on the object directly. what is the point of an intermediary who converts :size to .size?

14:25 but, yes, reconsidering the broader picture will probably lead you to a better answer than my random instincts

14:26 noncom|2: i want to encapsulate the work with the object because i do not want to make the user to import the class

14:27 i want to create a wrapper for this class: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/utils/MeshBuilder.html

14:28 dbasch: noncom|2: but if the user is sending you things like :capsule or :circle or :box you’re not really encapsulating anything

14:28 amalloy: (inc dbasch)

14:28 lazybot: ⇒ 6

14:28 noncom|2: well, maybe i will later have a map with {:circle 10 10 10 10 ...]

14:28 sorry, i meant }

14:29 maybe i want to build something upon it

14:29 if the methods were clojrue functions that would be easy

14:29 but them java methods are different

14:29 dbasch: noncom|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:30 if you’re going to simply put sugar around the java api, might as well just let them use the java api

14:30 noncom|2: ummm.. the user just writes or generates a set of declarative instructions, just as i have said above

14:30 yeah, i agree with you

14:31 but sometimes sugar means much too. and this is not only sugar, this will help to write cleaner drawing routines

14:31 dbasch: noncom|2: do you need to expose the entire api, or just a small subset?

14:31 noncom|2: ideally all api. overtime this will be required anyway..

14:31 currently i am leaning towards a condp :)

14:32 dbasch: noncom|2: if you’re adding methods that do things that the api doesn’t, then I would write those in idiomatic clojure

14:32 noncom|2: for the rest, I’d just give the user the option to go down to java, like the rest of clojure does

14:33 noncom|2: ummm, 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:33 so that :circle is a building block as well as 20

14:33 homoiconicity

14:34 i just need an automata there

14:34 which will pick the right method by the keyword

14:34 so condp is the simplest

14:35 AeroNotix: A colleague wants to use an IDE for Clojure, I heard there was some good integration between some IDE and a plugin

14:35 anyone know?

14:35 noncom|2: eclipse + ccw

14:35 AeroNotix: ccw?

14:35 noncom|2: or emacs

14:35 Jaood: AeroNotix: cursive

14:35 dbasch: noncom|2: why is it less work to generate those sequences than to generate the actual clojure code that calls the java api?

14:35 clojurebot: ccw is http://code.google.com/p/counterclockwise/

14:35 AeroNotix: noncom|2: he's not an emacs user

14:35 cbp: ,1

14:35 clojurebot: 1

14:36 noncom|2: dbasch: the sequences will be generated automatically, from sound or eeg

14:36 AeroNotix: thanks noncom|2

14:36 noncom|2: (this is a very simplifies explanation)

14:36 cbp: I tried ccw to teach a coworker a few months ago and it was very underwhelming

14:36 systemfault: Cursive or lighttable :P

14:37 Anything touching eclipse sucks (my opinion)

14:37 amalloy: systemfault: that's a sucky opinion (objectively)

14:37 dbasch: noncom|2: I’m out of ideas :)

14:38 systemfault: amalloy: Could very well be. But the day I switched to IntelliJ, I had no more problem with bad third-party plugins.

15:07 dagda1: I 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:10 amalloy: you seem to have accidentally posted a sql optimization question to #clojure, dagda1

15:10 dagda1: haha

15:10 amalloy: please feel free to answer in clojure :)

15:19 danneu: Do jvm opts passed via command line override :jvm-opts in project.clj?

15:19 technomancy: danneu: how do you pass jvm opts via the command line?

15:24 danneu: technomancy: when you compile an uberjar, are :jvm-opts 'baked in' to the jar as default opts when you java -jar app.jar?

15:24 amalloy: danneu: no, you can't do that. you're the one typing java, so you get to pass the jvm opts

15:25 technomancy: yeah, what he said

15:25 danneu: oh, i see. so :jvm-opts is just used by lein commands

15:37 cbp: does anyone have a fn handy to walk the body of a macro, find an expression and do a kind of update-in?

15:39 sveri: Hi, 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:41 allenj12: so does hiccup and enlive replace html completely/ or atleast mostly?

15:44 justin_smith: allenj12: well they produce and interpret html. Whether you still use html directly probably depends on the skillset of the people you collaborate with.

15:45 allenj12: 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:45 allenj12: justin_smith: gotcha so if im doing this solo, would i need/be recommended to use any html?

15:46 justin_smith: allenj12: 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:47 but I mean hiccup is html, it just has some tags embedded in it

15:47 and those tags produce more html...

15:47 allenj12: justin_smith: yea i know that i was just wondering if there was any real point in making any html files directly

15:47 dbasch: sveri: you shouldn’t be using doseq. What does your file look like?

15:48 sveri: is it “colon-separated values” ?

15:50 justin_smith: sveri: would lines have the same keys, or would a key be unique across all lines?

15:50 sveri: dbasch: yea, I just found out reduce is better and am fiddling with it :D

15:50 dbasch: justin_smith I am not sure how it will look exactly, so I am taking a split function here

15:53 Jarda: has anyone created a sqlkorma store for clauth?

15:55 justin_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:55 clojurebot: {"d" "3", "c" "2", "b" "1", "a" "0"}

15:56 justin_smith: sveri: 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:57 dbasch: sveri: how about https://www.refheap.com/86526

15:57 (assumes no repeated keys)

15:58 justin_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:58 clojurebot: {"d" ["3"], "c" ["hello" "2"], "b" ["1"], "a" ["0"]}

15:58 justin_smith: works with repeated keys

15:59 sveri: justin_smith: dbasch thats both awesome solutions :-) I wonder which day will be the day my head starts to think of them himself :D

15:59 justin_smith: sveri: work from the inside out, and always visualize the shape of the data - eventually it is like legos

16:00 dbasch: sveri: 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:00 justin_smith: sveri 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:00 dbasch: doseq is for side effects, e.g. printing stuff to stdout

16:01 sveri: yea

16:01 dbasch: you have a line-seq, and you want to convert it into another structure via application of functional transformations

16:01 sveri: I get that, understanding the difference between doseq and reduce is the easiest part :D

16:01 justin_smith: someone 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:02 dbasch: my thinking was: first, split every line into two pairs, then convert those pairs into a map where each pair is a mapping

16:03 sorry, split every line into a pair

16:03 justin_smith: dbasch: oh, was it really one pair for a line? that would have been easier than my overgenerlization then

16:03 dbasch: (inc justin_smith )

16:03 lazybot: ⇒ 2

16:04 justin_smith: is inc sensitive to paren placement or something?

16:04 $karma justin_smith 16:04 lazybot: justin_smith has karma 47. 16:04 dbasch: (inc justin_smith) 16:04 lazybot: ⇒ 48 16:05 dbasch: lazybot’s parsing clearly is 16:05 (inc ) 16:05 (inc ) 16:05 lazybot: ⇒ 1 16:05 dbasch: haha 16:05 justin_smith: (inc significant white space ) 16:05 lazybot: ⇒ 1 16:05 allenj12: domina hasnt seem to be updated recently, why is that? 16:06 justin_smith:$karma significant white space

16:06 lazybot: significant has karma 0.

16:06 dbasch: $karma 16:06$karma

16:06 justin_smith: dbasch: your client is not sending trailing white space

16:06 dbasch: $karma ; 16:06 lazybot: ; has karma 0. 16:06 justin_smith:$karma

16:07 dbasch: $karma ; 16:07 lazybot: has karma 0. 16:07 dbasch:$karma ;

16:07 lazybot: has karma 0.

16:07 justin_smith: odd

16:07 dbasch: justin_smith: the convert-line-to-map-entry function implied that it was one pair per line

16:08 clojurebot: Gabh mo leithscéal?

16:08 justin_smith: dbasch: yeah, sometimes I code faster than I read

16:09 dbasch: clojurebot: one day you’ll |learn| that not everything can be solved with the Irish language.

16:09 clojurebot: Ok.

16:18 TimMc: justin_smith: I'll do the voice if someone else wants to provide a good mic. :-P

16:20 justin_smith: heh

16:41 sveri: Hm, 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:43 nevermind, doseq over the vetcor and writing the result just does the trick

16:50 stephenjudkins: what are good OSS clojure projects to read?

16:52 technomancy: maybe syme if you want a small web app

16:53 justin_smith: stephenjudkins: flatland/useful is pretty great

16:54 nDuff: stephenjudkins, ...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:56 hiredman: https://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:56 (but it hasn't been touched in 3 years)

16:57 justin_smith: analemma is pretty cool, yeah

16:57 and very easy to use

16:58 (it even makes animated svg)

16:58 hiredman: oh, neat, I haven't seen the animated bits

16:59 justin_smith: http://liebke.github.io/analemma/ animations here

17:00 stephenjudkins: thanks for the links, all

17:05 cbp: /

17:16 gfredericks: huh. so having a "src/.clj" apparently isn't working

17:17 justin_smith: src/..clj maybe?

17:18 hiredman: the arc of history is long but it bends toward justice

17:18 gfredericks: I guess it's worth a try

17:18 justin_smith: even better would be if you namespace was my...something.other such that the containing directory would have to be parallel with its parent

17:18 gfredericks: nope ..clj doesn't work either

17:19 I'm just going to have to use user.clj

17:27 technomancy: gfredericks: can you use load instead of require?

17:27 not that it's a thing I'd recommend

17:34 gfredericks: technomancy: yeah that totes works; not sure how to do that as a library though

17:34 oh wait

17:34 hm

17:34 I'm not sure I attempted load correctly

17:35 amalloy: gfredericks: what tomfoolery are you up to here?

17:35 gfredericks: amalloy: trying to gain myself repl utils that work from everywhere but without being too evil

17:35 referring things everywhere is hard, so I settled on (ns .)

17:35 then I can use ./foo from everewhere

17:36 technomancy: the tommest of foolery

17:36 hiredman: is refering things everywhere actually hard?

17:37 gfredericks: hiredman: I think so

17:37 hiredman: can't you just alter the refer function to refer your code when it refers clojure.core?

17:37 technomancy: monstrous

17:37 gfredericks: hiredman: 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:38 technomancy: gfredericks: have you tried adding a cider hook for the change-namespace command there?

17:38 hiredman: gfredericks: maybe it should be custom nrepl middleware

17:38 gfredericks: technomancy: nope

17:38 hiredman: technomancy will tell you all about nrepl discover

17:39 gfredericks: hiredman: I was imagining that, but gtrak told me namespace changes are done by simply evaling (in-ns ...)

17:39 so that'd be weird to intercept

17:39 technomancy has told me about nrepl-discover every time I've brought this up, except for today

17:39 amalloy: gfredericks: you're attempting black magic, right? does "weird" matter?

17:39 hiredman: gfredericks: oh, but with custom middleware you can intercept (foo) and load gfredericks.utils and run (gfredericks.utils/foo) instead

17:39 gtrak: nrepl-discover is not 'mature' enough to make it into cider yet, heh, heh.

17:39 gfredericks: ./ has the advantage of not being dependent on my tooling

17:40 hiredman: fah

17:40 gtrak: I'm pretty sure that just means 'not my code'.

17:40 hiredman: you are always dependent on tooling

17:40 gfredericks: hiredman: that only works if it's a top-level call

17:40 ludwig: is it possible that component local state in om is entirely broken?

17:40 arrdem: gtrak: now there's damning with faint praise..

17:40 gfredericks: hiredman: 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:42 amalloy: {blake}: no, there aren't

17:42 gfredericks: hiredman: e.g., somebody in a web browser via session, or in a deployment with a raw clojure.main

17:42 s/somebody//

17:42 {blake}: amalloy, Dammit. I should've known you'd take their side.

17:42 arrdem: {blake}: for has :when

17:43 amalloy: arrdem: another entry in "weird things programmers say"

17:43 {blake}: arrdem, That's probably where I'm getting the idea from, thanks.

17:43 amalloy: {blake}: egamble has a macro that includes :when and various other nonsense in a let-binding

17:43 arrdem: amalloy: heh

17:43 amalloy: $google egamle let-else 17:43 lazybot: [guitar chords, guitar tabs and lyrics - chordie] http://www.chordie.com/song.php 17:43 amalloy:$google egamble let-else

17:43 lazybot: [egamble/let-else · GitHub] https://github.com/egamble/let-else

17:44 hiredman: gfredericks: session should really be using nrepl

17:45 {blake}: Ooh. Guitar tabs.

17:46 gfredericks: hiredman: agreed

17:46 {blake}: amalloy, Thanks.

17:49 Nikentic: Any tips on how to reslove function from a string?

17:50 arrdem: please don't, use a static dispatch table and resort to clojure.core/resolve if you know what you're doing.

17:50 TEttinger: Nikentic, yeah it uh can be a pain with namespaces

17:51 gfredericks: amalloy: I guess by weird I meant unreliable; sensitive to client changes, doesn't necessarily work across clients, etc

17:53 hiredman: gfredericks: so what would you put in such a bag of tricks?

17:54 gfredericks: hiredman: if you're asking what goes in the namespace: https://github.com/gfredericks/repl-utils/blob/master/src/com/gfredericks/repl.clj

17:54 the best one is the bg macro at the bottom

17:55 hiredman: huh

17:57 amalloy: gfredericks: canonizing a record seems like a dangerous plan

17:57 in that it won't print as a record

17:58 gfredericks: amalloy: totes; I just added that today

17:58 amalloy: it's just for pretty-printing, so not too risky

17:59 amalloy: gfredericks: your hack could be to add all these functions to clojure.core

17:59 then you wouldn't need to refer them

17:59 gfredericks: amalloy: yeah I've tried that

17:59 amalloy: you have to be careful about doing it before *any other* namespace boots up

17:59 and it still has the universality disadvantage, of modifying namespaces you'll never need to touch

18:00 amalloy: but it can't do anything bad to those namespaces

18:00 just cause them to get a warning about overwriting a var

18:00 gfredericks: no but I'll get warnings from clojure.repl about dir already being defined and crap like that

18:02 hiredman: but, I mean, come on, how often do you really use dir?

18:02 gfredericks: a lot

18:03 technomancy: why not just use tab completion?

18:03 gfredericks: autocomplete in cider is super janky and I want to turn it off

18:03 technomancy: seriously, afaik everything in clojure.repl is obsoleted by cider

18:03 amalloy: technomancy: apropos

18:03 technomancy: not auto-complete, just regular completion

18:03 gfredericks: technomancy: I don't think that really applies

18:04 if I don't know the name of a function

18:04 technomancy: amalloy: huh... I didn't realize that got moved to clojure.repl, but touche

18:04 gfredericks: just what namespace it is in

18:04 technomancy: gfredericks: you can still use tab completion

18:04 alias/ TAB

18:04 gfredericks: on what basis does it figure that out?

18:04 oh crap that works

18:05 how does that work

18:05 technomancy: it's the same algorithm with "" as the input

18:05 amalloy: technomancy: not that i actually use apropos, or anything in clojure.repl. but whenever i say "just use emacs, bro" someone complains about apropos

18:05 it's fun to be on the other side for a change

18:05 technomancy: heh

18:06 time to add apropos it to cider I guess

18:06 gfredericks: just added debug-repl break! and unbreak! as well

18:06 amalloy: most of my programs could use an unbreak!

18:06 gfredericks: :P

18:06 technomancy: debug-repl *really* needs cider support

18:06 err

18:07 nrepl-discover support I mean =D

18:07 amalloy: so, i left (future (while true (swap! a inc))) running for about 20 hours. any guesses how high it's gotten?

18:07 gfredericks: you're talking about my debug-repl or some other identically named project?

18:07 technomancy: gfredericks: talking about the original debug-repl

18:07 arrdem: amalloy: I'm sure it hasn't overflowed ;P

18:07 gfredericks: alex-and-georges?

18:07 amalloy: oh, i actually used inc'

18:07 so it can't

18:07 technomancy: gfredericks: yeah

18:07 gfredericks: technomancy: I rewrote that as nrepl middleware

18:08 technomancy: oh right

18:08 anyway, not being able to M-x that and bind it to an emacs binding is sadface

18:08 gfredericks: I was trying to factor out an nrepl-mux functionality when I ran into nrepl boogs

18:09 someday gtrak will just fix them for me

18:09 amalloy: okay well you all failed to guess anything, so [spoiler]: 2851591830804

18:09 gfredericks: amalloy: also brazil just won 3-1

18:09 that's another way of counting things

18:10 technomancy: gfredericks: man, it feels kinda nice not to be the person referenced in that sentiment

18:10 gtrak: gfredericks: what did I do this time?

18:10 arrdem: aaaah I need to start watching the cup

18:10 technomancy: arrdem: a watched cup never boils

18:10 gfredericks: gtrak: declare your desire to git into the nrepl bug

18:10 gtrak: haha

18:10 amalloy: gfredericks: 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:10 gtrak: yea, I just wanted CLJS to work, look what happened

18:10 gfredericks: technomancy: man thank goodness gtrak wrote leiningen what would we do without him

18:11 gtrak: lol wut.

18:11 gfredericks: amalloy: those hordes of people aren't part of my mental model of the world

18:11 amalloy: it turns out they're pretty laid back anyway

18:12 gfredericks: hah

18:13 brehaut: huh apparently sportsball is on in my office and i hadnt even noticed

18:13 arrdem: "sportsball"

18:13 Dota is the only real sport besides CouterStrike amirite? :P

18:13 devn: Anyone want to hear a cool rant about LSD and Clojure? Here's the link...

18:13 ;)

18:14 arrdem: devn: -_-

18:14 devn: where's that lsd and systems programming article..

18:14 technomancy: best sportsball: https://en.wikipedia.org/wiki/FIRST_Robotics_Competition

18:14 devn: List comprehensions dude. So groovy.

18:14 arrdem: $google lsd unix systems programming 18:14 lazybot: [Famous quotations about the Unix operating system] http://www.linfo.org/q_unix.html 18:14 gtrak: I remember he came on the list initially and was like, 'hi guys, I'm going to do some cool things later' 18:15 technomancy: gtrak: whom? 18:15 devn: gtrak: it's cool. he's not being a jerk about it 18:15 gtrak: the LSD Clojure blog post. 18:15 allenj12: justin_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:15 gtrak: yea, he seems nice, it's just not good manners, maybe inadvertently. 18:16 devn: i mean, it could make for an interesting discussion 18:16 but not on a huge public ML 18:16 justin_smith: allenj12: I forget if / how much / hiccup caches. you could put a memoize around your hiccup function 18:16 or put varnish in front of your server with smart parameters on it 18:16 devn: "This one time..." :X 18:16 gtrak: honestly I hoped there would be more talk about neurochemical aspects of LSD and Clojure. 18:16 allenj12: justin_smith: varnish? 18:16 justin_smith: varnish is a universal caching layer you put in front of a web server 18:16 devn: gtrak: i think the "ugh, don't post this here" probably stopped any interesting conversation from happening 18:17 hiredman: I dunno that hiccup caches anything, but it does try to generate as much html at macro expansion time as it can 18:17 justin_smith: most clojure web servers should have at least nginx in front in production, and may benefit from having varnish in front too 18:17 devn: gtrak: there are some pretty interesting LSD programming experience reports i read a long while ago 18:17 amalloy: yeah, exactly what hiredman said. no caching, but clever pre-generation 18:18 gtrak: devn: I bet if you posted a thoughtful response it would blow over, I don't have much to say. 18:18 also I'm curious :-) 18:19 allenj12: justin_smith: hmm kk ill look more into that once im done with this, thanks dude 18:19 philandstuff: am I missing something or is there a reason that butlast isn't lazy? 18:19 devn: gtrak: i suppose this channel is logged and public 18:19 allenj12: justin_smith: ill also try to find out more about hiccup and letya know if i fond anything 18:19 devn: but again, im not so hot on chatting LSD in a public ML 18:19 gtrak: haha 18:20 arrdem: ^^ yeah.... why would you think this is a good idea... 18:20 amalloy: philandstuff: i'm not aware of any good reason; you can use (drop-last coll 1) if you want 18:20 justin_smith: "we would consider for this position, but according to the Internet you used LSD once" 18:20 devn: "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:20 arrdem: haha 18:20 gtrak: so, what we're saying is thoughtful responses are less likely than usual. 18:20 justin_smith: lol 18:21 (inc devn) 18:21 lazybot: ⇒ 19 18:21 devn: gtrak: lol i just think it's kind of a weird forum for it 18:22 can you imagine recruiters reaching out based on a healthy interest in psychedelics? 18:22 philandstuff: amalloy: oh awesome, thanks :) 18:23 (inc amalloy) 18:23 lazybot: ⇒ 127 18:23 devn: i 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:23 if you get what im layin' down 18:24 technomancy: clojurebot: are you experienced? 18:24 clojurebot: Excuse me? 18:24 philandstuff: amalloy: and drop-last defaults n to 1, so I can just do (drop-last coll) 18:24 arrdem: heh 18:24 philandstuff: ,(drop-last [1 2 3]) 18:24 devn: haha technomancy 18:24 clojurebot: (1 2) 18:24 arrdem: devn: well if they're youngish you get dogecoin, reddit and pineapples on everything. 18:24 cbp: clojurebot was offended 18:25 technomancy: sorry clojurebot; I didn't mean to pry 18:25 gtrak: devn: sounds 'innovative' 18:25 devn: yeah, a real "heady" crew 18:26 justin_smith: or just your typical Portland startup 18:26 shaun: hi, 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:27 umpa: is this an optimal loop recur? 18:28 ,(defn looper [x y] (loop [x1 x, y1 y] (if (< x1 5) (let [x1 x1](println x1) (recur (inc x1) y1))))) 18:28 clojurebot: #'sandbox/looper 18:28 umpa: ,(looper 1 1) 18:28 clojurebot: 1\n2\n3\n4\n 18:29 Bronsa: umpa: that let is useless and you never use y1 18:29 gtrak: umpa: you don't need to loop either, recur will hit the top of the fn. 18:29 umpa: Bronsa: how to do without let ? 18:30 justin_smith: umpa: the recur creates a new binding 18:30 you don't need let for that 18:30 Bronsa: umpa: (defn looper [x y] (when (< x 5) (println x) (recur (inc x) y))) 18:30 y is still useless though 18:31 justin_smith: Bronsa: I assumed it is a simplification of some code where y did something 18:31 Bronsa: justin_smith: you're probably right 18:31 umpa: justin_smith: is correct 18:45 shaun: Nevermind about the Om question, pending state is explained by the distinction between get-state and get-render-state 18:47 amalloy: incidentally, 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:49 Bronsa: amalloy: yeah I've always thought drop-last was really cool 18:50 justin_smith: amalloy: oh wow, that is really cool 18:51 amalloy: oh, 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:52 hiredman: amalloy: when nil punning went away 18:52 if become a macro that expanded to if*, and if would check for nil punning and warn 18:52 amalloy: hah, neat 18:52 hiredman: clojure: days of future past 18:55 amalloy: hiredman: in this context by nil punning you mean that empty seqs used to be falsey, right? 18:59 cbp: (inc drop-last) 18:59 lazybot: ⇒ 1 19:00 Bronsa: I wonder if there's a way to write drop-last without realizing the whole seq 19:01 justin_smith: Bronsa: well, drop-last is already lazy and you can't know where the end is until you hit it, right? 19:01 Bronsa: it would require a lazyseq type that was also counted 19:01 which sounds counterintuitive 19:02 justin_smith: but there are many cases where the seq should be lazy, but you know the max length at creation time 19:02 ie. 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:03 s/know/may know 19:03 Bronsa: right 19:03 the issue there is that some lazy functions would be able to preserve this info while others wouldn't, e.g. map vs filter 19:04 justin_smith: but in that case you still could know an upper bound 19:04 brehaut: Bronsa: i think that haskell achieves something like what you are talking about with its rewrite rules 19:04 Bronsa: that would be pretty useless justin_smith 19:05 justin_smith: for a drop-last, at least 19:06 justin_smith: right, but I can think of other situations where hypothetically knowing an upper bound would be useful 19:08 dbasch: justin_smith: more obvious case: (range some_big_number) 19:09 amalloy: counted lazy seqs are pretty hard to work with, but a counted reducer is somewhat viable 19:10 eg, in http://dev.clojure.org/jira/browse/CLJ-993 i include Counted for my Range reducer 19:10 justin_smith: dbasch: sure, but we often use lazy operators on vectors or even maps via seq 19:11 dbasch: justin_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:15 gfredericks: should I use auto-complete-mode in the repl buffer? 19:18 cbp: when I did that it would randomly create massive amounts of new lines which was pretty annoying 19:18 I've been told it's because of popup.el 19:18 company mode works fine though 19:21 mdeboard: hi, 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:21 gfredericks: clojure.test is the lightweightiest 19:21 mdeboard: I used midje a couple years ago with a cascalog thing but idk if that's still a good choice 19:21 amalloy: midje has never been lightweight 19:22 gfredericks: "midge is a lightweight set of maven coordinates to locate a heavyweight testing library" 19:22 mdeboard: gfredericks: Is tehre a caveat there or? 19:22 (wrt clojure.test) 19:22 gfredericks: mdeboard: 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:23 justin_smith: clojure.test is good. it is simple. 19:23 gfredericks: what occurs to you as missing from clojure.test? 19:23 mdeboard: Someone linked http://jayfields.com/expectations/ the other day 19:24 gfredericks: justin_smith: docstrings on tests 19:24 the order of args to is feels pretty backwards 19:24 dbasch: if I’d written that library, I would have called it Inquisition 19:25 mdeboard: Every time I see "Expectations" i think of old SNL skit, "Lowered Expectations" 19:25 justin_smith: gfredericks: that is what clojure.test/testing is for 19:25 gfredericks: fixtures can be a little weird 19:25 justin_smith: extra nesting just to add the docstring? 19:26 justin_smith: I like it because it nests and allows multiple descriptions in one test 19:26 amalloy: &(macroexpand '(clojure.test/are [x y] (let [y (+ x y)] (= y x)) 0 0)) 19:26 lazybot: ⇒ (do (clojure.test/is (let [0 (+ 0 0)] (= 0 0)))) 19:26 justin_smith: it's more than a docstring, it is also part of what prints on failure 19:27 gfredericks: justin_smith: yeah that's what I mean by docstring 19:28 hiredman: amalloy: there used to be no such thing as an empty seq, there was just nil 19:28 there was no lazy-seq macro, there was this lazy-cons thing 19:29 subtlety different 19:37 mdeboard: No let-binding with deftest ? 19:39 justin_smith: mdeboard: huh? I use let in deftest all the time 19:39 mdeboard: I see 19:40 justin_smith: another thing I do that may be more counterintuitive, is make a defn that calls test/is and run it inside a deftest 19:40 mdeboard: one o' them watchacall pebcak errors on my part 19:40 justin_smith: ahh 19:43 allenj12: can 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:43 woops 19:43 i ment here ? 19:43 yea 19:44 justin_smith: do you want  instead of ' ? 19:45 dbasch: you probably want to unquote page-name as well 19:45 justin_smith: also, if you leave [] out, then the caller of defpage can decide if and what arguments should be provided for a given page 19:45 allenj12: dbasch: i did but then it complains that page-name is not a symbol 19:46 mdeboard: I think clojure.test is plenty good for my needs atm 19:46 justin_smith: ~'page-name 19:46 clojurebot: Huh? 19:46 justin_smith: or maybe '~page-name 19:46 I forget now 19:46 allenj12: why would you quote it just to unquote it 19:47 Bronsa: ~'a 19:47 ,~'a 19:47 clojurebot: a 19:47 Bronsa: ,a 19:47 clojurebot: sandbox/a 19:47 dbasch: allenj12: actually, why is that even a macro? 19:47 justin_smith: because it is an argument, but it is an argument used as a symbol, not evaluated for avalue 19:47 because he wants to make a def for a certain symbol 19:47 Bronsa: justin_smith: with def actually there's no need for ~' 19:47 ,*ns* 19:47 clojurebot: #<Namespace sandbox> 19:48 Bronsa: ,(def sandbox/a 1) 19:48 clojurebot: #'sandbox/a 19:49 allenj12: so i tried '~page-name ~'page-name as well and same problem 19:50 page-name not a symbol for def 19:50 justin_smith: oh yeah, ~page-name actually works 19:51 my bad 19:51 dbasch: allenj12: btw, what is body? can you give a usage example? 19:51 justin_smith: (defmacro defpage [page-name & body] (def ~page-name (memoize (fn [] (html5 ~@body))))) 19:52 allenj12: its hicuup code 19:52 justin_smith: dbasch: idiomatically, it would be the body of a function, or some other (do ...) 19:52 allenj12: i know the problems 19:53 I used ' not  im a dumbass 19:53 lol 19:55 dbasch: with  and ~page-name it works fine for me 19:56 allenj12: dbasch: yea as i said before i accidentally used ' 19:57 dbasch: i feel dumb 19:57 dbasch: allenj12: that’s what macroexpand-1 is for :) 19:57 it tells you before other people tell you :P 19:57 justin_smith: allenj12: 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:58 allenj12: justin_smith: good idea, thanks? btw memoizing like that should work right? 19:58 justin_smith: in case you eventually want dynamic content of any sort 19:58 yeah, memoize makes a map from args to results 19:59 so a new arg means looking up a different result 19:59 just don't expect memoize to work with things that randomize their output or depend on things that are not args 20:00 so 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:00 allenj12: justin_smith: yea alright thanks! if i cant run this all the way through all try varnish like you mentioned 20:02 johnwalker: justin_smith: ordered my copy of jcip :) 20:02 allenj12: justin_smith: actually what if some of the pages i write are static, would i still benefit from memoize 20:04 justin_smith: absolutely 20:04 johnwalker: awesome 20:04 allenj12: 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:07 allenj12: justin_smith: awsome 20:14 nkozo: how 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:15 justin_smith: nkozo: you can use test selector metadata on your test definitions, and use lein test :foo to run only tests with metadata foo 20:15 nkozo: oh, this is someone else's codebase? hopefully they have defined selectors, or you could add them I guess 20:16 nkozo: mm, I don't see any selector, the tests are defined in a .cljx file 20:27 cpetzold: nkozo: so you want to run the clj tests and not the cljs ones? 20:27 nkozo: cpetzold: exactly 20:27 cpetzold: you can temporarily comment out this line: https://github.com/Prismatic/schema/blob/master/project.clj#L17 20:28 nkozo: cpetzold: oh, I see, thanks! 20:28 cpetzold: np :) 20:28 out of curiosity though, why don’t you want to run the cljs tests? 20:29 justin_smith: probably because of making changes to clj and not cljs and cljs takes a long time to run? 20:29 just a guess 20:30 nkozo: yes, an because I'm making some changes in the clj version temporary incompatible with the cljs one 20:32 boov: hi 20:32 where i can find young girls? 20:33 where i can find young girls? 20:34 which one holocaust was your favourite one? 20:38 TEttinger: yeah that'll work... 20:38 seems to be more trolls lately 20:39 mdeboard: russia 20:39 TEttinger: he was from poland 20:45 allenj12: is 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:49 bob2: as in reload your code? 20:49 allenj12: bob2: as in re compile the clojurescript file and re fresh local host 20:49 bob2: pretty much just restart everything 20:50 bob2: i remember a guy doing it with :alias and adding something to his script but i forget how 20:50 bob2: and using a light table connection 20:55 this is gonna drive me net 20:55 nuts 21:02 i remember he called the alias lein up 21:02 still cant find it tho 21:07 devn: how do you get "\space" from \space? 21:07 i cant brane good. i have the dums 21:08 brehaut: ,(str \space) 21:08 clojurebot: " " 21:08 brehaut: probably not 21:08 ,(pr \space) 21:08 clojurebot: \space 21:08 devn: doy, thanks dude 21:08 justin_smith: ,(pr-str \space) 21:08 clojurebot: "\\space" 21:09 justin_smith: pr-str is awesomesauce 21:09 devn: ,(with-out-str (pr \space)) 21:09 clojurebot: "\\space" 21:09 justin_smith: ,(pr-str \ ) 21:09 clojurebot: "\\space" 21:09 devn: oh weird, i swear i tried pr-str and it didn't work 21:10 allenj12: where is a good site to find out to set up leiningen to recompile clojurescript and to refresh localhost on save? 21:12 nDuff: allenj12, I'd suggest using figwheel for that. 21:14 devn: honestly, 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:14 allenj12: nDuff: awsome thank you :) 21:14 devn: but alas, we only have strs, syms, keys 21:14 justin_smith: no chars, it's an outrage 21:15 nDuff: (though, err, *grumble* re: asking for a link about doing X, as opposed to just "how do I do X?") 21:15 devn: why /dont/ we have :chars, :ints, etc.? 21:15 justin_smith: :ints would imply that the symbol '1 would not be bound to 1, which sounds evil to me 21:16 but yeah, :chars makes sense 21:16 ,(= '1 1) 21:16 clojurebot: true 21:16 nDuff: ...note that figwheel goes beyond just reloading the page completely from fresh, and actually tries to keep state across code revisions. :) 21:17 devn: justin_smith: yeah i can dig that 21:19 justin_smith: now I am remembering amalloy_'s evil reflection trick to change the value of one of the integers... 21:20 devn: haha, i was just thinking about that today 21:26 jack_rabbit: devn, what's the trick? 21:31 justin_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:31 clojurebot: nil 21:31 justin_smith: ,(range 10) 21:31 clojurebot: (0 1 2 3 4 ...) 21:31 justin_smith: ,(range 2 6) 21:31 clojurebot: (2 3 4 5) 21:32 justin_smith: hmm 21:32 ahh 21:32 that was the undo :) 21:32 ,(let [field (nth (.getDeclaredFields Long) 3)] (.setAccessible field true) (.set field 5 2)) 21:32 clojurebot: nil 21:32 justin_smith: ,(range 2 6) 21:32 clojurebot: (2 3 ...) 21:32 justin_smith: (inc 5) 21:32 lazybot: ⇒ 1 21:33 justin_smith: ,(inc 5) 21:33 clojurebot: 3 21:33 _ato: nice 21:33 johnwalker: ,(inc .4) 21:33 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .4 in this context, compiling:(NO_SOURCE_PATH:0:0)> 21:33 justin_smith: ,(+ 5 5) 21:33 clojurebot: 4 21:33 johnwalker: (def .4 4) 21:33 ,(def .4 4) 21:33 clojurebot: #'sandbox/.4 21:33 johnwalker: ,(inc .4) 21:33 clojurebot: 2 21:33 john2x: is there a similar emacs plugin for core.test like Midje's plugin? where I can do C-c , to run a fact? 21:33 justin_smith: ,(dec 5) 21:33 clojurebot: 1 21:34 johnwalker: ,(inc *1) 21:34 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.lang.Number>

21:35 johnwalker: john2x: use projectile with clojure-mode

21:35 oh, you want a particular test to run

21:35 justin_smith: johnwalker: because of the way clojurebot evaluates, *1 is usually not bound

21:36 johnwalker: justin_smith: was worth a shot :)

21:37 john2x: johnwalker: yes, e.g. run the test under the cursor

21:38 johnwalker: have you tried clojure-test-mode?

21:39 C-c M-, runs a deftest

21:40 justin_smith: one 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:41 ,(do (require '[clojure.test :as test]) (test/deftest f (test/testing "this fails" (test/is false))) (f))

21:41 clojurebot: \nFAIL in (f) (NO_SOURCE_FILE:0)\nthis fails\nexpected: false\n actual: false\n

21:42 justin_smith: "expected: false actual: false"

21:42 worst kind of failure

21:43 johnwalker: when i run it i just get nil

21:43 justin_smith: in clojure.test no output means success

21:43 you don't get the summary, since it is just one test

21:43 johnwalker: when the test breaks i also get nil

21:43 justin_smith: no printed output?

21:44 johnwalker: oh, i do get output

21:44 still weird though

21:44 justin_smith: all testing does is print, what else would it do?

21:45 johnwalker: i dunno, return :fail or :success

21:46 allenj12: figwheel is pretty picky lol

21:55 i 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:55 :output-dir "resources/public/js"

21:55 is my lein

21:59 justin_smith: and you have a resources/ directory I assume?

22:00 johnwalker: :x

22:02 allenj12: justin_smith: yea definatley

22:04 nDuff: allenj12, *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:05 allenj12: nDuff: its just the project.clj right? ill link it

22:06 nDuff: allenj12, ...well, that's not the _only_ thing that can matter. Would prefer a full reproducer, TBH.

22:07 allenj12: nDuff: wait would it matter i have no starting html file? there all being generated by hiccup right now

22:07 nDuff: buildings closing brb 10 min

22:12 gfredericks: cider-nrepl just started breaking with an unresolved var in clojure.tools.trace

22:14 cbp: well on the bright side, I'll make sure not to update for now

22:15 gfredericks: it's a snapshot you update all the time

22:15 justin_smith: someone should make one of those static sites "is-the-current-cider-broken.com"

22:15 cbp: oh crap youre right

22:15 * cbp panics

22:16 justin_smith: page will just be the word "yes", or maybe the word "no"

22:16 cbp: justin_smith: lol

22:17 justin_smith: backend would be a ring server, that periodically pulls from cider, and runs an emacs batch with some elisp that checks if stuff works

22:17 cbp: (inc justin_smith)

22:17 lazybot: ⇒ 49

22:18 justin_smith: http://isitraining.in/portland <- are these things still cool?

22:18 http://isitraininginportland.com/ <- less serious / lower effort version

22:19 allenj12: im back

22:20 gfredericks: I'm still here

22:22 allenj12: gfredericks: :)

22:23 nDuff: hey does it matter that my html files are being generated by hiccup and there are non actually saved

22:25 tvanhens: how do I refer to a directory using resources so it will be compatible with an uberjar?

22:26 gfredericks: clojure.io/resource

22:26 and the /resources directory in your project

22:26 tvanhens: I'm using resource and it works for lein run

22:26 but when I make an uberjar

22:26 tvanhens: it fails to run that task

22:27 gfredericks: tvanhens: how does it fail?

22:27 nullptr: justin_smith: useless!

22:27 justin_smith: what are you doing with the result of io/resource?

22:27 nullptr: lol

22:27 tvanhens: a common mistake is to call io/file or make a java.io.File out of the result of io/resource

22:27 this works if a resource is on disk, but not in a jar

22:27 tvanhens: using io/file to convert it into a file object and then using file-seq to get everything

22:28 justin_smith: (io/input-stream (io/resource "something")) works in both cases

22:28 you cannot use io/file on a jar resource

22:28 tvanhens: cool let me try that thanks justin

22:31 now I'm getting a file not found exception even in development

22:31 odd thing is the file it says is missing is there

22:31 the path its showing is right

22:31 TEttinger: justin_smith: is it raining? http://dl.dropboxusercontent.com/u/11914692/dogeweather/weather.html?place=portland

22:32 justin_smith: it was overcast all day, I saw no actual rain

22:33 but the "is cider broken" site should definitely do it doge style

22:33 TEttinger: my thing is kinda open source

22:33 it doesn't have a server side

22:33 justin_smith: oh, is that yours?

22:33 TEttinger: not really

22:34 dogeweather was credited to the people in the bottom right of the page

22:34 but it used php for no good reason

22:34 I refactored it to pure JS API calls and HTML

22:34 justin_smith: I like the var names http://dl.dropboxusercontent.com/u/11914692/dogeweather/js/jquery.dogeweather.js

22:34 nice job

22:35 tvanhens: justin_smith any common errors that lead to file not found when it exists where the uri it says it doesn't exist?

22:35 justin_smith: tvanhens: remember that inside a jar, it is not a file

22:35 it is a resource

22:35 devn: who has a sweet way to generate this sequence? '((2 3) (3 4 5) (4 5 6) (5 6 7) (6 7))

22:36 tvanhens: It stopped working outside the jar though

22:36 thats where I'm getting the error

22:36 justin_smith: tvanhens: are you asking for it relative to the resource (class) path?

22:36 ie. if it is resources/macros/sloth.gif you need to ask for (io/resource "macros/sloth.gif")

22:37 tvanhens: the folder is ./resources/db/schema from the project root I'm refering to it as db/schema in resource

22:37 justin_smith: oh, so what you want is a handle to the containing directory

22:37 I don't know if that is portable between resource and fs actually, I haven't tried it

22:38 tvanhens: ah interesting

22:38 cbp: devn: i don't get it

22:38 justin_smith: there should be some way to abstract over that

22:39 TEttinger: devn, the 2-element subseqs are odd

22:39 tvanhens: yeah really what I need is a way to get all the items within a "folder" in an uberjar

22:39 that also works in development

22:40 TEttinger: resources

22:40 there's a way to declare it in project.clj

22:41 xeqi: devn: looks like a constant, I'd just use it like that

22:41 devn: cbp: 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:41 cbp: devn: here's one way tho ##(map seq [[2 3] [3 4 5] [4 5 6] [5 6 7] [6 7]])

22:41 lazybot: ⇒ ((2 3) (3 4 5) (4 5 6) (5 6 7) (6 7))

22:41 tvanhens: TEttinger I'm using a resources directory. Problem is iterating over all the items in a folder in resources

22:42 Jaood: cbp: use the range man

22:42 TEttinger: ah.

22:42 devn: so 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:42 justin_smith: TEttinger: what he wants is to iterate the contents, inside a jar

22:42 oh, he just said that

22:42 devn: if you give me 2, then i want to give you (2-3)

22:42 if you give me 3, i can give you (2 3 4)

22:42 and so on

22:43 tvanhens: If theres a way to list all items in a directory in resources within a jar then I could figure out a workaround

22:43 devn: tvanhens: there is

22:43 err i havent been following along, but my understanding is that you can get at that stuff

22:44 i bet michaniskin knows the answer to this

22:44 * devn goes and looks at boot.core and boot.task

22:46 TEttinger: ##((fn [start end] (map (fn [item] (filter #(and (>= % start) (< % end)) [(dec item) item (inc item)])) (range start end))) 2 8)

22:46 lazybot: ⇒ ((2 3) (2 3 4) (3 4 5) (4 5 6) (5 6 7) (6 7))

22:46 michaniskin: tvanhens: devn: https://github.com/tailrecursion/boot.core/blob/master/src/tailrecursion/boot/deps.clj#L17-L21

22:47 :)

22:47 justin_smith: tvanhens: there is a .getProtocol method on java.net.URL

22:47 which is the class returned by io/resource

22:47 TEttinger: ##((fn [start end] (map (fn [item] (filter #(and (>= % start) (< % end)) [(dec item) item (inc item)])) (range start end))) 5 15)

22:47 lazybot: ⇒ ((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:47 justin_smith: tvanhens: 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:48 devn: michaniskin: nice!

22:48 michaniskin to the rescue

22:48 tvanhens: michaniskin giving that a go thanks

22:48 michaniskin: it's expecting a JarFile object there

22:48 TEttinger: (inc michaniskin)

22:48 lazybot: ⇒ 1

22:49 TEttinger: devn, what was that non-violating-bounds fn work?

22:49 *does that

22:50 devn: TEttinger: oh, i missed that

22:50 let me try that out

22:50 justin_smith: tvanhens: 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:51 TEttinger: devn, that's with ## as the equivalent to , for lazybot instead of clojurebot btw

22:51 devn: TEttinger: like a charm

22:51 thanks dude

22:51 i feel like there's /got to be a better way!/ *pounds fist*

22:51 justin_smith: I 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:52 devn: a modified partition would be nice

22:52 tvanhens: I guess slightly higher level question: is storing the schemas for my db in a jar not the best idea in the world?

22:52 devn: version coupling

22:52 justin_smith: tvanhens: with caribou we get the schemas for the db from the db

22:53 at boot

22:53 we kind of reify things though to make the sql db be more "homoiconic" I guess

22:53 tvanhens: interesting

22:53 justin_smith: and more clearly self describing

22:54 so we have a table called model, and another called field

22:54 and each row in model has many fields

22:54 etc.

22:54 devn: TEttinger: maybe a reduce would be simpler?

22:55 michaniskin: anyone here familiar with sonatype aether?

22:57 justin_smith: ,((fn [input] (concat [(take 2 input)] (partition 3 1 input) [(take-last 2 input)])) (range 5 15)) devn

22:57 clojurebot: eval service is offline

22:57 justin_smith: &((fn [input] (concat [(take 2 input)] (partition 3 1 input) [(take-last 2 input)])) (range 5 15)) ; devn

22:57 lazybot: ⇒ ((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:57 justin_smith: michaniskin: I know alembic.still is much easier to use

22:58 devn: justin_smith: yeahhhh, im being picky and should just move on

22:58 michaniskin: justin_smith: what i want is to get a list of jars on the classpath, sorted in dependency order

22:58 justin_smith: alembic uses pomegranate, no?

22:58 justin_smith: I think so, yeah

22:59 TEttinger: I love how good #clojure is at shaving yaks on these kinds of problems

22:59 (inc justin_smith)

22:59 lazybot: ⇒ 50

22:59 michaniskin: for 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:59 justin_smith: michaniskin: I think some of the abstractions here may help you actually https://github.com/pallet/alembic/blob/develop/src/alembic/still.clj

23:00 michaniskin: the aether/resolve-dependencies function doesn't provide a true dependency graph

23:00 justin_smith: oh, and that is what alembic is using, yeah

23:00 well they wrap it - what is wrong with aether/resolve-dependencies?

23:01 michaniskin: justin_smith: aether/resolve-dependencies returns the information you'd want for something like lein deps :tree`

23:01 deps :tree doesn't give you a true deps graph, it elides info you're not interested in when you're debugging deps issues

23:02 xeqi: michaniskin: you're looking for something more then https://github.com/cemerick/pomegranate/blob/master/src/main/clojure/cemerick/pomegranate/aether.clj#L790 ?

23:02 michaniskin: xeqi: 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:03 xeqi: "true dep graph" ?

23:03 justin_smith: michaniskin: what about going through all the deps, loading the pom.xml for each, and doing your own graph calculation then?

23:03 michaniskin: for 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:03 xeqi: ah, right

23:04 michaniskin: so yes, i could bring in xml parsers and everything

23:04 justin_smith: I hope that's not what you need to do

23:04 michaniskin: but it seems unlikely that there's no way to just do it via aether

23:04 xeqi: I ended up needing that info in pedantic... let me find where it was

23:04 michaniskin: currently i gave up and just do aether/resolve-dependencies individually for each dep

23:05 and then i do the topo sorting

23:11 xeqi: ugh, its been so long since I've delved into the aether area

23:13 michaniskin: xeqi: https://github.com/xeqi/pedantic/blob/master/src/pedantic/core.clj#L81 that guy looks promising

23:13 xeqi: my recollection is you have to inject a DependencyGraphTransformer that will gather the info you want and then "return" it through an atom

23:13 michaniskin: perhaps the :ignored ones are the deps i'm looking for?

23:13 xeqi: and it looks like http://wiki.eclipse.org/Aether/Transitive_Dependency_Resolution says a similar thing

23:13 michaniskin: the ones that are hidden by resolve-dependencies?

23:14 xeqi: :ignored would be a dep w/ a version that wasn't choosen, so yes

23:15 though I wrote this stuff >1year ago, so don't take it as gospel

23:15 michaniskin: whew! this is hopeful :)

23:15 my current project has a ton of dependencies, and it's taking forever to do it my naive way

23:16 johnwalker: devn: what is this cloclogo you're working on?

23:16 is this for core.typed?

23:16 xeqi: your naive way was the same way my proof of concept code for lein-pedantic worked, before I actually dove into aether's api

23:17 which was mostly undocumented around this stuff :p

23:19 michaniskin: xeqi: where does the session come from?

23:19 xeqi: in the use-transformer function

23:20 xeqi: michaniskin: 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:21 michaniskin: xeqi: dude thank you. i owe you a beer at the next conj!

23:22 tvanhens: is there a way to use globbing with io/resource?

23:23 xeqi: michaniskin: 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:23 though I'm getting more confident this is the right area as I stare at it

23:24 tvanhens: that takes a pattern and path both strings, and boolean result

23:24 it has an unfortunate dependency on Ant, but it works with < java7

23:25 justin_smith: tvanhens: what about creating a compile time task that records the resources that should be loaded, based on the directory contents?

23:25 michaniskin: in java7 there is nio stuff to do glob matching on Path objects

23:25 justin_smith: michaniskin: you can get a Path from a jar resource? that's cool

23:26 michaniskin: justin_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:26 justin_smith: michaniskin: wait, javadoc for path makes it look filesystem specific

23:26 ahh, based on a list of resources for example

23:26 michaniskin: justin_smith: you could do (.getPath (io/file "foo/bar")) and the file doesn't need to exist

23:26 justin_smith: right, then you can use path matching

23:27 michaniskin: xeqi: thanks, i've been at this for a while now, i feel like this may be the breakthrough lol

23:27 tvanhens: oy this bit is ending up a lot more complicated than I thought it would be

23:28 xeqi: michaniskin: what are you building?

23:29 michaniskin: xeqi: i'm overhauling boot: https://github.com/tailrecursion/boot-ng

23:29 xeqi: i have "pods" working now (not fully tested though, so ...)

23:29 pods are a way to dynamically start a child boot session in a segregated classloader

23:30 from within boot itself, so a task can do its actual work in the pod

23:30 basically 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:31 but the build process itself (which has no deps of its own) runs in your project

23:31 allenj12: is domina still used?

23:31 seems a while since it was updated

23:31 Jaood: allenj12: looks like react wrappers took oever

23:32 michaniskin: allenj12: how was your hoploning?

23:32 Jaood: *over

23:34 justin_smith: ,(.getPathMatcher (java.nio.file.FileSystems/getDefault) "glob:*.clj")

23:34 clojurebot: #<CompilerException java.lang.ClassNotFoundException: java.nio.file.FileSystems, compiling:(NO_SOURCE_PATH:0:0)>

23:34 justin_smith: &(.getPathMatcher (java.nio.file.FileSystems/getDefault) "glob:*.clj")

23:34 lazybot: java.lang.ClassNotFoundException: java.nio.file.FileSystems

23:34 allenj12: Jaood: so like om then

23:35 justin_smith: old jvms :(

23:35 allenj12: michaniskin: hehe pretty great so far :) although only have done a little since we last talked

23:36 michaniskin: right now im playing with a couple things

23:36 justin_smith: michaniskin: that looks really cool!

23:36 (the boot project that is)

23:36 michaniskin: justin_smith: the actual production version is here: https://github.com/tailrecursion/boot

23:37 it works, you can try it out!

23:37 justin_smith: very nice

23:37 Jaood: I though everyone here was against running clojure script

23:37 allenj12: why?

23:37 clojurebot: why not?

23:37 Jaood: clojurebot: why yes?

23:37 clojurebot: Cool story bro.

23:38 Jaood: clojurebot: thanks

23:38 clojurebot: the best way to thank your friendly #clojure resident is with (inc nick)

23:38 Jaood: (inc clojurebot)

23:38 lazybot: ⇒ 40

23:38 justin_smith: haha

23:38 \$karma lazybot

23:38 lazybot: lazybot has karma 26.

23:38 michaniskin: justin_smith: you can do cool things like this: https://github.com/tailrecursion/hoplon-demos/blob/master/google-maps/build.boot

23:38 justin_smith: man, clojurebot is totally winning

23:38 michaniskin: that's the build script for a hoplon web app thing

23:39 justin_smith: nice

23:39 Jaood: michaniskin: is boot meant to be use with external dependecies too?

23:39 michaniskin: Jaood: boot is a build tool, like leiningen

23:40 you can use it to pull in external dependencies

23:40 (set-env! :dependencies '[[foo/bar "0.1.0"]])

23:40 Jaood: michaniskin: oh, the was reading just the first about running clojure scripts

23:40 *part

23:41 with the shebang

23:41 michaniskin: yeah i mean in lisp, all you need for a build tool is a way to run lisp code and bring in dependencies

23:41 all the build stuff is just functions you can call

23:41 xeqi: michaniskin: ah, I thought about trying to do some similar container type things with lein and how it handles tool/project seperation

23:41 ended up postponing it due to native deps and possibly something else

23:42 michaniskin: xeqi: it's tricky. i currently have things talking to each other through sockets and evaling things in repls lol

23:42 xeqi: i'm not really concerned with native deps i guess

23:43 xeqi: sockets and evaling? I was leaning towards using classlojure and eval-in-classloader

23:43 ah right

23:43 clojure's namespaces are global

23:43 michaniskin: xeqi: i started with that route

23:43 xeqi: *namespace list

23:44 michaniskin: but i found that things leaked between sibling classloaders

23:44 and there was no way to communicate upward in the tree without sockets

23:44 Jaood: nice how all the hoplon demos have a a view live option

23:44 xeqi: so that made sharing objects between classloaders couldn't keep diffent loaded namespaces seperate

23:44 michaniskin: like with classlojure the child can't pass messages up to the parent

23:45 xeqi: yep, just returning

23:45 hellofunk: re

23:45 michaniskin: so now i have a master process that starts many children who communicate with each other via sockets and repls

23:46 Jaood: michaniskin: is hoplon planning on using react?

23:46 michaniskin: Jaood: it's compatible with react, meaning you can embed react in there if you want

23:47 but there hasn't been a need so far

23:47 in my work anyway

23:47 far more useful to me has been being able to use jquery plugins and things like that

23:48 Jaood: the dom diffing, virtual dom, and dirty checking isn't necessary with hoplon because of the javelin cells thing

23:49 cells are evaluated in a dependency graph, which is the alternative to dirty checking

23:51 Jaood: michaniskin: I see, gonna read on the javelin stuff to understand that approach

23:52 michaniskin: Jaood: https://github.com/tailrecursion/javelin

Logging service provided by n01se.net