#clojure logs

2013-11-09

00:00bitemyappakurilin: what library is this?
00:00bitemyappWhat is it you're trying to do?
00:00akurilinbitemyapp, https://github.com/korma/Korma/blob/master/src/korma/core.clj#L512
00:01bitemyappakurilin: yeah that's pretty minor.
00:01bitemyappakurilin: AOP that bitch.
00:01akurilinbitemyapp, what's that?
00:01akurilinGoogle time? :)
00:01bitemyapphttp://en.wikipedia.org/wiki/Aspect-oriented_programming https://github.com/michaeldrogalis/dire/ http://en.wikipedia.org/wiki/Metaobject#Metaobject_protocol
00:02akurilinAlright thanks, I'll investigate.
00:03akurilinBtw I almost switched from having a DAL for my "models" and then I realized mocking pure korma calls would have been not trivial. Guess I just add a level of indirection :)
00:04akurilinCan't win every fight.
00:04bitemyappI think the truism of software is that indirection solves every problem except indirection.
00:07bbloombitemyapp: is indirection a problem? or is slowdown (both for the computer's execution and the programmer reasoning) caused by excessive indirection the problem?
00:07justin_smithisn't indirection inherently some multiplier of computation time?
00:09bitemyappbbloom: I only care about the practical consequences.
00:10bitemyappbbloom: what languages do you hack in that aren't Clojure and CLJS?
00:10seangroveFacjure?
00:10bbloomseangrove wins: all my other code is in postfix notation. also, i only use traditional chinese characters
00:10seangrovefactjor :P
00:11bbloombitemyapp: but no seriously.... i'm working for Code.org right now
00:11bbloomif you're bilingual, help us translate! http://crowdin.net/project/codeorg
00:11bbloomanyway, that's javascript & ruby
00:11bbloomplus i tend to be the dude who writes a buttload of bash, sed, awk, make, etc
00:11seangrove我明明用简体字
00:11bbloomi'm monolingual :-P
00:12seangroveAh, well, all the more impressive for using traditional Chinese characters then
00:12seangrovebbloom: Looking at this now, could possibly handle a few languages
00:12seangroveNot sure what it is though
00:13seangroveHeading out for a few hours, but would be curious to check out later
00:14bbloomseangrove: http://code.org/hourofcode & http://code.org/translate
00:14ddellacostaseangrove: いってらっしゃい
00:15ddellacostawhat am I doing wrong that I can get stefon to run (specifically the clj-v8 component) when running via lein ring, but not within an uberjar on same environment?
00:15seangroveddellacosta: いってきますます
00:15ddellacostaseangrove: haha
00:16bbloomguys. it's not polite to speak in other languages in the presence of monolingual folks
00:16bbloomwe get paranoid
00:17ddellacostabbloom: sorry, I just said "see ya later," and he replied "be back," in a kind of funny way
00:17bbloomddellacosta: i google translated it :-P
00:17bbloomthanks tho
00:17ddellacostabbloom: ah. The impressive thing about seangrove is, however, that the first comment he made was Chinese, and the other ones were Japanese.
00:17ddellacostaand I think his Korean is pretty kickass too.
00:18bitemyappddellacosta: not the only languages he knows...
00:18bitemyappddellacosta: no no, the list keeps going.
00:18ddellacostaI'm sure...
00:20ddellacostanow, about that stefon issue...why would an uberjar give me this? https://www.refheap.com/20622
00:21ddellacostaI suspect I need to pass something to the java -jar args to tell it not to look for that lib in the system, but rather in a lib, but I am a java idiot so I'm not sure what is up.
00:32TEttingerI wonder if clojure on linux with openjdk (ARM) has the same performance issues clojure has/had on android (ARM). I'll be installing PicUntu on my roughly-$60 ARM mini-PC, and it would be nice if I could use clojure and run it on there. does anyone else have an MK802 or similar TV stick?
00:32beppunoob question: `lein new help` says that 3rd party templates can be found at https://clojars.org/search?q=lein-template but that list seems incomplete.
00:32beppuIs there a better way to find 3rd party `lein new` templates?
00:32TEttingerbeppu, that's a good question
00:33beppuTEttinger: wasn't the android performance issue due to the Dalvik VM (...and less to do w/ the ARM processor's characteristics)?
00:34TEttingerbeppu, I hope so. this thing is a quadcore ARM computer the size of a big usb drive
00:34TEttingerI am absolutely amazed by how cheap computers have gotten
00:42uvtcTEttinger, do you mean pico-ITX?
00:43TEttingernever heard of it, PicUntu is an ubuntu distro for these stick PCs
00:45uvtcAh. I thought maybe those tiny PC's you mentioned were of one of the ITX form-factors. Unfamiliar with stick PC's.
00:47TEttingerhttp://liliputing.com/2013/04/tronsmart-mk908-quad-core-android-tv-stick-performance-video.html
00:48TEttingerthere are tons of them now, and they have gotten a lot better in the last year or two
00:48TEttingerI own an MK802 first gen, which is a tiny overheat machine
00:49TEttingersince then there have been 3 or 4 versions that add new features to that, among them not overheating as much
00:49uvtcSilly question: can you run a desktop OS on one of those?
00:49TEttingeryes, if by desktop OS you mean linux
00:49uvtcRight.
00:49uvtcWow.
00:50TEttingerPicUntu is XFCE Ubuntu
00:50TEttingeryou can even use stock android with a keyboard and mouse, and I have
00:50uvtcThis is one of the reasons I'd love to see a Clojure implementation in C (or Rust?). JVM-based Clojure seems like it'd be too resource-hungry for one of these.
00:50justin_smithubuntu had a kickstarter for a phone that would work as a desktop once you connect a display / keyboard / mouse via USB
00:50justin_smithsame concept
00:50TEttingereh, it has 2GB RAM
00:52justin_smithI would use emacs on an n900 ages ago - I set up one of the keys on the keypad to be meta as a prefix key
00:52justin_smithand I actually succeeded in running a ring app on it
00:52justin_smith(very slowly)
00:52TEttingerha! I remember those nokia MIDs
00:52uvtc2GB. Wow. That's what my *current* desktop has. :)
00:58TEttingeruvtc, the one I got came with a wireless keyboard, which was the big problem I had with the MK802 -- I was carrying around a keyboard that was probably 50x larger than the computer. something like http://www.aliexpress.com/item/MK908-RK3188-quad-core-android-4-1-google-tv-stick-xbmc-box-2G-8G-bluetooth-mini/893264177.html
01:10ddellacostasoo...anyone know why jna.library.path is not set up properly when using clj-v8 in an uberjar?
01:11TEttingerddellacosta, can you set it as a JVM opt?
01:15ddellacostaTEttinger: I guess so...the problem is, I'm not sure what it should be. When I run the project via lein ring/repl, it is set to be the target dir
01:15ddellacostaI think that is the default. What I'm confused about is how it works when it is an uberjar
01:18ddellacostaargh, anyways, gotta go.
01:21tutysarawas reading web development in clojure, had a look at the middleware - wrap-noir-session, question is what is a stateful session and how it is different from the normal ring session
01:35bitemyapptutysara: depends on what's intended by "session"
01:35bitemyapptutysara: session can mean a user session, which is typically stored as an identifier, or in whole as data in the user's cookies
01:36bitemyapptutysara: but when it comes to Ring, what's usually meant is basically state that comes with the processing of the request.
01:40tutysaraokie, I wanted to know how is the ring session different from noir session (in lib noir) and what advantage i get by wrapping the handler in wrap-noir-session
01:42Raynestutysara: Ring's session middleware puts the session in the request map and expects that if you have updated the value that you return it inside of the response map.
01:43RaynesThis tends to be unwieldily sometimes, so wrap-noir-session exists to provide a stateful layer on top of it.
01:48tutysaraRaynes: ok, so this means noir takes care of sending the session data in response if we set in using sessions/put anywhere while processing the request
01:48Raynestutysara: Yes.
02:19dobry-dennother stateful session lib: https://github.com/brentonashworth/sandbar
03:35luxbockI'm trying to join two matrices together like this (extend [[1 2][3 4]] [[5 6][7 8]]) -> [[1 2 5 6][3 4 7 8]] using core.matrix but I can't think of how to do this (there's no extend command) other than to transpose both of the matrices and then add the second one as rows to the first one
03:35luxbockdoes anynoe know if there's a better way to do this?
03:44amalloyif you just wanted vectors instead of matrices, i think ##(map into [[1 2][3 4]] [[5 6][7 8]]) is fine?
03:44lazybot⇒ ([1 2 5 6] [3 4 7 8])
03:46luxbockyeah I was hoping to find a way that would work with all implementations of core.matrix
03:49luxbockI'm trying create a magic-matrix function and for the case of a singly even matrix I have to divide a bigger matrix into four sub-matrices and do a few transformations with those and then add them together again
04:10TEttingerluxbock, I'm curious what this matrix stuff is for
04:11luxbocknot for anything particular, just practice
04:11luxbockI noticed Octave has a function for creating magic-matrices and so I thought it would be a good excercise to write it in Clojure
04:12TEttingerah cool
04:12luxbockhttp://blogs.mathworks.com/cleve/2012/11/05/magic-squares-part-2-algorithms/
04:13luxbockjust following this
04:19poppingtonicluxbock: I'm sure there's a really elegant way of writing a magic-square algorithm. Cool.
04:24john2xis there a way to simplify this: (-> "foobarbaz" (str/replace #"foo" "fizz") (str/replace #"bar" "quuz") (str/replace #"baz" "buzz"))
04:25Apage43see clojure.string/escape if you don't need the searched part to actually be a regex
04:26Apage43,(clojure.string/escape "foo - bar - baz" {"foo" "fizz" "bar" "quuz" "baz" "buzz})
04:26clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
04:26Apage43,(clojure.string/escape "foo - bar - baz" {"foo" "fizz" "bar" "quuz" "baz" "buzz"})
04:26clojurebot"foo - bar - baz"
04:26Apage43huh
04:26Apage43oh feh
04:26Apage43escape works on characters, not arbitrary search strings
04:27TEttinger(doc (clojure.string/escape)
04:27clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
04:27TEttinger(doc clojure.string/escape)
04:27clojurebot"([s cmap]); Return a new string, using cmap to escape each character ch from s as follows: If (cmap ch) is nil, append ch to the new string. If (cmap ch) is non-nil, append (str (cmap ch)) instead."
04:27addisadenlearned *g+
04:27Apage43forget what i said :)
04:28addisadenis there a bot evaluating clojure? :D
04:28addisaden,(+ 1 2)
04:28clojurebot3
04:28addisadenhaha nice ^^
04:32TEttinger,(reduce #(clojure.string/replace %1 (first %2) (second %2)) "foobarbaz" {#"foo" "fizz" #"bar" "quuz" #"baz" "buzz"})
04:32clojurebot"fizzquuzbuzz"
04:32TEttingerit's always reduce.
04:33john2xcool, thanks!
04:34TEttingerno prob
05:23cYmenphew
05:23cYmenJust watched "are we there yet"...
05:23cYmennot sure if rich is a genious or crazy
06:18poushkarHello there. I am newbie in Clojure, reading about functions at the moment. Can't figure out why this code: (((fn [] +)) 4 5) results in 9. Could someone explain it to me, please?
06:21john2x(fn [] +) defines an anonymous function that just returns the function `+`. ((fn [] +)) calls that function, so now you have (+ 4 5)
06:24poushkarjohn2x: oh, that's easy. I've got confused with parentheses. Thank you
07:19cYmenalright, on to learning some "ring"
07:27cYmenQuestion: When I try to (use 'hello-world.core) from the repl and I have an error in that file. How can I recover and reload after fixing that error?
07:27h_smithcore.async question. if I have two threads listening on the same channel on the go block, how can send an event to both threads? looks like my event is getting consumed by only one listener
09:56zeebrahI was expecting (let [+ *] `(1 2 3 (+ 1 1))) to evaluate to (1 2 3 (clojure.core/* 1 1))) but it's not. What's up with that?
09:58justin_smithzeebrah: bindings in a let block are not evaluated if quoted
09:59justin_smith,(let [a +] `a)
09:59clojurebotsandbox/a
09:59justin_smith,(let [a +] 'a)
09:59clojurebota
10:01ddellacostasoo, I'm trying to get my uberjar to work the same way as my project run via lein ring, with regards to a library (clj-v8) that gets loaded via jna. The relevant code is here: https://github.com/circleci/clj-v8/blob/master/clj-v8/src/v8/core.clj
10:02ddellacostait seems like it finds the library for the external .so just fine (the one packaged with the clj-v8 lib itself) when loaded via lein ring/repl, but in the uberjar it tries looking for the lib in the system's libs
10:03ddellacostaI've tried setting -Djna.library.path in jvm-opts in lein project as well as when running the jar, but no dice.
10:04justin_smithwait, so you create an uberjar, then run it with lein?
10:04ddellacostajustin_smith: no, java -jar
10:04justin_smiththen -Djna.library.path should be in the java command line, right?
10:04ddellacostasorry, that was confusing: trying to get the uberjar to work the same way as running via lein ring/repl does
10:05ddellacostajustin_smith: right; but that doesn't work either.
10:05justin_smithweird
10:05justin_smithI have had many problems with jna loading as well
10:05justin_smithwish I knew what the problem was
10:06ddellacostawell, if you check this bit out, it seems like the lib itself is doing some magic: https://github.com/circleci/clj-v8/blob/master/clj-v8/src/v8/core.clj#L4
10:07justin_smithso what invoked __SET_JNA_PATH__?
10:07ddellacostajustin_smith: yeah, I guess I have to learn more about how jna works...pretty confused by what is going on there. I don't even know what the proper setting should be...is the lib packaged in the uberjar, and so should the path be relative to that? dunno
10:07justin_smithyou can open an uberjar with zip
10:07justin_smith*unzip
10:08ddellacosta__SET_JNA_PATH__ is set when loading that lib, I assume...if you're asking what uses it, it is stefon in my app
10:08justin_smithso that can help with that question, at least
10:08ddellacostayeah, good point, I knew that but didn't think to see if it was in there...will check right now
10:08justin_smithoh wait, the defonce is using the return value
10:08justin_smithso that is a total hack
10:09justin_smithit is just being done that way so you can reload the namespace without running the top level code again
10:09justin_smithI misread it at first
10:13ddellacostahuh, gotta go read up on jar file execution. I was hoping to avoid learning this much about Java...haha
10:13ddellacostathanks for taking a look justin_smith
10:14justin_smithI wish I understood this stuff better, there are some native libs I would like to be able to use
10:15ddellacostajustin_smith: yeah, I wish I understood it better too...I'll ping you if I figure anything out. For now I have some reading to do. :-/
10:26jared314has anyone built a library that uses core.async as an abstraction for jdbc? Google has failed me
10:36justin_smithjared314: well you don't need a specific library to do your queries inside a go block so that they are async with other code
10:37justin_smithbut you would need to adapt that heavily to your own db usage (knowing what can be done in parallel while waiting for the db to return your data)
10:39jared314justin_smith: well, then I will put that idea on the back burner then
10:41swarthyjared314: Writing some actual Golang code might help it make more sense. Typically in Go you would structure your code such that N readers would pull from something on the 'read' channel. Then you would send from those N readers to a single writer on the 'write' channel.
10:41swarthyjared314: Thus doing a bunch of stuff, but programming in a synchronous feeling way.
10:43ddellacostajustin_smith: dunno if your problems were like mine in that they are problems with uberjars, but this post was quite helpful in understanding the issue: https://groups.google.com/forum/#!topic/leiningen/2OZQPMi3cks
10:44ddellacostajustin_smith: this suggests that nothing you can do via jvm_opts or args to java will have any effect
10:44ddellacostajustin_smith: er, sorry, that's incorrect--will not have any effect with regards to specifying the path inside the jar to use those libs by default
10:45justin_smithright, so you have to put native libs onto disk somehow
10:45justin_smithbefore you can load them
10:45justin_smithyou would think there would be a standard turnkey way of doing this
10:46justin_smithbut I guess not
10:46ddellacostajustin_smith: yeah, seriously...seems like a relatively common issue
10:47ddellacostaweeelll, may be time to write a wee library perhaps
10:47justin_smithI have a four day weekend maybe I can make something...
10:47justin_smithyeah
10:48justin_smiththrow in some puns about blanket access to native libs and you can tie it into the american thanksgiving story
10:48justin_smithsorry, that was probably in bad taste
10:50ddellacostajustin_smith: hahaha
10:50ddellacostaas an American, I forgive you
10:50dobry-dennative american?
10:50ddellacostanope, not in the sense of being one of the folks who the Europeans displaced/killed en masse
10:52justin_smithI'll see what my tech lead thinks of the joke (he is Native American)
10:52ddellacostawell, I could continue the joke but I will stop...but it gave me a chuckle. I like dark humor, however
10:52ddellacostaah, there ya go.
10:53ddellacostaanyways, on that note, you folks have a good night. Gonna hit the hay.
10:54uvtco/
11:01francis_wolkeHas anyone run into an issue with the clojurescript browser repl where it freezes indefinitely? If so, what is your fix?
11:01dobry-denat this point in my life, i tend to restart repls til they work
11:02dobry-denfoo already refers to bar.foo? restarting
11:02dobry-denspotify frozen?
11:03francis_wolkedobry-den: I usually do that, however it's freezing on startup. I rolled back my git changes to ensure it's not something in my code.
11:04clojurebotHuh?
11:04justin_smithfrancis_wolke: another voodoo option is to lein clean
11:04justin_smithcan't hurt
11:05francis_wolkejustin_smith: Thanks. Totally forgot about that.
11:06seangrovefrancis_wolke: C-c C-b
11:06seangroveAnd then reconnected... although that's only for nrepl.el
11:09ziltiilitary
11:16francis_wolke3 restarts, and for some reason __this__ time it works. Strange.
11:16justin_smithI am sure that Papa Legba was appeased by your sacrificial lein clean
11:17francis_wolkejustin_smith: 3 restarts after `lein clean`
11:17justin_smithsacrifices take a while to get to their ethereal destination, duh
11:18jared314francis_wolke: it's like a car. If you keep trying to start it, it gets better.
11:19dobry-den^
11:19justin_smithperhaps we could implement a new plugin for percussive maintinance
11:20justin_smithlein jostle
11:20dobry-denthe entropy in your computer gradually aligns to adapt to the state it needs to be in for the jvm to work
11:20justin_smithwith the more powerful line slam option
11:20dobry-densorta like a car's computer
11:20dobry-denrepl to work*
11:25benmossdo people usually gitignore the output directory for cljs?
11:25justin_smithbenmoss: yeah
11:27dobry-denfor sure
11:28justin_smithoutput generated by code in the repo running in an automatic way should not be stored in the repo
11:28justin_smiththat goes for sass, m4, whatever
11:28dobry-dennothing worse than when you gitadd some js output and your clojure code coverage on github is reported below 100%
11:28dobry-denor when your project becomes a CSS project because you included twitter bootstrap
11:28justin_smithhah
11:28benmossso the target directory too?
11:29dobry-denyeah
11:29benmossah github has '/targets/' in their leiningen gitignore, but mine is producing target
11:30dobry-denyeah it should be target
11:33muhooi've seen projects (not clj) where people include jars in git. horrifying.
11:34benmossis there any way to use a local leiningen template?
11:34justin_smithI've worked on projects where people put all our assets (images, pdfs, zip downloads) into git
11:34muhoobenmoss: pivate repo?
11:35justin_smithbenmoss: I guess you could lein install it?
11:35benmossmuhoo: just for testing it
11:35dobry-denis it really that bad, though? it's like a layman's local-dependency deploy.
11:36justin_smithbenmoss: yeah, I usually lein install and then check from another project if I can use it before deploying, reduces the number of deploys I need to do
11:36muhoobenmoss: IIRC there is a way to test templates from a dir. don't remember where it's documented tho
11:36dobry-denjust look up the template literature
11:37muhoosame way as dev/testing plugins tho
11:37justin_smithit would be nice if we had a version of lein install which tracked what had been manually installed for easy removal, so you can local install to check that things work nicely, then remove so you don't get a warped view of what your lib versions act like
11:38justin_smithof course we can do this manually, but I like the idea of doing it conveniently
11:38dobry-denthe things we put up with
11:39justin_smithI'm not complaining, just daydreaming of possible features. I may even try to make that thing some day.
11:40dobry-denyeah, i didnt mean it like that
11:42dobry-denwhen i first came to clojure, i hated looking up dependency versions. (i still do if it's on maven) i started writing a plugin that lets me `lein dep-install compojure`. but i never polished it because i became too lazy
11:43jared314dobry-den: doesn't lein have a search task now?
11:43justin_smithso it would be a tool that would get the latest stable version of each dep I assume?
11:43dobry-denyeah, and mutate the project.clj map
11:44benmossafter i've `lein install`ed the local repo, how can i uninstall it so it doesn't shadow the real repo?
11:44justin_smithlike slamhound for your project.clj https://github.com/technomancy/slamhound
11:45dobry-denof course, by the time the jvm boots just to tell you it couldn't find "commnos-io" wwhen you mean "commons-io", you couldve just added it yourself
11:45justin_smithbenmoss: remove the director, it will bee under ~/.m2/
11:45justin_smith*directory
11:45benmossthanks
11:46dobry-denspeaking of, does anyone do any clojure develoment on a weak computer?
11:46justin_smithI ran a ring app on an n900 once, just to see if I could
11:46justin_smithit worked, but slowly
11:46dobry-deni was a rails developer on a 2009 atom netbook and that was painful
11:46dobry-denhaha
11:47justin_smithI used to use an underpowered 2008 Acer (with debian installed), but I got tired of having to shut down one lein project in order to have enough ram for another to run
11:48benmossI'm still working on a 2008 macbook
11:48justin_smithso I went totally over the top and got a system76 bonobo
11:48dobry-denhell yeah. 2 years on my netbook and i'd even have to do things like shutdown every other tab to watch a youtube video
11:48justin_smithwhich is awesome, but not as portable as a notebook should be
11:49justin_smithbut hey, 32 gigs of ram, as long as I don't try to use rythmbox that is enough
11:49justin_smithlol
11:49dobry-deni had a 17" laptop for half of uni. definitely a tank
11:49dobry-dencomical to open that fatboy up in class
11:49TimMcUpgrading from 8 to 16 GB of RAM at work. Too many Java services.
11:50dobry-denyeah, i'm at 8gm ram and it's not enough. especially now that i'm getting into datomic
11:50justin_smithhttps://www.system76.com/laptops/model/bonx7 17.3" bonobo extreme, weights 9 pounds, the power supply is another 4 pounds or so
11:50TimMcoh jeez
11:51justin_smiththat acer was 2 gigs of ram - somehow I managed to develop clojure on it anyway
11:51dobry-denever take that tank to a public space? it probably imposes itself upon the world around you
11:51justin_smithdefinitely
11:52dobry-deneven the dude that brings his imac to starbucks feels uneasy next to you
11:52justin_smithI always tell people I only use a computer that big in order to make me look smaller in comparison
12:48lynaghk`dnolen: ping
12:49lynaghk`dnolen: it's me and Zach Allaun coming to you straight from EC2. We're doing the node knockout and have run into "property backtrack undefined" issues with core.async + core.match. Using latest cljs, async, and match on node.js. Have you run into this before?
12:52jtoyi noticed for each java process I start with "lein run -m ns.core" it starts to java processes, is this normal and can I hve it run with one java process instead to reduce resource usage?
12:55jared314jtoy: have you tried lein trampoline?
12:56jtoyI have not, jared314 , i see this solves it http://www.flyingmachinestudios.com/programming/lein-trampoline/
12:57jared314jtoy: that is the one
13:00jtoyjared314: what exactly is a task name, I couldnt just change "lein run -m ns.core" to lein trampoline ns.core
13:02jared314jtoy: did "lein trampoline run -m ns.core" not work?
13:03jtoyjared314: yes, that does work, thank you
13:17brainproxyon the latest cljs and cljsbuild
13:17brainproxytrying to itegrate repl into my dev/test build
13:18brainproxygetting complaints about stuff missing seemingly related to goog base
13:18brainproxyso i guess it's not enough to require cljs.browser.repl in order to pull that stuff into the build
13:19brainproxynow, i see some references to "out/goog/base.js" in the wiki and other places
13:19brainproxyhowever, in the out dir, i only have cljs and clojure subdirs
13:20brainproxyalso, before today, I've never had an `out` dir, but have been doing `lein cljsbuild auto/once...` stuff for awhile, so maybe the upgrade of cljs and the lein plugin have brought that into play
13:20brainproxyclarification: the "complaints" mentioned above relate to browser-side exceptions from the the compiled js
13:22jtoyinteresting read, just came across this http://scottlocklin.wordpress.com/2011/11/30/only-fast-languages-are-interesting/
13:25jared314jtoy: I like how people invent micro benchmarks then judge things, without discussing it with anyone
13:26jared314jtoy: it's even better when they act stubborn and justify it with the "it shouldn't require effort" line
13:30justin_smith"Then again, the nice thing about the internets is people telling you when, and exactly how you’re being stupid."
13:31jared314justin_smith: reminds me of cat videos on reddit. "Hey look at my cat being crazy!" "Your cat is having a seizure, take it to the vet immediately!"
13:31brainproxyokay, after fiddling a bit it seems to come down to this exception:
13:31brainproxy"Uncaught TypeError: Object #<Object> has no method 'setTimeout' "
13:31brainproxywhere the object in question is "goog.Timer.defaultTimerObject"
13:32brainproxywhich is the same object as "goog.global"
13:34dobry-denjtoy: is it that interesting? that person has code like (def rands (repeatedly rand)) and (def tmp (take 3000000 rand)) which realizes both collections of 3mill numbers in two different vars
13:36dobry-denthen includes the realization of them both in the benchmarks
13:37indigo"Only smart programmers are interesting" ;P
13:38francis_wolkeClojurescript people: Earlier today I asked for a solution to a frozen browser repl. The issue happened again (repl freezes, restarting the repl does not help, detatching repl does not help), but this time aound I opened up the page I'm working on in a new tab - which fixes the issue.
13:38dobry-denif i blow the stack trying to add numbers in a language im admittedly new to, my first thought is actually that i'm a doing it wrong
13:38francis_wolkeThoughts?
13:38indigodobry-den: Funny, that was my thought too ;P
13:39dobry-denof course, mike anderson, clojure hero, is fucking everywhere
13:39jared314dobry-den: na, it shouldn't require thought. It should "just work". Like everything else in life
13:40dobry-denhe's like darkwing duck
13:40dobry-denoh look, a stackoverflow clojure question i can answer. Nope. mikera already answered it.
13:41dobry-den(he points out the blogger's issue in a comment on that post)
13:45majykmaybe mikera is the Jon Skeet of Clojure
13:51brainproxydnolen: I have a cljs project that uses a wrapper similar to the one I cooked up for mori several months ago
13:51brainproxyhttps://github.com/swannodette/mori/blob/master/support/wrapper.js
13:52brainproxyi discovered just now that the `..cal({})` part can be problematic inasmuch as in the compiled output there is a line `goog.global = this`
13:52brainproxyand there are other parts that depend on `goog.global` having on it all the expected things from the global environment, e.g. setTimeout
13:53brainproxyit's possible to replace `..call({})` in the wrapper with `..call(this)` but that kind of defeats the purpose
13:54brainproxyso... I was wondering if you had any thoughts on the matter; I had not run into a problem until just now when I was trying to make use of `clojure.browser.repl`, but I'm not sure whether that was the reason it came up or whether it's related to my bumping to the latest clojurescript release
14:34logic_progis there an idiomatic way to run read-string over an entire file after slurp-ing it ?
14:35justin_smithwhy not load-file?
14:35justin_smithor do you need the text too
14:35justin_smithoh, you don't want to execute, just read
14:36francis_wolkelogic_prog: java.io.PushbackReader
14:36logic_progI want to just read it all in as a sexp
14:37justin_smithdo you want it as text too?
14:37francis_wolkelogic_prog: Yes, but if it has multiples sexps?
14:37justin_smith(I mean as a string too)
14:37logic_progI want a list of sexp's
14:39francis_wolkelogic_prog: You want Pushbackreader.
14:39francis_wolkeIt'll allow you to read a file out as sexps
14:43logic_prog(let [reader (java.io.PushbackReader. (clojure.java.io/reader "lsearch.xyz"))] (clojure.edn/read reader))
14:43logic_proghow do I call map on this to read until eof?
14:44justin_smithyou probably want a loop rather than map
14:44justin_smithsince you don't have a sequence of the length of the input sequence
14:44justin_smithto map over
14:46logic_prog(let [reader (java.io.PushbackReader. (clojure.java.io/reader "lsearch.tkx"))] (loop [ans '()] (let [x (clojure.edn/read reader)] (recur (cons x ans)))))
14:46logic_proghow do I handle the exception?
14:47hyPiRion(let [sym (gensym) val (clojure.edn/read {:eof sym} reader)] (if-not (= val sym) (recur ...) return-val))
14:47hyPiRionOr something in that regard
14:47coventrylogic_prog: https://www.refheap.com/20629
14:48logic_progwill look into it, thanks
14:48coventryBut it's not reliable to read a whole file without evaluating it form by form.
14:49justin_smithcoventry: thats nice, I assume it is from an existing codebase?
14:49coventryYes.
14:49coventryjustin_smith: Some earlier mucking around. Nothing solid. https://www.refheap.com/20630
14:58bitemyapparrdem: boo
15:07dnolenlynaghk: ping
15:22dnolenlynaghk: you need to include the runtime core.match stuff
15:28sritchiebitemyapp: liberator Q, if you have a second
15:36benkay,ping
15:36clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ping in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:39bitemyappsritchie: I'm far from an expert, but I'll google what I can ^_^
15:41bitemyappbenkay: why do you keep doing that?
15:42benkaybecause i don't have a robust erc setup yet
15:42benkayand i'm in argentina, and occasionally the connection dies, and i know that if i
15:42benkay,anything
15:42clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: anything in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:43benkayclojurebot will respond
15:43benkay:)
15:43benkay¿sabes?
15:43benkay¿entiendes?
15:44biggbearyo sabía que los args decían ¿entendés?
15:45benkayyour spanish is better than mine ;)
15:45benkayadios!
15:45sritchiebitemyapp: try to use enlive with liberator,
15:46amalloybenkay: if it's just for private use, please /msg clojurebot instead of talking to him publicly - he responds just the same
15:46sritchieand I find that when I return my basic response from handle-not-found, (response/response enlive-snippet),
15:46sritchieNPEs abound :)
15:46sritchiebitemyapp: so the Q is, I guess, how to redirect?
15:46sritchieinside of a liberator response?
15:47benkaythanks amalloy
15:52sritchieNo method in multimethod 'render-map-generic' for dispatch value: text/javascript
15:52sritchiethis is the crux
16:00logic_prog_does clojurescript have a prepend? http://docs.closure-library.googlecode.com/git/closure_goog_dom_dom.js.html shows append, but I want to insert an element as a the _first_ child rather than _last_ child of a node
16:02bitemyappsritchie: eek @ enlive. Hrm. redirect.
16:04bitemyapphrm. this is why I just use Ring, haha.
16:04bitemyappsritchie: http://clojure-liberator.github.io/liberator/doc/handlers.html
16:04bitemyappsritchie: https://github.com/clojure-liberator/liberator/blob/master/examples/clj/examples/collection.clj#L52
16:14bbloomlogic_prog_: there is insertChildAt and insertSiblingBefore
16:14logic_proginsertChildAt seems to _replace_
16:14logic_progeither that, or I'm doing something wrong
16:15bbloomlogic_prog: i dunno. i don't really use any of the goog.dom stuff
16:17bitemyapp`cbp: how's your weekend going?
16:36cjfriszI've finally got enough of my own fns/macros that I use in every project to want them in a library that gets included by default. Is there a best practice for automating this?
16:38amalloycjfrisz: automatically including your library in other projects of yours? if you do this it will only bring tears
16:38dnolencljsfrisz: just make a lein template that includes your lib
16:39amalloyunless you just mean you want it added to your project.clj everytime you create a project
16:39cjfriszMoreso than copy/pasting the same few macros into every project?
16:39cjfriszamalloy: That
16:39amalloysure. then do what dnolen says
16:39cjfriszdnolen amalloy: thanks!
16:39bbloomcjfrisz: i think that copy paste is the right level of reuse for a many utilities
16:39technomancycjfrisz: scottj suggested making the default template look in the user profile for extra thingies to add, which would be neat
16:40technomancyor really, if all the templates did that
16:41cjfriszbbloom: Agreed, but I think the 4th time I copy my defrecord+ macro is when I should consider making it easier to access :-p
16:41bbloomwhat's defrecord+ do?
16:42cjfriszRight now it defines a get/set interface for the record a la R6RS define-record-type
16:42bbloom.... why?
16:43hiredmanbecause cjfrisz is a schemer
16:43cjfrisz^^^^
16:43bbloomdude. just stop making so many damn record types
16:43technomancy(inc bbloom)
16:43lazybot⇒ 18
16:43bbloomi have like 3 record types in dozens of small projects & i only created them after profiling :-P
16:43technomancyhypothesis: adding :reload/:reload-all/:verbose to a :require clause is a thing you do temporarily to your ns form, not something you intentionally leave in.
16:44technomancy[Y/n]
16:44Raynestechnomancy: Y
16:44cjfriszbbloom: I'm not claiming that everyone should do it; it's just the way my brain works thanks to Scheme
16:45technomancyRaynes: thanks. looking over a big slamhound improvement that only works with that assumption, but I think it's OK.
16:45bbloomcjfrisz: fight the urge. you're a smart guy. force yourself to think a different way and soon enough you'll gain some insight that frees your brain from one approach and offers you a vantage point from which you can select the appropriate approach
16:45bbloomtechnomancy: Y, but even more than that: i never add them. i rely on hotkeys in my editor
16:46technomancybbloom: even better
16:46Raynestechnomancy: I've only used reload for two reasons. The first is to reload a namespace in the REPL, and the second is to reload plugins in lazybot (but that is a function that calls the 'require' function, not an (ns ..) addition).
16:46RaynesI've never seen anyone else use it for anything more interesting than that either.
16:46cjfriszbbloom: Is the alternative to just use hash-maps instead?
16:47bbloomcjfrisz: the most common of several alternatives, yes
16:47technomancycjfrisz: they're just maps; ignore the concrete type
16:48technomancywhy did github screw up my comment by hiding the bulk of it here? https://github.com/technomancy/slamhound/pull/53#issuecomment-28137768
16:48bbloomcjfrisz: you need to decouple your mental concept of "type" from the "type tag" from "some tag i put on this data to discriminate by"
16:49bbloomtechnomancy: did you email it in?
16:49technomancybbloom: yeah, do they use a different parser or something?
16:49bbloomtechnomancy: what mail client do you use? at my last company i did *lots* of email parsing & quoted text removal and shit like that. it's a nightmare
16:50technomancybbloom: mu4e; just sending boring old plaintext email.
16:50bbloomtechnomancy: odd.... you didn't type two hyphens between your paragraphs by chance? :-P
16:50bbloomtechnomancy: or intent them 2 lines or whatever?
16:51technomancynope: http://p.hagelb.org/raw-github-comment.html
16:51bbloomsurely a regex run amuck
16:52bbloom*shrug*
16:52technomancyI specifically didn't wrap it because I know github doesn't like that
16:52technomancyone more reason to prefer non-http ways of accessing github I guess?
16:53bbloomcjfrisz: i can only assume that right now you're staring at some outputted data structure w/o a record type prefix and you feel like somebody has unclipped your seatbelt
16:53technomancyhttps://github.com/technomancy/slamhound/commit/6bf39a849c9f913e37c9eca10b9e28566850c502 \m/
16:54bitemyappcjfrisz: stop fucking around and just make maps.
16:55cjfriszbbloom bitemyapp: I don't get the record type fear
16:55cjfriszIt's not the performance, and it's not the record type tag
16:55bbloomcjfrisz: it's not fear
16:56cjfriszIt just evokes memories of sloppy undergrad code where they use association lists instead of define-record-type
16:56technomancyalists are a crappy workaround for not having a good associative data structure
16:56bbloomcjfrisz: by choosing to use a record, you're added a type tag to your public interface, declaring a minimum set of fields for initalization, weakening data interop between systems, introducing versioning problems, etc
16:57technomancysee that over and over in elisp and it is really terrible
16:58bbloomcjfrisz: if you don't need type dispatch or a fixed set of fields for perf reasons, then you shouldn't opt in to the other things that come along with records
16:58bitemyappcjfrisz: write Clojure, not Scheme in Clojure.
16:58cjfriszbbloom: So you'd quit your bitching if I changed defrecord+ to create a map instead of record type?
16:58bitemyappcjfrisz: don't be rude, we're trying to reduce your pain level arising from writing poor Clojure code.
16:59bbloomcjfrisz: no, then i'd bitch even more. accessor functions are a nightmare
16:59bbloombitemyapp: you're being rude. cjfrisz is willing to learn
16:59bbloombitemyapp: cjfrisz and i have met in person & are on terms where he can say "quit your bitching" to me
16:59bitemyappbbloom: this is your daily reminder that I am not omniscient.
17:00bitemyappif somebody is rude in IRC when receiving help, I'm going to snip their wings.
17:00bitemyappbbloom: if you can dump your facebook relationship graph to XML I can use that as a reference in future.
17:00bbloombitemyapp: i know you're not omniscient, which is why i informed you of the situtaiton
17:00bbloommoving on.
17:01technomancyrecords also act weirdly when reloaded
17:01bbloomcjfrisz: what benefit does accessor functions give you?
17:01technomancyyou can have two visually identical objects be not-equal
17:01bitemyapptechnomancy: well specifically, stale instances can float around.
17:01bitemyappthen something derived from an older version of the record type won't equal an otherwise identical record.
17:01bbloomtechnomancy: that's b/c defining a type has the side effect of pulling an entry from a unique source: new-ing up a type object
17:02bitemyappannoying and pointless.
17:02technomancyoccasionally a necessary evil
17:02bitemyapptechnomancy: this is why I prefer teaching Python people to use Clojure. "Just use maps" comes naturally.
17:02technomancybut not something you'd just inflict upon yourself for no reason
17:03bbloombitemyapp: that's not been my experience. the python community is very fractured between OOPnauts and "just use a function function and a map"-people
17:03bbloomcjfrisz: let's leave gut out of this for a moment: what do records or unique accessors buy *you*?
17:07cjfriszbbloom: Maybe nothing more than comfort of a familiar idiom a la define-record-type
17:07cjfriszbbloom: I'll have to think on that one more
17:07bbloomcjfrisz: getters & setters are one of the worst ideas to ever happen in programming :-)
17:07bbloomcjfrisz: another issue i have: auto-generation of predicates
17:08bbloomer type predicates
17:08bbloom(define-record-type foo ...) also gives you foo? too right?
17:10bbloomthere's no need for that either, b/c we already have generalized `instance? and `satisfies? for concrete types and abstractions respectively. beyond that, it's up to the programmer to define predicates which should have the docstring "Checks if x is a logical foo" rather than "Checks if x is an instance of type Foo", which is unnecessary early coupling
17:10bbloomcase in point:
17:10bbloom(doc fn?)
17:10clojurebot"([x]); Returns true if x implements Fn, i.e. is an object created via fn."
17:10bbloommeanwhile:
17:10bbloom(doc ifn?)
17:10clojurebot"([x]); Returns true if x implements IFn. Note that many data structures (e.g. sets and maps) implement IFn"
17:10bbloom*sigh* causes so much confusion!
17:11`cbp_bitemyapp: hi, just trying to learn some haskell cus every cs paper seems to be using it :(
17:11bbloomfn? should be ifn? and what was fn? should be (partial instance? clojure.langFn)
17:11bbloomcjfrisz: see what i'm getting at?
17:11bblooms/langFn/lang.Fn/
17:12cjfriszbbloom: So what about the fact that not having a functional interface to your data type leads to more silent failures if you try to access the data structure incorrectly?
17:13`cbp_ghc 900 mb....
17:13bbloomcjfrisz: who cares? everything is printable and immutable. add a pprint statement somewhere in your program, eyeball it, and resolve your "type error"
17:14bitemyapp`cbp_: that's a fantastic idea. I really enjoy Haskell. Keep me posted :)
17:15`cbpbitemyapp: how you doing?
17:15bitemyapp`cbp: I'm going to start poking at reproducible error cases and see what I can do to pass the error to the client.
17:15`cbpok
17:16bitemyappI'm pretty good, I haven't started coding, but I've been noodling over the error passing behavior all morning. I've got somebody coming by to buy a monitor off me, then I'll get to work.
17:16`cbpbitemyapp: did bja ever contact you again?
17:17cjfriszbbloom: I still think a functional interface is going to prevent enough debugging time to be worth it
17:17bitemyapp`cbp: no, that's why I'm proceeding.
17:17bitemyapp`cbp: he can improve upon whateve I do if he likes, but I want error handling in ASAP.
17:17bitemyappwell, not even "handling", just graceful notification of agent breakage to the client.
17:19bbloomcjfrisz: you have a functional interface. keywords are functions and assoc is a function too. what you want is earlier error detection via type checks
17:21cjfriszbbloom: keywords and assoc don't fail in those cases as I'd want them to
17:21bbloomcjfrisz: sure, but they are functions :-P
17:21cjfriszbbloom: I might need medical attention for the amount that my eyes are rolling
17:22bitemyappcjfrisz: if you want early error detection, why not use core.typed?
17:22cjfriszI can't stop it!
17:22amalloybitemyapp: if you like haskell, have you looked at elm? it's pretty neat, although i don't know if i'm excited enough to actually get good at it
17:23bitemyappamalloy: I have, but I favor things like Fay for that. I think it's cool that they're bringing FRP to the masses though.
17:23bitemyappamalloy: Fay being the CLJS of Haskell, so to speak.
17:23cjfriszbitemyapp bbloom: core.typed is a very cool thing that I like a lot, but the class of machinery you have to set up for that is way different and way heavier than if all I want is early error detection on improper record type accesses
17:26bbloomcjfrisz: so there is a cost/benefit trade off to be made between formally specifying static requirements and early detection of errors
17:26bbloomcjfrisz: i'm a big believer that things should fail loudly if they are gonna fail at all
17:27bbloomcjfrisz: and i'm also a believer that they should fail *early*
17:27bbloomcjfrisz: however, i don't buy the argument that early == compile time, since me working at my repl is as early as most people run their compilers, but i'll assume, as a schemer, you agree with that
17:27cjfriszbbloom: indeed
17:28amalloybitemyapp: neat. fay might be easier to pick up; fewer new concepts
17:28bbloomso by throwing an exception when there is a type error, i do get a *bit* earlier, like half way through execution, rather than after exectution w/ just a wrong value
17:28bbloomcjfrisz: however, i generally write & test small enough bits of purely functional code, that it's almost always trivial to pin point the source of the mistake
17:28bbloomcjfrisz: that said....
17:29bbloomcjfrisz: some programs really do have a lot of different concepts that exist in scope at the same time, all of which can be representeded by associative data structures
17:29bbloomcjfrisz: and i can imagine, it might get confusing when that does occur & type errors make slip through and not be detected early
17:29bbloomcjfrisz: *however*
17:30bbloomcjfrisz: i find it's more frequent that i'll invalidate an invariant, than add an extra key that has no impact
17:30bbloomcjfrisz: and i also find it's more frequent that i made a DESIGN error
17:31bbloomcjfrisz: and beyond those, my experience has shown that judicious print statements, validation functions, and carefully considered assertions, pays greater dividends
17:31bbloomcjfrisz: by relying on early detection of a small class of errors, my experience has been that i subconsiously adjust my design and process to nudge errors to fall in to that small class
17:32bbloomcjfrisz: and later, when i say "shit, i really need a validator function and some logging" i wish i started on it earlier!
17:34bitemyappamalloy: Fay is just vanilla Haskell + DOM interface for the most part.
17:34bbloomcjfrisz: i'm not saying it's not useful to have ready-built sanity checks. i'm saying that there are hidden costs and so you should only pay them when you need them & look for ways to avoid needing to pay them or to buy something different & get more bang for buck
17:34bitemyappamalloy: and uses the existing GHC tooling (thank god)
17:34amalloybitemyapp: minus typeclasses, apparently, which seems like a big deal
17:34amalloyor did i misread somehow?
17:35cjfriszbbloom: That sounds like we're suspiciously close to being on the same page :-p
17:36cjfriszbbloom: even if we enact it in different ways
17:36bbloomcjfrisz: as is always the case with smart people who arrive at the same place form wildly different directions & then ultimately talk past each other
17:36bbloomcjfrisz: i've been down the auto-generated attr_accessor path quite a bit in ruby land. i much prefer clojure's approach. all i'm saying: give it a try :-P
17:37cjfriszbbloom: I didn't realize that there was quite that much baggage on Clojure's record types, so that's useful to know
17:38cjfriszAs much shit as people give R6RS define-record-type, myself and the other prolific and intelligent Schemers of the world seem to get a lot of mileage out of the metaphor
17:38cjfriszSo I still buy into that metaphor, but I'm flexible on the underlying representation for it
17:38nooniani thought records were optimized compared to regular maps because there is only one instance of each key required for every instance?
17:38bbloomnoonian: that's not why the are optimized
17:38noonianoh?
17:38bbloomnoonian: they have a fixed memory layout for their required fields
17:39bbloomnoonian: the compiler can convert (:foo record) to a field lookup
17:39bitemyappamalloy: sadly, yeah. When cabal 1.18 and haskell-suite become standard and more common, that might change.
17:40noonianah, thanks for dropping that info
17:40noonianwhat is the 'baggage' you guys were talking about? i came in late
17:40bitemyappvalue types on the JVM would be kinda cool.
17:43bbloomnoonian: issues w/ namespace reloading regarding dispatch, equality, etc. asymmetry between assoc/dissoc and type preservation, problems for serialization & versioning, etc
17:44cjfriszLetting different versions of data structures play nice together is such a double-edged sword...
17:45noonianah, I see
17:46cjfriszI've had big Scheme systems where there were instances of "oh, it's a good thing that version wouldn't play nice because it was stale" and "man, I wish it didn't treat this version as stale" for the exact same record type
17:46bbloomcjfrisz: versioning is hard.
17:47cjfriszThe way the generative/nongenerative clause works in define-record-type, you can have it either way, but smarter programmers than I have taught to default to nongenerative
17:48technomancyare opaque structs a common thing across schemes?
17:48bbloomcjfrisz: i can't find any real details on gen/nongen.
17:48technomancythose are incredibly annoying
17:48bbloomcjfrisz: docs?
17:49bbloomoh i found something here http://www.scheme.com/tspl4/records.html
17:49cjfriszbbloom: was about to send that link
17:49bbloomright, def vs defonce
17:49bbloomboth suck for different reasons :-P:
17:50cjfriszbbloom: There might be additional details in CSUG: http://scheme.com/csug8/objects.html#./objects:h13
17:50cjfrisztechnomancy: R6RS records aren't *exactly* opaque
17:50cjfriszIf you're willing to do some gymnastics, you can pull the layout and interface out of a record
17:50cjfriszI've never had to do it, so I don't remember how off the top of my head
17:51bbloombut in general, this is complexity
17:51bbloomand it's cost you should only pay if you need to
17:51cjfriszbbloom: to what are you referring?
17:51bbloomgenerative vs nongenerative
17:51bbloomdefrecord (and deftype, etc) is generative
17:52bbloommaps are effectively nongenerative, since the type is consistent across clojure versions
17:52cjfriszbbloom: right
17:52cYmenGood evening.
17:52bbloomcjfrisz: nongenerative is problematic with static information tied to a type tag, like required fields
17:54cYmen*sigh*
17:55cYmenSince I'm trying to learn clojure I might as well start using emacs again...
17:55cYmenMy brain will be so messed up with all the shortcuts...
17:56noonianthat was too ambitious for me
17:56noonianwell, i've always used emacs but never too a fraction of its potential
17:57cYmenAre there any other IDEs?
17:57nooniani use Light Table now for Clojure
17:58cYmenOh, is that in a usable state?
17:59nooniandefinitely, but there aren't many docs so you have to know how to use its 'start typing and get shown possibly completions' interface
17:59noonianmainly for tweaking settings
18:17cjfriszSomething I've not thought about before
18:17cjfriszScheme: (eq? 'a 'a) => #t
18:17cjfriszClojure: (identical? 'a 'a) => false
18:18cjfriszThat is one really dumb thing Scheme did that was good to ignore in Clojure
18:18bbloomcjfrisz: that's b/c symbols can have metadata. keywords test identical?
18:18bbloomcjfrisz: technically, the strings that back the symbols are interned :-P
18:20cjfriszbbloom: the Scheme standard requires that all instances of a symbol be *actually a pointer to the same thing* IIRC
18:20cjfriszWhich is a really annoying thing to take care of
18:20bbloomcjfrisz: yeah, that's true of keywords in clj/jvm (sans the spec part)
18:21bbloomcjfrisz: it makes for super fast equality, which is important when symbols are self-evaluating, but not super important when symbols are ... symbolic ... for their intentional indirection
18:22cjfriszbbloom: right
18:22cjfriszKeywords working that way makes more sense than for symbols
18:22bbloomcjfrisz: it's also a reason why the vector syntax is so important
18:22bbloomsymbols : keywords :: lists : vectors ;; in terms of evaluation strategies
18:23bbloomany time you add a data type to your evaluator that has some kind of special evaluation rule, you should also add a quoting construct or a type with the non-special evaluation rule
18:24bbloomor both :-P
18:30cYmennoonian: Now I want to learn how to use lighttable, ring and clojure and clojurescript and feel totally overwhelmed.
18:30cYmenAll your fault!
18:30noonianhaha
18:30noonianyou'll thank me someday
18:30bbloomcYmen: just sloooow it down and use the little text editor at http://www.4clojure.com/ and do some puzzles
18:30bbloomyou can thank noonian looong after you thank me :-P
18:31cYmenbbloom: I've already done a ton of those.
18:31bbloomok, well then add one thing at a time
18:32rbxbxcYmen: what were you using for editing before clojure?
18:32rbxbxcYmen: most of the major environments have at least halfway decent support for Clojure now
18:33cYmenWell, I am used to vim and visual studio these days. But back when I was doing anything with lisp I liked emacs for it
18:33cYmen.
18:34cYmenSo far all the clojure I wrote was in vim without any support for anything.
18:34bbloomcYmen: try vim-fireplace. i use it heavily
18:34bbloomlots of closeted vim folks in here like it
18:34cYmenBut I was just looking at ways for not having to reload and restart everything when trying ring examples...
18:35rbxbxcYmen bbloom : yup, it's a pretty great environment
18:35cYmenforeplay was renamed to fireplace...what does that tell us about tpope? :p
18:35rbxbxcYmen: not sure what you mean exactly, but I'd be willing to bet vim-fireplace would help you to accomplish that.
18:36rbxbxcYmen: it tells us that some people got uneasy and didn't like an otherwise good plugin due to it's name so it was renamed :p
18:36cYmenrbxbx: Problem 1: When I try to (use 'hello-world.core) and I get an error, can I somehow recover without restarting the repl?
18:37swarthyI'm a Vim user that has been thoroughly enjoying LightTable for Clojure, what trouble are have with LightTable cYmen?
18:37rbxbxcYmen: care to gist the error?
18:38swarthyyou having*
18:38cYmenrbxbx: Uh sure I can produce one but I mean it's not about the error that is usually easily fixed....
18:39rbxbxcYmen: the error is putting vim into an unusable state?
18:39rbxbxcYmen: that... shouldn't be the case.
18:39cYmenrbxbx: No just the repl I started with lein repl.
18:39cYmenIn detail:
18:39cYmenstart repl with "lein repl"
18:40cYmenrun "(use 'ring.adapter.jetty)"
18:40cYmenrun "(use 'hello-world.core)"
18:40cYmennow get an error because of e.g. unmatched parens
18:40cYmenfix error...rerun last command doesn't work...
18:41cYmenI'm sorry my process probably doesn't make any sense at all.
18:43rbxbxcYmen: yeah, not sure off hand. I actually have to bounce, but if you're unable to resolve things feel free to ping me.
18:43rbxbxcYmen: sorry, godspeed!
18:43cYmenthanks anyway, bye
18:44cYmenswarthy: No real reason just didn't want to get into it right now because I am working remote through ssh.
18:44llambdais there a way to force lein to run each unit test in isolation? i'm seeing some strange results with a particular set of unit tests and if i manually do something like `lein test :only foo.bar/baz` all works as expected, otherwise there appears to be leakage between tests
18:45amalloyllambda: there's not really any such thing as "in isolation", unless you want to restart the jvm each time. there's nothing lein can do to "undo" any side effects your code decided to perform
18:46llambdahm it's too bad there isn't some kind of setup and tear down infrastructure that lein could call between tests
18:49coventryYou could probably get pretty close by rewriting run-tests to (require 'actual-namespace :reload) between each test in test-actual-namespace.
18:53amalloyllambda: you can use a test fixture to run any code you want before and after each test
18:53llambdacoventry: that might help. or possibly using something like speclj
18:53swarthycYmen: that makes sense
18:54technomancyllambda: yeah, that's a problem with clojure.test unfortunately
18:54technomancyno run-wide fixtures
19:00cYmenOh..I think I want nREPL.
19:02technomancyllambda: I think there could be a "run each test in its own JVM" plugin though, that sounds kind of familiar
19:05llambdatechnomancy: that might be helpful
19:18abaranoskydoes core.typed require you to type annotate everything before it is useful?
19:19bitemyappabaranosky: yes, but you can do it a namespace at a time.
19:19bitemyappabaranosky: you can ignore the type errors arising from a lack of annotations and focus on only the parts that are type errors for things that are annotated too.
19:19abaranoskybitemyapp: if that first ns depends on others, how does core.typed disambiuate?
19:19abaranoskyI see
19:19bitemyappit doesn't, you add no-check annotations for the outside things you're using.
19:19arohnerabaranosky: start small
19:20abaranoskybitemyapp: do you know a good link to see how to write type annotations for common stuff?
19:20bitemyappthe no-check annotations isolate the type checker propagation.
19:20bitemyappabaranosky: https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/base_env.clj
19:20bitemyapp~baseenv is https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/base_env.clj
19:20clojurebotRoger.
19:21abaranoskybitemyapp: thx, that's perfect
19:22bitemyappabaranosky: no problem at all.
19:23bitemyappabaranosky: and I second arohner's advice, start small.
19:26abaranoskybitemyapp and arohner: the error messages aren't so obvious. Makes sense to start small.
19:26bitemyappabaranosky: domain is the arguments to the function, range is the results
19:26bitemyappthat might be obvious to somebody that took undergrad math in college, but I did not, so it took me a moment.
19:28bitemyapparohner: but you knew what it meant immediately when it said domain/range, right?
19:29arohnerI figured them out from context
19:29bitemyappsame as me then.
19:29abaranoskydo you see anything wrong here? https://gist.github.com/AlexBaranosky/7392037
19:30bitemyappabaranosky: also, you can use check-ns and cf from the REPL, might be faster than lein typed.
19:30abaranoskybitemyapp: yeah, cool, thx
19:31bitemyappabaranosky: example project while I try to understand why the nested vec set is failing. https://github.com/typedclojure/core.typed-example
19:31bitemyappabaranosky: there's also a typed-clojure IRC channel btw.
19:37dobry-denHow do yall prevent Java APIs from infesting your code with their bullshit? Sometimes I have a Bouncycastle Point: (.toBigInteger (.getX point)). Sometimes I hava a java.security Point: (.getAffineX point)
19:38abaranoskybitemyapp: are you using core.typed for any production code? I'm still on the fence about the added verbosity its going to add
19:38abaranoskydobry-den: could you elaborate a little more on the question?
19:39abaranoskyI'm not familar with those libs, but on thing you can always do is convert to the points to Vectors
19:39abaranoskyits context-dependent though
19:41cjfriszThis sounds like a painfully dumb question, but I've just never run into it before: is there a built-in predicate to ask if something is a boolean?
19:41cjfriszI know there's true? and false?
19:41abaranosky(some-fn true? false?) ;; :)
19:42abaranosky(partial instance? Boolean)
19:42cjfriszabaranosky: The former is what I wrote
19:43abaranoskythis is probably fastest: (defn boolean? [x] (instance? Boolean x))
19:43dobry-denabaranosky: I guess i'm looking for a pattern so that I can carry points around in my code like {:x BigInt, :y BigInt}, or keypairs like {:priv _, :pub _}.
19:44dobry-denand then i'd define a function like (defn multiply [point n] ...) that turns them back into whatever Java obj they need to be
19:44abaranosky most would robably use [x y]
19:44jtoyis it correct to say that if i define a macro that calls other functions, all those other functions must be defined ahead of time? but shouldnt the functions i call only need to be defined when I use the macro?
19:44bitemyappabaranosky: production code? no, but I've experimented with using it on production code.
19:44bitemyappabaranosky: production code isn't a good measure here, my current project at work is a bit of a throwaway and is very "HACK NOW NOW NOW NOW" in terms of scheduling.
19:45bitemyappif I had some time to fuckin' breathe I'd eat the pain and just it.
19:45bitemyappjust use it*
19:47abaranosky`reduced` is a pretty neat little somewhat recent addition to clojure.core
19:47abaranoskyenables you to short-circuit a reduce call
19:51bitemyappabaranosky: reduced is important, it brings folding capability in Clojure to parity with loop/recur and Haskell's foldl/foldl'/foldr
19:51abaranoskybitemyapp: yeah, it rocks for certain
19:51bitemyappmostly to parity with loop/recur, there are some things recursion can do that a short-circuiting fold might still find a little awkward.
19:51bitemyappI can provide an example if you care what that might be.
19:52abaranoskybitemyapp: if you want, go for it, but don't go too far out of you way on my behalf :)
19:52bitemyappabaranosky: this is a pattern I ran into that is really awkward with folds, basically where you want to "take 2, merge those items, put them back into the iterable"
19:53bitemyappabaranosky: messing with the base iterable in that way is awkward with folds unless you make it part of the "carry" and do something else for the actual foldee.
19:53bitemyappwhich would be really weird and is in effect, mimicking recursion in a fold for no good reason.
19:53abaranoskybitemyapp: yeah, I use oo/recur for that
19:53bitemyappso you just use loop/recur (or recursion, if you're in Haskell) for that.
19:54abaranoskyI meant loop/recur , not oo/recur :)
19:56dnolengot sick of using console.log, added enable-console-print! to CLJS, also added support for *print-length* https://github.com/clojure/clojurescript/compare/5827c4cd48...0e427a08c5
19:56dnolenif somebody wants to do *print-depth* that would be cool
19:57bitemyappdnolen: I'm surprised it took you that long to get impatient with it,
19:57dnolenbitemyapp: always some other yak I'd rather shave
19:58bitemyappdnolen: I chuckled heartily when cemerick said there were no more yaks left in Clojure-land. Least true thing I'd seen in ages.
20:03dnolenheh wow
20:03dnolenclojure.pprint uses defstruct still
20:06abaranoskydon't fix it, if it ain't broken ;)
20:07dnolenabaranosky: truth
20:11jtoywhat is the proper way to test if a function is defined?
20:14bitemyappjtoy: there's nothing specific to functions for this.
20:14bitemyappjtoy: and I can still tell you're writing terrible code.
20:15bitemyappjtoy: you should learn Clojure.
20:15bitemyappspecifically, if you did, you'd know why you don't need anything specific to functions to detect if a var is defined or not.
20:16bitemyappjtoy: I recommend this book: http://clojurebook.com/
20:37jtoyhow is it possible to get an error like: user-find already refers to: #'toy-app.datastore/user-find in namespace: pusher.core if user-find is only defined in toy-app.datastore ?
20:39bjajtoy, if you attempt to def user-find in toy-app.datastore or require it twice, I believe you would see tat
20:39bitemyappbja: I'd like to start on the error handling stuff
20:40bitemyappbja: have you made any progress? if not, that's okay, I just don't want to trip over you.
20:44jtoybja i cant require it twice? I require it from different namespaces
20:44jtoyi only def it once and I double checked with grep, so it must be the require twice issue, how exactly does that work?
20:44bjawithin the same namespace, you would see that error. you can require it from as many namespaces as you wish
21:07dobry-denjtoy: a common way to botch your state is to do something like (:require [... :refer :all]), eval it, delete the line, then 1 hour later (for me, 5 min) without having restarted the repl, you forget you did it
21:07ambrosebsabaranosky: did you figure out your core.typed parse errors?
21:07dobry-denand now youve got all them phantom functions defined in the current ns
21:07dobry-denand nothing to grep
21:08dobry-denthat's why if one were to piechart how i spend my time every day, it's a pacman labeled "restarting repl"
21:11dobry-denin his mouth a sliver labeled "whining on #clojure"
21:19MattYhello. there was one macro that lets you pipe a value through a series of functions. anyone knows what I am talking about?
21:19MattY>> or something
21:20bitemyapp,(-> 1 inc inc inc inc inc inc inc inc inc inc inc inc inc inc inc inc inc inc inc inc inc)
21:20clojurebot22
21:20MattYthat's it, thanks!
21:29mtpbitemyapp‘ wow
21:39arrdembitemyapp: watrudoing
21:39arrdembitemyapp: I log in and all I see is inc
21:44Julian_darrdem: He was answering a question: "MattY: hello. there was one macro that lets you pipe a value through a series of functions. anyone knows what I am talking about?"
21:45arrdemJulian_d: I know just giving him crap
21:45Julian_darrdem: my bad :p Just trying to be helpful. I'm likely to need the karma down the road ;)
21:47justin_smithhis code can be made more seasonal
21:47justin_smith,(let [❄ inc ☃ 1] (-> ☃ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄ ❄))
21:47clojurebot42
21:48arrdemjustin_smith: you aren't helping here bud :P
21:51ddellacostajustin_smith: I go to bed and when I get up you're still making holiday jokes
21:51ddellacostajustin_smith: I commend you sir
21:51dobry-denI'm new to typed clojure and I'm having trouble in the newbie foothills: How can I annotate a byte array?
21:52justin_smithddellacosta: I was out bicycling most of the day, but back now
21:53ddellacostajustin_smith: you're spoiling my fantasy of someone spending all day on IRC making bad holiday jokes. It's like, bad-santa-bot or something
21:53dobry-denoh yeah, under the blanket with the native libs
21:54justin_smithddellacosta: hah
21:54ddellacostadobry-den: haha, you remembered...
21:55arrdemdobry-den: won't it just be (Seq byte)?
21:55justin_smithI am working on a quad tree that is cljs compatible for a packing lib, with bit masks I am getting really amazing performance
21:56justin_smith(which I need, because every placement will need a number of quad tree ops)
21:56ddellacostasooo, speaking of native libs, in an uberjar, how do I execute code before my require'd libs get loaded for my main fn?
21:57ddellacostajustin_smith: that sounds pretty cool, are you going to release it as OSS?
21:57justin_smithddellacosta: yeah
21:57ddellacostaneat, would like to check it out when you do
21:57justin_smithbasically we are thinking "masonry in clj / cljs (but more configurable / customizable)
21:57justin_smith"
21:57arrdemddellacosta: you'll have to not use (ns) for requires, execute code first then use inline (require) forms to get the same effect.
21:58justin_smithnot very far yet, but I have some very smart collaborators so I think it wil lrock
21:58ddellacostaarrdem: ah, okay, I was suspecting something along those lines...thanks.
21:58arrdemddellacosta: you're welcome, sorry there isn't a better answer
21:59justin_smitharrdem: it would suffice to only do that with the mainspace with -main in it, right?
21:59ddellacostaarrdem: nah, I just want to make sure that there isn't...poking around leiningen docs and mailing lists yields about the same kind of answers
21:59justin_smithand other namespaces could be normal?
22:02bitemyappddellacosta: hey, Japanese question
22:19concurif I recur from within the locking macro, will I keep the lock?
22:19concuror leave the scope of locking?
22:19bitemyappconcur: I have a hard time imagining why that would interfere with anything
22:20bitemyappconcur: more chancy would be doing core.async channel operations which could deadlock.
22:20amalloyconcur: i sorta doubt you can recur across a locking-boundary
22:21concurI just want to get out of the locking scope
22:21concurand try again basically
22:21concurbut some things need to happen before it locks again
22:22amalloy&(loop [l (Object.)] (locking l (recur l)))
22:22lazybotjava.lang.UnsupportedOperationException: Cannot recur across try
22:22Apage43CompilerException java.lang.UnsupportedOperationException: Cannot recur across try
22:22concuraw
22:22concurthanks
22:22amalloyconcur: instead of trying to use recur to break out, you have to "finish" the locking block normally, and then recur while already outside it
22:22amalloyor recur to a point that's still inside it
22:23concurthe thing is
22:23concurI want to exit the lock on two different conditions
22:23concurone recurs
22:23concurone actually does something
22:24concurhmm
22:24concurI think I know how I can pull this off actually
22:24Apage43i like the new windows 8.1 installer messages
22:24concurI'll have to see what finish does first
22:24concur&(doc finish)
22:24lazybotjava.lang.RuntimeException: Unable to resolve var: finish in this context
22:25concurlol
22:25Apage43"Setting up a few more things..." "Getting ready..." "Almost ready..." "Let's start"
22:25concurI should probably do that in my own terminal anyway
22:26concuroh
22:26concurlol
22:26concurI thought you meant finish was a function
22:26concurwas wondering what it could do
22:26concuryou just meant to close the parens off though :P
22:40dobry-denDoes anyone have a command handy for evaluating some arbitrary clojure with nrepl? For instance, I'd like to bind C-c C-f to (clojure.typed/check-ns)
23:01justin_smithconcur: instead of using the locking form you can use a java.concurrent.locks.Lock, and lock and unlock it manually http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/locks/Lock.html
23:01concurthat's true
23:02concurI think I'll be able to make due with just locking
23:02concurbut that's good to keep in mind
23:03justin_smithbut then it is of course up to you to ensure that the Lock object gets released
23:03justin_smithwhich is nicer with locking, you just need to be sure the form exits and you are good
23:05concurright
23:06concurI'm trying to minimize my java interop anyway
23:06concurI already have way too much of it
23:08concurI think I've found a very nice way to utilize locking in my program :)
23:08concurno need for Lock
23:18concurI just ran my code for the first time
23:18concurgot one small error that I fixed right away
23:18concurand on the second run it works
23:18concurwhat in the name of fuck?
23:18concurthis can't be
23:19justin_smiththe code demons are messing with your head
23:20concurit still has the same exact issue that the other function I wrote had, actually
23:20concurwhich I think is an issue with the interface they share
23:20concurbut other than that, it works perfect
23:20concurI don't believe this
23:21concurbut I'll take it as an excuse to finally go to that party
23:21concurand stop writing code for the night
23:23muhoooontz oontz oontz code party
23:27bitemyappI'm having an issue where a write against SocketOutputStream connected to a broken socket will return nil and not error out
23:27bitemyappbut a second write will finally throw the exception.
23:27bitemyapphow do I make the first unsuccessful write throw?
23:32justin_smithyou could put an assert around the write, then any falsey return throws
23:33justin_smithnever mind, an assert does not return the value asserted
23:33justin_smithif that function existed (and you could make it exist), it may be the simplest way to handle the situation
23:34bitemyapper.
23:34bitemyappthere are multiple things going on with what you said that aren't matching my mental model of the universe. one moment please.
23:34justin_smith,(doto 1 assert)
23:34clojurebot1
23:34justin_smith,(doto nil assert)
23:34clojurebot#<AssertionError java.lang.AssertionError: Assert failed: G__60>
23:34justin_smithsee, falsey is an exception
23:34weimy clojure.tools.logging/spy macro stopped working after switching to logback (but the other macros work, e.g. info). where is the output going for spy?
23:35justin_smithconcise
23:35justin_smith(doto (write-to-socket) assert)
23:35bitemyappjustin_smith: for starters, .write always returns nil.
23:35justin_smithreturns the value of write-to-socket, or throws
23:35justin_smiththat's what you want, no?
23:35bitemyappjustin_smith: I have zero means of detecting whether it failed or not
23:35justin_smithoh, sorry
23:35justin_smithnever mind then
23:35bitemyappbecause it always returns nil and it's not throwing an exception.
23:36bitemyapponly if I perform a *second* write will it throw a socket exception.
23:36justin_smithcheck .open after writes?
23:36bitemyappjustin_smith: ...on the socket or the outputstream?
23:37bitemyappI don't see an open method on the outputstream.
23:37bitemyappnor on the socket.
23:38bitemyapp:connected continues to be true on the socket even after a disconnection occurs.
23:38justin_smithis this because the socket is an OS resource, and nothing in the jvm finds out the other end has closed it until it tries to use it?
23:38bitemyappit DID use it!
23:39bitemyappI wrote to it while the server on the other side was down!
23:39amalloybitemyapp: i mean, in general that's not possible, right? you can't control how long it takes the networking stack to detect/decide that the other end of the socket is dead
23:39bitemyappthe problem is that writes aren't triggering any exceptions or issues of any kind, yet are getting SWALLOWED somehow.
23:39bitemyappamalloy: shouldn't a write against a dead connection fail?
23:39justin_smithbecause of how sockets are supposed to work, the OS is supposed to retry after the system call returns
23:39bitemyappI know it won't magically throw when I don't do anything
23:39bitemyappbut shouldn't it fail when I write to it the first time, as opposed to the second time?
23:40justin_smithI don't know if there is a way to wait for the OS timeout or respond to it
23:40amalloysure, if it's known to be dead. but in real life, write() on a working socket just puts something in a networking buffer and schedules some networking activity
23:40bitemyappare you telling me writes are non-blocking and throwing bytes over the fence?
23:40justin_smithno, because the way sockets work, it returns before the other end has acked
23:40amalloythen, eventually, that write happens, and when the other end doesn't respond in X amount of time, the OS concludes the socket is dead
23:41bitemyappchrist
23:41justin_smithbitemyapp: to your last question, yes
23:41amalloybitemyapp: the alternative is too horrible to contemplate. your entire app blocks every time you send a byte, for an entire tcp round-trip
23:41bitemyappsure but
23:41justin_smithit is not a java problem even, it is how posix and sockets are designed to work
23:41bitemyapphow do I know which writes failed and which did not, asynchronously or not?
23:41bitemyappif it just gets swallowed and I can't tell the difference?
23:42amalloyi'm not sure. it's the sort of thing it's hard for me to decide if it's even possible
23:42bitemyappif I attempt to run a SQL query against a down database, I get an exception or error back
23:42justin_smithbitemyapp: http://www.softlab.ntua.gr/facilities/documentation/unix/unix-socket-faq/unix-socket-faq-2.html
23:43bitemyapp*how are they doing that?*
23:43justin_smithtop question in that faq
23:43bitemyappjustin_smith: fine fine fine whatever, but there is existing tooling that is returning errors deterministically for failed writes.
23:43amalloybitemyapp: because they're expecting an actual response back; when they don't get one, they throw an exception
23:43Adeonthey send back acknowledgements
23:44bitemyappokay, so the problem here is that my reads are independent of my writes.
23:44justin_smithyeah, you need an ACK that you can check for
23:44amalloyif all you're doing is shouting into the ether, you won't find out quite as quickly that nobody is listening
23:44bitemyappit's a non-blocking API
23:44bitemyappso it sounds like if my socket dies I need to deliver the exception to all on-deck promises.
23:44bitemyappand wrap up the agent
23:49lpvbanyone know how to get the intellij repl to recompile java source code so I don't have to relaunch it
23:50justin_smithlpvb: maybe import? does import implicitly reload?
23:50justin_smithmaybe not
23:51lpvbno
23:51lpvbI have to do lein javac
23:51lpvbthen close the repl
23:52lpvbstart it up again and then import reloads the right object file
23:53bitemyappokay, so I'm starting to get this nailed down.
23:54bitemyappis failure the only condition under which a read from an InputStream will return nil?
23:54justin_smithmaybe keep a set of un-acknowledged sent data, and once you get a closed socket, you mark all in the set as unsent?
23:55justin_smithbitemyapp: no, I think it can return nil if it isn't ready
23:55lpvbit's really slow too because lein javac first launches leiningen and that takes a while
23:55lpvbis there a way to get lein in some kind of continuous mode so I can issue commands to it
23:56lpvbwithout relaunching lein
23:59algalHello, all.
23:59algalI'd love some advice on how to use Clojure's concurrency features correctly, to maintain certain invariants in an SQL db.
23:59algalI understand the point of an SQL db is usually that they guarantee operations are atomic, but I'd like to build up some operations within clojure functions that are effectively atomic within those functions.