#clojure logs

2014-11-21

00:00justin_smithkenrestivo: what about using update-system, with a predicate to restart the specific component?
00:00justin_smiththat would get the component system to do its "magic" I think
00:03kenrestivofascinating. i found the problem: my stop function does a dissoc which returns a map, not a Foo record. and start doesn't know how to dispatch to the component protocol on a map
00:04kenrestivoso it just silently shrugs
00:04justin_smithOOPS!
00:05kenrestivoand yeah, maybe update-system when stopping would avoid that. trying.
00:06kenrestivoit doesn't. it can't. he must be doing some magic somewhere, it's only one page of code, reading some more.
00:07justin_smithkenrestivo: I often find when using stuartsierra libs that I am a bear of very little brain, and there is a clear and simple way to use this thing which is totally beyond me
00:08kenrestivohaha, yeah everyone's libs have their own unique flavor.
00:08kenrestivozach's libs are the ones that make me feel like i've gone through the rabbit hole.
00:11kenrestivoi think this might be by design though! maybe it's not intended to be possible to restart components, only systems?
00:12justin_smithkenrestivo: regardless of the answer, it would be nice if it were documented
00:13erikcwI have a clojurescript function that is using core.async. How do I retrieve the return value of the go macro? I don’t want to wrap it in another go macro to use <!
00:14justin_smitherikcw: you can use <!! outside a go block
00:15kenrestivoahah!
00:15justin_smitherikcw: see the walkthrough https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj
00:15kenrestivo(dissoc this :foo) is baaaaaaad..... (assoc this :foo nil) is gooooooddd
00:15kenrestivoit's protocol/record weirdness
00:16kenrestivodissoc'ing an essential field of a record turns it into a map
00:16justin_smithkenrestivo: returning a different data type because of dissoc is so weird...
00:16justin_smithright
00:16kenrestivoyeah
00:16kenrestivonow i know why certain people 'round here avoid records/protocols like the plague
00:16justin_smithI wonder what the awesome use case is that makes that featuer worth it?
00:16kenrestivoi recall the words "broken reload semantics" being bandied about. now i understand why.
00:17justin_smithhey, don't drag protocols through that :P
00:17kenrestivooh protocols in cljs are awesome
00:17justin_smithprotocols just act weird when you redefine them
00:17kenrestivoyeah "broken reload semantics". anyway, i'll consider this mystery solved. onward
00:18danielcomptonkenrestivo: component will only work on records that implement the component protocols. The maps don't so when you dissoc the key and get a map, component can't start it
00:18justin_smithdanielcompton: yeah, we discovered this and are now griping about it
00:18kenrestivoyep
00:19erikcwjustin_smith: so (prn (<!! (go (let [from-chan (<! chan)] “testing 123”)))) shoud print “testing 123” right?
00:19kenrestivoi'm just whining about the surprising behavior of records. but i guess thinking about it, it makes some sense. just didn't expect it.
00:19justin_smitherikcw: when the go block returns
00:19justin_smith<!! won't return anything until the go block is done
00:20erikcwjustin_smith: it will just block, right?
00:20danielcomptonkenrestivo: as far as unexpected corner cases go, Clojure is pretty good compared to other languages
00:20justin_smitherikcw: right
00:21Jaooddanielcompton: but JS now has flow
00:21kenrestivodanielcompton: i agree.
00:21justin_smithdanielcompton: I expect assembly to baffle me and core dump, and the track record is pretty good :)
00:23danielcomptonjustin_smith: yeah, when you get deeper into Clojure you really do need to understand the JVM. But the language itself separated from the host platform doesn't have too many surprises
00:23justin_smithit's true, I was just making a silly about "expectation"
00:24danielcomptonha
00:34realyzeHey there! Is this the right place to ask about "core.typed"?
00:35technomancynot only that, it's also the right place to ask about asking about core.typed
00:36danielcompton~ask
00:36clojurebotThe Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.
00:37danielcompton#typed-clojure is another good place
00:37realyzeCheers guys. So I'm trying to introduce core.typed to my project and I'm epically failing on type checking timbre
00:37danielcomptonBased on what's come out so far, what are people's favourite Clojure Conj talks? https://www.youtube.com/watch?v=BNkYYYyfF48&amp;list=PLZdCLR02grLoc322bYirANEso3mmzvCiI&amp;spfreload=10
00:38realyzeWith Cannot invoke type: t/Any
00:38realyze(t/ann ^:no-check taoensso.timbre/info [t/Any * -> t/Any])
00:39realyzeBut maybe I'm just holding it wrong.
00:39ambrosebsrealyze: is there a line number with that type error?
00:40realyzeType Error (habanero/activity/jira.clj:34:3) Cannot invoke type: t/Any in: (taoensso.timbre/levels-scored s1__1088__auto__)
00:40ambrosebscan you show me the code?
00:40realyzeI'll create a gist
00:40ambrosebswhat's the type for levels-scored?
00:40realyzehe project is private I'm afraid
00:41realyze(t/ann taoensso.timbre/levels-scored t/Any)
00:41realyzejust BTW - do I really have to annotate all the timbre functions myself?
00:44realyzehere's a snippet of what I'm doing https://gist.github.com/realyze/78d8b972b2b0bad2b3aa
01:09luxbockfor anyone who has watched Hickeys new transducers talk, in the source snippet he has for transduce
01:10luxbockinside the let form, there's a line like this: (let [xf (xform f), ret (reduce coll xf init)] ...)
01:10luxbockthe expression for ret is not right, or maybe I'm missing something?
01:11TEttinger(doc reduce)
01:11clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns t
01:11TEttingerperhaps
01:11TEttingerI'd think coll would go last
01:12luxbockit was not the actual source for transduce but a simplified version, so I think it's possible he made a typo there
01:12luxbockhttps://www.youtube.com/watch?v=4KqUvG8HPYo
01:13luxbockthis is the talk in case people reading want to watch it without typing things into a search box
01:15luxbockah I think know the reason now
01:15luxbockclojure.core.protocols/coll-reduce dispatches takes its arguments in that order because it needs to dispatch on the type of the collection
01:19ambrosebsrealyze: yea you need to get the annotations from somewhere.
01:19ambrosebslevels-scored needs a better type
01:21realyzeambrosebs: so just doing dummy any -> any won't cut it? That's a pity :-)
01:22realyzeI guess that's just the pains of bolting a type system onto a dynamic lang though
01:25realyzeambrosebs: that could be a nice use case to have in the docs - using core.typed on a project with timbre
01:26realyzeI'm pretty sure someone else will have the same trouble as I'm having now in the future.
01:26ambrosebsrealyze: yea, in fact core.typed uses timbre internally so I'll probably be next :)
01:29realyzehaha well you're definitely the right person anyway :-)
01:31FriedBobI've made some progress on my app, but now I am getting "Paramter declaration def should be a vector" and then it is pointing to https://github.com/llowder/run-nerd-miner/blob/master/src/run_nerd_miner/core.clj#L20 can someone help me see what I did wrong?
01:32luxbockit's the form below the highlighted line
01:33luxbock`defn` is for defining named top level functions, so it needs an argument vector
01:33FriedBobI thought it might be that function, but wasn't sure. Thanks
01:33luxbockso they way you use it, you need to add [] in there
01:33TEttingerwhich can be [] yeah
01:34luxbockyou shouldn't use `def` inside a function body though
01:34TEttingerif you're doing your def's inside a function, they will be defined at runtime
01:34TEttingerwhich is sometimes what you want, but not often
01:35TEttingererr, not just at runtime, only if the fn is called
01:36FriedBobFor the time being, that is fine, but I eill keep that in mind as I makethis actually do things.
01:40luxbockso I take this `educe` thing is completely new? I tried to search for it from clojure.core and on its Github repo but couldn't find anything
01:43TEttingereduce or reduce?
01:43luxbockeduce
01:43TEttingerwhat does it do?
01:43luxbockit was introduced in this talk
01:44luxbockit takes a transducer and a collection and returns a recipe for doing the work, but doesn't actually do it yet
01:44luxbockI'm not sure if I'm the best person to explain it so I would recommend watching the talk :P
01:46TEttingerhaha
01:46luxbockI think the point of them is that you can compose these recipes together
01:46TEttingeryep
01:46luxbockwithout creating intermediate values in between
01:47luxbockohh, there's no function called `educe` but there's `eduction`
01:47luxbockthat's why I didn't find it
01:47luxbockbut it is there
01:49TEttingerI'm thinking my next big project to be hopefully distributed to endusers may be in F#, since the JVM install base seems to be not great for the average user, and it may get much easier to bundle .NET now that it's all getting open sourced. I am certain I will use clojure as a preprocessing tool though, and as a data analysis technique
01:52gizmo385!clojurebot help
01:52seancorfieldTEttinger: but at least the JVM is cross-platform - F# will limit you to Windows for the time being.
01:53seancorfieldAnd even later, Linux and Mac won't have .NET by default - so you'll have the JVM problem again.
01:55TEttingerseancorfield, mono is distributed with F# now
01:56TEttingerand mono is currently the main way of bundling a CLR
01:56seancorfieldI've had zero luck with F# stuff on Mac (unfortunately).
01:56TEttingerhm
01:57seancorfieldI'm looking forward to that changing now that MS actually _cares_ about this stuff!
01:57TEttingeryep!
01:57TEttingermy project should take long enough that it will be the mid 2015 target for linux and mac .NET
01:58seancorfieldYeah, next year will be interesting. I'd love to see F# be truly cross-platform and reliable enough to build all sorts of apps.
02:05TEttingerwhen did you try F# on Mac? I think someone I know was using it on linux very recently
02:15seancorfieldLast year. In preparation for Lambda Jam. I signed up for the F# workshop.
02:15seancorfieldWorked great on Windows (which was what I ended up using).
02:24schrottiljjjkkjjjk
02:24schrottiwups wrong window ^^
02:46TEttinger,(let ["wat"])
02:46clojurebot"wat"
02:50kenrestivoIllegalArgumentException let requires an even number of forms in binding vector
02:53TEttingerbut it returned!
02:53TEttingerwhat sorcery
02:55TEttinger,(let ["even number of forms, eh?" "let's make it even" "or not"])
02:55clojurebot"let's make it even"
02:57TEttinger,(let ["even number of forms, eh?" "let's make it even" "or not"])
02:57clojurebot"or not"
03:09rritochOpinion question, which name is better for (comp first filter) first-filter or filter-first?
03:14marchdownWhat do I have to do before C-c and C-z in emacs work as expected?
03:15marchdownLoad the code into repl, that is.
03:27Glenjaminrritoch: i've seen that called find / detect in other stdlibs
03:30rritochGlenjamin: I suppose find-first would probably be a better name, there's already a clojure.core/find
03:35rritochGlenjamin: Thanks though, I'll try that if my first-filter commit gets reverted
03:36rritochGlenjamin: I work in a very hostile environment when it comes to common libraries... Even a small addition like this could lead to weeks of disputes.
03:36Glenjaminsounds fun :s
03:37rritochGlenjamin: It's amusing, I usually try to stay out of common areas as much as possible, but (first (filter.... shows up in these codes a lot so it really needs to be in a common area.
03:39Glenjamini saw an interesting talk recently that suggested that abstraction is only warranted if it reduces bugs
03:39Glenjaminand that saving a bit of typing isn't a strong enough reason
03:40Glenjaminin that vein, (first (filter... might not be problematic enough to be worth the effort (in scenarios where it takes effort to put into stdlib)
03:42rritochGlenjamin: It's not the typing I'm worried about, its the column width. (first-filter vs (first (filter saves one column
03:42Glenjaminyou can omit the space
03:42Glenjamin:p
03:42rritochGlenjamin: Really? I wasn't aware of that,
03:43Glenjamin,(first(filter even? (range 4))
03:43rritoch,(first(filter #(>% 2) '(1 2 3 4 5))
03:43clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
03:43clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
03:43Glenjaminoh, maybe you can't
03:43Glenjamin:D
03:44rritochThat seems odd though
03:44rritoch,(def first(filter 1)
03:44clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
03:45rritoch,(first(filter #(> % 2) '(1 2 3 4 5))
03:45clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
03:45rritoch,(first(filter #(> % 2) '(1 2 3 4 5)))
03:45clojurebot3
03:45Glenjaminoh, you can - i just can't count
03:45rritochGlenjamin: Nah, your right, I missed a parenthesis
03:45Glenjaminheh
03:46Glenjaminnot that i'd particularly recommend omitting the space
03:46rritochGlenjamin: Thats cool though, I thought the space was needed, but if it wasn't then it could be used as part of identifiers which would be extremly confusing
03:48rritoch,(first(first (cons '(foo) '())))
03:48clojurebotfoo
03:48TEttingerdude have I not pasted my super condensed clojure in here?
03:48rritochTEttinger: I haven't seen it
03:49TEttinger##(clojure.string/join" "(repeatedly 998(fn[](apply str(concat(rand-nth[[(rand-nth["B""D""G""C""F""T""K"])(rand-nth["r"""""""""])][(rand-nth["S""L""Th""Ch""Sh""L""Y""W""Z""V""M""N""T"])]])(take(+ 2(rand-int 3))(interleave(repeatedly #(rand-nth["a""o""e""i""u""a""o""e""i""au""oi""ou""oo""ai""ee"]))(repeatedly #(rand-nth["s""p""t""n""m""b""mb""rd""g""st""f""rt""sp""ch""rl""x""sh""y""ng"])))))))))
03:49lazybot⇒ "Zootosp Lasheet Terlo Kerl Soipish Namba Vomee Kochoo Wist Diyoi Dreexoot Tes Manup Thoxoo Bag Fauy Boibo Trib Tax Krart Toosesp Chomb Lipard Dangaig Bos Cesu Naixi Shourdau Maumof Fooboomb Gaumang Tafourl Croboub Los Zipat Kungi Zeerlai Shan Fraita Surtemb Coch Gra... https://www.refheap.com/93714
03:49rritochEither way, I didn't know I could drop the spaces, that is very helppful in some cases
03:49TEttingerstar wars name generator
03:49TEttingeryou can drop spaces all over
03:49TEttingerlike between strings or before vectors
03:49TEttingeror after vectors!
03:50rritochWell, that's very helpful when trying to stay in 80 cols
03:51TEttingerthis one was trying to stay in 420 or so characters, freenode's limit is around there
04:13kungiWhy am i highlighted?
04:13SagiCZ1because you are you?
04:14kungiInteresting never thought about it :-)
04:31amalloykungi: TEttinger's "random star wars character" name generator appears to have generated your nick
04:31TEttingerhaha
04:31SagiCZ1:D
04:31TEttingerI just noticed that as well
04:32daniel___i get highlights any time someone says nick
04:32TEttingerI'm sure Croboub was highlighted too, or would be if he was real
04:32kungiamalloy: I am a Star Wars Character! *swoosch*
04:32SagiCZ1my client only highlights my nick
04:32TEttingermine highlights too much
04:32daniel___i use irssi, seems to highlight lines with 'nick' in orange
04:33TEttingermy nick alert isn't a beep though, it's https://dl.dropboxusercontent.com/u/11914692/guitarsolo.wav
04:35TEttingerI'll use the greek generator next time
04:35TEttinger&(clojure.string/join" "(repeatedly 2000(fn[](apply str(concat[(rand-nth["rh""s""z""t""k""ch""n""th""m""p""b""l""g""phth"])](take(+ 2(* 2(rand-int 2)))(interleave(repeatedly #(rand-nth["a""a""o""e""i""o""au""oi""ou""eo"]))(repeatedly #(rand-nth["s""p""t""ch""n""m""b""g""st""rst""rt""sp""rk""f""x""sh""ng"]))))[(rand-nth["os""is""us""um""eum""ium""iam""us""um""es""anes""eros""or""ophon""on""otron"])])))))
04:35lazybot⇒ "rheotus sartorkum phthartangophon bashum rhorkeros nocheoseros gorkium zosanes zoipaubotron lomiam kachoxotron mepaushon meseum mobasperos phthochouxotron thoishum geobixanes thiniam peobingor zoshingiam sispanes goshum seongor tausis baspotron morkiam kongophon bau... https://www.refheap.com/93717
04:35TEttingermobasperos: a place in which league of legends and dota are played
04:36ucbI have a question: I have a macro that takes a body, and then uses this as key into a map to fish out some state to pass it
04:37ucbe.g. (my-macro (the body here))
04:37ucbthat'd fetch something like (get @state '(the body here))
04:38ucbclearly that's not great, since this doesn't work: (let [a 1] (my-macro (do-stuff a)))
04:38ucbI mean, I can't do things like (doseq [n (range 5)] (my-macro (do-with n)))
04:38ucbsince now the 5 versions of whatever the macro returns will share state, when in reality I'd like them not to
04:38ucbthoughts? solutions?
04:41jmnoznewbie question: I modified a clojure library and installed it into ~/.m2 with lein install. Still, the changes made don't show up when I run the project that depends on it. Why is that?
04:41SagiCZ1jmnoz: did you run lein deps?
04:41jmnozyes
04:42rritochjmnoz: Does your libraary rely on macros? If so they won't typically get re-expanded until you do a clean/compile
04:43jmnoznot sure
04:43jmnozI tried to do clean in my project
04:45jmnozI did check in the .jar to see that the changes were installed. I am sure I am missing something obvious here.
04:46SagiCZ1there is also a command to "refresh project" in my IDE, not sure what it translates to
04:46rritochjmnoz: What does your :depends line look like?
04:48TEttingerjmnoz, what version did you lein install?
04:48TEttingerare you depending on that version?
04:48rritochjmnoz: The reason I assk is that I believe to pull from localrepo deps like [blah/blahapp "0.1.0-SNAPSHOT"] need to be changed to [blahapp "0.1.0-SNAPSHOT"]
04:51jmnozTEttinger: yup same version
04:52jmnozrritoch: okay, it's just called blahapp... et c, no first part.
04:52TEttingerthat might be why?
04:52rritochjmnoz: Well the only other thing I can think of is check the output of 'lein classpath
04:52TEttingerthere's a package and an artifact id, you just have the id
04:53TEttingerI guess that works, nvm
04:53TEttingergetting sleepy here
04:53SagiCZ1i would like to run 'distinct' with my own equality check, is there a way to do that?
04:53jmnozTEttinger: wow that's a lot of paths
04:53jmnozI mean rritoch
04:54rritochYeah, well do you see your dep in there, and is it pulling from where your update installed?
04:55jmnozit's there
04:56rritochjmnoz: Than it's using your new code, something else must be wrong
04:56jmnozthe thing I'm trying to modify is part lein plugin
04:57jmnozit's two twings I guess, lein-figwheel and figwheel
05:20rritochWhen clojure code is run from Java, such as a java servlet, is there some way to get leiningen to interpret a project.clj file to extract things such as the compile-path? Since the code is run from Java there won't be any profiles selected so other than manually parsing the project.clj file I'm not sure if there is a better way.
05:25clgvrritoch: you won't even have access to any leiningen functions except if you add leiningen as dependency
05:26clgvrritoch: if you only need attribute values, you can supply them to the manifest file through leiningen - not sure if that is your use case
05:27rritochclgv: Sorry, my X is useless right now so I had to switch machines
05:28rritochclgv: Anyhow, I know I'd need to import leiningen as a dependency, any ideas how I deal with the profile issue?
05:28clgvrritoch: you won't even have access to any leiningen functions except if you add leiningen as dependency. if you only need attribute values, you can supply them to the manifest file through leiningen - not sure if that is your use case
05:28clgvrritoch: what exactly do you need from your leiningen profiles?
05:29rritochclgv: I need the classpath
05:29rritochclgv: I'm basically trying to chroot a servlet using pomegranite
05:30rritochclgv: I have a configuration file in WEB-INF/projectref.clj which has a pointer to the absolute path of the project.clj file
05:30rritochclgv: So I need to extract the real (calculated) paths to add to the classpath
05:31rritochCurrently I'm doing it manually with (str/replace x "%s" blah) but there's no guarantee of future compatiblity so I'd like to pull in leiningen to do it for me
05:35rritochclgv: I don't need the deps though, just the source, resource, and compile-paths, a plugin copies all the deps to WEB-INF/lib for me
05:35yocapybaraguys is there any alternative to time that will return millis instead of print them out as a side effect?
05:37rritochclgv: But that does give me an idea, I'm generating that projectref.clj file from leiningen, so I guess I can just pre-compute all the paths and avoid reading the project.clj file all-together.
05:47rritochyocapybara: Why not just use with-out-str ?
05:47rritoch,(with-out-str (time (+ 1 1)))
05:47clojurebot"\"Elapsed time: 0.013901 msecs\"\n"
05:49yocapybararritoch: aaaah due to complete ignorance, I didn't know with-out-str existed! Thanks! I looked at the source of time to see what it was doing and also realised I could make something very similar that returned - or build in the timing to my own functions
05:49yocapybarathanks!
06:00kungiCan someone please have a look at this gist and help me decifer the exception in the comment? https://gist.github.com/Kungi/4008221dc26b60225a25
06:00kungiI am trying to make a multipart post
06:01clgvrritoch: can't you add those paths to the manifest when leiningen builds your project?
06:01clgvthat'd be a pretty simplistic approach
06:02rritochclgv: There will be no manifest, the point of this construction is to be able to make hot-changes.c
06:03rritochSo putting the project into the classpath should make it possible to make changes and have them reflected in real time
06:03clgvrritoch: and thosechanges are not via units like jars but single source files?
06:04rritochclgv: Yes, previously I was "pushing" all of the code to the webroot, but copying the compiled binaries from target/* to webroot/WEB-INF/classes
06:04rritochclgv: I'm trying to add hot-development support so changes are reflected in real time
06:05clgvrritoch: so wait, is there a fixed root directory where you push those?
06:06rritochclgv: Yes, I have tomcat setup with a webroot of ~username/public_html
06:06rritochclgv: But since these projects are hosted on GIT I need to develop elseware which is why this construction will be helpful
06:07clgvrritoch: so you plan to push the whole leiningen project directory to such a root directory and then you want to create a classloader that includes the needed paths of that project on the classpath?
06:07rritochIt is basically how things are done in the Yii framework, the sources aren't in the webroot
06:08rritochclgv: No, I'm replacing the system which would push all the code to the webroot, with a system that pushes the project classpaths into the servlet using pomegranite
06:09rritochclgv: The only thing getting pushed to the webroot now are the dependencies and a configuration file which the servlet can use to locate the project
06:09rritochclgv: At least that's the theory, I haven't tested it yet
06:10clgvrritoch: so you could use leiningen on the project.clj and your problem is that you cant determine with which profiles the project.clj needs to be evaluated?
06:12rritochclgv: Yes, basically
06:12kungidakrone: I hope you are the right onl to ask. I am using clj-http to create a multipart upload and get the following weird exception (https://gist.github.com/Kungi/4008221dc26b60225a25) could you please have a look at the attached code and help me decifer what's happening there?
06:12clgvrritoch: how about just defining one as convention?
06:13clgvrritoch: profile :servlet-dev or similar
06:14clgvkungi: keyword: minimal viable examples - can't you narrow it down to the single call?
06:15kungiclgv: let me see
06:16rritochclgv: I guess that is an option, but for now to simplify the issue I'm just going to push the paths into the projectref.clj file when it's generated, that way developers are free to use whatever profile/configurations they choose without the system being dependent on specific profile names.
06:17rritochThe source code that generates it is @ https://github.com/rritoch/clj-grid/blob/master/src/leiningen/grid/tomcat_deploy.clj , so if I just cache the paths ahead of time I don't need to calculate them at runtime.
06:18rritochDevelopers will just need to make sure they have the correct profiles active when they do a lein grid tomcat-deploy path ....
06:19rritochAnd to update it again anytime they change the paths established in the project.clj file
06:20clgvrritoch: devs could define their own arbitrary profiles and provide the :servlet-dev profile as a composite profile (https://github.com/technomancy/leiningen/blob/stable/doc/PROFILES.md#composite-profiles)
06:21clgvthe degenerate case being a simple alias
06:24kungiclgv: I was able to minimize it a bit bit, but a single call is not possible as far as I see.
06:25clgvkungi: ah, due to the login
06:25kungiclgv: yep
06:26clgvkungi: since you do not pass any java objects in there explicitely, it must be a configuration error or a library error
06:27zoti have a sequence of vector where sometimes adjacent pairs need to be merged into a single item; is there a better way than using partition-by + concat?
06:28clgvzot: "better" with respect to what? code size? runtime performance?
06:29zotclgv: readability; namely is there an idiom that might match it better than this "construct->deconstruct" model?
06:29rritochclgv: I guess that solution would be much cleaner, have the servlet use profile :servlet, and have the servlet provide some kind of default value for it if it's not defined in the project.
06:30clgvzot: hard to judge the readability of "invisble" code ;)
06:30zotclgv: i'm still writing that version! :)
06:31marchdownWhere do -> and ->> macros come from (what is the reasoning behind them), and why aren’t there corresponding <- and <<- macros?
06:31SagiCZ1marchdown: they just make the code more readable somteimes
06:32dm3marchdown: try creating some hypothetical examples with <- and <<- and see if that's more readable :)
06:32SagiCZ1marchdown: it avoid nesting too much
06:33dm3anyone got some experience with boot-clj already?
06:33clgvzot: then finish it and ask again with a gist. the other option is to ask fur an idiomatic implementation providing input and output examples
06:34zotclgv: fair. will post when mine is working. :)
06:34clgvmarchdown: they are pretty useful if the logic of your code is similar to a pipeline. e.g. (->> some-list (filter some-pred?) (map some-fn) (reduce other-fn init--val))
06:35clgvmarchdown: to the second part, why is there "every?" and not "?yreve" ?
06:37marchdownWhich one is more appropriate here? All three versions work, all seem clumsy to me: https://github.com/marchdown/contest/blob/45cf1ecb2ab70b37cb4d4eb07a247fb19da6fb10/codewars/square-every-digit.clj
06:39clgvmarchdown: line 7 looks good
06:39marchdownclgv: You could argue that it’s unnatural, yet we still sometimes have to reason about function composition going right-to-left?
06:39clgvmarchdown: line 13 is horrible
06:39clgvmarchdown: no, I didn't have any idea what you intention with the reversed macros is
06:40marchdownclgv: that is exactly my point. It is horrible. And some of that horribleness appears on line 10 as well. What is the right compromise here?
06:41clgvmarchdown: line 10 is perfectly fine. you could improve it minimally, by defining the function explicitely as (defn square ...) in advance, but in this example it is not really a big improvement
06:42CookedGryphonzot: partition-by might solve your problem
06:42CookedGryphonif you make a function closing over a bit of state to track the last item
06:43CookedGryphonoh wait, you suggested partition-by, so you don't want them out as a lits
06:43CookedGryphonlist*
06:44CookedGryphonit sounds like a plain old reduce to me
06:45clgvCookedGryphon: he'll be back with his first try ;)
06:45marchdownclgv: But it’s all the same! -> version looks horrible because there are too many inline lambdas used to work around bad parameter ordering, and, presumably, with long enough piplines you get to do that all the time no matter if you pick -> or ->>.
06:45clgvmarchdown: for sequences you almost alway pick "->>"
06:46TimMcmarchdown: So use as->
06:46clgvwhcih works quite well when you write your functions such that sequential collections are always the last parameter. which is a clojure guideline btw
06:47clgvmarchdown: usually there is a low threshold for pipelines. if they get too long, it gets hard to track what they are actually doing
06:49TimMcmarchdown: http://conj.io/1.6.0/clojure.core/as-%3E/
06:50clgvTimMc: oh a shortcut to grimoire :P
06:54cityspiritanyone know how to do an INSERT IGNORE with korrma?
06:54clgvoh the clojure/conj talks are really there already
06:58rritochclgv: I see that if I use leiningen.core.project/read it is going to add the dependencies to the classpath, which I don't want. Should I be able to load the project with read-raw and and set :eval-in :servlet before calling init-project to bypass altering the classpath, or is there a big risk that it will break the plugins?
06:59clgvrritoch: uh, no idea
06:59rritochclgv: The problem is the servlet itself is usually provided by a dependency so it needs to be available before any of this code gets run, it is a chicken-and-egg problem
07:00rritochclgv: Well, it is a step forward, I'll try it and may just need to deal with any unwanted side-effects
07:01clgvrritoch: the idea I had in mind was, just to read the merged (wrt. profiles) project map and go from that
07:05inad922Hello
07:07inad922Is there a templating library for clojure which resembles Jinja or Django templates in functionality so basically it's html based with some tags for if/else or forloop control structures? Also if there is such does it work in clojurescript?
07:08marchdownTimMc: as-> looks great, thanks!
07:11Glenjamininad922: take a look at https://github.com/yogthos/Selmer perhaps
07:11inad922Glenjamin: Thanks
07:14inad922Glenjamin: Perfect! That's what I wanted. Thank you!
07:20SagiCZ1(doc as->)
07:20clojurebot"([expr name & forms]); Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form."
07:24TimMcclgv: Actually, grimoire now redirects to conj.io
07:24TimMcSagiCZ1: Like -> or ->> but with explicit placement.
07:31SagiCZ1TimMc: sorry, but what do you mean by explicit placement? it will not append it as last nor append it as second but let you say where it should place the argument?
07:37SagiCZ1i mean nor last nor first
07:40FrozenlockWhat... cider now has javadoc support?!
07:41TimMcSagiCZ1: Here's an example: http://clojuredocs.org/clojure.core/as-%3E
08:01justin_smithas is the shit, especially embedded inside -> / ->> in the right place
08:01justin_smithas-> / as->> that is
08:02justin_smithwait, there is no as->>?
08:02luxbockhow would it be different from as->?
08:03justin_smithluxbock: (->> coll (map foo) (as->> x (concat x x)))
08:03justin_smithluxbock: for usage inside a pipeline
08:03clgvO_o
08:04justin_smithclgv: as-> was originally intended for mid-pipeline usage, so why not a version that works inside thread-last?
08:05justin_smith,(-> 1 inc (as-> x (* x x)))
08:05clojurebot4
08:16grandyhello, anyone have a sense of how out of date this page is? http://en.wikibooks.org/wiki/Compojure/Core_Libraries
08:17clgvgrandy: better look at the documentation on the github wiki of the project
08:17justin_smithgrandy: I don't see defservlet - usually people use defroutes
08:18justin_smithgrandy: and as that page says, this is what you actually want https://github.com/weavejester/compojure/wiki
08:18grandyCool... anyone know of a good example of using forms?
08:18justin_smithand as clgv said
08:18grandyor handling the data posted?
08:18grandythanks to both of you
08:18justin_smithgrandy: look at any of the POST examples for that
08:19grandyjustin_smith: trying to find thsoe
08:19grandythose
08:20clgvgrandy: clojars.org uses compojure as well (https://github.com/ato/clojars-web)
08:20clgvmaybe you find interesting examples there as well
08:20grandyclgv: perfect, was looking for a nontrivial project
08:21justin_smithgrandy: POST definition from that repo https://github.com/ato/clojars-web/blob/master/src/clojars/routes/artifact.clj#L69
08:22grandyjustin_smith: excellent
08:22justin_smiththe PUT examples are good too https://github.com/ato/clojars-web/blob/master/src/clojars/routes/repo.clj#L84
08:22clgvjustin_smith: is it common to have the implementation in the route definition?
08:22grandyany other open source compojure recs?
08:23clgvin one of my projects it is much better to have the implementation in separate namespace, then I can reload that namespace and see the results in the server instance I setup via repl (I can't use "lein ring" there).
08:23rritochclgv: Is it possible to just include leiningen core as a dependency? depending on [leiningen "2.5.0"] is loading "the kitchen sink".
08:23justin_smithclgv: I think that is REST style - the main router just handles endpoints, and then each endpoint handles the various HTTP methods
08:23zotre: the previous question about merging adjacent values: https://gist.github.com/anonymous/0654ae82e81724b1ca2b
08:24justin_smithrritoch: leiningen is a kitchen sink
08:24clgv(inc leiningen) ;!
08:24lazybot⇒ 7
08:25zotafter writing it, i think it wisest to use group-by (instead of partition-by), and simplify the merging func. i wonder whether using a reduce function that refs the last value would also be smart, but this seems more natural
08:25justin_smithclgv: so it's not implemention in the route that that shows, it's sub-routing inside the implementation
08:26rritochOk, I think I found it [leiningen-core "2.5.0"] hopefully that's got less overhead
08:28clgvrritoch: 6 deps sounds reasonable http://crossclj.info/ns/leiningen-core/2.5.0/project.clj.html
08:31rritochjustin_smith: Working on adding the project to the classpath, I ran into a few stumbling blocks with leiningen and the project file but I think I now have a solution.
08:31rritochRunning tests now to see if this is a viable solution to hot-updates
08:36rritochAs long as tomcat is using the same runtime classloader when it initializes the servlet, as when it calles the doPost method for a web request, than this will work, otherwise I need to juggle classloaderss
08:48SagiCZ1java.util.Enumeration has no good interop in clojure?
08:49clgv,(apropos "enum")
08:49clojurebot(clojure.core/enumeration-seq)
08:49justin_smithSagiCZ1: it can be used, it's just a little clumsy - in fact I forget how to use it off the top of my head
08:49clgvSagiCZ1: ^^
08:49SagiCZ1clgv: cool, thanks
08:49SagiCZ1(inc clgv)
08:49lazybot⇒ 38
08:52rritochHmm, I'm starting to think using leiningen to read the project file was a bad idea, I''m checking the tomcat logs now and it's not just reading the project file, its loading all of the dependencies into the localrepo of the servers user account, it spammed my loggs.
08:54clgvrritoch: using a simple "read" function of leiningen's api does that? O_o
08:54rritochclgv: Yeah, I didn't use read directly though
08:54clgvrritoch: what did you use?
08:54rritochI'll commit what I have so far, but I have other issues now
08:55rritochSince some of my dependencies are in a private repository that needs authentication
08:55rritochIt screwedd everything
08:55clgvleiningen.core.project/read-raw sounds reasonable from the docstring
08:56rritochclgv: That doesn't load the profiles though
08:56clgvrritoch: ot loads them but it does not merge them, right
08:57rritochHere is the code ... https://github.com/rritoch/clj-grid-core/blob/master/src/com/vnetpublishing/clj/grid/lib/grid/servlet/standard_servlet.clj#L31-L62
08:57clgvrritoch: you probably have to steal the parts you need from "init-project"
08:57rritochIt is virtually the same as read, accept I set the eval-in to :servlet to block leiningen from updating the classpath on its own
08:59rritochWell, right now I'm just removing my private repositories from the project, but this is still going to be complicated to maintain.
09:01SagiCZ1is there any way to force close all open io/readers even if i dont have their handles?
09:01clgvrritoch: btw there is a #leiningen channel
09:02clgvSagiCZ1: unlikely, just open them in a `with-open` block
09:02SagiCZ1clgv: i cant, i read them with lazy seq.. i need the reading to be lazy and close it when its done
09:02rritochclgv: Well, I'm thinking of just releasing control to leiningen, if users add plugins that they expect to apply additional dependencies, everything leiningen's doing could be helpffful
09:03clgvSagiCZ1: process the lazyseq within the scope of the block
09:03clgvSagiCZ1: lazyseqs and io dont play nicely together
09:03clojurebotHuh?
09:04edwSagiCZ1: What you're dealing with is one of the most irritating parts of lazy sequences. You might want to give up laziness in this case.
09:04clgvrritoch: ok
09:04SagiCZ1edw: i would but the file wont fit in the memory :(
09:04SagiCZ1i guess i will have to pass the handles around
09:04clgvSagiCZ1: you can just reduce over the lazy-seq within the `with-open` block
09:05edwSagiCZ1: I think clgv speaks much wisdom.
09:06SagiCZ1edw: I don't doubt that hah
09:06SagiCZ1but i think i figured out a way to keep the task in the scope of the with-open
09:10edwSagiCZ1: this sort of problem is an huge hassle with SQL calls too. Make sure you grab row data before that result set gets closed! Ugh, horrible.
09:15clgvedw: but with sql, you sooner or later use pagination right?
09:16clgvedw: or load off calculations on the db (if possible)
09:21Glenjaminyou could do a deftype to represent the file which implements .close and Seq
09:21Glenjaminprobably not worth it tho
09:22clgvGlenjamin: then better take the transducers approach ;)
09:30hellofunkanyone with enough experience with both core.logic and prolog care to comment on their differences?
09:32rritochclgv: It looks like leiningen to load profiles is a dead-end. I'm going to revert all of this and just cache the paths I need. For some reason even using leiningen.core.project/read directly isn't loading plugins correctly. It was a learning experience but it opens up too many complicated vectors. Such as how to deal with passing credentials for tomcat to use with leiningen.
09:34rritochclgv: I suspect the problem is that the current working directory, isn't the project path, but I would just need to override too much leiningen functionality, making it unmaintainable.
09:34clgvrritoch: ok. do you provide a leiningen project for this code hot swap?
09:34clgvsorry, plugin not project
09:35rritochclgv: Yeah, grid source @ www.github.com/rritoch/clj-grid/ and it's pushed to clojars
09:36rritochThat's how I'm generating the backlink from the webroot to the project.clj file
09:36rritochWhen that's generated (via lein grid tomcat-deploy path) I can just cache the paths which need to be added from the classpath
09:37clgvrritoch: the plugin could offer a subtask to determine the needed paths and write them to a well-known file in the project folder - or is this how it works right now?
09:38rritochclgv: That is basically what i'm saying. Right now the "well known file" (WEB-INF/projectref.clj) is just a map that contains the absolute path to the project.clj file (and is generated by the plugin).
09:40rritochclgv: So if I add the absolute paths that I need added to the classpath (source paths, resource paths, and compile path) to the projectref.clj generated file I won't need to runn leiningen from tomcat, saving a lot of headaches.
09:40clgvrritoch: yeah, that sounds solid
09:56bcmI'm so excited about the persistant data structures talk
09:57Frozenlockbcm: What is it about?
09:58Frozenlock(what's the 'persistant' part?)
09:58justin_smithFrozenlock: http://en.wikipedia.org/wiki/Persistent_data_structure a specific implementation of immutible data that is more space efficient
09:58bcmI'm a huge fan of bitmapped vector tries
09:59bcmone of the cooler data structures imo
09:59justin_smithFrozenlock: the basic clojure data structures are persistent
10:00Frozenlockjustin_smith: ah okay, I was wondering what I was missing there. ("wasn't it always like that?")
10:00justin_smithFrozenlock: clojure is somewhat unique in how much it uses these things
10:01SirRobinHi all
10:01SirRobinI'm using cljs on node
10:01FrozenlockYeah, it's magical for cljs react.js project... you can store states all you want and reuse the data.
10:02bcmFrozenlock: yep, for no space penalty
10:02SirRobinI recently updated my project file, and jumped core.async from 0.1.338.0-5c5012-alpha to 0.1.346.0-17112a-alpha
10:02SirRobinnow when I try to use a go block I get "TypeError: Object #<Object> has no method 'setTimeout'" on cljsbuild-compiler-0/goog/async/nexttick.js:178:4
10:03justin_smithSirRobin: have you done a full clean since the dep change? sometimes a manual clean is needed when you swap versions
10:04justin_smithSirRobin: and, out of curiosity, why cljs+node rather than clojure+jvm?
10:05clgvthey still got these awesome memorable version hashes :P
10:05bcmSirRobin: how is your startup time?
10:06SirRobinjustin_smith: I removed the target folder & compiled from scratch, anything else I had to do?
10:06justin_smithbcm: well, if with cljs you either count compile time, and it's way long, or you don't, and it's decent. But compare apples to apples, and you get good startup time with clojure too, from an uberjar
10:06SagiCZ1so.. continuing from yesterday, how would i match the BOM in text file? (re-find \feff "string") ?
10:06SirRobinstart up time is way better than jvm
10:07justin_smithSirRobin: what about "lein clean" ? I am not sure where cljs keeps all its compiled stuff actually
10:07justin_smithSagiCZ1: no need to use an re, you are matching a specific pair of bytes
10:07justin_smithSagiCZ1: so .replaceAll
10:08SagiCZ1justin_smith: and what do i replace? whats the match?
10:08justin_smithSagiCZ1: sorr, I meant replace https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replace(java.lang.CharSequence,%20java.lang.CharSequence)
10:08justin_smithSagiCZ1: (char 0xfeff)
10:08justin_smitherr, actually "\feff"
10:09SagiCZ1okay
10:09SagiCZ1thank you
10:09SirRobinjustin_smith: same problem after lein clean
10:09justin_smith,(.replace "hello" "l" "w")
10:09clojurebot"hewwo"
10:09justin_smithI would use a BOM in that example, but they are weird and annoying :)
10:10SagiCZ1justin_smith: thank you, and if i just wanted to see if there are any boms in the string?
10:11justin_smithSagiCZ1: https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#indexOf(java.lang.String)
10:11justin_smith,(.indexOf "hello" "l")
10:11clojurebot2
10:11justin_smith,(.indexOf "hello" "q")
10:11clojurebot-1
10:11SagiCZ1thank you very much"
10:11justin_smithSagiCZ1: those javadocs are very useful btw
10:11SagiCZ1(inc justin_smith)
10:11lazybot⇒ 141
10:12justin_smithand I recommend the "javadoc search pane" extension for chrome / firefox, it makes this stuff much easier
10:12justin_smithand knowing how to use it will make you look smart :)
10:12SagiCZ1justin_smith: i usually use the autocomplete for java, but for clojure it doesnt work that way so i am kind of stuck with the internet
10:13clgvjustin_smith: you mean "javadoc lookup extension"?
10:14justin_smith"Javadoc Search Frame 1.5.1" is what my extension manager says
10:14justin_smithclgv: or is javadoc lookup extension better?
10:15clgvjustin_smith: I have no idea. I just want to check it out ;)
10:15justin_smithclgv: this one gives auto-complete which updates with clickable links as you type, in a side frame
10:15justin_smithso you type in a class and it finds matches
10:16SagiCZ1justin_smith: \feff doesnt seem to work, or is it supposed to be in the quotes?
10:16clgvhumm do you use the chrome one?
10:16justin_smithSagiCZ1: in the quotes, yeah, it takes string args
10:16justin_smithclgv: yeah
10:16SagiCZ1clgv: https://greasyfork.org/en/scripts/3758-javadoc-search-frame
10:16clgvI am looking for the firefox variant ;)
10:16justin_smith,(str (char 0xfeff)) ; SagiCZ1
10:16clojurebot""
10:17SagiCZ1clgv: yeah i cant seem to find it either
10:17justin_smithSagiCZ1: yeah, that looks very similar, and links to the chrome one I use
10:17SagiCZ1justin_smith: i need greasemonkey though?
10:18SagiCZ1its not like a regular extension
10:18justin_smithgreasemonkey is cool, but I guess...
10:18justin_smithI just heard it was available for ff, had not found or used it for ff myself
10:18justin_smithbtw, emacs tells me that str generated above contains a proper bom
10:19clgvworks great
10:19rritochclgv: Thanks for your assistance today. I was finally able to get it to work properly ... http://home.vnetpublishing.com:8080/~vwpdev/test.clj , My next project is to build a servlet to execute absolute refrences to .clj files instead of uploading the source, but this test proves the project resource is on the classpath.
10:19justin_smithclgv: cool, yeah, I have had great luck with that extension, even works with my downloaded javadocs
10:19rritoch(inc clgv)
10:19lazybot⇒ 39
10:20clgvrritoch: great :)
10:20clgvjustin_smith: I am using the greasemonkey script now
10:20clgvfirefox search on javadocs is awful
10:21rritochclgv: The only unfortunate behavior is that the project doesn't override dependencies, in this case my projects index.clj is ignored, because one of the dependencies provides it. http://home.vnetpublishing.com:8080/~vwpdev/ , the behavior is unfortunate, but I can live with it.
10:26rritochclgv: It is something I can probably resolve later by forcing the system to check these paths before checking for classloader resources.
10:37geekyvinHi There, I am new to Clojure and need some help, basically I have vector [{:name max, :age 26} {:name Manpreet , :id 45} {:name Elexia, :age 82}]
10:37geekyvinand a function say createTree that takes one argument at a time and gives {:name Elexia :age 82 :child {:name Manpreet :age 45 :child {:name Max :age 26} } } when used with presumable apply or map. I have tried them but could not get it right. any help will be appreciated. thanks :)
10:38geekyvinthe second one is :age not :id
10:41justin_smithgeekyvin: do you know how to do this with one entry?
10:42geekyvin@justin_smith: the minimum is two entries as one is inside the other in the o/p
10:42crash_epgeekyvin: the `map` function probably won't help you, as it returns a new collection of the same size as the collection(s) you pass to it. Whereas you want to pass in a vector of maps and get back a single map.
10:42geekyvinyeah I can imagine how to do it in one/two arguments.
10:43justin_smith(reduce (fn [child parent] (assoc parent :child child))'[{:name max, :age 26} {:name Manpreet , :id 45} {:name Elexia, :age 82}])
10:43justin_smith,(reduce (fn [child parent] (assoc parent :child child))'[{:name max, :age 26} {:name Manpreet , :id 45} {:name Elexia, :age 82}])
10:43clojurebot{:child {:child {:name max, :age 26}, :name Manpreet, :id 45}, :name Elexia, :age 82}
10:43justin_smithmaps print their fields in a weird order, so that reads funny
10:44justin_smithbut it's the right output
10:45geekyvin@justin_smith: will it work for any (number of) inputs
10:45justin_smithas long as each is the child of the next
10:45justin_smithyes
10:46justin_smithbut you need something fancier if they are in an arbitrary order
10:46justin_smithkurstin: stop spamming <- technomancy
10:48geekyvin@justin_smith: @clojurebot @crash_ep : that is awesome guys. it works!!! thanks!!!
10:49geekyvinI never really explored reduce. thats y I was stuck I guess
10:49geekyvinthanks :)
10:49vermaso I've been reading into why clojure startup time is slow, are there any more recent developments in this regard? projects out there which are trying to improve the situation?
10:49crash_epgeekyvin: reduce is an amazing function that takes a collection and transforms it into anything you want. Another collection of the same (or a different) size, a different kind of object altogether, or even just a number.
10:50justin_smithgeekyvin: reduce is amazing
10:50geekyvin@justin_smith: this seems good for now I dont think I need fancy right now ;)
10:50justin_smithgeekyvin: it gets even better with transducer / transducers
10:50geekyvinduely noted guys, I'll look into it.\
10:51justin_smithverma: technomancy has an awesome guide to fast startup time on the lein wiki
10:51geekyvinduely noted guys I'll look into reduce.
10:51vladh_Hey guys, I’m trying to use clojure-watch to monitor some files so I need my script to keep running — what’s the best way to not have a script die when it reaches the end?
10:51justin_smithverma: one moment, I will find it - it brought repl startups down from like 30 secs to 3 secs for me(!)
10:51vermajustin_smith: nice!!
10:52justin_smithverma: https://github.com/technomancy/leiningen/wiki/Faster
10:52vermajustin_smith: I was at a meetup yesterday, and one guy used clojurescript -> js -> rhino -> bytecode workflow to get a 50ms startup time for an android app
10:52vermajustin_smith: I thought it was incredible
10:52justin_smithverma: wow
10:53vermajustin_smith: the google closure compiler had already thrown out everything that wasn't needed by the time bytecode compilation started
10:53justin_smithverma: in particular, LEIN_FAST_TRAMPOLINE worked nicely for me, (as does using clojure.main instead of nrepl, when I am not using a networked client)
10:54vermajustin_smith: taking a look, thanks
10:54justin_smithLEIN_FAST_TRAMPOLINE=y lein trampoline run -m clojure.main <- the second time you run this, it will start crazy fast
10:55justin_smiththough I need to use rlwrap with that
10:55justin_smithso its LEIN_FAST_TRAMPOLINE=y rlwrap lein trampoline run -m clojure.main
10:55vermawhat's rlwrap?
10:55justin_smithcrazy fast startup after the second time
10:55justin_smithverma: provides readline wrapping
10:55vermatrying
10:55vermanice
10:55justin_smithand unlike nrepl doesn't take 10 seconds to start up :)
10:55crash_epjustin_smith: I don't see any tradeoffs to turning LEIN_FAST_TRAMPOLINE on, I wonder why it's not just the default behavior?
10:56justin_smithcrash_ep: it's new?
10:56justin_smithcrash_ep: I agree, it's great
10:56justin_smithcrash_ep: may have issues with bad caching, so may need some usage testing to establish that it really works consistently
10:57justin_smith(think of the various bugs that have been work-around dealt with using lein clean... similar issues)
10:57vermaman, this is super nice!
10:57justin_smithisn't it though?
10:57justin_smith~fast-lein is https://github.com/technomancy/leiningen/wiki/Faster
10:57clojurebot'Sea, mhuise.
10:58justin_smith~fast-lein
10:58clojurebotfast-lein is https://github.com/technomancy/leiningen/wiki/Faster
10:58justin_smithnow I just need to make sure I remember what I called it :)
11:00vermajustin_smith: I've asked him to write up a blog post and then may be it'd be fun to play with it
11:01justin_smithverma: yeah, an easy way to do clj on android would be awesome
11:01justin_smith(with good startup time that is :))
11:01vermanice, why not everywhere?
11:01justin_smithheh
11:01justin_smithtrue enough
11:02justin_smithwell, I think interop is a *little* harder to do in rhino, is it not?
11:02justin_smithso that workflow may not be universal
11:02vermayeah it is, kind of weird syntax, but I feel its a tooling problem, I an (:import ...) could be translated to rhino interop calls, I would hope
11:03hellofunkcan anyone suggest a more elegant version of this line: (if (> (count name) 10) (str (apply str (take 9 name)) "...") name)
11:03vermas/an/mean/
11:04justin_smithhellofunk: (str (subs str 0 9) "...")
11:04justin_smitherr
11:04hellofunkjustin_smith that will add ... to all strs
11:04vermabtw, here's the twitter thread sort of: https://twitter.com/samberan/status/523929208595025920
11:04justin_smith,(str (subs "hello my name is bob nice to meet you" 0 9) "...") ; hellofunk
11:04clojurebot"hello my ..."
11:05justin_smithhellofunk: sorry, at first I used a bad generic var name of "str", my bad
11:06hellofunkit is nicer justin_smith.
11:06justin_smithhellofunk: bonus, string ops are much faster than seq ops on a string followed by constructing a string
11:10justin_smith&(format "%.9s..." "hello my name is bob nice to meet you") ; hellofunk - another option
11:10lazybot⇒ "hello my ..."
11:11justin_smithwhether to use that or subs may depend on whether the numbers are ever args passed in, or whether you prefer format style to str building style
11:13hellofunk(inc justin_smith)
11:13lazybot⇒ 142
11:13hellofunkno doubt, son! thanks!
11:13justin_smithheh, np
11:14hellofunkof course, i'm actually doing this in cljs so performance considerations may be different than you describe
11:14justin_smithahh, OK
11:14justin_smithI wonder if format works in cljs...
11:14hellofunkbut your subs syntax is surely better than my deconstruct/reconstruct
11:15vladh_does anyone know how to keep a clojure script running after it reaches the end? I’m trying to watch some files
11:15hellofunk90% of the time, shorter code is likely faster code, it seems.
11:16justin_smithhellofunk: I think that regardless, the amount of allocation going on in breaking a string into chars, and then reassembling a subset of those chars (or one letter strings as in the case in js) will be more expensive than a proper substring function on either platform
11:16justin_smithhellofunk: clojure makes an effort to make the easy thing the fast thing (though clarity / determinism trumps that still)
11:17justin_smithvladh_: clojurescript or a program "script" written in clojure?
11:17vladh_justin_smith: sorry, just regular clojure
11:17justin_smithvladh_: in jvm clojure I would spawn a future with a while loop
11:17justin_smithvladh_: or maybe even use a proper fs watcher
11:17vladh_justin_smith: I’m using this https://github.com/derekchiang/Clojure-Watch
11:18justin_smithvladh_: cool. yeah, put that in a future
11:18justin_smithclojure will keep running until all the futures / agents are done
11:18justin_smithfutures are super easy to use
11:19vladh_justin_smith: futures it is. thanks!
11:25justin_smithsketchy and rash decision: using my template rendering lib on some sql files instead of adding a yesql dep, or using my own home grown map-relational-model dsl tool
11:27clgvhmm clojure-watch is not listed on crossclj.info...
11:28thesebjust curious...what is left to develop in core clojure runtime since it uses Java libraries?
11:28thesebis there much developer activity?
11:28clgvtheseb: improvements ;)
11:28thesebclgv: besides speeding things up...what other kinds are there?
11:28clgvcurrently focus is on reusable computation in different contexts -> transducers
11:29thesebwow
11:29clgvand there is a branch for static function calls, but I have been told that it is unlikely to be part of 1.7
11:29justin_smiththeseb: clojure does not use javac for most code, so it's own compiler has lots of ongoing work to do
11:30clgvtechnomancy: someone for your ban list "kurstin"
11:38vermaclgv, what do you mean, that nick sent me awesome link
11:39rylevIs it possible (and an ok idea) to check if two functions are the same in a test? When I use midje autotest I get failures because the functions are different instances.
11:39clgvverma: :P
11:39justin_smithrylev: there is no general solution for function equality besides identity, at least not in clojure
11:40clgvrylev: you can compare their classes - but if the code of the function is reloaded between the creation of both instances, even the classes wont be equal
11:40justin_smithrylev: to give you an idea of how hard this is, it isn't even possible in haskell :)
11:41rylevWell if it's not possible in Haskell it's not worth doing! ;-)
11:41justin_smithjust saying, they are super mathy and would love to have that predicate, but gave up on implementing it
11:41Glenjaminsurely `deriving Eq` does it.
11:41justin_smithGlenjamin: solve the halting problem first, sure
11:41Glenjaminoh, functions
11:41Glenjamini didn't read properly
11:41justin_smith:)
11:42EvanRjustin_smith: you cant check if a function is equivalent to identity either
11:42justin_smithEvanR: I mean the identity of the function
11:42Glenjaminif functions have the same identity, they are equal
11:42EvanRoh
11:42justin_smith,(let [f (fn [])] (= f f))
11:42clojurebottrue
11:42EvanRGlenjamin: but not only if
11:42justin_smith,(= identity identity)
11:42clojurebottrue
11:42justin_smithhaha
11:42clgvjustin_smith: only in that case ;)
11:43justin_smith,(= identity (identity identity))
11:43clojurebottrue
11:43justin_smith,(= identity (identity identity) (identity (identity identity))))
11:43clojurebottrue
11:43rylevnow you're just having too much fun
11:43justin_smith:)
11:43rylev:-D
11:43clgv,(defn f [g h] (= g h))
11:43clojurebot#'sandbox/f
11:43clgv,(f map map)
11:43clojurebottrue
11:43clgvdamn. there is some case where this fails. probably not that minimal
11:43justin_smith,(f map #(apply map %&))
11:43clojurebotfalse
11:44rylevI can only get it to fail when I reload code
11:44clgv,(f map (with-meta map {:fail true}))
11:44clojurebotfalse
11:44clgvah great ^^
11:44justin_smithrylev: yeah, reloading would make that happen reliably
11:45justin_smithrylev: you could store and compare the var, which should only get made once
11:45EvanRtheres several ways to describe equality for functions, but as far as functions defined with algorithms on possibly infinite domains, no dice
11:45rylevjustin_smith: we don't that in one code base of ours. Makes the code slightly uglier but it's ok
11:45rylevs/don't/do
11:46justin_smithquick demo of what I meant here: https://www.refheap.com/93724 but it sounds like you get the idea
11:46EvanRand equality predicates and predicates suck as a basis for reasoning anyway
11:47justin_smithEvanR: well, clojure equality testing (which tends to be structural equality not identity based) is often better than the normal method at least
11:48EvanRi noticed that
11:48EvanRbut = seems to default to pointer equality?
11:48justin_smithnot at all
11:49EvanRjust for functions
11:49justin_smith&(= [1 2 3] '(1 2 3))
11:49lazybot⇒ true
11:49justin_smithEvanR: well, that's the only predicate any lang will give you for functions
11:49sdegutisHas anyone using Speclj run into this bug? https://github.com/slagyr/speclj/issues/113
11:49EvanRid be ok with not having an equality for functions
11:50EvanRrather than possibly mixing things up
11:50EvanR,(= identity 3)
11:50clojurebotfalse
11:50EvanRbleh
11:51justin_smithhaha
11:51justin_smith,(= Double/NaN Double/NaN)
11:51clojurebotfalse
11:51EvanR,(not= Double/NaN Double/NaN)
11:51clojurebottrue
11:51EvanRer
11:51sdegutisInsane.
11:51clgv(.compare Double/NaN Double/NaN)
11:51sdegutis(doc not=)
11:51clojurebot"([x] [x y] [x y & more]); Same as (not (= obj1 obj2))"
11:51clgv,(.compare Double/NaN Double/NaN)
11:51clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: compare for class java.lang.Double>
11:52sdegutis(source not=)
11:52clgv,(.equals Double/NaN Double/NaN)
11:52clojurebottrue
11:52justin_smithsdegutis: EvanR: it's required by the floating point spec that NaN not be equal to itself
11:52justin_smithso .equals is buggy here
11:52sdegutisjustin_smith: is it required that it be not= to itself also?
11:52EvanRright, but i was expecting false for all comparisons for some reason
11:53justin_smith,(< Double/NaN Double/NaN)
11:53clojurebotfalse
11:53justin_smith,(> Double/NaN Double/NaN)
11:53clojurebotfalse
11:53justin_smithEvanR: hmm, I wonder
11:53sdegutis,(>= Double/NaN Double/NaN)
11:53clojurebotfalse
11:53sdegutisWhatever, I like Swift.
11:53EvanR"not equal" might not be a floating point thing
11:53justin_smithanother silly one: ##(= Double/NaN)
11:53lazybot⇒ true
11:54EvanRok, wtf is up with that one :|
11:54clgvno special case in its definition
11:54justin_smithEvanR: clojure short circuits, one arg to = always returns true
11:54justin_smithit's a special case in =
11:54clgveverything is equal to itself, well except ...
11:54EvanRwhy
11:54justin_smith$source =
11:54lazybot= is http://is.gd/8CTFcB
11:54clgv,(=)
11:54clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/=>
11:54clgv:(
11:54justin_smithEvanR: so that (reduce = coll) makes sense
11:55justin_smith,(reduce = [])
11:55clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/=>
11:55EvanRwhat
11:55justin_smith,(reduce = [1])
11:55clojurebot1
11:55EvanRreduce uses arity 1 ?
11:55justin_smithyou want that to be true, right?
11:55clgv,(reduce (fn [a,b] (println "called!") b) nil [1])
11:55clojurebotcalled!\n1
11:55clgv,(reduce (fn [a,b] (println "called!") b) [1])
11:55clojurebot1
11:55justin_smithEvanR: wait, I am wrong
11:55clgvjustin_smith: ^^ ;)
11:56justin_smithEvanr it is the recur in =
11:56justin_smithEvanR: the recur needs the one arg base case
11:56EvanRuhg
11:56clgvjustin_smith: in reduce with a collection of 1 element and no seed, the function does not get called ;)
11:56legittalonI understand (>) but what does (>>) do?
11:56justin_smithclgv: right, I was wrong on that
11:57justin_smithlegittalon: where do you see >> ?
11:57justin_smithdo you mean ->> ?
11:57legittalonyeah
11:57legittalonmy bad
11:57justin_smith$grim clojure.core/->>
11:57lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/-&gt;&gt;
11:57EvanRgood thing i never accidentally use the right number of args minus 1, or that would be annoying
11:57justin_smithlegittalon: above link has docs and examples
11:57justin_smithEvanR: haha
11:57clgvwhy did the incanter devs think maps would be a good representation for table rows... it's blowing the heap again for a 400MB file :(
11:58sdegutisI like Hiccup, but I don't like that I can put random code in a Hiccup template.
11:58sdegutisI really value logic-less views as a way of enforcing separation of view and model, and encouraging using presenters, like mustache would have.
11:58justin_smithsdegutis: selmer is logic-less right?
11:59sdegutisAt the same time, Hiccup is very valuable since it's highly readable and pure code, so it can be manipulated with very little effort, e.g. partials can just be plain old Clojure functions, and you already get looping on collections and such for free.
11:59justin_smithsdegutis: at least, selmer doesn't support arbitrary code, only explicitly passed in helpers
12:00justin_smithsdegutis: I use the in-house caribou tool (caribou/antlers) which is quite similar to selmer, mustache style syntax, pass in helpers to the render function
12:00EvanRlogic-less is a new word for me, i immediately thought it meant no if statements and for loops in the template, but i guess logic is a word to mean something like "business logic"
12:01justin_smithEvanR: yeah, more like "not turing complete"
12:01sdegutisEvanR: Right, it has very very limited logic, only what's absolutely needed for turning your pre-processed data and template into the final intended view.
12:01justin_smithEvanR: "logicless templates, they allow paridoxical definitions!"
12:01EvanRi still dont know whats going on
12:02sdegutisjustin_smith: That sounds very tempting, but what Hiccup has going for it is the very expressive and easy syntax specifically intended for outputting HTML/XML.
12:02Glenjaminhiccup doesn't escape by default
12:02sdegutisjustin_smith: With mustache and friends, you have to put "<div>{{ bla }}</div>" manually in there and it quickly gets verbose and tedious.
12:02Glenjaminwhich is a big gotcha imo
12:02sdegutisGlenjamin: Oh, I didn't know that. Good thing we don't allow any user content in our website.
12:03justin_smithsdegutis: yeah, depends on workflow though - we had frontend guys who didn't do clojure, so they preferred mustache style over hiccup data structures
12:03Glenjaminit's possible to get hiccup syntax and safe-by-default escaping, but the current implementation doesn't make that easy
12:04EvanRhtml should have just had "functions", taking care of the 1000 not-essentially-different-from-html template languages that also failed to realize this. function here does not mean an implementation of bubblesort with mutable arrays, or sending email
12:05EvanRsubstituting a text variable, or even a list of text into.. text.. isnt enough
12:06EvanRtemplates are functions
12:11sdegutisI think there could be value in having a Clojure templating language that's got the expressiveness, succinctness, and structure of Hiccup, but without necessarily using Clojure data structures, in order to remain friendly to designers who don't know Clojure.
12:12sdegutisIt would resemble Hiccup in its syntax, but drop a little of what's only necessary for the "it's just plain Clojure data" principle, like this: "html\n body\n span Foo bar" would result in <html><body><span>Foo bar</span></body></html>
12:13tbaldridgeyay, replace hard Clojure syntax with invisible whitespace!
12:14xemdetiaThis is kind of a random question, but for GTK emacs is there a nice way to change the double-click select rules? To make them closer to a term/putty?
12:14sdegutisOne benefit of not having pure Clojure syntax would be to limit what kind of logic is allowed.
12:15sdegutisIt's all too easy to throw raw Models right into a Hiccup template and manipulate them in there, instead of creating a Presenter layer first and passing that into the Hiccup template.
12:15justin_smithxemdetia: #emacs may be able to help there
12:16justin_smithxemdetia: I tried to do M-x describe-key followed by double-click to see what gets run, but it only captured the first click
12:17xemdetiajustin_smith, I was running into the same issues- it's in mouse.el I guess but I don't even know if there is an infrastructure to plug into there. I was hoping that someone messing around with clojure modes would have figured it out. :)
12:18sdegutisPlus there is value in having maps which are otherwise stringly typed be checked for valid keys, which raw Clojure code can't do (without a wrapper) and which a template language could.
12:18justin_smithxemdetia: heh, who knows, but if anyone does #emacs or #clojure-emacs will
12:18technomancythe #emacs channel will just make fun of you for using the mouse
12:18justin_smithhaha
12:18sdegutisI started using the mouse more often lately ever since Emacs was causing me to have damaging injuries to my left hand earlier this year continuing to this day.
12:19sdegutisRMS is in denial for thinking his RSI wasn't caused by his own creation.
12:19justin_smithyeah, emacs has nice features but those bindings will fuck you up
12:20technomancyI used to get RSI from using the mouse
12:20technomancywell, it might not have been RSI; the pain was worse in my shoulders
12:20sdegutisWas that with those 80s mice?
12:20technomancytechnically a trackball
12:21technomancyit was just the movement off the keyboard to the not-keyboard
12:21justin_smithtrackballs are better than most mouse-like things rsi wise
12:21justin_smithand being able to put it between your hands makes it even better
12:22justin_smiththat's what I have, half my keyboard on each side of a trackball
12:22justin_smithI can use the ball left or right handed, with many possible clickable hand-positions
12:23justin_smithtakes the "r" out of rsi if you have multiple comfortable positions available (and use them)
12:23FriedBobI'm still holding out for somethgn that'll let the cursor track my eye movements.
12:23justin_smithFriedBob: oh nice, popups that cause bugs in my code :)
12:23technomancypanning around virtual desktops via tracking head movement plz
12:23justin_smithI use mouse-to-type in my wm
12:24justin_smithI've had pair-programming scenarios where someone moves my mouse, causing me to type code into random windows...
12:25xemdetiajustin_smith, are you sure you just weren't part of a psychology experiment?
12:25justin_smithhaha
12:25canweriotnowlesterthx I'd sue the IRB that approved that.
12:26justin_smithin their defense, they did not comprehend the concept of mouse to focus, so they expected moving the mouse not to effect what I was doing
12:26SpaghettiCatHello, I have a noob question and I'm hoping someone will condescend to answer. I want to learn Clojure because it's novel, but, e.g., if I want to create a small, desktop GUI utility, is clojure a bad choice because of the time it takes to load JVM and how much memory it takes up?
12:27SpaghettiCatIs clojure only for big apps and backend, powerful stuff?
12:27justin_smithSpaghettiCat: for longer running programs it should be OK - the startup time is much better for an uberjar compared to what you would get from lein
12:28SpaghettiCatjustin_smith: : I'm new to the JVM world so I can't appreciate what you said
12:28clgvwhy do people complain about startup time for clojure gui applications? non-trivial applications always need at least some seconds to start up...
12:28clgv+GUI
12:29pmonksSpaghettiCat: might be worth trying it out and seeing for yourself if it's a bad choice? Hard to know what that means for your use case.
12:29technomancyEmacs boots in ~900ms
12:29justin_smithSpaghettiCat: the jvm is just a part of what makes clojure slow, and with a compiled project (not dev mode using lein) you can eliminate a substantial part of that overhead.
12:30SpaghettiCatHmm I see
12:30justin_smith*slow to start up
12:30pmonksSpaghettiCat: plus you get to play with really nifty libraries like seesaw: https://github.com/daveray/seesaw
12:30justin_smithreally, jvm is a big part of what makes clojure fast :)
12:30clgvtechnomancy: that's a second :P
12:30canweriotnowtechnomancy depending on how many packages you're preloading :)
12:30SpaghettiCatIf I write a Python script and executed it, the startup time is very, very fast. But I get the feeling that it's not the same when you have to load up JVM
12:31SpaghettiCatI know that JVM is fast at executing, what I'm worried about is memory footprint and startup time
12:31justin_smithSpaghettiCat: the jvm default is to trade larger preload / startup delay, for faster runtime performance
12:31clgvJVM is pretty fast as well, Clojure itself is kinda slow on startup atm
12:31justin_smithSpaghettiCat: it is optimized for long-lived processes
12:31clgvwhere is that link from the last days?
12:31SpaghettiCatHmm I see, thank you for the info
12:31technomancyclgv: yeah, but emacs is like seventeen different apps
12:31clgvWhy is Clojure bootstrapping so slow?
12:31clgv
12:32clgvtechnomancy: yeah emacs is an OS ;)
12:32clgvI skip the editor joke.
12:32clgvups title and not link :P
12:32clgvhttp://nicholaskariniemi.github.io/2014/02/25/clojure-bootstrapping.html
12:33justin_smithSpaghettiCat: if you want persistent data structures, and functional programming, plus smaller heap usage and faster startup, you could consider racket or ocaml
12:33SpaghettiCatSo I guess Clojure is aimed at enterprise apps, big/powerful programs (like an XML editor) and backend stuff?
12:33technomancyclgv: it's not actually a joke though
12:33technomancySpaghettiCat: the JVM was created by a company that sold server hardware
12:33SpaghettiCatjustin_smith: My 2nd choice would be haskell: it compiles to native
12:33justin_smithSpaghettiCat: yeah, I find it is great for big server side stuff that stays running for months at a time
12:33justin_smithSpaghettiCat: so do ocaml and racket
12:34justin_smithSpaghettiCat: and they make smaller and at least in ocamls case, faster starting executables
12:34SpaghettiCatjustin_smith: They seem to be less popular
12:34clgvSpaghettiCat: you can do a lot of different stuff with clojure: web dev, data analysis, machine learning, optimization algorithms
12:34justin_smithSpaghettiCat: yes, they are
12:35pmonksSpaghettiCat: I've had good success with CLI apps that only run for short periods (a minute or two). I think it all boils down to how long your total runtime is, and therefore how much you can amortise the startup time.
12:36SpaghettiCatI like lightweight programs on my desktop
12:36SpaghettiCatwhich is why I have avoided Java apps. I don't have any installed except for LibreOffice
12:36clgvwhat is a lightweight program?
12:37SpaghettiCatclgv: Low memory footprint, fast startup, doesn't peg the CPU
12:37clgvSpaghettiCat: whast exactly is "low"?
12:38pmonksLibreOffice isn't a Java app.
12:38pmonks(except, IIRC, for the MS Access alternative)
12:38justin_smithSpaghettiCat: clojure wants the opposite of all of those (it wants to peg every CPU available because that gives you the result faster, and it optimizes away from the other time because that gets more results from the same amount of cpu usage). You may be happier with a differently designed lang.
12:39SpaghettiCatHigh memory footprint for me is >100MB. I remember installing JDownloader and it took up 200MB-300MB, which is massive overkill
12:39justin_smiths/other time/other two/
12:40clgvSpaghettiCat: set the -Xms and -Xmx appropriately...
12:40SpaghettiCatAhh, now I see
12:40SpaghettiCatclgv: But what is the minimum the JVM can take up?
12:41clgvSpaghettiCat: you'll see. it depends on what the program does
12:41justin_smithmore important is the minimum that clojure can take up - it can't run without initializing a large number of persistent data, and loading its full compiler.
12:41justin_smitha java hello world is a lot smaller than a clojure hello world
12:42AimHereIt is?
12:42justin_smith(in memory at runtime that is)
12:42justin_smithAimHere: by orders of magnitude
12:42AimHereWell that's kindof a given
12:43justin_smithI mean the clojure code for hello world is "hello world" much smaller than java, but the size of the runtime to implement that...
12:43justin_smithAimHere: java comes with a lot, but is lazy about loading needed classes into heap
12:44justin_smithAimHere: but clojure needs many those classes to bootstrap itself, and it's own internals are large
12:44AimHereSure. I only queried in the first place, because you didn't say you were referring to runtime memory
12:44justin_smithgotcha
12:44AimHereI thought you just meant source size
12:44justin_smithAimHere: the conversation was about runtime memory usage
12:45AimHereI never read up more than 3 lines in the scroll buffer
12:45AimHereLife's too short!
12:45clgv"lein repl" in one of my projects with 15MB (-Xmx) fails and with 20MB succeeds to start
12:46hellofunka function literal would be better to test for equality, woudln't it?
12:46hellofunk,(= (fn [x] (inc x)) (fn [x] (inc x)))
12:46clojurebotfalse
12:46clgvso I guess it is "lightweight" ;)
12:47justin_smithclgv: you could get that smaller with LEIN_FAST_TRAMPOLINE=y rlwrap lein trampoline run -m clojure.main
12:47justin_smithhellofunk: but = does not see the literal
12:47justin_smithhellofunk: it sees the compiled function
12:47clgvjustin_smith: interesting. I just wanted to have a rough number for the repl there ;)
12:47hellofunkexactly ,which is why function equality is hard to achieve
12:48justin_smithclgv: sure, but lein repl loads nrepl, which is relatively big - the above literally just gives you a repl
12:49Bronsahellofunk: even comparing functin literals, = would still be useless. (fn [x] x) vs (fn [y] y)
12:49clgvjustin_smith: sure. the only memory concern I have is with dataset rows as clojure PHMs in incanter. that's just horrible and I need to find a way around it
12:50clgvBronsa: unification! :D
12:50justin_smithI hope I don't sound like I am badmouthing clojure. I think clojure is great, I use it for everything I can, but it doesn't optimize for low heap usage, in any way at all
12:51Bronsaclgv: then (fn [x] (inc (dec x))) vs (comp inc dec) :P
12:51hellofunkBronsa yes that was my point, to show that fn equality is not available. because (= map map) returns true which is misleading, hence the literal example
12:51justin_smithI even went and got a laptop with 32g ram so I could use clojure and just not think about heap usage until it deploys
12:51clgvBronsa: sure
12:51EvanRhellofunk: you can check syntactic equality, even accounting for renaming variables. but this isnt a general form of function equality
12:52technomancyjustin_smith: on the other hand, I haven't upgraded from 4GB so I can still feel the pain of users =D
12:52justin_smithtechnomancy: you are a saint
12:52justin_smith(inc technomancy)
12:52lazybot⇒ 159
12:52clgvtechnomancy: very emphatic of you :D
12:52justin_smithyou could of course upgrade, and develop in a vm
12:52EvanRi have 8G and im feeling the pain of datomic
12:53clgv16GB and I feel the pain of using incanter to load up a 400MB dataset :(
12:53justin_smithhilariously, I run a super lightweight wm for UI reasons, and for a client project I have a SuSe install running with the default kde desktop in a vm
12:53technomancythat's not actually why; I'm just waiting for my Novena to arrive
12:53EvanRnobody will need more than 640k
12:53justin_smithtechnomancy: well use a ram limited jail and you can hold onto your purity
12:54clgvare we telling urban legends already?
12:54technomancyjustin_smith: yeah, but until recently that would have meant downgrading my screen
12:54justin_smithtechnomancy: I may just want a novena too though... that looks awesome
12:54vermaJust posted this on the mailing list based on what I was talking about earlier: https://groups.google.com/forum/#!topic/clojure/foeLiIDx4q8
12:54technomancyI can always SSH into more ram if I need it; I can't SSH into a better screen
12:54justin_smithtrue that
12:54clgvhaha :D
12:55justin_smithverma: cool, bookmarking that thread to follow it
12:57Glenjaminthe novena google results are an odd mix of FLOSS and catholisism
12:57vermayeah, totally threw me off
12:57technomancyGlenjamin: https://www.crowdsupply.com/kosagi/novena-open-laptop is the best one
12:58pmonks(inc EvanR)
12:58lazybot⇒ 5
13:00sdegutisWhat would cause (macroexpand) to behave differently at two different times?
13:01Bronsa,(defmacro x [] (rand))
13:01clojurebot#'sandbox/x
13:01sdegutisSometimes it seems to work as macroexpand-1 should. Is it possible that someone could have redefined it?
13:01Bronsa,(macroexpand '(x))
13:01clojurebot0.5872319973633218
13:01Bronsa,(macroexpand '(x))
13:01clojurebot0.9289759698202612
13:01technomancyjustin_smith: did you ever come across prescheme?
13:01justin_smithtechnomancy: no, but the wikipedia on it looks very interesting
13:01justin_smithtechnomancy: what about it?
13:02technomancyjustin_smith: I'm tempted to try to get it compiling to avr
13:02technomancyI can't find evidence of it being used for anything but the s48 VM, but it looks awesome, especially the type system
13:03justin_smithoh yeah, it seems like a nice compilation target or IR - or I guess you could suck it up and program scheme without closures manually :)
13:03technomancyjust wondered if you had come across it in your exploration
13:03justin_smithnope, not at all
13:03technomancywell if the alternative is C...
13:03justin_smithyeah scheme without closures can beat C, especially if the overhead is low enough
13:03justin_smithwhich it seems it could be...
13:04technomancythat's the claim
13:04technomancyseeing a hello world would help
13:05technomancythat's scheme for you; they'd rather write a beautifully-typeset 11-page paper than a simple getting started readme =)
13:06justin_smithhah
13:06technomancyanyway once the dust settles from the atreus announcement I might give it ago
13:08erikcwIs it corect that <!! isn’t available in the clojurescript version of core.async?
13:08justin_smithtechnomancy: have you looked at the scheme48-doc that is available from apt?
13:09technomancyjustin_smith: I've just been looking through a checkout of the source, but I also found http://mumble.net/~campbell/darcs/s48-refman/prescheme/
13:09vermaerikcw, it isn't because there are no real threads
13:09technomancyhaven't gotten a chance to read through the tex manuals yet
13:09justin_smithtechnomancy: oh, texi, I love info docs (making me one of a very small number likely)
13:10technomancyjustin_smith: I'm a fan too; gotta have my hyperlinks
13:10justin_smithps-as-scheme.texi looks right
13:10erikcwverma: So what is the correct way to consume the channel returned from a go block? Basically — how do I leave core.async land?
13:11technomancyjustin_smith: were you looking for stuff for microcontrollers too or just general low-level langs?
13:11justin_smithtechnomancy: for embedded (recent example, using a cell phone chip without an OS)
13:11technomancycool
13:12justin_smithtechnomancy: that board even theoretically could support desktop ram
13:12justin_smithso - gigs of ram - no OS
13:12justin_smithlol
13:12technomancy._.
13:12justin_smithtoo bad mirage is vm-only, that would be interesting
13:13justin_smithtechnomancy: this is for DSP, so there are valid reasons to skip an OS if possible, and to have as much working ram as you can afford
13:13technomancyoh sure; makes sense
13:14technomancyreasons to skip a GC too, maybe?
13:14justin_smithright, or use a gc that is optimized for worst case rather than average case
13:14vermaerikcw, what are you trying to do?
13:14vermaerikcw, would be nice to see some code
13:15justin_smithtechnomancy: because a DSP that hangs ever is worse than one that is a little more limited power wise
13:15justin_smithhangs meaning fills a buffer 1ms too late
13:15technomancyep
13:15technomancy*eep
13:16justin_smithtechnomancy: time domain output, any irregularities ruin the result
13:16justin_smithaka - the audience can hear a glitch happen, or your analysis is fucked because an artifact snuck in, or whatever
13:17justin_smithbut I am still a dabbler with this stuff - I have played with things getting close to it, and read about it for a while, but this is the first time I have had good access to custom built hardware to do it in anger
13:19erikcwverma: http://pastebin.com/S1j3X2YD
13:20erikcwverma: Kind of a mess since I’ve been moving stuff around a bunch trying to get this to work
13:20erikcwverma: Basically, I’m trying to get the dimensions of an image file from and HTML file input
13:21erikcwverma: It involves 2 layers of nested callbacks, 1 for the js/FileInput object, and one for the js/Image object
13:22justin_smithtechnomancy: hrm, the docs that come with scheme48 on my system have no mention of prescheme
13:23hellofunki'm watching this video where William Byrd suggests that MiniKanren (and thus core.logic) are all the pure parts of Prolog, with the impurities cut out. Best comparison I've heard yet of the two.
13:23technomancyjustin_smith: it's treated as an implementation detail
13:23justin_smithtechnomancy: makes sense. Much like the weird lisp dialect hidden inside gcc
13:23technomancyhaha, yeah
13:23justin_smithtechnomancy: I wanted to play with that, until I discovered that they intentionally made it hard to use directly
13:24justin_smithtechnomancy: those anti-corparate security via obscurity shenanigans!
13:24sdegutisjustin_smith: there is!?
13:24justin_smith"let's cripple this open source software's pluggability, so that corporate users don't subvert our licensing by extending it internally"
13:25justin_smithsdegutis: yes, there is. But using it directly is likely a dead end.
13:25sdegutisso weird
13:25sdegutisWhat is it used for?
13:25justin_smithsdegutis: basically, once your code is parsed, and they have an ast, they have a lisp for doing optimizations
13:26{blake}Greenspun's revenge!
13:26justin_smithbecause lisp is great and rearranging and interpreting asts, as we know
13:26sdegutisWhy don't they just use a plain struct-based AST like a normal person?
13:26krstoWould anyone happen to know if leinigen has an included Node-Webkit project template? I've found some but not an official one.
13:26justin_smith{blake}: I think they were intentionally greenspunning here
13:26justin_smithsdegutis: because that's much weaker than a lisp
13:26sdegutis:|
13:27justin_smithsdegutis: and they are a bunch of lisp-loving weenies
13:28sdegutisASTs are excellawesome
13:28sdegutisC structs too
13:28Glenjaminbut you'll want a set of standard functions to manipulate them
13:28Glenjaminmight as well be in lisp :D
13:28justin_smithyeah, and why not aim for lisp, right
13:29Glenjaminthis one? http://gcc-melt.org/
13:30justin_smithGlenjamin: I forget the name, but so far that looks like it. There was some controversy when it came out that they intentionally made it weaker / harder to use in order to prevent end-runs around the GPL.
13:31jmontleonhow hard would it be to change building something with leiningen to clojure-maven-plugin. is this a pom file change for plugins, or something bigger?
13:31justin_smithGlenjamin: this looks recent enough that it could be a restart to make it more accesible (perhaps inspired by clang)
13:32sdegutisHow ironic. The GNU people are so strictly opposed to proprietary works that they effectively make their own software proprietary so that nobody can bypass its "openness".
13:32sdegutisThe most backwards and counterproductive mindset if I ever saw one.
13:32justin_smithjmontleon: you would need to make a pom with all your deps in it, right? or does clojure-maven-plugin know how to load project.clj?
13:32justin_smithsdegutis: yes, I was very annoyed to see how that played out
13:33sdegutisGNU has literally become its own enemy.
13:33jmontleonjustin_smith, I do not know, but you can create a pom using leiningen, right?
13:33Glenjamini always thought the GPL having specific technical distinctions between compiling and linking was odd
13:33justin_smithjmontleon: right, but if you were migrating from lein, you would then need to update the pom manually, I assume
13:34jmontleonjustin_smith, ya, I'm not opposed to creating a pom using lein each time. The backstory is that we have a build system where we are able to use maven, but not lein
13:34justin_smithahh
13:34jmontleonso if I want to build the clojar and I can do it with maven in the build system my life is happy
13:36justin_smithjmontleon: regarding plugins, I don't think any lein plugins will run without lein, so you would hopefully have a build that does not rely on plugins
13:38jmontleonjustin_smith, I'll take a look
13:38justin_smithjmontleon: you may get better info from #leiningen too
13:38jmontleonthanks, i can ask there too
13:42sdegutisI'm all for emphasizing the "core" namespace as long as you think of it as "core vs extras" rather than "core vs exterior/shell"
13:45justin_smithsdegutis: compojure.tl-dr
13:45sdegutisjustin_smith: did you just now come up with that?
13:45justin_smithyes, just now
13:45sdegutisjustin_smith: because that's actually the perfect name for the primary namespace of any lib
13:45justin_smithmay replace some .core with .tl-dr now
13:45sdegutisIt's so incredibly accurate and conveyish.
13:46justin_smithmy-proj.use-this-namespace
13:49Glenjaminyou can have both myproject and myproject.other-stuff as namespaces with stuff in
13:49technomancyI'm a fan of breaking up the name of your project
13:49technomancyslamhound -> slam.hound
13:50technomancyuse syllable boundaries if you have to
13:50Glenjaminany particular reason, or just for kicks?
13:50justin_smiths.l.a.m.-.h.o.u.n.d
13:50technomancyjust don't make me load yet another "core" namespace uuuuugh
13:50technomancy"core" means the opposite of "entry point"
13:50justin_smithvia the above method, you can have a proper trie of available namespaces
13:51Glenjamin(:require [slamhound slamhound.misc]) ; works
13:51Glenjaminso core isn't really needed, if you're ok with that
13:51technomancyGlenjamin: it's supposedly problematic if called from java
13:51Glenjaminah
13:51justin_smithGlenjamin: that kind of breakup is annoying when using automated tools to find usages (ie. grep)
13:52sdegutisjustin_smith: you have just solved the namespace problem for everyone
13:52sdegutistechnomancy: only if you're thinking of an apple
13:52justin_smithsdegutis: I am glad that you appreciate this
13:52sdegutisjustin_smith: I mean the .tl-rd namespace
13:52justin_smithright, OK
13:52sdegutishuh?
13:52Glenjamin:require myproject.dot
13:53sdegutistechnomancy: core [noun]: "the central OR most important part of something" (emphasis mine)
13:53sdegutisThe public interface is arguably the most important part of something because without it the library cannot be used effectively.
13:53Glenjamin:require myproject.public
13:54technomancy"interface" implies "outside" while "core" implies "inside"
13:54Glenjamin:require myproject.shell
13:54justin_smithmyproject.fascia
13:54Glenjamin:require myproject.to-be-loaded
13:55sdegutisproj.entry, proj.public, proj.gateway
13:55hyPiRionsdegutis: perhaps one example: the core of a planet is not its outside
13:56sdegutishyPiRion: Yes, there is the whole apple/planet definition of "core", but that's not the only meaning.
13:57technomancyit's the meaning used by clojure.core
13:57Glenjamin:require myproject.crux
13:57sdegutistechnomancy: A word can be used in different ways at different times.
13:57sdegutiscore: "[ often as modifier ] the part of something that is central to its existence or character"
13:57sdegutisThe public interface is central to the character of a lbirary.
13:57sdegutis*libary
13:58justin_smithI think the usage of .core is meaningful in that it carries an ontological payload: we aren't about information-hiding, the core is the part you should care about
13:58justin_smithof course we can like using clojure without having to agree
13:59sdegutisjustin_smith: From what I've seen of libraries, the "core" namespace almost always depends on private functions (granted they're all encapsulated within the core ns).
13:59technomancysdegutis: that's because `lein new` is stupid
13:59justin_smithright, they are not using "core" they way clojure.core does I don't think
13:59sdegutisok
13:59TimMcI agree, it's a bad default name.
14:00justin_smithI was referring to the intentional choice (the one clojure core devs made), not the unthinking usage of a default
14:00TimMc(Question: Does a good default name *exist*?)
14:00Glenjamin(ns changeme)
14:00sdegutisI like "gateway" personally. It's the way you get into the library.
14:00technomancyTimMc: I'm actually kind of tempted to change it to mylib.public
14:00TimMcGlenjamin: (ns FIXME)
14:00justin_smithTimMc: my-project.i-am-too-lazy-to-rename-my-primary-namespace
14:00justin_smithcoming soon to a lein new pr
14:00technomancyfor apps it should be .main of course
14:01TimMcjustin_smith: Ooh, that's a good one! It'll annoy people into changing it.
14:01sdegutistechnomancy: now let's not go crazy
14:01TimMctechnomancy: I would also argue that lein new should not create a lib by default.
14:01hyPiRionPerhaps we should remove the default then
14:02hyPiRion(no, I'm not serious)
14:02sdegutisfwiw I am using (macroexpand-1) to figure out how to stop using this library's DSL.
14:02justin_smithTimMc: maybe there is something that would draw the parallel to people you can tell are n00bs in an online game, because they don't do the most sensible customizations and use silly defaults
14:02technomancyTimMc: that ship has sailed, unfortunately
14:02technomancyat least it tells you about the difference
14:02hellofunkwhat do you mean by lein new creating a lib?
14:02technomancyfixing it would invalidate tons of tutorials
14:03hyPiRionhellofunk: `lein new foo` is equivalent to `lein new lib foo`
14:03TimMctechnomancy: shipit
14:03justin_smithhaha, myproject.shipit would work
14:03hellofunkwhat does the actual lib do?
14:03jkjhellofunk: as not an app.. the default thing does not have main function
14:03jkjhellofunk: so you cannot directly run it as a program
14:04hellofunkjkj isn't that good? to not make an assumption that it should be run with a main entry point?
14:04justin_smithhellofunk: in case it is unclear, this is a template for making a new lib
14:04jkjyou can start a REPL or you can make it a jar and use it as a dependency in another program
14:04jkjhellofunk: it think it is good
14:04justin_smithhellofunk: the dispute is about the default naming (and the annoyance of using libs that don't change that default naming)
14:04hellofunkit was suggested earlier that lein new should *not* make it a lib
14:05justin_smithI don't think so, I did not see that suggestion at all
14:05TimMcbecause new-comers are probably not making libs
14:05TimMcnewcomers?
14:05hellofunkjustin_smith naming as in, the naming of the files?
14:05TimMcn00bs
14:05justin_smithahh, I missed it
14:05justin_smithhellofunk: naming of namespaces
14:05justin_smithhellofunk: now I see where TimMc said that
14:06hellofunkif it was not a lib by default, then you just mean it would add a main function for app entry with every lein new project?
14:06jkjwell.. entry point is something that app has but lib doesn't.. so isn't lib as the lowest common thing, a reasonable default for an amorphous blob of code that might become an app or something else later
14:07hellofunkjkj i agree.
14:07jmontleonjustin_smith, that worked. thank you: Uploaded: file:///tmp/output/puppetdb/puppetdb/0.0-dev-build/puppetdb-0.0-dev-build.jar (70 KB at 23089.2 KB/sec)
14:07hellofunkby namespace defaults, are you referring to the single XX.core namespace generated?
14:07jmontleontraditionally it is built with leiningen
14:08justin_smithjmontleon: cool
14:08justin_smithhellofunk: yes, the whole .core thing
14:09justin_smithhellofunk: it becomes a sort of noise, and the more times it is not changed, the more it looks like a convention, rather than a silly default
14:09hellofunkjustin_smith i see
14:09hellofunkseems like a trivial issue to me, especially considering how easy is it to change
14:09jkjse we should dump the core? (pun intended)
14:10justin_smithhah
14:11jkjmdfind -name core.clj|wc -l .... 278 ... argh
14:11sdegutis"I've tried on every programming opinion I've found, which is why I'm so confident that the few I still hold to are correct." lol
14:17{blake}
14:20xeqiBronsa: /quit
14:46sdegutisAre all Compojure/Ring request keys likely and/or guaranteed to be keywords?
14:48nooniani think the default top-level ones are, but any middleware you are using can modify the request so no guarantees
14:49sdegutisDang.
14:54TimMcMy middleware converts all keywords into dynamically generated enums.
14:56amalloyand eg the map under :headers will have string keys
14:58gfredericksoh that headers map is sooper weird
14:58gfredericksI can't remember if it's the jetty lib or clj-http but one of them uses a special case-agnostic map for headers
14:58justin_smithI would more likely believe jetty there
14:59gfredericksI think it was clj-http actually
14:59gfredericksit was a clojure thing, not jetty proper
14:59gfredericksprobably used mister tellman's lib for making weird maps
15:00amalloygfredericks: never attribute to ztellman that which can be explained by garden-variety madness
15:00justin_smithgfredericks: potemkin?
15:00gfredericksyeah
15:00justin_smithamalloy: gfredericks: potemkin https://github.com/dakrone/clj-http/blob/master/src/clj_http/headers.clj#L105
15:01gfredericksit's string/keyword agnostic too looks like
15:01gfredericksI had a super weird time figuring out why headers didn't roundtrip for my vcr-clj lib
15:01justin_smithztellman made the gun, dakrone pulled the trigger
15:02gfredericksI'm curious if you folks think that was a good decision, or if an explicit (get-header req header-name) function woulda been better
15:02justin_smithgfredericks: I think this is designed for the case where add-header could be misused
15:03justin_smithor modify-header even
15:04amalloygfredericks: i think it was a bad decision. i like the way ring does it: on the way in, headers are keywordized and downcased (and kebab-cased?), and on the way out i forget what happens but it's some kind of reasonable thing
15:04justin_smithgfredericks: oh, never mind, the comment explicitly says it is about lookup
15:04amalloyer no, headers aren't keywordized. i was thinking of stuff like :scheme
15:10jmontleonjustin_smith, little more complex, but not by much: http://www.dotkam.com/2014/07/02/pom-pom-clojure/
15:11jmontleoni realized i was just getting a jar, not an uberjar; seems that can be fixed though too
15:11justin_smithjmontleon: cool
15:11hellofunkamalloy i thought Ring made all headers into keywords, weren't you right the first time?
15:11justin_smithjmontleon: I am bookmarking that for sure
15:12justin_smithhellofunk: not in my experience
15:12justin_smithhellofunk: perhaps one of your middleware is doing that
15:12hellofunkjustin_smith oh maybe I do have something in their. i'm using Friend, perhaps that's involved somehow
15:12mgaareis there a clojure equivalent to java's import package.whatever.*
15:13justin_smithmgaare: no
15:13amalloymgaare: it's discouraged in java anyway
15:13justin_smithmgaare: makes using some libs kind of annoying, right (opengl I am looking at you)
15:13mgaaresure does
15:18arrdem.away
15:26sdegutisI'm using [compojure "1.2.1"] but it still fails claiming "compile-route is not public" -- what gives?
15:28justin_smithsdegutis: are you sure that's the version that's getting loaded? you may want to check the output of "lein deps :tree"
15:28nooniansdegutis: might check if lein deps :tree | grep compojure returns any other versions
15:29justin_smithnoonian: well, without the grep he would also see the "conflicting versions" warnings at the top :)
15:29justin_smithor am I imagining those
15:29justin_smith*misremembering
15:29noonianheh, i get overwhelmed when my terminal scrolls wildly :P
15:29sdegutisI only see compojure "1.2.1" in here.
15:29sdegutisBut I see a lot of "overrides" on the line before it.
15:30justin_smithsdegutis: there is also "lein cp"
15:30justin_smithsee what version shows up in there
15:30justin_smithalso - if you are very unlucky, one of your lib deps is aot'd with an old verison
15:30sdegutis1.2.1
15:30sdegutis:(
15:31nooniansdegutis: are you using any ring lein plugins?
15:31sdegutisDon't think so.
15:31sdegutisOnly plugin I can see is Speclj.
15:36sdegutisIs compojure["1.2.1"].core/compile-routes public for anyone else?
15:38sdegutisAre good programmers also typically good at chess?
15:40justin_smithsdegutis: when I load compojure 1.2.1 compojure.core/compile-routes seems not to exist, public or not
15:40justin_smithand I have verification from alembic that 1.2.1 was the version I got
15:40sdegutisWhoa, this is getting pretty twilight zone up in here.
15:41justin_smithwait
15:41clrndsdegutis, not that I know of
15:41justin_smithcompile-routes or compile-route
15:41clrndmaybe imperative programmers ;)
15:41sdegutiscompile-route sorry
15:41justin_smithsdegutis: yeah, that is private
15:42justin_smithsdegutis: but the source does not mention it being private
15:42justin_smithsomethig else must set it private manually
15:42justin_smith(I am looking at the same jar I have loaded, it is using defn, not defn-)
15:42sdegutisjustin_smith: Or he might have accidentally uploaded the wrong artifact?
15:43justin_smithsdegutis: no, opening the jar and reading the source, it is public, checking in the repl, that loaded the same jar (with verification) it is private
15:43sdegutisOh.
15:43sdegutisWeird!
15:43justin_smithunless he deployed a class file that is stale...
15:44justin_smithno, I see no class files in there
15:44dbaschjustin_smith: compile-route is public
15:44sdegutisA jar is just a zip file, right?
15:44gfredericksI use `unzip foo.jar` all the time
15:44gfredericks
15:44gfredericks,'test
15:44clojurebottest
15:44justin_smithdbasch: not in my version - I can share a paste verifying this
15:45technomancygfredericks: not C-x C-f foo.jar?
15:45dbaschjustin_smith: in 1.2.1
15:45dbaschnot in 1.2.0
15:45justin_smithOH!
15:45justin_smithnever mind
15:45justin_smithdbasch: my mistake
15:45justin_smithI misread the alembic output
15:45sdegutisoops, just unzipped a .jar onto my Desktop
15:45justin_smithsdegutis: I was getting the wrong version, missed it in some boilerplate printout
15:45justin_smithhaha
15:45justin_smithsdegutis: what editor do you use? emacs can browse / edit jar files
15:47sdegutisjustin_smith: shell + tree
15:47justin_smithsdegutis: you use shell + tree as a text editor?
15:48gfrederickstechnomancy: zomg
15:48justin_smithvim can read jars too, it's not an emacs only thing
15:48sdegutishi
15:48gfredericks(inc technomancy)
15:48lazybot⇒ 160
15:49justin_smithgfredericks: awesome, huh
15:49timvisher-xubunttechnomancy, gfredericks: http://xkcd.com/1053/
15:50justin_smithtimvisher-xubunt: clearly, "emacs opens jar file contents" is something every adult should know :)
15:51justin_smith(not that my sarcasm undermines the point at all)
15:51timvisher-xubuntjustin_smith: ^_^
15:53technomancytimvisher-xubunt: a magical moment indeed!
15:53sdegutisSo what's making compile-route private?
15:53justin_smithsdegutis: I bet you didn't really get the version you thought you did
15:53dbaschsdegutis: why don’t you paste your project.clj somewhere?
15:54sdegutisdbasch: it's proprietary
15:54justin_smithtechnomancy: which novena did you order, and when does it show up?
15:54sdegutisjustin_smith: all tests everyone has suggested have passed
15:55daGrevishello, lispers! what's the best way to get a random item out of vector and return the item AND new vector (without that item)?
15:55justin_smithsdegutis: here's another possible test: temporarily move ~/.m2/repository/compojure/compojure/ somewhere else, run lein deps, see which version actually downloads
15:55sdegutiscan I just rm -rf ~/.m2 ?
15:55justin_smithsdegutis: if you want to do a bunch of downloads and break things that rely on local installs, sure!
15:56xemdetiayou can just use dired in emacs to look in .jar files :(
15:56sdegutisdaGrevis: split-at and first maybe?
15:56justin_smithxemdetia: that makes you sad?
15:56xemdetiajustin_smith, I just started working in a vim shop
15:56{blake}heh
15:56justin_smithxemdetia: vim can open jars though right?
15:57xemdetiaI don't know, I pretend I am using vim and use emacs instead
15:57daGrevissdegutis, how would I get back the new vector? by concating those splitted parts back together?
15:57sdegutisdaGrevis: or you can just do (let [c (drop n coll)] [(first c) (rest c)])
15:58technomancyjustin_smith: I got the desktop one. supposedly arrives in December?
15:59sdegutisjustin_smith: I just opened "core.clj" inside "~/.m2/repository/compojure/compojure/1.2.1/compojure-1.2.1.jar" and it is not private.
15:59andyfIf someone knows how to make an emacs compilation-mode buffer with a file name that looks inside a jar, I'd like to know
16:00justin_smith,(defn extract-rand [v] (let [n (rand-int (count v))] [(get v n) (into [] (concat (take n v) (drop (inc n) v)))]))
16:00clojurebot#'sandbox/extract-rand
16:00justin_smith,(extract-rand [1 2 3 4 5 6])
16:00clojurebot[2 [1 3 4 5 6]]
16:01andyfI tried /path/to/file.jar:path/in/jar.clj without success , even though that works with c-x c-f
16:01justin_smith,(extract-rand [42 420 666 "☃"])
16:01clojurebot[42 [420 666 "☃"]]
16:01justin_smithdaGrevis: ^
16:01justin_smithsdegutis: sure, that's why I suggested setting aside the whole dir, and seeing what get's downloaded
16:02daGreviswow, cool, justin_smith. real nice!
16:02sdegutisstill not public
16:02sdegutis:/
16:02justin_smithtechnomancy: cool
16:02justin_smithsdegutis: what version did it say it was downloading?
16:02daGrevisanyway, i must ask. why isn't something like that in standard lib? it's a normal thing to want in clojure, right?
16:02daGrevisjustin_smith, sdegutis ^
16:03justin_smithdaGrevis: I've never had to do it before
16:04amalloydaGrevis: it's not made easy because vectors aren't a good data structure for this access pattern
16:04sdegutis1.2.1
16:04justin_smithdaGrevis: part of why it is not in stdlib is taking something out of the middle of a seq has no efficient implementation for the standard clojure datatypes, and implementing things that don't have good efficient algorithms is avoided in core
16:04sdegutisdaGrevis: I never needed it, no.
16:04andyfdaGrevis: Shuffle is in core, which is not what you asked for, but might suit your purposes
16:04daGrevisamalloy, hmm, interesting. what data structures should I be using instead?
16:05justin_smithdaGrevis: just because it is inefficient doesn't mean you have to change - depends how often you do it. But core is fastidious about providing things that are fast, for the most part.
16:05amalloyeven a sorted map from integer to value would not be unreasonable
16:05daGrevisthanks for the answers. i need to experiment with this a bit, i'll be back
16:06amalloyor a heap with a comparison function that's effectively random, eg based on hashcode
16:07justin_smithtechnomancy: I look forward to hearing about your awesome arm machine sometime in december then
16:08technomancyjustin_smith: hoping to blog about it
16:08technomancythough ... yeah. that might take a while since I'm planning a big move
16:09justin_smithI like that the laptop version uses OTS rc battery packs
16:10sdegutisHow do you call a private macro in Clojure?
16:12amalloysdegutis: you can't, really, without making a copy of the var and putting it somewhere public. are you sure you want to? would it be better to drive to the author's house and harangue him instead?
16:13sdegutisThere's a macro, foo.core/bar, and I would normally call it (bar quux), but it's private. So I have (#'foo.core/bar quux) but it says wrong number of arguments.
16:13technomancyjust run clojure.repl/source on the macro, do a string replace to get rid of ^:private, and pass it to read-string+eval
16:14technomancyeasiest thing in the world
16:14amalloysdegutis: right, like i said, you can't do that
16:15sdegutisOkay.
16:16{blake}I'm trying to AJAXify a form created in my Ring/Compojure/Hiccup/Bootstrap web app. If I were writing the Javascript directly, I would do something like this: http://stackoverflow.com/questions/425095/submit-form-using-ajax-and-jquery
16:16{blake}So my question is: Do I shoehorn that in, or is there a more Clojure-y way?
16:17sdegutistechnomancy: that's genius actually
16:17amalloytechnomancy: now look what you've done
16:17technomancysdegutis: http://gif-central.blogspot.com/2013/07/nope-badger.html
16:19sdegutistoo late im doin it
16:19{blake}What could possibly go wrong?
16:20amalloysdegutis: if you are determined to wall-hack your way in, i recommend my approach over technomancy's: copy the var with something like (def ^:macro my-macro @#'private-macro)
16:20{blake}Maybe I just gotta bite the bullet and go full Clojurescript.
16:21justin_smithamalloy: damn, you shouldn't publish a macro that does that in a lib called wall-hack, but it would be disgustingly awesome if you did
16:21arohnerjustin_smith: https://github.com/arohner/clj-wallhack
16:21mavbozo{blake}: jquery usage is fine
16:22arohnerjustin_smith: but mine works on java privates, not clojure privates
16:22{blake}mavbozo: What does that mean?
16:22amalloyjustin_smith: the name is borrowed from uh, i think clojure.reflect?
16:22justin_smithahh, OK - or the thing arohner linked above
16:23amalloynah, i've never seen that before, so i can't have stolen the name from there
16:23arohneramalloy: hiredman originally named it, in old contrib
16:23justin_smithamalloy: he got it from hiredman / contrib
16:23arohnerit comes from a common hack in quake 1 multiplayer
16:23amalloyah, that's right. not the current clojure.reflect, but the old one in contrib
16:24mavbozo{blake}: if you use javascript only to submit form, then use jquery
16:24{blake}mavbozo: Oh, okay, thanks.
16:30sdegutisamalloy: hmm
16:31sdegutis{blake}: that's /never/ the answer
16:31{blake}sdegutis: What's /never/ the answer? It's not violence, is it? Because I find violence is usually the answer, in the proper magnitude.
16:31sdegutis{blake}: that's a recycled joke
16:32sdegutis{blake}: I can literally see the newspaper article it was made from sticking out the end of it
16:32{blake}sdegutis: What is? I'm new here, I don't know from recycled.
16:32sdegutis{blake}: your nick hurts my pinky for holding shift
16:32sdegutis{blake}: you stole that joke from jack handey
16:32sdegutis"deep thoughts with jack handey" which are quite good
16:33{blake}sdegutis: Oh! Possibly. I've been guilty of unconscious plagiarism before. And I even stole =that= from George Harrison.
16:33{blake}sdegutis: So, what is /never/ the answer, again?
16:34sdegutishi
16:43justin_smithis there a version of pmap that doesn't preserver order?
16:43ucbis there any way in which I can eval some parameters passed to a macro and not others?
16:43justin_smithbecause I have a bunch of parallel tasks, and I don't care about the order, I just want all the results...
16:43ucbe.g. (let [a 1] (my-macro a)) means my-macro will see 'a and not 1
16:44ucbideally, I'd be able to have my-macro see pre-evaled values
16:44ucb(I can provide my actual use case if it'll make it easier to answer the question)
16:44justin_smithucb: why would it be a macro?
16:44ucbah, here we go, ok, this is what I'm trying to do
16:44ucbI have a bunch of fns that operate on state
16:44ucband I'm trying to keep this state across redefs of these fns
16:45ucbso I'm using the body of the fn as the key into a hashmap
16:45ucband the state as the value
16:45ucbnow, that's fine in principle
16:45ucband it works
16:45dbaschjustin_smith: ma(dca)p
16:45ucbthe problem is that it doesn't work in the case of (doseq [n (range 10)] (the-macro n))
16:45ucbbecause the 10 different versions will share or trump each other's state
16:45ucbmakes sense?
16:46justin_smithdbasch: heh, the results are useful regardless of ordering (they carry enough data to put them where I need them)
16:46ucband the reason why this is a macro is because I want to create fresh new state when the body of the fn changes
16:47ucbbut re-evaling these definitions creates new fns, so I can't have it as a function
16:47justin_smithdbasch: oh, wait, looking at the source of pmap - since I won't return until I hve all results, and the operation is very time-expensive, this may be one of the few cases where pmap is the right answer
16:47jeremyheilerjustin_smith: i think you'd have to do something custom so that each map function call reports when it's done so that it can be returned into a lazy seq
16:47justin_smithjeremyheiler: I don't even want laziness though
16:48justin_smithI just want all the results to evaluate in parallel as much as they ar able
16:48danielcomptonjustin_smith: you could use something like reducers or core.async to work on things in parallel?
16:48justin_smithdanielcompton: there is no reduction step, all results are independent of one another, and core.async doesn't want io in go blocks, and this is io heavy...
16:49danielcomptonjustin_smith: https://clojure.github.io/core.async/#clojure.core.async/pipeline
16:49danielcomptonjustin_smith: https://clojure.github.io/core.async/#clojure.core.async/pipeline-blocking
16:49justin_smithdanielcompton: oh, pipeline-blocking my just be the thing, thanks!
16:52danielcomptonjustin_smith: or you could make your own reducing function which combines multiple results,
16:52justin_smithlike I said, no reduction stage, the results are all independent but also all needed
16:52danielcomptonjustin_smith: sorry that wasn't clear, all the reduce would do is concat the results
16:53justin_smithsql query results, queries on mulitiple tables, with no inter-query logic
16:53justin_smithahh! interesting
16:54danielcomptonso map in parallel, reduce (fold) in parallel to concat, and you'll get back a collection of results but not in order
16:54justin_smithright
16:55justin_smithwell in-order is fine, but not needed :)
16:55dbaschjustin_smith: so why don’t you spawn a bunch of futures that put the results in a queue?
16:56justin_smithdbasch: that would totally work, yeah
16:56danielcomptonjustin_smith: it's worth benchmarking, and it may be a wash with your external IO, but I'd expect reducers to be faster
16:57justin_smithOK - I'll benchmark a few versions pmap,reducers,pipeline,future+queue and either get rate-limit kicked out by my db or have an interesting answer by the time it is done :)
16:58justin_smithis there a program that forwards a local port and simulates realistic network latency? because that would be kickass for benchmarking this
16:58danielcomptontc can do latency
16:59justin_smithdanielcompton: oh, nice, checking it out, thanks
16:59ucbjustin_smith: no thoughts then? :)
16:59danielcomptonjustin_smith: you could make a second loopback interface and run tc on that only
17:00justin_smithdanielcompton: yeah, I would definitely not want to mess with my latency overall :)
17:00danielcomptonjustin_smith: that would give some confusing results
17:00justin_smithucb: sorry, bot wrapped up in my own work
17:00ucbno worries :)
17:00justin_smith*bot
17:00justin_smith*Got
17:00justin_smithwow
17:01ucblet me know if anything comes to mind as to how to better solve this
17:01justin_smithusing macros for state feels really weird... I don't know what to say beyond that
17:03ucbheh
17:03ucbwell, I'm happy to change approaches
17:03ucbas this is clearly not working out
17:10ucbjustin_smith: if you don't mind me asking, how would you handle this?
17:12sdegutisWait, compojure.core/compile-route is a function that returns code as data???
17:12lazybotsdegutis: Yes, 100% for sure.
17:19anneliesI think I have my AWK library kinda working.
17:19anneliesStill not sure on state management though. You currently can't keep any state.
17:20danielcomptonI'm working on a leiningen plugin which depends on a library for it's main function (kibit). I've followed the instructions to checkout kibit in lein-kibit, and add .lein-classpath in my test project, but the checkout changes in kibit don't seem to be picked up.
17:20danielcomptonAre checkout dependencies supported in leiningen plugins?
17:23technomancydanielcompton: you have to add everything to .lein-classpath
17:23sdegutisannelies: FP and state aren't friends
17:23technomancyyou can't just add lein-kibit and have it pick up kibit
17:23anneliesState is very useful when reading text files in certain formats.
17:24danielcomptontechnomancy: ahh, I assumed the checkout dependencies would be picked up instead
17:24anneliesYou'd usually keep it with recursion but I want my library to do the recursion for you.
17:25danielcomptontechnomancy: are checkouts only used when you're working directly in that project?
17:25justin_smithannelies: what about letting the user return any state in a map at each loop step? perhaps as an option arg to a return function
17:25technomancydanielcompton: right
17:25anneliesYeah I was thinking about that.
17:25technomancydanielcompton: there's a lot less magic going on than you probably think
17:26anneliesInstead of returning a sequence you'd return [some-sequence new-state]
17:26technomancyfor some reason this is a feature that everyone overcomplicates in their head. it's like ten lines.
17:26justin_smithucb: what about giving each function a keyword that maps to its state? at least that would be intelligible and persistent
17:26danielcomptontechnomancy: do you mind if I pull request the documentation for plugins about this?
17:26technomancydanielcompton: sure
17:27ucbjustin_smith: I thought of that, and I'm reconsidering. I initially had it like that, but the problem is that these have to be unique, and repeatable, and I will have quite a few ...
17:27ucbjustin_smith: but I might just have to bite the bullet
17:27ucbjustin_smith: by repeatable I mean that I just can't use gensym
17:28justin_smithucb: something derived from the namespace / name of the function? a macro could help there
17:29ucbright, yes, but then I have top-level functions that take some form of config and return the actual function
17:29ucbperhaps include the config in there as well
17:29ucbfwiw, these fns are riemann streams
17:29ucb(in case you're familiar with them)
17:31sdegutisarohner: wait aren't you usually in #clojure?
17:31arohnersdegutis: I am in #clojure
17:31sdegutisarohner: I thought I remember you're often in #clojure talking and saying stuff and writing libs
17:32justin_smithucb: it seems like you want to be able to reliably look up the functions, in that case I would give up on using them directly, and either pass around their vars (which are used via lookup) or put them in a map where you grab them via keyed lookup
17:32ucbjustin_smith: https://gist.github.com/4f9e5490fc872789d535 <- this is the most basic building block actually
17:32arohnersdegutis: yeah?
17:32sdegutisarohner: so when did you get into Swift?
17:32arohnersdegutis: aha
17:32sdegutisarohner: it was just a surprise seeing you in there is all
17:32ucbjustin_smith: not the functions, but rather the state they'll work with
17:32arohnerworking on a native app that talks to a clojure server
17:32arohnerstarted in August-ish
17:33sdegutisarohner: for OS X?
17:33justin_smithucb: well that's easier isn't it? store their state outside the function, and define the function such that it knows how to look it up?
17:33arohnersdegutis: yep
17:33sdegutisarohner: sounds fun, is it open source?
17:33ucbjustin_smith: that's exactly what I'm doing. I just updated the gist.
17:33arohnersdegutis: no, but it's related to: https://app.getflowmeter.com/blog/productivity.html
17:33sdegutisarohner: gonna sell it?
17:33ucbjustin_smith: you'll see I'm using the function's body as key, but that breaks badly because macros and eval
17:33arohnersdegutis: yep
17:33ucbjustin_smith: I'll have to abandon the body-as-key approach it seems ;_;
17:34justin_smithucb: yeah, I would use something more explicit than the function body as a key
17:34godd2that's a nice line of vertical semicolons
17:34sdegutisarohner: oh :)
17:34ucbit's a pity, because the resulting DSL was very nice to work with
17:34godd2err, colons
17:34ucbit had a slight problem: IT WAS BROKEN
17:34sdegutisarohner: how do you like Swift so far compared to Clojure?
17:34arohnerI don't like it very much
17:34justin_smithucb: with a good macro, you should be able to achieve that elegance, especially if you had it once
17:34arohnerit's better than objc though
17:34sdegutisarohner: why do you hate it so much?
17:35arohnerI didn't say hate :-)
17:35justin_smithucb: for example, have the macro use the namespace / name of the function (easy to get based on the body) as the lookup / storage key
17:35ucb+ whatever config it might be passed on
17:35sdegutisarohner: well what do you "not like" about it?
17:35danielcomptontechnomancy: is .lein-classpath a multiline or single line file? what's the separator between entries?
17:35ucbrecall that I have many top-level functions that generate these functions
17:36ucbbut yeah, something like that
17:36arohnersdegutis: it's a nice improvement on objc. The big downsides are: 1) no repl 2) C compilation model
17:36arohnersdegutis: 3) weak datastructures
17:36sdegutisarohner: i took it to Swift-Lang for on-topic-ness
17:36arohnerno, I'm not going to complain about swift in #swift
17:36justin_smithhaha
17:36ucbjustin_smith: where would I go and read more about finding the ns an fn has been defined in, and its name, and so on?
17:37justin_smithucb: in a macro, the ns will be *ns*
17:37justin_smithfor the name - you can provide that as part of the form
17:37ucb*nod*
17:37ucbthanks!
17:37justin_smith,((fn named [] 1))
17:37clojurebot1
17:37justin_smithucb: you could even assert that the name part is there in the fn, with an informative message, from inside the macro
17:38ucbyeah, good idea
17:38justin_smithsince you are looking at the form
17:38ucbnot sure I'll be able to get named fns
17:38justin_smithwait, where are they coming from?
17:38ucbthey'll come as body
17:39ucbe.g. (some-predicate arg1 (some (seq ...)))
17:39justin_smithoh - the inside part
17:39justin_smiththat' a problem
17:39ucbwhere some-predicate is a macro that eventually becomes (defstream ...)
17:39ucbyes, it is!
17:39oyvinrobhyPiRion: regarding https://github.com/technomancy/leiningen/issues/1765
17:40justin_smithucb: I'll get back to you, I do need to make progress on this query thing, sorry
17:40ucbjustin_smith: no rush, it's zzz time here anyway
17:40oyvinrobhyPiRion: if you're referring to the stacktrace being logged, that has already been fixed
17:40ucbthanks for paying attention to my sillies
17:41sdegutisarohner: what do you mean by weak datastructures
17:44oyvinrobhyPiRion: I think, at least
17:46kenrestivowhat's that link to that cool interactive clojure source browser that lets you search for every usage of a function/protocol/namespace, etc?
17:46kenrestivoi think it pulls in every clojure project off of github and indexes it.
17:47xemdetiagrimoire
17:47kenrestivothat's it, thanks!
17:48kenrestivono, it was crossclj, that's what i was thinking of
17:49oyvinrobhyPiRion: also, I just realized this isn't #leiningen
17:51sdegutisarohner: anyway i havent used swift yet, and im only on chapter 3 of the swift book, so i truly have no idea what ur talkin about
17:55justin_smithkenrestivo: that one takes submissions, it doesn't spider
17:55justin_smiththough spidering would be cool
17:56kenrestivo /msg *status ClearBuffer #clojure
17:56technomancywe wrote a plugin at seajure that runs the tests for all libs that depend on you
17:56technomancyso you can see if a change you're considering breaks your users
17:57technomancy(like all seajure projects, it was more of a poc)
18:00EvanRis it possible to implement a protocol for the java array class
18:01BronsaEvanR: yeah, (extend-protocol p (Class/forName "[B") (f [_] ..)) for example
18:02EvanRis there a way to cover that array and vectors at the same time
18:03BronsaEvanR: no you have to extend each class on its own
18:04BronsaEvanR: though if you use `extend` you can reuse the impl
18:04EvanRclass/interface right, IPersistentVector
18:04Bronsalike, (def impl {:f (fn [_] ..)}) (extend Class1 impl Class2 impl ..)
18:04BronsaI meant (extend g ..)
18:05EvanR,(Class/forName "[B")
18:05clojurebot[B
18:05EvanRwhats B
18:05justin_smithit's the name of the class for byte-array
18:06justin_smith,(class (byte-array 0))
18:06clojurebot[B
18:06EvanRim not sure if thats the java array i was thinking of
18:07BronsaEvanR: it was just as an example
18:07justin_smithwhich one are you thinking of?
18:07EvanR,(type (make-array Object 0))
18:07clojurebot[Ljava.lang.Object;
18:07EvanRL?
18:07EvanR,(type (byte-array 0))
18:07clojurebot[B
18:08BronsaEvanR: yeah it's different for object arrays vs primitive arrays
18:08BronsaEvanR: the internal name is [<<primitive class name>> or [L<<fully qualified class>>;
18:08EvanRdo i need a different implementation for every possibly object array
18:09EvanRor can i just implement it for [Ljava.lang.Object;
18:11BronsaEvanR: http://sprunge.us/VeFe?clj
18:12EvanRbasically no
18:12Bronsacorrect
18:12EvanRsweet
18:12BronsaEvanR: the only "catch-all" type is Object
18:12BronsaEvanR: you could extend Object and test for (.isArray this) in the impl
18:13Bronsa(.isArray (class this)) rather
18:13EvanRwould that clobber my implementations for non array classes, interfaces, and deftypes?
18:13EvanRor just classes
18:16EvanRis this [Foo pattern the same for all java generics?
18:20justin_smithEvanR: generics have no existence in the jvm, it only exists in the compiler for type checking
18:20justin_smithEvanR: it's called "type erasure"
18:21EvanRerm
18:21EvanRbut we have [Lsomeclass
18:22EvanRso either this is not generics or type erasure means something else
18:22justin_smithEvanR: arrays are not generic
18:23EvanRthey are special?
18:23justin_smiththere is a separate class for an array of each primitive
18:24justin_smithwhich is manually created, not using any kind of generic feature
18:24EvanRi dont care about those i only care about array of class X
18:24justin_smithEvanR: class X can only be Object
18:24justin_smithwait...
18:24justin_smithlet me double check that :P
18:24EvanR,(type (make-array java.util.Date 0))
18:24clojurebot[Ljava.util.Date;
18:25justin_smithdon't mind me...
18:25EvanRif it could only be object that would be awesome
18:27justin_smithEvanR: so sorry, thought I new this stuff but clearly got myself tripped up
18:27EvanRit appears that in java, arrays cant use generics, so they are something else
18:28justin_smithOK, good to know I was at least right on this count
18:28TimMcArrays are friggin' weird, I don't even know what they are.
18:28EvanRit has to do with subtyping crap
18:28EvanRArrayList however is apparently generics
18:29EvanRirrelevant to me so im not going to see if you can implement a protocol for it
18:29EvanRbut this is certainly confounding to my design
18:29justin_smith"The reference type of the Java virtual machine is cleverly named reference. Values of type reference come in three flavors: the class type, the interface type, and the array type. "
18:29justin_smithhttp://www.artima.com/insidejvm/ed2/jvmP.html
18:30justin_smithso arrays are a separate thing, parallel with interfaces and classes
18:30EvanRnice, the triple entente
18:38TimMc&(make-array Void 1 2 3 4)
18:38lazybot⇒ #<Void[][][][] [[[[Ljava.lang.Void;@19ff188a>
18:39justin_smithFUN
18:39EvanRthe hell is java.lang.Void
18:39justin_smith"The name of an array's class has one open square bracket for each dimension plus a letter or string representing the array's type."
18:39TimMcIt doesn't matter, you can't have one.
18:40TimMc&(apply make-array Void (repeat 100 1))
18:40lazybot⇒ #<Void[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[... https://www.refheap.com/93740
18:40EvanRThe Class object representing the pseudo-type corresponding to the keyword void.
18:40EvanRo_O
18:41TimMcnot to be confused with null
18:41amalloyEvanR: used in reflection. if you ask what the return type of System.out.printin is, you need Void to exist
18:41TimMc&(class (apply make-array Void (repeat 10000 1)))
18:41lazybotjava.lang.IllegalArgumentException
18:41TimMchmmm
18:41andyfHuh. I never noticed before that you could start comments with #! in Clojure. Useful for executable files that have that as first line on unixes
18:42justin_smithyupyup
18:42TimMc&(class (apply make-array Void (repeat 255 1)))
18:42lazybot⇒ [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[Ljava.lang.Void;
18:42andyfBut looks like it can be anywhere in file
18:42TimMc&(class (apply make-array Void (repeat 256 1)))
18:42lazybotjava.lang.IllegalArgumentException
18:42amalloyandyf: indeed that's what it's for
18:42EvanR,(Void.)
18:42clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Void, compiling:(NO_SOURCE_PATH:0:0)>
18:42amalloyEvanR: there's no way to instnatiate it
18:43TimMc*No* way?
18:43EvanRso the class itself is used as the value
18:43EvanRso java/something has first class classes?
18:43amalloyTimMc: i mean, you can use reflection to get around the access controls. but it has no public constructors, and no private constructors that are ever used
18:43amalloyEvanR: classes are certainly first class
18:43EvanRin clojure
18:44amalloyand in java
18:44EvanRoO
18:44EvanRa class is an object of class Class or something?
18:44amalloyEvanR: exactly, yes
18:44EvanRand Class is class Class?
18:44amalloy&(class String)
18:44lazybot⇒ java.lang.Class
18:44amalloy&(class Class)
18:44lazybot⇒ java.lang.Class
18:45TimMc,(let [c (first (.getDeclaredConstructors Void))] (.setAccessible c true) (.newInstance c (object-array [])))
18:45clojurebot#<Void java.lang.Void@1ad6d84>
18:45TimMc^ that right thur is a Void instance
18:45amalloyTimMc: well like i said, you can cheat
18:45TimMcI sure can.
18:46justin_smiththe Void has come! IA!
18:46TimMcIf they *really* wanted there to not be an instance, they could have put a throw in the constructor.
18:46EvanRcall the destructor on it
18:46TimMc,(def void (let [c (first (.getDeclaredConstructors Void))] (.setAccessible c true) (.newInstance c (object-array []))))
18:46clojurebot#'sandbox/void
18:47TimMc(.finalize void)
18:47clojurebotGabh mo leithscéal?
18:47TimMc,(.finalize void)
18:47clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: finalize for class java.lang.Void>
18:47TimMcOh, it's protected. That makes sense.
18:47EvanRif the gc encounters a Void it will cause a full collapse of the universe
18:49TimMcI'm guessing having an instance doesn't actually alow you to cause any shenanigans.
18:49TimMcYou could declare that your method returns Void and return an instance, but whatever.
18:50EvanRin this sense void or Void is basically the unit type
18:51TimMcNot even.
18:51TimMcvoid methods can't return null
18:51TimMcI think null is more like Unit.
18:51amalloyTimMc: no, void is like unit
18:51EvanRnull doesnt have a type
18:52amalloyin scala, i believe void methods actually do return unit, like in clojure they return nil
18:52TimMcamalloy: You wouldn't say that a Java type declaration of String is a union type of the String class and the null "class"?
18:52EvanRnull doesnt fit in
18:52amalloyTimMc: i don't see how an answer to that question is related to whether void is like unit
18:53TimMcfair
18:53EvanRin ruby nil is a NilClass
18:53amalloyjava's String is indeed like a `Maybe String`, which is equivalent to a union of String and ()
18:53TimMcamalloy: Aren't you supposed to be able to get an instance of Unit?
18:54amalloyTimMc: i don't think type theory trouble itself with "instances"
18:54dbaschTimMc: the one and only instance of Unit
18:54amalloya method which returns nothing is the same as a method which always returns the same thing
18:54TimMchrmf :-)
18:54amalloyit provides the same amount of information
18:55EvanRdoes java stop you from assigning the result of a void function to a variable
18:55amalloyyes
18:55dbaschEvanR: there is nothing to assign
18:55EvanRsmall favors
18:56EvanRdbasch: well, except an instance of Void ;)
18:56dbaschEvanR: a void method doesn’t return Void
18:56EvanRit doesnt return anything, i was talking about hypothetically
18:57EvanRVoid exists and it can be instantiated despite documentation saying otherwise
18:57dbaschEvanR: you said void, not Void
18:57EvanR"nullable" is annoying
18:57TimMcEvanR: "can be" is relative, here
18:57EvanRuse a sum type to wrap whatever type
18:57TimMcAny code with setAccessible is cheating.
18:58EvanRlet null pointers go
18:58{blake}I inspected Void once. It inspected me back.
18:58technomancynulls: literally the worst thing in programmering languages
18:58dbasch{blake}: you’re thinking of Abyss
18:58TimMc"What are you doing?"
18:58TimMc"Programmering."
18:59dbaschthe gaze method of Abyss takes a callback parameter
19:00{blake}Which one cannot help but pass.
19:00EvanRdoes it implement the null object pattern
19:00dbaschlong gaze()
19:00TimMcI don't see a callback there!
19:01TimMcIt knows where you live.
19:01andyftechnomancy: People get so worked up over nothing :-)
19:01{blake}My address is a global variable.
19:01{blake}Great. Now how am I going to get home?
19:02dbasch{blake}: home is where the heart was assigned
19:03{blake}dbasch: (ns range) (def home :heart)?
19:03EvanRin addition to null i would like everything listed here http://hl7.org/implement/standards/fhir/null-flavor.html
19:04TimMcNINF and PINF seem like they don't belong there
19:04EvanRyou dont encode infinity as a null?
19:04EvanRjeez
19:05TimMcboth of them
19:05TimMcpositive null and negative null
19:05TimMc,(with-meta nil nil)
19:05clojurebot#<NullPointerException java.lang.NullPointerException>
19:06EvanRi cast "Null Pointer Exception" at the darkness
19:07dbaschNullPointerException is one of the least exceptional exceptions
19:08EvanRmore like NullPointerRule
19:08TimMcsnrk
19:11amalloyNullPointerTedium
19:12amalloyat least it's a pointer in java. in c#, they need to put up with the extra syllable in NullReferenceException
19:12EvanRits so different from java
19:12EvanRhttp://c-faq.com/null/
19:14EvanReverything you never wanted to know about null pointers
19:16TimMcpublic class NullAgain extends RuntimeException
19:16TimMcEven Noooooo would be shorter
19:23clojerIn Rich Hickey's Clojurescript launch video he stresses that to get the benefits of advanced compilation you have to know how to write code that is optimised for the Google Closure compiler. Anyone have any details or pointers to what's involved?
19:25dbaschamalloy: imagine if someone built a jvm that showed ads in exception stacktraces, that would replace the tedium with rage
19:30TEttinger(dec oracle)
19:30lazybot⇒ -1
19:30justin_smithseriously?
19:31justin_smith(dec oracle)
19:31lazybot⇒ -2
19:31kenrestivothis crossclj is the most amazing thing
19:31Bronsa(inc crossclj)
19:31lazybot⇒ 7
19:31justin_smithkenrestivo: isn't it though? if only they had the help of a UX person
19:31justin_smiththe featuers are there, but can be a little hard to find
19:32kenrestivobest thing ever for deciding what libraries to use. it's got everything: the dependencies (so i can see any hairballs before they happen), the full source, cross refereced, the docs, it's great
19:32TEttingerhome is 607 mb apparently
19:32kenrestivoeven shows the lein-pedantic outdated dependencies
19:32kenrestivosorry, lein-ancient
19:33TEttingerI downloaded one earlier revision of my previews repo where I store files, "home" and it's 608 MB
19:33kenrestivoand... the docs/readme shown is from the *released* artifact,instead of what's in HEAD. which is what i want anyway.
19:33justin_smithkenrestivo: we should all remember to submit libs we want other people to use, so crossclj will be sure to crossref them
19:33kenrestivowho made this thing?
19:33technomancyit's ironic that we have find-usages in a web app but not in nrepl yet =\
19:34justin_smithtechnomancy: haha, I know it
19:34dbaschthe link to 1.7.0-alpha4 here is wrong http://clojure.org/downloads
19:52danneuclojer: check this out https://developers.google.com/closure/compiler/docs/api-tutorial3
19:54danneuclojer: for example, closure leaves strings untouched but will munge property access. so you sometimes need to change (.-foo thing) to (aget thing "foo"). aka thing.foo to thing["foo"]
20:00{blake}So, I'm AJAXifying my compojure form which, and the response to the AJAX request should be a map of names and values specifying what I should update. But I think I have to pass a string, right? So...would I serialize a hashmap or...?
20:01justin_smith{blake}: the j in AJAX is json
20:01justin_smithuse cheshire to turn a map into a json string
20:03dbaschjustin_smith: you made me check ajax to see if the J had changed from javascript to json :)
20:03justin_smithdbasch: OK, maybe we should be talking about ajaj
20:03justin_smithhah
20:04justin_smith{blake}: if you are returning a map, it's more likely json we should be dealing with rather than xml
20:04DomKMAnyone know how to generate an attribute key without a val in hiccup? Specifically, I don't know how to generate <div itemscope >
20:04dbaschjustin_smith: we should use ajaj in cloxure
20:04justin_smithheh
20:05{blake}justin_smith: Cheshire! Thanks!
20:05{blake}(inc justin_smith)(
20:05{blake}(inc justin_smith)
20:05lazybot⇒ 143
20:10justin_smithis there a straightforward way to avoid using a templating language to create a prepared statement if I want to use jdbc to run a statement querying a variable number of fields?
20:11justin_smithI would be using a templating lib to insert the ?? in the statement, and then providing the args in order
20:11justin_smithbut it still feels weird
20:21hyPiRionoyvinrob: It was pretty messy on master – I tried ~1 hr before I wrote that ticket. But I'll have to see if I can repro the case, because it wasn't "no network", it was simply "bad network"
21:31crash_epshould transducers avoid side effects?
22:49FriedBobI'm trying to implement the ret-xml-data function from http://drknucklehead.wordpress.com/2012/06/28/pulling-data-from-clojure-data-xmlparse/ but when I run the code, it it is telling me "wtong number of args (4) for core/if-not" My code is at https://github.com/llowder/run-nerd-miner/blob/master/src/run_nerd_miner/core.clj#L18
22:50FriedBobBeen googling some, but I can't figure out what I did wrong
23:04dbaschFriedBob: your code shouldn’t compile, it’s not valid clojure
23:04dbaschhttps://github.com/llowder/run-nerd-miner/blob/master/src/run_nerd_miner/core.clj#L23
23:04dbaschdefn should have a parameter vector
23:04dbasch(and you shouldn’t have defs inside a function)
23:04justin_smithtwo different kinds of should there
23:05dbasch(which won’t cause compilation to fail but it’s not idiomatic)
23:05dbaschyes, defn *requires* a parameter vector
23:07FriedBobdbasch: I fixed that, just haven't pushed yet
23:08dbaschFriedBob: post the code you’re running, because the problem you mention is not apparent there
23:08FriedBobNeed to get my kid to sleep,
23:09dbaschheh, mine just fell asleep
23:10FriedBobThis where the current error is - ignore the other functions. Will push when I can
23:10FriedBobhttps://github.com/llowder/run-nerd-miner/blob/master/src/run_nerd_miner/core.clj#L13-L21
23:10justin_smiththe error isn't there in that code
23:10FriedBobLine 18, the if-not line
23:11dbaschFriedBob: that ‘if-not’ shouldn’t fail
23:11justin_smiththat's not the error
23:11dbaschit has three arguments, not four
23:12FriedBobHmm, it's running now and not giving te error.
23:12FriedBobMust need more caffeine or morer scotch, or both
23:13dbaschyou probably had something extra inside the parentheses
23:13justin_smithFriedBob: so about the def thing - def creates globals, using def in function logic is almost guaranteed to break if you have more than one thread
23:13justin_smithFriedBob: also, if two functions use the same var name, they will break one another
23:14dbaschbtw, (if-not condition something nil) is the same as (when-not condition something)
23:16justin_smithdbasch: if you ever want to have an argument about style in clojure, say that to technomancy
23:16FriedBobOk, infant is asleep. Only took one AC/DC and part of one Motley Crue song
23:16dbaschnote I didn’t say one is better than the other :P
23:17dbaschbut I much prefer the latter
23:57marcuscreoEvening!
23:57marcuscreoAnyone at the Conj?
23:59cflemingkenrestivo: Francesco Bellomi makes CrossClj, which is indeed fantastic