#clojure log - May 27 2014

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

0:01 tolstoy: Frozenlock: I wonder if that info is in one of the dot files in the project root?

0:02 Frozenlock: I'm gonna go with 'no'

0:02 Unless it's hidden in .nrepl-port :-p

0:02 tolstoy: There is, I think.

0:03 -U

0:03 See bottom of this page: https://github.com/technomancy/leiningen/blob/master/src/leiningen/deps.clj

0:03 Or, "lein help deps".

0:04 Frozenlock: That might just do it! Thanks!

0:04 tolstoy: No prob. :) I had no idea myself.

0:31 hellofunk: If anyone uses Om, I’m curious the advantage to building a separate component for each <li> rather than just a single component for the entire parent <ul>.

0:41 ddellacosta: hellofunk: it entirely depends on your data model

0:41 hellofunk: it can make sense if you have a data model where the individual li elements get added to or removed from frequently

0:41 hellofunk: Is a component basically something that will be treatedly individually in the React virtual DOM ?

0:42 ddellacosta: hellofunk: yes, as far as Om it may be re-rendered or not based on referential equality checks

0:42 hellofunk: Is see, so the advantage of having a separate component for each <li> would be if one were to change and the others not, then the entire <ul> would not be re-rendered, only that specific <li>

0:43 ddellacosta: hellofunk: yep.

0:43 hellofunk: Is Om basically relying on React for this logic, or is Om also doing its own virtual checks

0:44 ddellacosta: hellofunk: well, Om has its own check in place for shouldComponentUpdate so that it can take advantage of immutability to do the checks. Take a look here: http://www.infoq.com/news/2014/01/om-react

0:45 hellofunk: ddellacosta thanks I shall read now

0:45 ddellacosta: hellofunk: sure thing.

0:46 hellofunk: and actually the relevant code is quite simple: https://github.com/swannodette/om/blob/master/src/om/core.cljs#L225-L249

0:48 hellofunk: ddellacosta what is that “this-as” function? It’s not in core or defined elsewhereon that page

0:49 ddellacosta: hellofunk: ah, that's for referring to the javascript "this"

0:50 * ddellacosta searches for reference

0:50 ddellacosta: hellofunk: meh, having a hard time finding a reference to that

0:51 hellofunk: no problem ddellacosta, just hadn’t seen that before

0:51 ddellacosta: hellofunk: it's mentioned here, but not described: http://himera.herokuapp.com/index.html

0:51 amalloy: hellofunk: (this-as x (foo x)) is like (foo js/this), if js/this were a real thing

0:51 ddellacosta: hellofunk: yeah, once you see it in the code I suppose it's easy to figure out how it works

0:51 hellofunk: i’m not a JS expert by any means, so hopefully that will not be a hinderance when using Om

0:51 ddellacosta: hellofunk: oh, I don't think so, but obviously you'll hit some JS-specific stuff here and there that you'll have to learn

0:52 amalloy: thanks

0:52 beamso: is it worth using om/react for rendering tables?

0:53 ddellacosta: beamso: yes? depends? need more context to answer that

0:53 Jaood: what is not worth is using cljs without react :P

0:53 ddellacosta: Jaood: I definitely disagree, but I think React certainly adds a lot of value.

0:54 amalloy: actually i'm now curious why js/this isn't a real thing. my guess is that if it were, you'd get into just as much of a mess using it as you do in javascript

0:55 so you're forced to use this-as instead

0:56 Jaood: ddellacosta: I don't know, looks like there aren't many appealing features of using cljs directly on the dom

0:56 hellofunk: amalloy do you mean that having to the “this-as” macro explicitly will encourage you to not use the js native “this” so much?

0:56 ddellacosta: amalloy: good point. Seems like a reasonable theory...minimizing the use of "this" is a good idea in CLJS, methinks.

0:56 amalloy: well, i mean it will encourage you to not give it the same name everywhere, so you can sort out which this you're talking about

0:58 ddellacosta: Jaood: I think using ClojureScript is a tremendous win over using JavaScript, regardless of whether you are interacting with the DOM or not.

