#clojure logs

2014-11-20

00:05technomancyTimMc: whoa
00:15FriedBobWoo hoo! Figured out how to get the edn-config stuff and not have to use profiles. Now I can move on to the meat of the project and see how much of what I have read has stuck.
00:26kenrestivois there a way in schema to say, i want a map here, but its structure is opaque and i don't have time to specify the whole deep thing?
00:27kenrestivoi.e. {:foo s/SomeRandomMapIDontControl}
00:34rritochkenrestivo: XML Schema?
00:34kenrestivoprismatic schema
00:34kenrestivohttps://github.com/Prismatic/schema
00:37rritochkenrestivo: Hmm, sorry can't help you there... is XSD it's <xs:any namespace="##any" processContents="skip"/>, no idea what prismatic would use since I've never used it.
00:40rritochkenrestivo: Looking at the source though it looks like there is an Any, I'm just not sure what syntax you'd use
00:40rritochhttps://github.com/Prismatic/schema/blob/master/src/cljx/schema/core.cljx#L242-L244
00:40rritochkenrestivo: Maybe s/Any
00:40kenrestivoyeah i saw that. also an empty map seems to work {}
00:40kenrestivoi want to specify that it's a map, just not what's in the map
00:41kenrestivo{s/Any s/Any} might work too
00:47ambrosebskenrestivo: perhaps (s/pred map? 'map?)
00:47ambrosebsjust going off the readme
00:48kenrestivoit seems like there are several ways. so far {} works, {s/Any s/Any} works, {s/Keyword s/Any} works. pred probably can too.
01:02rritochWhere is the clojurescript syntax #+clj documented? It looks like a reader macro but I can't find documentation for it
01:03justin_smithrritoch: that's cljx notation
01:03justin_smithit means code that is only used in clojure (jvm) and not in clojurescript
01:06rritochjustin_smith: Thanks, that helps, checkout out the cljx now. I'm easing into clojurescript since the web platform is nearly fully functional. I added a http-mapper to the kernel, and an implementation to the core which should now make it possible to serve static files
01:07rritochjustin_smith: While doing that I realized that I can make a servlet specific for serving resolved ".clj" resources so that will probably be my next step which will invalidate the need for template engines since the role of delivering extension based content types would be taken over by servlets
01:08rritochjustin_smith: And this may also mean that within a month I should finally be out of the systems level code and actually into web application development
01:21rritochIs it possible to "include" one lein plugin in another? Looking at the cljx features it looks like cljx would be very useful when generating OSGi bundles but I have a lein plugin which generates the OSGi bundles so I'm not sure how I could refrence cljx code from another leiningen plugin, I've never tried anything like that before.
01:23rritochIf I load cljx as a dependency instead of as a plugin would that make the cljx code available to my leiningen plugin?
01:24justin_smithrritoch: it should, yes
01:25rritochjustin_smith: Cool :) That's been one of the big complications I've been trying to resolve, how to compile clojurescript into web applications prior to deployment, and cljx seems to solve much of that problem, and provides the benefit of code-reuse between the server side (clj) and the client side (cljs).
01:26rritochjustin_smith: Sneaking into Web 5.0 land :)
01:28clojerAnyone deploying on Openshift? I'm missing something getting a default app to start. Probably something really obvious :(
01:28rritochSomeone in here was also working on making browser plugins using clojurescript which is another important leap I'll need to make to enter Web 5.0 land. Being able to offload processes to the client for offline processing is key to Web 5.0.
01:31justin_smithclojer: I don't know anything about openshift, but I know that it is easy to deploy an uberwar webapp to aws elastic beanstalk, and pretty straightforward to deploy a self-hosting webapp (ie. http-kit) on aws ec2 or heroku
01:31justin_smithclojer: in fact, technomancy works at heroku and often helps people here to get their apps set up to run there
01:33clojerjustin_smith: I have the community cartridge and app setup but it doesn't appear to be started. I ssh'ed into the account and ran lein run but an error was returned: Could not transfer artifact lein-ring:lein-ring:pom:0.7.5 from/to clojars (https://clojars.org/repo/): Specified destination directory cannot be created: /var/lib/openshift/546d7bd35973ca795600002c/.m2/repository/lein-ring/lein-ring/0.7.5
01:34justin_smithclojer: OK, what's your $HOME set to?
01:34justin_smithclojer: also, it's actually better not to use lein in production at all
01:34justin_smithbuild an uberjar, and then use java to run it on the server
01:35clojerjustin_smith: I thought of trying EC2 but they take card details, if I remember, so you have to watch your usage.
01:35justin_smithclojer: ahh, so openshift has a straightforward free teir? interesting
01:35clojerjustin_smith: Lein was a last resort.
01:35justin_smithclojer: did you try creating an uberjar and running it?
01:36clojerjustin_smith: Yes. No card and no 1-year expiry .... as far as I'm aware :)
01:37clojerjustin_smith: I'm not sure their setup allows this as I didn't setup an app server. You can go with Wildfly 8 but that's a different route.
01:37justin_smithwhat wouldn't their setup allow?
01:37justin_smithif lein will run, java will run
01:38justin_smithclojer: use an embedded server, I like http-kit
01:38justin_smithjava -jar my.uberjar.jar
01:38justin_smiththat's it
01:38clojerjustin_smith: OK, I'll give it a try. I'm new to deployment as all my Clojure so far has been running locally.
01:38justin_smith(well lein uberjar to create the jar...)
01:38justin_smithclojer: OK. Uberjars make it amazingly simple.
01:38justin_smithit's a single file, you tell java to run it. That's it
01:39clojerjustin_smith: How do I tell Java to run it? Sorry :)
01:39justin_smithI already said above "java -jar <name of uberjar>"
01:40justin_smithclojer: if your app will run via "lein run", it will usually run from an uberjar with no issues
01:40clojerAh, thought that was creation. Great.
01:40justin_smith"lein uberjar" is creation
01:40justin_smithalso pretty simple
01:40justin_smiththe tricky part is it means your main needs to be aot compiled
01:41justin_smithbut, alternatively you can run it via "java -cp <name of uberjar> -m clojure.main your.core
01:41justin_smith"
01:41clojerjustin_smith: Does that mean I have to create teh uberjar locally and git-push?
01:42justin_smithclojer: you should be able to scp it
01:42clojerjustin_smith: If so there's a JVM mismatch :(
01:42justin_smithI don't even like to have git installed on my server
01:42justin_smithclojer: jvm mismatch...
01:42justin_smithI've never seen that
01:43justin_smithclojer: were there any more details?
01:43clojerjustin_smith: When I ran the app locally there was an error which seemed to refer to something deprecated in JDK 8
01:44justin_smithso you created the uberjar, and tried to run it?
01:44clojerWARNING: :warn-on-reflection is deprecated in project.clj; use :global-vars.
01:44clojerReflection warning, /private/var/folders/5h/4fvvcx856_lgdmyz0rxgtwgh0000gp/T/form-init3201957262574781917.clj:1:906 - call to invokeStaticMethod can't be resolved.
01:45justin_smithclojer: that's just reflection warnings
01:45clojerjustin_smith: No, this was with `lein run`
01:45justin_smithclojer: those are not errors
01:45justin_smithOK
01:45justin_smiththose warnings just mean that :warn-on-reflection is on, and you are getting reflection warnings
01:45justin_smithit's an optional feature that helps you get your code to run faster
01:45justin_smithif you use typehints and eliminate the warnings
01:46justin_smithbut it doesn't mean your code won't run
01:46clojerjustin_smith: It hung at that point, though.
01:46justin_smithOK
01:46justin_smithclojer: do you launch a server in your -main ?
01:47justin_smithI am assuming this is a ring app btw, is it?
01:47clojerjustin_smith: Great discovery! It didn't hang. Just no feedback that it was running :)
01:47justin_smithoh, nice
01:47clojerjustin_smith: Locally, that is.
01:49clojerjustin_smith: I'll have another go getting it pushed and running. Thanks.
01:49justin_smithnp
01:50justin_smithlike I said, if lein run works, then running the uberjar should (which you can also verify locally)
01:51clojerjustin_smith: Just one more thing.
01:51justin_smithOK
01:51clojerjustin_smith: the default came with Clojure 1.5.1 so if I revert to the uberjar method do I assume I can upgrade everything to a higher version?
01:51clojurebotTitim gan éirí ort.
01:52justin_smithclojer: the uberjar will use whichever version of clojure your project.clj specifies
01:52justin_smithclojure is just another java library as far as the uberjar is concerned
01:52clojerjustin_smith: Yes, thought so.
01:52justin_smithuberjars work fine with 1.5.1 in my experience
01:54justin_smithclojer: the reason I recommend uberjars and not using lein or git on the production machine is because it reduces the number of things that can be misconfigured (or differently configured) between your dev machine and prod
01:55justin_smithclojer: you have a guarantee that what runs on prod is the exact set of versions that worked locally, because uberjar grabs the same artifacts and packages them
01:55clojerjustin_smith: Will use uberjar. I'd heard of it before but hadn't tried as I was doing everything locally. Cheers.
01:55justin_smithclojer: also, using a jar directly has faster startup time and lower memory usage than with lein, and that can matter a lot on production
01:56justin_smithclojer: I hope I didn't leave anything out... it's pretty simple though
01:56clojerjustin_smith: I'm glad you mentioned that as I was originally going with Go for memory efficiency and because I wasn't aware that Clojure was an option at Openshift.
01:58justin_smithclojer: generally, if java will run, and you have sufficient RAM to spare, clojure will run
01:58justin_smitheven android (though the startup time there is painful and the jvm is very nonstandard)
01:59clojerjustin_smith: Openshift comes with 3 gears, each of which has 512Mb RAM but you can select a "scaling" option which appears to pool the combined resources.
01:59justin_smithinteresting
02:00clojerjustin_smith: More precisely it seems to add a Haproxy into the mix.
02:00justin_smithyeah, 512 is a limit you can hit fast in clojure, but with some care you should be able to make it work
02:00justin_smithclojer: that's a setup that isn't as good for clojure
02:01justin_smithclojer: for php or ruby, being able to route to different instances is a great way to scale, but clojure has a high baseline mem usage (thanks to the size of the lang, and the use of immutible data structures everywhere) but it scales very well in one instance
02:02clojerjustin_smith: Yes, I'm hoping this "scaling" option creates a combined 1.5GB RAM but I have my doubts.
02:02justin_smith:)
02:03clojerjustin_smith: I think the scaling is specific to web requests.
02:03justin_smithyeah, that just isn't what you do in clojure
02:03clojerjustin_smith: You never know, though.
02:03justin_smithclojer: so for php you have one process per request
02:03justin_smithclojer: clojure handles threads, and long living processes very nicely
02:04clojerjustin_smith: Some warning with uberjar: Warning: specified :main without including it in :aot.
02:04justin_smithclojer: I've done pretty big corparate sites, and I have used a lot of ram, but never more than one machine / vm instance
02:04clojerIf you only need AOT for your uberjar, consider adding :aot :all into your
02:04clojer:uberjar profile instead.
02:04justin_smithclojer: that means you should use the java -cp option I mentioned
02:04clojerWarning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-class directive may be missing in the namespace which contains the main method.
02:05justin_smithclojer: how do you usually run the app?
02:05clojerjustin_smith: `lein run`
02:05clojerjustin_smith: My first use of `lein uberjar`
02:06clojerjustin_smith: Maybe I need to study :uberjar options a bit first
02:06justin_smithOK, you can ignore the warnings and use "java -cp <your jar> -m clojure.main your.ns"
02:06justin_smithwait, let me double check that syntax
02:11amalloyjustin_smith: java -cp my.jar clojure.main -m my.ns
02:12justin_smithamalloy: thanks! I was afraid of that.
02:12amalloyor uh, maybe it's not -m to clojure.main?
02:13amalloy&(doc clojure.main/main)
02:13lazybotjava.lang.SecurityException: You tripped the alarm! clojure.main is bad!
02:13justin_smithI run clean pretty often, so I will verify as soon as I have an uberjar to test it on
02:13amalloywell, anyway, it says use -m
02:15justin_smithI am totally gonna make a pr to leiningen where it immediately says "use LEIN_SNAPSHOTS_IN_RELEASE to override" instead of getting to the very end of the jar building process, and then bailing
02:15clojerjustin_smith: It sounds like a bit of high magic is required to get this uberjar working :(
02:15justin_smithhmm - it's typically been reliable for me - though I usually have a script running things, so I only set it up once for each project
02:15justin_smithnot magic at all, I promise
02:16justin_smithclojer: the whole "not needing to aot compile -main" is new for me, and I have not utilized it in production yet
02:17justin_smithbut it is a good thing that I do intend to take advantage of
02:17clojerjustin_smith: I'll look into it later. Have to dash now. thanks for all the help.
02:19justin_smith$mail clojer if you are using the built in ring server and don't have a standalone server configured in -main, you may want to use "lein ring uberwar" to create the standalone
02:19lazybotMessage saved.
02:35dysfunjustin_smith: is that preferred over generating an uberjar and providing a server in main?
02:36justin_smithdysfun: not really
02:36justin_smithdysfun: but easier to try out
02:36dysfunthat's what i thought
02:36justin_smith(if you are using lein ring)
02:38justin_smithI just noticed that "teach yourself progoramming in ten years" mentions clojure http://norvig.com/21-days.htm
02:47rritochIs there a good way to change the "source" folder in clojure at runtime? For example, if I have a clojure servlet running on a tomcat server, via whatever means, but I want to pull the sources from a different folder, similar to how yii is deployed where sources are in a non-web accessible location... Would that be possible and if so how?
02:48justin_smithrritoch: I think that would be a question of adjusting the classpath
02:48justin_smithrritoch: I am not sure of the details here though
02:52rritochjustin_smith: So I should be able to use clojure.core/add-classpath for this?
02:53rritochjustin_smith: My concern is that function is deprecated
02:53justin_smithI'm not sure, but that sounds right. When you use require, it looks for files on the classpath.
02:54rritochAny idea why they deprecated add-classpath?
02:54justin_smithrelevant thread on the group https://groups.google.com/forum/#!topic/clojure/eAf3PT5vjsI
03:01rritochjustin_smith: Ok, I think I understand the problem at least. Currentlyl I'm deploying apps with lein grid push, which just compiles and copies code to the web root, but I want to be able to edit code in real time, maybe I can achieve this by just pushing the maven dependencies to the classpath, and a configuration file to direct the servlet to add the source folder to the classpath
03:01rritocherr, push maven dependencies to the lib path ...
03:02rritochEither way, it looks like I need to make my own add-classpath function since this one is going away, which is really too bad because there are a lot of uses for it.
03:02justin_smithrritoch: you could check out what pomegranate does
03:03justin_smithit adds maven deps to the classpath at runtime
03:03justin_smithor maybe you can just use pomegranate
03:04rritochCool, that should work
03:04rritochThe less I need to maintain the better :)
03:08rritochI also need to figure out what I need to do to ring to get it to work, I'm using hostmonster for my site right now which doesn't provide tomcat, but I'm thinking I can make a ruby app to deploy ring, assuming I can stop ring from blocking tomcat dependencies.
03:08rritocherr, hostgator
03:08justin_smithrritoch: any reason you can't use an in-app web server like http-kit?
03:10rritochNot particularly, I simply wasn't aware of it, Ring is the only stand alone clojure web server that I'm aware of.
03:10justin_smithrritoch: ring is not a server
03:10justin_smithit is an adapter layer
03:10justin_smithhttp-kit is ring compatible
03:10justin_smithring can also be adapted for containers like tomcat or jetty
03:11justin_smithin fact, as far as I know ring is the way you are expected to use http-kit
03:12justin_smithhttp://www.http-kit.org/
03:13rritochHmm, well that sounds about right. Its usage looks very similar to ring, so as long as it doesn't block my tomcat dependencies that should work
03:14rritochWith ring or http-kit though it looks like I'm still not going to be able to stream content, (such as mmpeg) but it is a step in the right direction
03:14justin_smithrritoch: ring is an adaptor that lets you use the same code for an embedded server (like http-kit) or a container (like tomcat) - but you would only be using one of those at a time
03:14justin_smithrritoch: http-kit explicitly supports websockets and streaming / async connections
03:15rritochoh?
03:15rritochOk, that is what I need then, I just need to figure out how it works and get it integrated. Tomcat is fine for development purposes, but isn't going to be good for end-users
03:15justin_smiththat link I pasted above, their example code uses a websocket
03:16justin_smithanother option that supports streaming (also ring compatible) is aleph https://github.com/ztellman/aleph
03:17justin_smithit is also standalone like http-kit is
03:17rritochCPanel's tomcat plugin (experimental) is horrible, and virtually useless, so my choices are to tie into ruby with a standalone implementation, like http-kit, or rewrite the CPanel plugin and hope CPanel accepts it. http-kit seems an easier route.
03:19rritoch(inc justin_smith)
03:19lazybot⇒ 137
03:19rritochI've owed you that for awhile, lol
03:19rritochI just didn't know how to use it until recently
03:21rritochAnyhow, thanks again. I think http-kit + pomegranate solve my remaining deployment issues
03:26rritochI'm also toying with the idea of trying to solve the C10K problem with clojure, but that may be pushing the technology far past it's capabilities.
03:26rritochIf I were to solve C10K with it though, that would be very helpful for marketing purposes
03:28rritochI've already added a lot of optimizations, but I haven't yet run any significant benchmarks on it
03:33szymanowskihi, is there something other than performance that yields to prefer protocols over multimethods?
03:36weidatomic question: how do you use the pull api to get all entities with a specific attribute?
03:38justin_smithszymanowski: a protocol describes a group of methods a type implements, while a multimethod is a single method. You can easily create a single method protocol of course, but it means that a protocol can tend to be more like an interface (in fact it compiles to one) while a multimethod is just a single generic function
03:44szymanowskiyes I know, but they target at the same purpose: polymorphism, and can be used for the same thing no?
03:46szymanowskiit is just that everybody seems to automatically use protocols over multimethods and would like to know if it is JUST for performance or other aditional benefits
03:46szymanowskijust*
03:46justin_smithszymanowski: they are simpler, they more directly use the built in facilities of the vm
03:47szymanowskidoes multimethods are really much more slow than protocols?
03:47justin_smithszymanowski: also, consider that if I write a library, and want users to be able to provide an implementation of some part of the logic - it often makes more sense to say "implement this protocol" rather than "implement these multimethods"
03:47justin_smithszymanowski: yes
03:47szymanowskiyes I see
03:48szymanowskithank you
03:48justin_smithone advantage for multimethods is in the repl, reloading the codebase
03:48justin_smithprotocols are much clumsier for redefining without a restart
03:49szymanowskiI really love multimethods, so flexible
03:49justin_smithmultimethods also support derive based heirarchies, and arbitrary dispatch functions, but in practice I don't see those features used very much
03:49szymanowskiyes
03:49justin_smithusually it's either a keyword lookup, or the type of the thing that are dispatched on
03:50szymanowskiyes in this situation I prefer protocols
03:50justin_smithalso, because protocols only do type based dispatch, you end up needing to use defrecord or deftype or adding a :type metadata to your code
03:50justin_smith,(type (with-meta {} {:type 'foo}))
03:51szymanowskiprotocols doesn't dispatch on type but on class no?
03:51clojurebotfoo
03:51szymanowskiyes I'm often doing this trick
03:51justin_smithszymanowski: good point, I think it is actually class they dispatch on, yeah
03:51szymanowskithat a bit sad I think
03:51justin_smithit's the sacrifice needed so that the performance is at least available
03:52szymanowskibut this is maybe that that allow speed
03:52justin_smithszymanowski: yeah, a protocol directly creates a jvm interface, and interfaces only support class dispatch
03:52szymanowskiI find that using protocol yields to write more complex code
03:52justin_smithyeah, it can
03:52justin_smithI use them sparingly
03:53szymanowskiI like the old school way of doing all with native types plus type metadata
03:54szymanowskithank you, i'm going back to work, have a nice day
03:54justin_smithif possible I avoid type dispatch altogether, and simply write code that uses native types
03:54justin_smithyou too
03:55justin_smith(I guess I am implicitly using the built in type / protocol dispatch when I use the core functions of course)
04:43schrottihm the nrepl used by lein is a 2-3 times slower than the one that comes with clojure.jar
04:43schrottihow come?
04:53morfeenAnybody here have used Clojurescript to build something on the server side?
04:53morfeenwith Node, that is
04:58dysfunwhy would you do that voluntarily when you have clojure available?
05:00morfeendysfun: npm?
05:00morfeennpm libraries
05:00dysfunclojars?
05:00dysfunthere's almost nothing i want for in clojure
05:01dysfunand the only thing i want for involves poking around JNI, so i'm just using something else
05:02TEttingermorfeen, I think people do that, sometimes, but it isn't common
05:02morfeendysfun: cool, do you use Clojure in production?
05:03dysfunproduct is in development, but we will be doing soon
05:04dysfunusing clojure makes me feel a lot more confident that the concurrency stuff won't become a problem
05:04morfeenClojars seem cool
05:04dysfunthere are a lot of useful libraries
05:05dysfunif you're struggling to find a particular library, http://clojure-toolbox.com/ is a good resource
05:05dysfunor asking in here. but bear in mind there's a choice and people have different tastes
05:06dysfunbut we've largely built around what luminus provides. except we've cut a few things out and swapped in some other things
05:06dysfunit'll be open source when we've tidied it all up, so you'll be able to see
05:07rritochIs there any way to check if a resource (URL) is a file or a directory?
05:07morfeendysfun: I thought the Clojure community was against the idea of using monolith frameworks
05:07morfeenLuminus seems to be one, if I am not mistaken
05:07dysfunmorfeen: it isn't a monolith framework. it's some glue code around a reasonably well chosen selection of libraries
05:07dysfunin fact, i'm not sure it even exists outside of a leiningen template
05:08morfeenright, so is Luminus the way to go with web dev? Like express for node?
05:08dysfunagain, people have their preferences. i like it
05:08dysfunwe are, like any other programming language, not short for web frameworks
05:09morfeenCool.
05:09dysfunnotably we don't use korma per their recommendations because we're using redis to handle our data
05:09clgvmorfeen: not necessarily. you can just have a look which libraries luminus uses and the you can setup your own project with only a subset of them without using luminus
05:10dysfuni'd recommend generating an app with the leiningen template and stripping out anything you don't want. i've done that a few times recently
05:10rritochI didn't realize that getResource requests on OSGi bundles for directories would return a non-null response, so it is screwing up the following code https://github.com/rritoch/clj-grid-core/blob/master/src/com/vnetpublishing/clj/grid/lib/grid/servlet/standard_servlet.clj#L91-L95
05:10schmirplain old clojure.jdbc instead of korma is also an option
05:11dysfunschmir: if you hate yourself
05:11morfeenclgv: cool
05:11schmirdysfun: why?
05:12morfeendysfun: What are you guys building? If you don't mind me asking
05:12dysfunschmir: because it's painful in the extreme. if i had to use it every day i'd quit my job
05:12dysfunmorfeen: an open-source e-commerce platform ("online shop platform")
05:13clgvmorfeen: optimization algorithms for logistics (but I am the odd one around here ;) )
05:13morfeeninteresting stuff!
05:13TEttingergames.
05:14morfeenTEttinger: that's cool! Clojure or Clojurescirpt?
05:14dysfuni wanted to do some games using actual clojure and web canvas, but JavaFX is crap :/
05:14dysfunthe only way to make it work would be to mix clojurescript and clojure and that started to seem a bit daft
05:15SagiCZ1morfeen: i am using clojure to build stock trading platform and automatic trading robots
05:15TEttingermorfeen, I have one bad little demo in clojure, but I've been working on making the art assets to do something better.
05:15dysfunSagiCZ1: interesting. some people came to me with a similar problem the other day and i said "i'd use clojure". not alone :)
05:16sveriHi there, timbre or something else for logging? Voting is opened now
05:16dysfuntimbre is very lovely
05:16TEttingerthe final game project may be in clojure or clojurescript, I'm just not an expert with web stuff
05:16SagiCZ1dysfun: the only thing i am concerned about, is that the platform has to be incredibly stable since outages could cost real $$.. i am not sure if clojure is mature enough to run for days without crash.. then again the bugs would be probably introduced by me anyways
05:17dysfunSagiCZ1: there are ways around that involving load balancers
05:17schmir+1 for timbre
05:18SagiCZ1TEttinger: are you using a 3d engine? i would love it if someone could wrap jMonkeyEngine in clojure.. it is very powerful but the API is a mess
05:18schmirdysfun: I don't think korma takes much pain away from sql...
05:19TEttingerSagiCZ1: erlang and its VM are possibly more reliable than the JVM, but clojure is certainly pretty reliable. My lightly-used IRC bot has had long periods of uptime, only broken when my household internet fails
05:19schmirbut then I also haven't used it...
05:19dysfunschmir: i think it eliminates one category of pain entirely, but does nothing for the fact you still have to think in SQL
05:19SagiCZ1TEttinger: thanks for sharing the experience, that's reassuring..
05:21dysfunand there's an awful lot of clojure being used in banks. i think we'd have heard something if there was a major problem with stability
05:21TEttingerit's running on windows server 2008 R2 (on a laptop; I needed to fresh install and I had a copy of the OS from school for free). that OS has also been surprisingly reliable
05:21SagiCZ1dysfun: in banks? never heard of that
05:21SagiCZ1TEttinger: i was thinking whether i really need to run this on linux since i am a windows guy.. maybe windows server would be an option
05:22TEttingerlinux is cheaper if you aren't a student :)
05:22TEttingerBSD is also legendary for its reliability
05:22SagiCZ1TEttinger: i actually do have dreamspark licence so its free anyways
05:22TEttingerheh, good then!
05:24clgvSagiCZ1: Clojure has been major enough to run for days for a while
05:24clgvSagiCZ1: I have run experiments spanning at least 3-7 days using all cores on the machines running on 6 machines
05:25SagiCZ1clgv: yeah.. i guess the risk of my own bugs would be magnitudes higher than some inherited instability
05:25clgvSagiCZ1: yes, that is the challenge ;)
05:26SagiCZ1cglv: i actually chose clojure also because it is so easy to test pure functions, compared to traditional junit tests in mutable java which gave me many headaches in my day job
05:26clgvSagiCZ1: I had a number of try-catches which ensured that single failing runs do not take down the whole system
05:26dysfunSagiCZ1: well we know datomic is being used in lots of banks, and it's written in clojure...
05:26SagiCZ1clgv: yeah i am planning on including some sort of recovery system
05:26SagiCZ1dysfun: super cool!
05:27dysfunwell, 'lots of' may be overstating it, but certainly a handful
05:27SagiCZ1dysfun: one would be enough to convince me, banks are serious business
05:29dysfunSagiCZ1: you might not say that if you'd worked in one. but those stories aren't for this channel :)
05:29SagiCZ1dysfun: hah i see your poitn
05:29SagiCZ1*point
05:30dysfuni am constantly amazed the banking system works at all
05:30SagiCZ1dysfun: you could be amazed equally about any compex burreocracy system.. (i cant spell)
05:31dysfunSagiCZ1: quite. i've had my fill of beaurocracies for a while
05:31clgv"office jackstraw games"? the first one to move in office losses? ;)
05:32dysfunif you find yourself in the office at 1 in the morning, ever, you should seriously take a look at your life and how it got this way
05:34clgvoh yeah that's bad.
05:34clgvmy personal record is around 11pm - shortly before submission deadline ended
05:34Glenjamini know a few places that still do really-late-night rollouts
05:35dysfunhah, i pulled an all nighter once
05:35morfeenCould you recommend a Clojure book for me? I am a node developer, so I am used to some of the ideas of functional programming, like higher order functions. I am currently reading Clojure in action.
05:35dysfunGlenjamin: if your system isn't set up to facilitate remotely flicking a switch to roll backwards and forwards, make it so
05:35schmirmorfeen: joy of clojure.
05:35schmirmorfeen: but finish clojure in action first
05:35dysfunmorfeen: The joy of clojure is quite good if you like the functional bits. and it does a good job of explaining why if you understand some already
05:36morfeenschmir: is Joy of Clojure a reference book?
05:36dysfunno, it's a guided tour through the language
05:36Glenjaminmm, very much so
05:36dysfunthere's enough material to make it a useful reference, i suppose
05:37schmirmorfeen: no, but it's probably not the best book if you know nothing about clojure
05:37morfeenso, Joy of Clojure is mostly about the philosophy?
05:37dysfunschmir: on the other hand i find clojure in action to be a terrible book
05:37morfeendysfun: why is that?
05:38dysfunmostly because we have much better libraries these days and it's getting old
05:38schmirdysfun: I read it a few years ago...and I think it was ok.
05:38dysfunbut because the libraries were crap back then, it's a very hard progression
05:39schmirspeaking about libraries...the clojure cookbook is nice
05:39dysfunand by introducing things like redis pretty early on, the author overloads you with information too quickly
05:39dysfunit's more like "how to solve the specific problem i solved with clojure, and a bad tutorial to step you into it"
05:40dysfunif you have the same problem, and you come at it with with existing knowledge of the other tools he uses, i can see it might be useful
05:41Glenjamini found the most helpful thing when learning clojure was to have a problem to solve
05:41dysfunor a project :)
05:41Glenjamintutorials/4clojure/koans to get started, then dive into a problem/project and keep looking things up
05:59SagiCZ1morfeen: i would strongly suggest to avoid Joy of Clojure.. i personally regret the time spending reading through this book, which is very long for what it has to offer.. i followed it with Clojure Programming and felt that it was much better read with more value to it.. try it.. also braveclojure is not that bad, koans and 4clojure is also enjoyable
06:14m1dnight_If i have (assoc {} \x 10), how do I get the value for \x?
06:14m1dnight_I figured (\x <map) but that doesn't work
06:14Bronsa(get {\x 10} \x)
06:14Bronsa,(get {\x 10} \x)
06:14clojurebot10
06:14m1dnight_oh
06:14Bronsa,({\x 10} \x)
06:14clojurebot10
06:15m1dnight_oooh
06:15m1dnight_but..
06:15m1dnight_,(:key {:key value})
06:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: value in this context, compiling:(NO_SOURCE_PATH:0:0)>
06:15m1dnight_okay i must have been mistaken
06:15m1dnight_thnx
06:15SagiCZ1,(:key {:key 'value})
06:15clojurebotvalue
06:15Bronsa,(:foo {:foo 1})
06:15clojurebot1
06:15Bronsam1dnight_: in clojure, keywords are functions
06:15Bronsam1dnight_: maps vectors and sets are also functions
06:15Bronsam1dnight_: char literals are not
06:16SagiCZ1and although maps are also functions, its recommended to use keywords as function, if you want to switch to records later
06:20dysfunwhy? don't records also act as functions like maps?
06:20Bronsano
06:20SagiCZ1dysfun: they don't
06:20dysfunhrm
06:20dysfunthat seems an omission
06:20Bronsayou might want to implement a different IFn behaviour
06:20dysfunoh i see what you mean
06:21dysfunit seems like a sensible default though
06:25morfeenSagiCZ1: thanks, will checkout Clojure Programming.
06:26SagiCZ1morfeen: the authors are Emerick, Carper, Grand
06:27morfeenSagiCZI: I'm currently reading Clojure in Action, have you read that book?
06:27SagiCZ1nope, is it good?
06:28morfeenIt's alright, but some people in this channel do not recommend it
06:28dysfuni think it was just me, actually
06:28SagiCZ1i see..
06:28SagiCZ1opinions may differ i guess
06:28morfeendysfun: some people, was you :D
06:28clgvmorfeen: "Programming Clojure" (now in 2nd edition) was really good to get going rapidly
06:28morfeenclgv: great!
06:29clgvmorfeen: pay attention to the order of the two words..
06:29clgvtwo pretty different books
06:29morfeenclgv: order of what 2 words?
06:29SagiCZ1there is also a very interesting chapter explaining how to develop really abstract code in a way i wouldnt imagine before
06:29morfeenAh alright
06:30dysfunclgv: my flatmate is learning clojure. he programs mostly scala. would you recommend it to him as an intro?
06:30SagiCZ1oh its a different book
06:30SagiCZ1nevermind
06:31clgvdysfun: I'd make the choice between "Programming Clojure" and "Clojure Programming" depending on which writing style you like better
06:31clgvdysfun: I think that both have sample chapters
06:31Glenjaminas in your preferred noun-verb order?
06:31SagiCZ1Glenjamin: :D
06:31dysfun(inc Glenjamin)
06:31lazybot⇒ 9
06:32morfeenSagiCZ1, clgv: You are both talking about different books right?
06:32SagiCZ1morfeen: yes
06:32morfeenSo of the 2, which one should I read, if I want to get up to speed real quick?
06:32clgvmorfeen: see my comment above ,)
06:33SagiCZ1morfeen: i cant compare, sorry
06:33morfeenI mean, I do have some exposure of FP with Javascript.
06:34clgvmorfeen: from my point of view "Programming Clojure" since it has pretty technical writing opposed to the more narrative style of "Clojure Programming"
06:34SagiCZ1i started from scratch and Clojure Programming was easy to grasp so it might be to slow for you
06:34SagiCZ1*too slow
06:34clgvmorfeen: but have a look at their sample chapters
06:34morfeenCool.
06:35clgvreplace "has pretty technical writing" by "is written in a more technical style"
06:35clgv;)
06:38kyrremorfeen, i'd get programming clojure and then after a while follow it up with "the joy of clojure"
07:00morfeenkyrre: Cool. Programming Clojure it is then.
07:01clgvmorfeen: make sure you get the 2nd edition
07:05boyscaredit's clojure conj day!!@#!
07:05boyscaredthere aint no party like a clojure conj party
07:05boyscaredcuz a clojure conj party infinitely recurses
07:06clgvah really?
07:10clgv"tex in clojure" sounds interesting
07:19luxbockhow long did it take the last time for the talks to be uploaded online?
07:23clgv1-2 months it seems
07:23clgvjudging from youtube info "posted on" and the conference date
07:42jmnozbeginner question: where can I find information about how to modify/troubleshoot project dependencies?
07:43mavbozoassuming you use leiningen: lein deps :tree
07:44jmnozbut if I want to modify the code in one of my dependencies?
07:47mavbozojmnoz: I misunderstood you, what kind of problem that makes you think that you have to change the code in you dependencies?
07:47mavbozo*your dependencies*?
07:48jmnozI am trying the lein-plugin figwheel on a windows machine and there seems to be some error with path names in that code.
07:49jmnozI would like to troubleshoot figwheel, should I clone the git repository and somehow point leiningen at my local files?
07:52mavbozojmnoz: yeah, I met that kind of path problem too. I did clone the lib repo and install it locally and modify it to find the problem.
07:52jmnozha! :)
07:54rritochjmnoz: Yes, clone the repository locally and make your changes, you can then use "lein install" to install them to your localrepo, you may also want to change the version number to an unreleased version so there's little risk of changes made by the maintainer overwriting your local deployment.
07:54jmnozexcellent, thanks
07:55mavbozojmnoz: there's a instruction to install lein plugin here https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md
07:55mavbozojmnoz: basically you just run lein install in your plugin project
07:55jmnozalright great, thanks folks.
07:56mavbozojmnoz: and creating .lein-classpath in your own project directory that contains path to the src directory of the above plugin
07:56dysfunjustin_smith: i'm wanting to integrate some full packet logging into groundhog, wondering if you had any thoughts
07:57dysfunwell, some content and timings anyway
07:59clgvwoah, building "pixie" requires quite some time.
07:59dysfunllvm :)
07:59clgvno pypy
08:00dysfunoh right. i was confusing it with the other one
08:00dysfunbut pypy is llvm, no?
08:01clgvnot that I know
08:02dysfunah, it's RPython
08:02dysfunwhich transpiles to c
08:19tbaldridgeYeah, the RPython translation process is one of the most advanced partial evaluators I've ever seen. That's why it takes so much time.
08:20tbaldridgeI've tried compiling a RPython program before that contained a lisp program as a string, it did so much partial evaluation, it didn't even build the compiler, it just read/compiled/ran the lisp program and emitted the output as a constant.
08:21Bronsasounds impressive
08:22clrndtbaldridge, wait, what?
08:24tbaldridgeclrnd: if the input to your reader/interpreter is a constant inside the interpreter, then that string's compiled output is a constant.
08:24tbaldridgeclrnd: so running something like this in RPython (defn -main [] (eval (read-string "42"))) gets compiled as int main () {return 42;}
08:25clrndI'm not sure what RPython is, but why does it know Lisp?
08:33jmglovI'm seeing the classic "Exception in thread "main" java.lang.NoClassDefFoundError: clojure/tools/logging/impl/LoggerFactory" error when aot compiling a project that depends on clojure.tools.logging.
08:33jmglovI figured I'd stop by and see if anyone has some insights to get me unstuck.
08:34jmglovI did some research, and found others having the issue, but I couldn't find any solutions out there.
08:35jmglovThis guy is using clojure.tools.logging and logback together, which is exactly my configuration: https://groups.google.com/forum/#!msg/datomic/6xWGFB-Dx68/_Hr2I4lv39gJ
08:46mnngfltgjmglov, does it work in a simple project (after `lein new`)? Maybe there's some interference with another package you're including.
08:47jmglovmnngfltg: It looks like this bug: http://dev.clojure.org/jira/browse/CLJ-1544
08:47jmglovThere's a minimal repro in this repo: https://github.com/arohner/clj-aot-repro
08:47sdegutisMost of the return values from my API (see https://github.com/sdegutis/clover) are in vectors because they act like tuples, but some of them are single values (like :404), so should those be in vectors for consistency, or just bare for simplicity and/or efficiency?
08:47mnngfltgjmglov, can you disable AOT?
08:48jmglovmnngfltg: Nope, because this library is being used by a Ring app that is deployed with "ring uberwar", which does some AOT compilation.
08:48jmglovI definitely stay away from AOT if I can. :)
08:49tbaldridgesdegutis: I'd convert everything into maps. Vectors/tuples imply meaning in the ordering. This makes programatic use of your api harder as you have to somehow express to the program(er) what each slot means.
08:49mnngfltgjmglov, too bad. Sorry I don't know nothing about the issue
08:49tbaldridgesdegutis: better explicit than implicit.
08:50jmglovmnngfltg: No worries. Do you know anything about how AOT works?
08:50mnngfltgknow :(
08:51mnngfltgno :(
08:51sdegutistbaldridge: One of the goals of my API is simplicity, so we return [:redirect "/"] because it's shorter and easier to type and remember than {:operation :redirect, :location "/"} or something similar.
08:51jmglovI'm seeing if I can hack around this by AOT compiling c.t.l, then rsyncing its target/ into my project's target.
08:51tbaldridgesdegutis: but it's not simple, what does slot 1 and slot 2 mean?
08:51tbaldridgesdegutis: if you pass me a map I know it instantly, I don't have to ask you
08:51sdegutistbaldridge: The ideal is that valid return value patterns would be easy enough for the programmer to remember, and in the cases where memory fails, there'll be a lookup table in the docs.
08:52tbaldridgesdegutis: the ideal is data that is self-expressing.
08:52sdegutistbaldridge: That's true, until you forget what the keys are (I've forgotten Ring's keywords many times).
08:52tbaldridgesdegutis: if I forget a english keyword name, how on earth am I going to remember what slot 1 is vs slot 2?
08:53tbaldridgewords are quite a bit easier to understand vs raw numbers
08:53sdegutistbaldridge: They should be obvious by reflecting the order of a function call, like [:redirect "/"] or [:404].
08:53sdegutisSo I'm wondering, should I indicate 404 by returning [:404] or just :404 ?
08:53sdegutisEverything else in my API uses [...] so far, so I'm leaning towards [:404] for consistency.
08:54tbaldridgesdegutis: well you often want a message with the error, bare error codes rarely are sufficient
08:54tbaldridgeespecially for 400 errors
08:54sdegutisWait, 404 error codes come with a message?
08:55sdegutistbaldridge: Do you mean the HTML of the page that a 404 error can return?
08:55sveriHi, what is the fastest way to integrate a simple storage engine with restart persistence for some key / values only, at best case it can be redistributed with the application and requires no extra setup on running the application
08:55tbaldridge400 = bad data, so when you send that error, it's often nice to say "400 - you didn't give a valid email address"
08:56sdegutisAh! Well then, that's a fine reason to use [:404] :)
08:56sdegutisThanks tbaldridge :)
08:56tbaldridgesdegutis: have fun with vectors once you start including extra headers, encoding options, etc, then the vector approach is going to fall apart.
08:57sdegutistbaldridge: Good point. I'll probably also allow maps as a fallback for more complex return values, but the goal is to avoid having more complex return values in the first place, or at least that they be very rare.
08:58sdegutistbaldridge: 99% of my web app's return values are simple and can be expressed either like [:404] or [:redirect "/cart"] or [:render {:user-name username}] or similar.
09:00jmglovUgh, that worked.
09:01Bronsasdegutis: kind of funny that the other day you were complaining about clojure libs being written by the authors ad-hoc to solve their problems and now you're desigining a lib based on your web app's needs
09:02sdegutisBronsa: I wasn't complaining, I was stating the facts :)
09:02jmglovI cloned git@github.com:clojure/tools.logging.git, added ":aot :all" to the project.clj, did a "lein compile", then copied tools.logging/target to my project dir. Then a "lein compile" of my project worked.
09:02tbaldridgesdegutis: that's kindof my point though, you can express that as {:status :redirect :url "/cart"} and then you won't have to make your framework accept vectors or maps. Having conditional logic like that is kindof a code-smell
09:02Bronsayour opinions, not facts
09:02sdegutisBronsa: Okay :)
09:02tbaldridgeand when you're starting your framework design with code-smells, that's also a code-smell.
09:02jmglovI'll drop that into the bug report, just to help out poor souls like me.
09:02tbaldridgethat's what I'm reacting against here.
09:02jmglovBut I don't like it, no sir!
09:03sdegutistbaldridge: I would have (strongly) agreed with you a year or two ago on that.
09:04sdegutistbaldridge: But I am beginning to disagree with the principles that I held strongly as I came into the Clojure community (which also holds them strongly).
09:04Bronsajmglov: don't open a ticket on tools.logging's jira, your bug doesn't seem like a bug there at all
09:05sdegutistbaldridge: Now it seems very reasonable to me to provide shortcuts where they make good sense. However, I do think that determining if it makes good sense requires a bit of time working *without* said shortcuts to get to know the problem domain very intimately first.
09:06jmglovBronsa: Sorry, I was talking about the Clojure bug I linked previously: http://dev.clojure.org/jira/browse/CLJ-1544
09:06Bronsajmglov: ah ok, sorry
09:06jmglovYou are certainly right that the bug has nothing to do with tools.logging.
09:06jmglovIt's just a crazy compile-order issue with AOT in the Clojure compiler, best I can tell.
09:07jmglovBut hey! I learned something new in the last 3 hours of troubleshooting this. :)
09:08Bronsaunfortunately there are quite a bunch of bugs related to aot compilation
09:09Bronsamost of them are related to what I believe is a wrong classloader setup by the compiler but I never investigated this
09:09jmglovInteresting.
09:10jmglovI'm certainly going to read the commit that fixes the bug.
09:10sdegutisSpeaking of which, every time I add :main to "project.clj", I get some weird error when doing `lein ubarjar` talking about AOT or whatever. When will that go away? I'm using the latest lein (2.5.0).
09:10jmglovsdegutis: You actually need to add an :aot directive for that namespace.
09:10jmglovLemme find an example...
09:10Bronsajmglov: best of luck waiting for that commit
09:11sdegutisOh.
09:11sdegutisIs using :main & :aot the recommended way to give a `lein uberjar` file a 'main' function to run?
09:12jmglovAh yes: (defproject "foo" "0.1", :main foo.core, :aot [foo.core]}
09:12jmglovsdegutis: Yes, AFAIK.
09:13jmglovAt least, that's what my Googling seemed to indicate a few months back when I was trying to figure out how to get rid of that warning. :)
09:13sdegutis:)
09:19clgvtbaldridge: so it did finish meanwhile. note to myself recompile during meetings ;)
09:20clgvtbaldridge: does pixie have exploratory functions to find out what functions/macros are defined=
09:26sdegutisAnyone interested in working with me to port http://slim-lang.com/ to Clojure?
09:26sdegutisI found a good name for it: https://github.com/sdegutis/slim-cljm
09:32mearnshhalf the work done then
09:40eglisdegutis: I don't see what slim could give you over hiccup
09:41sdegutisegli: inline Markdown
09:41eglihiccup has actual data structs
09:41eglislim has indenting and weird conventions
09:42eglican't you have inline md in hiccup?
09:42egliin the sense of [:h1 (markdown "**foo**)]
09:42sdegutisegli: Sure, if you want to put the entire thing inside a giant string. Not very pretty when it's multi-line.
09:43sdegutisegli: Our website's "/legal" page is mostly Markdown, and it's incredibly awkward to have expressed it in Hiccup.
09:43egliaren't there md->html->hiccup converters?
09:44sdegutisUhh...
09:44sdegutisWhat would that look like?
09:45Frozenlockthis? https://github.com/chameco/Hitman
09:45eglisdegutis: feed in md out comes html pipe it through another converter and you get hiccup
09:45FrozenlockOr even this https://github.com/theJohnnyBrown/endophile
09:46sdegutisInstaparse is awesome.
09:47FrozenlockI should start a project to play with it.
09:47FrozenlockI heard all kind of praises for instaparse.
09:49sdegutisAnyway that still doesn't address the problem I want to solve, which is to write inline Markdown.
09:49luxbockthere's now Instaparse for ClojureScript as well
09:49Frozenlocko_O
09:49luxbockhttps://github.com/lbradstreet/instaparse-cljs
09:51Frozenlocksdegutis: you want to write markdown into a clj file? (as opposed to slurp it)
09:51sdegutisNo, I want to write it into my Slim file.
09:51sdegutisIt gets tedious after a while to write all sorts of double-quotes everywhere just because you want to write raw (or interpreted) content.
09:52sdegutisThat's why http://slim-lang.com/ is so appealing to me.
09:54TEttingerhuh, I hadn't seen https://codeclimate.com/ before
10:05sveriwhat happened to lighttable, no more menus in 0.7.1?
10:11tbaldridgethat's one reason I moved away from LT, each version seemed to remove more of the GUI.
10:11sdegutisIt's the evolution of Emacs, so its destiny is to have no GUI.
10:11Frozenlocksdegutis: really? Emacs seems to be its ultimate form. :-p
10:12teslanickLightTable: This Isn't Even My Final Form
10:12Frozenlockteslanick: that's what emacs tell me each time I open my .emacs file.
10:12Frozenlock*tells
10:13daniel_nick
10:13mavbozotbaldridge: what do you use as LT replacement?
10:14tbaldridgeI've tried LT a few times, used to use emacs, now I use Cursive 100% of the time
10:14sdegutisIs there a lazier way to specify (-> 3 foo bar quux)?
10:15sdegutisEr sorry, #(-> % foo bar quux), in other words, a function.
10:15Bronsawhat do you mean by lazier
10:15sdegutis(= (-> 3 inc inc) ((comp inc inc) 3))
10:15sdegutis,(= (-> 3 inc inc) ((comp inc inc) 3))
10:15clojurebottrue
10:15sdegutisAh, comp is like -> then?
10:15Bronsano
10:16Bronsa,((comp inc -) 2)
10:16clojurebot-1
10:16Bronsa,(-> 2 inc -)
10:16clojurebot-3
10:16sdegutis,(= (-> 3 inc -) ((comp - inc) 3))
10:16clojurebottrue
10:16sdegutisAh, they're backwards.
10:16sdegutisGood!
10:17Bronsareverse order, also comp is a function that returns a function, -> is a macro that does lexical transformation
10:18Bronsaso (comp foo bar) ~= #(-> % bar foo)
10:18Bronsait's actually #(->> %& (apply bar) foo)
10:19sdegutisOh, also -> calls the function immediately with args, comp does't.
10:19sdegutisSo (-> 3 (foo)) turns into ((comp #(foo %)) 3)
10:19sdegutisYikes.
10:19Bronsa,(macroexpand-1 '(-> 3 (foo)))
10:19clojurebot(foo 3)
10:20sdegutisRight.
10:20sdegutisFrozenlock: lol
10:20clojurebotExcuse me?
10:20mavbozo`,%&
10:20clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: %& in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:20Bronsamavbozo`: it's #() syntax
10:20Bronsa,(#(vec %&) 1 2 3 4)
10:20clojurebot[1 2 3 4]
10:21Bronsa,(#(vec % %&) 1 2 3 4)
10:21clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/vec>
10:21Bronsa,(#(vector % %&) 1 2 3 4)
10:21clojurebot[1 (2 3 4)]
10:21Bronsa,(#(vector %1 %2 %&) 1 2 3 4)
10:21clojurebot[1 2 (3 4)]
10:21Bronsamavbozo`: %& is & foo for the #() fn literal
10:22mavbozo`(inc Bronsa )
10:22lazybot⇒ 2
10:23Bronsamavbozo`: no space before the paren ;)
10:23sdegutisI'm trying to turn a bunch of (-> routes (wrap-reload) (wrap-cookies) ...) into a function that can take a routes later.
10:23sdegutisThe only solution I came up with was to put # around it and replace routes with %
10:23Bronsasdegutis: what's wrong with that?
10:23sdegutisIt's just not as pretty I guess.
10:24sveriI use cursive myself, but I like the instant of LT and therefor use it for this from time to time
10:24mavbozo`(inc Bronsa)
10:24lazybot⇒ 73
10:25Bronsasdegutis: I dislike #() and % myself, but they are handy. I worked around this by prettifying them via font-lock
10:25sdegutisI meant pretty in a different way.
10:26agarmanƒ(... ) is nice looking
10:26luxbockBronsa: what do you use for that? pretty-mode?
10:26Bronsai.e. this is how I see #(-> foo % bar) http://i.imgur.com/mk3nv65.png
10:27Bronsaluxbock: no https://github.com/Bronsa/.emacs.d/blob/master/config/hooks.el#L11-L31
10:27andrewhrthe sad thing about Cursive it’s the buggy experience of IntelliJ’s Ideavim
10:29luxbockBronsa: thanks, I'll these out
10:32otfromanyone here at the conj?
10:33hyPiRionyess
10:33clgvhyPiRion: did the talks start, yet?
10:33clgvhyPiRion: where is the live stream? ;)
10:33tbaldridgeclgv: no live stream, but they said they're doing "same day upload"
10:34hyPiRionidk if there's a live stream, but yes, we've been through two
10:35andrewhrtbaldridge: nice to know! :)
10:35tbaldridgehttps://twitter.com/clojure_conj/status/535087288725012480
10:36tbaldridgeThat's the official tweet, and a link to the YT account
10:36FrozenlockSame day upload? That's amazing!
10:37tbaldridgethey pulled it off at Clojure/West, I think my talk was online 4 hours after I gave it
10:37tbaldridgeFrozenlock: most of that was due to InfoQ from what I understand, they delay things like crazy
10:38FrozenlockAh, that would explain a lot...
10:38tbaldridgeI think their goal was a steady stream of talks year round, and they didn't want some sort of "here's 20 Clojure talks" thing either. So they'd interleave conference videos and then only release 2-3 videos a week.
10:39tbaldridgeI understand why they did that, but it's still a bad idea IMO.
10:39clgvtbaldridge: oh that'd be great
10:40clgvI am interest in th Tex+Clojure combination - I couldnt find its repository so far
10:43sdegutis,(:path (meta (defn ^{:method :get, :path "/foo/:bar"} get-foo-bar [] 3)))
10:43clojurebot"/foo/:bar"
10:43gfredericksdoes anybody know if I can get emails for all activity on a project on jira?
10:44Bronsagfredericks: you have to ping puredanger for that
10:44gfredericksoh
10:44Bronsagfredericks: I think ATM only project leads get emails on activity
10:45Bronsagfredericks: maybe andyf can do that too, not really sure
10:45clgvgfredericks: test.check?
10:47gfredericksyeah
10:47dogonthehorizonGreetings all, I'm attempting to call java.nio.file.Paths/get in my code with a string argument but the REPL is using the URI variant of the function instead... any idea on how I can force it to use the string variant instead?
10:48clgvgfredericks: oh, it has a new release :)
10:48gfredericksoh cool
10:50clgvshrinking shuffle :)
10:50luxbockBronsa: now my clj files do indeed look a lot prettier
10:51luxbockI added a font-lock-builtin-face for the lambda character as well
10:52Bronsaluxbock: nice
10:53justin_smithdysfun: cool
10:54Bronsa... hudson won't cut releases again
10:54Bronsathis is so annoying
10:57justin_smithdysfun: care to elaborate? the reference to packets seems abit odd since it is inside ring and all...
10:57boyscaredgood conj so far
10:59andyfgfredericks: I don?t know how to set it up for you to get all updates for a whole project
10:59andyfproject leads do, but not sure if that is possible, or how, for others.
11:00daniel_is there a live feed of the conj?
11:00boyscaredno
11:00BronsaI'm so done with hudson
11:00boyscaredthe vids should be on clojuretv shortly after concluding though
11:01daniel_cool
11:03simpleirc1hi why people choose clojure over cl?
11:03clgvsimpleirc1: jvm nad its million libraries
11:03gfredericksandyf: computers are hard
11:03clgv*and
11:04mavbozo``simpleirc1: awesome community
11:04daniel_simpleirc1: its not so fringe
11:04tbaldridgesimpleirc1: also, the JVM GC and JIT are top notch, really hard to beat for the "normal" use cases of Clojure.
11:05clgvmavbozo``: sell the "someone else has done the basic tasks for a lot of domains already" first ;)
11:05andyfsimpleirc1: Some people have found that they really like data that is immutable by default, with explicit places you can say 'this is mutable'.
11:05andyfCL tends to be mutable by default
11:05BronsaI guess I won't cut a t.a release today
11:05SagiCZ1tbaldridge: its actually super easy to write a code that holds on references thus causing memory leaks in clojure..
11:06dysfunjustin_smith: packets wasn't what i actually meant. i meant to record the timings of data coming in and out to provide an idea of how long bits of response take to happen and can be analysed later in aggregate
11:06tbaldridgeSagiCZ1: that's easy in any language with lazy constructs
11:06tbaldridgeEver since I started using transducers problems like that completely disappeared for me.
11:06SagiCZ1i gues.. it usually didnt happen to me in java
11:06tbaldridgeSagiCZ1: how often did you use lazy seqs i Java? ;-)
11:06BronsaSagiCZ1: java doesn't have lazy-seqs
11:07SagiCZ1i know i know... i was trying to say i didnt use any languages with lazy constructs before
11:07tbaldridgeFun fact, Rich used to write Common Lisp: http://foil.sourceforge.net/
11:07mavbozohttp://cdn.cognitect.com/stateofclojure/2014/clj-general.txt
11:07mavbozofrom the latest clojure survey
11:08clgvSagiCZ1: holding on to the wrong reference is pretty usual in java before someone takes the time and hunts those down ;)
11:08justin_smithdysfun: aha, I have something like that as its own middleware, one moment
11:08andyfsimpleirc1: Search for "Clojure for Lisp programmers" on YouTube for a talk by Rich on some of the design goals of Clojure that were different from CL, by choice.
11:08tbaldridgebut from what I've heard, Haskell has the same problems. The entire language is lazy, so sometimes you "blow the heap"
11:09justin_smith$google clojure for lisp programmers youtube hickey
11:09lazybot[Clojure for Lisp Programmers Part 1 - Rich Hickey - YouTube] http://www.youtube.com/watch?v=cPNkH-7PRTk
11:09justin_smithit was worth a shot :)
11:09Bronsatbaldridge: does pixie have "proper" lazy-seqs or only sequence+transduce style lazy-seqs?
11:11clgvtechnomancy: currently the fibonacci on pixie doesnt seem to beat a non-optimized clojure one, though I couldn't really time it, since I have no idea how to get timestamps in pixie ;)
11:12TEttingerclgv: did you mean that for tbaldridge?
11:12daniel_whats pixie
11:12Glenjamin$google pixie lisp
11:12lazybot[pixie-lang/pixie · GitHub] https://github.com/pixie-lang/pixie
11:12TEttingerdaniel_: clojure-inspired lisp running on the same kind of VM as PyPy
11:12clgvTEttinger: no technomancy was asking the hard question how the performance of the fibonacci function is on pixie ;)
11:13Glenjaminwhich reminds me, i should take another crack at getting pixie to build
11:13clgvthat got me curious as well. but I guess there are no optimizations for that yet ;)
11:14clgvGlenjamin: current master built just fine some hours ago - you need libuv-dev and libffi-dev though
11:14Glenjaminyeah, pkgconfig on os x is annoying
11:14Glenjamincombined with me not really knowing how it works
11:15clgvGlenjamin: on debian-based OS it is just an "apt-get install" away ;)
11:15Glenjamini think i have ffi and uv installed now, just need the makefile to find them
11:15clgvyou can take a coffee or two during build :D
11:16Glenjaminseems to be going using the notes on https://github.com/pixie-lang/pixie/issues/49
11:17Glenjaminwarnings are ruining the nice picture
11:17tbaldridgeGlenjamin: yeah, the warnings are being fixed.
11:17clgvhehe. it's a pixie, I guess? the warnings ruined it here as well
11:18tbaldridgeAnd I'd be more than happy to help people build and install pixie, but sadly I'm working today. Will be on 20% time tomorrow, so I'll hang out here as well as in #pixie-lang
11:18Glenjaminoutput like this sounds like made-up tech they use on movies:
11:18clgvtbaldridge: did someone spend hours on the ascii image progressbar or is that generated from an image?
11:18Glenjamin[jitcodewriter:info] there are 988 JitCode instances.
11:18tbaldridgeclgv: it's a mandelbrot fractal
11:19clgvtbaldridge: oh interesting. do I find its parameters in the pixie repository?
11:19SagiCZ1does average clojure newbie need to learn about transducers or is it some super hard core niche thing i would use once in ten projects?
11:19tbaldridgeclgv: actually that's part of the RPython compiler framework, it does it on its own.
11:19clgvSagiCZ1: I'd say, not immediately
11:19FrozenlockI never looked at transducers. Shameful, I know...
11:19clgvtbaldridge: ah ok
11:19sdegutis,(namespace *ns*)
11:19clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Namespace cannot be cast to clojure.lang.Named>
11:20Bronsa,(ns-name *ns*)
11:20clojurebotsandbox
11:20clgvSagiCZ1: actually as newbie hold on to stable clojure which does not contain transducers ;)
11:20tbaldridgeSagiCZ1: IDK, I mean we got along for years without them, but these days I think transducers should be taught before lazy seqs.
11:20SagiCZ1what is stable clojure? or why is clojure with transducers unstable?
11:20tbaldridgeonce they're stable, there's still a few bugs in transducers.
11:20hiredmantbaldridge: a feature which isn't in a released version yet?
11:20Glenjamindo you think they should be taught under the "transducers" banner, or just as "here's how to combine a bunch of operations" ?
11:20TEttinger1.7.0 is the transducer release
11:21TEttingerit's in alpha
11:21SagiCZ1oh i see
11:21clgvtbaldridge: really, we didn't really explain that those sequence functions are lazy at all in the first lectures to not confuse the students which knew only Java
11:22tbaldridgeI guess my point is, why would I ever want lazy-seq map, when I have transducer's map? Transducers give you most of the power of lazy seqs without some of the drawbacks.
11:23sdegutistbaldridge: Which drawbacks?
11:23tbaldridgeThere's no reason to teach features in the order they were released.
11:23Frozenlocktbaldridge: do you have a link to a further explanation for this?
11:25luxbocktbaldridge: are you working on any videos about transducers? I subscribed to your pivotshare site
11:25luxbockfor the core.async videos, but now I'm kind of wondering how much of that stuff is going to be outdated with the addition of transducers
11:26Glenjaminoo, RPython now appears to be generating C code
11:27clgvtbaldridge: true, but if you introduce students to a completely different paradigm of programming. most try to not to overwhelm then
11:27tbaldridgeluxbock: yes there are 3 transducer videos, more to come later this week
11:27clgvtbaldridge: e.g hey that's a function that applies a given function to all elements of the given list
11:27Glenjaminyou could teach ##((map inc) [ 1 2 3 ]) instead of the seq version
11:27lazybot⇒ #<core$map$fn__4338$fn__4339 clojure.core$map$fn__4338$fn__4339@45acd1f6>
11:28Glenjamin&*clojure-version*
11:28lazybot⇒ {:major 1, :minor 7, :incremental 0, :qualifier "alpha1"}
11:28tbaldridgeclgv: and then you spend the rest of the day explaining how bindings don't work right, how you can't read from a file with them, etc.
11:28BronsaGlenjamin: that's not how transducers work
11:28Glenjamin:s
11:28justin_smithGlenjamin: I assume you want to call sequence?
11:28Glenjaminoh right
11:28Glenjaminduh
11:28clgvtbaldridge: not really. reading files is for later anyway
11:29luxbocktbaldridge: ah nice, I hadn't realized they were out already. I sent a request to pivotshare to add RSS feeds as a feature but so far they haven't added it
11:29Glenjamin&(sequence (map inc) [ 1 2 3 ])
11:29lazybot⇒ (2 3 4)
11:30mavbozoisn't How to Design Programs book a good and tested method on teaching students without overwhelming them?
11:30clgvmavbozo: havent heard of it thus far
11:31tbaldridgeGlenjamin: clgv: the way walked through it in my videos is to start with eager map and filter. Then extract the conj, then integrate it with a loop, now name that loop reduce, etc. One step at a time.
11:31tbaldridgeTeach the rationale, not the public APIs, at least that's how I like to go about it.
11:31mavbozoclgv: some consider it a improvement over SICP
11:31clgvtbaldridge: sounds good. I did not refer to your videos since I don't know them ;)
11:32zakwilsonIs there a clojure library with a macro providing functionality similar to and and or, but catching exceptions and treating them as false?
11:33sdegutiszakwilson: Not that I know of, I'm not sure I see the benefit to that.
11:33clgvzakwilson: easy write-up - you can just modify the source of `and` and `or`
11:34zakwilsonYeah, I have no doubt I could write it. I was more wondering how popular the idea was.
11:34clgvzakwilson: wrap "(try ~x (catch Exception e false))" around "~x"
11:35clgvah probably "nil" is better as return
11:35justin_smithI could see that leading to really weird bugs if you did not specify which exceptions you catch
11:36justin_smithI can't tell you how many times I have gone down a rabbit hole debugging because some lib was doing a try/catch/nil that one wouldn't expect...
11:36zakwilsonIt can't really do anything that you couldn't do with try/catch, but it seems like it might be clearer in some situations.
11:36justin_smithzakwilson: point being it makes the bad behavior easier
11:36justin_smithcatching all exceptions and returning nil is already a problem
11:37justin_smiththis is a functional language, your try/catch can easily be wrapping *my* code
11:37gfredericksdoes anybody regularly make use of a "sample" function that returns a random sample of a sequence w/o holding the head?
11:37clgvjustin_smith: yeah that's the huge disadvantage
11:38Glenjamindatapoint: "something_flaky rescue nil" is relatively common in short ruby scripts
11:38Glenjamindunno if that's for or against
11:38zakwilsonjustin_smith: yeah, I can see that, though I was just recently dealing with a library in Python that was too far the other way. It returns an object that may or may not have a certain attribute, which should contain a dictionary that may or may not have a certain key.
11:41zakwilsonIt ends up being that it needs to be wrapped in a try/catch or a bunch of really ugly calls to getattr. It would be less problematic in idiomatic Clojure.
11:41justin_smithzakwilson: we already have error-free nil returning property lookup (via get or some->)
11:42tslockeIs there a core function equivalent to (fn [col] [(map first col) (map second col)]) ?
11:42justin_smith,(some-> [1] .length)
11:43clojurebot1
11:43justin_smith,(some-> nil .length)
11:43clojurebotnil
11:43tbaldridgetslocke: try juxt !!!
11:43clgvzakwilson: isn't duck typing common in python?
11:43Bronsatslocke: (juxt keys vals)?
11:43justin_smithtslocke: (map (juxt first second) coll)
11:43Glenjamin~juxt
11:43clojurebotjuxt is a little hard to grok but it's the best thing ever
11:43tbaldridge, ((juxt first second) [[1 2] [3 4]])
11:43tslockety all
11:43clojurebot[[1 2] [3 4]]
11:44justin_smithtbaldridge: you may want a map in there :)
11:44tbaldridgeum, no, bad example
11:44tbaldridgelol yeah
11:44Bronsajustin_smith: that doesn't work the way he asked
11:44justin_smithno?
11:44clojurebotno is tufflax: there was a question somewhere in there, the answer
11:44tbaldridgetslocke: congrats, you just found a use case for everyone's favorite function
11:45justin_smithBronsa: oh, right
11:45Bronsa((juxt keys vals) {1 2 3 4}) vs (map (juxt key val) {1 2 3 4})
11:45justin_smithtslocke: Bronsa's right, that's not the answer
11:46tslocke,(map (juxt first second) ‘[[a 1] [b 2] [c 3]])
11:46clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ‘ in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:46tslockelol
11:46Bronsawut
11:46justin_smithtslocke: yeah, that acts as identity
11:46justin_smithBronsa: smartquote
11:46tslocke,(map (juxt first second) `[[a 1] [b 2] [c 3]])
11:46clojurebot([sandbox/a 1] [sandbox/b 2] [sandbox/c 3])
11:47Bronsa,(= \‘ \')
11:47clojurebotfalse
11:47zakwilsonclgv: yes, but it doesn't help here. If you have an object that supports the expected properties and methods, you can use it in place of another, but my problem involved an object that may or may not have the right properties, despite being the same type.
11:47Glenjaminyou want the opposite of zip i guess
11:47EvanRhow do i implement a protocol for the data structure "map"
11:47Bronsafucking unicode
11:47GlenjaminEvanR: IAssociative perhaps
11:47BronsaEvanR: extend the protocol to IPersistentMap
11:47BronsaGlenjamin: there's no IAssociative, there's a c.l.Associative
11:48Glenjaminbah, i'm rubbish at remembering the interface names
11:48EvanRi dont think you can implement protocols for interfaces?
11:48BronsaEvanR: yeah you can
11:48justin_smithEvanR: why wouldn't you?
11:48EvanRis that new?
11:48BronsaEvanR: nope, always been teh case
11:48justin_smithEvanR: that's the point of protocols isn't it
11:48Glenjamini was under the impression you only implement for interfaces
11:48zakwilsonjustin_smith: property lookups of various types are probably the most common use case for error-free-or, and since those are typically error-free anyway....
11:48Bronsabtw this is one of my main issues with protocols. in cljs those interfaces are protocols
11:49Glenjamindefprotocol generates an interface
11:49Bronsaand you can't extend protocols to protocols
11:49Bronsaso doing that in clojurescript means extending a protocol to all the concrete types
11:49Bronsawhich.. should be implementation details
11:49BronsaI would love if clojure had the concept of a "supertype"
11:49EvanRill try
11:50Bronsai.e. PAM, PHM & co would be PersistentMaps & extending a protocol to persistentmap would extend that for every type registered as a PersistentMap
11:54EvanRso i can implement a protocol for java classes, java interfaces, types
11:54EvanRbut i cant implement java interfaces for any of these right
11:55Bronsayou can implement java interfaces for deftypes, you just can't extend an existing class to a java interface
11:55EvanRhow does that look
11:55Bronsa(deftype foo [] Interface (method [arg
11:55Bronsa] body))
11:56EvanRok
11:56tslockefwiw
11:56tslocke,(reduce #(map conj %1 %2) [[] []] [[:a 1] [:b 2]])
11:56clojurebot([:a :b] [1 2])
11:57tslockeKinda ugly though
11:57tslockeI think transducers would be the way to go but not got them at my fingertips yet
11:57justin_smithtslocke: not ugly to me, but maybe I have reduce-stockholm-syndrome
11:57EvanRcant resolve IPersistentMap
11:57BronsaEvanR: clojure.lang.IPersistentMap
11:57justin_smithEvanR: clojure.lang.
11:58EvanRwhats the interface for "set"
11:58BronsaIPersistentSet
11:58justin_smith,(clojure.string/join \space (supers (class #{})))
11:58clojurebot"interface clojure.lang.IEditableCollection interface java.lang.Runnable interface clojure.lang.IFn class clojure.lang.APersistentSet interface java.io.Serializable interface clojure.lang.IHashEq interface java.util.Collection interface clojure.lang.IObj interface clojure.lang.IMeta interface clojure.lang.IPersistentCollection class java.lang.Object interface java.util.concurrent.Callable interfac...
11:59justin_smithfor some reason IPersistentSet is near the bottom there...
12:00justin_smith$(clojure.string/join \space (supers (class #{})))
12:00justin_smith&(clojure.string/join \space (supers (class #{})))
12:00lazybot⇒ "interface clojure.lang.IHashEq interface java.io.Serializable interface clojure.lang.IEditableCollection interface java.util.Set interface java.lang.Runnable class clojure.lang.APersistentSet interface java.util.concurrent.Callable interface java.lang.Iterable inter... https://www.refheap.com/93685
12:03KnightsWhoSayNi:q
12:03KnightsWhoSayNiblergh
12:04clgvNi! Ni! Ni!
12:05EvanR,((symbol ":a") {:a 2})
12:05clojurebotnil
12:05EvanR,((symbol "a") {:a 2})
12:05clojurebotnil
12:05EvanRwhats the big idear
12:06Bronsa:a is not a symbol
12:06Bronsait's a keyword
12:06EvanRoh
12:07bcmHmm, why test.check?
12:09gfredericksbcm: you're asking why it exists?
12:10justin_smith,((keyword "a") {:a 2}) ; EvanR
12:10clojurebot2
12:11EvanRyes, and i finally got it to work after saving my file and reloading my source files several times
12:11clgvEvanR: you can explore types via ##(type :a)
12:11lazybot⇒ clojure.lang.Keyword
12:11EvanR##?
12:12justin_smithEvanR: inline syntax for lazybot
12:12EvanRyes i got type
12:13kenrestivo,phm is persistent hash maps
12:13clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: phm in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:13kenrestivo~phm is persistent hash maps
12:13clojurebotAlles klar
12:15clgvphm?
12:15clojurebotphm is persistent hash maps
12:15clgvclojurebot: botsnack
12:15clojurebotthanks; that was delicious. (nom nom nom)
12:15clgvyou have to reinforce it ;)
12:27marchdownHello there. I’ve a couple of questions about lazy sequences. First, how do I take a difference of two lazy sequences, second, where do I chant appropriate incantations to get bignums in the following example: https://gist.github.com/marchdown/d89c273506f120c9f7ba
12:29marchdownI mean, is there a canonical difference function, or do I have to inspect two lazy sequences element-by-element and discard some by hand?
12:29dnolen_marchdown: use +' for auto promotion, no canonical difference function, you probably need to do something by hand
12:29marchdownThanks.
12:30marchdownYep, that works.
12:30dnolen_marchdown: you do have clojure.data/diff, never tried it w/ lazy seqs
12:31marchdownWhat should I read up on once I begin to care about performance? As in timing and profiling tools?
12:32Bronsamarchdown: https://github.com/hugoduncan/criterium
12:32justin_smithstandard java profilers work
12:32justin_smithor criterium for microbenchmarks, yeah
12:32marchdownThanks.
12:33tbaldridgemarchdown: the two rules are a) only benchmark after the code is warm (see criterium for help) b) don't profile inside lein, it does crazy stuff to the JVM to help with development.
12:33tbaldridgesometimes at the cost of runtime performance.
12:34clgvit should be safe to profile within "lein" when your profile.clj replaces the default jvm args lein sets
12:34clgvbtw. recent versions of criterium warn when that is not the case
12:34tbaldridgeprobably, but I don't like to risk it. I just compile via uberjar and then do java -jar.
12:35technomancylein with-profile production run ...
12:35marchdownregarding lein, how do I grow past single core.clj source file? Simply adding (ns foo.core (:require foo.bar)) is not enough to call quux defined in bar.clj
12:36technomancymarchdown: (:require [foo.bar :as bar])
12:36technomancybar/quux
12:36marchdownThanks!
12:37noonianor (:require [foo.bar :refer [quux]])
12:37tbaldridgetechnomancy: but what are the settings of with-profile production? That's the problem if I'm citing benchmark results it's easier to just use a jar and remove all doubt.
12:38TimMcmarchdown: Or your original :require, but then use foo.bar/quux
12:38technomancytbaldridge: production is an empty profile
12:38tbaldridgetechnomancy: that goes for any dev tool btw, not just lein
12:39technomancybut yeah, the closer to production the better
12:40technomancydon't profile on a mac if you're deploying on linux
12:40gfrederickshey I just succeeded in getting the phrase "test.chuck" onto a slide at clojure conj
12:44clgvgfredericks: you did a talk about test.check?
12:44clgvand snuck in the lovely chuck? ;)
12:45gfredericksno I'm not even there
12:45gfrederickssomebody mentioned test.chuck
12:45clgvah kk
13:21sdegutisSo far this API isn't looking different enough to be worthwhile: https://github.com/sdegutis/clover
13:25expezGiven a jar, how would I go about getting a list of all exported symbols?
13:26justin_smithexpez: you can open the jar as a zip file and look at the namespaces
13:26justin_smiththere is no specific "list of vars created in a jar"
13:26justin_smithexpez: or do you mean classes/
13:27expezjustin_smith: Vars, initially, but would like to do classes too. Visual inspection is not an option. I was thinking maybe I could ingest everything with tools.analyzer and query the ASTs or something
13:27justin_smithexpez: the problem is there is no manifest that lists all namespaces contained
13:28expezjust consume all .clj files?
13:28justin_smithnot to meantion dirty tricks that create a var without using top level def / defn
13:28justin_smithexpez: I guess you could hack that up with t.a.jvm yeah
13:29expezI was thinking an 'import symbol at point' operation would be nice for clj-refactor. it would then build a cache of symbols on the classpath and just import it if it's one or prompt you if several.
13:29justin_smithexpez: you keep saying symbol when you mean var
13:29expezBuilding ASTs are expensive, but you could cache that stuff
13:30expezmy bad, is java.util.Date. considered a var?
13:30justin_smithmaybe you are looking for some sort of compile time abstraction
13:30justin_smithbut it isn't a symbol, or a var
13:31justin_smithit's a reader macro that resolves to (new java.util.Date)
13:31expezthe thing at point might not even resolve to a var, right?
13:31justin_smithright
13:31Bronsawell it *is* a symbol justin_smith
13:31justin_smithBronsa: OK
13:32Bronsaalso it's not a reader macro
13:32justin_smithjust not one that can be read as such
13:32Bronsa,(read-string "foo.")
13:32clojurebotfoo.
13:32expezclojure.tools.analyzer.ast.query this looks like it might have some stuff, where you can build a db from ASTs and query it.
13:32Bronsajustin_smith: it can be read, the transformation happens at macroexpansion time not at read-time
13:32justin_smithBronsa: oh, thanks for clearing that up
13:33BronsaI have no idea what I'd call that though
13:33Bronsaa macroexpansion-time transformation
13:33Bronsaexpez: yeah, you need to depend on Datomic to use that though
13:34justin_smithexpez: I imagine namespaces like this could easily trip you up https://github.com/Prismatic/hiphip/blob/master/src/hiphip/double.clj
13:35expezDoes this seme doable, Bronsa? Just ingest every .clj file found on classpath with tools.analyzer to get a list of symbols to possibly import?
13:36technomancyexpez: are you familiar with slamhound?
13:36expezjustin_smith: it's just a helper function, if it works 90% of the time that's still cool.
13:36Bronsaexpez: I wasn't following the conversation, what are you trying to do?
13:36expeztechnomancy: I know what it is. Does it contain code I should pilfer?
13:37technomancyexpez: well, it does the same thing, basically, but with a dramatically simpler approach
13:37expezBronsa: user hits 'import symbol at point' and clj-refactor imports the symbol below the cursor, possibly with a prompt if it's ambiguous
13:37technomancy(all-ns) + (ns-publics n)
13:37technomancyafter loading all namespaces on the classpath
13:37technomancyyou don't need the analyzer for that
13:37technomancyprovided you're OK with compiling everything you find
13:38Bronsayou'd need to do that with t.a anyway
13:39expezman, didn't even know about all-ns. The docstring is a bit sparse, but the seq is of every ns on the classpath?
13:39justin_smithexpez: no, all the ones loaded already
13:40justin_smithand also, namespaces made by shady methods where the ns does not reflect an artifact in the classpath as well
13:40Shayanjmsomeone should make a cool clj dsl for working with these sets: http://opendata.cern.ch/
13:40Shayanjm:)
14:00kenrestivousing the clojure.tools.namespace.repl/refresh thing... it tries to compile test/ files and chokes on them. anyone else seeing that?
14:01kenrestivospecifically, it compiles test/foo/core_test.clj which has in it a (:require [foo.core :refer :all]), and can't find that namespace at wherever it is in the compilation at that point
14:08mi6x3mhey bbloom, did you by any chance find the reason for the issue yesterday?
14:08mi6x3mI thought I'd search for it this evening
14:14emacsnubdoes annotating your code w/ core.typed act as type inference?
14:14emacsnubact as type hinting
14:15clrndemacsnub, I'm sure core.typed use type inference, otherwise you'd need to type every sub-expression
14:18amalloyemacsnub: i would be quite surprised if it acted as typehinting
14:18emacsnubamalloy: clrnd: thanks!
14:19emacsnub:amalloy so it probably won't improve runtime performance, right
14:19amalloykenrestivo: test/ is on the classpath during dev, so if you attempt to reload everything on the classpath then test/ will be included
14:20amalloybut it should work fine, i would think, as long as the dependencies are declared properly and you don't do anything grossly side-effectful at the top level of your tests
14:20clrndcore.typed doesn't touch the runtime at all, afaik
14:21amalloyemacsnub: no, core.typed only acts at compile time; as far as i know, the bytecode generated for a function that's typed with core.typed will be identical if you remove the annotations
14:21emacsnuboh ok
14:22emacsnubthanks again
14:41gfredericksso I think something about autocompleting is causing my emacs to be really laggy while typing clojure code
14:41gfrederickssound familiar to anybody?
14:42gfrederickseven worse if I type a prefix of something quickly and then try to autocomplete it, it will likely autocomplete from a prefix of the prefix
14:42tbaldridgereason #42 why I stopped using emacs
14:42gfrederickswhat nobody STOPS using emacs
14:42jaaqoMy lagginess was about cider, cider-nrepl and company version mismatches
14:43BronsaI have never had lag with ac-slime
14:43technomancygfredericks: autocomplete.el?
14:43joshuafcolegfredericks: oh?
14:44joshuafcole:P
14:44technomancygfredericks: it's a pretty crap implementation from what I understand; the alternatives are a lot more stable.
14:44gfrederickstechnomancy: I see "AC" in my modeline; what does that suggest?
14:44technomancygfredericks: yeah, you probably want to ditch that
14:45jcsimsgfredericks: I switched from auto-complete to company awhile back, and it's treated me well
14:45technomancyI just use the built-in completion because I'm a luddite
14:47amalloyi use AC but not ac-slime. i heard bad things about ac-slime years ago
14:47Bronsaamalloy: ?
14:47gfredericksis there a good lein plugin for generating a Main class so you can have an arg-free executable jar but otherwise avoid AOT?
14:48TimMcgfredericks: There's a bad lein plugin.
14:48amalloyas i recall, the same thing gfredericks is saying. long pauses while typing because autocomplete is trying to find all possible completions
14:49gfredericksTimMc: what's the bad one?
14:49TEttingerhttps://github.com/llasram/lein-otf
14:50Bronsadunno, I never noticed any lag & type pretty fast
14:50TimMchttps://github.com/timmc/lein-otf is broken with lein 2.4.3 or 2.5.0 (I forget which I've tried), but it's really really easy to replicate in your own code.
14:51amalloyTimMc: why do this with a java loader class that reads the manifest, rather than injecting a clojure file like: (ns my.loader (:gen-class)) (defn -main [& args] (require 'real.main) (apply (ns-resolve 'real.main '-main) args))?
14:52amalloyi don't know how to do that in a lein plugin, but that's how i've produced non-aot runnable uberjars by hand
14:52gfredericksspeaking of which what's the right way to "inject" some clojure code as above which is intended to work when packaged up as well?
14:52EvanRwhy is the datomic pull api only getting some of the things nested past depth 3 (i know this is technically the wrong channel but if you know the answer to this ill be happy to hear the answer in #datomic)
14:52gfrederickswe were talking about util libs a while ago and the problem applies there too
14:53TimMcamalloy: I think I did, but it was pulled in from the dependency.
14:53TimMcI don't recall the tradeoffs of various injection strategies.
14:53amalloyTimMc: pulled in from the dependency?
14:54TimMcAs in, a clojure file was injected, but it still read from the manifest.
14:54TimMcI had to much with stuff in or near the manifest anyhow, IIRC.
14:55TimMcAnyway, I should just replace the readme with "Just make another nsthat requires your real ns and calls -main, okay?"
14:56gfredericksyou could call the namespace itself -main
14:56TimMcI.. could.
14:56gfredericksdon't judge me.
14:56amalloygfredericks: if i made suggestions as outrageous as yours i'd live in constant fear of the inquisition arriving on my doorstep
14:57gfrederickshey great I love questions
14:57amalloygfredericks: is your answer to this question a lie?
14:58dbaschamalloy: perhaps
14:58TimMcwhere's technomancy
14:58technomancyyou'll never catch me
14:59gfredericksamalloy_: I’m really happy for you, Imma let you finish but Beyonce had one of the best videos of all time
14:59TimMcGet back here! I need that "mu" character!
15:00technomancy(defun mu () (interactive) (insert "無"))
15:00TimMcgfredericks: "What is 2 + 2? (This is strictly a 3-or-5 question.)"
15:01dbaschTimMc: pancakes
15:01gfredericks,(bit-or 3 5)
15:01clojurebot7
15:01TimMchaha
15:02dbasch(inc gfredericks)
15:02lazybot⇒ 108
15:02TEttingerclojurebot: mu |is| 無
15:02clojurebotIn Ordnung
15:02TEttinger~mu
15:02clojurebotmu is 無
15:03TimMc~無
15:03clojurebotexcusez-moi
15:03TEttingerbetter, TimMc?
15:03TimMc*nod*
15:04TEttinger$google 無
15:04lazybot[無 - Wiktionary] http://en.wiktionary.org/wiki/%E7%84%A1
15:05TEttingerneither yes nor no, interesting
15:18bbloommi6x3m: iirc you were doing (foo a b c :x 1 :y 2 :z 3) positional arguments like that
15:18bbloomthat's not a map, and so won't be formatted as a map
15:18bbloomthere's no general way to tell keyword args from positional args
15:19bbloomso there's no general way to print them where key/value pairs stay on a line
15:19bbloomat best, you could use a heuristic
15:19danielcompton~karma amalloy
15:19clojurebotexcusez-moi
15:21bbloomclrnd: i tink emacsnub's intended question was: does using core.typed preclude the need to write clojure's type hints to the compiler for avoiding reflection and boxed math
15:21danielcomptonkarma amalloy
15:21danielcompton,karma amalloy
15:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: karma in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:21gfredericksis bbloom time-traveling again?
15:21justin_smithdanielcompton: $karma amalloy
15:21TimMcgfredericks: I COME... FROM THE PAST!
15:21danielcompton$karma amalloy
15:21lazybotamalloy has karma 197.
15:21justin_smith(identity amalloy)
15:21lazybotamalloy has karma 197.
15:21justin_smithor that :)
15:22danielcomptonwhew, I didn't miss the big 200
15:22gfredericksbbloom: how many fingers am I holding up?
15:22clrndbbloom, ooohhhhh, yeah probably
15:22bbloomamalloy: i'm not sure, but there may be variants of defn that accept annotations and do hinting, but i dunno
15:23shafirehello smart people
15:27bbloomgfredericks: can you hear me now?
15:27gfredericksbbloom: ACK
15:27bbloomgfredericks: i have no idea wtf is wrong
15:28bbloommaybe i was rate limited or something? .... i've set my irc client to join far fewer channels
15:28justin_smithbbloom: I've had that delay thing before. IRC is weird.
15:28bbloom*shrug*
15:28clrndlol
15:28gfredericksbbloom: does it apply across all freenode or just to #clojure?
15:29bbloomgfredericks: doesn't seem to affect private messages
15:29bbloomnot sure about other channels
15:29gfredericksaw snap
15:29bbloomit's kinda hard to find out b/c people may just ignore you heh
15:29bbloomi feel like i'm manually implementing TCP :-P
15:29gfredericksyeah and it's hard to guess on this end because you might just be having an unsurprisingly laggy IRC conversation
15:30gfredericksI didn't guess it till I saw two late replies back to back
15:30bbloomthat's why i was testing with the ghost_of_bbloom via a web irc client
15:30TEttingeryou could be missing out on show gratis spam! solo hoy!
15:30bbloomno, i'm not missing out on that at all lol
15:32justin_smithTEttinger: we should totally have a bot that a) changes nicks periodically b) spouts a small bit of markov generated clojure related gibberish periodically c) kickbans anyone that sends it a pm which matches our profile
15:33gfredericksd) kickbans random people periodically
15:33justin_smithsure, why not
15:34justin_smithgfredericks: but our spammer is predictable enough that false positives would be pretty easy to prevent - ie. repeatedly using the same text
15:34TimMcThis would require getting additional ops.
15:34TEttingeryes.
15:35MontananI'm staring at the core.async example, line 91 of https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj and wondering how we get out of the (while true ...) loop
15:35justin_smithMontanan: replace true with a different condition?
15:35TimMcI think if we should have two bots. One periodically says ~guards and the other inc's the first. If both get the same message from the same sender within 30 minutes of each other one kickbans the sender.
15:36TimMcThey'll blend right in.
15:36justin_smithhaha
15:36Montananmy question is, why does it leave the (while true ...) loop
15:36aperiodicMontanan: you don't. that's the magic of go blocks; when it's waiting for a new value from the channel, it stops executing that go block's state machine and frees the thread up to go do something else.
15:36justin_smithMontanan: does it ever leave?
15:36justin_smithaperiodic: that example is a thread, not a go block
15:37Montananwhoah, that's a trip. Thank you aperiodic
15:38aperiodicMontanan: and the thread keeps going because the `go` macro is asynchronous (the body gets executed in a different thread, I think) http://clojure.github.io/core.async/#clojure.core.async/go
15:38aperiodicjustin_smith: what? there's a go call right on that line.
15:38tbaldridgefirst conj vid: https://www.youtube.com/watch?v=BNkYYYyfF48&amp;feature=youtu.be
15:40nullptrtbaldridge: awesome, didn't realize these were posted so quickly -- thanks
15:40justin_smithaperiodic: what line?
15:40aperiodicjustin_smith: line 91, as Montanan said https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj#L91
15:40justin_smithaperiodic: oh, I did not see the line part, sorry
15:49Montananaperiodic: when the let block ends, is the thread or go block cleaned up?
15:54aperiodicMontanan: I'm not sure. I'm not that familiar with core.async. My guess would be no, since the thread actually executing the go block still has a reference to the channel and it's still open. I would think that the channel needs to be explicitly closed first, then the thread where the go block is executing will notice and release references to the channel & go block, and then after the channel is released on the calling/consuming side everything can be
15:55aperiodicMontanan: but like I said, I don't know much about core.async, so you should verify that somehow.
15:55justin_smithMontanan: what do you mean by "when the let blcok ends"
15:55justin_smithwhen all code inside it has stopped running?
15:57justin_smithobjects that don't have references outside a specific thread will be reclaimed sometime after that thread is reclaimed
15:57MontananThank you aperiodic. Yes justin_smith, when the main thread of execution leaves the let block
15:57justin_smithMontanan: main thread?
15:59justin_smithI mean if I use my definition of main thread, nothing inside a thread or go block is run in the main thread
16:01MontananI'm following, justin_smith, once outside the let block, there is no reference to the thread, and thereby it should be reclaimed later
16:02MontananI should be able to verify that in a debugger
16:03justin_smithMontanan: right, jvisualvm will show you all the threads that exist
16:03justin_smithit's much trickier in core.async
16:03tbaldridgeMontanan: os the gist is, the that everything gets reclaimed after the last reference to it is gone. For go blocks, when they pause they are attached to channels.
16:03justin_smithsince they use a thread pool, and have some implementation dependent definition of a go block that may be hard to recognize in a profiler or debugger
16:03tbaldridgeSo they live as long as the channels they are attached to.
16:04tbaldridgewith (thread...) blocks there is an actual OS thread running that block, and the OS keeps a pointer to that thread, so it never gets reclaimed.
16:04tbaldridgeuntil it exits that is.
16:05justin_smithtbaldridge: so the actual answer to Montanan 's earlier question was that he could stop the go block by closing the channels
16:05tbaldridgejustin_smith: well closing them will cause them to start returning nulls, which will cause that go block to loop forever.
16:06tbaldridgeif you just drop the reference to the channel, the go block will attach to it, then the channel will get reclaimed, and with it the go.
16:06justin_smithtbaldridge: oh, ok
16:06justin_smithtbaldridge: the interaction between gc and clojure constructs still confuses me sometimes, thanks for clearing that up
16:11MontananThank you tbaldridge, justin_smith.
16:12justin_smithMontanan: tbaldridge has some video tutorials for core.async
16:13MontananLooks like he gets some of my loot
16:22SagiCZ1do you have any idea what could be causing this?
16:22SagiCZ1NumberFormatException For input string: "198717588"
16:22SagiCZ1I mean, it looks pretty parsable to me..
16:22SagiCZ1,(Integer/parseInt "198717588")
16:22clojurebot#<NumberFormatException java.lang.NumberFormatException: For input string: "198717588">
16:22justin_smith&Integer/MAX_VALUE
16:22lazybot⇒ 2147483647
16:23SagiCZ1,(< 2147483647 198717588)
16:23clojurebotfalse
16:23justin_smith&(> Long/MAX_VALUE 198717588 Integer/MAX_VALUE)
16:23lazybot⇒ false
16:23justin_smithhrm
16:24tbaldridge,(< 2147483647 198717588N)
16:24clojurebotfalse
16:24justin_smith(Integer/parseInt "198717588")
16:24tbaldridgehrm...
16:24justin_smith&(Integer/parseInt "198717588")
16:24lazybot⇒ 198717588
16:24SagiCZ1,(Integer/parseInt "198717588")
16:24clojurebot#<NumberFormatException java.lang.NumberFormatException: For input string: "198717588">
16:24justin_smith,(map int "198717588")
16:24clojurebot(65279 49 57 56 55 ...)
16:24SagiCZ1what is this sorcerry
16:24justin_smiththere's your problem
16:24justin_smithunicode!
16:24amalloy(inc justin_smith)
16:24lazybot⇒ 138
16:24tbaldridgerofl
16:24SagiCZ1sorry im slow, could you elaborate?
16:24tbaldridgethat's awesome
16:25justin_smith,(char 65279)
16:25clojurebot\
16:25amalloySagiCZ1: that's not a 1, it's a different unicode character that renders the same as a 1
16:25amalloyor similarly, at least
16:25justin_smith,(char 49)
16:25clojurebot\1
16:25dbaschon my screen it renders like _1
16:25SagiCZ1isnt that nice
16:25justin_smithI think that may be a BOM hidden in the screen
16:25clojurebotPardon?
16:25kenrestivothat charactter renders as a \
16:25justin_smith,(str (char 65279))
16:25clojurebot""
16:25BronsaI see an small underscore
16:25dbaschsame as Bronsa
16:26Bronsashade
16:26amalloy&(printf "%x" 65279)
16:26lazybot⇒ feffnil
16:26amalloyyeah, that's a BOM
16:26Bronsahttp://i.imgur.com/xjjHK5V.png
16:26amalloyFEFF
16:26justin_smithZERO WIDTH NO-BREAK SPACE
16:26justin_smith old-name: BYTE ORDER MARK
16:26SagiCZ1,(Integer/parseInt "198717588")
16:26clojurebot#<NumberFormatException java.lang.NumberFormatException: For input string: "198717588">
16:27justin_smithSagiCZ1: it has hidden whitespace, so it isn't parsable
16:27SagiCZ1i am not sure what i can do about it.. its a string from a text file, can i trim it or something?
16:27justin_smith,(Integer/parseInt (sube "198717588" 1))
16:27clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sube in this context, compiling:(NO_SOURCE_PATH:0:0)>
16:27justin_smith,(Integer/parseInt (subs "198717588" 1))
16:27clojurebot198717588
16:27amalloySagiCZ1: probably, read the text file better so that it doesn't include the BOM
16:27justin_smitha regex that trims should handle it
16:28TimMcSagiCZ1: Stop using notepad?
16:28amalloyit's probably the first two bytes in the file, and when you specify the proper character encoding you should be able to read it just fine
16:28kenrestivoright, we've been around this block before here.
16:28SagiCZ1TimMc: its notepad++
16:29SagiCZ1amalloy: i was joining these files earlier, so im afraid the bom is actually in the middle of the new file
16:29kenrestivothe dreaded feff
16:29justin_smith,(Integer/parseInt (second (first (re-seq #"([0-9]+)" "198717588")))) ; SagiCZ1
16:29clojurebot198717588
16:29dbaschSagiCZ1: where do the files come from?
16:30TimMcBOM: Because no one would ever cat files together, ever.
16:30csd_I'm looking for code similar to Rich Hickey's ants.clj. Any suggestions?
16:30justin_smith,(Integer/parseInt (ffirst (re-seq #"([0-9]+)" "198717588"))) ; actually this is better
16:31clojurebot198717588
16:31SagiCZ1justin_smith: thank you very much.. but i still wonder how to fix the actual file.. notepad++ doesnt show any weird unprintable characters
16:31TimMcSagiCZ1: Notepad++ is probably adding it.
16:31SagiCZ1TimMc: i am not saving it though
16:31justin_smithSagiCZ1: you could slurp the file, and filter all characters that equal (char 0xfeff)
16:31SagiCZ1justin_smith: i could do that
16:31justin_smitherr, I mean remove of course
16:31SagiCZ1yeah sure
16:32justin_smithand then spit it back out again, of course
16:32TimMc.replaceAll
16:32justin_smitheven better
16:32SagiCZ1these files used to be in a really obscure encoding.. i think it was utf16 little endian.. i had a lot of trouble even decoding it.. but after that i spit it back with the default spit encoding so i dont know what went wrong
16:33TimMc&(first "198717588")
16:33lazybot⇒ \
16:33TimMc&(first (.replaceAll "198717588" "\ufeff" ""))
16:33lazybot⇒ \1
16:33SagiCZ1TimMc: this just baffles me honestly
16:34TimMcBOM is pretty baffling. :-(
16:34justin_smithBOM is also the name of a character in one of Samuel Beckett's weirdest plays
16:34SagiCZ1justin_smith: what a coincidence
16:34justin_smithheh
16:35justin_smithyeah, the play is pretty baffling too
16:35SagiCZ1zero width no break space.. who thought that would be a nice character to have?
16:35justin_smithhttp://en.wikipedia.org/wiki/What_Where
16:36justin_smithSagiCZ1: it's used as a marker. It should be metadata, but it is in the file.
16:36SagiCZ1i see
16:36justin_smith"The byte order mark (BOM) is a Unicode character used to signal the endianness (byte order) of a text file or stream."
16:36justin_smithhttp://en.wikipedia.org/wiki/Byte_order_mark
16:37SagiCZ1so feff is bom?
16:37justin_smithyes
16:37SagiCZ1but what is it doing in the middle of the file?
16:37justin_smithfeff is bom, and should only be at the beginning of a file
16:37justin_smithbecause someone fucked up, clearly
16:37SagiCZ1justin_smith: i did
16:37justin_smithwell, whatever tool was combining the files should not have left a bom in the middle
16:37csd_SagiCZ1: is this a Clojure exercise? why not just use a hex editor to remove it
16:38SagiCZ1when i was reading and writing the new tweaked files i used write and getBytes.. actually its a little snippet you wrote for me.. i think it wrote the bom too
16:38SagiCZ1csd_: its not an exercice and i would totally do it manually if there wasnt 100GB of those files
16:38justin_smithyeah, getBytes and write would let you do something like that :)
16:38csd_oh its more than one?
16:39SagiCZ1justin_smith: at least i know how it happened..
16:39Guest70412Does anyone know if it is possible to call a function in a namespace in a lein project.clj? I'm trying to call a function to return a generated version number to use in the defproject.
16:40TimMcjustin_smith: It's not exactly SagiCZ1's fault.
16:40Guest70412I can write simple functions at the top of the project.clj but was unable to call into another namespace or add the ns macro to the top of the project.clj
16:40justin_smithTimMc: well, he used byte oriented methods for textual data. I put it a bit harshly, and for that I apologize.
16:41justin_smithsorry SagiCZ1
16:41hyPiRionGuest70412: You can do (require '[my-namespace :as my-ns]) then (my-ns/my-function ...) if the namespace is on the classpath
16:41Guest70412I guess there is a bootstrap problem
16:41TimMcjustin_smith: I feel like a lot of text-oriented tools screw this up too.
16:41TimMcIt's just a bad situation.
16:41justin_smithyeah
16:41SagiCZ1justin_smith: no problem, i didnt see the harsh tone, language barrier i guess :)
16:41Guest70412thanks @hyPiRion
16:42hyPiRionGuest70412: But it sounds like a bad idea to use functions outside of core clojure, at least that's my gut feeling
16:43justin_smithGuest70412: maybe what you really want is to write your own lein plugin and run it?
16:43Guest70412hyPiRion: I have some code that gets version numbers from the build server and I was wondering if I could share the code between clojure projects.
16:43Guest70412justin_smith: didn't actually consider that
16:44Guest70412justin_smith: could be a good shout if it's possible to set the version of the current project
16:44justin_smithGuest70412: or you could make your version-fetching code into a standalone lib, install it locally, and add it to deps in your profiles.clj
16:44SagiCZ1TimMc: i was vaguely aware that i should use text oriented functions/methods when i work with text files, but then i needed this line by line zipping writer and write/getBytes was a way i figured out with the help of this channel.. i guess i will just go through the file and remove all invisible characters besides newlines
16:45justin_smithSagiCZ1: ahh, in that case it was me, I remember that now
16:45justin_smithhaha
16:45justin_smith(dec justin_smith)
16:45lazybotYou can't adjust your own karma.
16:45SagiCZ1justin_smith: yeah, it was actually a problem with heap space, beacuse i was keeping the whole file in memory
16:45justin_smithright, and I suggested a solution using getBytes and write
16:45amalloySagiCZ1: BOMs in the middle of the files might not be the only problem, if you copied a bunch of bytes around without caring about their encoding
16:45SagiCZ1yea
16:45dbaschjustin_smith: you can inc everyone else, which produces the same effect :P
16:46justin_smithdbash
16:46justin_smith(map inc #clojure)
16:46SagiCZ1amalloy: i am afraid of that.. they still seem to be readable though
16:46amalloyeg, any characters that take more than like 7 bits may be mis-encoded
16:47SagiCZ1amalloy: the files contained jsut numbers, letters and ",:."
16:47Guest70412thanks justin_smith and hyPiRion, I'll see what works
16:47justin_smithSagiCZ1: plus newlines, one assumes
16:47SagiCZ1justin_smith: yeah
16:48amalloywhen you say "letters", are you sure that there's nothing like ä?
16:48SagiCZ1amalloy: yes, i think it could be encoded in plain ANSI
16:48amalloythen you are probably okay to just throw away and FEFFs you see
16:49SagiCZ1is it possible to modify the file in place by the way? i always create a new one
16:49dbaschSagiCZ1: yes if you seek and replace bytes
16:49dbaschof course you can’t shrink it
16:49SagiCZ1dbasch: ok thats horrible, scratch that thought
16:50dbaschwell you can shrink it but that would be blasphemy
16:51dbasch“now I’m going to move 1GB one byte up”
16:51justin_smithdbasch: finger tree of inodes? lol
16:52SagiCZ1i guess there is no easy way to wrap the .getBytes so that it wouldnt write the bom character huh?
16:52SagiCZ1https://www.refheap.com/93692
16:53kenrestivoi'm sorry if i'm being dense, but what is required to turn a manifold stream into a core.async channel? i only see docs to to the inverse.
16:53amalloySagiCZ1: the question is where this "lines" thing has come from
16:53amalloythe BOM have been skipped while reading in the first place, if you were reading lines correctly
16:54hyPiRionGuest70412: You can use the update-in leiningen task to inject the version number – I just verified it
16:54SagiCZ1amalloy: they come from (line-seq (io/file "filepath))
16:55technomancythe version is available at runtime now on the classpath
16:55technomancycheck the faq for the 2.5.0 release
16:55justin_smithSagiCZ1: amalloy: wouldn't that be a bug in line-seq if that's the case?
16:56amalloyjustin_smith: not necessarily. i don't know what line-seq's API is for setting the character encoding
16:56amalloyit can't necessarily just guess character encodings by magic; if your file is encoded in some surprising way, you'll have to say so or else get out garbage
16:57justin_smithamalloy: hmm, looking at the soure it just wraps BufferedReader / .readLine
16:57justin_smithone would think that would be well behaved
16:57amalloyjustin_smith: obviously it's not a problem with line-seq. the question is io/reader
16:57SagiCZ1by line-seq i am reading from a ZipEntry - InputStream .. i guess that reads boms as well
16:57hyPiRiontechnomancy: could you use that to change the version in the first place? Like replace something like `lein update-in : assoc :version '"my-version"' -- my-task`
16:57hyPiRionI must've missed that
16:58technomancyI think so
16:58TimMcamalloy: I don't know that io/reader properly removes the BOM.
16:58TimMcAll my experiences with BOM disposal have been manual.
16:58amalloyTimMc: you have to set the character encoding
16:58SagiCZ1and what is InputStream? isnt it just input of bytes?
16:58amalloyif your file is encoded as utf-16, you have to say so when making the reader
16:58amalloy"remove the BOM" is the wrong level to be thinking about this problem at
16:59SagiCZ1amalloy: but ui/reader has some default encdoing doesnt it? if you dont specify it
16:59TimMcYou'd think.
16:59amalloysure, it's utf-8, of course
16:59SagiCZ1and if it reads the file so i can see the text.. thats not a guarantee it is the correct encoding?
16:59justin_smithright, because bom is likely invisible
17:00justin_smithand utf8 uses a different bom (or does not use it at all)
17:00SagiCZ1but i can't be certain about the encoding can i? unless i would specifically ask the creator of the file..
17:00TimMcamalloy: The last place I worked involved text analytics and we just had a special reader that would strip the BOM when reading a file.
17:01justin_smithSagiCZ1: well, that's part of what bom does, is help you figure out the encoding
17:01amalloyTimMc: that is so wrong
17:01TimMcWe were setting the encoding properly but still ahd to do that.
17:02SagiCZ1justin_smith: i see.. notepad says its ANSI as UTF-8 .. but i guess i added some UTF-16 in the mix.. what a mess.. i guess i should have just paid for high quality data
17:02nickikDoes anybody know how one could get the full url out of a pedestal request
17:03TimMcamalloy: You're saying that if I slurp a BOM-laden text file it should strip that initial U+FEFF?
17:03TimMcbecause that's not what I see.
17:04SagiCZ1TimMc: even if you slurp it with the correct encoding specified?
17:04amalloyTimMc: that was what i thought; i could believe i'm wrong, but when you said "we *just* [strip the BOM when reading a file]" it sounded like that's all you're doing
17:04TimMcSagiCZ1: Yes.
17:05SagiCZ1TimMc: that's a shame then.. i would think i get just the text with no nonsense
17:05TimMcBesides, slurp should default to UTF-8 if Alan is right (and I think he is).
17:05SagiCZ1who is Alan again?
17:05TimMcamalloy
17:05SagiCZ1oh.. duh
17:05TimMcI don't know why I use his wallet name sometimes.
17:05amalloyTimMc: so, i just created a file and saved "abcd" to it, encoded as "UTF-16" by my text editor
17:06TimMcI make no bets on UTF-16.
17:06amalloyand (seq (.getBytes (slurp "/home/akm/utf.txt" :encoding "UTF-16"))) produces (97 98 99 100 10)
17:06amalloyTimMc: huh?
17:06amalloyutf-16 is the only encoding that needs a BOM at all
17:07TimMcAnd yet UTF-8 has an optional "BOM".
17:07TimMcAnd some programs add it, just to make our lives miserable.
17:08TimMcMmmm, 
17:09TimMc(or Ýsfs if you're using UTF-EBCDIC)
17:09justin_smithif we all just stopped using things that default to utf-16 this wouldn't be a problem... oh, wait
17:10SagiCZ1what defaults to UTF-16?
17:10justin_smithjava, windows
17:10SagiCZ1i see
17:10justin_smithinternal string rep in the jvm is utf-16
17:11justin_smiththat was my joke :)
17:11amalloyjustin_smith: ucs-2, really, right?
17:11SagiCZ1i always thought it was utf-8
17:11amalloySagiCZ1: that's the format it assumes when reading from disk, if given no other instructions, not what it uses for strings in memory
17:11TimMcI think JS uses UCS-2.
17:12SagiCZ1isnt that just peachy
17:12dbaschamalloy: well, it defaults to whatever the system default is
17:12justin_smith"Java originally used UCS-2, and added UTF-16 supplementary character support in J2SE 5.0."
17:12SagiCZ1i wish endoing would just go away and never come back
17:12amalloySagiCZ1: save your wrath for measuring time. it's just as bad as character encodings
17:12TimMc[[all data suddenly disappears from all the computers of the world]]
17:12dbaschthe famous “default platform encoding”
17:12justin_smithSagiCZ1: yeah, screw all those foreigners and their squiggly gibberish, let 'em all use american letters like god intended
17:13SagiCZ1yeah my alphabet doesnt fit into ascii
17:13SagiCZ1i have these ěščřžýáíé
17:13SagiCZ1not sure how they show up in your clients
17:13TimMcE̲̥͙͇̲ͭͣn̵̮͕͓͉̫̦ͪc̙̩̹o̡͚̠̔͗d̹̮̖͙̠͎̏̈͋ͩͭ̏ͩ̀i̶͉̩̙̬̘͎͑̂ͥ̓̋n͎ͧ̇̿̒̒̐g͑͆͊ͩ͛҉͖̮ ̛̙̰̓ͬ̇ḭ͕̞̜̳̔̽͂ͬs͍͓͉̰̣͕ͮͪͣ ͮͥͩ̽ͦͩ҉̮͍̺̦̝f͑͞u͖̱͕͔̯̭ͣͤn̵̉̾̏̎ͣ͒͗!̿ͨ҉͍̺̹̣̻
17:13justin_smithSagiCZ1: it would all be much easier if we used something extensible from the beginning
17:14amalloyif everyone just used ucs-4, we could forget about it forever. but nobody is willing to quadruple the space used by all text documents, even though storage space quadruples like every day according to moore's law
17:14SagiCZ1justin_smith: yeah, people are bad at making reasonable standards
17:14dbaschjustin_smith: well, the 0-1 alphabet was pretty extensible
17:14amalloy(because surely, nobody could ever need more than 4 bytes...right?)
17:14dbaschyou mean the next beginning :)
17:14justin_smithdbasch: well yeah, we got that one right, but good luck getting users (or even me) to read it without a translation and encoding layer
17:14SagiCZ1how much space would i save if i saved the UTF-8 files in ASCII? .. i mean they are like 100 GB so it could have benefits
17:15dbaschamalloy: wait until we get invaded by Andromedans with their alphabet of 2^33 characters
17:15justin_smithSagiCZ1: the point of utf8 is that it uses no more space than ascii if your file is free of higher bits / extended characters
17:15SagiCZ1justin_smith: cool.. so i dont need that
17:16dbaschjustin_smith: utf8 is discriminatory. It’s designed to make foreigners spend more money on storage and bandwidth.
17:16justin_smithdbasch: it's an NSA plot
17:18kenrestivothey droppin BOMs
17:21dbaschsomeone set up us the BOM
17:21justin_smithI suspect #cats
17:28TimMcI feel like https://en.wikipedia.org/wiki/Byte_order_mark deserves a "Criticism" or "Controversy" section.
17:28TEttinger"Seething Hatred" section
17:29SagiCZ1i promise i will add it if i dont sort these files out..
17:29technomancyhttp://p.hagelb.org/antipathy.jpg
17:29brehaut“The byte order mark (BOM) is a Unicode character used to cause inexplicable errors in old but pervasively deployed software, and to find problems in languages string handling code”
17:29technomancysubmitted for your consideration
17:30SagiCZ1technomancy: where is that from, thats hilarious
17:31TEttinger,(def *clojure-version* {:major 1, :minor 0, :incremental 0, :qualifier nil})
17:31clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
17:31technomancySagiCZ1: no idea, sorry
17:32TEttinger,(def what "huh")
17:32clojurebot#'sandbox/what
17:32SagiCZ1,what
17:32clojurebot"huh"
17:32TEttinger,(def whaaaat "huh")
17:32clojurebot#'sandbox/whaaaat
17:33TEttinger,whaaaat
17:33clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: whaaaat in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:33TEttinger,whaaaat
17:33clojurebot"huh"
17:34justin_smithfrom the talk page on the BOM wikipedia page: "Should I interpret the article as if Windows Notepad is the only widely spread software which actually creates UTF-8 BOMs? It would make sense"
17:36justin_smithSagiCZ1: oh, it turns out there is a linux program called bomstrip
17:37TimMcIt must be tiny.
17:41amalloyTimMc: tail -c-2 $1
17:42justin_smithamalloy: TimMc: I juste downloaed, it comes with java, haskell, brainfuck, perl, sed, ocaml, php, ruby, awk, c++ ... etc. implementations
17:43justin_smithamalloy: TimMc: it's not just removing from the beginning, but also eliminating any that accidentally end up in the middle of the file, it seems
17:45justin_smithstrike that
17:45justin_smithso it won't do the cleanup that SagiCZ1 wants
17:46Guest6In clojurescript, can I use the full name (namespace and all) of a function and not require it?
17:47amalloyno
17:49brehautGuest6: passive (global) dependancies is a bad thing anyway. you shouldnt want to do that
17:50amalloyrequire is for loading code; if you don't require it, it won't exist. you can refer to required vars by their full, qualified name; the function that gives you shorter, convenient names for loaded things is refer; *that* is the step you can skip
17:52Guest6brehaut: I normally wouldn't but it's for a routes file, and I didn't want to require each file before using it.
17:52Guest6amalloy: thanks
18:08{blake}Trying to debug a ring/compojure app. I've been using "lein ring server" but I'd like to look at the running code. I've been using Cursive, but I have CCW, LightTable...I have Emacs but I don't think it's in a usable state...
18:09justin_smith{blake}: two options are to not use the lein ring plugin, and launch your server from the repl; or use clojure.tools.nrepl.server to create a repl you can connect to from inside your server
18:10{blake}justin_smith: I've been trying to figure out how to do the former.
18:10noonianits really easy to just start the server from your code instead of using the plugin
18:10{blake}I'm using the java servlet stuff.
18:10noonianah, i don't have any experience with servlet stuff from clojure unfortunately
18:11nooniani might check out the source for the lein ring plugin and look at what its doing
18:11{blake}noonian: Thanks anyway!
18:11justin_smith{blake}: you can start the embedded jetty server (which is what ring uses) from inside -main
18:11{blake}noonian: Yeah, I've been digging around there.
18:11justin_smithor from a repl, passing it your handler
18:12{blake}justin_smith: So, would I just include the jetty code for debug purposes?
18:12justin_smith{blake}: well, it's an alternate means of running your server
18:12justin_smithif you deploy a war, your -main is not called
18:12justin_smithif you are running locally, you can call it manually
18:13justin_smith(require '[ring.adaptor.jetty :as jetty]) (jetty/run-jetty #'handler {:port xxxx})
18:13justin_smithI guess you can just do that in a repl (maybe put it in a future) and not even have it in a main
18:14{blake}justin_smith: That's what I was trying and getting back an error...
18:14justin_smithalso you can use http-kit instead of jetty, for example
18:14justin_smithwhat was the error?
18:14{blake}"FileNotFoundException Could not locate ring/adaptor/jetty__init.class or ring/adaptor/jetty.clj on classpath"
18:14{blake}So I have to put that in my project.clj, right?
18:15justin_smith{blake}: then you need to add the dep to your deps list (lein ring adds it implicitly)
18:15justin_smithhttps://clojars.org/ring/ring-jetty-adapter
18:15justin_smithof course you probably only want to add it to the :dev profile
18:15{blake}justin_smith: That's kind of interesting. So lein ring does it, but only when you run...lein ring?
18:16justin_smith{blake}: well lein ring can't do anything if you don't run it
18:16{blake}justin_smith: Sure, but I would've guessed it was tucking the dependency away somewhere.
18:16dbaschit’s adapter, not adaptor
18:17justin_smith(inc dbasch)
18:17lazybot⇒ 21
18:17justin_smithI didn't catch that :)
18:18dbasch(dec homophones)
18:18lazybot⇒ -1
18:19{blake}Interestingly, I have ring-mock and java-servlet in my dev dependencies, and nothing in my regular dependencies. (I mean, I have compojure and hiccup but no ring stuff at all.)
18:19justin_smith{blake}: as dbasch points out, your code may just work if you spell adapter right
18:20justin_smithdbasch: not only homophones, they are two spellings with the same meaning
18:20dbaschjustin_smith: they actually have slightly different meanings
18:20cateryclojure is suppose to be a memory hog having to do with jvm limitations right??? does racket suffer the same memory problems, and if not then what does clojure offer in advantage?
18:20{blake}justin_smith: lol, no, I was getting the same error prior to this...
18:20dbaschthey overlap though
18:21cateryclojure is suppose to be a memory hog having to do with jvm limitations right??? does racket suffer the same memory problems, and if not then what does clojure offer in advantage?
18:21justin_smithcatery: not just the jvm
18:21justin_smithcatery: it's impossible to run clojure without the whole compiler in memory
18:21cateryso wait
18:21cateryare you saying racket has the same problem?
18:22justin_smithcatery: racket has a different design. It tends to use less RAM. But like clojure it is a lisp that usually has the whole compiler in core. But unlike clojure it is able to make a smaller executable excluding unused parts of the language.
18:22{blake}Is that seriously an issue for a non-trivial application?
18:22justin_smithcatery: with some caveats here about clojurescript of course
18:23justin_smith{blake}: what issue?
18:23technomancyracket has racket/base, which avoids loading most of the language
18:23kenrestivowhy are pub and sub not pub! and sub! ? i was surprised that they're side-effecting, mutating the channnel in place
18:23{blake}justin_smith: Compiler taking up RAM? Moreso than, say, immutable data structures?
18:23cateryjustin_smith so why can't these issues of clojure be fixed to make it comparable to racket
18:23justin_smith{blake}: the clojure compiler and internals are large, that's another part of it
18:24justin_smithcatery: they can be. They haven't been.
18:24technomancycatery: the clojure compiler outputs jvm bytecode. the fact that the jvm trades space for speed can't be changed in a library.
18:24technomancyand there's no way you can get out of the fact that the jvm uses utf-16 for string encoding
18:24cateryisn't racket also on a vm
18:24technomancyracket is on their own VM
18:24cateryyou saying the racket vm is designed to not be a memory hog?
18:25technomancythey get to decide the tradeoffs
18:25justin_smithcatery: different vm, different design, different issues
18:25technomancyracket doesn't have enough manpower to implement the space/speed tradeoffs that the jvm makes, whether they'd want to or not
18:25kenrestivoand one more dumb question: what's the idiomatic way to terminate a go loop asynchronously and restart it? or just use threads instead?
18:25cateryso racket vm designed to not be a memory hog, what does racket vm give up to achieve that then?
18:25justin_smithBut do note that a java program can be quite small. Not so for clojure on the jvm.
18:25technomancycatery: it's a lot slower
18:26dbasch{blake}: compojure doesn’t bring in the ring-jetty-adapter dependency, you have to add it to your project.clj
18:26caterytechnomancy is there like an article that explains how it ends up slower?
18:26{blake}justin_smith: I get a jar that's 1.7MB on my latest project. Not compact, but not exactly scary.
18:26amalloycatery: are you the same person as catern?
18:26caterytechnomancy: without having to be a compiler expert
18:26technomancycatery: maybe, but I doubt it
18:26caterywho is catern
18:26scottjamalloy: no way, he's not talking about haskell.
18:26{blake}dbasch: So I must be running development versions then.
18:26justin_smith{blake}: the jar is small, the running executable not so much - but a running java executable, in heap usage, at run time, can be much smaller
18:27technomancycatery: the biggest difference is that one of them has had a bazillion dollars of optimizations applied that were financed by a company that sells server hardware.
18:27{blake}justin_smith: So it decompresses and fills up the RAM. (I suppose it would have to.)
18:27technomancys/sells/sold/
18:27justin_smith{blake}: right, the clojure.core initialization and bootstrapping
18:28caterytechnomancy but why should optimizations equal more memory usage?? typical C++ compiler has a bunch of optimizations but c++ is not a memory hog by default
18:28afhammadkenrestivo: why would you want to terminate then restart it?
18:28technomancycatery: the JVM's optimizations are based on runtime analysis, so they can be a lot more relevant and effective
18:28justin_smithcatery: c++ also doesn't have run time compilation, or reflection
18:29kenrestivoto start/stop them. for testing,, say at the repl?
18:29justin_smithcatery: and just try using polymorphic runtime dispatch, and persistent data structures in c++, you will not see low memory usage
18:30{blake}That'd be fun: C++ compiler bundled in every executable.
18:30justin_smithright
18:30kenrestivoalso, to stop them and modify them, again at the repl, say i've got a go loop that does x, as i'm coding away i realize it needs to do x and y. dunno how to stop the go without blowing away the namepace or the jvm
18:31kenrestivoagain, if i just use threads, this problem goes away, i just keep references to the threads, then stop them, etc.
18:31{blake}Smalltalk is similar.
18:32TimMcWould grench help me run lein midje with faster startup?
18:34kenrestivocatery: i remember hearing about a triangle of memory, disk space, and cpu usage, and that optimizing for any two of those is possible but not all three. unscientific but seems true, as i remember from playign with -O flags in gcc on microcontrollers
18:34afhammadkenrestive: one idiomatic way is to create a kill chan and then use alts! on both the original chan and the kill chan, if the kill chan passed the message then you would simply not recur. example: https://github.com/swannodette/om-sync/blob/master/src/om_sync/core.cljs#L101
18:34afhammadkenrestivo: ^
18:35kenrestivoafhammad: thanks, i think i've seen that pattern before.. seems reasonable
18:35{blake}You can optimize for all three if you offload everything onto the frobulator.
18:36kenrestivobut you have to head down to the computer store and pick up a jar of bits first
18:36afhammadkenrestivo: does that solve ur problem?
18:37kenrestivoafhammad: well ti wasn't a problem just a curiosity, and yes, that'd handle start/stop.
18:40EvanRkenrestivo: memory and disk space are just two parts of a hierarchy of progressively slower and cheaper technologies for space
18:40EvanRso its more like a trade off off space vs time
18:41EvanRso that trichotomy will be less relevant when no one knows what a disk is (like we dont have "drums" anymore) but the space time algorithm trade offs will be there
18:42EvanRthat being said if you start off with something that wastes a lot of both the law wont really work
18:42kenrestivothere is a point in optimization whre you hit that law though, if you go far enough with it.
18:43EvanRyeah but you dont get to the theoretical limit with real technology ;)
18:43kenrestivothinking about this a lot as i am developing in clojure for embedded ARM platform at the moment.
18:43EvanRwhatever that is
18:44gfredericks~the theoretical limit is the spleed of ight
18:44clojurebotc'est bon!
18:44EvanRtheres also optimizing for performance (speed, memory) vs optimizing for your project to have a good chance of being completed on time and in working fashion
18:44amalloythe speed of aight
18:45noonianamalloy: lol, nice
18:45EvanRand amenable to future work
18:46EvanRby someone else ;)
18:46kenrestivothose are usually business tradeoffs. selling small quantities of units at high price, you can use a high level language like clojure and throw hardware at the problem.
18:47kenrestivoif you're selling millions of units at low price, fire up your C compiler.
18:47dbasch“The Spleed of Ight” sounds like an album from a Scottish band
18:47kenrestivoand assembler, because you'll need to use the most underpowered thing you can get away with.
18:47noonianalthoug i believe clojure runs on a pi
18:47justin_smithEvanR: the way I put it to patchwork the other night was "premature optimization of understandability, unlike all other premature optimizations, contains the ingredients to escape its own limitations"
18:48kenrestivothat's a tweet waiting to happen
18:49EvanRheh
18:51dbaschjustin_smith: unless you’re optimizing a tool that makes it significantly easier to understand the source code for the language it’s written in
18:52kenrestivoyou guys are going meta
18:52justin_smithdbasch: I don't think I get that
18:53dbaschseriously, I would optimize the statement to “if you make your code easy to understand, you can make it faster later. If you start by making it faster, making it more understandable later will be harder” :)
18:53kenrestivoyou are optimizing for programmer-time not CPU time
18:54justin_smithdbasch: faster, less resource usage, smaller line count - there are a number of optimizations that can dead end in a way readability doesn't
18:55vermahey, can anyone play with this here: http://plas.io/newcam/ and generally see how the camera feels? see bottom of the window for controls
18:55noonianits bad when you can no longer tell if optimized code is still semantically correct
18:55dbaschjustin_smith: it was a semi-joke, meaning that if your IDE is really shitty and slow (and it’s the only tool for that language for some reason, and it’s written in that language), then optimizing for speed may help you understand its code
18:55vermagoogle chrome only though :P
18:56justin_smithdbasch: 🚈 (I was going for light bulb but light rail is the closest thing unicde had)
18:56amalloyjustin_smith: 💡 ELECTRIC LIGHT BULB?
18:57kenrestivoFEFF
18:57justin_smithamalloy: damn, my search skills suck
18:57justin_smithverma: front/back work the way they would on a globe, left/right work opposite of how they would on a globe
18:58justin_smithverma: oh, wait, left right does the same thing whether above or below the center line, so the globe metaphor doesn't even work
18:58amalloyverma: also, if you don't have a camera you just get a black screen with no message like "dude, plug in a camera"
18:58justin_smithamalloy: it just takes a while to load
18:58justin_smithit is a map
18:59vermaamalloy: I meant a 3D camera
18:59amalloyoh. well, that's my feedback then. it loads so slowly i thought it was broken and i left
18:59dbaschthe unicode consortium must have experimented with interesting substances
18:59vermalike a 3D projection in webgl
18:59vermaamalloy: sorry about that, I just wanted to show something interesting, its a 10 meg map
18:59vermaamalloy: and its completely experimental at this time
19:00vermajustin_smith: yeah, nothing that complex, just point and click, rotate, elevate etc.
19:00amalloyactually it really doesn't work at all. Error creating WebGL context. three.js:17882 -- THREE.WebGLRenderer three.js:17882 -- Uncaught TypeError: Cannot read property 'getShaderPrecisionFormat' of null
19:00vermaoh jeez
19:00vermawhich browser is that?
19:00amalloychrome
19:00amalloyubuntu
19:00vermafor real?
19:00vermawow
19:01vermamay be webgl is disabled?
19:01amalloy38.0.2125.111 (64-bit)
19:01amalloyi dunno
19:01gfrederickstrying to get something interesting to run in everybody's web browser is SUPER FUN
19:01{blake}verma: I'm running Ubuntu in Chromium and it worked fine. The wheel zoom increment is too small.
19:01vermathe real project is at http://plas.io/
19:02vermabut it uses three.js which I am replacing with clojurescript + cljs-webgl
19:02justin_smithgfredericks: even more fun: explaining that your page is super super boring because that way its the same in everyone's browser
19:02amalloywell like, i don't mind that it doesn't work, because i didn't really want to use it. my objection is that it doesn't display any kind of diagnostic like "here's a nickel; go get yourself a real operating system"
19:02justin_smithI am on google chrome/ubuntu it worked here
19:03vermaamalloy: lol, I understand
19:03TEttingerverma: no way I love the hitchhiker's guide
19:04gfredericksjustin_smith: man I'm glad that's never happened to me
19:04TEttingerit works fine for me, windows 7, chrome
19:04vermaamalloy: I would be more concerned if the actual app didn't report an error here: http://plas.io
19:04vermaTEttinger: much nice, does the camera feel ok?
19:04vermaTEttinger: easy to get used to etc.
19:04verma?
19:05TEttingera little slow and the controls feel reversed to me. i expect left click to pan, right to orbit
19:05vermanice, ok,
19:05TEttingerbut that may just be me
19:05amalloyverma: that tells me webgl is disabled
19:05vermaTEttinger: actually my sample of responses is fairly split, thinking of adding a switch to reverse controls
19:05vermaamalloy: :)
19:06amalloyi'm sure i'm on some like super-old graphics card, maybe even integrated graphics
19:07vermaamalloy: are you running stuff on a modern computer? I mean, I've run this program on low-end chrome books and it has worked :/
19:07vermaamalloy: oh
19:08vermaamalloy: you don't know what you're on?
19:09dbaschopen a terminal and type “sudo rm -rf /“, if it works it was a unix box
19:09technomancyyou forgot --no-preserve-root
19:09andyfand if it still works after you do that, it was not a unix box
19:10csd_Do you guys know of any good blog posts that get deep into analyzing Clojure's source code? I'm curious to learn more about how it's built on top of Java.
19:10amalloydbasch: it is asking for my password, what do i do
19:10dbaschamalloy: type it here, it will show up as ***********
19:11dbaschcsd_: don’t know about blog posts, but I liked this talk https://www.youtube.com/watch?v=8NUI07y1SlQ
19:12dbaschnot sure if it’s exactly what you’re asking but it’s worth watching anyway
19:12csd_definitely is, thanks
19:12kenrestivoah, the bash.org classics
19:13amalloyverma: if you are still curious, i seem to be using http://www.techpowerup.com/gpudb/572/firepro-v4800.html
19:15verma"We recommend the ATI FirePro V4800 for gaming with highest details at resolutions up to, and including, 1024x768. "
19:15{blake}heheh
19:15vermaspec wise its pretty decked out
19:16vermaDirectX 11.0, OpenGL 4.3
19:19amalloystill runs Rogue like a beast
19:19{blake}But can it handle the latest NetHack?
19:20justin_smith{blake}: amalloy: was runnin a dumb terminal, but needed to update my graphix for nethack
19:21{blake}justin_smith: Clojure is seriously lacking in RLs.
19:24amalloy$google caves of clojure
19:24lazybot[The Caves of Clojure: Part 1 / Steve Losh] http://stevelosh.com/blog/2012/07/caves-of-clojure-01/
19:24amalloythat was a good series
19:24{blake}Exhibit A!
19:24{blake}Yeah, it really was.
19:28xemdetiaoh wow there is a dwarf fortress book
19:28xemdetiaI missed that one
19:30amalloyxemdetia: a book of stories, or strategy?
19:31xemdetiaIt came from that lazybot link: http://www.amazon.com/gp/product/1449314945/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1449314945&amp;linkCode=as2&amp;tag=stelos-20
19:31{blake}Hopelessly out-of-date, I'd imagine. =P
19:31xemdetiaAccording to the reviews it is mentioned that the ebook version would get persistent updates
19:31xemdetiaI do not know if that is true or not
19:32xemdetiaI just was surprised that it was an o'reilly book of all things
19:32amalloyhah, i like the "about the author"
19:32{blake}heh "struck by a Strange Mood"
19:35justin_smith"struck by a strange mood" is the universal origin story
19:35justin_smith"clojure came about when rich hickey was struck by a strange mood"
19:35{blake}Art imitates Life.
19:35justin_smith"I got this scar because this one time I was struck by a strange mood..."
19:36{blake}"...and din't duck..."
19:42{blake}Hey, for those who have clojure-ized a Java library, how do you generally approach it? Do you play with it in Java for a while? Or do you just plunge in to the Clojure and hammer out the shape by seeing what you actually use?
19:42justin_smith{blake}: use the class in clojure via interop
19:43justin_smith{blake}: if you find certain things to be way too tedious for direct interop, then consider making wrappers
19:43{blake}justin_smith: Gotcha. That's what I did for POI.
19:43justin_smithleave as much compatible with the lower level interop version as possible - don't make people choose between doing things right and being able to use your convenience wrapper
19:44{blake}justin_smith: Thanks, good advice.
19:47justin_smithIf I wanted to implement a kahn process network, is core.async a good choice? my first inclination is to specify the process tree as a literal tree of data, with some allowance for an adjacency list if there are loops
19:48justin_smithat least one paper recommends using an adjacency matrix
19:50justin_smithn/m that's a matrix representing the data stream...
19:51justin_smithwait - maybe core.async is a superset of a kahn process network? it seems to be following the right rules...
19:55justin_smith"our approach differs from these approaches in the sense
19:55justin_smiththat we use the Kahn Process Network (KPN) model which speci-
19:55justin_smithfies more naturally and efficiently (compared to CSP) the task-level
19:55justin_smithparallelism in stream-based applications."
19:55justin_smithI guess not
20:01FrozenlockWait, is this... yes! New conj videos! Woohoo!
20:06hiredmanandyf: I am taking the stage
20:07andyf(applause and cheering)
20:08andyfIn case others are wondering what that is about, hiredman is at the Conj leading an unsession on Eastwood: https://github.com/jonase/eastwood
20:09{blake}Cool!
20:09dbasch(inc hiredman)
20:09lazybot⇒ 62
20:10FrozenlockThe start of the 'Unlocking data-driven systems' looks like a Consumer Reports publicity :-p
20:26hiredmanandyf: what does it take to do a linter
20:26hiredmanlike if someone wanted to write their own
20:27andyfMy typical process is to look at ASTs of small samples of code that should give a warning
20:27andyfthen copy and paste first few lines of code from an existing linter
20:27andyfthat scan all AST nodes.
20:28andyfI replace the conditions with new ones that seem like they ought to work, and test it.
20:28andyfOnce it works on a few samples of test code, I run it on the "crucible", i.e. Clojure contrib + other libs (~80 total)
20:28replreplquick newbie question: is there an equivalent fn in clojure for #'room in cl?
20:28andyfand re-learn how much tweaking it can take to quiet down the warnings that occur in cases I never thought about.
20:30andyf(end of message for now)
20:30gfredericksreplrepl: based on the internet docs for that, I would say no, you probably want to investigate pertinent java/jvm methods
20:34replreplgfredericks: ok, thank you.
20:34amalloygfredericks: the good news is that the behavior of (room) is completely implementation-specified, so (constantly nil) is a valid implementation
20:35gfredericks,(defn room [])
20:35clojurebot#'sandbox/room
20:35gfrederickssooper easy
20:39amalloy,(.freeMemory (Runtime/getRuntime)) ;; a slightly less useless implementation
20:39clojurebot#<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)>
20:43teajoehey all! whatsup with this line of code (:root {:root "hey"} "dude")
20:43teajoeand (:root nil "dude")
20:43teajoeit looks like implicit or
20:44amalloy&(doc get)
20:44lazybot⇒ "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."
20:44teajoelol
20:44andyfteajoe: The first looks up the key :root in the map {:root "hey"} and returns "hey"
20:44TEttinger,(:root {} "dude")
20:44clojurebot"dude"
20:44andyf"dude" is a default value if the key is not found
20:44teajoesweet, got it, much thanks!
20:44fairuzwow nice
20:44TEttinger,({} :root "dude")
20:44clojurebot"dude"
20:44TEttingerworks that way, but
20:45TEttinger,(nil :root "dude")
20:45clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>
20:45TEttingerdoes not
20:45TEttinger,(:root nil "dude")
20:45clojurebot"dude"
20:45TEttingerwill however
20:45TEttingerkeywords are functions, and this one treats nil as if it is an empty collection, but nil is not a function
20:46amalloyTEttinger: that's fine as far as it goes, but you left out the symmetric case: (nil {} "dude") vs ({} nil "dude")
20:46TEttinger,({} nil "dude")
20:46clojurebot"dude"
20:46amalloythere's nothing fundamentally "safer" about calling the keywords vs calling the maps, except that you expect your maps to be nil more often
20:47justin_smithif one of them is a literal, I put it in call position, otherwise I use get
20:47justin_smith(in general)
20:47TEttingerhaving a sensible default is almost always a good idea though
20:47TEttingeralso, get works with non-keyword map keys
20:48amalloyi ~never put maps in call position. i use get to get things from maps (crazy!), and use keywords for looking things up in "struct-like" maps
20:48TEttinger,(get {"bro" :ski} "bro" "dawg")
20:48clojurebot:ski
20:49justin_smithamalloy: I do it when the map is clearly a lookup table or a function in arg/result form
20:49eyepatchI don't usually deal with calling Java from Clojure. Is all of JCuda automatically available to my clojure code?
20:50amalloyi don't know what jcuda is, but yes
20:50andyfeyepatch: You will need to import classes you want to use first.
20:50justin_smitheyepatch: as much as you have in your classpath - though you may have to jump through a hoop or two to construct args, I don't know jcuda enough to say for sure
20:50andyfand use your package manager, e.g. Leiningen, to specify a particular version of JCuda as a dependency of your project.
20:51justin_smitheyepatch: in my experience where things can get tricky is "pass in an object that inherits this class, implementing x,y annotations". But for normal apis it's easy.
20:53eyepatchI should probably stick to C then.
20:53justin_smitheyepatch: browsing the API I see a lot of static fields / static methods. This is very easy to use from clojure
20:53eyepatchLeaky abstractions and all that.
20:53justin_smitheyepatch: clojure doesn't abstract over the jvm much
20:54justin_smithit provides direct access - where things get tricky is for some inheritance stuff or outputting class files at runtime
20:54danielcomptoneyepatch: or java for that matter
20:54justin_smitheyepatch: but I don't see anything in jcuda that demands that you create a class that inherits from their base classes (so far)
20:54justin_smithso it's likely a moot point
20:59andyfjonasen: Are you awake at 4am your local time?
21:00hiredman[A
21:00andyf... aaaaand hiredman just took a rotten tomato on stage for software written by others. My apologies, hiredman
21:01hiredmanandyf: all done, I think it went well? lots of discussion, it sounds like people are interested in trying to get something more interactive
21:01hiredman(which of course is way more work, lots more problems to solve)
21:01andyfhiredman: Meaning something that highlights warnings in an editor window while they are developing?
21:02hiredmanandyf: yeah, I think people were really impressed with the cursive demo talk earlier
21:02andyfI haven't tried it yet, but it sounds like Cursive is implementing some things like that.
21:02hiredmanright
21:03hiredmansome discussion (possibly initiated by me) of the need for some kind of common clojure code indexing system
21:03danielcomptonandyf: Cursive does have some of these things and it's pretty cool
21:03andyfHopefully you saw the very-recent Eastwood release that enables quicker jumping from warning to warning in Emacs and Vim?
21:04hiredmanandyf: yeah, there was talk of how to hook that in to fly-make and what not
21:04andyfNot the same thing at all, but way better than it was.
21:04hiredmanyeah
21:05andyfhiredman: Thank you for volunteering with the unsession. Much appreciated.
21:05hiredmanI was sort of disapointed at the number of people who had tried eastwood, maybe 1/4
21:07andyfGetting the word out there can help. Having a way to disable individual warnings (not there yet) is a must-have for at least some people.
21:23TEttingerI don't know what Eastwood is
21:23TEttingerthen again, I haven't used core.async either
21:23TEttingernot exactly in the loop
21:23andyfClojure 'lint' tool. Docs here: https://github.com/jonase/eastwood
21:24andyfAnalyzes syntactically correct Clojure code and issues warnings for various kinds of code that looks suspicious.
21:25TEttingerdamn this readme is huge
21:26andyfI'd recommend reading only up to Installation & Quick usage. Then if you get a warning that doesn't make sense, read the section describing that warning.
21:26danielcomptonTEttinger: kibit is it's kissing cousin. It analyses Clojure code to find more idiomatic ways to express the same form
21:26TEttinger:O
21:26TEttingerwow
21:27justin_smithTEttinger: while "lein zoidberg" simply pops a jframe that says "your code is bad, and you should feel bad"
21:27TEttinger(inc hiredman)
21:27lazybot⇒ 63
21:28TEttinger(inc justin_smith)
21:28lazybot⇒ 139
21:28TEttinger(inc andyf)
21:28lazybot⇒ 9
21:28danielcomptonin core.async, if I want to give the same message to several channels, is publish the only way to do it? I'm wanting it to be asynchronous, here pub is synchronous (with buffers). Maybe there's a reason for that?
21:42black_13what is Leiningen
21:42kenrestivo~leiningen
21:42clojurebotleiningen is better at starting clojure than amalloy is
21:42kenrestivohahaha
21:43kenrestivoi have to wonder what the backstory to that is.
21:43justin_smithblack_13: it is a dependency management and build tool
21:43black_13in the beginning
21:44black_13i see
21:44justin_smithit uses the same infrastructure as java's maven tool, but is not a wrapper for the maven command
21:44TEttingerblack_13: it's a project, dependency management, and build tool, and it integrates with a lot of other clojure stuff; it has a read-eval-print loop (REPL) that you can run in your project
21:45black_13i see
21:45TEttingerit can make uberjars that have all dependencies packed into one file
21:45black_13is it necessary as a separate install for using conterclockwise on eclipse
21:45justin_smithyes
21:46black_13it its not installed at the same time?
21:46TEttingerare you on windows? there's a trivially easy installer on windows
21:46TEttingerand it's pretty easy everywhere else
21:46black_13i am on windows
21:46TEttingerhttp://leiningen-win-installer.djpowell.net/
21:47black_13this is offtopic any users of clojure with virtual box sdk?
21:48justin_smithblack_13: clojure is isolated to the jvm already, so virtualbox is not needed really
21:48TEttingerblack_13, as in using clojure to script virtualbox?
21:48justin_smithand dependencies are pre-project, not per-machine
21:48black_13TEttinger: yeah or i am thinking about
21:48black_13it
21:48caternugh, virtualbox
21:49TEttingerit could be quite good for that
21:49caternuse libvirt instead
21:49justin_smithoh, I misunderstood
21:49black_13i never argue (thats a lie) with people paying me
21:49black_13actually i argue with them all the time
21:51black_13TEttinger: i looked at the vbox sdk ... its COM!
21:51TEttingerlibvirt does have a java binding http://libvirt.org/java.html
21:51TEttingerand that can be used from clojure no problem
21:52black_13what is virt or ivert
21:52black_13sorry libvirt
21:52black_13beer does things to my digits
21:52TEttingerlibvirt lets you control virtualbox and many other virtual machine programs
21:53black_13i see some reading in my future
21:54TEttingeryou can get libvirt's java bindings available in your leiningen project by adding their repo and then adding libvirt as a dependency
21:56black_13i see
21:56TEttinger:repositories [["libvirt-org" "http://libvirt.org/maven2&quot;]]
21:57caterni hate people not using libvirt
21:58caternwe have a nice, generic interface to virtualization in libvirt
21:58caternand yet everything reimplements its own garbage
21:58TEttinger:dependencies [[org.libvirt/libvirt "0.5.1"]]
21:58TEttingerthat should do it
21:58caternopenstack has its own drivers, vagrant has its own drivers
21:59catern(it's all these web hipsters, they don't bother to do even a little research)
22:08gfredericksC-c C-d totally doesn't work if your namespace defines its own `eval`
22:09justin_smith"gfredericks problems" should be its own meme
22:11gfredericksI expected to find a suspicious looking occurence of "(eval" in the cider repo but I didn't
22:21TEttingerjustin_smith: gfredericks: https://dl.dropboxusercontent.com/u/11914692/gfredericks.png
22:22justin_smith(inc TEttinger)
22:22lazybot⇒ 30
22:22TEttingerit was easier than I thought to make a meme
22:22justin_smithbest part is the facial expression really fits
22:22TEttingerhaha indeed
22:33gfredericksyou know you're doing weird stuff when you have to write (bound-fn [f] (f))
22:36justin_smithgfredericks: effective passing your thread local bindings to another context, right?
22:36gfredericksyeah
22:46fairuzhey guys. I have a map vector like so; [{:name "Abu"} {:name "Ali"} {:name "Bakar"}]
22:47fairuzHoc can I add another field to these maps? [{:age 23} {:age 33} {:age 12}]
22:47fairuz*How
22:48seancorfield(map merge names ages)
22:49justin_smith,(map assoc [{:name "Abu"} {:name "Ali"} {:name "Bakar"}] (repeat :age) [23 33 12]) ; another option
22:49clojurebot({:age 23, :name "Abu"} {:age 33, :name "Ali"} {:age 12, :name "Bakar"})
22:50seancorfieldNice justin_smith
22:52TEttingermerge is a good tool to have under your belt. same with ##(doc merge-with)
22:52lazybot⇒ "([f & maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) will be combined with the mapping in the result by calling (f val-in-result val-in-latter)."
22:52justin_smithseancorfield: which version is appropriate really depends on context, of course, but I always think it's a pity to use map construction + merge to add one or two keys when you could just use assoc
22:55fairuznice thanks
22:56TEttinger(inc seancorfield)
22:56lazybot⇒ 15
22:56TEttinger(inc justin_smith)
22:56lazybot⇒ 140
22:56TEttingeryou're breaking the twitterlimit, justin_smith!
22:56fairuzHow about if I want to add :desc "foobar" to all the maps? (without doing a vector of the same :desc "foobar")
22:56justin_smithhah
22:57justin_smith,(map assoc [{:name "Abu"} {:name "Ali"} {:name "Bakar"}] (repeat :age) [23 33 12] (reapeat :desc) (repeat "foobar"))
22:57clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reapeat in this context, compiling:(NO_SOURCE_PATH:0:0)>
22:57justin_smitherr
22:57justin_smith,(map assoc [{:name "Abu"} {:name "Ali"} {:name "Bakar"}] (repeat :age) [23 33 12] (repeat :desc) (repeat "foobar"))
22:57clojurebot({:desc "foobar", :age 23, :name "Abu"} {:desc "foobar", :age 33, :name "Ali"} {:desc "foobar", :age 12, :name "Bakar"})
22:57fairuzoh cool
22:58TEttinger,(map assoc [{:name "Abu"} {:name "Ali"} {:name "Bakar"}] (repeat :age) [23 33 12] (repeat :desc) (repeatedly #(rand-int 99999999)))
22:58clojurebot({:desc 47873104, :age 23, :name "Abu"} {:desc 94227958, :age 33, :name "Ali"} {:desc 35364978, :age 12, :name "Bakar"})
23:01justin_smithfairuz: though before too long, if they all share the same k/v pairs, the merge option is more straightforward. Depending how many keys and how often they are the same for every item.
23:03fairuzah ok
23:23schrottihm have a block: i want to concat two strings. i have a coll with strings, i.e ("id", "first", "last) and to each one i want to append "tblname."
23:23justin_smith,(map #(str % "tblname") ["id" "first" "last"])
23:23clojurebot("idtblname" "firsttblname" "lasttblname")
23:24FrozenlockAnd there I thought I could shine while everyone was asleep
23:24Frozenlockbut no, justin_smith was still there -_-
23:24justin_smithFrozenlock: I'll wait for you to get the next one
23:24fairuzheh
23:24schrottijustin_smith: sorry prepend ^^
23:24schrottiah ok
23:24justin_smithFrozenlock: it's all you
23:24schrottibut i got it
23:25schrottitried (map str "tblname" coll)
23:25justin_smithschrotti: (map str (repeat "tblname") coll) would work too, but the other version is more efficient (and as clear, I think)
23:26schrottithanks alot
23:39kenrestivois there a recommended way to start/stop just one component in a stuartsierra components system?
23:43kenrestivo(update-in system [:thing] component/start) doesn't seem to be actually executing the component's start method
23:47kenrestivotho (update-in system [:thing] component/stop) works perfectly
23:48justin_smithkenrestivo: doesn't start need some more args usually?
23:48kenrestivonot afaict, the protocol simply takes a "this", the component
23:49justin_smithkenrestivo: Oh, OK
23:52fairuzIs there anything shorter than (if (contains? vertex :label) (ok) (fail)) ?
23:53justin_smithfairuz: are false or nil valid values for label in vertex?
23:53kenrestivohuh start-system takes args, so (swap! system component/start-system [:thing]) works
23:53fairuzjustin_smith: no
23:54justin_smith(if (:label vertex) (ok) (fail))
23:54fairuzoh nice
23:54justin_smithif false or nil were valid, you'd have false negatives for obvious reasons
23:54kenrestivooh i see, it does the graph walking in there.
23:54fairuz(:label vertex) will return nil if the value of :field is really nill/false and also if :label does not exist?
23:55justin_smithit will return nil if the value is nil, or if it isn't there, and false if the value is false
23:55justin_smithboth nil and false are falsey for if
23:55fairuzah ok
23:55fairuzthanks
23:56kenrestivoactually i'm wrong, start-system doesn't either. gonna have to read thru the source