#clojure logs

2014-12-04

01:03rritochIs it possible to copy a var from one namespace to another in such a way that any bindings on that var will automatically appear on both namespaces?
01:05rritochFor example, creating a dynamic var in a library, and also linking that var to the clojure.core namespace to make it available globally.
02:29dysfunrritoch: have you tried interning the var?
02:30dysfun,(def :^dynamic t1 "foo")
02:30clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: :>
02:30dysfun,(def ^:dynamic t1 "foo")
02:30clojurebot#'sandbox/t1
02:31akkadirc support for eval is nice :P
02:32dysfunyeah, but i'm going to make a few mistakes figuring out how it's going to work, so i've moved to another terminal tab :)
02:32rritochdysfun: No I haven't tried, but it does seem like a good way of doing it. Is there an upgrade-safe way of interning vars?
02:33dysfun'upgrade-safe'?
02:33rritochdysfun: Upgrade safe means that it doesn't rely on undocumented features of clojure that are subject to change in future versions.
02:33rritochdysfun: In other words it "should" work in all future versions of clojure
02:34dysfunwell i don't think the semantics of intern are going to change any time soon, having read the clojure source code
02:34rritochdysfun: If not, I'm OK with that, but keeping code upgrade safe when possible is ideal.
02:34dysfunwell if you want to be sure, i'd recommend not doing that
02:35dysfunif you want values to be visible elsewhere, either put them there to start with (intern is fine for that) and then bind those instead
02:35dysfunor use an atom or something
02:35dysfunbut e.g. noir doesn't try to solve this, you just import the dynamic var from their namespace and use it in all the modules you need to
02:36dysfunhttp://www.webnoir.org/autodoc/1.2.1/noir.request-api.html
02:36cflemingHi everyone. A colleague of mine has a very strange problem with records.
02:36cflemingRefheap: https://www.refheap.com/94392
02:37cflemingWhat is happening is that a different class is returned depending on whether he uses the class constructor (TestRecord.) or the constructor function (->TestRecord)
02:38cflemingThe classloader is also different - the constructor function version uses a dynamic classloader and the class constructor version uses the system classloader.
02:39dysfunthat's some odd but easily explained behaviour. what i'm not seeing is why this matters
02:39cflemingdysfun: The record problem, you mean?
02:39dysfunclojure does a lot of clever things involving rather a lot of classloaders
02:40dysfunyes, what is the actual problem?
02:40dysfunis it you are having difficulty testing the identity?
02:40cflemingIf you look at the refheap, only one of the records correctly dispatches the multimethod
02:40dysfunooh i get it now
02:41cflemingPlus equality will fail, polymorphism won't work...
02:41cflemingI don't understand where the dynamic classloader is coming from.
02:41dysfunokay, perhaps i can explain that to you
02:41dysfunone really useful thing in clojure is being able to redefine things
02:42dysfununfortunately owing to jvm limitations, you just can't
02:42cflemingYup
02:42dysfunbut you can take a classloader from before something was defined and use that, whereupon it doesn't exist
02:42dysfunclojure allocates a new classloader to every top level expression
02:43cflemingBut all those classloaders should delegate to the system classloader, right?
02:44dysfunshould they? then you wouldn't be able to load something twice
02:44dysfuni mean the loading mechanism is certainly the same, but the need to be able to redefine stuff is great
02:44cflemingThey have to, otherwise you would end up loading all the clojure classes in every classloader.
02:44cflemingSymbol, Keyword, PersistentHashMap...
02:45dysfunclassloaders work as a tree
02:45cflemingRight.
02:45dysfunso a classloader is almost like a new interpreter. as far as namespacing goes, it pretty much is
02:45dysfunand obviously you could limit it to loading from a specific jar etc.
02:46cflemingOnly if everything is loaded into that classloader
02:46dysfunah, that's where clojure does magic
02:46cflemingWhich it can't be - those base level classes aren't reloaded on every expression.
02:46dysfundon't ask how it works, i'm not 100% on it but current understanding says it mostly works because clojure does value semantics on everything
02:47cflemingIn this case I think I need to actually know how it works to figure out what's going on.
02:47dysfunin that case, you'll need to find someone with more understanding of the guts of clojure than me, or to read the source
02:47dysfunif you do figure it out, i'd love to know the answer
02:48cflemingOk, I'll research around a bit.
02:48dysfunbut hopefully you understand a bit more now
02:49cflemingHere's hoping - I can't find any information about this
02:50rritochdysfun: What if he binds the app classloader to Compiler/LOADER ? It seems like ->Method is using RT, so if it does than binding Compiler/LOADER should prevent clojure from creating a new classloader, right?
02:50cflemingJoy of Clojure doesn't even contain the word classloader. Programming Clojure only mentions it once.
02:51cflemingHere's what I don't understand:
02:51cflemingI'm assuming that there must be a parent classloader that all these per-expression classloaders delegate to.
02:52dysfunrritoch: that seems like a reasonable workaround, i haven't tried it
02:52dysfuncfleming: do you understand how the classloader system works?
02:52cflemingIn this case, it looks like the system classloader, because that's where the TestRecord class ends up being defined.
02:52cflemingdysfun: Yes I do.
02:52cflemingAt least, I do in Java - I'm not sure how Clojure uses classloaders.
02:52dysfunwell, i'm talking about the java bit
02:52cflemingYes.
02:53dysfunabout how delegation works, in particular
02:53cflemingYep.
02:54cflemingSo, in this case the TestRecord class ends up being defined in the system classloader, I'm assuming because that way it will be available to all future expressions in this file, even if they're using fresh classloaders.
02:54dysfunokay, try running that at the repl
02:54cflemingWhat I don't know is why the class later gets redefined in a different classloader, presumably a per-expression one.
02:55dysfuni get both as DynamicClassLoader
02:55dysfunand both as TestRecord
02:55dysfunare you AOTing, perchance?
02:56cflemingYes, this is with lein compile
02:56dysfunright, turn off AOT on that namespace and try again
02:56cflemingI'm sure that will work.
02:56cflemingWhat I'd like to understand is why the other doesn't.
02:57dysfunwell, see if it works first :)
03:01cflemingYup, definitely works :-)
03:01dysfunwell that's a start. now let's figure out why :)
03:01cflemingInterestingly, I see the same dynamic loader both times.
03:01dysfun"top level expression"
03:02dysfunoh, i read those as being nested, they are separate
03:03dysfuni don't know. it's not really my area (although i have some horrible classloader/securitymanager stuff on the horizon which will require me to learn more...)
03:04cflemingRight, they're separate.
03:06cflemingSo, I can get the dynamic classloader of that class. I then navigated through its parent hierarchy - I have to go up 6 levels (!!!) of dynamic loaders before I get to the AppClassLoader
03:06dysfunclassloaders are cheap
03:09cflemingOk, so DCL uses the standard delegation model.
03:10cflemingIf that's the case, then in the AOT example, if the class is defined in the system classloader, how does it ever get loaded into a DCL?
03:15dysfunis it defined in the system classloader though?
03:15dysfuni suspect it's defined further down the chain
03:15dysfunbecause i know you can in fact even load multiple clojure versions on the same jvm in parallel
03:15dysfun(see classlojure)
03:17rritochdysfun: I tried the binding trick, it doesn't work, if I require from repl both use the application class loader, it is only during lein compile that this dynamic classloader gets generated.
03:18cflemingYes, it is - see this line: ; .. #classloader.core.TestRecord{:foo nil} sun.misc.Launcher$AppClassLoader@288d539f 1971347490
03:19dysfunno, that just means it's being run on an AppClassLoader instance
03:19dysfunwhich isn't the same thing as the root classloader
03:20cflemingRight, I shouldn't have said the system class loader - what I mean is a standard classloader outside the DCL chain.
03:21dysfunis the whole thing done through subclassing? isn't it possible there's something that drives a classloader?
03:21cflemingI suspect it's being loaded there due to AOT, which is fine. What I don't know is why there's ever another instance of the record class defined
03:22dysfunoh, i may be able to explain that
03:22cflemingIn fact, there's a bug which suggests that it's not - http://dev.clojure.org/jira/browse/CLJ-371
03:22dysfunAOT generates a stub class, not the full thing
03:22cflemingWell, it is, but the AOT'ed one will always be found because it's always in a parent CL
03:22cflemingYou're talking about gen-class though, right? Not classes generated from records?
03:24dysfuni'm not sure any more. i tend to always use the map->record form
03:25dysfunthat and ->record are certainly workarounds
03:27cflemingExcept it's not, really - the multimethod dispatch doesn't work.
03:27cfleminginstance? won't either.
03:27dysfunyour example shows it working?
03:28dysfunsorry if i'm being thick, it's still early here and i haven't finished my coffee, but it looks like it's working in the ->record case
03:29dysfunanyway, in general, AOT makes bad things happen which is why you should avoid it where possible
03:31cflemingSadly that's not always an option.
03:31dysfunyeah, i know :(
03:31cflemingHere's what seems to be happening
03:32cflemingI think that the AOT compiles the class, and then it presumably gets loaded into the AppClassLoader when the ns is loaded.
03:33cflemingHowever the Compiler, whenever it sees a "new" expression uses LOADER.deref(), which is always a DynamicClassLoader
03:34cflemingActually, wait - I think this is the stub you were talking about, my apologies, it looks like it does this in more cases than just gen-class
03:38echo-areaI see that the version number of core.async contains "alpha". Is it now suitable to use it for production?
03:50dysfuncfleming: heh
03:50dysfunecho-area: that depends entirely upon your attitude to risk. in the sense of APIs may change, bugs may be fixed later
03:53echo-areadysfun: I have no experience using it yet, and so cannot be sure what kind of issues I would have. And my application is very serious. I think I might not put it into production at the moment.
03:53echo-areadysfun: Thanks
03:54dysfunecho-area: multithreaded programming in clojure is practically a joy, i'm reluctant to leave behind those niceties to write core.async
03:54szymanowskiHi, i'm struggling a bit here, i've got A: a lazy-seq of indexes, and B: a coll (possibly lazy-seq), i'm trying to write a fn that select all the indexes present in A from B, could anyone give me an hint for doing that properly?
03:55echo-areadysfun: Sure, and I am using agents by now.
03:55dysfunagents rock :)
03:56rritochI'm not sure if this helps or not, but I found the source of the dynamic class loader. It seems TestRecord is interned into the namespace as the symbol TestRecord, but when using dot notation (TestRecord.) it doesn't use the interned class which seems to be a bug
03:57rritochWhen I added (println (pr-str (.getClassLoader TestRecord))) to the source file, it outputs the same dynamic class loader that is produced by ->TestRecord
03:58cflemingrritoch: Right, I'm debugging this now. NewExpr always uses maybeClass, which is basically Class.forName()
03:59cflemingrritoch: However when compiling a deftype form, it always calls LOADER.deref() which gives a DCL.
04:02cflemingrritoch: What I don't understand now is how (TestRecord.) works in a normal non-AOT REPL.
04:03dysfunthat clojure bug pretty much explains it
04:05cflemingNot really, it just says "because classloaders"
04:05cflemingIt gets weirder.
04:07cflemingIf I start a non-AOT'ed REPL, and instead of using nREPL's load-file I do a (require 'classloader.core) from the REPL, both records have their class in the AppClassLoader
04:09rritochAnyhow, I need to give up for now... I tried (.importClass *ns* 'TestRecord (class (TestRecord. nil))) which I really thought would lead to ->TestRecord using the app class loader, but it didn't
04:10cflemingHmm
04:10cflemingrritoch: Anyway, thanks for looking at it
04:10cflemingI need to give up for the moment now too.
04:10rritochIt seems that when it comes to classloaders, clojure will do the exact opposite of what you want it to do, every time.
04:10cflemingrritoch: Certainly it's not very predictable.
04:11rritochcfleming: If your using gen-classes, I've been able to deal with some of this classloader issues by extending classes with static initializers
04:12cflemingrritoch: Yeah, this is actually for a colleague but I'm going to have similar problems myself soon, so I'd like to understand it.
04:12rritochI took on this issue because I'm trying to learn all of in's and outs of clojure classloading because it frequently causes issues, but I still have a ways to go
04:12cflemingrritoch: It seems to be a bit of a mess.
04:14dysfunit's largely java's fault tbh
04:15cflemingdysfun: Mmmmh, I thought so, but this idiosyncratic choice of which loader to use is all Clojure
04:15dysfun*nod*
04:15dysfuni can understand why it's the way it is, but it's not helpful
04:40rritochdysfun: I believe I found the bug
04:40rritochdysfun: (println (clojure.lang.Namespace/areDifferentInstancesOfSameClassName (class (->TestRecord nil)) (class (TestRecord. nil)))) is returning false
04:40rritochOr I should say "a bug"
04:41rritochthe areDifferentInstancesOfSameClassName should be validating that both classes are using the same classloader instead of just checking =
04:45dysfunrritoch: heh, nice find
04:46rritochdysfun: I am not sure though, this is acting wierd still
04:46dysfunwelcome to the jvm :)
04:47rritochWow, crazyland
04:48rritochLet me see if I can paste this someplace...
04:48dysfuni've heard it called worse :)
04:48dysfunhttp://refheap.com/
04:48clgvthat predicate seems about right
04:50clgvdid you reevaluate the definition of TestRecord?
04:51rritochhttps://www.refheap.com/94397
04:52rritochNow that is crazyness if I ever saw it
04:53rritochInside the let it reports they are different, outside let context they're reported as the same.
04:54rritochI'm supposed to be working right now, but I don't deal well with not knowing the solution to a problem
04:55clgvrritoch: better restart your repl. they are the same for both evaluation in a fresh repl overhere
04:56clgvrritoch: is it possible that there are stale class files in your project?
04:56rritochclgv: I'm not running from repl, I'm running via lein compile (:aot :all)
04:56rritochFrom repl all of this crazyness goes away
04:57rritochcflemming's code if loaded via require :reload-all produces the same classloaders, it is only during lein compile that they deviate, at least in my tests.
04:58dysfunthis has gotten quite interesting all of a sudden
04:58rritochIt could be a version issue though, I'm using version 1.5.1 for this test
04:58rritochI didn't try a newer version of clojure
04:59rritochI get the same offending results with version 1.6.0
05:00rritochI really have to stash this issue away for later and get to work, but cflemming has uncovered something very odd about the classloading within lein compile
05:01clgvrritoch: but run the compiled code via "lein run" by adding a -main and :gen-class to the namespace - then you get "same" both times.
05:01clgvso is this really relevant for any practical purpose?
05:02clgvrritoch: I just added an additional -main function and kept the other code as is
05:04rritochclgv: I'm not exactly sure when this would be relevant, I rarely use top-level "let" statements in code
05:05clgvrritoch: it seems to be compile time only. when the compiled code is run and the side effects from loading the class are triggered both report "same"
05:06rritochclgv: Yes, and I noticed the dynamicclassloader dissappears at runtime, both use the classloader
05:06rritocherr, the app classloader
05:08llasramAOT really doesn't seem to be a feature the clojure/core people use much
05:13rritochWell, I found one more thing, when running lein compile, the non-let version is reporting same for both, and they're both using the same dynamic classloader that is reported in let for ->TestRecord
05:14rritochSo the only time the app class loader is being used at compile time is when (TestRecord. nil) syntax is used within a let statement.
05:16cflemingclgv: it's relevant because the multimethod dispatch doesn't work properly, see the refheap
05:17cflemingprint-method is called or not depending on how the record class is instantiated
05:17cflemingllasram: They AOT compile datomic
05:17rritochcflemming: Do you really need to be using a top-level let statement in your code?
05:18rritochcflemming: The crazyness seems to evaporate if you aren't in a let statement.
05:18cflemingrritoch: This is just a repro case, it's not the real code
05:19cflemingrritoch: This was giving problems at the REPL, and seems to be related to http://dev.clojure.org/jira/browse/CLJ-371
05:19rritochcfleming: I'm aware of that, but this bug seems to only presents itself within a let statement
05:19cflemingrritoch: Mostly I'd just like to understand how the classloading actually works.
05:20rritochcfleming: Same here, I honestly have no idea how the let form changes things, but it narrows the problem down a bit
05:22rritochcfleming: Did you see the pastebin I posted?
05:22cflemingrritoch: Yes, I'm looking at it now
05:22rritocherr, refheap
05:23rritochIt is simply another perspective on the same issue, but the let binding seems to be the basis for the bug
05:24cflemingSo that different instances check looks legit to me
05:24cflemingI think the difference in the output is because you're getting the classes looked up in different classloaders
05:25clgvcfleming: multimethod dispatch in AOTed namespace does not work?
05:25rritochcfleming: Yeah, I was wrong about that function having a bug
05:25SagiCZ1clgv: not that i am an expert or anything but it seemed to work in my case
05:26cflemingclgv: Take a look at https://www.refheap.com/94392
05:26cflemingYou can see there that the print-method method is invoked, or not, depending on how the record class is instantiated.
05:27cflemingPresumably because the classes are different due to different classloaders being used, and the multimethod is dispatched on the Class
05:28cfleminginstance? would also fail
05:28clgvcfleming: yes I had that running
05:29llasramcfleming: Oh yeah. Good point :-)
05:29llasram(re: datomic; catching up)
05:31clgvcfleming: but the multimethod dispatch works in a -main function with the compiled class files in a uberjar
05:31cflemingclgv: So multimethod dispatch works fine, it's the class lookup that's a little unpredictable
05:32cflemingclgv: interesting.
05:33cflemingclgv: My colleague was having problems in a REPL because of this. I assume (but I'm not sure) that he'd loaded the AOT code and was then trying to redefine a class.
05:33cflemingWhich looks sort of like CLJ-371 but not quite.
05:38simaohey any reason why `lein run` would never stop? I am just outputting some strings but lein run gets stuck doing nothing
05:38llasramsimao: "Never stop" meaning "not exit once the entry-point function returns"?
05:39simaoyeah, when -main returns
05:39llasramsimao: Probably the agent thread pool, which uses non-daemon threads. Try adding a call to `shutdown-agents` right before returning from your `-main`
05:41simaollasram: nothing changes, still hung
05:42llasramsimao: Well, are you perhaps starting threads some other way?
05:42simaollasram: no, it's very simple what I am doing.. maybe some import is starting some thread but that would be weird
05:42llasramsimao: code?
05:43simaollasram: I just found it. some call to a library was opening a tcp connection and probably would use some threads
05:43simaothanks!
05:43llasramwell, cool
05:44llasramHope that actually helps then :-)
05:47llasramcfleming: I think it's the same problem, just in a more complicated way, combined with how Clojure evaluates code form-by-form
05:48llasramcfleming: I'm failing to find why, but there's especially tricky interactions which lead to why the `deftype` and `defrecord` macros produce forms which wrap their contents in a top-level `let` instead of `do`
05:48llasramSince the compiler special-cases a top-level `do` to evaluate each sub-form as independently at the top level
05:53dysfunohh, that's how it does it
06:01Empperiok, this is wierd
06:01EmpperiI set :test-paths ["test/clj"] in my project.clj but leiningen doesn't seem to be compiling those into classpath so that those tests could be executed
06:01Empperiwhat am I missing?
06:03mavbozoany good explanation about AOT in the web?
06:10llasrammavbozo: Sure. github.com/clojure/clojure/.../Compiler.java ;-)
06:10llasrammavbozo: (by which I mean: "unfortunately not")
06:10clgvmavbozo: depends on your question
06:11llasramEmpperi: Not sure what you mean by "compiling those into classpath"...
06:12llasramEmpperi: Does the directory hierarchy underneath your test path(s) still reflect the Clojure namespace hierarchy and match the `ns` forms in your test files?
06:13mavbozoclgv: like why we should AOT compile some namespace and not the other, or why there are some libraries that come AOT compiled
06:14llasrammavbozo: Clojure AOT is for applications. Libraries should *never* be AOT-compiled
06:15llasrammavbozo: You can get a startup-time speed up with AOT, but most people to use AOT because they think they need executable uberjars, which requires an AOT class
06:15llasramBut you really don't :-)
06:15Empperillasram: yes
06:15llasrams,people to,people seem to,
06:16Empperibut strangely enough, if I just removed :test-paths declaration it works o_O
06:16dysfun"but you really don't" ?
06:16Empperioh well
06:16Empperiit works -> carry on
06:16llasramEmpperi: noooo
06:16mavbozollasram: but, there is this kind of suggestion https://github.com/yogthos/Selmer/pull/67
06:17mavbozoto AOT compile selmer.node
06:17llasramThat actually doesn't make sense. Could you refheap your project file, the result of the shell command `find test/`, and the path+`head` of one of your test files?
06:17clgvdysfun: yes, you can use the pattern of lein-otf to have a fake main class that is AOTed and loads your real main dynamically. so you actual code does not need to be AOT compiled
06:18TEttingeris lein-otf even compatible with recent lein?
06:18mavbozollasram: and actually namespace selmer.node in selmer is aot compiled https://github.com/yogthos/Selmer/blob/master/project.clj
06:18llasrammavbozo: They are wrong and about to break their users when they release this :-)
06:19mavbozollasram: it's already released yesterday i think in version 0.7
06:19llasram(I think -- yogthos should know better)
06:19llasramYeah -- just one sec while I verify something
06:19dysfunclgv: ah i see. i tend to just do a very quick wrapper around another namespace
06:19dysfunthis will save some typing
06:21llasrammavbozo: Ok, nm. Last time I checked doing an AOT meant transitively compiling clojure.core, but that seems not to be happening here
06:22llasrammavbozo: BUT
06:22llasrammavbozo: IMHO they did the wrong fix
06:23llasramActually, I'm going to pause blathering as I don't actually understand what the problem was
06:24llasramThey require selmer.node in selmer.parse, which should define the relevant types. AOT should be completely irrelevant
06:26mavbozollasram: i'll ask yogthos when he's here. including why there is gen-class in that selmer.node
06:26clgvdysfun: well, I dont mean to say you should use lein-otf - it broke with recent leiningen. but you can use the same pattern
06:27mavbozowhy aot'ed libraries might break user's applications?
06:28llasrammavbozo: Because of the transitive compilation issue. In the past there have been AOT libraries which unintentionally transitively compiled -> included other libraries
06:29llasramThe Clojure class loading strategy prefers available AOT versions of things. This caused incomprehensible behavior like getting a version of library nothing seemed to include
06:29llasrammavbozo: They're avoiding that here, although I still think it shouldn't be necessary
06:29llasramIt might be linked to how they're reaching into the protocol implementation to use the protocol backing JVM interface.
06:31mavbozollasram: oh, a library jar which includes other libraries jar
06:31llasramExactly
06:34mavbozothx llasram
06:34mavbozo(inc llasram)
06:34lazybot⇒ 41
06:36mavbozothe pain of making and using libraries reminds me of old thread https://groups.google.com/forum/#!topic/clojure/WuS31RSiz_A
06:59justin_smithszymanowski: ##(filter (set '(a b c)) '(a b d c e b a)) something like this?
06:59lazybot⇒ (a b c b a)
07:06Fendertoday a performance question: I have a vector and a function and I count how often this function is truthy on each element in the vec
07:07FenderI actually traverse the (range (count values)) via reduce where values is the vector
07:07Fenderand inc an Integer if (function (get values i)) is truthy
07:08Fenderhowever, now I want to do this for two integers because I got two functions
07:08Fendermeaning I could (reduce some-counting-function [0 0] (range values))
07:08Fender(range (count values)) that is
07:09Fenderof course, I wouldnt use a persistent vector because that's expensive, instead I tried an int-array
07:09Fenderbut thats twice as expensive as counting just one function
07:10Fenderthe functions btw are just keywords on a record, so I suppose they're cheap
07:10Fenderis there a faster way to count if <n> functions hold over the same vector?
07:11Fenderthat is: is there a fast way to count how often <n> functions hold in one single vector?
07:12Fenderlike transient vectors (didnt try), AtomicInteger, int-array (same perf as AtomicIntegers), ...=
07:12clgvFender: as long as you use (range) the other performance optimizations do not make that much sense
07:12FenderI read a lot that seq on the vector wouldnt be faster
07:12Fenderyou mean I should loop
07:12Fenderof course
07:13Fenderthanks already, sometimes you optimize the wrong thing
07:13clgvFender: if you want fast arithmetic (e.g. for counting) use loop-recur and make sure there is no boxing
07:13Fenderyou're completely right, I now see how stupid that was^^
07:14noncom|2how do i get http://mvnrepository.com/artifact/org.apache.commons/commons-io/1.3.2 with deps in project.clj ?
07:15noncom|2i tried [org.apache.commons/commons.io "1.3.2"] but it does not work
07:15ucbshouldn't it be commons-io though?
07:16hyPiRionyeah, it's moved
07:16clgvnoncom|2: thats probably because mvnrepository is not mavencentral and thus not in the list of your repositories
07:16hyPiRionuse [commons-io/commons-io "2.4"]
07:16noncom|2oh..
07:16noncom|2it is even 2.4 now...
07:17noncom|2yeah, this one works
07:17noncom|2thanks
07:22Fenderis there a neat way to make sure there is no autoboxing? cantor is not supported anymore and set-warning on reflection doesnt tell me anything...
07:25justin_smithFender: 1.7.x (still in alpha) has warning on boxing if you turn on *unchecked-math*
07:26justin_smithFender: there is also the primitive-math lib https://github.com/ztellman/primitive-math
07:27Fenderok, thanks, I will use the latter
07:27clgvFender: warn on reflection should tell you at least for the loop parameters
07:27justin_smithclgv: it will tell you if it reflects on their class, but not if they get boxed
07:28justin_smithit will happily let an object be java.lang.Long
07:28Fenderhmm, sometimes during compilation I remember I read some autoboxing warning
07:29Fenderbut it was from leiningen
07:29justin_smithFender: leiningen is just running the compile command, I am sure it's the compiler giving the actual warnings
07:30clgvjustin_smith: it'll tell you the loop params initialized with primitive get boxed before passed to recur
07:30justin_smithclgv: oh, cool
07:31clgv1.7 has a new option for *unchecked-math* where you can enable warnings
07:33Fenderso the absence of a compiler warning for the loop params in 1.6 implies the absence of autoboxing
07:33justin_smithFender: as long as you hinted the arg as a primitive
07:34justin_smithif you didn't hint it as a primitive, you'll get no warning
07:34clgvFender: if the arg is initialized with a primitive, yes
07:35clgvhints will lead to a compile error if I remember correctly
07:35clgvFender: e.g. (loop [i 0 ...] ...) or (loop [i (long x) ...] ...)
07:35Fenderok, I coerce them as in http://clojure.org/java_interop#Java Interop-Type Hints
07:36Fenderand there is no warning
07:36Fenderbut I only inc them, so maybe it sticks to the type in this case
07:38Fenderok, inc doesnt seem to be type-true
07:38Fenderbut inc' is
07:38Fenderso I get a compiler warning if I use inc' but not if I use inc
07:38jmglovHi all! Is anyone awake who knows a bit about Ring?
07:40kungijmglov: what is your question?
07:41jmglovI would like to deploy a Ring app (made with lein uberwar) to Tomcat, but using the WebSocketServlet API, not the HttpServlet one.
07:41jmglovAs far as I can tell, Ring can't currently do that.
07:41jmglovAm I correct in this?
07:42kungijmglov: my ring expertice is not good enough to answer that question.
07:42justin_smithjmglov: I suspect it will be easier to make a standalone uberwar, using httpkit or aleph
07:43justin_smithjmglov: how badly do you really need to be using tomcat?
07:43jmglovPretty badly, I think.
07:43jmglovOtherwise, I'd just use http-kit and be done with it. :)
07:44justin_smithgoogle immediately finds you asking questions about this on stackoverflow
07:44justin_smithlol
07:44jmglovI need to deploy to AWS Elastic Beanstalk.
07:44jmglovjustin_smith: Yup.
07:45clgv,(binding [*warn-on-reflection* true] (eval '(fn [n, x] (loop [i 0, s 0] (if (< i n) (recur (inc i) (+ s x)) s)))))
07:45clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
07:45jmglovI figured #clojure might be able to bring more expertise to bear quickly.
07:45clgvFender: try that one on your repl ^^
07:45jmglovI see now that Elastic Beanstalk can do Docker, so perhaps http-kit + Docker would be an option.
07:47justin_smithjmglov: that's a nice new option. I have had success with just using plain ec2 instances as well for what it's worth.
07:47justin_smithjust scp an uberjar and fire it up.
07:48jmglovjustin_smith: I have done the same with other Clojure services on EC2, but Elastic Beanstalk gives me ELB and Auto Scaling as well, which saves quite a bit of work.
07:49jmglovOtherwise, I'd need some tool to deploy new versions to all running instances, update my AMI, etc.
07:49jmglovSo it's quite a lot of tooling that I'd potentially have to write.
07:49justin_smithright, clearly you are hitting scale issues I have not seen
07:50justin_smithI never had scaling issues that couldn't be fixed with nginx reverse proxy and a varnish layer on a single instance
07:50jmglovYeah, I have to be available and scalable, so I have some constraints that are best left to Amazon to sort out. :)
08:06TimMcjmglov: Embedded Jetty doesn't allow you to use websockets? I've never used them myself.)
08:06justin_smithTimMc: embedded Jetty doesn't work on elastic beanstalk
08:06justin_smithunless maybe with that docker option he mentions
08:07TimMcAnother thing I know nothing about. :-)
08:07jmglovTimMc: I believe that embedded Jetty does handle websockets, though almost no-one seems to be doing that.
08:07jmglovBut as Justin says, that doesn't really scratch my itch.
08:08jmglovhttp-kit on Docker looks like the best way forward, honestly.
08:08justin_smithTimMc: the idea with elasticbeanstalk is that the instances are totally generic, with nearly no setup, which allows fast and easy allocation / deallocation of instances as needed
08:08TimMcAh, OK.
08:08jmglovBut I think I'll take a crack at writing a Ring adapter for WebSocketServlet.
08:09justin_smithgodspeed, that sounds very useful
08:09jmglovThe Docker stuff is a lot more complicated than a simple "lein beanstalk deploy production". :)
08:09jmglovI don't think the adapter would really be that complicated. ring.util.servlet is not much code at all.
08:10jmglovAnyway, I'll report back once I've done it or died trying. ;)
08:10TimMcThere's also that async ring thingum...
08:10justin_smithjmglov: I'll take your word for it. The lower I get in the stack, the more likely a small miscalculation totally ruins things, so I am often reluctant to make something like that.
08:11atankanowwhomai
08:11TimMchttps://github.com/dgrnbrg/spiral
08:11justin_smithhaha, you almost got an easteregg
08:11justin_smithwhoami
08:11lazybotjustin_smith
08:11atankanowhaha
08:11atankanowjust making sure circe set my nick correctly
08:11justin_smithpwd
08:11lazybot#clojure
08:11justin_smithls
08:11lazybotbin home lib64 lost+found media opt proc root sbin tmp usr var
08:11TimMcmutt
08:11lazybotWoof!
08:11atankanowrm -rf /
08:12hellofunkIn Om I am trying to udpate parent local state from child. Code snippet is last message in this thread, if anyone spots the problem: https://groups.google.com/forum/#!topic/clojurescript/22Oh2BkGlyQ%5B1-25-false%5D
08:12atankanowno wait, sudo !!
08:13clgvatankanow: make sure you got the correct window ;)
08:16atankanowclgv: never! i type indiscriminately into any application with text input
08:17jmglovjustin_smith: You're certainly right, but I can't let fear stop me. :)
08:18jmglovBugs happen and get fixed, no matter where in the stack I am.
09:00charliekilostupid question: am I missing anything about vars pointing to record? Using Prismatic Schema this works (schema/check MySchema {:foo "bar"}), while (schema/check #'MySchema {:foo "bar"}) does not.
09:00Bronsa,(defrecord Foo [])
09:00clojurebotsandbox.Foo
09:00Bronsa,Foo
09:00clojurebotsandbox.Foo
09:00Bronsa,#'Foo
09:00clojurebot#<CompilerException java.lang.RuntimeException: Expecting var, but Foo is mapped to class sandbox.Foo, compiling:(NO_SOURCE_PATH:0:0)>
09:00Bronsa,(class Foo)
09:00clojurebotjava.lang.Class
09:00Bronsacharliekilo: records are classes, not vars
09:01justin_smithand even if you are talking about a var ##(= #'+ +)
09:01lazybot⇒ false
09:02justin_smithGuest35729 is spamming
09:02charliekiloBronsa: but wouldn't (def MySchema (schema/either ...)) create a var?
09:02justin_smithcharliekilo: see my point
09:03justin_smithon the other hand ##(= + @#'+) does work
09:03lazybot⇒ true
09:03justin_smithbut it's also silly :)
09:05charliekiloso I need to basically resolve the class then and not the var
09:05justin_smithwell, schemas are by convention in CamelCase but are not classes, they are vars holding clojure data structures
09:06justin_smithunless you are talking about something actually made with defrecord or such
09:06jonathanjhrm, is anyone familiar with Liberator?
09:07ordnungswidrigjonasen: I am
09:07jonathanjhow do i dynamically return the Content-Type for :handle-ok ?
09:07charliekilojustin_smith you sure, because then I call (class MySchema) it returns schema.core.Either (in my case)
09:07jonathanj(like, i've pulled some stuff out of a database and now i know the content type is X)
09:07charliekilowhich is a class
09:08ordnungswidrigliberator figures this out for you based on what the client accepts ("Accept" header) and what the resource provides (:available-media-types)
09:08justin_smithcharliekilo: how do you define the schema?
09:08ordnungswidrigif you want to do that dynamicaly, then specify a function for :available-media-types which returns the type in a vector.
09:09charliekilojustin_smith (def MySchema (schema/either ...))
09:09justin_smithaha, yeah. in that case MySchema is a var, but the value it points at is an instance of schema.core.Either
09:09justin_smithbut MySchema is not a class
09:10justin_smithso what I was saying still holds. It's in CamelCase but is not in fact a class.
09:14jonathanjordnungswidrig: hrm, is there some handler that is called as a kind of "setup" handler?
09:14jonathanjordnungswidrig: the problem i have now is that my exists? handler places the necessary information into the context but available-media-types runs before exists?
09:15justin_smithcharliekilo: schema/either returns an instance of a record (schema.core.Either), and records are just specialized maps
09:15ordnungswidrigjonasen: well, look it up in :available-media-types and put it into the context there. you can then use that value in :exists?
09:16jonathanjordnungswidrig: i can't mutate context, can i?
09:16jonathanjusually i return the map to merge with context from a handler, but in this case i have to also return the vec of media types
09:17ordnungswidrigjonasen: let me check
09:17justin_smithcharliekilo: one thing that can lead to confusion is that #(= (#'+ 1 1) (+ 1 1)) vars are callable, and implicitly deref when called. But they are not generally substitutable with the thing they resolve to.
09:17justin_smithoops ##(= (+ 1 1) (#'+ 1 1))
09:17lazybot⇒ true
09:18justin_smithalso, the CamelCase convention for schema vars is misleading, because usually something in CamelCase in clojure should be a class, not a var
09:19ordnungswidrigjonasen: you're right. In this case you would need to specify :media-type-available? and call to `(negotiate-media-type ctx)` yourself. But I guess it's simpler to lookup the resource in `service-available?` which has the nice side effect to produce a good status code in case your db fails :-)
09:19hellofunkif you have a destructred arg in a fn and you call that function with nil as the arg rather than something that can be destructured, it this acceptable and you just get nil for your destructured args?
09:20justin_smithhellofunk: that is the only behavior you can expect
09:20hellofunkjustin_smith as opposed to say errors, this would be considered fine?
09:20justin_smith,((fn [{a :a}] a) nil)
09:20ordnungswidrigjonasen: would you mind to file an issue to liberator on that? I find it would be a good extension to be able to "update the context" from :available-media-types.
09:20clojurebotnil
09:21justin_smithhellofunk: destructuring will always nil rather than error unless the syntax is invalid
09:21charliekilojustin_smith I followed Prismatic's naming convention (see their README) ... think Prismatic uses CamelCase to highlight its a schema
09:22justin_smithcharliekilo: right. that's why I explicitly blame the naming convention and not you.
09:22justin_smithbut it's bound to lead to confusion in forums like IRC where we see CamelCase and assume a class :)
09:23charliekilojustin_smith right, I should have been more explicit by highlighting the usage of the Prismatic naming convention
09:23justin_smithwell, the usage of the word "record" in your question may have led things astray as well
09:24justin_smithyou asked about a var pointing to a record, when I think you really meant a var pointing to an instance of a record
09:24jonathanjordnungswidrig: thank you for your help, i'll file a bug when i get the chance
09:25justin_smithbut I think we have it all cleared up at this point what was really going on :)
09:25ordnungswidrigjonasen: you're welcome
09:37charliekilojustin_smith got it ... thanks
09:43atankanowseq is a nice idiomatic way to process possibly empty element collections a la #(if-let [xs (seq %)] (process-collection xs) (process nil))
09:43borkdudewhat's wrong with this Datalog query? https://www.refheap.com/94400
09:43atankanowis there a nice way to also handle non-Iterables here ... that is send non-Iterables to the else
09:43borkdudethe one on line 5
09:43justin_smithatankanow: in 1.6 you can also use not-empty, basically the same thing but I think it conveys the intention very nicely, and it keeps the collection type
09:44justin_smith,(map (juxt seq not-empty) [[] [1 2] () '(1 2)])
09:44clojurebot([nil nil] [(1 2) [1 2]] [nil nil] [(1 2) (1 2)])
09:44atankanowthanks justin_smith
09:44jonathanjis there a function such that (f "abc") returns ["abc"]?
09:45atankanowbut what if one of the elements is say a boolean
09:45borkdudejonathanj vector
09:45justin_smith,(vector "abc")
09:45clojurebot["abc"]
09:45jonathanjborkdude: oh, i was trying "vec"
09:45jonathanjthanks
09:45justin_smith,(not-empty false)
09:45clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean>
09:45justin_smith,(seq false)
09:45clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean>
09:45atankanowbasically i want non-collections to be treated as such without explicitly checking =)
09:46justin_smithatankanow: you need (and (coll? x) ...)
09:46justin_smithor something using a check for coll?
09:46atankanowthat's what i thought justin_smith ... i just wasn't sure if i was missing a nice clever single fn solution
09:46borkdudegotcha: datomic inputs must start with a ?
09:47justin_smithbut any place where you are maybe getting a single item or maybe a collection indicates to me you are interacting with a poorly designed api
09:47atankanowagreed
09:47justin_smithor at least a crippled one - what if you wanted a collection as your single item?
10:40EvanR,(quote <)
10:40clojurebot<
10:40EvanR,(quote :)
10:40clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: :>
10:40EvanR:(
10:40EvanR,(quote ::)
10:40clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: ::>
10:41EvanR,(symbol ":")
10:41clojurebot:
10:42mikerodEvanR: the symbol constructor allows a lot of symbols to be created that aren't readable
10:43EvanRis this bad
10:43mikerod,(symbol " h ")
10:43clojurebot h
10:43mikerodI think in order to make the symbol construction performant, it just allows anything in a string
10:43mikerod(this is mostly a guess of mine)
10:43EvanRare unreadable symbols bad, like (symbol "<:")
10:44mikerod,<:
10:44clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: <:>
10:44mikerodEvanR: I don't know. I guess it depends on what you intend to do with them.
10:44mikerodThey are bad if you intend for them to be read. :)
10:44EvanRhmm, i was using them abstractly. i keep forgetting symbols are really about the runtime environment
10:45mikerodEvanR: Yeah, I find it awkward to use them for anything other then their intended runtime semantics.
10:45mikerodSince they have meaning already tied to them there. I'd suppose it should be considered bad practice to use them for other
10:45mikerodthings.
10:47mikerodKeywords are much better suited for representing something as itself with no other meanings tied to runtime behavior.
10:48EvanRright keywords are good.. for words
10:48EvanRbut prefixing other symbols with : is awkward
10:49EvanR:<:
10:49EvanR:?e
10:49justin_smithyou can always use get, and a string
10:50EvanRget and a string?
10:50justin_smith(get {"a string" 1} "a string")
10:50ajmccluskeyIs it possible to extend a protocol in the same sense as extending a Java interface? From what I can see it isn't, but it seems like it makes sense to express hierarchies of behaviours.
10:51ajmccluskeye.g. A "Graph" protocol expects implementers to be able to add-node, add-edge, etc.
10:51justin_smithEvanR: many people are over eager to take incoming data (for example in an http request, or sql results, or json) into symbols or keywords, where really things are simpler if they remain strings
10:52ajmccluskeyA "WeightedGraph" protocol might add the ability to add-weighted-edge, but a WeightedGraph should be able to do all the things a "Graph" can do as well
10:52EvanRwell this isnt incoming data its symbols in a dsl
10:52EvanRlike datomic usage of '?e
10:52justin_smithajmccluskey: you can implement a Weighted protocol, and then document that a client should implement both Graph and Weighted. This is the general approach in clojure.core
10:53justin_smithEvanR: in that case, use symbols or keywords that aren't insane :)
10:53justin_smithif it isn't client provided, that's in your power
10:53EvanRthats what im ascertaining, colon is an insane symbol in clojure
10:53EvanR<: is standard notation for subtype
10:54justin_smithEvanR: tailing colon is OK
10:54justin_smith,'<:
10:54clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: <:>
10:54EvanRnope
10:54justin_smitherr, not
10:54justin_smithsorry
10:54justin_smithmy bad
10:54ajmccluskeyjustin_smith: Right. That's what I was seeing, hence I assumed it wasn't possible. Feels like it would be better to capture this in code rather than comments.
10:54justin_smithajmccluskey: clojure is opinionated against inheritence, this is reflected many places in the design
10:56ajmccluskeyjustin_smith: I knew it was opinionated against inheritance of implementations, but I guess I see legitimate reasons for inheritance of interface.
10:57EvanRprerequisite interfaces for an interface would be good
10:57EvanRprotocols on a protocol
10:58justin_smithajmccluskey: there is no manner of enforcing that an interface is fully implemented. Putting it all in one interface vs. mixing multiple interfaces gains you very little, because nothing prevents incomplete implementation.
10:59justin_smithEvanR: same goes for that argument. Since I can't even enforce that you implement all the methods in one interface, how does mixing multiple interfaces into one give me any net benefit?
10:59ajmccluskeyjustin_smith: I assumed it would be a compilation error to only partially implement a protocol/interface
10:59EvanRi wasnt mixing, but also, you can "just not implement" part of an interface?
11:00justin_smithnot at all
11:00justin_smithEvanR: nothing makes you implement a full interface.
11:00EvanRin any case, why make an assumption that someone might do that
11:00justin_smithEvanR: it's common.
11:00EvanReven if they implement all the methods, you also have no guarantee they did it right
11:00EvanRdoesnt seem to be "our" problem as the protocol user
11:01justin_smithsure, but what I am saying is that interface inheritence gains you complexity, but doesn't actually help you simplify anything. It doesn't do anything useful.
11:02justin_smithwhether you are implementing one interface, or many, you actually have to go and look at the interface(s) and figure out what you need to implement.
11:02justin_smiththe compiler isn't enforcing any of it
11:02ajmccluskeyIn the context where full implementation of protocols/interfaces isn't required it doesn't do anything useful. I'd be interested to find out why the decision was made to not enforce full implementations.
11:03ajmccluskeyI guess the one gain I can think of in this context is that it's expressed semantically as code rather than in a comment, which maybe makes it stand out more. There's also the possibility for adding tooling/checking around it.
11:03EvanRwhat i was thinking of was, you want to implement an independent protocol B for class X, class Y, and for anything implementing protocol A (ignoring for the moment what happens if X or Y implements A)
11:04justin_smithajmccluskey: because needing full implementations creates a lazy path leading to inheritance. And lazy partial implementation is much easier to fix than lazy / poorly thought out inheritence trees.
11:04justin_smithlaziness as in "what does a programmer in a hurry / with other priorities end up implementing"
11:05EvanRits common in a dynamic system to treat it as if people are following some sanity rules, if they dont, its their problem
11:05EvanRtwo different subjects it seems
11:06EvanRmushing several independent interfaces into one seems bad
11:07justin_smithimplementing a protocol based on another protocol leads to the ruby problem "where the hell is the code that generates this behavior exactly?"
11:08EvanRshouldnt the system tell you which implementation is being used for a given class and protocol pair
11:08ajmccluskeyjustin_smith: good points
11:08EvanRin file foo on line bar
11:08EvanRalso ruby does not have anything close to anything we are talking about
11:08ajmccluskeyEvanR: interesting point about dynamic systems giving people more freedom. Agree.
11:09EvanRajmccluskey: the only way i can do anything in super dynamic language x is to do tons of static checks in my head, i think its common for library designers to treat users as following some unseen protocol
11:10EvanRwhich they can use to write their code correct against some standard
11:10justin_smithEvanR: I am talking about the more general design problem of implementation being spread in unintuitive ways. Which ruby code in my experience often has in spades, and meta-protocols would lead to similar problems.
11:11justin_smithEvanR: this is why I like prismatic/schema now that I have started using it
11:11justin_smithEvanR: even if I never run the schema checks, just having the annotations on my functions is great
11:12EvanRyes so maybe the gripe is about using implementation somewhere for something without some visible code to tell you whats going on
11:12EvanRor how / why its even happening in this context
11:13Bronsajustin_smith: not being able to extend a protocol to a protocol leads to this https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L8164-L8260
11:13justin_smithRight. And inheritence, and nesting of protocols on protocols (effectively inheritence) are big causes of that. One of my favorite things about clojure is how easy it usually is to intuit where the behavior I am observing is likely implemented.
11:14EvanRbut the using a protocol to implement a protocol is in my mind equivalent to using a function to implement another function
11:14Bronsaand juuio is the daily spammer.
11:14EvanR"function inheritance" is usually not considered bad
11:15justin_smithEvanR: than do what you would do with a function, and wrap one in calls to the other. Protocols are allowed to call methods on other protocols.
11:15EvanRyou follow the (visible) code to find out why something is working
11:15EvanRjustin_smith: thats what im talking about
11:16justin_smithEvanR: I thought you were talking about extending Protocols onto other Protocols
11:16EvanRprotocol P implementation X using the method from P2 implemented on X
11:16EvanRP implementation Y wouldnt
11:17EvanRand from there you could make it polymorphic, instead of just X, any x that has P2
11:17EvanRor copy the code, which is what ive been doing in this case
11:17EvanRsince the code is identical
11:19justin_smithBronsa: yeah, that is the downside, I admit
11:19justin_smithBronsa: what do you think the right way to do it would be?
11:20EvanRjust looked at that link
11:22EvanRfor whatever common protocol (most of) those interfaces use to implement IPrintWithWriter, call it P, implement IPrintWithWriter *for P*
11:23Bronsajustin_smith: I don't know of a good way to avoid that that doesn't include some use of inheritance
11:23EvanRbut without enforcement, you will have a confusing rule to disambiguate the case of overlapping implementations
11:23EvanRwhat im saying isnt inheritance
11:25Bronsajustin_smith: note that since in clojure those protocols are actually interfaces, we *can* extend a protocol to them -- with the caveat that in the case of overlapping implementations one at random will be selected
11:25EvanR:(
11:26EvanRso dont overlap
11:27justin_smithEvanR: given that this is the jvm, how would you extend an interface onto another interface without inheritance?
11:27Bronsajustin_smith: but since most of the clojure interfaces form a hierarchy, there's rarely this issue. extending IPersistentMap will win over IPersistentCollection and Seqable etc
11:28justin_smithBronsa: is there a trick for that? because we were talking about this recently and I tried extending a protocol onto another protocol and it just didn't work, maybe I was doing it wrong
11:28EvanRjustin_smith: well not being able to implement it for some technical reason is a different story from its a bad idea
11:28justin_smithBronsa: a trick for extending protocols to protocols that is
11:29Bronsajustin_smith: in clojure?
11:29justin_smithEvanR: yeah, I think I had a "clojure stays close to the impl" premise that we weren't sharing
11:29justin_smithBronsa: yeah
11:29Bronsajustin_smith: in clojure you can use the underlying interface of a protocol
11:29Bronsajustin_smith: but this will only work for types that implement that protocol inline
11:29justin_smithahh, so not via extend-protocol
11:29justin_smithno wonder it didn't work
11:30justin_smiththanks
11:31puredangercfleming: I saw your questions in the backchat - you are probably running into this gem: http://dev.clojure.org/jira/browse/CLJ-979 which would be great to fix
11:34Bronsathere's an even weirder one
11:35Bronsabut I can't find the ticket
11:36puredangerBronsa: justin_smith: fwiw, I find the non-ability to layer protocol abstractions to be very frustrating as well. I've asked Rich about it in the past and he didn't seem to have strong feelings either way iirc.
11:36puredangerBronsa: maybe this AOT one: http://dev.clojure.org/jira/browse/CLJ-1544 ?
11:37Bronsapuredanger: no it had to do with redef'd deftypes & #ctor[] syntax
11:37puredangerdoesn't ring a bell
11:38gfrederickspuredanger: do you know if there's any general guidance around the use of custom data literals/readers in [contrib] libraries?
11:38gfredericksI was thinking of making a clojure-dev email about this but that's a lot of effort :)
11:38puredangeras far as whether they're ok?
11:38gfredericksin particular including a data_readers.clj file
11:38gfredericksand the implications of that happening in a library
11:39puredangerthey were designed for use by libraries, so I would think that is ok
11:39puredangermake sure to namespace your tags of course
11:39gfredericksyeah; how verbose should a namespace be? e.g. for test.check
11:40reiddrapercom.gfredericks.is.a.swell.programmer.random.aes
11:40justin_smithare multiple data_readers.clj files reliably loaded, even though they all have the same classpath-relative location?
11:41Bronsapuredanger: http://dev.clojure.org/jira/browse/CLJ-1495
11:41gfredericksjustin_smith: looks like core.clj intends to load all of them
11:41gfredericksvia (.getResources class-loader "data_readers.clj")
11:41puredangerBronsa: right. I don't think that's AOT-related though
11:41justin_smithcool
11:41gfredericksjustin_smith: and leiningen intentionally merges them when doing uberjars
11:41puredangergfredericks: it's 'sposed to work!
11:41Bronsapuredanger: the incredibly weird thing is that in the last example, if you don't evaluate "#user.Foo[1]" the (Foo. 1) call will use the updated type
11:42hiredmanfyi, I am already squatting bytes/*
11:42Bronsapuredanger: no definitely a classloader issue. but I honestly think CLJ-979
11:42Bronsaand a lot of other "AOT bugs" have to do with the classloader rather than with AOT
11:42puredangerhiredman: ideally, should be something a little more tied to the library
11:42puredangerBronsa: no doubt
11:43gfrederickspuredanger: alrighty I'll go ahead with that using the "clojure.test.check" namespace
11:43gfrederickspuredanger: thanks!
11:43hiredmanpfffft
11:43puredangergfredericks: I hate to use anything that long, but I'm not sure how else you end up with a manageable ecosystem? probably just test.check would be fine
11:44puredangerhiredman: which lib is bytes/* for ?
11:44mavbozo`puredanger: is stuartsierra 's suggestion in this old mailing list thread still relevant? https://groups.google.com/forum/#!topic/clojure/B4_uGy1VhnA
11:44mavbozo`"data_readers.clj is intended for application developers. Libraries may define data reader functions and suggest tags for consumers of that library" - stuartsierra
11:45stuartsierraIgnore me
11:45KnightsWhoSayNi/ignore stuartsierra
11:45stuartsierraDon't use data readers in code.
11:45stuartsierraIf you have an EDN data file with custom tags, that's fine.
11:45hiredmanpuredanger: https://github.com/hiredman/bytes
11:46sm0keHEY GUYS
11:46puredangerwell at least it matches the project name :)
11:46sm0keoops sorry for the caps
11:46gfredericksstuartsierra: do you still object to a library providing data_readers.clj for something specific to that library (using namespaced tags)?
11:46stuartsierragfredericks: yse
11:46sm0keis there a way to print bytes as readable edn?
11:47stuartsierraThere's almost never any good reason to make data-literal tags globally visible to all code. A function or macro can do the same job and the semantics are clearer.
11:47stuartsierraAgain, if you're using it for custom data types in EDN files, that's fine, just pass your custom readers in a map to clojure.edn/read
11:47gfredericksstuartsierra: this is for a functional PRNG
11:48gfrederickswhich would be nice to be able to print/read transparently
11:49gfredericksespecially for repl stuffs
11:49stuartsierraI don't think "transparent" (de)serialization is achievable with print/read.
11:49gfrederickswhat's the downside here?
11:49stuartsierraThere are too many edge cases, it's easier just to extend EDN in the specific places you want to use it.
11:49mavbozo`gfredericks: for applications such as datomic, maybe there is a very good reason to include it's own data_readers.clj
11:50stuartsierraEven in Datomic, we've had to educate users not to use data literals like #db/ident in code, because they're evaluated only once at read time, which is almost never what you want.
11:50gfredericksa prng could be print-dup-able without much trouble
11:52justin_smithgfredericks: idea being that a literal would specify a seed, so at read time it would be reset to that seed?
11:52stuartsierraMaybe. I hope someone can prove me wrong. So far my experience with tagged literals has been almost as bad as AOT-compilation.
11:52stuartsierraSo now I'm scarred and just tell people "don't go there."
11:52gfredericksjustin_smith: it's a pure value, so seed & state sure
11:53justin_smithgfredericks: what differentiates a seed and a state in a prng?
11:54gfredericksit's just terminology; "entire pertinent internal state" is what I was getting at
11:54gfrederickswhere state is the functional immutable sense of the word
12:02sm0kejuuio: is a spam bot
12:02arrdemwe seem to be missing technomancy's fingerguns
12:03arrdem$seen technomancy
12:03lazybottechnomancy was last seen talking on #leiningen 17 hours and 15 minutes ago.
12:03justin_smitharrdem: yeah, I think we need someone with the right privs to deputize some more sherrifs via chanserv
12:03justin_smithrhickey, maybe chouser, can do that
12:04puredanger_we had this discussion this week. the next time I can talk to rhickey or chouser, I will.
12:04arrdemohai puredanger_
12:04puredanger_why I am both puredanger and puredanger_ right now, I don't know :)
12:05sm0kesomehow since morning today i am getting jinxed a lot with other people!!
12:05sm0kea lot!! which is kind of creepy
12:05gfredericksstuartsierra: I should probably take it to clojure-dev then?
12:06justin_smithpuredanger_: /msg nickserv ghost puredanger <password>
12:06sm0keright now i was asking for printable edn bytes representation
12:06sm0keand some just posted https://github.com/hiredman/bytes before i could ask!
12:06arrdem /kick puredanger_
12:06EvanRis postwalk lazy?
12:06puredangertest
12:07justin_smitharrdem: that works? for some reason I thought nickserv was needed for that
12:07Empperi,(type (clojure.walk/postwalk inc [1 2]))
12:07clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.walk, compiling:(NO_SOURCE_PATH:0:0)>
12:07Empperidarn
12:07clgvEvanR: no. how could it walk maps & co if it were? ;)
12:07justin_smithEvanR: I don't think it can be, since it can return a hash-map
12:08EvanRwell that sort of makes sense.
12:08EvanRbut the IO error does not occur until i pprint the hash map
12:08EvanRi can show the keys but not the values
12:08gfrederickssm0ke: hiredman: I've been using whidbey for repl pprinting and it includes its own bytes printer :/
12:08puredangerEvanR: lazy value?
12:08justin_smithEvanR: well, you can have lazy functions inside the postwalk, that don't get forced neccessarily
12:09EvanRbingo
12:09justin_smithbut that's not postwalk being lazy, per-se
12:09puredangerif only you had transduced :)
12:09EvanRthere is a single "map" in the code, im guessing that is it
12:10mdrogalisAside from IFn and Clojure, is there anything in particular that needs to be done before invoking a Clojure fn from Java?
12:10mdrogalisRunning up against: java.lang.IllegalStateException: Attempting to call unbound fn
12:10mdrogalisBoth the Clojure and Java code are in the same uberjar.
12:11clgvmdrogalis: using the public API e.g. the `var` method should be safe
12:11mdrogalisclgv: What do you mean by safe?
12:12puredangermdrogalis: you should initiate the runtime by ensuring that clojure.java.api.Clojure is loaded
12:13puredanger(which really loads RT importantly)
12:13mdrogalispuredanger: Yep, I imported that, as well as clojure.lang.IFn.
12:13puredangerimport does not load
12:13puredangercalling Clojure.var() or something else will
12:13mdrogalisD'oh!
12:14clgvIFn f = Clojure.var("my.lib/my-fn"); is the path to go
12:14puredangerright
12:14llasram+ `require` the namespace for non-clojure.core
12:14mdrogalisActually, looks like I have that covered as well: IFn commission = Clojure.var("my-ns", "my-fn");
12:15puredangerhttp://clojure.github.io/clojure/javadoc/clojure/java/api/package-summary.html
12:15hiredmangfredericks: I am so beyond base64 these days
12:15mdrogalisllasram: There we go, that'll do it I think.
12:15puredangerhiredman: base65
12:15hiredmanhttps://github.com/hiredman/base85
12:15mdrogalispuredanger: I didn't read down far enough :) Got excited and coded after I saw "invoke"
12:15gfrederickshiredman: yeah I was trying to check if the first and second halves of my array were the same and base64 was no help
12:16mdrogalisThanks guys.
12:16puredangermdrogalis: http://tech.puredanger.com/2007/07/11/miller-principle/
12:16cflemingpuredanger: Thanks, that does look like it.
12:16puredangercfleming: we spent a fearful amount of time fighting that issue at Revelytix
12:17mdrogalispuredanger: I got half Miller Time'd. :P
12:17puredangermdrogalis: oof
12:17llasramcfleming, puredanger, Bronsa: I vaguely recall an IRC conversation where Bronsa figured out the cause of that issue, but maybe I was hallucinating
12:17puredangercfleming: the workaround we found at the time was to compare classes by name, not Class
12:18puredangerllasram: if anyone has figured it out, it would be Bronsa :)
12:18cflemingpuredanger: So you'd dispatch your multimethod on the class name?
12:18justin_smiththere is also base-_SEMI_lkjfdsa https://www.refheap.com/90612
12:19puredangercfleming: I'm not saying it's pretty :)
12:19cflemingpuredanger llasram: No doubt, my money is on Bronsa :)
12:20cflemingWhich classloader is used when seems like black magic, after looking at the code a little.
12:20llasramRich's commit comment when using the `(let [] ...)` instead of `(do ...)` is "prevent dynamic classes from being flushed before use"
12:25hiredmanbecause toplevel do's get hoisted
12:27puredangerI don't have time to look at this right now but if there was a solution to it I would be happy to lobby for getting it into 1.7.
12:33TimMchiredman: I'm partial to base256 myself
12:34hiredmanyou've gone too far!
12:34TimMcbase257
12:36TimMcHmm, I don't see technomancy. I guess I'll just get spammed.
12:37llasrambase128, for encoding in signed bytes
12:41cflemingpuredanger: Ok, I'll take a look with my colleague and see what we can see. I suspect time will be short for both of us too.
12:45kenrestivoaviso pretty print would be great... if only i could figure out how to turn off the dang colors
12:49kenrestivocause, you know, https://www.refheap.com/94410
12:51kenrestivohah, i found a hack: use timbre error log, since i already have timbre configured :fmt-output-opts {:nofonts? true}
13:07kenrestivoare there any examples of what buf-fn needs to be in core.async/pub ? i naively gave (async/pub c :topic (async/buffer 1000)) and it was expecting a fn, so i tried (async/pub c :topic async/buffer), no dice either.
13:10Bronsapuredanger: I think I have fixed both clj-979 and clj-1495
13:11Bronsahere's a preview of the patch http://sprunge.us/YddP?diff
13:11llasramBronsa: !!!
13:12llasramSo obvious once you point it out
13:12Bronsathe tl;dr is that Class.forName was ignoring the classcache of dynclassloader
13:13puredangerhmmm.. sounds promising
13:13Bronsatests are passing, as well as the testcases from the 2 tickets
13:15puredangerI've got other focus today but whatever you can do to clean that up for more evaluation would be great
13:15Bronsayeah sure, I'll clean it up and attach it on the ticket
13:15puredangerif I'm going to try to get it into 1.7, I will need to mount a compelling case :)
13:15llasram(inc Bronsa)
13:15lazybot⇒ 74
13:16puredangerthings that would help: super clean ticket+patch. votes. test runs on external libs. knowledge of cases where people have had to maintain a fork of Clojure to get around it. etc
13:17kenrestivothere were two people here last night banging their heads against this IIRC
13:18puredangeryes, that was the start of this thread
13:19kenrestivothat's amazing how fast it got diagnosed and, apparently, fixed
13:19kenrestivo(inc bronsa)
13:19lazybot⇒ 75
13:19puredanger(inc bronsa) ;indeed
13:19lazybot⇒ 76
13:21puredangerthere may be other jiras out there that this affects as well
13:22BronsaI remember having a long mail convo with ambrosebs about this issue months ago, IIRC he hit this bug aswell with core.typed
13:23puredangerCLJ-1544 perhaps ?
13:24Bronsapuredanger: just tested that seems unrelated as it's still throwing
13:24Bronsapuredanger: I believe CLJ-1544 might be related to the ticket hiredman opened about the classloader being popped
13:25puredangeryeah
13:25puredangerCLJ-1457
13:25sdegutislook, I don't know about you, but metadata is probably my favorite way to use Clojure
13:25BronsaI hate metadata.
13:25sdegutiswhy?
13:25clojurebotwhy is the ram gone
13:25Bronsaweird evaluation rules
13:26Bronsaweird corner cases
13:26puredanger+1 on that :)
13:26Bronsamostly around :tag specifically
13:26sdegutisBronsa: i mean purely on vars
13:26Bronsa,(def ^{:foo (println "foo")} a)
13:26clojurebotfoo\nfoo\n#'sandbox/a
13:26Bronsathen there's that.
13:26sdegutisI love to do (defn ^:foo ^:bar some-fn [] ...)
13:26puredangerdon't do that :)
13:27Bronsahttp://dev.clojure.org/jira/browse/CLJ-1137
13:28sdegutisoh wow
13:28sdegutisso anyway, metadata is my favorite API
13:28sdegutismacros are very limited compared to metadata
13:28sdegutismetadata is declarative, macros are transformative
13:28sdegutisyou cant easily wrap macros, whereas you can easily re-calculate and add metadata
13:28sdegutisso far, it is clear to all that we should be using metadata
13:29Bronsa,(meta '^:foo {})
13:29clojurebotnil
13:29Bronsathere's also this
13:29sdegutisnaturally, i only mean on vars
13:33Bronsapuredanger: I guess I'll sneakily link a couple of jira tickets a day when you're on IRC if that helps getting them triaged :P
13:33puredangerheh …
13:34puredangerwell not sure that means much :)
13:34sdegutisTIL clojure and crosier rhyme
13:35puredangersounds like the start of a song to me
13:36sdegutisi learned the word crosier because i was reading about the pope's new lightsaber crosier and the controversy around it
13:36sdegutisdidnt know how to pronounce it -- looked it up in the dictionary, it has "ZH" in the "s" part
13:36sdegutistook a guess, and looked up "closure" -- sure enough, same ZH!
13:36sdegutisand we all know Clojure is pronounced the same as "closure"
13:39puredangerBronsa: http://dev.clojure.org/jira/browse/CLJ-1132 ?
13:39kenrestivolooks like the game now is to see how many jira tickets can be closed with one bugfix :-)
13:39kenrestivomaybe a new record could be set
13:40puredangerno pun intended
13:40kenrestivohaha record
13:41Bronsapuredanger: yeah that's likely the same issue
13:41puredangerI just marked it as a dupe, almost certainly the same thing
13:41crash_epIf I have a byte array that represents a series of Unicode characters, and I know the character encoding of this series, what's the best way to convert the byte array into a seq of code points?
13:41kenrestivoreally, i've heard people complaining about "broken reload semantics" of records/protocols for a while. i'm using tools.namespace.refresh to get around it, as i'm sure many people are. seems like this would be an epic fix.
13:41Bronsapuredanger: I'll test it later, having dinner now
13:41puredangerBronsa: np, greatly appreciate your help
13:49pbombWould someone mind taking a peek at this http://bit.ly/1CJthES and letting me know if I'm barking up the wrong tree?
13:49pbombThe actual question is in the bottom paragraph.
13:49FrozenlockAny good libraries to sanitize form inputs? I tried https://github.com/alxlit/autoclave, but it messes up email addresses :-(
13:50justin_smithpbomb: the idea of a "temporary namespace" doesn't make much sense. Maybe you want a let block to bind things in?
13:50justin_smith(doc let)
13:50clojurebot"([bindings & body]); binding => binding-form init-expr Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein."
13:51justin_smith$grim let
13:51justin_smitherr
13:51justin_smith$grim clojure.core/let
13:51lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/let
13:51justin_smithsee examples in the above link
13:51pbombjustin_smith: Doh, that simple - thanks.
13:53justin_smithpbomb: actually - so does the file have defn in it? if so it may need its own namespace
13:53pbombjustin_smith: Yes, it will have.
13:54justin_smithbut in that case the right thing to use is the ns macro, creating an ns does not map clojure.core, but ns does that
13:54justin_smithor you could require that a migration define a namespace, unless it makes sense to put all the migration in one ns
13:55puredangerbtw, I've been trying to track AOT issues at http://dev.clojure.org/display/design/AOT+Problem+Overview with an eye toward making a push to get them all fixed by 1.8. I may be missing some. please add it so.
13:58Bronsapuredanger: http://dev.clojure.org/jira/browse/CLJ-1495 is also a dupe of 979
13:59puredangerthx
14:00Bronsapuredanger: also CLJ-1544 is missing from that wiki page
14:00Bronsaerr I mean 1457
14:00puredangerit's there?
14:00puredangeroh, thx
14:01Bronsasorry, I have a bunch of jira tickets open and I opened the wrong one
14:02puredangerCLJ-1457 does not seem overtly like AOT?
14:02Bronsaah uhm you're right.
14:04pbombjustin_smith: Thanks.
14:04pbombjustin_smith: Will explore all of the above.
14:05Bronsapuredanger: btw I'm scoping the patch for fixing the classloader issue rather than targetting only the AOT bugs. this just means that I'm replacing a bunch of class.forName calls with the patched RT.classForName
14:05puredangersure
14:06puredangerwe will need to make the ticket align with the real problem/fix. I can help with that.
14:08justin_smithpbomb: also, you could manually call refer to get clojure.core into scope, you may want to consider clearing the ns when done as well (especially if there is more than one migration to run)
14:09justin_smith$grim clojure.core/refer
14:09lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/refer
14:10pbombjustin_smith: I've just tried that and it seems to be working.
14:10justin_smithcool!
14:11justin_smithpbomb: the function for clearing the ns would be clojure.core/remove-ns
14:16pbombjustin_smith: Thanks, here's what I did in the end: https://programmers.stackexchange.com/questions/264601/i-would-like-to-run-load-file-in-a-sandboxed-namespace-in-clojure
14:17justin_smithpbomb: so you only need the keys from the loaded ns?
14:17pbombjustin_smith: No, eventually I'll need to execute a function from that ns.
14:18justin_smithaha, so then you probably want to export the whole ns-publics datastructure
14:18justin_smithsince the remove-ns will unbind all of that
14:18pbombjustin_smith: I'll probably just pass in a body to be executed before remove-ns
14:18justin_smithbut you can just use the map from ns-publics to find all the functions by name
14:18justin_smithaha
14:18justin_smiththat works too
14:19pbombThanks again.
14:19justin_smithnp
14:43dimovichHello... I'm running Emacs on Windows with Cider 0.8.1 and cider-nrepl 0.8.1 (it's present in the maven cache)...
14:43dimovichNevertheless, I get "WARNING: CIDER's version (0.8.1) does not match cider-nrepl's version (not installed)"
14:44dimovichmaybe someone can point me to the right direction...
14:46justin_smithdimovich: how are you specifying to lein that the cider-nrepl lib should be used?
14:46justin_smithdimovich: usually you would add it as a dependency in ~/.lein/profiles.clj
14:47dimovichI have in my profiles.clj files the ":plugins [[cider/cider-nrepl "0.8.1"]"
14:47justin_smithit's not a plugin
14:47justin_smithit is used at runtime, so it has to be a dependency
14:47justin_smithso put it in :dependencies
14:47gfredericksunless it's a plugin that adds itself as a dependency
14:47justin_smithgfredericks: that's weird and bad and I hate that idea :P
14:47gfrederickswhich could make sense here since presumably you need to add middleware too
14:47justin_smithgfredericks: hmm
14:47gfredericksso only a plugin could do that in one step
14:48gfredericksI haven't checked if it actually does this or not :)
14:48Bronsapuredanger: would you rather a patch with 3 commit:, -fix RT.classForName, -replace Class.forName with RT.classForName -tests or a squashed patch?
14:49justin_smithgfredericks: anyway, I have never succeeded in using cider as a plugin, only as a dependency. I got it to work by switching it to dependencies rather than plugins
14:49puredangerBronsa: squashed
14:52dimovichjustin_smith: putting it in :dependecies breaks everything...
14:53justin_smithdimovich: that's really weird - what do you mean by breaks everything?
14:54mavbozodimovich: i'm still using cider 0.7.0 and :plugins [[cider/cider-nrepl "0.7.0"]] in my windows maching
14:55dimovichmavbozo: thx
14:55dimovichjustin_smith: when I switch to :dependencies I get the "Please, install (or update) cider-nrepl 0.8.1 and restart CIDER"
14:57Bronsapuredanger: woop, race condition. I accidentaly removed your triaged
15:01dimovichSeems the warning appears whenever I start cider from a buffer in clojure-mode... If I start cider from a text buffer, everything runs ok...
15:01Bronsallasram: cfleming http://dev.clojure.org/jira/browse/CLJ-979 vote up if interested
15:02TylerEWhat's the current recommendation for an intro book/tutorial that is up to date?
15:03dbaschTylerE: what’s your background?
15:03TylerEmostly python
15:03TylerEsome (common) lisp but that was like 10 years ago
15:03dbaschyou can check this out and see if you like it http://www.braveclojure.com/
15:03TylerEso e.g. I don't need something that spends 100 pages talking about s-exprs and how cool macros are (but not how to write them)
15:04mavbozodimovich: by starting, you mean cider-jack-in ?
15:04dbaschthe joy of clojure is a great book if you’re already somewhat familiar with clojure/lisp
15:05dimovichmavbozo: yes
15:06mavbozodimovich: maybe there's a conflict in your project.clj file? (assuming you are in a project dir)
15:08mavbozoTylerE: Clojure Programming contains some python codes as comparison
15:09mavbozoTylerE: even comparison of call syntax between Clojure, Java, Python, Ruby
15:09mavbozoin page 8
15:10dimovichmavbozo: yeah, the warning appears whenever I start cider from a project dir...
15:10dimovichbut project.clj doesn't define any :plugins
15:11mavbozodimovich: try put cider-nrepl in :plugins
15:11mavbozodimovich: in your project
15:13dimovichmavbozo: nope... same warning
15:13dimovichI'll try making a new project with lein new, and see how that goes
15:16dimovichmavbozo: the new project works fine... no warning...
15:18puredangerarrdem justin_smith andyf amalloy : fyi, chouser helped me out and I now have ops here
15:19justin_smithcool
15:19amalloyneato, thanks puredanger and chouser
15:19Bronsanice
15:19puredangerthe next time I chat with Rich, I'll ask him whether I can deputize a couple others
15:20arrdemsweet
15:20sg2002TylerE: Clojure programming is more or less current. Only some korma-related(clojure sql dsl) stuff changed.
15:23sg2002TylerE: JOC is ok, but as someone who started with it, I won't really recommend it as your first clojure book. It's nice to read it later as kind of an exam of your clojure knowledge. Though maybe second edition changed... Haven't read that one.
15:24chouserWe've heard reports that the 2nd ed is a bit easier to read, but JoC was never meant as an introductory book.
15:25Bronsapuredanger: so I have a version of the current patch that also fixes CLJ-1457
15:26Bronsapuredanger: I'll attach that version along the current one as this might need some discussion
15:26puredangeris it inter-related?
15:27Bronsapuredanger: kinda sorta. CLJ-1457 is fixed by making classForName _always_ look in the DynamicClassLoader cache first even if the baseLoader is not a DynamicClassLoader
15:28Bronsapuredanger: but this might just be a workaround, not sure.
15:28sg2002chouser: Well, you had some introductury stuff in it, so to me it looked like "you can use this as an introductury book, if you really wish". Still, thanks for the book, gonna also buy second edition when I'll have time to read it.
15:28puredangerBronsa: does the 1457 change require the 979 change?
15:28puredangermight be better to attach it to 1457
15:29Bronsapuredanger: yes it does
15:29chousersg2002: yes, that's true. Maybe we would have been better out all suggestion of introductory material.
15:29puredangerBronsa: well, attach it somewhere. :) I will take a look.
15:30chousersg2002: Anyway, I hope you got some use out of the book.
15:32sg2002chouser: Was worth every penny. To bad that debug macro does not work well in cider. But I've read that there's gonna be a debugger in cider someday.
15:33Bronsapuredanger: attached & cross referenced
15:33chouserThat's good to hear. You /can/ use a real debugger in emacs via ritz, but I'm uncertain if the value is worth the setup cost.
15:39@puredangeramalloy: I gave you op, same as technomancy
15:42xaxes`hello, I've just started learning clojure and I have a little problem with stack overflow in this snippet: http://wklej.org/id/1548127/
15:42xaxes`what am I doing wrong?
15:42EvanRhead explode once again, as it turns out java.util.Date is NOT zoned
15:43puredangerjava.util.Date is the worstest
15:43puredangerexcept for Calendar, that's worse
15:43arohnerEvanR: use joda or jdk8 instants, if you can
15:43EvanRin the process i discovered the "next final form" of Calendar
15:43pbombjustin_smith: FYI, http://www.clodoc.org/doc/clojure.contrib.with-ns/with-temp-ns
15:43pbombjustin_smith: Used to exist in contrib.
15:43EvanRarohner: yes, but i have to process java.util.Dates at least to get away from them
15:44arohneryup
15:44justin_smithpbomb: yeah, remarkably close to whate you ended up with
15:44sdegutishello what is a good local backup strategy that doesnt use dropbox but has redundancy thank you
15:44llasramxaxes`: you seem to be swapping argument order in your recursive call
15:44xaxes`oh...
15:44xaxes`O
15:45xaxes`llasram: thank you
15:45xemdetiasdegutis, what are you even trying to back up
15:46justin_smithsdegutis: rsync
15:46sdegutisxemdetia: everything
15:46sdegutisjustin_smith: thanks what kind of hardware thanks in advance
15:46xemdetiasdegutis, rsync is software and I would recommend just doing that
15:46xemdetiayou need another server somewhere you are replicating to
15:46justin_smithsdegutis: rsync is a software, point it at a hard drive, and it does smart incremental backups, only sending things that have updated
15:47xaxes`llasram: now it throws null pointer exception ._.
15:47sdegutisi have a fireproof/waterproof backup drive i hope that will be enough
15:47justin_smithsdegutis: or you can even point it at a remote host, if the server is set up nicely
15:47justin_smithsdegutis: if you have the bandwidth for it, run rsync and point it to a machine in another location
15:47sdegutisjustin_smith: thanks in advance, appreciated.
15:48justin_smithmaybe populate the drive locally first, and then do the incrementals to a remote
15:49justin_smithsdegutis: I just found a bunch of crap I was working on in 2004 thanks to having used rsync. I thought it was lost but I had merely forgot where I put the external drive.
15:49sdegutishaha
15:50justin_smithlike, I forgot how much ocaml code I wrote
15:50sdegutisi wonder does rsync handle nicely if you just move a directory to a subdirectory of another directory like does it know just to move things and not re-send everything thanks?
15:50sdegutisjustin_smith: wow you must love ocaml
15:51justin_smithsdegutis: http://unix.stackexchange.com/questions/102620/rsync-that-handles-moves-sensibly
15:52sdegutissick
15:52justin_smithhttp://rdiff-backup.nongnu.org/ looks nice actually
15:53sdegutisill be the judge of that
15:55sdegutiscrap i screwed up my dropbox sync somehow by moving two directories too quickly in a row and now its resyncing the whole thing
15:55EvanRput directory in directory
15:56EvanRput bag in bag
15:57epicheroput lime in coconut
15:57mikerodI'm fairly sure I read something about leiningen one time where you could work with 2 (or more perhaps) projects at the same time from the REPL in parallel
15:57mikerodwithout any clean-install stuff
15:58mikerodis this a plugin or a command? I am not seeing it come up in any searches, except one that had a dead link
15:58justin_smithmikerod: maybe lein checkouts?
15:58justin_smithhttps://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies
15:59mikerodok, I was searching for the wrong combinations of words I think
15:59mikerodjustin_smith: yes, that does ring a bell now. I think that's what I'm looking for. Thanks!
16:02justin_smithweird off topic question: what IRC channel would I ask about sending/receiving data via a serial port connected to a tandy102? Bonus points if I can get it hooked up as an actually tty I could log in to.
16:08EvanR,#inst "2011-01-01"
16:08clojurebot#<SecurityException java.lang.SecurityException: denied>
16:13justin_smith&#inst "2011-01-01"
16:13lazybot⇒ #inst "2011-01-01T00:00:00.000-00:00"
16:15EvanR&(.getYear #inst "2011-01-01")
16:15lazybot⇒ 111
16:15EvanR&(.getFullYear #inst "2011-01-01")
16:15lazybotjava.lang.IllegalArgumentException: No matching field found: getFullYear for class java.util.Date
16:17dbaschjustin_smith: do you have a a computer with an rs232 serial port to connect to the tandy?
16:17justin_smithdbasch: rs232->usb adaptor
16:17justin_smithconnected, but getting nothing but junk characters
16:17dbaschjustin_smith: this thread from 1996 may be useful if you haven’t seen it https://groups.google.com/forum/#!topic/comp.sys.tandy/Ki7wu1shKwQ
16:18justin_smithI really like the idea of a simple laptop that runs on AA batteries, with a week of battery life, that can also be a terminal
16:18justin_smithdbasch: cool, thanks!
16:27MartinHynarhi, I am playing with an idea that component library could help me on controlling starting/stooping few things in my project, but I feel I am missing some clue on how to correctly use it when my functions need things controlled by component and I can't pass a component instance as parameter. So far, it is 1 day experience with component, so I might be perhaps not using it in the intended way, Hints welcome. I made an example here: https://gist.
16:30geekygator@MartinHynar I think your link got cut off
16:31MartinHynarhttps://gist.github.com/martinhynar/25abd9fb3e1ac88a9030
16:31justin_smith&(-> (doto (.build (java.util.Calendar$Builder.)) (.setTime #inst "2011-01-01")) (.get java.util.Calendar/YEAR)) ;; EvanR
16:31lazybotjava.lang.ClassNotFoundException: java.util.Calendar$Builder
16:31justin_smithblerg
16:32justin_smithoh, Calendar$Builder is new in java 8
16:32EvanRthe Date does not represent a date, but a timestamp. the Calendar does not represent dates either, but ZONED timestamps. WTF
16:32MartinHynarAre the links filtered out, or is it broken?
16:32puredangerMartinHynar: you might find this talk useful: https://www.youtube.com/watch?v=13cmHf_kt-Q
16:32EvanRyoull have to excuse me i am new to java
16:33justin_smithEvanR: I think the preferred option is just to use joda time, which clj-time is a frontend for
16:34EvanRim using clj-time
16:34puredangerEvanR: unless you are on Java 8, where you should consider the new library (led by the joda author)
16:34EvanRand datomic gives you a Date
16:34weavejes_The Java date/time system is notoriously bad
16:34EvanRand my library accepts Dates and Calendars
16:34weavejes_puredanger: Oh, they're finally fixing it?
16:34MartinHynarpuredanger: thanks, I'll see it first
16:34puredangerJava 8 has an entirely new library based on the ideas in Joda
16:35puredangerJSR 310 was the project
16:35TimMcThe weird thing is that it's not like they didn't put any thought into the old one.
16:35TimMcI mean, just check out the javadoc for Date.
16:36puredangerhttp://www.threeten.org/
16:38mikerodI have a project that has both a Maven pom and a Leiningen project. It seems everytime I run `lein install` it overwrites my maven pom as well?
16:38justin_smithmikerod: lein install will replace anything you have locally with the same coordinates, yes
16:39justin_smithboth the pom and the jar
16:41kenrestivo~j.u.c.
16:41clojurebotCool story bro.
16:41kenrestivo~date
16:41clojurebotCool story bro.
16:41kenrestivo~j.u.d.
16:41clojurebotTitim gan éirí ort.
16:41mikerodjustin_smith: can I stop this behavior?
16:42mikerodjustin_smith: why does it need to alter the pom? why not just package the project and install
16:42mikerodI always just revert it :)
16:42justin_smithit generates and installs a pom
16:42mikerodhmm for some maven interop?
16:42ordnungswidrigmikerod: why shouldn't it update the pom?
16:43justin_smiththere needs to be a pom file for the dep resolution stuff to work properly I think?
16:43mikerodordnungswidrig: it is complicated, but I'm using leiningen only for development
16:43kenrestivolein-pom?
16:43justin_smithmikerod: that's good, because lein is a development only tool
16:43mikerodwe haven't been able to generate a sufficient pom via lein yet
16:43mikerodso we have a manually made pom
16:43mikerodthat we use for deployment
16:43ordnungswidrighmm
16:44kenrestivocould go the opposite way https://github.com/thickey/lein-nevam
16:45mikerodhah I did not notice why it was named taht until now
16:45kenrestivoi vaguely rememebr there being a lein plugin or set of project options that'd let you customize the generated pom
16:45mikerodI've seen some extensively complex poms generated via lein
16:45mikerodI think it is possible now
16:45justin_smithmikerod: do you need to run lein install? what about lein jar, followed by using your known good pom and the resulting jar?
16:45mikerodbut I have just not had a full-team onboard with that idea yet though
16:45mikerodbut lein is still great for development because there is a lot of support out there for it now
16:46mikerodjustin_smith: I'd imagine that would work
16:46justin_smithsee also the pom options as demonstrated in the example project.clj https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L429
16:47mikerodone weird "issue" we currently have is we have "release scripts" that automatically go regex hunting maven poms to bump the version on internally developed snapshot dependencies
16:47mikerodso if we were 100% based in the leiningen project world, it'd have ot find the dep versions to bump there instead
16:48mikerodnot impossible, just haven't went there yet
16:48mikerodBeyond that, I think there is enough support now to generate some complex maven poms. I haven't seen how far it can be pushed though.
16:49justin_smithmikerod: in that example, it shows how to generate arbitrary xml output
16:49mikerodjustin_smith: this example does have some good stuff init though, thanks for the link
16:50mikerodjustin_smith: I believe you are referring to :pom-additions
16:50justin_smithyeah
16:50mikerodI was not aware of that feature. That's pretty cool.
16:51justin_smithit's singular, though, no s
16:51mikerodwoops, yes good catch hah
16:51mikerodI'll have to play around with this and see how it works out
16:51mikerodlooks like lein is all-powerful now
16:53sdegutisI'm not sure we're creating the right macros. I think we'd do better to create lower-level macros e.g. language features or control-flow features, than to use them in APIs.
16:56moquistmikerod: I'm coming in late, but your comment about your "release scripts" tells me you might be interested in lein voom ( https://github.com/LonoCloud/lein-voom ) at some point.
17:02andyfsdegutis: whatever you use for local backups, I'd recommend keeping 2 physical backups, with one kept in different location (e.g. friend's home, safe deposit box, locked drawer at office) and rotate them every month or so. Protects against theft fire and some other things
17:02mikerodmoquist: thanks for the link. this does look interesting. I'll have to look at it a bit more.
17:02sdegutisandyf: theft im not worried about (we live nowhere), fire what about just getting fireproof drive?
17:03andyfYay, amalloy has ops. Kicks to spammers all around
17:03kenrestivosolo hoy :-)
17:04andyfsdegutis: Your call. Think how sad you might be if fire destroyed fireproof drive, and decide.
17:04amalloygoodness, do i? i guess i'll have to look up how to use this stuff
17:04sdegutisamalloy: do u also kickban trolls? just ciruous
17:04amalloyi will rule with an iron fist. anyone who doesn't say nice things about me at least once a day? gone
17:04xemdetiaamalloy, u so pretty
17:05andyf(inc amalloy)
17:05lazybot⇒ 201
17:05EvanR(dec amalloy)
17:05lazybot⇒ 200
17:06sdegutisamalloy: my what large karma you have
17:07puredangeramalloy: use your powers only for good :)
17:07hiredman~amalloy
17:07clojurebotamalloy is the spotlight illuminating my dumb mistakes
17:08xemdetiaamalloy's karma can only be matched by his charity towards ducks
17:08puredangeramalloy: or for humorous mischief
17:08amalloyhah
17:09sdegutis$karma amalloy
17:09lazybotamalloy has karma 200.
17:10xemdetiais there a good place to read about the current state of binary logging in general? google is blown out for me by mysqlness
17:26TimMcandyf: I'd go further and recommend using a different backup strategy with each drive. Protects against certain systemic failures.
17:27justin_smithxemdetia: I think the "binary log" is a specific mysql thing, and not really a term for a general logging technique. Some systems store logs in a manner that is not human readable, but I don't think any of them distinguish that as their primary motive or feature.
17:27andyfWow. I've been out-safeties
17:28xemdetiajustin_smith, I was more talking just the general motions of the industry as a whole, e.g. systemd's binary logs and other fun stuff.
17:28andyf*safetied
17:28TimMcOne of my backups is rsync with --link-dest to another drive (so a series of de-duped snapshots), another is tarsnap (remote, encrypted, de-duping), and a third is a drive image (done twice a year from a live USB.)
17:30justin_smithxemdetia: yeah, I don't think you can generalize about them though. Osx has binary logs, systemd has binary logs, mysql has binary logs. But other than the fact that humans can read them without some program that interprets the data, what else can we say about them as a group?
17:30justin_smiths/can/can't
17:31ordnungswidrigsystemd binary logs are a clear deviation from the unix way of doing things.
17:32fowlslegsI'm trying to use flipBit for BigIntegers, but I can't figure out the java_interop syntax.
17:32TimMcordnungswidrig: Would The Unix Way™ approve of structured (e.g. JSON) logs?
17:33ordnungswidrigTimMc: of course not :-) That kind of logs must be human readable
17:33TimMcJSON is pretty readable.
17:34cflemingBronsa: I owe you beer, thanks :-)
17:34gfredericksit's a lot easier to go from JSON->readable than readable->JSON
17:35TimMcIt has become increasingly clear to me that logs as a giant stream of random unstructured multiline crap is wrongheaded and only leads to pain.
17:35EvanRhavent you heard of elastic search
17:35TimMcThe fact that there are tons of log analyzers out there means we should be using structured formats in the first place.
17:36TimMcAny time you have alerts based on graphs based on *regex analysis of human-readable debugging output* you've done something terribly wrong.
17:36ordnungswidrigTimMc: I'm all with you, as long as we're sure what will replace good old plain text. Every application inventing a binary log format is not helpful
17:36ordnungswidrigI'd prefer edn :)
17:36tuftEDN works nice
17:37TimMcI'm not wild about binary formats in general.
17:37tuftwant to analyze some logs? open a repl
17:37EvanRmake sure you dont log a :
17:38edwI'm looking for a no b.s. peer-to-peer messaging package for Clojure. Anyone really like anything in particular?
17:41sg2002ordnungswidrig: How about we replace good old plain text with clojure? ;-)
17:43TimMcWe have metrics (which are great for primitive data) and audit logs (which are fine if you have a small number of schemas) and then we dump everything else to logs. I think that indicates we need something that's like a middle ground between all of those -- loose or no schema, amenable to graphing, data-bearing, non-lossy.
17:43uris77what does ${::some-symbol} do?
17:43uris77kind of hard to google for #{::}
17:43Bronsa,::foo
17:43uris77sorry, s/$/#
17:43clojurebot:sandbox/foo
17:44chouseruris77: #{} is a set, and as Bronsa has shown double-colon reads as a keyword with a prefix equal to the current namespace
17:44sg2002uris77: It's a set with keyword ::foo
17:45uris77oh, so it just prepends the ns to the keyword inside the set
17:45Bronsauris77: correct, and it also can resolve aliased namespaces
17:46Bronsa,(alias 'foo 'clojure.core)
17:46clojurebotnil
17:46Bronsa,::foo/bar
17:46clojurebot:clojure.core/bar
17:46uris77oh, nice
17:46fowlslegs,(.flipBit (biginteger 8) 1)
17:46uris77thank you
17:46clojurebot10
17:46Bronsauris77: so if you have say (:require [some.ns :as s]), ::s/foo will resolve to :some.ns/foo
17:47uris77hmmm, can't I also just do s/foo without the :: prefix?
17:47Bronsayes
17:47Bronsa,:foo/bar
17:47clojurebot:foo/bar
17:47Bronsa,::foo/bar
17:47clojurebot:clojure.core/bar
17:47Bronsauris77: : will not resolve aliases in the keyword, :: will
17:47TimMc,foo/bar
17:47clojurebot#<CompilerException java.lang.RuntimeException: No such var: foo/bar, compiling:(NO_SOURCE_PATH:0:0)>
17:49TMA,'foo/bar
17:49clojurebotfoo/bar
17:49uris77hmmm, I'm confused. I'm doing (:require [some.ns as s]) and s/foo works
17:49uris77s/as/:as
17:49chouseruris77: yes, but :s/foo is just :s/foo
17:49TMA,foo/conj
17:49clojurebot#<core$conj__4079 clojure.core$conj__4079@32d521>
17:49chouser::s/foo is :some.ns/foo
17:50uris77ah, ok
17:50justin_smithuris77: I think you are maybe unclear on the keyword vs. symbol distinction?
17:51chouserwow, what a lot of little details
17:51chousers/foo only resolves to some.ns if some.ns has a var named foo
17:51chouser...or if s/foo is in a syntax-quote
17:52chouser:s/foo never does
17:52uris77so, I understand that #{::foo} will give me #{:ns/foo} . I was just confused by (:require [some.ns :as s]), ::s/foo
17:52chouserrather, :s/foo is always :s/foo
17:52chouserand ::s/foo is :some.ns/foo regardless of the existence of any var in some.ns
17:52Bronsachouser well yeah I mean, symbols always resolve to vars or error out, keywords have nothing to do with vars
17:52uris77my confusion was that I can also do s/foo and couldn't understand why I would need ::s/foo
17:54uris77but I think I understand now. if I need to add a function from that ns into a set, I can do so using :: . Sorry for being confused. Newbie here.
17:54Bronsachouser keywords don't really have much to do with namespaces either it only happens that they resolve alias using a shared mapping with the namespace system
17:55chouserBronsa: you're right. Add something about syntax-quote and we'll have said much the same thing. :-)
17:55Bronsauris77: no, you are confusing keywords with symbols. symbols have no ':' and map to a value, keywords have a : and _are_ values
17:55TMA,(namespace ::foo/bar)
17:55clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: ::foo/bar>
17:55BronsaTMA the alias expired
17:55Bronsa,(alias 'foo 'clojure.core)
17:55clojurebotnil
17:55TMAoh
17:55Bronsa,(namespace ::foo/bar)
17:55clojurebot"clojure.core"
17:56TMA,(namespace :clojure.core/bar)
17:56clojurebot"clojure.core"
17:56TMA,(namespace :foo/bar)
17:56clojurebot"foo"
17:57TimMcBronsa: Well... symbols also *are* values, but it is not their primary function.
17:57BronsaTimMc: in the context of evaluated clojure only *quoted* symbols are values
17:58justin_smithuris77: and the point of namespaced keywords is when you have a map that could contain vailues from multiple places, it prevents the keys different libs use from colliding
17:58TimMcMmm, fair.
17:58justin_smith*values
17:59TimMcBronsa: Clojure has so much support for self-evaluating literals that lists and symbols are kind of an exception -- and I forget about them when talking about code-as-data. :-)
17:59TimMcwhereas in some other lisps self-evaluating forms are more of a novelty :-P
17:59chouserIs that a condescention of programmers? No, it's a pedant of Clojurites! ;-)
17:59BronsaTimMc: it doesn't help much that the difference between the different stages are not that clear cut. Makes it hard to talk precisely about this stuff
18:00TMATimMc: I do not concur. symbols and list are the only non-self evaluating objects in Common Lisp
18:01TimMcTMA: How many self-evaluating forms does Common Lisp have? I'm not familiar with it.
18:01TMATimMc: take the numerical constants for example. 1 => 1
18:02TimMcNumbers are probably universally in that category, yes. :-)
18:02TimMc(def 3 (+ 2 1))
18:03justin_smithTimMc: yeah, likely the only languages without numeric literals are the super-minimal esolangs
18:03TMATimMc: or the strings "a" => "a" ; vectors #(a b c) => #(a b c) ; structures (as defined by defstruct)
18:03Bronsaandyf: ping
18:03andyfPong
18:03TimMcStrings!
18:03TimMcBut not everyone has vectors and sets and maps as literals.
18:03Bronsaandyf: next t.a.jvm snapshot is going to break a lot of your pattern matchings against ASTs
18:04TimMcBooleans and nil vary as well.
18:04TimMcI think in Racket, true, false, and nil are symbols that eval to those values.
18:04TimMcI really appreciate that regularity.
18:04justin_smithkeywords, characters, regexes
18:04TMAalas CL has no standard notation for sets/maps
18:04justin_smithdates
18:05justin_smithrecord types
18:05Bronsaandyf: just warning you in case you wanted to try it. I'm thinking about adding a function to safely pattern match (:do/:with-meta aware)
18:05andyfThanks for advanced notice. I'll be sure not to update to latest t.a.j. until I'm ready to go through that.
18:07andyfI can always destress myself by remembering: "Eastwood is only a lint tool, with no computational results that are affected if output is undesirable." :-)
18:07TMATimMc: but, all-told, when writing an evaluator for CL you have (defun eval (v ...) (cond ((symbolp v) (eval-symbol v ...)) ((consp v) (eval-list v ...)) (t v)))
18:10Bronsaandyf: ah I cut a release with the column patch a few hours ago. Many thanks for the help on that
18:10Bronsaandyf: a tools.reader release, that is
18:11andyfGrazie. Latest code I've been checking in doesn't rely on that, but I probably will some day
18:39turbofailg
18:39turbofailwhoops
18:47m3talsmithbbyler_tho: hi
18:48bbyler_thom3talsmith hey buddy!
19:04arohnerI don't suppose anyone has a library that works like deliver, but throws exceptions when deref'd?
19:05arohnerI'd like to be able to (let [p (promise)] (deliver p (/ 1 0)), and have deliver store the exception, and make @p throw it
19:10hiredmanarohner: manifold maybe
19:11hiredmanI haven't used it, but if I recall it has a thing like a promise with the concept of failure and success
19:11arohnerhiredman: that looks interesting, thanks
20:20david234567Hello! I have a question about core.async channels. If I have a channel with a buffer size of 10 and I put 10 things into it, then read 10 things into it, can I then put more things into it?
20:22thearthurdavid234567: yes
20:22thearthurif you ment read 10 thuings out of it
20:22thearthurrather than "then read 10 │ Cr8 things into it
20:23thearthur(cut pase failZ)
20:25david234567I did mean that, read 10 things out of (<!)
20:25david234567*of it
20:25david234567ook, awesome. Thank you!
20:26david234567(I was worried for a bit there)
20:28doritostainsI have a function that returns a multi-artiy function, how do I call one of the arities from the other?
20:32hyPiRion,((fn foo ([a] (foo a 1)) ([a b] (+ a b))) 2)
20:32clojurebot3
20:36david234567Another question about async, when does >!! stop blocking?
20:37doritostainshyPiRion: thanks! didn’t know fn could take a name!
20:42thearthurdavid234567: when a message is recieved or the channel is closed
20:43thearthuriff the channel is closed will it return nil
20:44thearthurdavid234567: sorrh read that the other way, when a message is read from the channel or someone else closes the channel
20:44david234567ook, Thank you thearthur!
20:54kenrestivounless you have a buffer...
20:55kenrestivoif it's a sliding buffer it'll never block at all.
20:55kenrestivoor dropping buffer
20:59david234567When I open a clojure file in emacs/cider that depends on other files in the same directory, why do I get a compiler error (classpath) error when I try to load it into the repl?
21:00david234567I guess it's expecting the other files to be opened first
21:00david234567but it should be able to find them right?
21:00gfredericksare those files actually on your jvm's classpath?
21:01gfredericksit's funny you ask this because I just got done manually evaling like six files because they were in a different project
21:01david234567I actually don't know how to do that
21:02itruslovedavid234567: something else that springs to mind is if that you have dashes in your namespace names, they should be underscores in the file path
21:02gfredericksdavid234567: typically you will organize your code as a leiningen project; when you have that, doing M-x cider-jack-in from one of that project's files should do the right thing
21:02gfredericks`lein new foo` to generate a project
21:03david234567ook, here's a picture of my problem
21:03david234567http://i.imgur.com/3zQBfkC.png
21:04david234567I used cider-jack-in on serverlist.clj and C-c C-k'd it
21:04david234567I then opened profiles.clj
21:04gfredericksdavid234567: there's just one project involved here?
21:04david234567yeah
21:05david234567erm
21:05david234567I guess so, I had to wrangle async_sockets to work right by downloading the file and placing it with the rest
21:06david234567Here's the part of code that it doesn't like
21:06david234567http://i.imgur.com/1kzaYrc.png
21:09david234567not sure if this helps but this is the dir structure
21:09david234567http://i.imgur.com/vVa1HuB.png
21:09itruslovedavid234567: have you restarted the repl since adding the dependency on com.gearswithingears/async-sockets in your project.clj?
21:10david234567yes, but I could probably remove that as it doesn't work (i'm not sure why)
21:14david234567now it can't find core.async hmm
21:14itruslovedavid234567: I think the problem is what you're requiring
21:15itrusloveyou need to (:require [com.gearswithingears.async-sockets :as s])
21:15itrusloveI was looking at https://github.com/bguthrie/async-sockets/tree/master - I think the README is wrong
21:16itrusloveyou should only need the source files you are writing in your src directory - the rest should be deleted.
21:17itrusloveCheck out the tests - https://github.com/bguthrie/async-sockets/blob/master/test/com/gearswithingears/async_sockets_test.clj#L6
21:19david234567Ok! I'll try that
21:20david234567:O IT WORKS!
21:20david234567:D
21:21itruslovegreat!
21:21david234567Thank you so much!
21:21itrusloveyou're very welcome. Good luck with the rest!
21:27david234567Thank you to everyone here! I'mma go now, thanks again!
21:52craigglennieI’m using Cursive Clojure, and wondering if there’s a way to do partial history completion / partial history search (I don’t know the correct term) when using the REPL. For example, in iPython, if I type “def get” and press up it only shows history where the text started with “def get”
21:52craigglennieI think Cursive is using nREPL, and I tried to find a setting for that option, but I think maybe it doesn’t exist
21:53cflemingcraigglennie: You're looking for the Tools->REPL->Search REPL history action
21:53cflemingcraigglennie: Which you can bind to a key, of course
21:53cflemingcraigglennie: You can invoke that from anywhere, too - you don't have to be in the REPL editor
21:54craigglenniecfleming: It doesn’t seem like I can type part of what I want to find, but this is still much better
21:54cflemingcraigglennie: Yes, you can type in that popup and it will narrow down
21:56craigglennieclfeming: I see… it’s a little counter-intuitive; I thought I could type in the lower window that shows the text of the selected command, but I can’t. When I tried to select the top window to see I could type in there I found that any click selects the command under the mouse, closes the window, and puts the command in the REPL
21:56craigglenniecfleming: So the typing only works if it’s the first thing you do after the search window is opened, I think
21:56craigglenniecfleming: But that’ll work
21:57cflemingcraigglennie: What else might you have done after the window is opened?
21:57cflemingcraigglennie: Click on an element or something?
21:57craigglennieWell the bottom half of the window looks like a text input field
21:57craigglennieSo I clicked on it
21:58craigglenniecfleming: And then I can no longer search by typing - key strokes do nothing
21:58cflemingcraigglennie: I see, you're right - that does seem to be broken.
21:58craigglenniecfleming: So I need to close that search and re-open it
21:58cflemingcraigglennie: Thanks, I'll fix that.
21:58craigglenniecfleming: Awesome, thanks for the help
21:59craigglenniecfleming: Also, I really like Cursive
22:00cflemingcraigglennie: No worries - I filed this so I don't forget about it: https://github.com/cursiveclojure/cursive/issues/664
22:00cflemingcraigglennie: Thanks, glad you're enjoying it!
22:02nullptr(inc cfleming)
22:02lazybot⇒ 5
22:05akkadjoy of clojure has arrived :P
22:12jay449clojure noob here. i am wring my first web app in it using compojure, etc. lotsa fun. however, one big problem: my upload bandwidth is not too good. and "lein ring uberjar" makes a roughly 40mb jar. is there a way to produce a smaller bundle when i make a small change? uploading 40mb jars to a real test server gets too much. current best solution: build from code on test server. haven't implemented that yet... was wo
22:12jay449ndering if there is a better solution.
22:25fairuzWhen developing I think you don't need each time to generate a jar
22:25fairuzI use liberator + compojure + ring, and just doing (go) in the repl will start my web server. Any modification after that, I just need to do (reset)
22:34jay449fairuz: thanks
22:34jay449i use the repl too for local testing
22:34jay449however, i still deploy 4-5 times a day to the real server to do some manual testing
22:35jay449each deploy takes me like 3+ minutes on my connection
22:37jswanson_jay449: i would just install lein on the server
22:37felixfloreshi all :)
22:37jay449haha, ok, that seems like what i was thinking
22:47sm0ke,(with-out-str (print "123"))
22:47clojurebot"123"
22:47sm0ke,(with-out-str (.print System/out "123"))
22:47clojurebot""
22:48sm0keany way to capture a System.out.println to a string?
22:53sm0kei thought print just wraps System.out.print
22:54sm0kebut it does not seems to be true
22:54gfrederickssm0ke: I think technically you can redefine System/out
22:55sm0kegfredericks: yes but i want to call a external api fucntion which prints uing System.out
22:56gfredericksso if you redefine it...you might be able to capture it?
22:56gfredericksnot sure what I'm missing
22:56sm0ke,(macroexpand-1 (with-out-str (.print System/out "123")))
22:56clojurebot""
22:57gfrederickswith-out-str uses *out*
22:57sm0ke,(macroexpand-1 '(with-out-str (.print System/out "123")))
22:57clojurebot(clojure.core/let [s__4979__auto__ (new java.io.StringWriter)] (clojure.core/binding [clojure.core/*out* s__4979__auto__] (.print System/out "123") (clojure.core/str s__4979__auto__)))
22:57sm0keis ##clojure.core/*out* ; not System/out
22:58gfredericksI know
22:58gfredericksI'm suggesting changing System/out itself
22:59gfredericks(.setOut System ...)
22:59sm0kegfredericks: wouldnt that be a global setting?
22:59gfredericksyes; this is the best you can do
22:59gfredericksafaik
22:59sm0keweird
22:59gfredericks~java
22:59clojurebot
23:00sm0ketoo hot to handle
23:00gfredericks~java
23:00clojurebotjava is a mutable basket case
23:01gfredericks~java
23:01clojurebotjava is a mutable basket case
23:01echo-areaWhy is it responding differently
23:01echo-area~java
23:01clojurebot
23:01echo-area~java
23:01clojurebotjava is a mutable basket case
23:01sm0keclojurebot: java *is* nuts
23:01clojurebotexcusez-moi
23:01sm0keclojurebot: java |is| nuts
23:01clojurebotAck. Ack.
23:01sm0ke~java
23:01echo-areaEveryone only gets one chance, and I have used it up :'(
23:01clojurebotjava is a mutable basket case
23:02sm0ke~java
23:02clojurebotjava is nuts
23:02echo-area~java
23:02clojurebot
23:02echo-areaHah, it's back
23:02Jaood~scala
23:02clojurebotscala is a good way to make people hate functional programming
23:02Jaood~haskell
23:02clojurebot"you have to see features like that in the context of Haskell's community, which is something like Perl's community in the garden of Eden: detached from all shame or need to do any work." -- ayrnieu
23:03echo-area~common lisp
23:03clojurebotcommon lisp is howl's moving castle
23:03Jaood~javascript
23:03clojurebotjavascript is beautiful, you're just too conformist to appreciate its quirks: http://tinyurl.com/7j3k86p
23:03michel_slm~haskell
23:03clojurebothaskell is Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you don't compute.
23:04michel_slm~elixir
23:04clojurebotGabh mo leithscéal?
23:04michel_slm~elixir
23:04clojurebotIt's greek to me.
23:04michel_slm~erlang
23:04clojurebothttp://www.unlimitednovelty.com/2011/07/trouble-with-erlang-or-erlang-is-ghetto.html
23:04michel_slmsomeone needs to teach clojurebot some new languages ;)
23:04michel_slm~lua
23:04clojurebotHuh?
23:05michel_slm~swift
23:05clojurebotexcusez-moi
23:05sm0keclojurebot: scala |is| object oriented, imperative, functional, and twenty other thing you can think of
23:05clojurebotc'est bon!
23:05michel_slm~scheme
23:05clojurebotscheme is Scheme is like a ball of snow. You can add any amount of snow to it and it still looks like snow. Moreover, snow is cleaner than mud.
23:05michel_slm~ocaml
23:05clojurebotPardon?
23:05Jaood~emacs
23:05clojurebotemacs is a nice operating system if it only had a decent editor
23:05michel_slm~ml
23:05clojurebotExcuse me?
23:05michel_slm~vi
23:06Jaood~clojure
23:06clojurebotclojure is for robots
23:06michel_slm~clojurescript
23:07michel_slmhmm, seems like I'm rate-limited
23:07Jaood~taco bell
23:07clojurebotPardon?
23:12dkoontzis anyone here familar with how to use Clojure interop to run a static Java method and then launch that using lein run, I keep getting errors like "Exception in thread "main" java.lang.NoSuchFieldException: main" when I try to do something like (MyJavaClass/main) from my clojure -main function
23:14sm0ke(MyJavaClass/main (into-array String []))
23:14sm0ke^^ dkoontz
23:15dkoontzinteresting, does Clojure fail to find main because it's looking for a main that takes 0 args?
23:15sm0keyep
23:16arrdemwell... Java would fail if you made that same method invocation so why should we work?
23:16arrdemadding implicit empty sequences would be... weird
23:16sm0ketotally
23:16arrdemadding implicit nils would be friggin evil
23:16sm0kebut its weird to write (MyJavaClass/main (into-array String [])) this as well
23:17dkoontzhrm, I was thinking args was a params in Java
23:17dkoontzI guess it's not
23:17dkoontzbeen too long in C# haha
23:17sm0kei would ideally love a cleaner syntax for Java's ... args calling from clojure
23:17arrdem(->> [] (into-array String) MyJavaClass/main)
23:17dkoontzyeah it makes sense to not resolve without the array
23:17arrdem&(class (into-array String []))
23:17lazybot⇒ [Ljava.lang.String;
23:18dkoontzlazybot: I did try type hinting with that exact type and passing a vector, that didn't work
23:18arrdem&(instance? (class (into-array String [])) nil)
23:18lazybot⇒ false
23:18arrdemdamnit
23:18sm0kearrdem: do you know if there is an additional copilation artifact to Java's func(Object... objs) ?
23:19arrdemsm0ke: not offhand
23:19sm0keif yes clojure could turn them into varargs?
23:19sm0kelike [& objs]
23:20arrdemI would need to look at some JVM bytecode and think about that for a while
23:20arrdemIIRC Object... objs is passed as Ljava.lang.Object
23:20arrdemas are Clojure Varargs
23:20arrdemso... maybe?
23:20arrdembut not "trivially" that I can imagine.
23:21arrdemthoughts on adding hosted articles to Grimoire 0.4 or should I just be linking out to clojure-docs as an article store?
23:30sm0kei think i should use grimoire more. looks great
23:31arrdemeh it's actually kinda broken ATM because I'm changing the way I store data
23:32arrdemall the edit links are fucked
23:32arrdemhopefully over Christmas I'll be able to get it up to the ClojureDocs living document standard
23:32sm0kearrdem: whats with the 3000 port?
23:33gfredericks(* 2 2 2 3 5 5 5)
23:33clojurebot*suffusion of yellow*
23:33gfredericks,(* 2 2 2 3 5 5 5)
23:33clojurebot3000
23:33arrdemsm0ke: hum? oh why is the real server on 3000? because I originally ran Grim on the same server as my blog, so both ran on not 80 and nginx dealt with it
23:34arrdemsm0ke: when Grim moved to its own server I just kept 3000 because I'm a lazy bugger
23:47dkoontzok, another probably dumb question, I have an app I can run with lein run that uses local jars that I include using :resource-paths in my project.clj. When I lein uberjar, the manifest doesn't include those jar files. Is there a config option to cause that to happen?
23:51sm0kedkoontz: you can install them locally into your maven repo and add them as normal deps
23:52sm0kehttp://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html