0:58 hellofunk: so js/* is not a direct map to all of what is in JS, then? I guess I thought typing js/ was just opening a window to native JS land. But you suggest that it has been curated to only allow some native JS through, which I didn’t realize. If I understand you correctly amalloy

0:58 amalloy: that is, i presume that (fn [x] (this-as t1 (.foo x (fn [] (this-as t2 [t1 t2]))))) doesn't just expand to "this" twice, but to capturing two different this's at appropriate scopes

0:59 *shrug* i dunno, i don't write any js

0:59 er, cljs

0:59 ddellacosta: hellofunk: nope, there are very specific js interop functions and special forms in ClojureScript, it's not one-to-one like that.

0:59 amalloy: but obviously js/foo can't map to *all* js constructs, like you can't write js expressions in there as js/"1 + 2"

0:59 Jaood: ddellacosta: isn't to much work to write idiomatic cljs in such a stateful world like the dom?

0:59 ddellacosta: hellofunk: unfortunately I don't know of any good docs for that other than the code itself. Really need something better than this: http://himera.herokuapp.com/synonym.html

1:00 Jaood: it's easier than writing stateful JavaScript

1:02 amalloy, hellofunk: ha, I guess it wraps "js* this" under the covers...interesting: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L651

1:02 amalloy: js* is the real magic

1:02 ddellacosta: right

1:03 interesting...

1:03 amalloy: my understanding is that js* appears to allow you to write arbitrary javascript, but if you try to use it yourself you'll be surprised

1:03 Jaood: ddellacosta: ok, I´ll going with it, I guess reacts makes thing much nicer anyway

1:03 amalloy: you're certainly never supposed to use it

1:03 Jaood: *keep

1:04 ddellacosta: Jaood: sure, I definitely agree wholeheartedly with that.

1:04 hellofunk: amalloy curious, where is js* defined? not in that source ddellacosta linked

1:07 ddellacosta: hellofunk: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L1276

1:08 hellofunk: it looks like it gets processed in the analyze phase

1:08 which makes sense

1:10 hellofunk: if I may ask a dumb question, looking at core.clj there, there is no require for cljs.analyzer, yet it can alias it. aren’t you supposed to require a ns before you can access it, or alias it?

1:13 ddellacosta: hellofunk: in Clojure at least I know you can refer to stuff using the full namespace without require/use'ing it. I'm not sure about the mechanisms involved, so maybe someone more knowledgeable about it than I can give more background, I just know it does work.

1:14 hellofunk: ddellacosta oh ok, I thought a source file could not know about another namespace unless it explicitly referred/required/used it

1:14 perhaps if you are not going to alias or refer any functions, then using require is just a convention to make the source more readable?

1:15 ddellacosta: hellofunk: yeah, again, I suspect that there is some kind of dynamic dependency resolution going on there for namespaces which are fully qualified. Makes sense on some level, but again, I don't know the nitty-gritty well so I can't comment on it past my own experience.

1:39 hellofunk: In Om, I’m trying to understand the difference between emitting an om/component from the om/root fn vs just emitting the contents of the om/component, such as a dom/ul. If you don’t use om/component macro, then technically what you return is not a component and just goes straight to the DOM with no virtual checks?

1:39 i.e. (om/component (dom/ul …. )) vs just (dom/ul….)

1:41 kelseygi: hi—in scala we have a call Future.successful{some-expression} that evaluates the expression in the current thread rather than spawning a new one. is there something similar in clojure? i need to pass a future into something in a test and i don’t need it to actually run in another thread

1:44 dissipate: kelseygi, if it evaluates in the current thread, it will take control of the current thread, no?

1:44 kelseygi: that’s totally fine—i just need to wrap something in a future for test purposes

1:44 cause the method derefs it like it’s a future

1:44 a dummy future basically

1:46 dissipate: kelseygi, sounds like you want a promise, not a future

1:46 kelseygi: so i’d need to do ((promise a) (deliver a whatever))?

1:46 :\

1:47 dissipate: kelseygi, yep, then pass the promise to the other function to be derefed

1:47 kelseygi: ok was hoping there was a one liner/method i could call

1:47 thanks

1:48 omg i could write a macro huh

1:48 wait would that be a good place to do that?

1:49 i guess that’s just a func

1:49 dissipate: kelseygi, why not just pass a ref of the result though?

1:50 if the other function just derefs, you can just create a ref of the result and pass that

1:50 beamso: anyone used cljs-ajax? i'm getting some weird json parsing issues.

1:51 dissipate: kelseygi, it's considered bad style to write a macro where a function would do. usually you don't need a macro.

1:51 kelseygi: yeah i’m trying to figure out what you do need macros for

1:51 dissipate cause i didn’t know you could pass a ref of something?

1:51 that’s what i was trying to ask...

1:52 ref is exactly what i was looking for, thank you again

1:53 dissipate: kelseygi, this SO post has info on what macros are used for: http://stackoverflow.com/questions/7593931/how-do-clojure-programmers-use-macros

1:54 kelseygi: wonderful, thanks!

1:54 dissipate: kelseygi, the problem is that macros don't play as well with functions and vice versa, so it's better to keep macros to a minimum.

1:55 kelseygi, just as an example, i found out the other day you can't use macros with the 'apply' function. you have to wrap the macro in a function in order to do so.

1:57 amalloy: kelseygi: the simplest dereffable thing is just a delay

1:57 @(delay 5) => 5

1:59 kelseygi: ok, that’s preferable to @(ref 5) because ref carries around history & stuff?

2:00 _eric: what would be the best way to remove the values in one vector from another one?

2:01 dissipate: kelseygi, sounds like 'delay' is what you want

2:02 kelseygi: yeah agreed, although any of them (including future) do work…feel like i’m in the wild west without a static type system :)

2:03 also dissipate now i’m in a rabbit hole about whether macros compose so thanks for that :P

2:03 hellofunk: ddellacosta from my readings it seems that both om.core/component and om.core/build are used to created components. The source for them is quite different. Is there a difference between “generating” a component vs “building” a component?

2:03 dissipate: _eric, are duplicates allowed in the vectors?

2:04 _eric: dissipate: no

2:04 dbasch: _eric: one way woud be (distinct (concat v1 v2))

2:05 ddellacosta: hellofunk: component and build are doing different things. Component creates a simple component that does nothing other than create a reified instance of IRender

2:05 dissipate: _eric, then you could convert each vector into a set and use the 'difference' function

2:05 http://clojuredocs.org/clojure_core/clojure.set/difference

2:05 dbasch: dissipate: but that might break the order, if that’s important

2:05 dissipate: dbasch, that's true

2:06 _eric, does order matter?

2:06 rhg135: (remove (set v2) v1)

2:07 ddellacosta: hellofunk: build takes a component and data structure as an argument and...builds the component

2:07 _eric: hmmm, it would be nice to preserve order

2:07 hellofunk: ddellacosta what does it mean to actually “build” a component vs generate one; why return just a component vs a build from the function passed as the first arg to om/root?

2:08 dissipate: _eric, then dbasch's solution is better

2:09 _eric: hmmm

2:09 using (distinct)?

2:09 dbasch: rhg135: that removes not just the duplicates but the elements themselves

2:09 ddellacosta: hellofunk: just building a component doesn't register that as a React component; you need build to do that.

2:09 _eric: I'm trying to remove elements. I don't see how (concat) would do what I want

2:09 ddellacosta: hellofunk: so it's not part of the app render cycle until you build it (or pass it into root)

2:10 rhg135: Oh ic, misread

2:10 hellofunk: oh i see, so I am getting confused in the difference between an “om component” and a “react component” — the term “component” can mean either depending on what you are reading.

2:10 ddellacosta ^

2:10 dbasch: ,(distinct (concat [1 2 3 4] [2 3 5 6])) ;; _eric

2:10 clojurebot: (1 2 3 4 5 ...)

2:11 dbasch: ,(distinct (concat [1 2 3] [3 5 6]))

2:11 clojurebot: (1 2 3 5 6)

2:11 _eric: I'm looking for [2 3 5 6] to be removed

2:11 dissipate: _eric, concat will produce a lazy seq of both vectors concatenated. then, distinct removes the duplicates and produces another lazy seq.

2:11 _eric: in that first case

2:11 dbasch: in that case, what rhg135 said

2:12 rhg135: I was right :D

2:12 dbasch: ,(remove (set [2 3 5 6] ) [1 2 3 4])

2:12 clojurebot: (1 4)

2:12 _eric: okay

2:13 ddellacosta: hellofunk: well, there is a little bit of a translation layer is all. Basically, when you pass in a component it gets passed into React, with an implementation wrapper (so to speak: pure-methods). That implementation checks which lifecycle protocols you've implemented and calls them if they exist, or does a default action (maybe nothing, depending on the protocol) if not.

2:14 kelseygi: (realized? (delay 5)) => false :\

2:14 ddellacosta: hellofunk: to clarify: *when you pass in a component to build/root (which just calls build)

2:14 dissipate: yep, rhg135's solution looks good

2:14 hellofunk: ddellacost ok, i was able to build stuff that presented on the page but never used build or build-all so I guess this means they were not part of React, just living alone inside Om, right?

2:14 ddellacosta ^

2:14 dissipate: kelseygi, it's not realized because it was not derefed

2:14 kelseygi: yeah i know, but i need it to be

2:15 ddellacosta: hellofunk: not knowing exactly what you're talking about it's hard to say, but presumably if you generated a component and didn't pass it to build or root, it wouldn't get displayed.

2:15 dissipate: kelseygi, i thought you said it was derefed in the function you pass it into?

2:15 kelseygi: it checks if it’s realized first...

2:15 dissipate: kelseygi, then just deref it before it is passed in

2:16 kelseygi: yeah, it’s just clunky as hell

2:17 amalloy: i mean, checking whether a future is realized should probably not be part of something you're testing. no async process is ever guaranteed to be done by the time you want it

2:17 dissipate: kelseygi, your use case is strange.

2:17 kelseygi: is it? i’m testing a function that takes a core.async response object

2:17 which has a future for the status

2:17 amalloy: and if you only want to work with things that are already realized, don't pass the future at all, just pass a value

2:18 kelseygi: i essentially need a dummy 200 response

2:18 dissipate: i agree with amalloy, doesn't make sense.

2:19 kelseygi: https://github.com/mccraigmccraig/twitter-streaming-client/blob/master/src/twitter_streaming_client/impl.clj#L158-L159

2:19 dissipate: kelseygi, it sounds like the function you are passing into should be checking if the value passed in is a 'ref' or not

2:19 kelseygi: that’s the function i’m testing

2:19 i want that check to pass

2:20 should that be doing something different? i am changing something in that function (hence why i’m testing it) but i wasn’t planning on changing that

2:21 dissipate: kelseygi, looks like a bug to me

2:22 kelseygi: ok, what’s the bug?

2:23 dissipate: kelseygi, the only way the 'and' passes is if the promise/delay is realized and then tries to deref it within the same 'and'. makes no sense. if the promise/delay is not realized, the test fails, if it is realized, it might as well just be a value.

2:24 hellofunk: ddellacosta here is a simple example i’m scrutinizing: https://www.refheap.com/85955

2:24 kelseygi: i assume it’s to keep the program from blocking indefinitely if the promise isn’t realized?

2:25 i dunno, i didn’t write this, just trying to make this library work

2:26 also, how does that not make sense? and is evaluated lazily, isn’t it? so it won’t try to deref it if it’s not realized?

2:27 ddellacosta: hellofunk: ah, yeah, I've seen that kind of thing before. I assume that since build just tries to wrap it in the pure-methods implementation, and since it is a React.DOM element, it must just get rendered by React somehow.

2:28 hellofunk: ddellacosta do you think there is a difference between using om/component or not here?

2:29 dissipate: kelseygi, think about it logically. if it is not realized, the test fails. that means that it should just be a value. the function shouldn't be concerned with something blocking, that's up to the calling function to deal with.

2:29 kelseygi: it’s calling another library

2:29 well that’s a bit of a weird way to put it but it’s a callback being passed to another library i believe

2:29 so it doesn’t have control over what’s passed in

2:30 anyway i’mma pull out the part that deals with the body to test that as a separate function

2:31 dissipate: kelseygi, if it must be a promise/future, just use 'delay' and deref immediately.

2:31 ddellacosta: hellofunk: I honestly don't know the answer to that--presumably React is doing the work of rendering it, since it just gets passed into React as is. And otherwise it seems like it would still just work as a normal component works within the render cycle. Of course, it means that you don't have a function there, but a low-level React DOM element, so you can't really do anything with it like you can with a compon

2:31 ent

2:32 hellofunk: the obvious thing you lose is any kind of composability of functions, which you get when you use components, even just om/component.

2:33 hellofunk: ok, maybe i’m spending too much time trying to understand the low-level stuff ddellacosta

2:33 ddellacosta: hellofunk: no, this is great. I'm learning stuff too trying to answer your questions.

2:33 hellofunk: I definitely don't think this is a waste. It's good to read through the code and really try to understand it.

2:34 beamso: ddellacosta: do you use a library for ajax with om?

2:34 hellofunk: ddellacosta, ok i’m working on another example snippet using build-all, i’ll share in a bit.

2:34 ddellacosta: hellofunk: sounds good.

2:37 beamso: sorry, missed your question. I use domina, but it's mostly for historical reasons. I'd use dommy now if I had a choice.

2:38 beamso: i mean for xmlhttprequests, not for dom manipulation

2:39 i'm having some weird issue with cljs-ajax where the response handler is being called with nil

2:39 ddellacosta: beamso: oh, sorry, thoughtlessly misread

2:40 beamso: all good

2:40 ddellacosta: beamso: I am using shoreleave now, but it seems like it's dead or dying, development-wise

2:40 beamso: I might consider https://github.com/JulianBirch/cljs-ajax now

2:40 beamso: yeah, that's the one i'm currently trying.

2:41 ddellacosta: beamso: hmm, don't know what is up with your problem I'm afraid

2:41 if you give me a snippet I'm happy to take a look though

2:43 beamso: i'm attempting to use something like https://www.refheap.com/85959

2:45 ddellacosta: beamso: I see. And response in your :handler fn gives you nil?

2:46 beamso: yeah

2:46 ddellacosta: beamso: are you seing that print out at all, or does it print out with "response == nil" ?

2:46 *seeing

2:47 beamso: response == ''

2:48 ddellacosta: beamso: btw, I might suggest putting this in IWillMount and setting the result in state via a channel in your handler, since you can't depend on this getting called in a synchronous fashion in init-state

2:49 beamso: as far as your specific problem with the response, I don't have any simple answers, but I would suggest starting with the simplest get call possible and ensuring you are getting data back from the server at all

2:49 (ajax/GET "/customers" {:hander #(println %)})

2:51 beamso: along those lines, are you sure there is data coming back from the server? Don't mean to second guess you, but that is often a problem, I've found.

2:51 beamso: data is coming back from the server

2:51 ddellacosta: k

2:51 beamso: i've checked that the response header is application/json

2:51 because it's an array i also tried chucking the array into a map

2:53 i did change to use that IWillMount protocol as well. it's getting called after init-state and before render.

2:54 whilo: ,(type {})

2:54 clojurebot: clojure.lang.PersistentArrayMap

2:54 ddellacosta: beamso: yeah I dunno, I'm sorry. :-( I would probably do the same as you at this point, and just try debugging stuff until I tracked down where the data is getting lost

2:55 beamso: but reading the code for cljs-ajax it seems pretty clear.

2:55 whilo: in cljs this returns: cljs.core/PersistentArrayMap

2:55 is there a reason why one is with . and the other with /?

2:55 ddellacosta: beamso: this is interesting though: https://github.com/JulianBirch/cljs-ajax/blob/master/src/ajax/core.cljs#L167

2:56 whilo: type does not return the same value for the same type (speaking of records for instance)

2:57 ddellacosta: whilo: probably because in Clojure PersistentArrayMap is a Java class, while in ClojureScript it is a type.

2:58 whilo: ddellacosta: same for defrecord objects

2:58 ddellacosta: whilo: sorry, not sure what your last comment meant

2:59 whilo: ,(defprotocol IFoo (-foo [this]))

2:59 clojurebot: IFoo

2:59 whilo: ,(defrecord Bar [name] IFoo (-foo [this] name))

2:59 clojurebot: sandbox.Bar

2:59 whilo: ,(type (Bar. "hello"))

2:59 clojurebot: sandbox.Bar

3:00 whilo: in cljs it is sandbox/Bar

3:00 ddellacosta: whilo: yeah, you got me, I dunno

3:01 hellofunk: ddellacosta here is a slight addition to the example: https://www.refheap.com/85955

3:02 whilo: ddellacosta: me neither. i am hashing this, so i'd prefer consistent behaviour. this is why i recognized it

3:05 ddellacosta: hellofunk: I think the main point remains that you can't use any of the stuff that Om gives you--overriding lifecycle protocols, using set-state!/transact! etc. It's kind of pointless to use Om without the tools it gives you, even if technically you can just pass in low-level DOM elements to build

3:08 hellofunk: ddellacosta so essentially all of Om’s power comes to elements that are explicitly built via “build” or “build-all” is what you are saying

3:09 ddellacosta: hellofunk: I suppose you could say that, sure

3:09 hellofunk: otherwise, you are ignoring 90% of the API that the lib provides

3:11 hellofunk: ddellacosta what is your IDE of choice when working in CLJS and Om?

3:11 ddellacosta: hellofunk: to put it another way: Om becomes a really compelling library for building UIs when you start taking advantage of all the flexibility the protocol functions give you

3:12 hellofunk: I have used emacs forever...I'm stuck in my ways. :-)

3:12 hellofunk: ddellacosta i’m working in Light Table for now, the automatic connection with a browser is nice.

3:12 ddellacosta: hellofunk: there are a fair number of vim users in Clojure-land though, and people who seem to like intellij

3:12 hellofunk: emacs seems more stable though

3:13 ddellacosta: hellofunk: and yeah, I've heard a lot of good things about Light Table, but I just don't need it. Emacs is quite powerful.

3:13 hellofunk: I can imagine, LT is still quite new

3:21 beamso: in clojurescript, what is #_?

3:22 TEttinger: ,(do "eh" #_"ignored")

3:22 clojurebot: "eh"

3:22 TEttinger: it's a sort of comment, it tells the reader to ignore the next form, not like (comment) which returns nil

3:23 ^ beamso

3:25 hellofunk: beamso it is a reader macro to suppress reading of the following form

3:25 unlike comment, where everything is still read by the reader but just not evaluated

3:26 ddellacosta: beamso: yeah, it is a general to Clojure and ClojureScript

3:27 beamso: okay

3:29 hellofunk: it is interesting to note that you can still get compiler errors on content inside a comment form since it is still read in. so #_ tends to be a better option in my opinion

3:31 ddellacosta: hellofunk: really? Didn't know that, interesting

3:32 hellofunk: yeah if you treat the contents of comment as a free-for-all wild west of text where you just throw in whathever you want to say, you can have problems with certain characters, since they are read

3:34 and on another note ddellacosta are you using a particular tool in emacs to get autocompletion for all the def’d forms in libraries you require in your ns? i like how LT seems to do this, when I was playing around with emacs I couldn’t quite get this to happen, as you’d expect in more modern GUIs that know all the forms available to you as you code.

3:36 ddellacosta: hellofunk: you know, it's still not ideal but the basic autocomplete seems to do a decent job of at least giving me the forms in the code I'm working in

3:36 hellofunk: I think it's this: http://www.emacswiki.org/emacs/AutoComplete

3:36 hellofunk: ddellacosta it works with the source file you have open, but it won’t autocomplete based on contents of other source files you haven’t actually opened but can access, right?

3:36 ddellacosta: hellofunk: I installed it via the packages feature available from 24.x

3:37 hellofunk: yeah, I think there's a way to get it to load other namespaces but I haven't done the yak-shaving to get it working

3:37 hellofunk: I'm lazy, but not lazy enough. ;-)

3:37 hellofunk: that’s an interesting term, yak-shaving. what does that mean?

3:37 ddellacosta: hellofunk: I guess this would help: https://github.com/clojure-emacs/ac-nrepl

3:37 hellofunk: $google yak-shaving

3:37 Frozenlock: I usually just use hippie-expand M-/ (when not in the repl)

3:37 ddellacosta: d'oh

3:37 $google yak-shaving

3:37 lazybot: [yak shaving - Wiktionary] http://en.wiktionary.org/wiki/yak_shaving

3:38 ddellacosta: Frozenlock: huh, okay, will check that out

3:38 Frozenlock: I use it everywhere in fact, even in ERC. I'm so lazy :-p

3:39 ddellacosta: Frozenlock: to misquote Larry Wall, laziness is a virtue for a programmer

3:39 hellofunk: frozenlock wouldn’t you still need hippie expand to know where to look?

3:39 Frozenlock: hellofunk: It looks everywhere

3:40 hellofunk: by everywhere, you mean what exactly… how does it know to look in some other source file your current code has access to but that you have not opened in emacs? it can parse an ns form ?

3:40 ddellacosta: hellofunk: you always ask good questions (seriously)

3:41 Frozenlock: hellofunk: Ah ok no, it looks into the buffers

3:41 hellofunk: ddellacosta thanks

3:41 Frozenlock: But then you probably used the function somewhere in the repl, so it will also be there.

3:42 If not, you need to type it by hand!! :-p

3:42 ddellacosta: and that would be a sin

3:42 ;-)

3:43 Frozenlock: I'm also a heavy user of M-.

3:43 (in the REPL it opens the source)

3:43 hellofunk: i find autocompletion to about a lot more than just saving some keystrokes. it acts as a form of inline documentation so you an quickly get to what you need and see what are the options.

3:43 Frozenlock: Once the source is opened, you get the completion in hippie-expand

5:53 hellofunk: lein cljsbuild is giving me an add error for a line that only says “reify” if anyone can spot the issue: https://www.refheap.com/85964

5:53 beamso: yogthos: ever have issues with cljs-ajax where the handler for a GET receives nil as its parameter?

5:53 hellofunk: *odd not add

5:54 beamso: the om/IRenderState and the render-state method appear to be outside of the reify form

5:56 hellofunk: beamso ahh good catch. my eyes couldn’t see that

5:57 beamso: watch your code style at line 13 too

5:57 no space before the 'xs'

5:59 hellofunk: ok, fixed those, but still getting the same error. maybe it’s time to give my eyes a break

6:02 ah the problem was the om/ namespace prefix on one of the protocol functions. I guess you aren’t supposed to qualify those

6:03 borkdude: Can someone explain to me why you would migrate to Clojure from Ruby for more performance? What makes Clojure/JVM more performant?

6:03 (I don't know much about Ruby)

6:07 vijaykiran: AFAIK, one issue is concurrency model

6:07 ... of JVM is way better than that of Ruby's

6:12 mattfield: Bigtime. Ruby has a very limited concurrency model.

6:14 ohpauleez: Better garbage collection, JIT compilation, "full" concurrency model, overal, faster vm

6:14 trading off space for speed though

6:15 subjective reasons: Better support for application packaging, better sense of robustness in software packages, support for high-performance computations, better support for low-level constructs (arrays, etc)

6:16 that

6:16 that's all just JVM vs Ruby's VM

6:20 borkdude: what is limited about Ruby's concurrency model?

6:21 vijaykiran I am waiting for euroclojure to come with extra tickets, probably tomorrow...

6:25 mpenet: I might have to sell mine, almost sure I cant make it, moving across countries on these days

6:26 borkdude: mpenet I would be very happy to buy it from you

6:26 mpenet: borkdude: Sure I ll let you know asap, today for sure. I have 1 night at an hotel there too btw.

6:27 borkdude: mpenet I'll send you a private message with my email, ok?

6:27 mpenet: borkdude: alright

6:33 hellofunk: Frozenlock I’m tring this M- you mentioned in emacs repl, not sure if I got that right. What is the keystroke to open source at repl you mentioned?

6:40 mpenet: anyone knows if there's some documentation for primatic/schema? or just the tests?

6:40 prismatic*

6:41 p14n: There's the github readme

6:41 https://github.com/Prismatic/schema

6:42 which also points to a mailing list

6:42 mpenet: it's not really documentation, a bit of pita to browse

6:43 I guess the tests will do for now ...

6:45 vijaykiran: borkdude: cool - I hope you get the ticket :)

6:45 otfrom: morning

6:45 anyone having elisp trouble with the latest cider?

6:46 (I've already asked on clojure-emacs but it is quiet over there atm)

6:48 powrtoc: hellofunk: M-. opens source at repl

7:12 Morgawr: what's a suggested clojure irc library to write a simple irc bot? nothing fancy like lazybot/clojurebot, just simple commands read and run

7:12 I know there's irclj but it seems abandoned/not updated in years (even before lein?)

7:16 mpenet: Morgawr: mpenet/ash could be a candidate

7:19 Morgawr: mpenet: what's its state? stable?

7:19 mpenet: yes

7:20 Morgawr: mpenet: awesome, I'll check it out, thanks

7:20 mpenet: i don't use it anymore, but it was working fine for a long time

7:20 no reason it shouldn't now

7:20 Morgawr: great

7:26 hellofunk: powroc when i do that i just git a minibuffer popup that says “Var”

7:30 mpenet: Morgawr: I think a new major version of pircbotx was release a while ago, if you have the motivation it could be worth evaluating if an upgrade is worth it

7:30 Morgawr: mpenet: ash wraps around pircbotx?

7:31 mpenet: yes

7:33 Morgawr: mpenet: alright, I can't promise anything but I might give it a look

8:10 * gfredericks lein new edn-printer

8:17 borkdude: vijaykiran ok, booked a flight and got a ticket :-D

8:17 mpenet thanks :-)

8:19 mpenet: np, thank you :)

8:20 what's the current price for a ticket btw? I think you made a good deal :)

8:26 vijaykiran: borkdude: cool :) see you there then

8:26 mpenet: if anyone needs a hotel room for 60ish euros for 26-27 for euroclojure, super close to the venue, ping me

8:27 whomp: i'm getting a weird error when trying to use incanter, here's the error output: https://gist.github.com/michaeleisel/7096e2eab117151d44a6

8:27 any ideas?

8:28 *rincanter, not incanter

8:29 drbobbeaty: whomp: that looks like a real problem with the JVM... I noticed it's JDK 8 - have you tried the same thing with the latest JDK 7?

8:29 whomp: i'll give it a shot

8:29 drbobbeaty, i had trouble getting my comp to find the headers like jni.h, could that be an issue?

8:30 drbobbeaty: whomp: If not, then follow the hint and include code dumps and then use gdb or similar to have a look. If you don't read core dumps, then this won't help you, but if you want to still be debugging this, that's the path I'd take.

8:30 whomp: Yes, that's *exactly* the problem.

8:30 JNI is tricky. It's useful, but very very tricky.

8:31 opqdonut: fwiw under linux jni.h is usually under /usr/lib/jvm/java-7-openjdk-amd64/include/jni.h or so

8:31 Morgawr: mpenet: your irc bot is awesome, thanks a lot!!!

8:31 mpenet: :) glad you like it

8:32 Morgawr: seems really easy to use and make plugins, really nice job

8:32 mpenet: it was my main goal

8:32 drbobbeaty: whomp: the headers should be shipped with the JDK, and you need to be certain that you're using the ones that ship with that exact version of the JDK.

8:32 opqdonut: yeah

8:34 mpenet: Morgawr: I'd gladly take PRs or even add you to the repo if you want to improve it. MapDB can be upgraded too I think

8:34 Morgawr: heh, I'm using this for a very simple/fun project,nothing serious, so I don't know if I have time to improve it or work actively on it

8:34 if I find some serious problems or bugs or stuff that can be fixed, I'll hit you up

8:34 but I can't promise anything

8:35 clgv: whomp: was rincanter updated at all?

8:35 mpenet: alright

8:35 clgv: whomp: seems not. that project seems to be abandonned since 2 years ago

8:37 whomp: clgv, f haha

8:39 Morgawr: mpenet: is there a way to specify multiple nicks in case the original nick is already taken?

8:40 mpenet: Morgawr: I think pircbotx supports it, but it's not on ash/make-bot options

8:40 Morgawr: alright

8:40 that might be something to look into for myself, maybe :P

8:40 mpenet: might be possible to do on the instance returned by make-bot

8:49 numberten: is there a built in log base 2 function?

8:50 whomp: drbobbeaty, i see where the headers are, and i have JAVA_HOME set to `/usr/libexec/java_home -v 1.8`, but nothing seems able to find jni.h or jni_md.h. what should i try to fix this?

8:52 drbobbeaty: whomp: I'm no JNI expert, but I've used it in the past when I had to. What I remember is that when the JDK (not JRE, mind you) was unpacked, there was a 'headers' directory in the unpacked directory. Do you see that at all? I ask because it's certainly possible that Oracle now packages them separately, and it's an additional download to get these headers.

8:53 Glenjamin: ,(defn log2 [b] (- 31 (Integer/numberOfLeadingZeros (int b)))) (log2 2)

8:53 clojurebot: #'sandbox/log2

8:54 Glenjamin: ,(do (defn log2 [b] (- 31 (Integer/numberOfLeadingZeros (int b)))) (log2 2))

8:54 clojurebot: 1

8:54 Glenjamin: numberten: according to http://stackoverflow.com/a/3305710/173062 thats how to do it

8:54 whomp: drbobbeaty, i do, i see a whole bunch of headers

8:54 Glenjamin: ,(log2 2048)

8:54 clojurebot: 11

8:54 numberten: looking at nhttp://clojuredocs.org/incanter/incanter.core/log2 now

8:55 Glenjamin: sounds like a good plan

8:56 drbobbeaty: whomp: OK, then I'd look at the build instructions for the library that needs JNI, and there has to be some README or something about how to build it. This should include some tests that it's been built OK. Are there docs like this you can follow for the build?

8:56 whomp: As importantly, are you sure there are pre-compiled jars available?

8:56 whomp: drbobbeaty, for what?

8:57 uruviel: Hey, for some reason leiningen keeps recompiling my java sources. On every command (test, run, repl ...) it says Compiling 3 source files to ... even though I didn't touch the Java source

8:57 drbobbeaty: whomp: I thought you were using incanter - the stats/math library - was I wrong?

8:57 uruviel: is there way to prevent that? (as the compile is rather slow)

8:58 whomp: drbobbeaty, rincanter, but now i'm just trying to use jri with clojure, because rincanter is apparently dead

9:00 drbobbeaty: whomp: OK, if you are trying to make JNI work with clojure, you first need to make it work with Java. And that is a challenge all in itself. If you are building something from scratch - on your own, there are some resources out there to help with JNI. It's not easy, as I said, and there are specific functions for mapping values across the C-Java boundary. But it can be done.

9:01 whomp: If you're trying to build a package that someone else has written, and has JNI in it, then I'd look for a README that explains how to do this.

9:03 mdrogalis: ambrosebs: Looks like I'll see you again this year. :)

9:03 ambrosebs: mdrogalis: cool!

9:03 mdrogalis: you're speaking right?

9:04 mdrogalis: ambrosebs: Terrifyingly, yes.

9:04 ambrosebs: nice

9:05 mdrogalis: ambrosebs: When do you move here permanently?

9:05 ambrosebs: early August

9:06 mdrogalis: ambrosebs: Sweet, look forward to having you in the same country. :D

9:06 ambrosebs: definitely

9:07 Glenjamin: the ó is missing from the talk title on the strangeloop site mdrogalis, its odd as it seems to be there in the URL and title

9:07 erm, missing in the list & page heading

9:08 mdrogalis: Glenjamin: Yeah, character rendering issue. I think Alex is working on it, didn't want to rush him over the holiday.

9:08 Glenjamin: ah cool, figured i might as well point out in case you hadn't seen

9:09 all these talks look great, i think i'm going to have to go to strangeloop again

9:09 mdrogalis: Glenjamin: Appreciated. :) Yeah, gosh there's so much good content up there.

9:10 Glenjamin: last time i had an extra day in the hotel, and ended up watching videos of some talks i didn't make it to!

9:10 i hope they do the early access video thing again, that was ace

9:11 mdrogalis: Glenjamin: I wouldn't be surprised if they do what they did at clj/west. External hardware capture

9:11 Videos were up in a few hours, bottleneck was Youtube upload lol

9:11 That's a really impressive service.

9:16 szymanowski: hello, i've got a schema related question: is it safe to extend the Schema protocol to clojure.lang.Symbol?

9:17 ambrosebs: what's an example of an type that extends ISeq but not Sequential?

9:18 ohpauleez: ambrosebs: I don't think one of those exists

9:18 You can have it the other way around though

9:19 oh wait

9:19 ,(seq? [])

9:19 clojurebot: false

9:20 ohpauleez: ,(contains? (ancestors (class [])) clojure.lang.Seqable)

9:20 clojurebot: true

9:21 ambrosebs: I'm interested in clojure.lang.Sequential

9:22 ohpauleez: Hmm, I think if it contains ISeq it always has Sequential

9:23 ayia: Hi guys,

9:23 ambrosebs: https://github.com/clojure/clojure/blob/master/changes.md#12-iseq-no-longer-inherits-from-sequential

9:23 has me confused

9:23 ayia: is there a way to achive the same as ~@(map inc [1 2 3]) ? because the latter does not work in cloujure

9:24 ohpauleez: ayia: You probably want the `apply` function. Unless you're writing a macro where you need to unroll like that

9:24 wkelly: ambrosebs: https://groups.google.com/forum/#!topic/clojure-dev/xY7ELXggnuA

9:26 ayia: ohpauleez: yeah, I need something like apply... but apply applies "something"... And I just want to unroll what i Have in a list returned from (map....)

9:26 ambrosebs: wkelly: thanks

9:26 looks like it's an invalid implementation to extend ISeq but not Sequential?

9:27 my particular context is: is this valid for all seqables? (nth (seq coll) n)

9:27 cos nth relies on Sequential as a last resort

9:30 wkelly: according to my reading of the docs, it should fall back to O(n) seq behaviors if necessary

9:30 so it should work on anything seq works on

9:32 uruviel: I've had this function in my code for a while to read a var from an unloaded file (with namespace) https://gist.github.com/joelkuiper/38ff5b7cadc1b18339cd but I assume there is a better way of doing this?

9:32 maybe with load-file?

9:32 ambrosebs: it doesn't actually call seq on the argument unless it's Sequential I think

9:32 ,(nth #{1} 0)

9:32 clojurebot: #<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: PersistentHashSet>

9:34 uruviel: just added an example usage, for clearity

9:34 wkelly: ambrosebs: ah! I see your trouble now. Yeah, calling seq first should always work if seq works

9:35 borkdude: mpenet I have no idea what the current price is, the website doesn't name a price

9:54 ticking: any thoughts on how to parse something like whitespace string whitespace in instaparse where the whitespace is greedy and the string reluctant?

10:01 so it looks like instaparse is less powerfull than regex...

10:03 ohpauleez: I don't know if that's correctly - they express different grammars.

10:03 correct**

10:04 If you're just trying to grab some text out of a single string, I'd just use regex

10:05 ticking: ohpauleez: it's a whole file format

10:05 robot operating system message declaration format, horrendous stuff

10:05 mattfield: re: EuroCLJ price (I think someone asked further up...) the standard rate was €195, iirc

10:06 Morgawr: mpenet: is it possible to add a plugin to the bot at runtime?

10:08 mpenet: yep

10:08 that's what it does at startup more or less if I recall

10:09 yep, confirmed

10:10 Morgawr: so I can just call the new handler and pass the bot as a parameter, right?

10:10 mpenet: yes

10:10 Morgawr: ah, awesome, thanks

10:40 arrdem: ls

10:40 lazybot: bin etc home lib lost+found mnt proc root selinux srv sys tmp usr var

10:42 Glenjamin: ls mnt

10:42 lazybot: bin data root selinux src srv tmp var

10:42 Glenjamin: is that actually real?

10:42 arrdem: $mail gtrak aware of any bugs with cider? I'm getting Error: (error "Cannot decode object: 1") and Error: (wrong-type-argument integer-or-marker-p nil) when I boot a freshly upgraded cider

10:42 lazybot: Message saved.

10:42 arrdem: Glenjamin: it's a random subset of lazybot's real /

10:42 Glenjamin: ah, neat

11:31 owl-v-: is there hardware-float on JVM for ARM ?

11:36 mpenet: owl-v-: there's a jdk8 ARM I think

11:41 arrdem: mpenet: Oracle's JVM has an ARM build?

11:42 Bronsa: ping

11:43 mpenet: arrdem: seems so http://www.oracle.com/technetwork/java/javase/downloads/jdk8-arm-downloads-2187472.html

11:44 * arrdem is only about a quarter surprised

11:54 owl-v-: *surprise*

11:55 justin_smith: I hear the arm jvm is not as well optimized as the x86 one

11:56 owl-v-: *oh no*

11:56 i was going to use it in beagle...

11:56 justin_smith: beagle board or beagle bone?

11:57 arrdem: justin_smith: well that's no surprise... although we can expect that situation to improve with time.

11:57 owl-v-: then i shall get minnowboard-max..

11:57 justin_smith: i have beagle-bone

12:03 master_op: hello, when i attempt to read orderset withscores from redis iget NumberFormatException

12:03 how can i resolve this

12:07 should i ask in redis room ?

12:08 cbp: you are trying to do a parseLong or something on invalid input

12:11 technomancy: owl-v-: iirc you have to get some terrible oracle thing to get decent perf on arm

12:11 I just went with racket instead

12:13 Bronsa: arrdem: pong

12:15 philandstuff: I'm looking to implement OpenID Connect in clojure (both IdP and RP side) but I'm not really sure where to start. I've had a look at clauth and friend, and also the Java section of http://openid.net/developers/libraries/ but I'm not really sure how to assess them for suitability. Does anyone have any expirience with OIDC in clojure?

12:15 I did find https://github.com/pelle/clauth/issues/15 but there hasn't been much activity since then

12:16 it looks like I want to use friend, but I'll need to implement my own workflow fn to manage the OIDC-specific bits

12:17 arrdem: Bronsa: currently working on lambda lifting, which means rewriting fn forms to make implicit parameters explicit. conceptually straightforwards, but I was wondering if you could think of a better way to do the function rewriting than to rewrite the :form as required and re-analyze the result to get a t.a(.jvm) tree back.

12:21 philandstuff: ooh, found http://connect2id.com/products/nimbus-oauth-openid-connect-sdk/examples which looks promising. apache2 licensed.

12:27 rasmusto: bagel bone?

12:28 isn't that the node.js asic?

12:28 Bronsa: arrdem: I don't see any obvious alternative

12:29 arrdem: Bronsa: that's kinda what I figured. Actually rewriting the entire analyzer AST seems like more effort than doing the transform at the source level and re-analyzing. Thanks, I'll go with that.

12:29 Bronsa: arrdem: yeah definitely

12:30 arrdem: you probably want to use (emit-form sub-ast) rather than (:form sub-ast) though

12:30 Morgawr: if I have a vector of strings like ["Hello" "World"] what is the most elegant way to merge that vector into a single string separated by a specific value?

12:30 like "Hello World" for " " or "Hello+World" for "+"

12:30 arrdem: Morgawr: string/join and interpose

12:30 rasmusto: (clojure.string/join sep xs)

12:31 Morgawr: nice!

12:31 thanks

12:31 arrdem: rasmusto: oh right join does include a sep....

12:31 Morgawr: I was using a botched version of reduce and it felt so ugly

12:31 rasmusto: arrdem: yeah, I prefer using interpose though, since making a string right off the bat can feel heavy-handed

12:36 gfredericks: technomancy: yo leiningen has this warning about :user profile :repositories entries

12:36 due to "repeatability"

12:36 arrdem: Bronsa: noted, thanks.

12:39 gfredericks: but I think it's necessary for using project templates from a custom repository?

12:40 technomancy: gfredericks: you should be able to use :plugin-repositories for that

12:40 though I don't understand the use case for private templates

12:41 (this might only work on master)

12:42 arrdem: is there a better pattern for (reduce (f [x y] (if (p y) (f x y) x)) xs)?

12:42 it seems like the if with the identity case is a repeated pattern and could be abstracted/eliminated...

12:43 gfredericks: technomancy: I realize you don't understand the use case for private anything :P

12:43 technomancy: I support the notion of private property.

12:43 but I'll smack anyone who says "intellectual property"

12:43 gfredericks: that's an entertaining policy

12:44 rasmusto: arrdem: (reduce f (filter p xs)) ?

12:44 arrdem: rasmusto: herp a derp...

12:45 this is what I get for writing C in my head and translating...

12:45 rasmusto: ,(interpose "a" ["herp" "derp"])

12:45 clojurebot: ("herp" "a" "derp")

12:45 arrdem: ,(repeatedly "derp")

12:45 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>

12:46 clgv: repeat ;)

12:47 arrdem: clgv: I noticed :P

12:47 ,(interpose "herp" (repeat "derp"))

12:47 clojurebot: ("derp" "herp" "derp" "herp" "derp" ...)

12:48 Glenjamin: ,(defn herp [derp] (str "herp a " derp))

12:48 clojurebot: #'sandbox/herp

12:49 Glenjamin: ,(repeatedly herp)

12:49 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/herp>

12:49 arrdem: ,(repeatedly herp "derp")

12:49 clojurebot: #<ClassCastException java.lang.ClassCastException: sandbox$herp cannot be cast to java.lang.Number>

12:49 Glenjamin: dammit

12:49 arrdem: oh. partial?

12:49 Glenjamin: ah, iterate

12:49 arrdem: ,(doc repeatedly)

12:49 clojurebot: "([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"

12:49 Glenjamin: i think

12:49 hrm

12:49 arrdem: ,(doc iterate)

12:49 clojurebot: "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

12:50 arrdem: ,(iterate herp "derp")

12:50 clojurebot: ("derp" "herp a derp" "herp a herp a derp" "herp a herp a herp a derp" "herp a herp a herp a herp a derp" ...)

12:50 Glenjamin: close enough :)

12:52 rasmusto: move over "Hello World!"

13:01 owl-v-: technomancy: why oracle thing is bad?

13:03 technomancy: owl-v-: because it's oracle?

13:04 arrdem: Oracle: they may make the best JVM but they're still worse than Hitler

13:04 Glenjamin: s/make/bought/ ?

13:05 or is it genuinely better now, i dunno

13:05 technomancy: it's better now that they've crushed competition in the mobile space with lawsuits

13:05 arrdem: I haven't seen JDK 6/7/8 benchmarks

13:06 dbasch: at my old company we did a thorough performance comparison of jdk6 options (in 2011) and for our specific application Oracle was slightly more performant

13:06 cbp: https://pbs.twimg.com/media/BaW3NZbCAAAa0i3.png

13:06 arrdem: dbasch: against OpenJDK or what other imp'ls?

13:06 (inc cbp)

13:06 lazybot: ⇒ 6

13:07 dbasch: arrdem: OpenJDK was the only one that was close

13:07 arrdem: dbasch: sounds about right.

13:08 dbasch: for us it was all about GC really

13:08 arrdem: I hear that IBM and some other companies have specialized JVMs and JVM→metal translators that are even more competitive with Oracle's JVM, but I haven't seen benchmarks and kinda doubt they exist openly.

13:08 dbasch: we were running with large memory footprints and the GC pauses were significant

13:08 arrdem:

13:09 technomancy: arrdem: you probably have to sign something that says you won't release performance measurements to use them

13:09 like datomic

13:09 arrdem: technomancy: ikr

13:10 owl-v-: why. what's so wrong about oracle ?

13:10 technomancy: which is a great indicator that you probably wouldn't want to use software written by them in the first place.

13:10 dbasch: Oracle, the legal firm that also sells software

13:10 arrdem: Oracle, destroyer of Sun

13:11 Oracle, the downfall of OpenOffice

13:11 technomancy: they're doing their best to destroy mysql too

13:11 (oh wait, that's actually not evil)

13:12 a broken clock is right twice a day?

13:12 arrdem: technomancy: only if you don't use Unix time...

13:12 owl-v-: so. it's just license that is bad?

13:13 is it okey to use oracle jam?

13:13 is it okey to use oracle JVM?

13:14 dbasch: a broken digital clock is right never

13:15 owl-v-: broken clock is not a clock but a trash

13:17 what's that code security on LLVM? >> http://en.wikipedia.org/wiki/Comparison_of_application_virtual_machines

13:18 clojure on mono?

13:18 arrdem: may run better than jvm clojure

13:19 owl-v-: lol

13:19 M$ would love that

13:19 but seriously

13:19 arrdem: mono and .net have better GC & memory performance than the JVM.

13:19 technomancy: "code security" probably refers to sandboxing

13:20 arrdem: o_O

13:20 I heard mono's generational GC was really immature

13:20 arrdem: technomancy: maybe, but for JVM apps I've seen run atop mono they've done better memory wise.

13:21 s/run atop/ported and run atop/g

13:21 technomancy: arrdem: sure, because of not being stuck with utf-16 probably

13:21 but I don't think that means the GC is comparable

13:21 arrdem: technomancy: maybe, also the codes I've seen ported were pretty shitty to start with so the port was probably a cleanup.

13:21 in a big way

13:22 owl-v-: (and LLVM MONO) for the next clojure

13:22 arrdem: tim++ has put a lot of effort into llvm clojure, but I don't know if we'll ever see that. it'd kinda invalidate my GSoC project :P

13:23 owl-v-: if oracle is that bad, that is..

13:26 how is OpenJDK?

13:27 arrdem: it's good enough for most things

13:27 owl-v-: compared to JDK?

13:27 arrdem: $google openjdk vs oracle jvm

13:27 lazybot: [OpenJDK - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/OpenJDK

13:27 technomancy: openjdk is great for everything but ARM

13:32 owl-v-: lol that (but ARM)

13:33 technomancy: the JVM is optimized for big-iron servers anyway; running it on arm is weird

13:33 owl-v-: damn... then... i should use x86 for java? wtf

13:33 arrdem: owl-v-: oooh yeah

13:33 technomancy: the only reason Sun engineers got away with OSSing it was that it would supposedly help sell servers

13:33 that's also why the client JVM was abandoned

13:34 arrdem: owl-v-: my previous shop was Calxeda, and our #1 and #2 failure reasons were lack of a good ARM JVM and lack of a 64 bit arm chip.

13:34 $google caxleda

13:34 * arrdem can't type

13:34 arrdem: technomancy: client JVM?

13:35 owl-v-: lol that right once and run anywhere... it's more like "anywhere"

13:35 technomancy: arrdem: back in the day you could do `java -client ...` and it would run a different variant of hotspot optimized for low memory usage and fast startup

13:35 arrdem: it never got ported to 64bit

13:35 arrdem: owl-v-: well who really treats arm machines as real PCs yet....

13:35 owl-v-: for real

13:35 amalloy: arrdem: it sounds like #0 must have been the decision to stick with arm despite #1 and #2

13:37 rasmusto: $google Jazelle

13:37 lazybot: [Jazelle - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Jazelle

13:37 arrdem: amalloy: our entire sales pitch was arm low power servers and ARM didn't deliver a 64 bit reference imp'l before we ran out of cash. :C it was a fun crew and we still get drinks... mostly at Qualcomm and Oracle now.

13:37 owl-v-: arrdem: no no, not pc but in embedded systems and robotics

13:41 PigDude: i asked this yesterday, but which is better? (when-let [v (f)] (f2 v)) or, (some-> (f) f2)

13:42 arrdem: I'd use the former if you just have one case...

13:42 PigDude: i prefer some-> but i don't want my code to be confusing

13:43 cbp: when-some? :P

13:43 whilo: ,(satisfies? clojure.lang.ISeq '())

13:43 clojurebot: #<NullPointerException java.lang.NullPointerException>

13:44 gfredericks: ,(instance? clojure.lang.ISeq '())

13:44 clojurebot: true

13:44 whilo: gfredericks: interesting, satisfies works that way in cljs

13:45 (satisfies? cljs.core/ISeq '()) ;=> true

13:46 dbasch: whilo: that’s because ISeq is a protocol in cljs

13:47 whilo: dbasch: ok, and in clojure it is a java interface?

13:47 dbasch: whilo: correct

13:47 amalloy: PigDude: some-> seems weird to me there. might just be because some-> is still newish to the language, though

13:48 arrdem: ,(doc when-let)

13:48 clojurebot: "([bindings & body]); bindings => binding-form test When test is true, evaluates body with binding-form bound to the value of test"

13:48 arrdem: really... why does that exist when we have if-let...

13:49 amalloy: arrdem: why does when exist? we have if, after all

13:49 gfredericks: why does let exist? we have fn after all

13:49 dbasch: why does clojure exist? we have java after all

13:49 technomancy: inb4 why do computers exist

13:49 gfredericks: why does existence exist? we have non-existence after all

13:49 arrdem: fuck it I'm just gonna rewrite all this in pure lambda calculus

13:50 church numerals ftw

13:50 dbasch: how can computers be real if our binary numbers aren’t real

13:54 Slackwise: Hopefully quick question, but is there any cleaner way to filter a vector of maps by key? https://gist.github.com/Slackwise/2ea39ae4ec465d74fb70

13:56 PigDude: amalloy: yea, i'd hope some-> becomes an idiom for that sort of thing because it's so much more to the point

13:56 dbasch: Slackwise: from the example it doesn’t look like you want to filter it, you’re just getting one element

13:56 Slackwise: Indeed.

13:56 I essentially wish to query it.

13:56 amalloy: Slackwise: no; if your seq of maps has a conceptual "key" you want to look things up by, you want a map, not a seq

13:57 also, clojure.core hasn't seen fit to add the function frst yet - not enough people misspell first, i guess

13:58 Slackwise: Fixed. Typed it up rather than copying and pasting my actual code. I'm just learning here.

13:58 This is, though, common in JSON files.

13:58 rasmusto: Slacwise: ##(let [v [{:name "Chris" :age 28} {:name "Adam" :age 25}] m (zipmap (map :name v) v)] (update-in m ["Chris" :age] inc))

13:58 lazybot: ⇒ {"Adam" {:age 25, :name "Adam"}, "Chris" {:age 29, :name "Chris"}}

13:58 rasmusto: yeah, maps are what you want

13:59 Slackwise: Destruicturing using a let?

13:59 rasmusto: nah, just making a map in the let

13:59 amalloy: Slackwise: sure, a seq of maps is common enough as input. but if you want to work with it, make it into a data structure that performs well

13:59 rasmusto: (inc amalloy)

13:59 lazybot: ⇒ 112

14:00 Slackwise: amalloy: So, no common way to do query nested collections?

14:00 ^to query

14:01 amalloy: $mail Slackwise if you want just an answer to your specific question, and would rather ignore the tengential advice you've received, then: yes, there is no better way to look something up in a seq than to iterate over the seq and stop when you get what you want

14:01 lazybot: Message saved.

14:02 dbasch: Slackwise: for associative collections, get-in

14:02 (doc get-in)

14:02 clojurebot: "([m ks] [m ks not-found]); Returns the value in a nested associative structure, where ks is a sequence of keys. Returns nil if the key is not present, or the not-found value if supplied."

14:02 Slackwise: Yea, I found that for nested maps. That was nice.

14:03 dbasch: Slackwise: but really sequential collections are made for efficient traversal or o(1) lookup, not for querying by value

14:07 Slackwise: dbasch: I know, but, semantically, I do not have a unique key here. I was just hoping there was a way since it's such a common data structure. I found vectors of maps all over the example code as well.

14:08 rasmusto: Slackwise: if :name isn't unique, why are you changing peoples' :age based on it?

14:08 Slackwise: Good point.

14:08 It is example code, but you do make a valid point.

14:09 I wouldn't be able to do that in real data WITHOUT a unique key.

14:09 I guess, unless I was trying to match.

14:09 rasmusto: and with a real unique key, it'd work to have that as keys in a map, no?

14:10 and you'd be albe to liberally use group-by if you wanted to query on a specific field

14:12 ,(let [v [{:name "Chris" :age 10 :id 0} {:name "Chris" :age 28 :id 1} {:name "Adam" :age 25 :id 2}] m (group-by :id v)] (update-in m [0 :age] inc))

14:12 clojurebot: #<NullPointerException java.lang.NullPointerException>

14:13 rasmusto: oh right, you'd have to call first if you're using group-by on a unique key

14:14 ,(let [v [{:name "Chris" :age 10 :id 0} {:name "Chris" :age 28 :id 1} {:name "Adam" :age 25 :id 2}] m (zipmap (map :id v) v)] (update-in m [0 :age] inc))

14:14 clojurebot: {2 {:age 25, :name "Adam", :id 2}, 1 {:age 28, :name "Chris", :id 1}, 0 {:age 11, :name "Chris", :id 0}}

14:15 rasmusto: ,(let [v [{:name "Chris" :age 10 :id 0} {:name "Chris" :age 28 :id 1} {:name "Adam" :age 25 :id 2}] m (group-by :name v)] m)

14:15 clojurebot: {"Chris" [{:age 10, :name "Chris", :id 0} {:age 28, :name "Chris", :id 1}], "Adam" [{:age 25, :name "Adam", :id 2}]}

14:15 rasmusto: Slackwise: ^ fyi

14:22 owl-v-: ,([1 2 3] 0 )

14:22 clojurebot: 1

14:22 owl-v-: lol vector is a function

14:22 ,([1 2 3] 1)

14:22 AWizzArd: owl-v-: exactly

14:22 clojurebot: 2

14:23 owl-v-: i was watching this talk >> http://youtu.be/wASCH_gPnDw

14:23 AWizzArd: Keywords also, and sets and hashmaps.

14:23 owl-v-: it's a great talk

14:23 AWizzArd: (:b {:a 1, :b 2}) ; keywords are functions

14:23 ,({:a 1, :b 2} :a) ; hashmaps are functions

14:23 clojurebot: 1

14:24 owl-v-: lol

14:24 AWizzArd: ,(#{10 20 30} 30)

14:24 clojurebot: 30

14:24 owl-v-: very interesting

14:24 AWizzArd: This worked also in Clojure 1.0 back in 2008 :)

14:25 Those were the times when Rich hung out here with us every day.

14:26 owl-v-: :)

14:26 i thought i had to do like (nth [1 2 3] 1) something like that

14:28 ,(type 'A)

14:28 clojurebot: clojure.lang.Symbol

14:28 owl-v-: ah!

14:28 ,(type 'A')

14:28 clojurebot: clojure.lang.Symbol

14:28 owl-v-: ,(type "A")

14:28 clojurebot: java.lang.String

14:28 owl-v-: :-)

14:29 AWizzArd: owl-v-: using nth would make it very clear to the reader of your code that they are dealing with a sequence, such as a vector.

14:29 owl-v-: is there 'cons' to use (nth) ?

14:30 AWizzArd: ,(cons 0 (list 10 20 30))

14:30 clojurebot: (0 10 20 30)

14:30 AWizzArd: owl-v-: you did CL?

14:30 owl-v-: ,(let [v [1 2 3]] (v 1))

14:30 clojurebot: 2

14:30 owl-v-: what's CL?

14:31 AWizzArd: Common Lisp. Not uncommon to use `cons` there.

14:31 In Clojure however it is rarely used.

14:32 owl-v-: clojure? i used it for solving problems for fun like >> https://projecteuler.net/

14:33 rasmusto: I use cons/conj a lot when writing recursive code

14:33 owl-v-: i used racket for solving some physics because i can draw some projectile path.

14:33 oh, i meant cons and (pros/cons)

14:34 rasmusto: cons has none

14:34 AWizzArd: owl-v-: aaah, I see. Well, nth is slower.

14:34 owl-v-: okey

14:34 llasram: `nth` is slower than what?

14:34 AWizzArd: ([10 20 30] 1) calls directly the correct function. nth first has to do a little bit more work.

14:34 rasmusto: llasram: vector access methinks

14:35 llasram: AWizzArd: `nth` has an inline-able fast-path for objects which implement `Indexed` (like vectors)

14:36 AWizzArd: llasram: funny, I just tried it and found `nth` to be actually faster.

14:36 llasram: I'd be very very surprised if there was a measurable difference

14:37 AWizzArd: And I thought I remember how I benchmarked such things a few years ago.

14:37 qerub: OK, who will check with https://github.com/hugoduncan/criterium ? :)

14:38 rasmusto: llasram: looking at the nth definition, I can't really tell what the :inline thing does differently

14:39 llasram: rasmusto: I meant inline-able by the JIT

14:39 rasmusto: llasram: ah, ok. Is this :inline something different completely?

14:39 llasram: Yes

14:39 rasmusto: llasram: kk, thanks

14:39 llasram: Sorry, wasn't clear

14:39 AWizzArd: And get however seems to really be slower.

14:40 rasmusto: llasram: no problem, just trying my best to keep up :)

14:40 amalloy: i'd be surprised if calling it as a function isn't at least a little faster than nth

14:41 and yet, i seem to be wrong. the jit works in mysterious ways

14:41 AWizzArd: amalloy: I thought that a direct call such as ([10 20 30] 1) should have an edge on nth and get.

14:41 rasmusto: ~jit

14:41 clojurebot: No entiendo

14:42 arrdem: jit?

14:42 amalloy: yeah, i agree, that seems natural to me, AWizzArd

14:43 rasmusto: jit??

14:43 lazybot: rasmusto: Uh, no. Why would you even ask?

14:43 amalloy: and yet a quick-bench with criterium suggests it's 50% slower

14:43 AWizzArd: I just tried it on tryclj and funnily (time (dotimes [i 100000000] ([10 20 30] 1))) was 568 msecs while the version with nth clocked in at 181 msecs

14:43 amalloy: clojurebot: The JIT |works| in mysterious ways

14:43 clojurebot: You don't have to tell me twice.

14:43 amalloy: AWizzArd: that's a terrible benchmark. you're going to be overwhelmed by the time taken creating that vector over and over

14:44 AWizzArd: amalloy: even if the JIT can optimize calls of nth… why are then nth vs. direct use not exactly the same?

14:45 amalloy: ~the jit

14:45 clojurebot: Pardon?

14:45 amalloy: dangit, clojurebot, work with me here

14:45 AWizzArd: amalloy: if you already have a clj repl with criterium up, could you throw in `get` into the comparison?

14:46 amalloy: AWizzArd: my repl always has criterium. adding stuff like that to my ~/.lein/profiles.clj has been a godsend

14:46 dbasch: on my machine they are about the same

14:46 AWizzArd: amalloy: also have it in my profiles.clj but have no access right now

14:46 dbasch: get is twice as slow though

14:47 amalloy: dbasch: i've been running (let [xs (vec (range 1e6))] (quick-bench (get xs 100000))). you?

14:49 dbasch: I was using a small vector, with your example it’s only 50% slower

14:49 but nth and the vector are still about the same

14:49 amalloy: i guess a smaller one is probably better, so that lookup time doesn't weigh into it

14:50 whilo: dbasch: ok, thx. why doesn't it throw an exception, btw.?

14:51 dbasch: whilo: why would you expect it to throw an exception?

14:52 whilo: dbasch: i mean if you pass in an interface instead of a protocol, a npe is not very helpful. only wondering...

14:54 dbasch: thx, works now crossplatform: https://github.com/ghubber/hasch/blob/master/src/clj/hasch/platform.clj#L123

14:54 dbasch: whilo: sorry, I had lost the context. You meant satisfies? and the interface

14:55 whilo: dbasch: yes

14:57 dbasch: whilo: this line assumes you passed in a protocol https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L497

14:58 perhaps it could be a bit more defensive and tell you that it’s not a protocol

15:09 whilo: yes

15:19 owl-v-: lol Linus Torvalds >> http://youtu.be/Aa55RKWZxxI

15:20 mdeboard: owl-v-: Does he mention clj?

15:21 owl-v-: i'm so scared about (oracle)

15:21 mdeboard: Ohh, right

15:22 mmitchell: Any prismatic/schema users here? Works fine in dev, but when I deploy my webapp to jetty, schema.core/defrecord doesn't exist.

15:26 noprompt: printing collections with strings containing numbers kind of sucks :-(

15:26 or rather, strings that only contain numbers.

15:27 dbasch: noprompt: how so?

15:27 noprompt: i guess that's what prn is for though.

15:28 dbasch: uh (print [1 "1"]) => [1 1]

15:28 pjstadig: mmitchell: do you have schema as a dependency or a dev dependency?

15:28 mdeboard: mmitchell: You need to require schema.macros

15:28 not schema.core

15:28 mmitchell: Ctrl-F ":as sm" here https://github.com/Prismatic/schema

15:28 dbasch: noprompt: yeah, prn

15:28 mmitchell: pjstadig: hey there :) - I have it set as a dependency (not dev)

15:28 noprompt: (print "X:" (pr-str data)) is kind of annoying though.

15:29 pjstadig: mmitchell: hey :)

15:29 mmitchell: mdeboard: schema.macros ahh, cool. Will give that a shot.

15:30 dbasch: noprompt: it’s the same as read-string, only backwards :)

15:30 mmitchell: mdeboard: This comment makes it sound as if I don't need schema.macros: ";; only necessary for cljs, macros are imported to schema.core in clj"

15:31 mdeboard: ohh

15:31 adammh: this is more of a clojurescript question but is it possible to use a javascript "namespace" (such as chrome.bluetooth) in a more direct fashion than (-> js/chrome .-bluetooth .getDevices) ... i.e. (require [chrome.bluetooth :as bt]) (bt/getDevices ...)

15:31 mdeboard: mmitchell: idk then, you're on your own :P

15:31 * mdeboard rides away

15:31 pjstadig: mmitchell: if schema is on the class path and schema.core/defrecord doesn't exist, then it needs to be required

15:31 noprompt: adammh: no

15:32 arrdem: Bronsa: inside an update-children the AST is a transient, right?

15:32 pjstadig: mmitchell: are you using it with it's fully qualified name, or something like (:require [schema.core :refer [defrecord]]) in your ns?

15:32 noprompt: adammh: well, i take that back, you could create a namespace for it and then yes.

15:32 :P

15:32 mmitchell: pjstadig: yeah i have (:require [schema.core :as sc]) in my ns declaration, then (sc/defrecord ...)

15:33 pjstadig: mmitchell: hmm, sometimes you can get that error if something fails when compiling a namespace. like maybe something that schema.core depends on is failing for some reason

15:34 owl-v-: lol vector is implemented as a tree

15:34 pjstadig: we've been using schema in production at outpace without difficulty

15:34 adammh: noprompt: in that I could write a script to generate templates for all the chrome APIs?

15:34 noprompt: pjstadig: i didn't know that.

15:34 llasram: owl-v-: You laugh at the strangest thing

15:34 s

15:34 noprompt: pjstadig: we need to try it out on the clojurescript side.

15:34 mmitchell: pjstadig: That's very good to know

15:35 noprompt: adammh: you could write a macro, sure.

15:35 Bronsa: arrdem: internally update-children uses transients but that's not something that should matter to a user of update-children, why do you ask?

15:36 pjstadig: noprompt: yeah it's been useful. when you're passing around lots of sequences of hash maps and such, it can get to be inscrutable, and it's nice to have schema definitions at least for the borders between libraries and such

15:36 clojurebot: Gabh mo leithscéal?

15:36 pjstadig: clojurebot: no one asked you

15:36 clojurebot: Pardon?

15:36 mmitchell: pjstadig: what version of schema are you using?

15:36 pjstadig: clojurebot: NO. ONE. ASKED. YOU.

15:36 clojurebot: Cool story bro.

15:36 pjstadig: ~botsmack

15:36 clojurebot: clojurebot evades successfully!

15:36 mmitchell: ha

15:37 arrdem: Bronsa: just pondering how much my lambda lift operation can cheat

15:37 pjstadig: mmitchell: 0.2.1

15:37 mmitchell: pjstadig: ok i'm on 0.2.2

15:37 dbasch: ~everybody

15:37 pjstadig: mmitchell: hmm. weird.

15:37 clojurebot: everybody do the dinosaur

15:37 * arrdem dances badly

15:37 owl-v-: ah, i see. clojure requires gc

15:38 persistent data structure... even when original reference is gone.

15:39 mmitchell: pjstadig mdeboard I'm changed from schema.core/defrecord to schema.macros/defrecord and all is well

15:39 pjstadig: i kind of think that schema's coercions would make parsing JSON much, much better, but haven't gotten to try it as yet

15:39 mmitchell: yeah now that I think of it we aren't actually using defrecord from schema, so we may not have run into this problem

15:40 mmitchell: interesting

15:40 noprompt: adammh: i would avoid the code generation/macro unless there is real benefit. wrapping a javascript api isn't that painful.

15:41 adammh: if you plan to package it up as a library you'll need to think about externs as well (which may or may not exist).

15:42 adammh: noprompt: wrapping in what sense - like rearchitecting the whole thing to be more clojurey? My initial goal it to just be able to use it without a ton if yuckyness :)

15:43 noprompt: mmitchell: is it possible to send the schema definitions down to the client? ex. when you're not sharing code between the server and client a la cljx?

15:43 adammh: what I really want (for now) is just (def getDevices (-> js/chrome .-bluetooth .-getDevices))

15:44 noprompt: pjstadig, mmitchell i'd love to be able to do that vs. having to hack together a schema-json-esque layer to go back and forth.

15:45 pjstadig: noprompt: since schema definitions are "just data" i want to say you could

15:45 mmitchell: I'd imagine so yeah

15:45 pjstadig: as always there may be security concerns to trusting data that a client sends to a server

15:46 noprompt: adammh: (ns chrome.bluetooth) (def bluetooth js/chrome.bluetooth) (def get-devices (.-getDevices bluetooth))

15:46 adammh: noprompt: ah, that's not too bad at all

15:46 noprompt: adammh: (ns my-app (:require [chrome.bluetooth :as bt])) (let [ds (bt/get-devices)] ..)

15:47 adammh: you could even use specify! to add ISeq and ILookup functionality on the return values from the api.

15:49 adammh: noprompt: cool. thanks for the help!

15:49 noprompt: pjstadig: mostly what i want is to be able to be able to write more declarative code on the client. ex. using a schema as template for form element contruction etc.

15:50 request the schema from the server and write generic code. if the schema changes i don't have to change the code.

15:51 adammh: noprompt: also, would this be a super weird sort of thing to do to avoid chaining callbacks? (defn get-devices []

15:51 (let [p (promise)]

15:51 ((.-getDevices js/chrome.bluetooth) (fn [arr] (deliver p arr)))

15:51 p))

15:51 noprompt: that's been the PITA part of the whole client/server relationship for me. having to change html because data changed. :(

15:52 or at least, change *less* code.

15:52 mdrogalis: Ommmmmmm :)

15:52 noprompt: mdrogalis: already doing that ;)

15:53 mdrogalis: noprompt: I just realized the hurt in that statement.

15:53 Disregard that :P

15:58 noprompt: adammh: i leave callback oriented code alone. if the api wrap it the same way. never make those choices there.

15:58 adammh: that way if i want to use core.async, promises, lies, cheats, dirty hacks, or whatever later on i can because my base functions are minimal.

15:58 adammh: noprompt: well - not gonna be able to use promises in clojurescript anyway

15:59 noprompt: adammh: promises are pretty weak compared to what you get with core.async anyway.

16:00 amalloy: noprompt: easy solution: never call print with anything but a string. it's just not a very sophisticated function

16:06 noprompt: amalloy: pssssssssssh. simple > easy. ;)

16:08 rasmusto: what does quick-bench do with a memoized function?

16:10 amalloy: rasmusto: uhhh...nothing? those two things are entirely orthogonal. quick-bench just runs the code you gave it N times

16:10 so: whatever your code does with a memoized function

16:10 rasmusto: amalloy: ok, so if I've cached a piece of it, it'll use the cached calls

16:12 amalloy: whatever intuitions you have about, say, dotimes, will apply equally to quick-bench. it doesn't do anything magical

16:13 rasmusto: amalloy: ok, thank you

16:27 beepbeep_: Can anyone tell me why I get following error at line 26? https://gist.github.com/aaronmu/48ac3a42f64499feaa0d#file-gistfile4-clj-L26

16:28 I don't understand why clojure looks for user/apply.

16:28 Bronsa: beepbeep_: it'd look like you did (def apply)

16:29 beepbeep_: Bronsa, I pasted the entire file.

16:29 Perhaps it's a light table instarepl bug

16:30 I was working on a function called apply-message-to

16:30 but even after removing it, error persists

16:30 rasmusto: try restarting the repl connection

16:30 arrdem: beepbeep_: is this clojure or clojurescript.... also if you ever did def apply you'll have to restart

16:30 beepbeep_: oh okay

16:31 that's 15m well spent :D

16:31 gtrak: you have to remove it from the ns, restarting obviously will do that for you :-)

16:32 beepbeep_: \o/

16:32 rasmusto: ,(apply str "grats" " " ["beep" "beep"])

16:32 clojurebot: "grats beepbeep"

16:33 * arrdem grumbles about apply, partial and lambdas

16:33 beepbeep_: I actually tried reconnecting to the instarepl earlier but that's apperantly not enough :)

16:34 rasmusto: arrdem: whats the grumbling about?

16:34 arrdem: rasmusto: I'm writing lambda lifting for my gsoc compiler and apply is currently deviling me

16:35 rasmusto: hmm

16:35 arrdem: rasmusto: the issue is what can be done about (let [x 3] (apply #(+ x %1) <>))

16:36 rasmusto: 'cause what I want to do is rewrite this to (def fn_90001 [x _1] (+ x _1)) (let [x 3] (apply (partial fn_90001 x) <>)) but that doesn't work because partial returns another lambda function and now I'm chasing my tail...

16:38 rasmusto: hmm, I think I see the issue

16:38 arrdem: I'm not sure it exists tho because I don't actually resolve that partial at compile time (yet) so I can legally do that transformation because partial is just a function invocation at this point

16:39 yeah this is legal nevermind. I retract my grumbling.

16:39 clojurebot: compilers |are| hard

16:39 technomancy: pretty sure that's a dupe

16:40 arrdem: technomancy: hum?

16:40 technomancy: I mean I think he already had that exact factoid.

16:40 rasmusto: clojurebot: compilers?

16:40 clojurebot: I don't understand.

16:40 arrdem: I wouldn't be surprised.

16:47 PigDude: if i have a hash with a key that refers to antohre key in the hash, is this a good way to acces it or is there a function i missed? (-> h :k h)

16:48 lavokad: hi

16:48 PigDude: ,(let [h {:a 1 :b :a}] (-> h :b h))

16:48 clojurebot: 1

16:49 Bronsa: PigDude: that only works if your key is a keyword

16:49 PigDude: my key is a keyword

16:49 {blake}: Heyo! Trying to follow along with this doc page: http://clojuredocs.org/clojure_contrib/clojure.contrib.zip-filter.xml/xml-%3E

16:49 PigDude: but i am interested in how to do it if not also :)

16:50 {blake}: I can define the parse-str shown in the first step (03-05) but then the "def sometree" fails with "CompilerException java.lang.IllegalArgumentException: No matching method found: createXMLStreamReader for class com.sun.xml.internal.stream.XMLInputFactoryImpl".

16:50 Bronsa: PigDude: (get m (get m k)) is safer

16:50 lavokad: hi

16:51 maybe someone can try to answer this?

16:51 http://stackoverflow.com/questions/23898230/clojure-evaluation-process-the-readers-job-and-directly-passed-data-structures

16:51 would appreciate a lot

16:52 Frozenlock: Is there any good web interface for a repl? Like tryclojure, but better... :-p

16:52 Raynes: Frozenlock: Could you elaborate on what 'better' means.

16:52 I mean

16:52 I can repackage tryclojure without sandboxing if you'd like to host it on your machine ;)

16:53 Frozenlock: Raynes: I already have that

16:53 llasram: lavokad: Yes; and yes

16:53 Frozenlock: I mean able to select text

16:53 llasram: ,'(+ 1 2 3)

16:53 clojurebot: (+ 1 2 3)

16:53 Frozenlock: Showing arguments list

16:53 llasram: lavokad: And "programs directly generating data sent to the compiler" is essentially what Clojure macros are

16:54 Raynes: Frozenlock: https://github.com/chrisdone/jquery-console

16:54 Frozenlock: I'm bound by what this can do.

16:54 Fixing issues with tryclj means fixing issues with that.

16:54 I do not know of a 'better' tryclj that exists that does not use this library.

16:55 Frozenlock: Raynes: Hey I didn't say it wasn't good! I was just looking around to see if there was alternative.

16:55 Raynes: If you find one, let me know, because I'll happily steal their repl.

16:55 I take no offense.

16:55 Frozenlock: IIRC catnip was pretty sweet, but more complex

16:56 Raynes: Also did something completely different.

16:57 DomKM: Is the docstring for core.match/match inaccurate? It says "Take a vector of occurrences, vars. Clause question-answer syntax is like `cond`. Questions must be wrapped in a vector" https://github.com/clojure/core.match/blob/master/src%2Fmain%2Fclojure%2Fclojure%2Fcore%2Fmatch.clj#L1966-1976

16:57 Seems to work just fine without wrapping them in vectors. https://www.refheap.com/85986

16:58 amalloy: DomKM: i think you're encouraged to use a vector so that it's easier to add guards and stuff like that

17:07 DomKM: amalloy: I'm not familiar with guards but a quick search looks like they are a way of testing properties of values. Is that correct? Anyway, I'd expect docstrings to be as accurate as possible; maybe it's outdated.

17:16 technomancy: it just struck me how weird it is that clojure.core/name works on strings

17:16 ,(doc name)

17:16 clojurebot: "([x]); Returns the name String of a string, symbol or keyword."

17:16 technomancy: "the name String" ??

17:16 lazybot: technomancy: Uh, no. Why would you even ask?

17:17 technomancy: it's convenient but weird

17:17 amalloy: TimMc: just stumbled upon https://github.com/amalloy/clojopts/commit/b78e71f00c9afe5c29c0cc1dfee1553ef1404631 - "Replace separate with a juxty thing because heck yes"

17:17 technomancy: \m/

17:18 * gfredericks tries to figure out what the humps in technomancy's 'm' represent

17:18 technomancy: throwin' up the horns, mang

17:19 gfredericks: it's so obvious in hindsight

17:19 hiredman: technomancy is pretty metal

17:20 technomancy: clojurebot: juxt is pretty metal

17:20 clojurebot: Ack. Ack.

17:20 amalloy: oh my gosh. clojopts.util is like the predecessor to amalloy-utils. this is like the first stuff i ever wrote

17:20 i wonder if i can find out what my first commit on github is

17:27 lavokad: pls someone

17:27 http://stackoverflow.com/questions/23898230/clojure-evaluation-process-the-readers-job-and-directly-passed-data-structures

17:29 TimMc: amalloy: :-D

17:30 PigDude: thanks Bronsa

17:30 TimMc: lavokad: Looks like your question was already answered 20 minutes ago.

17:32 Also, begging is not very attractive.

17:33 amalloy: you just don't hang out with the right beggars

17:33 TimMc: It's true.

17:34 amalloy: Some day I'm going to rewrite clojopts to make it better suited to dynamic configuration.

17:35 amalloy: TimMc: you mean working with data instead of the clojopts macro?

17:36 clojopts desugars into something that's at least kinda usable, i think

17:37 looking at that file now i remember being *very* confused about how to write a macro that just wraps a function. there are numerous failed attempts just sitting there

17:38 TimMc: Yeah, I found the macro insufficient. It has been a while, but I have use for it again.

17:39 amalloy: TimMc: it looks like all the macro does is prevent you from having doing a bit of quoting and grouping: (clojopts "drake" (with-arg var v "Set a workflow variable.")) desugars to (clojopts* "drake" (with-arg ["var" "v"] "Set a workflow variable.")), which is all functions and values

17:39 cbp: If I have a function that returns two or more items, eg [1 2], [3 4], etc. And I want to turn it into a lazy-seq (1 2 3 4..) how do I do that?

17:40 gfredericks: so it returns [[1 2] [3 4] ...]?

17:40 cbp: yes

17:40 gfredericks: (apply concat items)

17:40 ,(apply concat [[1 2] [3 4] [5 6]])

17:40 clojurebot: (1 2 3 4 5 ...)

17:41 cbp: but that resolves the whole thing

17:41 amalloy: i'm actually impressed by how well clojopts has held up, given how little clojure i knew at the time

17:41 gfredericks: cbp: no it's lazy

17:42 cbp: Oh

17:42 silly me

17:42 thanks!

17:43 gfredericks: np

17:44 p_l: anyone got a macro to cleanup dispatch based on type-overloading (a'la Java)?

17:52 gfredericks: p_l: like...with protocols?

17:53 p_l: gfredericks: like "an interface that exports single method that dispatches on class of the first argument" :)

17:53 i.e. what I'm implementing on Clojure side

17:54 gfredericks: a protocol would be fine for that

17:54 ,(defprotocol IFoo (single-method [first-arg]))

17:54 clojurebot: IFoo

17:55 gfredericks: ,(extend-protocol IFoo Number (single-method [n] (inc n)))

17:55 clojurebot: nil

17:55 gfredericks: ,(single-method 41)

17:55 clojurebot: 42

17:55 p_l: gfredericks: I am not writing the protocol, I am implementing an existing Java Interface

17:55 gfredericks: ooooh

17:55 this makes more sense :)

17:55 so you're creating your own types to do this?

17:56 p_l: ended up currently with something that looks like this (defn transform ([this x] (transform1 this x)) ([this x y] (transform2 this x y)) ([this x y z] (transform3 this x y z )))

17:56 and yes, gen-class is involved

17:57 gfredericks: gen-class is the last-ditch way to make a type

17:57 the first ditch ways are

17:57 lavokad: TimMc: if you can't help or say anything usefull, u should shut up because nobody cares about moral comments

17:57 gfredericks: reify, defrecord, proxy, and deftype

17:57 p_l: gfredericks: And the only one that apparently works in my case

17:57 TimMc: lavokad: THat's the ticket, you're sure to get plenty of assistance now!

17:58 lavokad: TimMc: begging is different thing than asking for an answer to a question

17:58 gfredericks: p_l: why so?

17:58 lavokad: TimMc: i dont care, ill then have to read and understand myself

17:58 amalloy: gfredericks: the zeroth ditch way is to use a hashmap. probably not really relevant to this discussion, but fun to say

17:58 p_l: gfredericks: class that must be used by Java code, implementing Java interface, and usable as normal class in Java...

17:59 I suspect I could have managed with proxy and a factory method...

18:00 amalloy: p_l: you can usually manage by exporting an interface (written in java, say) that your clojure object should conform to; then provide a clojure function that creates instances of that interface. it's a little tedious for java consumers to call that function, but not actually difficult

18:00 and then once they have an instance, it feels like any other java class

18:00 p_l: amalloy: that's the proxy method I mentioned right now, yes

18:00 amalloy: well, reify

18:01 not proxy

18:01 p_l: amalloy: unfortunately, in progress of dealing with the interface, I found that the best thing to do to maintain data integrity was to subclass a java class

18:02 amalloy: are you sure you wouldn't be better off writing this in java? you want a named class that subclasses another class and dispatches based on types of arguments passed to it. that's all easy in java and all hard in clojure

18:03 p_l: amalloy: the really hard parts are way too annoying in Java :)

18:03 amalloy: so have the hard parts delegate to clojure via a less awful api

18:03 move the clojure/java boundary so that the java-friendly stuff is on the java side, and the rest is on the clojure side

18:04 gfredericks: doing class stuff isn't too hard with instance? and condp maybe

18:05 or a multimethod

18:05 p_l: gfredericks: yeah, going through multimethods right now

18:05 gtrak: just don't do what we did.

18:05 amalloy: technomancy: `lein deploy clojars` tells me to see `lein help deploy` for help with credentials; but that just sends me to `lein help deploying`. is there a reason i'm not sent to the right place to begin with?

18:05 p_l: gtrak: ?

18:06 gtrak: Nested protocols mirroring interfaces :-).

18:06 amalloy: or rather, is there a reason the second place isn't the right place, i guess

18:06 gtrak: to support a java-plugin system that falls back to clojure ones.

18:10 technomancy: amalloy: nope, looks like an oversight

18:11 owl-v-: what makes developers fear Oracle?

18:11 technomancy: amalloy: fixed

18:11 amalloy: thanks

18:13 gtrak: owl-v-: google lawsuit?

18:13 owl-v-: is that all?

18:14 oh, oracle won the game

18:14 lol java back-stab

18:15 gtrak: I think that's also why James Gosling left

18:15 TimMc: amalloy: And the last time I used clojopts seriously I didn't know nearly as much Clojure either. :-P

18:16 I think I probably didn't know how to dig underneath macros at that point.

18:16 amalloy: TimMc: every so often i find someone who actually uses clojopts, and i'm surprised

18:16 gtrak: err maybe not

18:16 amalloy: factual has got to be the primary user by far: they use it for drake

18:18 the thing that really bugs me about clojure.tools.cli (nee clargon) is that it rolls its own option parsing, instead of just using gnu getopt. that wouldn't be so bad if it were actually compatible, but instead you get a command-line environment that just seems foreign

18:19 technomancy: it doesn't do the "single-dash for long opts" atrocity does it?

18:20 turbofail: no

18:20 * technomancy lowers his shotgun

18:21 amalloy: not anymore

18:22 owl-v-: but google was violating the copyright

18:22 p_l: gtrak: dunno about language people, but from someone who interned in Sun's hw-related division around the time of takeover, the general outlook on employment of existing crew was glum even without moral issues :)

18:22 owl-v-: Except that nowhere except USA is API covered by copyright, and that's the first ruling, ever, to claim that API fell under copyright

18:22 technomancy: owl-v-: that's absurd

18:23 amalloy: technomancy: actually it looks like last december tools.cli started parsing things pretty normally. it's still hand-rolled, but seems fairly compatible

18:23 turbofail: implementation of an API being regarded as copyright infringement is insanity

18:23 * TimMc takes owl-v-'s toilet away, since the pipe fitting diameters were copied from a competitor.

18:23 p_l: owl-v-: except USA copyright law as usual forgot to put down important things in the sheeple-like run towards turning copyright around from its purpose

18:24 TimMc: don't forget to take away the house because it had round pipes

18:25 arrdem: TIL standard == copyright.

18:26 p_l: arrdem: the ruling about API essentially meant that the standard is copyrightable...

18:26 owl-v-: wait, i thought oracle won the game.

18:26 p_l: owl-v-: it won an appeal

18:26 and lost the game for everyone in USA in exchange, including possibly themselves

18:26 owl-v-: how about final boss?

18:26 arrdem: owl-v-: they did win that round with a bull ruling that likely will not stand in a 2nd appeal.

18:27 owl-v-: is it still on-going?

18:27 p_l: owl-v-: it's not final

18:27 owl-v-: omg

18:28 p_l: they got it to ignorant/"helpful" court for the appeal, so I've got yet another reason to avoid USA ;)

18:28 arohner: is there a library that has a replacement for clojure.contrib.repl-utils/show ?

18:32 amalloy: arohner: clojure.reflect is less friendly but exposes more information

18:32 well. it's less human-friendly, much more computer-friendly

18:32 arohner: yeah

18:32 I just want a simple user-friendly thing for REPL debugging

18:32 and it's irritating pasting (defn show [] ...) into every project

18:33 amalloy: arohner: well, don't do that. put it in a library

18:33 owl-v-: is that why google is holding back dalvik development?

18:33 arohner: amalloy: yes, which is why I was asking if there was a library first :-)

18:34 technomancy: arohner: there are a few ports of the swank inspector

18:34 amalloy: oh yeah, i always forget about the swank inspector

18:34 {blake}: I need to walk through this doc example but I can't get past the "def sometree": http://clojuredocs.org/clojure_contrib/clojure.contrib.zip-filter.xml/xml-%3E

18:35 owl-v-: so.. what happens if oracle wins? what changes.

18:36 technomancy: owl-v-: most software becomes illegal in the US

18:36 which is already the case

18:36 but now it's illegal on copyright terms as well as patent terms, woooo

18:36 p_l: including oracle's

18:37 owl-v-: including OpenJDK?

18:37 arrdem: if Oracle tries to shut down the OpenJDK project they will be shooting themselves in the foot with a Davy Crocket.

18:38 p_l: owl-v-: OpenJDK might be safe from Oracle copyrights, but it would be open to other claims because, for example, they implemented in a support library on some platform an API that wasn't theirs...

18:38 owl-v-: what happens to clojure then, if oracle wins the game?

18:39 p_l: owl-v-: to clojure itself probably nothing

18:39 amalloy: technomancy: i have no idea what pgp key i used to push to clojars on my previous computer, and am setting it up anew here. should i just replace the old key at https://clojars.org/profile with a new one, or do something else?

18:40 owl-v-: then clojure is locked on proprietary platform i guess...

18:40 technomancy: amalloy: yeah, that's probably best

18:40 owl-v-: it's already impossible to fork openjdk in the US

18:40 because of patents

18:40 TimMc: arohner: https://github.com/timmc/handy/blob/master/src/org/timmc/handy/repl.clj

18:40 owl-v-: then somebody should fork clojure

18:41 arohner: TimMc: thanks!

18:41 TimMc: (show object) or (show Class)

18:41 technomancy: owl-v-: that doesn't make any sense

18:41 * p_l currently runs clojure on proprietary but not Oracle's VM

18:42 technomancy: owl-v-: a port is not a fork

18:42 TimMc: Oh huh, (show nil) gives an NPE. Oh well.

18:42 owl-v-: they can literally put price tags on every machine if they want by simply changing license terms.

18:42 technomancy: owl-v-: no they can't

18:43 they can't change the license terms of openjdk 8

18:43 owl-v-: but it has java api

18:43 right?

18:43 technomancy: it's already licensed as free software

18:43 the worst they could do is lock out future improvements post-8

18:44 owl-v-: locking future improvement means death of software

18:44 technomancy: sure, in the long term

18:45 it's still so far ahead the competitors that it would be possibly decades before any other runtime could catch up

18:45 possibly a decade, rather

18:45 owl-v-: x-jvm engineer should work on llvm or something else-vm

18:47 hiredman: llvm really would have saved a lot of confusion if they had left out vm

18:47 technomancy: "it's the zeromq of virtual machines!"

18:48 p_l: hiredman: confusion among people who don't have even basic grounding involved in using something like LLVM...

18:48 hiredman: hey, it's a vm, we should run on it!

18:49 technomancy: I think there's a dilbert about that

18:50 cbp: wait gfredericks i think i asked the wrong question

18:51 p_l: your OS is a VM, a lot of CPUs kinda count as VM (definitely in combination with modern firmware on many platforms), etc.

18:51 owl-v-: if clojure is locked up in proprietary JVM then clojure is not so open after all.

18:51 * gfredericks is waiting

18:51 p_l: owl-v-: there's more than Oracle's JVM

18:51 cbp: I have a fn that returns a lazy-seq of ((a b) (c d e) ..) and want to turn it into a lazy-seq of (a b c d e ..)

18:52 apply will resolve the lazy-seq

18:52 gfredericks: cbp: still sounds like apply concat

18:52 what makes you say that?

18:52 cbp: ,(take 10 (apply vector (range)))

18:52 clojurebot: #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>

18:52 gfredericks: cbp: that's vector not apply

18:53 ,(take 10 (apply concat (repeat '(1 2 3))))

18:53 clojurebot: (1 2 3 1 2 ...)

18:53 gfredericks: cbp: ^ called apply with an infinite seq

18:54 storme: Hello

18:54 gfredericks: storme: hello

18:55 storme: Question, if I have a hash like so: {:b 4 :c 3 :e 7}; what would be the best way to pick out the key with the lowest value?

18:55 gfredericks: ,(let [m {:b 4 :c 3 :e 7}] (key (apply min-key val m)))

18:55 clojurebot: :c

18:56 technomancy: clojurebot: why the long face?

18:56 clojurebot: excusez-moi

18:56 storme: gfredericks++

18:56 Jaood: does lein uberjar handles jar conflcts?

18:56 amalloy: (inc technomancy)

18:56 storme: thanks!

18:56 lazybot: ⇒ 109

18:58 arrdem: (inc gfredericks)

18:58 lazybot: ⇒ 64

18:58 technomancy: Jaood: by default it's last-one-wins, but you can change it

18:59 gfredericks: do chatbots on other planets respond to foo++?

18:59 TEttinger: gfredericks: yes

18:59 {blake}: (inc ++)

18:59 lazybot: ⇒ 1

18:59 gfredericks: I grew up here so this is all I know

18:59 technomancy: in #emacs the bot claims to track points but just emits random numbers when you try to query it

19:05 amalloy: #emacs is a weird place

19:05 arrdem: #emacs is seldom on topic

19:05 cbp: ,(defn foo [i] (lazy-seq (do (println i) (cons (list i) (foo (inc i))))))

19:05 clojurebot: #'sandbox/foo

19:05 cbp: ,(def x (foo 0))

19:05 clojurebot: #'sandbox/x

19:05 Frozenlo`: #emacs is fun. They talk about all-dressed pizza :-p

19:05 cbp: erm

19:06 arrdem: cbp: wat

19:06 cbp: well that prints the first 3 numbers on my repl

19:06 owl-v-: i didn't know mono uses llvm o_O

19:06 amalloy: Raynes: feature request: lazybot randomly adds or subtracts up to a thousand from karma when it's queried

19:06 gfredericks: cbp: concat is slightly not lazy

19:06 amalloy: i look forward to people typing $karma amalloy a hundred times to get decent error bars on it

19:06 gfredericks: it will realize the first 3 or so elements

19:06 cbp: gfredericks: aha!

19:06 amalloy: cbp: no way that prints anything in your repl

19:06 if you used concat it might

19:07 cbp: err

19:07 ,(def x (apply concat (foo 0)))

19:07 clojurebot: 0\n1\n2\n3\n#'sandbox/x

19:07 gfredericks: cbp: related: http://dev.clojure.org/jira/browse/CLJ-1218

19:07 cbp: ^ I meant that

19:07 Well

19:07 Do I have to write my own lazy concat?

19:08 Because each recursion of the lazy seq does a network call

19:08 gfredericks: that ticket has a fully lazy version that you could probably use

19:08 cbp: gfredericks: thanks

19:08 gfredericks: it's mapcat instead of apply concat but that's probably what you want anyways?

19:09 oh wait

19:09 no it isn't

19:09 it's exactly what you already wanted, just without the apply

19:09 hiredman: obviously you should use a reducer instead

19:10 gfredericks: hiredman: I'm going to interpret this as irony.

19:10 hiredman: it may or may not be

19:11 gfredericks: clojurebot: it |may or may not be|

19:11 clojurebot: Titim gan éirí ort.

19:11 hiredman: I think reducers are much better for io kinds of things than lazy seqs, and I don't think clojure.core.reducers/mapcat has the realizing too many bits problem

19:12 gfredericks: I don't think I knew that reducers + IO made any sense

19:12 cbp: ^

19:12 hiredman: I have some literature for you

19:12 http://ce2144dc-f7c9-4f54-8fb6-7321a4c318db.s3.amazonaws.com/reducers.html

19:15 apricots: i created a nrepl middleware and it works in my nprepl project’s dir, but when i reference it from ~/.lein/profiles.clj it can’t find it even though i’ve added it as a dep in the :plugins list. is there something I have to do to “install” my nrepl middleware?

19:16 hiredman: on the other hand, rewriting every is very tedious as is reprogramming people from lazy seqs to reducers

19:16 everything

19:17 amalloy: hiredman: i don't think "The reduce operation as defined by the reducers library makes no promises about the order in which elements will be reduced" is true at all

19:17 it promises to go in the same fold-left order as clojure.core/reduce

19:18 it's the fold operation that makes no such promise

19:18 owl-v-: lol clojure-py and ClojureCLR

19:19 hiredman: amalloy: the reduce operation as an abstract notion doesn't

19:19 arrdem: owl-v-: why lol?

19:20 gfredericks: hiredman: sweet

19:21 owl-v-: arrdem: i didn't expected those

19:21 i'm not sure ClojureCLR is compatible with mono

19:24 Jaood: technomancy: thanks

19:25 owl-v-: ClojureCLR is on the front page of clojure.org ;)

19:28 owl-v-: Jaood: nice, but i don't have MS Windows

19:29 noprompt: ,(gensym "+")

19:29 clojurebot: +27

19:29 noprompt: ,(gensym "-")

19:29 clojurebot: -52

19:30 danielcompton: What's the lein tool that runs eastwood + a bunch of others as well?

19:32 noprompt: i'm not sure where the bug is but the cljs repl reports (gensym "+") will display that as 27 and not +27.

19:32 s/will display that//

19:32 danielcompton: Got it, it's checkall

19:35 technomancy: danielcompton: you can compose an alias to run a bunch of tasks with do

19:36 danielcompton: so I would run lein do checkit ?

19:36 owl-v-: dalvik is outdated and android will change... maybe use V8 as main programming language?

19:36 we have clojurescript :-)

19:37 Frozenlo`: doesn't cljs require clojure to compile to js?

19:37 arrdem: Frozenlo`: it does. neither clj nor cljs is self hosting out of the box.

19:38 noprompt: cljs will be self-hosted in the distant future. i hope anyway...

19:39 tools.analyzer ftw

19:41 arohner: what does "Can't call public method of non-public class" mean?

19:42 amalloy: arohner: you can't use reflection to call methods on a non-public class, even if those methods are public and are specified by a public interface

19:42 you can fix it by type-hinting the thing you're calling a method on as an instance of whatever interface

19:43 arohner: thanks

19:45 danno: I just learned I can name stuff with a prime (')

19:45 (def x' 10)

19:45 Any side effects I should know about doing that?

19:46 arohner: amalloy: thanks, that was the last bug. Now I can read audio out of my rocksmith guitar cable into clojure!

19:46 amalloy: you may be mistaken for a mathematician

19:46 also your code won't work in versions of clojure before 1.3

19:47 hiredman: danno: that is not prime, that is single quote

19:47 danno: Cool, screw the the <1.3 crowd anyway

19:47 hiredman: there is an actual unicode prime mark, and you can use that too

19:47 danno: kidding

19:47 amalloy: well, that's a reasonable attitude to have, danno. even old curmudgeons like me are on newer versions than that

19:48 danno: hiredman: good call, points for exactness, thanks

19:48 hiredman:

19:48 arrdem: ,(def foo′ 3)

19:48 clojurebot: #'sandbox/foo′

19:48 arrdem: ^ foo prime

19:53 danno: thanks all

20:05 danlamanna: lost on require/use/import - i essentially want to import edu.stanford.nlp.ie.crf.CRFClassifier.main (static method) as train-model

20:06 which should i be using? (this is from a local jar i put on :resource-paths in my project file)

20:09 technomancy: danlamanna: you can't alias classes, only namespaces

20:12 gfredericks: danlamanna: you want (:import edu.stanford.nlp.ie.crf.CRFClassifier) and then (CRFClassifier/main)

20:18 hiredman: this literature might be about to change my life

20:21 rasmusto: ,((fn [& _] 'foo) 'blah)

20:21 clojurebot: foo

20:21 hiredman: cool

20:26 rasmusto: oh, constantly is a thing

20:27 gfredericks: ,(((constantly constantly) constantly) constantly)

20:27 clojurebot: #<core$constantly$fn__4085 clojure.core$constantly$fn__4085@197fe9>

20:27 gfredericks: ,(take 10 (iterate constantly constantly))

20:27 clojurebot: (#<core$constantly clojure.core$constantly@1ed13a3> #<core$constantly$fn__4085 clojure.core$constantly$fn__4085@1a4500a> #<core$constantly$fn__4085 clojure.core$constantly$fn__4085@82fff0> #<core$constantly$fn__4085 clojure.core$constantly$fn__4085@711710> #<core$constantly$fn__4085 clojure.core$constantly$fn__4085@a13863> ...)

20:27 rasmusto: ,(reduce constantly (repeat constantly))

20:27 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/constantly>

20:28 rasmusto: darn

20:28 amalloy: ITYM (reduce (constantly constantly) (repeat constantly))

20:28 rasmusto: hahha

20:28 so constantly is useful for one thing in my code, where is it used otherwise?

20:29 brb, grepping clojure.core

20:29 gfredericks: other places in other peoples' code

20:29 rasmusto: gfredericks: ah, okay

20:29 amalloy: anytime you've got a function that's "too general" for your specific case

20:30 like, map lets you pass a function to decide what each value should be. but maybe you want it to always be the same thing: then you can use (map (constantly 'whatever) xs)

20:30 rasmusto: ahh, right

20:30 which is exactly how I'm using it. I have a high-order function that takes a "function" that might be constant

20:30 :)

20:31 gfredericks: also useful for stubbing functions with with-redefs

20:31 ,(with-redefs [+ (constantly 42)] (map + [1 2 3] [4 5 6]))

20:31 clojurebot: (42 42 42)

20:32 amalloy: flatland.useful.fn used to have an entertaining use of constantly

20:32 we have this (vaguely gross) policy that if you pass something that could be a function but isn't, we wrap it in (constantly) for you

20:33 so what it currently looks like is https://github.com/amalloy/useful/blob/develop/src/flatland/useful/fn.clj#L25, but it used to look like (fix x (! ifn?) constantly)

20:33 rasmusto: hm, I could do that instead of dropping (constantly myfn) into like 10 places

20:35 gfredericks: amalloy: duck wrapping!

20:35 rasmusto: (constantly 'turducken)

21:26 owl-v-: installing SBCL

21:33 cbp: owl-v-: is everything ok?

21:34 p_l: cbp: sounds like bad case of locked-in panic

21:39 owl-v-: dang! ROS has roslisp >> http://wiki.ros.org/roslisp

21:40 TEttinger: owl-v-: you're doing robotics stuff?

21:40 owl-v-: java is not there because... well, not an open source (code and license).

21:40 TEttinger: openjdk?

21:41 owl-v-: yes, robotics is my main target, not pc

21:41 openjdk will die as soon as oracle wins the game

21:41 TEttinger: yeah, I would imagine SBCL might be a bit better for that. clojure uses a lot of memory usually

21:42 owl-v-: ah, but that JVM...

21:42 cbp: I'd go for racket =)

21:43 owl-v-: isn't racket slower than SBCL?

21:43 p_l: probably

21:43 but those two implement different languages

21:44 owl-v-: mm, small memory foot-print...

21:44 arrdem: sbcl has a really good compiler... plenty of tricks I hope to steal :D

21:45 owl-v-: i don't know... clojure-sbcl maybe?

21:45 arrdem: owl-v-: meh it could be done but why

21:45 p_l: lol @ "small memory footprint" and "SBCL" without a negation

21:45 arrdem: p_l: br0 jvm looses hard sometimes. pick your battles :P

21:46 owl-v-: i only use subset of clojure, so it would be easy to migrate to sbcl

21:46 p_l: still can suck hard when you spinup poor laptop's disk to load 140 MB executable :P

21:47 arrdem: if 140MB is a problem, then you're looking in the wrong place with lisps.

21:47 bust out that K&R C book and like it

21:47 owl-v-: where does 140MB comes from?

21:47 p_l: arrdem: just for comparison - CCL routinely generates 2~4x smaller images, and LW has no problems making full application take less than 10M

21:47 owl-v-: sbcl?

21:48 p_l: owl-v-: that was for a full application

21:48 SBCL itself... let me check

21:48 arrdem: p_l: my CL experience is limited at best, I decided rapidly that Scheme was a dead end and that the CL community was cruftier than I was willing to deal with so I ran for Clojure when a mate suggested it.

21:49 p_l: 45MB for "naked" SBCL core on amd64

21:49 * arrdem checks out an uberjar

21:49 p_l: the one that I normally load takes 80M of dynamic space after load

21:49 owl-v-: only 45MB?

21:51 if i get minnowboard-max ddr3-2GB ram then i should be fine :-)

21:51 if beaglebone-black, i should still be ok

21:52 p_l: well, there's new port for ARM, but I haven't tested it

21:52 should take ~25 MBs of RAM, due to 32bit pointers

21:52 owl-v-: why not 64bit pointers?

21:52 if 64bit processors

21:53 oh, minnowboard-max is x86 atom board

21:53 64bit

21:55 finished installing sbcl/1.1.18

21:55 lol 51M

21:56 p_l: http://bpaste.net/show/308485/

21:57 maybe I should setup precompiled core for QL...

22:00 cbp: I thought sbcl 1.2 was just released?

22:00 p_l: cbp: I didn't bother to update for some time :P

22:00 owl-v-: yes

22:00 p_l: and yes, 1.2 is quite fresh

22:01 owl-v-: no bug fix (if exists)

22:01 p_l: as in I think I observed last bug squashing before release yesterday or two days ago

22:01 owl-v-: i mean bug on 1.2

22:02 p_l: I meant "last bug squashing before 1.2.0 release so that arm support could go in" :)

22:02 owl-v-: lol strong ARM

22:02 arrdem: heh

22:04 owl-v-: p_1: what's quick lisp u posted?

22:04 this? >> http://www.quicklisp.org/beta/

22:04 p_l: http://www.quicklisp.org/

22:04 yes

22:04 also, fix your font

22:05 owl-v-: fong?

22:05 font?

22:05 oh, 1 -> l?

22:05 p_l: ok

22:07 amalloy: p_l: fix your nick? i mean, it'd be nice to have a font where it's easy to tell the difference, but you know it's common not to

22:07 p_l: amalloy: it's less about the nick, tbh - 1/l mistakes in code are much funnier :)

22:11 owl-v-: amalloy: p_l: no, it's just my input font and screen font are different

22:14 lol sbcl worst case is slower than clojure? >> http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?test=all&lang=sbcl&lang2=clojure&data=u64q

22:14 x3 slower and x3 more code

22:15 yedi: prismatic using om in production, pretty cool

22:18 p_l: owl-v-: looks like bad typing in few places

22:23 eraserhd: why is aget so slow?

22:29 p_l: owl-v-: http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&lang=sbcl&id=2 <--- in this worst case benchmark, you can see compiler complaining about types ;)

22:29 justin_smith: eraserhd: what type of array? if it is an array of Object you could have a reflection issue

22:30 amalloy: eraserhd: if you don't type-hint the array then aget uses reflection

22:30 regardless of what type of array it is

22:32 p_l: type erasure makes reflection necessary in absence of hint, iirc

22:36 justin_smith: p_l: well "type erasure" is a javac thing, and since clojure isn't using javac for this stuff, it's just the issue that the array itself is untyped

22:37 so you need to provide that info out of band somehow

22:38 yedi: is there a function that does this: #(if (% username) (disj % username) (conj % username)) where % is a set

22:42 owl-v-: p_l: i wonder what's FIXNUM is...

22:46 bbloom: http://clhs.lisp.se/Body/t_fixnum.htm

22:47 generally, a fixnum is an integer that fits in to a pointer, where the highbits being set indicate a dynamic object pointer vs a fixnum

22:48 explaination in the java context here: https://blogs.oracle.com/jrose/entry/fixnums_in_the_vm

22:53 owl-v-: so sbcl was slow because of std-output?

22:54 hellofunk: is there a reflective technique by which you can tell if a particular defrecord instance implements a particular protocol?

22:58 owl-v-: 11th case was omitted because bad output :-(

22:59 guns: hellofunk: see clojure.core/satisfies?

23:04 p_l: owl-v-: SBCL was slow because it essentially did reflection on + and - due to improper type derivation

23:04 owl-v-: p_l: i think this is the worst case, which is 10th case >> http://benchmarksgame.alioth.debian.org/u64q/program.php?test=knucleotide&lang=sbcl&id=4

23:05 yes, k-nucleotide

23:05 p_l: Java 'long' is plain dead simple, meanwhile SBCL's fixnum on 64bit is (unsigned-byte 62) (2 bits less than java). In this case, Clojure calculated with primitive, while SBCL constantly checked if it wasn't fed a BigNum :)

23:05 owl-v-: that's the last one

23:06 p_l: yeah

23:08 owl-v-: p_l: so the output was ok, it just checks number too many times?

23:13 p_l: for the binary-trees thing

23:13 k-nucleotides I'm not in shape to decode right now

23:13 and no idea about the broken one

23:22 owl-v-: lol optimization >> (declaim (optimize (speed 3) (debug 0) (space 0) (safety 0)))

23:33 technoma`: owl-v-: FWIW racket has had JIT support on ARM for longer than SBCL, so I wouldn't be surprised if it's ahead in performance

23:33 owl-v-: though making assumptions like that without data is silly

23:34 owl-v-: *shrug* racket is quite big because it has stuff like graphical interface

23:35 technoma`: racket/base leaves all that stuff out

23:35 it's about 700kb for a standalone executable

23:35 owl-v-: ah.

23:35 osx version is 333.3mb

23:36 technoma`: right; that's the full development environment

23:37 p_l: technoma`: the question is how well Racket does type derivation and such (and whether it can do hotspot-style optimizations in JIT)

23:37 owl-v-: racket and sbcl >> http://benchmarksgame.alioth.debian.org/u64q/racket.php

23:38 much lesser code hm..

23:39 technoma`: p_l: I'm actually more curious what "SBCL supports ARM" means. it seems likely that it means the interpreter works on ARM, which probably means they haven't optimized it anything close to what they've got for x86, but I could be wrong.

23:39 owl-v-: that's an x86 comparison

23:39 p_l: technoma`: the interpreter is not considered a port to anything :)

23:40 technoma`: SBCL does *NOT* work without native code generation

23:40 technoma`: p_l: huh, I didn't know that

23:40 p_l: (it's quite simply impossible for the runtime to operate in other way than compiled)

23:41 there's an evaluator that barely anyone remembers it exists, is by general consensus considered to be buggy, and it depends on the compiled code anyway (as it can only be used to run user's code, not internals)

23:42 it's the funny effect when your "interpreter" is written in the language it interprets

23:43 owl-v-: lol without regex, sbcl looks too many codes

23:43 racket has regex

23:46 p_l: SBCL doesn't do much in terms of contribs. Also, as can be seen, CL similarly to clojure starts to get full of type hints when you start optimizing :D

23:48 http://benchmarksgame.alioth.debian.org/u64q/program.php?test=mandelbrot&lang=sbcl&id=1 <--- though this is overkill - the code adds new instructions to compiler (SSE intrinsics)

23:49 (and the code still has compiler notes saying it can't optimize due to wrong or unclear types...)

23:49 amalloy: bbloom: usually lowbits, not highbits, right?

23:49 not that it matters much

23:50 owl-v-: sbcl is like 'not so much in ready to market'

23:51 p_l: owl-v-: it's just a compiler (that has been around longer than Racket existed). Rest is to be loaded from 3rd party libraries

23:52 owl-v-: there is 3rd party?

23:52 kwertii: Anyone here use friend-oauth2? I added the workflow to my app as per the example code, but it redirects unauthenticated users to "/login" rather than to the 3rd party auth provider. What am I doing wrong?

23:53 p_l: owl-v-: that's the difference between Scheme and Common Lisp, yes, we have libraries that are compatible between implementations

Logging service provided by n01se.net