#clojure logs

2014-12-31

00:10sm0kein java.jdbc api if i have a dbspec like {:connection-uri "jdbc:...." :password ".."} it does not work
00:10sm0keis there a way around this?
00:11sm0kei can append password to uri but the delimiters are not same for every vendor
02:20yedido you ever just.. absentmindedly wander through a codebase and kinda just like gaze at the code?
02:20yediis that a thing?
02:20Empperieveryone does
02:20rhg135It is
02:20Empperieveryone has brainfreezes every now and then
02:37rritochDo leiningen projects require a subversion? I have a project with version "3.7-SNAPSHOT" but when I try to use it as a dependency it isn't being added to the classpath
02:38rpaulochannels with transducers look scary with regards to memory usage
02:42rritochOops, I miss-interpreted the problem. The dependency isn't showing up on the classpath for a leiningen plugin that I'm developing, so when I run lein mytask ... I'm getting a class not found exception, but the class is provided by a dependency.
02:51rritochrpaulo: Tranducers don't block, are you sure you didn't do something crazy like pumping a few million transducers onto your channel? I've run into problems before when using non-blocking code with channels.
02:52rpauloI was just watching Rich's talk
03:08rritochI found my problem, my plugin's project is using :eval-in-leiningen true but it is being ignored, when I added :eval-in :leiningen to it the problem repaired itself.
03:20dysfunrritoch: that changed a while back
03:21rritochdysfun: I never noticed. This is my first plugin with a dependency
03:25rritochdysfun: I'm trying to integrate sablecc with leiningen, so far so good but the integration is a bit messy, many of the functions I need are private so I'm calling the apps main function to access private features, like the license and usage docs.
03:27dysfunoh i remember sablecc
03:27dysfunused it as part of the perl5-on-jvm project
03:29rritochWhat about geting rid of this warning notice; Warning: compile already refers to #'clojure.core/compile ... I added (:refer-clojure :exclude [compile]) to my ns declaration but it's still giving a warning.
03:30dysfunwhere are you seeing this?
03:30rritochdysfun: Well, this is my first sablecc project, it doesn't look like it should be too painful, but things will go a lot smoother if I can develop the extensions and actions in clojure.
03:31dysfunyeah, clojure was a bit less well developed when i was using sablecc :)
03:31rritochdysfun: I haven't published any of this yet so I really can't point it out, I'm using clojure 1.5.1
03:31dysfuni.e. i hadn't even heard of it yet
03:31dysfunany reason you're not on 1.6.0?
03:31rritochdysfun: No, I'll try that
03:32rritochdysfun: I always use 1.5.1 for anything that doesn't require the newest features... It is just a habbit
03:36rritochdysfun: 1.6.0 version didn't remove the warning though
03:39rritochdysfun: I've made a task sablecc with 3 subtasks (license, usage, and compile), license and usage are working but they're throwing that warning. I haven't made it to compile yet since I need to figure out where grammers should come from, and where the generated sources should go.
03:40rritochdysfun: Eventually, if possible, I'd prefer doing it as a hook on javac but to start with these subtasks should be good enough
03:42dysfunyou can add a hook with the robert.hooke library that comes with leiningen
03:43dysfunand i suspect your problem is one of inherited environment. as part of its setup, leiningen does a bunch of stuff before running your plugin
03:43dysfunthe quick fix is to s/compile/build/
03:44dysfuni managed to do what i needed without writing the leiningen plugin last time, so i can't help much with debugging it
03:48rritochdysfun: I'm working with sablecc 3.7 which doesn't seem to utilize anything relevant from the environment.
03:48augustljustin_smith: haha, will yell "concurrency" the next time someone tells it, thanks :)
03:50rritochdysfun: I think I'll just add a :sablecc-source-paths and scan for *.scc 's and gen to target/compiled_sources, though getting those compiled to target/classes may still be a challenge.
03:51dysfuni thought sablecc just spat our java files? /me can't remember, it's been a while
03:52rritochdysfun: I'm using sablecc-maven-plugin as a model
03:52dysfuni'll be interested to use it when you get it worked out though :)
03:52rritochdysfun: It does, but it should be transparent, and put somewhere that developers know they can't mess with, like the target folder.
03:53dysfunwell, if it only exists as a hooked thing, hard for them to mess with it :)
03:53dysfunsay, a hook just before javac runs
03:54rritochdysfun: That is one of the things I want to add, but avoiding recursion may be a mess since the generated sources need to be compiled, and they won't be in the :source-paths
03:55dysfunyes, but you can temporarily add them to :source-paths
03:59rritochdysfun: That may work, set :source-paths to [target/generated_sources] and run javac, then run javac again with the original source paths.
03:59rritochdysfun: If I do it within the hook that would probably avoid a recursion
04:00rritochdysfun: For debugging purposes though I'm starting with tasks to make sure there aren't any problems with the process
04:01rritochdysfun: I haven't made a hook yet, so tasks are what I know
04:01rpaulowas server-socket from clojure-contrib put in core.async?
04:03rritochdysfun: There also doesn't seem to be an official release of sable on maven, so I also need to make a custom distribution on clojars that builds with leiningen.
04:04rritochdysfun: I've already done that, but I need to re-do it as a fork from their project on GIT hub.
04:04rritocherr: sablecc
04:05dysfunyay
04:05dysfunnothing like a stack of yaks, eh?
04:08rritoch"stack of yaks"? I'm originally from NY and have no idea what that means
04:10dysfunshaving yaks. yaks breed (like rabbits?) and suddenly you have a stack of them to shave before you can solve your real problem
04:11rritochdysfun: hehe, exactly
04:12rritochdysfun: A lot of work just to get to the fun part of making an interpreter
04:12dysfunsix weeks ago i had one active project. now i have 16
04:13dysfunsome of them are variations on one theme, but they're on the list of stuff i'm doing because they're interesting
04:13dysfunand if you can't spend your time developing doing interesting things, why bother?
04:17rritochdysfun: hehe, I don't really think most of my projects are interesting. The only common theme is making difficult things easier, and breaking current limitations.
04:18dysfunbreaking limitations is cool, you get lost in the possibilities of what you can do with the new power
04:18rritochdysfun: breaking being the operative word because it often involves a lot of collateral dammage
04:18dysfunmeh. programming is all tradeoffs
04:22rritochdysfun: I honestly don't worry much about the economics of my apps, I've run into way too many bottomless pits where there is no end to the possiblities. Instead I just target an option that gets the job done with as few negative side-effects as possible.
04:23dysfunthere's something to be said for "the simplest thing that works"
04:24rritochdysfun: A bit like code-golf and optimization, you can spend weeks to sequeeze out a few extra cpu cycles, but it isn't always worth it.
04:24dysfunoh i rarely look at performance these days. clojure is really 'fast enough' for all my purposes even if i wrote really crappy code (and i haven't been nearly drunk enough for that this year)
04:25dysfunnot until there's a problem
04:27dysfunalso i wish postgres were as straightforward to deal with as clojure
04:29yocapybaradysfun: agreed - am dabbler with pg and clojure and found dealing with hstore etc bit confusing
04:30dysfunmy favourite is json columns
04:31dysfunhttps://gist.github.com/jjl/8124490
04:31dysfunbut that's just the clojure side
04:35yocapybaradysfun: had to adapt some code I found to convert hstore to map (and vice versa) also if I remember right, which was a nice modification
04:35yocapybarapg does inspire me with more confidence than mysql even though I have a lot more experience with mysql
05:02dysfunyocapybara: yeah, the switch was hard for me at first, but it's much better
05:03yocapybaradysfun: just the hstore is a revalation for me. Storing some json too but have't used any of the real json capabilities yet
05:04dysfun9.4 was released just before christmas with binary json support
05:08yocapybarathat's right - I haven't quite got straight what that enables you to do in practice - more efficient storage of json?
05:08dysfunpretty much
05:08dysfunspeed is amazing considering the dynamism
05:09dysfunthey've massively improved the index support for it as well
05:09dysfunthey're now smaller and faster
05:11yocapybarahmm interesting, just looked it up, so for operations in the DB concerning JSON, better to use JSONB. Interesting though some logic I perform in the program, looks like I might be able to push some of that into the DB with greater speed if I save it as JSONB
05:12rritochdysfun: I have sablecc generating the sources, but they're not compiling, I'll upload the code to github so you can see it. The compilation phase isn't where I expected problems, but that's where I'm at.
05:13dysfunyocapybara: just be aware where you're making tradeoffs. the database is a handy place to arbitrate whether some data is suitable, but doing so can make write-heavy workloads suffer
05:15yocapybaradysfun: thanks - I'll have to have a good read up of the tradeoffs. Mostly any JSON interaction I do is just retrieving, and I might be able to push some of what I do after the retrieval down to pg. Fingers crossed :)
05:15dysfunthat's less of a problem because you can spin up many slaves
05:15dysfunread-heavy workloads can be made to work pretty well on postgres to pretty huge scale
05:16rritochdysfun: can you take a look and let me know if you can see why this isn't compiling the generated sources into the target/classes folder https://github.com/rritoch/lein-sablecc/blob/master/src/leiningen/sablecc/compile.clj
05:16yocapybaradysfun: I'm just on one instance, is there getting to be concensus on how to do clustering with pg these days?
05:19dysfunyocapybara: if you can assume 9.4, lots of cool stuff just got added regarding that
05:19dysfunyocapybara: they've paved the way for doing master-master setups pretty well
05:19dysfunrritoch: my browser crashed, give me a few minutes
05:19yocapybaradysfun: ooh that is awesome I will check it out
05:20rritochOk, no problem. The compiler code is (lein-compile/compile (assoc project :java-source-paths [target-path])) where lein-compile is the leiningen.compile namespace
05:21rritochand target-path is where the sources where generated
05:32dysfunrritoch: just started looking. you could use if-let around line 9 to make that shorter
05:36rritochdysfun: These compile problems have been hauting me a lot lately, when I type lein compile my java sources don't compile, they don't compile until I do lein repl or lein run
05:37rritochdysfun: I'm not sure if this problem is related or not
05:37dysfunyou need to opt-in to it i think
05:40rritochdysfun: What doyou mean by opt-in?
05:41dysfuni don't remember the mechanism, but i think you don't get java compilation completely for free
05:44rritochMy test project is :aot :all, so :aot will already be set in the project parameter in the test that I've done
05:44rritochBut I don't know what else I need to do to force java source compilation
05:45rritochMy test project doesn't have any refrences to the generated sources in clojure though, that may have something to do with it, but I'm not sure.
05:47rritochI'll try using the javac task, maybe that will help
05:48rritochYeah, that should have been self-evident, they're all compiling now, I'm just going to add that optimization you suggested
05:53rritochOk, I uploaded the changes, the plugin is now functional so I just need to figure out how to do this automatically via a hook and this plugin will be ready for release
05:54dysfunfor that, you'll want the robert.hooke namespace
05:54rritochThe license function doesn't work due to a problem with the available dependency, but that's beyond the scope of this plugins responsiblity.
05:55rritochI've been able to get license to work with a custom dependency, but it isn't extremly critical at this point.
05:58rritochdysfun: The documentation says the hooks are opt-in
05:59rritochdysfun: Does that mean there's no way to get them automatically implemented when the plugin is in use?
05:59dysfuner it doesn't mean like that, no
06:00dysfunyou put the plugin and config in your project.clj and you use the hooks you need
06:00dysfunthere's a guide on the wiki i think
06:03daniel`anyone have an example of a liberator resource using put! and an implementation of the new? decision?
06:10dysfunthere have been a lot of liberator questions recently. is it really popular or really complicated?
06:17ticking_dysfun: maybe the httop rest foo is really complicated :D
06:17dysfundoing it right can be :)
06:17mi6x3m-altany way to call a constructor with reify?
06:18rritochAs expected the hook method has recursion problems
06:18rritochI'm trying a var/binding to see if that resolves it
06:18dysfunrritoch: easy, dynamically bound variable
06:21rritochdysfun: Well that didn't completely solve the problem, it's still generating sources too many times. I'm switching to an atom to solve it.
06:23daniel`dysfun: its a bit unusual and it seems to be popular, at least i never see any other REST frameworks being mentioned
06:24rritochdysfun: the atom worked, I just need to clean this code up and try a few more tests
06:24daniel`the documentation is a bit overwhelming and there aren't dont seem to be many real world examples
06:24daniel`i can follow the decision points and see where things are going wrong but i don't know if im doing things the 'right' way
06:25dysfunis liberator the one that shows you the decision graph?
06:26dysfunit looked cool if so, but i've been too busy needing to ship to play with it
06:26ticking_mi6x3m-alt: reify is mostly for interfaces or protocols, what you want is probably proxy
06:26ticking_see http://stackoverflow.com/questions/4368332/provide-a-constructor-with-clojure-reify
06:26mi6x3m-altticking_: yes I am using proxy for such situations, I got confused since proxy seems not to be handling protected methods well
06:27daniel`dysfun: yes, that one
06:39rritochdysfun: Ok well making the hook wasn't too painful, I've uploaded the changes and added some brief usage instructions to the readme
06:41rritochdysfun: Oops, one more change, I left some obsolete code in the compile task that isn't needed anymore
06:41mi6x3m-altClojure, what should I do if proxy is no overriding a method as requested?
06:45rritochdysfun: Ok, I think this plugin is compete, it seems to work either via a hook or via, lein sablecc compile .
06:47rritochDysfun uploading it to clojars now (as a snapshot since it isn't well tested)
06:47rritochIf I don't run into any more bugs I'll release it
06:52hellofunk(inc dysfun)
06:52lazybot⇒ 3
06:52hellofunk(inc rritoch)
06:52lazybot⇒ 3
06:52hellofunkhappy new year fellas
06:52hellofunkor ladies
06:55daniel`hny
06:56rritochHappy new years :) Hellofunk
06:57rritochI must admit this is the first time on IRC for new years, I guess I've officially earned the "geek" title. I'm in GMT+8 so its midnight in 4 hours.
06:59luxbockrritoch: philippines?
06:59hellofunkrritoch: HK, Singapore, or Philippines?
06:59rritochPhilippines
06:59kungiShort question: "Clojure's primitve data structures" the 's is correct in this case?
06:59hellofunkrritoch: nice, my wife is in manila right now. almost feel like hopping on a plane myself
06:59kungirritoch: Happy new year! :-)
07:00yguanhappy new year!!!
07:00rritochhellofunk: ofw?
07:01hellofunkrritoch: which of these do you mean: http://www.urbandictionary.com/define.php?term=OFW
07:01rritochOverseas Filipino Worker
07:01hellofunkrritoch: oh, no i'm not
07:02rritochI suppose technically I'm an OFW according to the urban dictionary, but I'm a permanent resident here with my wife... Better than dealing with U.S. immigration, and as a programmer I prefer this weather to the snow in NY
07:03hellofunkrritoch: i hear you.
07:04hellofunkrritoch: i think i could live fine in a place like Makati
07:06rritochhellofunk: Well, I'm in visayas, it isnt' that bad if you have a generator and water pump (which we do).
07:06hellofunkrritoch: no doubt. life in phils is def a different style than most might expect
07:10rritochhellofunk: From what I hear its not much different than life on most islands, you need to be very self-sufficient and plan ahead. Having a good lawyer also helps :)
07:17luxbockI'm trying to create my own binary format with ztellman's Gloss
07:18luxbockI have a 1326 element array of floats and I'm trying to figure out when it makes more sense to store them as sparse arrays then normal arrays where elements missing are just zeros
07:19luxbockis this correct: 1326 * 4 = n * (2 + 4) + 2, n = 883.666... ?
07:21luxbockso either it's 1326 elements that take 4 bytes each, or it's n, the amount of elements present in the array, times 2 bytes for the index of the element and 4 for the float of the value, plus 2 bytes to indicate how many elements there are in the sparse array
07:28dysfunrritoch: sweet :)
07:29rritochluxbock: If the array is always the same size why not just use something like {(int) nvalues, byte[] bitmask[166], float[] values } where each bit in the bitmask represents if the value is presant or not? That would probably be more efficient than a sparse array.
07:30rritochthe nvalues is of course so you can calculate ahead of time how large the values array is
07:31luxbockrritoch: I have to read up on bitmasks
07:33rritochluxbock: Just look at your actual data, if the number of items with a value is > 87 => 87 = (166/4) + 4, than a bitmask uses less storage space.
07:34rritocherr, 166/2 which brings you to an equivalent number of indexes.
07:35luxbockrritoch: my data is a tree-structure which I'm storing as a list-view, where each node contains a handful of these 1326 element float arrays, so when serializing my plan was to check for each node how many elements it has and then use the sparse/full representation with a prefix to distinguish which one it's using
07:36luxbockmy other goal besides saving space is to be able to memory-map the file so that I can look up a nodes value from its index without reading the whole file into memory at once
07:40rritochluxbock: Memory is really the least of your problems, you have to consider that most operating systems read files in blocks, typically 4096 bytes each
07:41rritochluxbock: Reading from a disk is slow
07:42rritochluxbock: So which option gives you the best chance of having all your data in one block, and you may as well just read the entire array into a cache to reduce the need to re-read the same data as much as possible.
07:44luxbockI'd be reading one node at a time, where each node has 4-20 of these float arrays and a few other things
07:45luxbockand I plan on serving these nodes over http to a web app which visualises the data for the client
07:45luxbockthe client requests the node id and gets served the data for that node
07:46luxbockbut I mostly don't know what I'm doing and I'm learning as I go so if you have any feedback on my plan then I'd love to hear it :)
07:46rritochluxbock: If you enable gzip compression on your http server you may as well just deliver the raw arrays, gzip should compress out all of your zeros
07:46rritochluxbock: At least for dealing with the transport layer
07:47rritochluxbock: At the disk level your probably better off with a bitmap format, and in memory your probably best with a sparse array
07:47luxbockrritoch: cool thanks
07:49luxbockwhat do you think of the plan to use a different data format for each node depending on how many elements there are in one array? since one node has many arrays, and all of the arrays in a node have the same amount of elements, then I think this could save me some space
07:57rritochluxbock: That would depend on your server load, if your server load is low < 50%, than that would be fine, but there's alot more logic involved when you start typing your nodes.
07:58rritochluxbock: The bottleneck of most web servers is the disk usage, most web servers hover arround 99% most of the time.
07:58rritochluxbock: Especially if the server has a lot of database usage on it
08:03rritochIf your only maintaining a few of these files and they're not modified as often as they're read you could keep the entire file in memory using memcached and your processing would be almost instant.
08:05rritochThat depends on their size, but in the common case, 1 mb file, 10-100 requests per second, your problem is that youdon't want to multiply that 1mb by 10-100, but if your processing is faster because you don't need to wait for the data to be read you really don't end up multiplying your memory usage because it's released quickly.
08:06rritochIf it takes you 10 seconds to read the file, and your getting 10 requests per second, than you can multiply ram usage by about 100, but if it takes 0.1 seconds to read the file, and your getting 10 requests a second, there's no ram usage multiplicaaation.
08:08mi6x3m-altllasram: are you available by any slight chance?
08:08rritochIt is why memcached is so popular, it makes servers more efficient.
08:08mi6x3m-altor someone with knowledge on proxy?
08:08mi6x3m-altI have a public method not being overriden
08:12rritochIf there is no memcached available, you can of course still do it from most clojure technologies as you should be able to store persistent data someplace, such as inside the servlet.
08:41luxbockrritoch: sorry was afk for a bit
08:42luxbockrritoch: I don't need to modify these files once they have been written
08:43luxbockand they will be computed by a different computer than the one running the web server
08:43luxbockso the whole file might not even fit into the memory of the machine that runs the web server at once
08:43luxbockwhich is why I'd like to use memory mapping
08:58rritochluxbock: In that case disk reads are going to be your bottleneck, anything you can do to compress the data structure, including typing your nodes, will probably provide significant performance improvements, you can even try gziping the individual nodes if you think it may help.
08:58luxbockrritoch: oh yeah I had thought of gzipping the whole tree (in case it's small enough to fit in memory at once) but I hadn't thought of gzipping individual nodes
08:59luxbockrritoch: what do you mean by 'typing your nodes'?
08:59rritochluxbock: You suggested using different formats depending on the size of your array
09:00rritochluxbock: That will require a type field to determine the type of the array
09:00rritochluxbock: anyhow, I have to go, have a good new year and good luck.
09:01luxbockthanks, happy NYE :)
09:17sm0ke,(str "A " (apply str (repeat 10 "very ")) "Happy New Year to Clojure community :D!")
09:17clojurebot"A very very very very very very very very very very Happy New Year to Clojure community :D!"
09:42gfredericksyou could do that with all symbols
09:43gfredericks,(concat '(A) (repeat 10 'very) '(Happy New Year to Clojure community :D!))
09:43clojurebot(A very very very very ...)
09:43gfredericksoh well
09:44SagiCZ1isnt :D a keyword though?
09:44SagiCZ1,(map type '(hello :D))
09:44clojurebot(clojure.lang.Symbol clojure.lang.Keyword)
09:45gfredericksyeah I spoke sloppily
10:28SagiCZ1happy new year #clojure.. thank you all for your patience, help and for being almost always here!
10:29teslanickSimpleDateFormat. tells me it's been 2015 since Monday.
10:32gfredericksthere was a lot of talk about that recently. not sure why I haven't heard of it before, you'd think it'd be an annual tradition
10:33mi6x3m-alta bug with SimpleDateFormat?
10:34gfredericksI think it's just a misleading naming convention or something
10:34gfredericksthere's this weird alternate definition of the year
10:34gfredericksI have no idea what the use of it is
10:34mi6x3m-altteslanick: can you show us your format?
10:34teslanickYeah, I was referencing stuartsierra's warning from yesterday, I thought it would be cute.
10:34mi6x3m-altI myself had an issue with YYYY accepting 2 digits also
10:34teslanickstuartsierra: user=> (.format (SimpleDateFormat. "yyyy-MM-dd") (Date.))
10:34teslanickstuartsierra: "2014-12-30"
10:34teslanickstuartsierra: user=> (.format (SimpleDateFormat. "YYYY-MM-dd") (Date.))
10:34teslanickstuartsierra: "2015-12-30"
10:34mi6x3m-altbut this is documented
10:35teslanickIt's a joke. -_-
10:36mi6x3m-alt,(.format (java.text.SimpleDateFormat. "yyyy-MM-dd") (java.util.Date.))
10:36clojurebot"2014-12-31"
10:36mi6x3m-alt,(.format (java.text.SimpleDateFormat. "YYYY-MM-dd") (java.util.Date.))
10:36clojurebot"2015-12-31"
10:36mi6x3m-altindeed
10:37teslanickBecause YYYY is the year for the current week, while yyyy is the year for the current day.
10:37mi6x3m-altteslanick: no, this is correct actually
10:37mi6x3m-altYYYY is the next week year which is 2015
10:40teslanickI never said it was incorrect. I was making a cute joke that apparently has fallen flat.
10:41mi6x3m-altsomewhat but it's still funny :)
10:43teslanickYou know what they say about explaining jokes: it's like dissecting a frog. Nobody laughs and the frog dies.
10:52mi6x3m-altteslanick: I am sorry I have put you through this horrible experience :>
10:52teslanick;)
11:03llasrammi6x3m-alt: did you figure out your proxy issue?
11:04mi6x3m-altllasram: still sweating over it :)
11:04mi6x3m-alta legit method is not recognized
11:04llasrammi6x3m-alt: code gist?
11:08llasrammi6x3m-alt: Also, are you sure the method is "legit" and not merely "dope"?
11:08llasram</humor-joke>
11:10mi6x3m-altllasram: hehe, yes :)
11:10mi6x3m-altsent you a PM
11:15TimMcgfredericks: I'd expect about half the years would have it, but only in clumps of about 7.
11:16AlwaysBCodingAnybody know how I can run one single test with clojure.test ... Like not all tests in a namespace like (run-tests) does, but just one deftest at a time?
11:16llasramAlwaysBCoding: If you're aren't using fixtures, you can just invoke the test var
11:16AlwaysBCodingWhat if you are using fixtures?
11:17TimMc&(mod 365 7)
11:17lazybot⇒ 1
11:17llasramAlwaysBCoding: Then you should stop -- it's not a great feature. ;-) I think there's a function in clojure.test which helps though... one sec
11:19AlwaysBCodinghaha now that I'm thinking about it, I guess it makes sense to just do your setup / teardown inside of an individual test so you can run it in isolation... isn't really a need to use fixtures
11:20llasramAlwaysBCoding: I think this should work: (clojure.test/test-vars [#'your-test-var])
11:20llasramThe more-convenient-looking `test-var` function unfortunately does not run fixtures -- `test-vars` is what handles that
11:23TimMc&(letfn [(fmt [f y] (.format (java.text.SimpleDateFormat. f) (java.util.Date. (- y 1900) 11 31)))] (filter #(= (fmt "YYYY" %) (fmt "yyyy" %)) (range 1990 2020)))
11:23lazybot⇒ (1994 2005 2011 2016)
11:23TimMc&(letfn [(fmt [f y] (.format (java.text.SimpleDateFormat. f) (java.util.Date. (- y 1900) 11 30)))] (filter #(= (fmt "YYYY" %) (fmt "yyyy" %)) (range 1990 2020)))
11:23lazybot⇒ (1994 1995 2000 2005 2006 2011 2016 2017)
11:24TimMcSo the last couple days in December *usually* show a mismatch.
11:25llasramIt's still pretty weird. What are the circumstances where you'd want the week-year behavior?
11:26andyf,(* 100.0 (/ 8 30))
11:26clojurebot26.66666666666667
11:27AlwaysBCodingIIasram: thanks got it to work, much better already :)
11:27llasramAlwaysBCoding: np
11:28TimMcllasram: payroll or something
11:28TimMcllasram: You *never* want YYYY-MM-dd -- you combine YYYY with some other date thing like "week number".
11:31TimMc&(.format (java.text.SimpleDateFormat. "YYYY-ww") (java.util.Date.))
11:31lazybot⇒ "2015-01"
11:53dagda1_is there a shorter way of selecting from a vector than this (first (filter #(not= :something %) my-vector))
11:55arrdemwhat are you trying to do precisely?
11:56Bronsa,(some #{:something} [:a :b :something :c])
11:56Bronsadagda1_: ^
11:56clojurebot:something
11:56Bronsaoh uhm, you want the opposite
11:56arrdemBronsa: complement
11:57Bronsaarrdem: no, that'd return a bool
11:57Bronsa,(first (remove #{:something} [:something :something :a :something]))
11:57clojurebot:a
11:57Bronsameh.
11:57arrdembah
11:58arrdemclearly we need a complement set type that contains everything and can only be subtracted from.
11:58justin_smitharrdem: unset
11:59justin_smithit would make sense to conj to an unset, but only after having removed the item previously
11:59justin_smith(similarly to disj on sets...)
11:59arrdemdisj on an unset would work, conj on an unset would be silly
12:00arrdemassuming that you started with the empty unset at least
12:00andyfas silly as doing disj on an empty set
12:00justin_smithandyf: exactly
12:00mi6x3m-altllasram: I'm back
12:01andyfarrdem: I think you should submit a JIRA ticket on Apr 1 2015
12:01arrdemandyf: oddly specific :P
12:02arrdemunsets are actually a structure I've wished for more than once..
12:02andyfWait, if we could get about 5 fun ideas ready by Apr 1, and submit them all on that day ....
12:02andyfjust a set that negates the answer for membership tests?
12:04arrdemno, because disj on a ∁set is conj on the underlying set, conj on a ∁set is disj on the underlying set, union/subtraction should then trivially work.
12:05arrdemI suppose ¬set is a better name than ∁set
12:06andyfbut you can also just think of it as a 'set of things I don't want', and reverse the uses of conj/disj on it?
12:06andyfI guess that is inconvenient in your use cases?
12:07arrdemyou could do the logical negation manually and I think that's what I wound up doing
12:07arrdemforget what I was up to that this seemed like a good idea. it was a while ago.
12:07andyfdon't ever try to do a union of one with a regular set :)
12:16justin_smith&(contains? #{Double/NaN} Double/NaN)
12:16lazybot⇒ false
12:16arrdemnope
12:16justin_smithso would we get a similar but complementary behavior from ¬set ?
12:17AimHere(= Double/NaN Double/NaN)
12:17AimHere,(= Double/NaN Double/NaN)
12:17clojurebotfalse
12:17justin_smith&(= Double/NaN)
12:17lazybot⇒ true
12:17andyfI think you might have to implement Java first
12:18andyfHmmm. My copy and paste of the complement symbol before the word "Java" failed
12:18justin_smithhaha, makes more sense now :)
12:18justin_smithsomeone should totally make ¬Java
12:19justin_smith(almost) nothing is an Object
12:19justin_smitheverything is a first class value, except Objects
12:20Bronsainvoking a method on any object throws a NPE, except for nil?
12:21Bronsawell, null
12:22justin_smithit would look like you were calling thunks as if they were varargs ml functions (terminating arg is always ())
12:32TimMcjava.net.URL bites again
12:34TimMcRandom program hang tracked down to something iterating over a bag of stuff and calling .equals on things. Turned out there was a URL in there and it was trying to do name resolution and failing.
12:34TimMcJust terrible.
12:34justin_smithjava.net.URFucked
12:35justin_smithyeah, side effects on .equals is batty
12:35bacon1989Was wondering if there's any info on Feature Expressions in clojure 1.7, i'm interested in maybe contributing some time converting some things to CLR
12:37arrdemI don't think that there's anything really official out besides the design page on the dev wiki
12:38Bronsaand the patches in the clj+tools.reader issue trackers
12:38arrdemhttp://dev.clojure.org/display/design/Feature+Expressions
12:38dysfunwhat's the easiest way to discover namespaces inside of a namespace? i want people to be able to drop scripts in a directory and them be picked up when a utility is run
12:38arrdemBronsa will know the jira stuff better than I do.
12:39Bronsabut afaik those tickets don't necessarily implement the solution that will eventually be picked
12:39justin_smithdysfun: "namespaces inside of a namespace"? what does that mean?
12:39arrdemdysfun: tools.namespace
12:39Bronsaarrdem: I believe all the tickets are linked in that design page
12:39dysfunjustin_smith: "get me namespaces foo.*" would return foo.bar, foo.baz.quux
12:39dysfunarrdem: ty
12:40justin_smithdysfun: oh. namespaces are not meaningful heirarchical except in name (though you probably already know that)
12:40dysfunindeed
12:40justin_smith*meaningfully
12:40bacon1989arrdem: yeah, i've been looking at that. I found an article outlining some cljs work with th experimental branch
12:40bacon1989however, I haven't seen anything with regards to clojureCLR, so I was wondering if there were other resources
12:41bacon1989I think it would be a great way to make some libraries more portable
12:41justin_smithdysfun: if what you care about is not loading a particular namespace (require) but rather all files in a given directory, why not just iterate and call load on each one?
12:43dysfunjustin_smith: whatever the means, it all equates to much the same. but in this case they belong as part of the codebase and will run in the build so it feels right to make them namespace. and new things should be picked up properly etc.
12:47andyfbacon1989: If there is nothing there about Clojure/CLR, it is likely no one has done anything for that yet. Probably David Miller is waiting until the dust settles.
12:48bacon1989andyf: Interesting, I just noticed the proposal came out pretty recently.
12:49bacon1989I'm just interested because my company deals mostly with .NET, and hardly touches java. the clojure community would probably expand a tad bit more if clojureCLR got more libraries part of the same domain of libraries as clojure and clojurescript
12:50andyfwell that wiki page for feature expressions was created in 2012, I think, but Alex Miller has been editing it heavily over the past several months as they get closer to deciding on what to do.
12:52bacon1989Ah I see
12:57OscarZwas thinking about static vs. dynamic typing.. Clojure is obviously dynamically typed language at its core.. but have you guys ever hoped for some static typing when doing Clojure programming? would it be possible to add some aspects of static typing to Clojure, i mean.. it has support for metadata etc..
12:58justin_smithOscarZ: there is core.typed
12:58OscarZor is static typing considered evil in the clojure community? :)
12:58TimMcThere are folks working on it.
12:59TimMcNot evil. :-)
12:59OscarZcool, i wasnt aware of that :)
12:59justin_smithOscarZ: also, I find prismatic/schema for runtime type assertions / static documentation of expected "shapes" of data to be quite useful
13:00justin_smithie. even if I don't turn on the runtime checks, it's nice to have an explicit declaration of what keys should be in a map etc.
13:00OscarZnot that i specifically ran into something that i'd need it.. i think i got drawn into clojure because of its clean syntax and i guess static typing always brings its own verbosity into play
13:00justin_smithOscarZ: core.typed does inference
13:00OscarZjustin_smith, yeah thats good.. i actually ran into that :)
13:03OscarZis it an impossible dream to have kind of layer on top of untyped language that you could use optionally? i dont have enough experience to know what kind of problems you run into.. i guess you can do all sorts of things at least compile time
13:04justin_smithonce again, core.typed does not require types for your whole program
13:04justin_smith(though if something is typed, all the things it uses need type declarations)
13:05OscarZyeah i got that.. but arent there any downsides for this approach vs. languages that are "natively" typed?
13:05justin_smithsure, using libs can be clumsier, since you often need to declare their types (or use them from untyped code)
13:08OscarZwhat about performance? one could naively think that typed languages could make more "ready" low- level code and there would be more "ad-hoc" dynamic checking when you add some layer on it .. but i dont really know if thats a problem
13:09justin_smithOscarZ: well, the point of static typing is that it happens at compile time. Dynamic typed langs already do all sorts of runtime type checking.
13:09justin_smith(as opposed to untyped langs which don't do any checking at compile OR runtime - ie. forth)
13:10justin_smith,(+ () 1) ; not untyped
13:10clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList$EmptyList cannot be cast to java.lang.Number>
13:10OscarZtrue :)
13:11OscarZin many cases, i dont care about performance hit by dynamic typing.. i guess one of the nice things would be to have some kind of syntax highlighting/autocomplete in the editor as you code
13:12OscarZbut that is surely something that can be done in core.typed etc
13:13dnolen_http://swannodette.github.io/2014/12/31/the-old-way-the-new-way/
13:14justin_smithOscarZ: cursive has core.typed integration
13:14OscarZi wonder if its nicer to program a code highlighting editor in Clojure as its "homoiconic"
13:14OscarZjustin_smith, cool! i need to check that out
13:14justin_smithdnolen_: cool! thanks - these clojurescript improvements all look great by the way.
13:15mi6x3m-altOscarZ: in the beginning I was a knight of the static typing order as well :)
13:15OscarZah dont have IDEA.. planning to check that out though.. maybe now its a good time
13:15mi6x3m-altbut some experiments in clojure changed my idealism
13:15TimMcOscarZ: No, the homoiconicity doesn't extend to things like comments and whitespace.
13:16arrdemTimMc: but it could :D
13:16OscarZmi6x3m-alt, im not a knight really.. im bored of Java and i like Clojure very much.. was just thinking if some of the good things in static typing could be brought in
13:16mi6x3m-altarrdem: a comment considered by homoiconicity woudn't be a comment, no?
13:17TimMcarrdem: There's alway sa sheen of surface syntax.
13:17OscarZi have looked into Scala too.. but somehow Clojure seems to be more interesting
13:17arrdemmi6x3m-alt: iff it's visible to the evaluator/macros then yes
13:17arrdemmi6x3m-alt: some langs (.net family) read whitespace, comments as form metadata for refactoring support.
13:17OscarZTimMc, i see..
13:17mi6x3m-altOscarZ: no wonder, scala is just java with pseudo-functional syntax
13:18justin_smithmi6x3m-alt: if that was all it was, it would be a lot simpler
13:18justin_smithmi6x3m-alt: it's a lot of things (but that subset is quite usable)
13:18OscarZwell, first i got into functional programming and learned some Haskell.. i like that a lot too
13:18OscarZbut need a JVM language to get closer to real world as it stands for me
13:18OscarZ(work)
13:19justin_smithOscarZ: Ocaml is another good one if you want something with faster compile times, static typing, and very fast compiled code
13:19OscarZthe Haskell type system is pretty cool though
13:19mi6x3m-altyes OCaml is great
13:19mi6x3m-altbut macros are the charm of lisp
13:20justin_smithocaml-java is in alpha :) maybe someday it will be an option
13:20OscarZjustin_smith, i see.. i have heard of it
13:20mi6x3m-altdoubt it, clojure already has a megaton of software
13:20justin_smith(and imho it would likely turn out to be what scala should have been if they do it right)
13:20mi6x3m-alteverything you need is here
13:23OscarZthis prismatic schema thingy, does it have IDE support as well ?
13:24justin_smithOscarZ: I don't think so. It's more about validating data at runtime, but I find the schema annotated code nice to work with.
13:25TimMc&(/ (* 1e6 2000) 2.2 1000)
13:25lazybot⇒ 909090.9090909091
13:28TimMc&(/ (* 1e6 2000) 2.2046)
13:28lazybot⇒ 9.071940488070397E8
13:28TimMcmi6x3m-alt: That's... almost a teragram of softare!
13:28OscarZjustin_smith, ok.. maybe i should look into that.. been looking for some nice open source project
13:29mi6x3m-altTimMc: whatever keeps the boat moving :)
13:29TimMcor 845 gibigrams
13:29TimMcsince really the mass of software should be measured in base-2 metric.
13:30llasramTimMc: Measuring software progress by weight is like measuring aircraft progress by lines of code
13:30TimMc:-)
13:30TimMcin that they're both good ideas
13:31mi6x3mTimMc: these words probably don't get said a lot :)
13:35EvanR-workhow do you remove an element from a set
13:35justin_smithdisj
13:35justin_smith,(disj #{1 2 3} 2)
13:35clojurebot#{1 3}
13:37andyfEvanR-work: You are welcome to ask here, but consider using the cheatsheet for similar questions: http://jafingerhut.github.io
13:39EvanR-workyou dont like showing off your knowledge so much faster than i can google it?
13:39EvanR-workjk
14:25mi6x3m-altllasram: still here?
14:25llasrammi6x3m-alt: Yep
14:25llasramWHat's up?
14:25mi6x3m-altllasram: look here https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_proxy.clj#L340
14:26mi6x3m-altit seems as if the proxy is constructed before the method map is extracted
14:26mi6x3m-altdoes this make sense?
14:28mi6x3m-altyes this seems to be the case
14:28llasramUnless something unexpected happens in `generate-proxy`, I think you're right...
14:28llasramWow, that is a pretty big gotcha
14:28mi6x3m-altmajor flaw, ye
14:34llasramI wonder if there's already an issue open for this...
14:34mi6x3m-altthink it's an issue?
14:34mi6x3m-altmight be a hidden feature
14:36llasramHmm. You have a point, kind of. It isn't explicitly documented, but if you start thinking through the actual mechanics of it, I think it wouldn't actually even be possible to make the replacement methods work during construction
14:37llasramSuper class constructor invocation needs to be the first thing which happens, but the proxy override methods are closures, so they are themselves per-proxy-class-instance function-instances which need to somehow be passed in
14:38llasramSo I think it's just un-/not-explicitly-documented behavior, but is surprising enough to warrant e.g. a mention in the doc string
14:39mi6x3m-altllasram: indeed, I stumbled upon a similar issue yesterday where I needed to delay the initialization
14:39mi6x3m-altjust because of this super class constructor call issues
14:57aphyrRaynes: Hey, outta curiosity, does the github plugin for lazybot work still?
14:59justin_smithaphyr: yeah, I have seen it work on #leiningen since the big update
15:00RaynesI was just suggesting he use a friend's bot (designed for the purpose) instead.
15:00RaynesThere's a website ye can go to and just set up a hook
15:02TEttingerand github provides an IRC hook
15:02borkdudeI'm looking for something to allow users embed links in their text, without allowing the use all of html. Maybe markdown is an option, or just html with restrictions. Any libs I could use for this?
15:02TEttingersounds like markdown
15:02RaynesTEttinger: Github's sucks though
15:02RaynesIIRC, rcmp joins and stays there for a long while
15:02RaynesRather than join -> yell -> part every time
15:03borkdudeok markdown it is
15:03TEttingerRaynes, because github's joins, sends a message, and immediately quits? yeah I can see that being annoying
15:04Raynesborkdude: Yeah, markdown or if it's literally just links you could just parse out []() yourself.
15:04borkdudeok sounds good
15:11aphyrRaynes: hmm, rcmp just throws 500 internal server error
15:12Raynesaphyr: Yeah, I noticed. Consulting the author. I think he took it down because he and nobody else was using it.
15:12RaynesThere's always lazybot :P
15:18aphyrRaynes: oh it looks like you can use mlock and the github bot won't part/join
15:19FrozenlockIs there a way to get a hold of a previous value in the repl? (further than *4)
15:20RaynesOh you can do that
15:20RaynesAwesome
15:21Raynesaphyr: Dope!
15:21Raynesaphyr: I'd suggest using that as it's a github supported thing, but let me know if you ever want lazybot reporting
15:21aphyrThanks :)
15:22TimMc,(for [i (rest (range)), :let [sym (symbol "clojure.core" (str "*" i)) v (resolve sym)] :while v] sym)
15:22clojurebot(clojure.core/*1 clojure.core/*2 clojure.core/*3)
15:22TimMcFrozenlock: I don't think *4 is a thing.
15:22Frozenlockeh... you are right, it goes to *3
15:23TimMc,(def recursive [*0])
15:23clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: *0 in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:23TimMcaw
15:24amalloyTimMc: (defn f [] (*1)), (f) ; implicit y combinator????
15:25TimMc&(defn f [] (#'*1))
15:25lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
15:25TimMc,(defn f [] (#'*1))
15:25clojurebot#'sandbox/f
15:25TimMc,(f)
15:25clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/*1>
15:27TimMcOh, no need to #' because it's in head position.
15:28TimMcAnd yeah, totally works... once. :-)
15:28TimMc(def fact (fn [n] (if (zero? n) 1 (* n (*1 (dec n)))))), (fact 5)
15:30andyfSounds like Swearjure has another idiom
15:32gfredericks*1 isn't legal swearjure
15:33andyf(inc Swearjure)
15:33lazybot⇒ 2
15:33gfredericks$karma Swearjure
15:33lazybotSwearjure has karma 2.
15:33gfredericks$karma swearjure
15:33lazybotswearjure has karma 2.
15:33gfredericks$karma GFredERicks
15:33lazybotGFredERicks has karma 112.
15:33gfredericks(inc lazybot)
15:33lazybot⇒ 37
15:33andyfI didn't mean to inc Swearjure, I meant to propose that as the name of the extended version of Swearjure :)
15:34andyf(dec Swearjure)
15:34lazybotYou want me to leave karma the same? Fine, I will.
15:34gfredericksI hate that lazybot response because it's not clear what s/he did exactly
15:34gfredericks$karma swearjure
15:34lazybotswearjure has karma 2.
15:37amalloygfredericks: that response is supposed to be impossible, but it crops up all the time. some lazybot bug i think
15:39gfredericksclojurebot: that response is supposed to be impossible
15:39clojurebotc'est bon!
15:39justin_smith~that response
15:39clojurebotthat response is supposed to be impossible
15:40gfredericksI wish I could search for all the times that clojurebot pops out of nowhere and says a random fact.
15:40andyfIf the bots logged bot messages, you could.
15:41gfredericksthe what did who
15:41andyfThe chat logs don't include things the bots say, do they?
15:41AimHereLazybot logs clojurebot
15:41AimHereEven when clojurebot is just replying to people demanding clojure of it
15:41gfredericksandyf: even so there's a lot of noise
15:41andyfSo it does: http://logs.lazybot.org/irc.freenode.net/%23clojure/2014-12-31.txt
15:43andyfI may have just bred another hairy yak there
15:45TimMcIt doesn't always log clojurebot. It didn't the last time I set 5 equal to 2. (I was grabbing those logs to show someone.)
15:46andyfYou may have crashed one of them :)
15:47TimMcoooh, right
15:48TimMcNo, that doesn't make sense -- it was logging what other people said.
15:48gfredericks~andyf is a hairy yak breeder
15:48clojurebotYou don't have to tell me twice.
15:48andyfThat was a perfect response
16:05amalloyweird, i thought lazybot ignores clojurebot completely, to prevent all manner of bot quining. i wonder how things actually go
16:23justin_smithI think it may be just clojurebot doing the ignoring
16:26AimHere&(,(println "Hello World"))
16:26lazybotjava.lang.NullPointerException
16:26AimHere&",(+ 3 4)"
16:26lazybot⇒ ",(+ 3 4)"
16:26AimHere,"&(+ 3 4)"
16:27clojurebot"&(+ 3 4)"
16:27AimHere,(println "&(+ 3 4)")
16:27clojurebot&(+ 3 4)\n
16:27lazybot⇒ 7
16:27amalloyjustin_smith: no, clojurebot doesn't ignore lazybot. lazybot prefaces his output with ⇒ so it can't look like a clojurebot command
16:28justin_smithoh, interesting
16:28Rayneslazybot ignores clojurebot, I'm fairly certain
16:28amalloyRaynes: i thought so too, and yet... ^
16:28AimHereIt certainly doesn't, I just proved the opposite
16:28justin_smithRaynes: a couple lines up...
16:28RaynesI think you broke it then.
16:29AimHereI think it's always been like that
16:29amalloyhe certainly *used* to. it was a little annoying, because his logs didn't include the stuff clojurebot said at all
16:29Raynesuser-blacklist
16:29justin_smithoh shit did that break?
16:29RaynesIt's configured, but now broken, I assume as a result of justin_smith's changes
16:29Raynesjustin_smith: Not a big deal or anything
16:29RaynesNo worries
16:29RaynesA little bot dialog never hurt nobody
16:29amalloyjustin_smith: you're fired. retroactively rescinding all of your paychecks
16:29justin_smithhaha
16:32kenrestivobotloop
16:46TimMcamalloy: Yeah, having clojurebot be missing from the logs was pretty annoying to me.
16:49[blake|If I've got a WAR, and some HTML in that WAR for uploading a file, I see that my upload code gets an actual file (in the TMP directory). I'm looking at using AWS and wondering if that's going to cause a problem.
16:49[blake|(Versus, say, receiving the stream in my code and doing something with that.)
17:12justin_smith /tmp on aws is no problem
17:13[blake|justin_smith: So, it's not like you can't write a file, it's just that you can't expect it to persist?
17:14justin_smith[blake|: that, and the default working directory for the war file is not writable
17:14justin_smithso make sure you write to something like /tmp that will be, if you are creating files manually
17:15[blake|justin_smith: Well, my app originally copied the file passed to a storage directory but I decided to put it into a database instead.
17:15[blake|Which eliminates the need for the storage directory (and has other value).
17:17[blake|So, kind of oddly, the web server will write the stream from the user to TMP, I'll load it from TMP and put it out to the DB.
17:18justin_smithis it the server copying the file to tmp, or something in your middleware? because clearly best would be to directly work with that data stream and skip the disk usage
17:18kenrestivoeastwood has given me a bizarre error in the ns declaration: https://www.refheap.com/95632
17:18munderwoHi all. So I have a clojurescript question (the cljs channel is rather quiet right now) Does anybody know how to split lines on a new line char and preserve the line?
17:19munderwo*preserve the new line?
17:19[blake|Well, I don't have any special code to do the writing...Wait, I do have multipart-params.
17:19[blake|Though I didn't think I was using it...
17:19justin_smithit could be your server is doing it, but if it's a middleware you can disable, all the better, no?
17:19andyfkenrestivo: That is most likely a case where the line and column number are not trustable
17:19andyfWhat Eastwood version?
17:20kenrestivo0.2.1
17:20andyfIs it an open source project, or one you are willing to share?
17:21kenrestivocan't unfortunately
17:21andyfunderstood. If Eastwood has some kind of bug or limitation where it doesn't get the correct line and column number, it reports 1:1 by default
17:21[blake|justin_smith: Yeah. But this is a straight compojure app.
17:22justin_smith[blake|: you say that as if that meant there wouldn't be middleware working some magic
17:22kenrestivoandyf: gotcha, thanks. but indeed, there is no > anywhere in the file
17:22kenrestivoand you'll notice the requires are quite benign
17:22andyfIt could be inside of a macro expansion, which would not be immediately obvious from your source code.
17:22andyfIt almost certainly is not because of the ns form
17:22kenrestivoyeah that's what i figured. is there a macroexpand-all for a whole ns?
17:22andyfbut some macro invocation later in the file.
17:23[blake|justin_smith: Well, I tried to use multipart-param. Now all I've got is a post with a "multipart/form-data" part, and when I get that post, I pull out the :tempfile param, which appears to be a /TMP file.
17:23[blake|I mean, I could see there being some middleware magic, but I think I would've had to put it there.
17:24kenrestivoi'm thinking in c, there's a feature to dump the source after all the macros have been expanded and includes have been included
17:24andyfIf you add :debug-warning true to your options map, you will get some additional info about some warnings, including :suspicious-expression warnings, but it might be confusing.
17:24andyfTry it and see if any of the expressions printed out look like they are macros invoked in your code.
17:24andyfe.g. lein eastwood '{:debug-warning true}'
17:24kenrestivowell it also could be a function call i'm making which calls a function which calls a macro, which causes trouble
17:25andyfI don't think that is possible, the way Eastwood works.
17:25andyfIt is not executing your functions, unless you call those functions inside of a macro expansions.
17:27kenrestivo:debug-warning outputs the same stuf
17:27andyfNo extra output?
17:28andyfah, I see. There are different kinds of suspicious-expression warnings detected in different ways in Eastwood, and I only added the extra debug output for 1 of them. Sorry about that.
17:29[blake|Which raises the question: What IS handling that?
17:29kenrestivoall good. it's a great tool.
17:29justin_smith[blake|: either ring or the server I guess?
17:30andyfIt does narrow it down a bit. Let me look at the Eastwood code for the other cases of that warning and see if it jogs my memory.
17:30kenrestivocool, thanks. if there's some patch you'd like me to try to eastwood, i'm game.
17:32justin_smith[blake|: so you are sure that multipart-params isn't being used?
17:32andyfNo occurrences of the character > in that file, you said?
17:32kenrestivoindeed, plenty of ->, but no >
17:32[blake|justin_smith: Took it out.
17:32justin_smith[blake|: never mind, now I see it is something jetty does
17:33justin_smith[blake|: if the request has a file input, jetty creates a file
17:33[blake|justin_smith: Oh! OK...this raises some other questions.
17:33kenrestivothere's some->, ->, and async/>!!. but no (> anywhere
17:33justin_smith[blake|: http://docs.codehaus.org/display/JETTY/File+Upload+in+jetty6 explained pretty clearly here
17:33andyfIs it test code, e.g. any uses of 'is' ?
17:34[blake|justin_smith: I've got ring-mock, ring-jetty-adapter and javax.servlet/servlet-api in my dev dependencies.
17:34[blake|justin_smith: I got bupkis anywhere else. Which would seem to be a barrier to deployment.
17:34justin_smith[blake|: yeah, by default ring uses an embedded jetty server in dev
17:35justin_smithand then you would deploy by creating an uberwar, which is put inside some container
17:35kenrestivooh, there's also map->Foo
17:35justin_smith[blake|: another option is using http-kit or aleph at runtime and deploying a standalone uberjar that hosts itself
17:36[blake|justin_smith: That might be interesting, especially if -- Well, I've been deploying to WildFly. It might make my life simpler if I didn't.
17:36[blake|So, if I wanted to capture the stream, could I do that? And is it worth it? I like the neatness of it. But.
17:37andyfYou can try '{:debug [:all]}' as comand line options, but the output is really long, and you'll want to redirect it to a file. Among many, many other things, it will show you the macro expanded forms, but the other stuff might drown that out.
17:38andyfLooks like I may want to add a debug option that only shows the macro-expanded forms, and not everything else.
17:39andyfOh, it would be a bit shorter if you used '{:debug [:compare-forms]}' and then look in the file forms-emitted.txt
17:40andyfSearch in forms-emitted.txt for occurrences of > (that are not part of -> or other longer names)
17:41andyfLikely what is happening is some macro you are using is transformed into code that contains an expression of the form (> expr). If so, that isn't necessarily a bug in your code or the macro -- perhaps just a degenerate case in the macro that made it straightforward to write.
17:51kenrestivoemitted-forms.txt is pretty cool. doing the needle/haystack thing now
17:52kenrestivohahaha
17:52kenrestivoandyf: got it.
17:52kenrestivo)))>)))
17:53kenrestivothanks
17:53andyfable to trace it back to something you wrote? Cool.
17:53kenrestivoyeah, stupid typo. not easy to find due to a > being buried in a forest of closing parens
17:54kenrestivobut... lein check didn't catch it, eastwood did. so, yay eastwood
17:54andyfI'm surprised that turned into a call to > with 1 arg
17:55kenrestivogit commit -a -m "derp"
17:55andyfbut if the warning goes away after fixing that, then I don't have any other explanation :)
17:56kenrestivono that was totally it.
17:56andyfWas it in a macro definition in another file?
17:56kenrestivono it was literally )))>)))
17:56kenrestivocan you spot the problem with that?
17:56andyfIn the file with the warning?
17:56kenrestivoi didn't :-P
17:56kenrestivoyep
17:57andyfIs the function something you can share, e.g. short and nothing terribly proprietary?
17:57andyfIf not, I can try to reproduce my own example. It would be better if the line/col number info was more accurate there.
17:58kenrestivosure. it was (some-> state-thread (async/>!! :stop)>)
17:58andyfthx
17:58justin_smith[blake|: backing up for a moment, if /tmp is at least a ramfs and not a disk fs you at least aren't paying for disk latency you don't need
17:58kenrestivofeel free to include in tests. compiler is fine with that, for some reason. but eastwood flagged it.
17:59andyfThere is nothing illegal about a call to > with 1 arg, just not usually what you want
17:59[blake|justin_smith: Yeah, I don't know. Maybe worrying about it is a form of premature optimization. It's not like there's going to be any volume anyway.
18:00kenrestivoandyf: the full version of the function is here: https://www.refheap.com/95634
18:01kenrestivolooking at it, i'm kind of surprised the compiler didn't puke blood when confronted with that
18:02andyfkenrestivo: Consider this form: (-> 5 (+ 1) >)
18:02andyfexpands to (> (+ 5 1))
18:02andyfnothing illegal
18:02andyfsome-> is similar
18:20gizmo385What are the performance impacts of using multimethods vs using protocols?
18:21gfredericksthe multimethods are slower.
18:39kenrestivohmm, i guess so. and since the function is just doing side-effecty things, the fact that it returns garbage isn't relevant
18:58DynastyCan a macro call a function which makes use of the macro itself?
19:07gfredericksare you talking about the macro itself calling a function or the macro emitting code that calls the function?
19:07gfredericksthe latter should be okay I think, especially if they're in the same namespace
19:12Dynastythe macro makes use of a function while generating its output
19:12Dynastybut the function makes use of the macro itself
19:12Dynastydoes that make sense?
19:12clojurebotTitim gan éirí ort.
19:13gfredericksdoes the macro only conditionally call the function, or always? if always that sounds like a guaranteed stack overflow during macroexpansion
19:15Dynastyconditionally I guess
19:21EvanR-workok im going insane
19:21EvanR-worktrying to assert that x is less than 2, i.e. no bigger than 1
19:21EvanR-work(assert (< 2 x) ...)
19:22EvanR-work(< x 2)
19:22amalloyEvanR-work: "less than 2" is quite different from "no bigger than 1" unless you're guaranteed an integer
19:23EvanR-workyes its integers
19:23amalloybut the former is (< x 2); you can imagine moving the < into the middle, or of < as meaning "increasing", as in (< 1 2 3 4)
19:23EvanR-worki need to put (< x 2) here, but how do i write it so its easy to actually read and understand?
19:23EvanR-workok..
19:23amalloyif you want to get cutesy you can write stuff like (-> x (< 2))
19:24EvanR-worki dont even want to use 2
19:24EvanR-work"no more than 1"
19:24amalloyokay, so <=
19:24amalloy(<= x 1)
19:24EvanR-workx <= 1
19:25EvanR-worklooks like a freakin arrow
19:25EvanR-work(not (> x 1)) ?
19:25amalloythat wouldn't include 1
19:25amalloyoh
19:25TMA,(macroexpand '(-> x (-> (-> 1 1+) (<))))
19:26clojurebot#<NumberFormatException java.lang.NumberFormatException: Invalid number: 1+>
19:26amalloyi mean, sure, you can write that if that more clearly expresses what you intend
19:27EvanR-work(at-most-one x)
19:28EvanR-workguess i need macroz
19:29TMA,(*)
19:29clojurebot1
19:32TMA,(macroexpand '(-> x (< (-> (*) (+ (*))))))
19:32clojurebot(< x (-> (*) (+ (*))))
19:34TMA,(macroexpand '(-> x +))
19:34clojurebot(+ x)
19:35TMA,(macroexpand '(-> * ()))
19:35clojurebot(nil *)
19:36amalloywhy would you need a macro, EvanR-work?
19:37TMA,(macroexpand '(-> (*) (-> (*) +)))
19:37clojurebot(+ (* (*)))
19:38EvanR-workyou wouldnt. it wouldnt need to be a function either
20:12kenrestivocrossclj appears to have stopped working. page loads, but the javascript in it seems to just lock up.
20:14kenrestivoactually it doesn't lock up, it just doesn't render anything.
20:18amalloykenrestivo: did you maybe search for "rhymes with orange"? maybe it's just having trouble finding the answer you want
20:18amalloyor like "functions better than juxt"?
20:18kenrestivono search, just loading home apage
20:19kenrestivoit's just a big white nothing. something's gone awry.