#clojure logs

2014-11-11

00:03technomancyalso relevant http://en.wikipedia.org/wiki/Chinese_room
00:06rritochtechnomancy: That is very cool, I'll need to review that in more depth, it is the first I've seen it but it looks like it can help with my work
00:06justin_smithsm0ke: rritoch: evolutionary programming (creating random configurations of input, varying them by some scheme, scoring them, varying the highest scoring results) was the method that was used to make the first (only?) successful malbolge programs. It was a system writting in common lisp.
00:07justin_smithmalbolge was designed to be impossible to program in, but a lisp program was able to solve "hello world" and "99 bottles of beer" where humans failed
00:08rritochjustin_smith: Nope, IBM just made one, lets see if I can find it
00:08justin_smithwat
00:08justin_smithhow is that a response to what I said?
00:08rritochhttp://www.ibm.com/smarterplanet/us/en/ibmwatson/what-is-watson.html
00:08justin_smithrritoch: that has nothing to do with what I was talking about
00:09rritochjustin_smith: IBM hasn't exactly open-sourced their technology, but as far as I can tell the watson system is doing exactly what your stating
00:09justin_smithrritoch: you do not understand what I said
00:09justin_smithmalbolge is a pathological vm, designed as a joke
00:10justin_smitha lisp program, by a separate author, was able to "solve it" using evolutionary programming
00:10justin_smithwhere no human was able to solve it
00:10justin_smithI gave this as an example of a successful genetic algorithm
00:13rritochjustin_smith: Evolutionary programming has many practical applications, but rarely are companies willing to fund it. The most common use I've seen is schedule generation.
00:14rritochhttp://www.codeproject.com/Articles/23111/Making-a-Class-Schedule-Using-a-Genetic-Algorithm
00:15rritochjustin_smith: But yes, you can achive calculations with genetic algorithms that are impossible for a human to perform
00:15justin_smithrritoch: yeah, stuff like simulated annealing is well suited to ridiculously large search spaces
00:17godd2I wrote a little evo-sim in ruby with little tanks that shoot at each other. It will be fun to learn enough Clojure to reimplement it. https://github.com/nicklink483/combat
00:23rritochgodd2: For projects like that Clojure should have an official "projects" page like Pike does... http://pike.lysator.liu.se/applications/
00:24rritochI've learned of a lot of clojure apps in this chatroom that I never would have found otherwise, many of which should probably be maintained in an official list to help those starting out
00:24godd2Clojars?
00:25justin_smithrritoch: clojure tends to be used more for server side stuff, rather than end-user applications
00:26rritochjustin_smith: I'm using it for an end-user application, for extremly high-profile customers
00:27godd2"tends to be"
00:27justin_smithfor every person who has mentioned an end user app in here, I think there have been 10 people mentioning some back-end service (usually http)
00:28justin_smithand it seems like most of the end-user stuff is clojurescript
00:29rritochjustin_smith: That is normal for an emerging technology, very few languages where developed from the ground up with end-user applications in mind, C/C++ and Pascal are the only ones I can think of that fit that category
00:30technomancytcl and elisp... maybe factor.
00:31justin_smithvisual basic!
00:31justin_smithjavascript
00:32technomancytechnically java was designed for set top boxes originally, but that probably doesn't count.
00:32justin_smithyeah, I was just considering that
00:33justin_smithbourne shell would almost count
00:33minikomimaybe racket
00:33justin_smithwhere the end user is a beginner programmer, in that case
00:34justin_smithR, for end users who do statistics
00:35justin_smithsimilarly the various computer algebra systems for folks who do math
00:35justin_smithmatlab / octave / mathematica
00:35godd2derive
00:35justin_smithcoq
00:36minikomikdb / q
00:36rritochjustin_smith, R, matlab, octave, and mathematica are all for research and development purposes, they're not often used by end users, the output from them are often delivered to end users though, but that doesn't really count.
00:37justin_smithI consider scientists/mathematicians to be end users - they certainly aren't good programmers for the most part
00:37engblomComing from Haskell background, I miss very much the official lists of applications of libraries
00:37justin_smithengblom: you know about clojars, right?
00:37engblomjustin_smith: No, I do not know more than that lein pulls down from there
00:38justin_smithhttps://clojars.org/projects
00:38justin_smithit's a veritable firehose
00:38engblomClojars seems to be the equivalent of Hackage.
00:39justin_smithis there a "popularity" listing?
00:39godd2Seems like Clojars could benefit from showing off metrics like total downloads and recent library activity
00:39rritochjustin_smith: What I mean is there needs to be a "sane" list of completed end-user applications
00:39justin_smithengblom: http://crossclj.info/ cross-references lib usage, which is a useful metric
00:39godd2Oh it does the first, but only when you look at the library in detail
00:40minikomithere’s http://www.clojuresphere.com/ as well .. but hasn’t indexed since feb this year..
00:40justin_smithrritoch: there are very few end user applications written in clojure, as I said
00:40engblomWhat I am missing for Clojure is this: https://www.haskell.org/haskellwiki/Applications_and_libraries#Haskell_applications_and_libraries
00:40TEttinger$google clojure toolbox
00:40lazybot[The Clojure Toolbox] http://www.clojure-toolbox.com/
00:40justin_smithengblom: clojuresphere is close to this too http://www.clojuresphere.com/
00:40engblomThere you click on "Web, Html, XML" and you get relevant libraries with some comment on what they do.
00:41justin_smithengblom: I think clojure toolbox, as TEttinger mentions, is close to that
00:41godd2hey technomancy where would I submit a feature request for the clojars site?
00:42TEttingerclojure toolbox doesn't have comments, but it does pretty much only have often-used libs
00:42justin_smithgodd2: it has a github repo https://github.com/ato/clojars-web
00:42engblomYep, clojure-toolbox is what I have been missing!
00:42technomancygodd2: is it something you would submit a patch for?
00:43engblomIf only some comments on what each library do would be added, it would be pretty much perfect
00:43godd2technomancy Yeah I suppose I could. Can I just submit a pull request to the repo?
00:43justin_smithengblom: I think the cross-reference "who-uses-what" info on crossclj.info is a good supplement to that
00:43justin_smithgives a good idea of what likely is usable, well updated
00:43technomancygodd2: yeah, but if it's going to be significant work it might be best to get feedback on the clojars-maintainers mailing list; it's on google groups
00:43godd2okay awesome thanks
00:45technomancytrying to think of end-user clojure applications that aren't development tools
00:45justin_smithyeah, pretty much zilch unless you count cljs websites
00:45minikomihmm.. how about quill or overtone? they’re still code based but in a different way..
00:46justin_smiththat's true, I could see counting those
00:46minikomiAlso, https://nightweb.net/
00:46technomancyminikomi: all three designed around writing code
00:46technomancyoh, sorry
00:46technomancynightweb is not nightcode
00:46justin_smithin that sense, incanter - even if used from a repl, is in some cases an end-user tool rather than a lib
00:46minikomiyeah, same dev i believe
00:47technomancyironic that the only non-dev clojure application is an android thing, which clojure is admittedly terrible at
00:47minikomiindeed..
00:47engblomIs Android Quill made with Clojure?
00:47minikomiis it a pain to distribute to end users perhaps?
00:47engblomOr is there any other Quill?
00:48technomancymaybe it's because if you're writing an application in clojure it seems like a shame not to let users write clojure too =)
00:48justin_smithminikomi: I think part of this is cultural - the folks who really go for clojure are less often the folks to be excited to make UI / end-user apps I think
00:48justin_smithtechnomancy: hehe, that too
00:48minikomilet’s say I want to make an app which someone can just download, double click, use.. what are my options for clojure?
00:48justin_smithperhaps end-users are too mutable for our delicate sensibilities
00:49minikomilet’s say restriction to a platform is ok
00:49justin_smithminikomi: seesaw for the UI is probably worth checking out
00:49justin_smithminikomi: not too hard to make a click+run jar
00:49minikomiwill the end user get scary java popups and such?
00:49justin_smithjava is so platform-independence focused, a non-portable app may be harder to make than a portable one
00:49justin_smithminikomi: no, that's only for web applets
00:50justin_smithdon't make web applets
00:51minikomiOK. might be worth looking through https://github.com/search?q=%22seesaw.core%22&type=Code&utf8=%E2%9C%93
00:51technomancyjustin_smith: you get a weird java popup on macosecks though the first time you run it
00:52technomancybecause you have to agree to the eula
00:52justin_smithtechnomancy: oh, I had no idea
00:52justin_smithbut that's for java, not a specific app, right?
00:52technomancyyeah /usr/bin/jana on a fresh install is this weird wrapper that downloads a JRE on demand
00:52technomancyyup
00:52TEttingerI'm working on making a lein plugin that integrates the jre bundler called Packr
00:52justin_smithmaybe part of why clojure doesn't have end-user apps is because jvm sucks for end-user apps somewhat
00:52justin_smithTEttinger: yeah, I look forward to seeing and using that
00:52justin_smith(inc TEttinger)
00:52lazybot⇒ 27
00:52technomancySun Microsystems made its money selling server hardware, go figure
00:53TEttingerit's available now, justin_smith but it doesn't work for weird reasons I can't understand
00:53engblomOut of curiosity, has anyone made a X window manager (similar to xmonad) in Clojure?
00:53godd2I know I don't have any, but how do I see my own current karma?
00:53TEttingerhttps://github.com/tommyettinger/lein-packr
00:53TEttinger$karma godd2
00:53lazybotgodd2 has karma 0.
00:53justin_smithengblom: the kind of host interop that would require is a huge pain in the ass
00:53godd2coll thanks
00:53justin_smithengblom: I started looking into it
00:54TEttinger(identity TEttinger)
00:54lazybotTEttinger has karma 27.
00:55justin_smithengblom: I searched for wms written in java, as a starting point, and the dirth of results was my first bad sign
00:55justin_smith*dearth
00:55technomancyjustin_smith: did you find an X lib written by a guy called frank?
00:55justin_smithtechnomancy: not that I recall, should I have/
00:56technomancyI dunno, that's what I found when I looked in 2009 or so
00:56technomancypretty much the only option on the jvm at the time
00:58justin_smithtechnomancy: oooh, this time I found an intriguing page full of broken links http://escher.sourceforge.net/
00:58engblomThere seem to be some options nowadays. At least a quick googling for 'java xlib' makes it look like that.
00:58justin_smithengblom: right, but none are mature, from what I found
00:59engblomMight be :/
00:59technomancyX sounds crufty enough that it wouldn't be something you'd do just for kicks
00:59rritochengblom: With a quick google search I found https://github.com/Zubnix/trinityshell which may be helpful, never tried it though.
00:59technomancykind of hard to justify when xmonad exists
00:59engblomWell, I will have to continue with xmonad. Even though it would have been fun to have something similar in clojure at least while learning clojure.
01:00technomancybut maybe if that's your thing who am I to judge =)
01:00justin_smithtechnomancy: engblom: I did a quick search, and my reasoning was "I could see hacking on this if there were evidence that it had been done well before, but I don't have the energy / motivation to be the first one to do it successfully"
01:01technomancyit seems like maybe a good project for someone who has worked with X before but wants to learn the jvm or clojure
01:01justin_smithyeah
01:01justin_smithhmm - what about doing it via mono? mono obviously has extensive X11 bindings (via gtk or qt likely)
01:02engblomI think it is too much for someone wanting to learn Clojure... but modifying it would be perfect for someone learning.
01:02justin_smithclj-clr / mono of course
01:02rritochjustin_smith: Working directly with the X11 protocol is a nightmare, I've tried it before at a socket level and I quit the project soon after processing a few packets, it is just too big of a project to do without libraries, at least for a normal developer.
01:02justin_smithrritoch: yeah, low level X stuff sucks
01:03justin_smithI could see taking a wm done in mono, and then bolting on clojure for configuration / runtime behavior
01:03justin_smitha nice extensible wm with a repl
01:03justin_smithI still miss sawfish sometimes :)
01:04justin_smithwith a better lisp sawfish could have been so much better
01:04technomancystump isn't so bad
01:06engblomI think stump is terrible as it is not dynamical. If I open one app more, I have to manually arrange the windows. If I am closing one, again I need manually rearrange or I will have unused space.
01:06justin_smithrritoch: looks like trinity shell is pretty immature, it has no program launcher, and I can't find any screenshots
01:06technomancyhm; I don't remember having that problem.
01:07engblomMy favorite WM are xmonad and dwm.
01:08justin_smithi3 is cool because it has a generalized tree of windows
01:08justin_smithscreens / desktops / frames / panels
01:08justin_smithwhich is something I often wanted until I found i3
01:08rritochjustin_smith: Per the docs it's started via java -jar bootstrap-0.0.1-SNAPSHOT-jar-with-dependencies.jar
01:09justin_smithrritoch: I mean no launcher for programs inside the wm
01:09rritochjustin_smith: I suppose you could just drop that in your init-scripts somewhere
01:09justin_smithI mean you need to go to a shell somewhere and type in the name of programs to run them
01:10justin_smithit has no menus or launch tool
01:10rritochjustin_smith: X11 doesn't work that way, apps "discover" the window manager directly from the X server, but apps don't need to be started with a special app to be aware of the window manager.
01:10rritochjustin_smith: You just launch your apps the same way you always would
01:10justin_smithrritoch: I know how x11 works. The documented fact that the wm has no menus or launcher is indicative of how immature the project is
01:11justin_smiththe way I always would is win-d which brings up my launcher tool
01:11justin_smithevery wm that is usable at least has a keybinding that spawns an xterm
01:11justin_smithat the very least
01:12technomancyjustin_smith: meh, xbindkeys is what I use
01:12technomancyI mean, I agree it's indicative of immaturity
01:12justin_smithtechnomancy: OK, but it's pretty low hanging fruit as a feature
01:12technomancybut I also like "do one thing well, and embed guile while you do it"
01:12justin_smithI could do it in like three lines of code if you already have keybinding support
01:13rritochjustin_smith: Per the specs it says it's a modular design, I suspect features like that are intended to be added as modules.
01:13justin_smithrritoch: and clearly none of those modules exist
01:13clojurebotExcuse me?
01:13rritochjustin_smith: Though with no one actually using that window manager, there are probably no modules for it.
01:13justin_smithright, I was just taking that as an indicator of maturity, not my must-have-feature
01:13engblomhttp://sourceforge.net/projects/jdx/
01:14justin_smithengblom: I think that is a fork of gnome
01:14justin_smithmost of the code is c iirc
01:15justin_smithengblom: oh wait, maybe not
01:17justin_smithengblom: that looks like the most complete one I have seen so far
01:20caternbetter to write it as a wayland compositor (we're talking about WMs here?)
01:20justin_smithcatern: yeah - the project that rritoch linked has a wayland target
01:21justin_smithcatern: are people actually using full wayland systems yet?
01:21caternjustin_smith: yes
01:22caternGNOME's Wayland session and all the GNOMEy applications work
01:22justin_smithcatern: cool (I tend to use debian, so maybe this will be my reality in a decade or two)
01:22caternjustin_smith: GNOME Wayland works fine in jessie
01:22catern(as long as you're using a free driver)
01:22justin_smithOK, I hope it's obvious I was exaggerating a little about the time frame
01:22justin_smithsadly I am not using a free graphics driver
01:22caternya :)
01:23justin_smithand limiting myself to gnome apps would be - interesting
01:23justin_smithdoes emacs have a version for wayland?
01:24caternnot yet :(
01:24justin_smithI can replace all the other apps I use
01:24justin_smitha native windowed emacs is a must have
01:24caternoh, you can use X applications on Wayland
01:24engblomI would not have much use of a wayland window manager. Quite often I need the remote X ability. For example, someone is calling me and asking me: Does site X work at the school with their browser and firewall? The only way to give a sure answer is to do X forwarding with SSH and test it.
01:24justin_smithoh, OK
01:26caternXWayland works fine
01:27justin_smithhearing that all the kids are using some new windowing system I have never tried definitely makes me feel old.
01:27caternnah
01:27caternit's not really *too* ready for daily use
01:27caterni'm sure some people (GNOME devs) are using it as such though
01:27justin_smithso it's only the arch / gentoo folks using it
01:28justin_smithahh
01:28caternit's still got minor bugs
01:28caternhaha
01:28justin_smith∀x -> hasBugs(x)
01:30justin_smith∀𝓍 → 🐛(𝓍)
01:31justin_smith(where that unicode is "bug" if you cannot see it)
01:32caternewww
01:32caternthat's creepy
01:38rritochIt's really too bad I've lost all of my CLISP codes, it was on a server that I threw out when I imigrated to Asia, but I had previously written a unix shell in CLISP which would probably be very useful for clojure developers
01:40rritochI found it very useful to be able to do loops to expand data directly from the command line using CLISP syntax
01:40godd2justin_smith well my code is a member of Y not X, so neener neener
01:40justin_smithheh
01:45rritochengblom: Good choice, CLISP is a dinosaur
01:45godd2There are other hosts for Clojure out there
01:46engblomJava is/was normally like this: Write once, run nowhere. A minor bug-fix version often broke applications written in Java.
01:47godd2ClojureCLR uses .Net
01:47rritochI stole the idea for the shell from CLASH, because I didn't like CLASH syntax since it put preference on LISP syntax vs shell syntax.
01:47TEttingerclojurescript, Pixie is some kind of PyPy VM thing
01:47rritochIf I recall correctly I just added some filters to convert "cmd `(...)" syntax into the syntax CLASH expects.
01:51rritochThat reminds me, is it possible to define subclasses using gen-class? There are some java libraries which have interfaces that require subclasses. Other than writing java wrappers I really don't see how it's possible from clojure.
01:52justin_smithrritoch: proxy
01:52justin_smithhttp://clojuredocs.org/clojure.core/proxy
01:52ddellacostayeah, gen-class should be avoided if possible just 'cause of how complicated it is
01:52rritochjustin_smith: Hmm, is there an example?
01:52justin_smithon that page I linked
01:53rritochjustin_smith: I can give an example of a problem... https://docs.oracle.com/javaee/6/api/javax/servlet/FilterRegistration.Dynamic.html
01:53justin_smithThat's not a lass, it's an interface. There are a bunch of options for that.
01:53justin_smith*class
01:54justin_smithreify, proxy, defrecord, deftype, and yes, genclass
01:54justin_smithor even extend is suitable, sometimes
01:55justin_smiththough the nested class may make that more complicated...
01:56rritochjustin_smith: I don't see a relevant example of the syntax needed to proxy a subclass on that page though, I know I could proxy the FilterRegistration but how would I define the methods for the Dynamic subinterface?
01:56justin_smithrritoch: you would include an invocation to proxy in the gen-class invoking namespace, I think
01:57justin_smiththough with nested classes it may just be easier to use java and make a shim
01:57rritochjustin_smith: But proxy returns an object, it doesn't return a class
01:58rritochjustin_smith: I can't just def -Dynamic (proxy ...)
01:58justin_smithwhy can't you invoke proxy in the constructor?
01:59justin_smithin order to fill that slot
02:00justin_smithand typehint the slot to have that class
02:01justin_smithI am not sure though, this is definitely more complex than it looked at first. Clojure deliberately avoids concrete inheritence, and doesn't provide much for it.
02:03rritochjustin_smith: As of now I've written this case off as impossible and if I need to implement filtering I'll need to write that code in Java because I simply can't figure out how to do it from clojure
02:03rritochjustin_smith: I tried, without any luck, doing (:genclass (:name foo.bar/childbar)) but it doesn't work
02:04justin_smithrritoch: a shim class should not be too hard to do - make the bare skeleton in java, and call clojure code for all the methods
02:14justin_smithrritoch: wait, this is a nested interface in an interface right?
02:14rritochjustin_smith: Yes
02:14justin_smithFilterRegistration$Dynamic
02:14justin_smiththat's the syntax to specify it
02:15rritoch:)
02:15rritochThat sounds about right, I never tried it though
02:16justin_smithyeah, I was confused by the "nested class" thing (what, a class inside an interface?) then I realized it was a nested interface (I blame the beer, sorry)
02:16rritochSo how would I do that? Implement FilterRegistration$Dynamic, and extend the parent class, then somehow def the child into the parent?
02:16justin_smithso yeah, you should be able to extend FilterRegistration$Dynamic as an interface
02:17rritochjustin_smith: Well either way, this is a HUGE step forward
02:17rritochI wasn't able to refrence the subinterface at all so I didn't get anywhere so far
02:18justin_smithyou can implement a subinterface separately from the interface iirc
02:18rritochOnce I'm done with this documentation I'll test it out on the clj-grid-core library where that interface is part of the dependencies.
02:22justin_smithso as I was saying before, reify, proxy, deftype, defrecord, and extend all allow making things that implement arbitrary interfaces
02:22justin_smithincluding subinterfaces via the syntax I just mentioned
02:23justin_smithin particular, deftype and defrecord define not just one-off instances, but also a class and a constructor
02:24rritochWell, I'll try it, ALL of theServletContext implementations in grid are incomplete as I had no way of implementing these classes which are required return-types for the ServletContext interface.
02:24rritochIt means the difference between having a semi-functional JSP implementation and having a fully functional one.
02:25rritochIt also means back to systems level code I go, lol
02:25rritochI suspect I"ve entered a bottomless pit
02:26justin_smithI don't know about that. If you find a way to use defrecord / deftype / proxy / reify instead of gen-class, it makes things much simpler and easier to implement
02:27justin_smithgen-class is one of the hardest to use parts of clojure
02:27rritochThis isn't the first time though, when I made my first web platform I had the same thought, that I'd never get out of systems level code, than one day without noticing I was out and never needed to look back.
02:29rritochjustin_smith: Well I really don't need to use any of those constructs at this time, that would be up to the web developer, I just need to produce the classes for them to utilize.
02:30justin_smithrritoch: the question is whether you need gen-class. gen-class is the hard to use thing you reach for if those simple options don't work.
02:30justin_smithand this matters if your code is going to be modified or extended
02:31rritochjustin_smith: Yes, the gen classes are required, in this case you need to gen-class to produce servlet filters
02:32justin_smitha record or deftype plus aot could not do it?
02:32rritochThe ServletContext doesn't accept filters as an object, it takes them as a class or class name.
02:32justin_smithdefrecord and deftype define classes
02:33justin_smith,(deftype FOO [x y])
02:33clojurebotsandbox.FOO
02:33justin_smith,(class (FOO. 1 2))
02:33clojurebotsandbox.FOO
02:33justin_smiththat's a class, with two slots
02:34justin_smithof course in practice you would implement some interfaces
02:35justin_smith,(deftype FOO [x y] Object (toString [this] (str "☃" x " , " y "☃")))
02:35clojurebotsandbox.FOO
02:35justin_smith,(Foo. 1 2)
02:35rritochDoesn't defrecord require you to implement every method?
02:35clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: Foo, compiling:(NO_SOURCE_PATH:0:0)>
02:35justin_smith,(FOO. 1 2)
02:35clojurebot#<FOO ☃1 , 2☃>
02:35justin_smithas ooposed to inheriting them?
02:36justin_smith*opposed
02:36rritochjustin_smith: As much as possible I've only implemented the absolute necessities, and gen-classes handle that well by throwing an exception if a method that isn't defined gets called.
02:36justin_smithrritoch: gen-class is the hard way
02:36justin_smithit really is
02:37rritochjustin_smith: See how many methods you need to define with a defrecord? https://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html
02:37rritochjustin_smith: That would take forever, with gen-class I can just implement the ones I need
02:37engblomIs (do ... ) only needed in special cases, like for (if ...) if you need to do several things when a condition is true? Is it otherwise OK inside of functions to just add forms after forms without (do ...)?
02:37rritochjustin_smith: which is exactly what I've done to reduce development time
02:37justin_smithengblom: right, it is for usage inside if or when
02:38engblomI tested kibit and it said I had been using unnecessary (do ...). In haskel you always used "do" if you wanted a sequence of code.
02:38justin_smithrritoch: so instead you are currently inheriting all of these?
02:39rritochjustin_smith: Nope, just leaving them as the default provided by clojure, an exception that the method hasn't been defined
02:39justin_smithrritoch: deftype/ defrecord do the exact same thing
02:39seancorfieldengblom: forget everything you know :)
02:39justin_smithyou don't implement them, and then get an exception if they get called
02:39rritochjustin_smith: I only get that exception IF I try to call one of thoose methods
02:40justin_smithexactly
02:40seancorfieldit feels the same way going from clojure to haskell btw
02:40justin_smithrritoch: this is exactly what defrecord and deftype do
02:40engblomseancorfield: I can imagine that :)
02:40rritochjustin_smith: Well, I wasn't aware of that, but I don't see gen-class as complicated, accept when it comes to handling these subinterfaces
02:41justin_smithrritoch: it is complicated because it does not run in code that is not from a file (unless you do complex workarounds)
02:41justin_smithit is complicated because deftype and defrecord do things automatically for you that gen-class does not
02:41justin_smithespecially defrecord
02:42justin_smithrritoch: note how I defined a type extending toString above? how would you do that with clojurebot with gen-class?
02:44justin_smithanyway, I need to turn in for the night
04:01Glenjamin~for
04:01clojurebotfor is forget arrdem
04:02Glenjaminhelpful
04:02Glenjaminfor?
04:02clojurebotfor is complected
04:11sm0ke,(let [c (atom 10) rfn (fn [] (when (not (zero? @c)) (swap! dec c) (rfn)))])
04:11clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: rfn in this context, compiling:(NO_SOURCE_PATH:0:0)>
04:11sm0keis there any way to close over a closure itself?
04:13clgvsm0ke: you can close over any value
04:13sm0keclose to close over itself
04:13sm0keugh closure to close over itself i mean
04:13clgvyour example will work with (rcur) instead of (rfn)
04:13sm0keclgv: but rfn is not resolved within itself in this example
04:13clgvno stack consumption then, as well
04:14clgv*(recur)
04:14clgvsm0ke: no, the name of the let binding is not bound before the right hand side is evaluated
04:15clgvyou can name the function if needed, as in (fn rfn [] ... (rfn))
04:15sm0keok recur could be a solution but what if instead of calling it directly i am using something like (partial rfn)
04:16clgvyeah, you can name the function as shown above
04:16sm0kemakes sense
04:16sm0kei guess i am not doing it right
04:17clgv,((fn count-down [n] (if (pos? n) (do (print n) (count-down (dec n))) (print "BOOM!"))) 3)
04:17clojurebot321BOOM!
04:18sm0keyes i know recursion! :D
04:19sm0kethanks clgv
04:20clgvjust an example for the naming of the lambda, I mentioned before ;)
04:20sm0kegot it
04:22clgv,((fn count-down [n] (if (pos? n) (do (print n) (map count-down (range n))) (print "BOOM!"))) 3)
04:22clojurebot3(BOOM!12nil (BOOM!nil) (BOOM!1nil (BOOM!nil)))
04:22clgvah doseq would have been better ;)
04:43m1dnighthmm, is there an easy way around the arithmetic overflow in clojure?
04:44clgvm1dnight: what is the calculation where this occurs?
04:44m1dnighta function for the colatz conjecture
04:45m1dnight(defn colatz [n] (cond (== 1 n) 1 (odd? 1) (recur (+ 1 (* 3 n))) :else (recur (/ 2 n))))
04:45clgvm1dnight: (odd? n) right? ;)
04:45m1dnightoh snap
04:46clgvyeah there are integers with arbitrary precision
04:46clgv,(type 1L)
04:46clojurebot#<NumberFormatException java.lang.NumberFormatException: Invalid number: 1L>
04:46clgv,(type 1M)
04:46clojurebotjava.math.BigDecimal
04:46clgvwrong guess
04:47clgvah yeah just use autopromoting ops, e.g. *' +'
04:47clgv,(*' 2 Long/MAX_VALUE)
04:47clojurebot18446744073709551614N
04:47clgvah "N" is the correct suffix ^^
04:48clgv,(type (*' 2 Long/MAX_VALUE))
04:48clojurebotclojure.lang.BigInt
04:48Glenjaminbah, i was just typing that but it took me 4 goes to find the name of MAX_VALUE
04:49clgv,(odd? (*' 2 Long/MAX_VALUE))
04:49clojurebotfalse
04:49m1dnightI had a function previously for belphegor numbers and that coerced to big ints
04:49m1dnightbut then my prime function no longer worked
04:49m1dnight:(
04:49m1dnightI believe it was with odd as well
04:50clgvm1dnight: so you have two choices (1) use auto-promoting operations or (2) start the calculation with BigInts e.g. 1N
04:50m1dnightauto-promoting is coercion (if thats the right term here) to bigint?
04:50clgvm1dnight: what does your prime function assume?
04:50m1dnightwell, that it's an int, I guess :D
04:50m1dnightlet me get the code, hold on
04:50clgvm1dnight: coercion to BigInt when needed
04:51clgvm1dnight: if that was a performance optimization you'll need to drop that to use BigInt
04:51m1dnightclgv: no just puzzles to keep my mind busy in the early mornings :)
04:52m1dnighti wanted to check Belgphegor numbers (10006660001 for example) for prime-ness
04:52m1dnightbut 1066601, .. 1000066600001 quickly overflows
04:54clgvm1dnight: how is the check implemented?
04:54m1dnighthttps://www.refheap.com/93129
04:55m1dnighthmr, dit past me fix the issue?
04:55m1dnight:D
04:55clgvhow exactly should that overflow as long as x is a long?
04:55m1dnightIt seems to fine here now
04:57clgvthe belphegor fn might overflow - maybe numeric-tower implements `expt` cleverly to auto promote
04:58clgvbtw. (:use ...) in ns should be used instead of (use ...) in the implementation part
04:58TEttingeryep, it will autopromote
04:58TEttingerhttps://www.refheap.com/93131
04:58Glenjaminwhy is :use preferred over use ?
04:58clgvand yeah, use should usually be omitted in favor of :refer ... :as
04:58Glenjaminor :require vs require etc
04:58TEttingerthat's numeric tower expt
04:59clgvGlenjamin: then all dependencies are contained within the ns declaration and not scattered all over the file
04:59TEttingerGlenjamin: it organizes includes into one place, so they aren't scattered through ...
04:59TEttinger(inc clgv)
04:59lazybot⇒ 36
04:59clgv(inc TEttinger)
04:59lazybot⇒ 28
04:59clgv;)
04:59TEttinger:D
04:59Glenjaminclgv: oh right, i thought you meant don't do (ns myns (require a))
05:00clgvGlenjamin: it is idiomatic to use keywords there as well, since it is "specification data"
05:00Glenjaminright, ok
05:04rritochHi, does anyone know how to implement a subinterface? I tried the following ... (deftype Blah [] javax.servlet.FilterRegistration$Dynamic (setAsyncSupported [foo] nil)) But I'm getting an error saying it can't define a method not in an interface, but it is in the interface.
05:10m1dnightclgv: it is a relic of testing execution of that file without a leiningen project :D
05:10m1dnightbut you are right
05:11clgvrritoch: did you include a param for the "this" reference in the implementation?
05:12rritochcljgv: No, but changing [foo] to [this foo] gives me the same error
05:13rritochclljgv: Oops, your right, awesome !
05:15rritochcljgv: So if I add a (def Dynamic (deftype ParentClass$Dynamic [] javax.servlet.FilterRegistration$Dynamic ....)) to a parent (gen-class) will that mimic the full structure of the parent->child relationship?
05:17foodooIs there something like a hash-map comprehension in clojure? Just like list comprehensions?
05:19rritoch,(let [{foo :foo} {:foo :bar}] foo)
05:19clojurebot:bar
05:20mavbozofoodoo: what languages have hash-map comprehension construct?
05:20foodoomavbozo: Python
05:20rritoch,(let [{foo :foo} (hash-map {:foo :bar})] foo)
05:20clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: {:foo :bar}>
05:20foodoomavbozo: Python3: { x: x+1 for x in range( 3 } }
05:21rritoch,(let [{foo :foo} (hash-map :foo :bar)] foo)
05:21clojurebot:bar
05:21foodoomavbozo: This creates a mapping from the numbers 0 to 2 to to each number plus 1
05:22rritochfoodoo: Is that what your looking for? You can expand it the same way you expand a map
05:23foodoorritoch: No. What I would like to have is something that makes it possible to define each key and value in the body of a 'for' expression
05:23Glenjamin,(into {} (for [x (range 3)] [x (inc x)]))
05:23clojurebot{0 1, 1 2, 2 3}
05:24foodooGlenjamin: that looks good. Thanks
05:29Glenjaminif anyone has a couple of minutes to look over https://github.com/defshef/defshef12/blob/master/ClojureScript.md it would be much appreciated - it's a ClojureScript primer to get experienced programmers going at a practical functional programming meetup
05:31mavbozoGlenjamin: thank you
05:40Barleyi'm having problems with cursive not picking up my user.clj in the repl even though it's in the classpath
05:41Barleyanyone know if thre's some tricks to be made about it
05:41cflemingBarley: AFAIK it should just work
05:41cflemingBarley: One sec, let me trawl the issues, there was one talking about user.clj
05:43cflemingBarley: There are some comments there saying that someone had said it worked, but I can't find the person saying that - it must have been via email
05:44cflemingDoes it work if you invoke lein repl on the command line?
05:54GlenjaminBarley: are you using lein repl or your own nrepl server?
05:54Glenjaminoh right, that's what colin just asked
05:55Glenjamini found that when using my own nrepl server, i had to add (require 'user) myself
05:59Barleynrepl
05:59Barleyjust doing what cursive does by default
06:00Barleyactually there might be a problem with my user.clj after all...
06:00cflemingBarley: Does it work if you run lein repl on the command line?
06:00cflemingBarley: That's usually the first thing to try to isolate whether it's a Cursive problem or not.
06:02zot t
06:05godd2Any reason that (map #(println %) [1 2 3]) works in the repl, but not when I do lein run?
06:07Glenjamingodd2: because the repl prints out the result of each expression, which causes it to realize the seq
06:08godd2do I just need to remember that clojure won't realize things on its own?
06:09godd2cause I had the same issue of understanding with lazy-seq haha
06:09godd2thank you Glenjamin
06:10dysfunis there clojurescript source mapping support yet?
06:11Glenjamindysfun: yup, cljsbuild has some settings for it
06:11dysfunsweet!
06:18martinklepschIn a system similar setup to stuartsierra/component what would be a good way to setup a test system and were would be the right spot to stop it again?
06:18martinklepschwhen using fixtures the system is created for every namespace and the created connections block for some time
06:19Glenjaminmartinklepsch: is this for end-to-end acceptance tests?
06:20Glenjamini'd generally try not to create a whole system, and just do the component your testing + mocks for most tests
06:20martinklepschGlenjamin: if you mean that as in "running the complete set of tests" yes
06:20Glenjamini meant as in "a test that tests the complete system"
06:21martinklepschGlenjamin: yes
06:23Glenjamini don't really have a good answer then i'm afraid
06:24martinklepschok, just had an idea, maybe that works
06:24myguidingstarGlenjamin, have a look at this, too https://github.com/swannodette/lt-cljs-tutorial
06:40rritochCan someone take a look at my attempt to create a subclass relationship and advise what I'm doing wrong? For some reason I can't get the static subclass to show up.
06:40rritochhttps://github.com/rritoch/clj-grid-core/blob/master/src/com/vnetpublishing/clj/grid/lib/grid/webapp/filter_registration.clj
06:42rritochIn the repl I attempt to check the type of the Dynamic static class but I get an error that the static property is not found using (type FilterRegistration/Dynamic)
06:56m1dnightdo you have to forward declare macros?
06:56m1dnightwell, I know I have to, but does it work properly? I get argument errors, and they seem to be correct
06:59arav93Hi, is there anyone familiar with Typed Clojure?
07:00martinklepschGlenjamin: I ended up using a dynamic var for the test-system, and if it's missing it's created otherwise the existing one is used
07:01martinklepsch(checking that in a fixture)
07:03Glenjaminseems reasonable, are you not worried about sharing state between tests though?
07:04martinklepschGlenjamin: I am :D
07:04martinklepschwe'll see if we can find a clean way to reset the system
07:07ddellacostaarav93: what is your question?
07:33clgv~anybody
07:33clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
07:35clgvrritoch: I don't think you can create inner classes with gen-class. why would you want to do that anyway?
07:37rritochclgv: I just figured it would be easier if I could instantiate the class via (new parentClass/childClass)
07:37rritochclgv: This parentClass$childClass is a very odd syntax to be using
07:38clgvrritoch: huh?
07:38clgvrritoch: you'd need to change Clojure to modify constructor call syntax
07:39clgvrritoch: why don't you just generate two classes without the requirement that ones class name looks as if it was an inner class generated from Java?
07:42rritochclgv: I could probably do that, it would certainly make this code more readable
07:42rritochclgv: Before your assistance I didn't even know how to instantiate these subinterfaces anyhow, so there's a learning curve involved here.
07:44clgvrritoch: let's step an additional step back: what exactly are you trying to achieve? maybe you don't even need gen-class
07:45rritochclgv: I'm trying to add filter support to add JSP filter support to the web application framework I'm developing
07:46clgvrritoch: so in the code it seems you definitely have to extend a class and implement additional interfaces, right?
07:46rritochclgv: Yes
07:47clgvrritoch: do you need to access those classes by name from java?
07:47clgvrritoch: or is it sufficient to be able to construct instance via a function?
07:49rritochclgv: honestly I'm not sure. I've wrapped Tomcat's servlet context to provide the capability of serving JSP source files from OSGi bundles
07:50rritochclgv: Currently there's no support at all for filters, but I'm trying to add that support now
07:52rritochclgv: I believe, for things to function properly, I'll need to pull out all of the filters from the actual tomcat provided servlet context and wrap them all
07:54rritochclgv: Basically I just don't want the actual tomcat provided context to slip through because if it does than the filters won't be able to resolve OSGi resources
07:55clgvrritoch: I was aiming at the following - maybe using `proxy` suffices and you do not need "gen-class"
07:55rurumateis it possible to define a package in the repl?
07:55rurumate! package foo { }
07:56clgvrurumate: what is a package?
07:56clgvrurumate: you can define arbitrary namespace in the repl
07:56rurumateoops sorry I thought I in scala
07:56clgvif a scala package is the same as a java package I doubt that this is possible ;)
07:57rurumateclgv: currently learning scala for my next job
07:57rurumateno I think it's not the same
07:58clgvok interesting. I have no clue about scala ;)
08:05rurumateMy research so far: scala has anonymous functions. But an anonymous function has no way to refer to itself; recursive calls are only by function name. Hence you cannot do recursion in anonymous functions.
08:06rurumatealso no s-expressions; hence, no paredit. it's kinda sad
08:07clgvrurumate: http://stackoverflow.com/questions/6475001/how-do-i-write-recursive-anonymous-functions ?
08:08rurumateclgv: amazing, thanks
08:08ingsoccan't you assign the anon to a variable then pass the var reference as a param when you call it
08:09rurumatebut is that tail-call optimized
08:09rurumateI assume that awkward mess will also blow the stack
08:09clgvprobably
08:10clgvso the idiomatic choice is probably to have names for recursive functions
08:10rurumatestill a lot better than java where you're stuck with loops
08:11rurumate*while and for loops, that is
08:11rurumateoh, and the scala compiler will by default not complain when something can not be tail-call optimized
08:12rurumatethat's for you to find out. at runtime
08:12clgvnice :P
08:12m1dnightisn't there a flag to make it warn?
08:12clgvthat's a feature it shares with java then ;)
08:13m1dnightdoesnt java lack tco at all?
08:13rurumatethere's a @tailrec annotation
08:13rurumatem1dnight: yes that's why you're stuck with while and for
08:14m1dnightrurumate: I didn't know that
08:14m1dnightgood to know
08:14rurumateof course you can write recursion in java, but it will blow up the stack
08:14m1dnightyeah, I realize that :D
08:14m1dnightA guys on SO yesterday gave an answer for replcing string using recursion
08:15m1dnightit's pretty, yes. but it sucks
08:15SagiCZ1could someone clarify what is meant by TCO, and does java/clojure has it always/sometimes?
08:15ingsocrurumate: i spose it depends what you are doing. There will be cases where you have to be careful but it depends on what the function does.
08:15rurumateSagiCZ1: clojure does it whenever you do (recur)
08:15m1dnightSagiCZ1: TCO means that when you do a function like: (defn f([x] (dostuff) (f (inc x))))
08:15m1dnightyou call yourself. Since the recursive call to f is in last position it is *tail position*
08:16clgvrurumate: the interesting thing is that you hardly notice missing TCO in Java if you never used a functional language because you are writing loops instead of recursions most of the time
08:16m1dnight(defn f[x] (f (inc c) (println "something"))), here the call to F is not in tail position
08:16clgvyou usually notice the stack limitation as soon as you implement a backtracking algorithm for larger problems ... ;)
08:17m1dnightso basicly what you can do, is, when the last expression is call yourself (f), you can "forget" all the local variables in the scope of the caller and reuse the space on the stack. If you don't have this optimisation (like java) it will still remember all the variables on the stack
08:17m1dnightand you eventually run out of that
08:17clgvSagiCZ1: TCO = tail call optimization
08:17m1dnight=> blown up stack => not a happy programmer
08:18m1dnightlong story short (defn f[x] (recur x)) will run forever in clojure
08:18rurumatethis is tail position too:
08:18rurumate`(loop [x 10] (if (not (zero? x)) (recur (dec x)) 0))
08:18m1dnightpublic static int f(int x) { f(x);} will fail instantly
08:18clgvm1dnight: in contrast to (defn f [x] (f x))
08:18m1dnightyes, correct :)
08:19clgv,((fn f [x] (recur x)))
08:19clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval25/f--26>
08:19rurumate,(loop [x 10] (if (not (zero? x)) (recur (dec x)) 0))
08:19clojurebot0
08:19clgv,((fn f [x] (recur x)) 1)
08:19clojureboteval service is offline
08:19m1dnightRIP clojurebot
08:19rurumatenotice that the (recur) form is not the last argument to if
08:19clgvdamn. I though he had a timeout
08:19clgv,((fn f [x] (f x)) 1)
08:19clojurebot#<StackOverflowError java.lang.StackOverflowError>
08:19clgvdemonstartion finished ;)
08:20m1dnightI had to implement TCO in a compiler/evaluator for Lisp last year
08:20m1dnightI had hella fun with that :p
08:20m1dnightin C++ that is
08:20clgvin clojure you just get a for-loop on the jvm for simple cases...
08:20m1dnightYeah, I figured that something like that would happen
08:21m1dnightonly possible choice on the JVM, for what I nkow of it
08:21ingsocso, if I want to do something concurrently in clojure, like say, read on a socket while i am doing other things like make http request what is the general approach in clojure ?, some kind of async library, or threads with STM, or some other green thread user level library ?
08:21m1dnighta future, i'd say
08:21m1dnightthat's what they're for
08:21ingsocor actor library
08:21m1dnightan actor is not really something built for that, but you could, I guess :p
08:21m1dnightjust use a future
08:22ingsocok so futures just defer to some kind of thread pool ?
08:23m1dnightI'm not aware of the basics, no. But I do believe they do
08:23m1dnightThey are not green threads (i mean native OS threads)
08:23m1dnightI always confuse red/green threads
08:23m1dnightand you can check if they have been resolved as well
08:23ingsocyeah, when i was talking about the different options for concurrency threads meant OS scheduled threads
08:23m1dnightthey are very well suited for what you are asking
08:24m1dnightyou should use futures because they are more lightweight than an actual thread
08:24m1dnightunless it is something that will run through your entire program, then you might consider a thread
08:24m1dnightbut I'd prefer futures for lightweight work
08:25rurumateingsoc, core.async is also worth a look
08:29ordnungswidrigingsoc: if you have multiple things that need to be computed in parallel and you need to wait for all to finish at some point I guess core.async might be easiest thing to use.
08:30godd2ingsoc: here's a clear and concise overview of clojure concurrency and parallelism: http://www.braveclojure.com/concurrency/
08:30Glenjaminfutures are not lightweight in clojure afaik
08:30Glenjaminthey just spawn a thread in a threadpool
08:30edwThey're threads.
08:30edwBeat me.
08:31Glenjamineverything in the JVM runs off OS thread threadpools
08:31m1dnightbut that means they are more lightweight than an actual thread?
08:31rurumateGlenjamin: source on that?
08:31m1dnighta threadpool can hold a lot of threads, you can't spawn 10k threas in java
08:31m1dnightwell, you can try
08:32Glenjaminhttps://www.youtube.com/watch?v=yhguOt863nw
08:32martinklepschis honeysql a popular choice as plain SQL abstraction? https://github.com/jkk/honeysql
08:32edwBack in the old days the JVM used green threads but by the Twenty-first C. they were using native OS threads.
08:32ingsocthe impression i get is future is just a way to send a task to a thread pool then check on it and resolve the result later
08:32Glenjaminas i understand it, most JVMs have their Thread class be 1-1 with OS threads
08:32ingsocan OS thread pool
08:32Glenjamin^^ that is my understanding also
08:33ingsocasync is node like progreamming
08:33Glenjamineven core.async is just a threadpool
08:33ingsocwhere you use callbacks
08:33edwNode.js programming is backwards programming.
08:33ingsocyeah i know
08:33Glenjaminright, co-operative multi-threading across a threadpool
08:34clgvGlenjamin: that's wrong. futures do not spawn threads. there is a configure threadpool for futures whose threads are used for futures
08:34clgvso you can definitely spawn as many futures as your heap settings allow
08:34rurumateingsoc: uh, really?
08:34ingsocgodd2: interesting resource
08:34Glenjaminclgv: right, but the threads in that pool are OS threads, they just might already be there?
08:34ingsocthanks
08:34edwAnd they queue up? Huh. This is interesting information.
08:35ordnungswidrigingsoc: no callbacks necessary with core.async
08:35clgvGlenjamin: yeah the threads are reused. If I remember correctly futures use a fixed threadpool with n+2 threads where n is the number of processors determined from runtime class
08:36ingsocI assume there is a way to specify/configure the thread pool size for these things depending on usage characteristics
08:36clgvnope
08:36clgvonly for agents, sadly
08:36m1dnightso does that not imply that (.start (Thread. (fn..))) is heavier than a future..?
08:36clgvm1dnight: yes
08:36Glenjaminthat sounds familiar, does that mean futures can be considered "more lightweight" ?
08:36phillordwith lein release is there anyway to know what version number it will give to the release before you do it?
08:36Glenjaminright, because there's no thread creation cost
08:36m1dnightGlenjamin: of course.
08:36clgvyou can call futures lightweight with respect to this
08:36m1dnightI *think* futures are like callables
08:37ingsocit is only heavier in a sense that you have the overhead of thread creation before any work is done
08:37clgvm1dnight: they are java futures in fact
08:37ingsocbut it is still a thread that is doing the work
08:37m1dnightyeah, and program counters and memory as well, ingsoc
08:37Glenjaminhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java#L49
08:37Glenjaminthere's the pools
08:37Glenjaminand here's core.async's https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L17
08:37clgvyeah that's the one
08:37alexanderteI get an error (doesn’t seem to do any harm) when running lein. I installed lein with brew. anyone know how to get rid of it? output: /usr/local/bin/lein: line 9: [: too many arguments
08:37ingsocok so it is examining the number of cores
08:37Glenjaminnum cpus * 2 + 42 :D
08:38ingsocthen using that as a base for making a decision on what to run
08:38clgvlove those magic numbers
08:38m1dnightlol, why + 42? :D
08:38m1dnightthe answer to life?
08:39godd2dogecoin mining uses all your extra super-hyper threads
08:47ordnungswidrigalexanderte: can pastebin /usr/local/lein somewhere?
08:47ordnungswidrigalexanderte: can you pastebin...
08:47rritochclgv: Well, thanks again with your help accessing SubInterfaces, that eliminates the need for me to use any java in these libraries. The code is all still extremly sub-optimial, but it's slowly coming together. I need a way to deliver static resources (like javascript) from the OSGi bundles which is why I'm starting to delve into the filters.
08:48clgvalexanderte: I'd recommend a manual leiningen installation - it's no big additional effort.
08:48rritochclgv: I bypassed filter usage with a hack https://github.com/rritoch/clj-grid-core/blob/master/src/com/vnetpublishing/clj/grid/lib/grid/jsp/request_dispatcher.clj#L53-L69 since I didn't think I could instantiate filter subinterfaces.
08:50clgvrritoch: ok, let me cite clojurebot: "that's greek to me"
08:50rritoch,(inc clgv)
08:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: clgv in this context, compiling:(NO_SOURCE_PATH:0:0)>
08:50rritochhmm, not sure how that works
08:51rurumate,(let [clgv 10] (inc clgv))
08:51clojurebot11
08:51rurumatesee
08:52clgv:P
08:52clgvrritoch: it works without the ","
08:52rritoch(inc clgv)
08:52lazybot⇒ 37
08:53alexanderteordnungswidrig: clgv: will attempt with a manual install. thanks!
08:53rritochCool, we'll your my first inc, but I've been searching for months for a solution to this problem, justin_smith helped me earlier when he let me know about the $ syntaxx but that still wassn't quite enough to get the code functional.
08:54ordnungswidrig,clgv
08:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: clgv in this context, compiling:(NO_SOURCE_PATH:0:0)>
08:54rurumate,(def clgv 10)
08:54clojurebot#'sandbox/clgv
08:54rurumate,clgv
08:54clojurebot10
08:54clgv$karma ordnungswidrig
08:54lazybotordnungswidrig has karma 0.
08:54ordnungswidrigwhat?
08:54rritochEven in javaland I rarely ever had to work with subinterfaces, after looking at tomcat's code for awhile I truly believe they intentionally made the code incomprehensible.
08:54clojurebotwhat is <amalloy> just use juxt, it'll be great
08:54ordnungswidrighow embarrasing
08:54clgv(inc ordnungswidrig)
08:54lazybot⇒ 1
08:54rurumate,(def clgv (atom 10))
08:54clojurebot#'sandbox/clgv
08:55ordnungswidrig(inc ordnungswidrig)
08:55lazybotYou can't adjust your own karma.
08:55ordnungswidrighow lame
08:55rurumate,(swap! clgv inc)
08:55clojurebot11
08:56vijaykiranordnungswidrig: you can tweak by re-nicking ;)
08:59rurumateGlenjamin: super vid thanks
08:59clgv,(ns-unmap *ns* 'clgv)
08:59clojurebotnil
09:41m1dnighthrm, there is metadata for datastructures in Clojure
09:41m1dnightthat's new
09:41m1dnight(to me, that is)
09:42stuartsierram1dnight: It's rarely used except for compiler hints.
09:43m1dnightyeah, but once you start doing some esoteric academic stuff, it might come in handy
09:43m1dnightcan't think of use right now, but it's good to know they're there
09:44hyPiRionm1dnight: annotations on an AST
09:44m1dnightright, for example! :)
09:44m1dnightfor AVL trees it could be handy
09:46clgvmetadata on variables defined by a DSL is pretty handy
09:47hyPiRionclgv: yeah like, hmmm.... project.clj or something? :)
09:47clgvhyPiRion: for example. I also have a DSL for my projects that I was refering to ;)
09:50m1dnightrigh hickey really really does not like state
09:50m1dnighti'm watching his talk "concurrency in clojure" on ClojureTV
09:50rweirthat's unfair
09:51clgvm1dnight: huh? isn't the take-a-way to have sane state management to decouple state from time?
09:52clgvm1dnight: you are probably refering to java's (& co) inplace mutation as "state", right?
09:52m1dnightclgv: yeah, sorry I meant that yes
09:52m1dnightwell, the mutability part, that is
09:53m1dnightI'm sorry for wrong terms
09:53clrndimplicit state
09:53clgvm1dnight: well definitions depend on the context. that's why it is important to get the definitions straight before serious discussions ;)
09:54m1dnightyou are right :D
09:57m1dnightI just don't understand well how it is really that bad to determine "how your program got to a state" when you use OO style
09:58m1dnightIsn't it equally hard in clojure?
09:58m1dnightI cna imagine in pure haskell where all functions are pure
09:58m1dnightbut when your functions are no longer pure.. you have kind of the same issues, no?
09:58rweirno, because clojure requires you to explicitly state when you make global mutations, and provides tools to make them sane
09:59m1dnightbut you can still do IO and other side effects in functions
09:59m1dnightwhich make your functions unpure
10:00clgvm1dnight: yeah Clojure has no machanisms to enforce pure functions
10:00rweiryes, it's not about function purity
10:02clgvm1dnight: but usually you should try to have as much "pure" functions as makes sense since those are a lot easier to test
10:03m1dnightYeah, i certainly understand that :)
10:03dnolen_m1dnight: many of the design decisions in Clojure are less obvious if you haven't done a lot of multithreaded concurrent programming in languages with shared mutable state particularly in OO style. IMO Java Concurrency in Practice is a must read to really understand Rich's points.
10:03dnolen_m1dnight: "how you your multithreaded program got to state"
10:03m1dnightyeah, I've written the book down, he talks about it in his talk
10:04dnolen_m1dnight: so while yes you do have to minimize state and still think about it - you don't IME encounter the truly horrific scenarios when writing concurrent programs in Clojure.
10:09dnolen_m1dnight: even so all these principles work great in single threaded contexts too. Om and the various ClojureScript React bindings demonstrate this to good effect. So Clojure is less "State is Bad" and more "Unmanaged State is Bad"
10:46llasramHuh. Did the syntax for github-flavored Markdown Clojure syntax highlighting change recently?
10:48clgvllasram: a few months ago they changed their markdown backend
10:48llasramclgv: I must not have been paying enough attention...
10:49Bronsallasram: it's been broken for a couple of weeks
10:49llasramWeird. In like half of my project's .md files Clojure code isn't getting highlighting, but it is in other
10:49llasramBronsa: Ok, whew
10:49llasramGlad it isn't just me
10:49clgvoh that as well?
10:49llasramI've been writing in C for the past few weeks, which must be why I hadn't noticed :-)
10:51Bronsallasram: https://twitter.com/ztellman/status/529880281621491712
10:51clgvllasram: https://github.com/blog/1867-github-pages-now-runs-jekyll-2-2-0
10:52llasramBronsa: Iiiinteresting. Well, I'm sure they'll fix it soon
10:53llasramIt's probably because Clojure is so difficult to parse
10:53clgvyeah all this weird syntax ;)
10:53llasramExactly
10:54llasram,`#(~@@% %&)
10:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: p1__25# in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:02SagiCZ1,(let [{a :a :as m} 5] (println a m))
11:02clojurebot#<CompilerException java.lang.UnsupportedOperationException: Can't type hint a primitive local, compiling:(NO_SOURCE_PATH:0:0)>
11:02SagiCZ1can anyone help me here?
11:02SagiCZ1i thought that 'a' would be nil and 'm' would be 5
11:03n0n3suchhey
11:03nkozaSagiCZ1: you are trying to map-destructure an integer, that's not possible
11:03BronsaSagiCZ1: the fact that it might work for non-map values is an implementation detail
11:03hyPiRion,(macroexpand-1 '(let [{a :a :as m} 5] (println a m)))
11:03clojurebot(let* [map__78 5 map__78 (if (clojure.core/seq? map__78) (clojure.lang.PersistentHashMap/create (clojure.core/seq map__78)) map__78) m ...] (println a m))
11:03SagiCZ1 ,(let [{a :a :as m} [5 3]] (println a m))
11:03clojurebotnil [5 3]\n
11:04SagiCZ1i can easily destructure vector as map though
11:04justin_smithSagiCZ1: (pprint (macroexpand '(let [{a :a :as m} 5] (println a m))))
11:05BronsaSagiCZ1: "Map binding-forms allow you to bind names to parts of associative things (not just maps), like maps, vectors, string and arrays (the latter three have integer keys)."
11:05justin_smithSagiCZ1: that should make it a little more clear I hope
11:05hyPiRion,(let [{a :a :as m} (list 1 2 3 4)] (println a m))
11:05clojurebotnil {1 2, 3 4}\n
11:06SagiCZ1,(let [{a :a :as m} (list 1 2 3)] (println a m))
11:06clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: 3>
11:06SagiCZ1ok so i see that it can take a vector or list but only if it can make key value pairs from it
11:06justin_smith,(let [{a :a :as m} (list 1 2 :a 4)] (println a m))
11:06clojurebot4 {1 2, :a 4}\n
11:06SagiCZ1,(let [{a :a :as m} '(1 2 :a 4)] (println a m))
11:06clojurebot4 {1 2, :a 4}\n
11:07SagiCZ1this is equivalent right?
11:07Bronsawith lists it's a different case than with vectors
11:07Bronsalists get transformed into maps
11:07Bronsavectors don't
11:07SagiCZ1,(let [{a :a :as m} [1 2 4]] (println a m))
11:07clojurebotnil [1 2 4]\n
11:07SagiCZ1i see
11:07Bronsathis is to support keyword args via destructuring
11:08SagiCZ1i will need to remember this
11:20ordnungswidrigSagiCZ1: ,(let [{:keys [a b c] :or {a 1 b 2 c 3}} {:a 10}] [a b c])
11:20ordnungswidrig,(let [{:keys [a b c] :or {a 1 b 2 c 3}} {:a 10}] [a b c])
11:20clojurebot[10 2 3]
11:21Bronsaordnungswidrig: FYI lazybot can evaluate inline code ##(inc 1)
11:21lazybot⇒ 2
11:21ordnungswidrigSagiCZ1: in case you're fine with having the values bound to locals named after the keys
11:21ordnungswidrigBronsa: Ah, nice!
11:21ordnungswidriginc bronsa
11:21SagiCZ1ordnungswidrig: thanks
11:21ordnungswidrig,inc bronsa
11:21clojurebot#<core$inc clojure.core$inc@9defa>
11:21SagiCZ1its (inc Bronsa)
11:22ordnungswidrig(inc bronsa)
11:22lazybot⇒ 69
11:22ordnungswidrig(dec ordnungswidrig)
11:22lazybotYou can't adjust your own karma.
11:22ordnungswidrigha
11:22justin_smiththis also may work: $#(inc Bronsa)#$
11:22justin_smithmaybe Raynes did not turn that plugin on, but it works now
11:23justin_smithmaybe only for $commands though
11:24ordnungswidrighmm, can we have access to all users in the bot expr please? $#(->> users filter #(> (count % 10)) (map dec)) for excessively long nicks
11:24SagiCZ1whats the opposite of slurp? i though it was barf?
11:24SagiCZ1or is it vomit?
11:24ordnungswidrigSagiCZ1: use pr-str
11:24justin_smithSagiCZ1: spit
11:24SagiCZ1spit"
11:24afhammaddoes folder structure in a project have any significance to compiler? do folders need to represent namespaces?
11:24SagiCZ1thanks
11:25justin_smithwe should have all the bodily functions
11:25justin_smithfart would be for inserting something into mongodb
11:25ordnungswidrigafhammad: yes, this is necessary for the runtime to know where to look for the file
11:25SagiCZ1afhammad: afaik they need to correspond to namespaces like in ajva to packages
11:25SagiCZ1justin_smith: hah
11:25afhammadSagiCZ1: ordnungswidrig: is this documented anywhere?
11:26justin_smithafhammad: doc require (it's too big for this forum)
11:26ordnungswidrigafhammad: `load` will load the file from every location but the magic behind `requrie` depends on the ns coressponding with the path
11:26justin_smith$source require
11:26lazybotrequire is http://is.gd/SqKuAM
11:26justin_smithsee doc string in the above link
11:27afhammadthanks
11:27justin_smithafhammad: it's one of the most extensively documented clojure functions actually
11:28afhammadany idea if lighttable does anything fancy with loading namespaces? require doc says "skipping any that are already loaded" but I often get "already required" errors when re-evaling a ns
11:29justin_smith"already required" is a weird error
11:29ordnungswidrigafhammad: in lighttable?
11:29afhammadnot those words exactly
11:29afhammadordnungswidrig: yes
11:29justin_smithafhammad: unless you specify the :reload keyword, require will silently ignore args that are already loaded
11:29ordnungswidrigafhammad: or is it complaining a var is already refering to a different var?
11:30justin_smithafhammad: maybe "already refers to clojure.core/foo in namespace ..."
11:30justin_smiththat's different, it's about conflicting aliases, usually caused by :use or :refer []
11:30justin_smith,(def count 1)
11:31clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
11:31justin_smithhrmph
11:31justin_smithwell if you do the above locally, you can see that error
11:31justin_smith*warning
11:31justin_smithnot an error
11:32afhammadi think it might have been clojurescript file not clojure
11:32justin_smithit's never an error to call def again on something already defined though
11:36csd_Would someone mind giving me a code review on my first clojure project? https://github.com/prunes/amzn/tree/master/src/hackerati_interval_web_app
11:36csd_I'm especially looking for what I might be able to refactor
11:36csd_also, ban fluuflu
11:36stuartsierrajustin_smith: It is an error if the symbol was `refer`ed from a namespace other than clojure.core.
11:37justin_smithstuartsierra: oh, I guess I would know that if I used :use, thanks
11:37justin_smithafhammad: so that could be your issue
11:38Bronsathere's also a bug with namespace reloading
11:39Bronsahttp://dev.clojure.org/jira/browse/CLJ-1578
11:39afhammadjustin_smith: #<Error: Namespace "bcr.routes" already declared.> this is clojurescript when evaluating in lighttable
11:39Bronsatechnomancy: ban fluuflu please
11:39justin_smithafhammad: odd, I have never seen that
11:40Bronsatechnomancy: it's the usual spammer
11:40Bronsa<3
11:40afhammadjustin_smith: ah, looks like a google closure issue: at Object.goog.provide (http://localhost:3020/js/out/goog/base.js:248:40)
11:41atyzDoes anyone know of a plugin of some kind that reads a .env file or something when you cd into a directory and sets those environment variables?
11:42atyzKind of like rbenv does for ruby
11:42justin_smithatyz: clojure doesn't really have "cd"
11:43massiHi all !
11:43afhammadjustin_smith: i think he means in the terminal
11:43atyzjustin_smith: I wans't talking clojure specific
11:43atyzafhammad: knows what I'm talking 'bout
11:43justin_smithatyz: things like that tend to fall out of usage because they make exploits too easy
11:43ordnungswidrigatyz that depends on your shell
11:44justin_smithif I create the right env file, and a root user cd's into that dir, I can get root
11:44ordnungswidrigyou can use something like a precmd for that. but the security problems are a think
11:44ordnungswidrigjustin_smith: you never want to use rbenv or like that as root
11:44justin_smithalso, this is very shell specific, any solution would only work for a particular shell
11:44pepijndevosDoes Alex Miller hang out here?
11:44atyzjustin_smith: I suppose thats true, but in the end its kind of similar to setting them in your ~/.zshrc
11:45Bronsapepijndevos: yeah usually, his nick is puredanger
11:45justin_smithatyz: the difference is if I cd to /home/jackass/, I don't load jackass's .zshrc automatically
11:45pepijndevosah
11:45Bronsapepijndevos: he's not here constantly but frequently
11:45atyzjustin_smith: thats totally true, I only want to use this on my machine though
11:46justin_smithatyz: yeah, this is all a throwback to when more then one person used the same computer
11:46justin_smithbut that's what unix was designed for, so there we are
11:46atyzjustin_smith: to me, thats kind of like using my toothbrush
11:46technomancyjustin_smith: also for checking out random codebases
11:46pepijndevosBronsa, my local meetup has a hackathon, and this seemed fun to hack on, but it's assigned to him, so I don't want to duplicate work: http://dev.clojure.org/jira/browse/ASYNC-104
11:47pepijndevosI'll see if he turns up today...
11:47justin_smithtechnomancy: atyz: excellent point - someone could get root on your machine byt putting a dot file in a github repo
11:47Bronsapepijndevos: FYI he's usually quite responsive to emails
11:48pepijndevosIf I had his email... maybe google knows.
11:48justin_smith$mail pepijndevos you can also use this lazybot feature to leave a message on this channel
11:48lazybotMessage saved.
11:48atyzjustin_smith: that is true, I guess my want for teh convenience kind of outweighs that at this point :P
11:48pepijndevoseh, oh, I forgot about that.
11:48Bronsapepijndevos: https://github.com/puredanger he has his email here
11:50justin_smithatyz: anyway, it's up to you, but these are the reasons it isn't a standard feature, though it's been implemented multiple times. Feel free to find one of those implementations or make another one I guess, if you really don't care.
11:50afhammadDo you see the compilation error here (http://programming-enchiladas.destructuring-bind.org/swannodette/6385166)? I keep getting this in my project, even though compiler finds it first time. my code is unrelated to the link, just came across that searching for the exception
11:50afhammadspecificly with require-macros
11:51atyzjustin_smith: I understand why but I hadn't really considered cloning someone elses repository
11:52Glenjaminatyz: the other issue is if you move around a lot, you'll accumulate env vars
11:52justin_smithatyz: yeah it's funny, when you download an archive someone else made, that effectively makes your machine multi-user
11:52Glenjamini generally find having 'env.sh' and using `source env.sh` to get the vars is a good balance
11:53justin_smith(inc Glenjamin)
11:53lazybot⇒ 7
11:53justin_smithyeah, make it an explicit you opt-in on
11:53atyzGlenjamin: I assumed the plugin or whatever would have removed the variable when you cd out but that is a good comprimise
11:53atyzI think I'll do that
11:54justin_smithor call it e, and ". e" for those avoiding typing
11:54mgaareatyz: you could write a little bash script that checks if the target directory has an env file and executes it and alias `cd` to it or create something li ke a `cdenv` alias
11:54justin_smithmgaare: executing does not suffice, it would have to be sourced
11:55mgaarejustin_smith: yes, you're right, misspoke
11:55pepijndevosBronsa, thanks, email sent.
11:55Bronsanp
11:56justin_smithanyway, another, more subtle issue, with this kind of automation is that it's an implicit mutation of your execution environment, which makes it harder to understand what is going wrong as soon as anything breaks
11:57atyzjustin_smith: that is also true. This would also be pretty easily addressed if I were to move all my development work into docker containers
11:57justin_smithlike a program that breaks when run in directory /home/foo, but only if I have visited /home/bar earlier in the same shell
11:57atyzThen you only really have teh variables that you explicitly set
11:58justin_smithatyz: in that case, you would set your docker environment vars, not per-directory ones I would assume
11:58atyzCorrect
11:58mgaarenone of this really qualifies as a "good" idea, no
11:59technomancyI prefer to only use env vars in production/staging and keep the defaults in code
11:59mgaareI wonder if someone has a written a tool that lets you push/pop your environment on a stack
11:59technomancythat way you can change them without restarting the jvm
12:00atyzhttps://www.refheap.com/93153 <--- I've just started using those for one of my projects
12:00atyzBut technomancy is right, restarting could get irritating, however I'm hoping its not something you do frequently (set env vars)
12:01csd_Would anyone be able to do a code review please? https://github.com/prunes/amzn/tree/master/src/hackerati_interval_web_app
12:03justin_smithcsd_: I've been browsing it but not super closely, no issues to note yet
12:04csd_ context is, I have a pair programming interview coming up where I need to suggest either a feature to add or a refactoring to do, and I have no clue what to suggest
12:04csd_whatever it is, it should take ~15-20 mins to do, according to them
12:05SagiCZ1csd_: there is always something you can refactor.. though i am not saying the result would be better than the original
12:05justin_smithcsd_: a simple one might be using schemas for more function arguments
12:05csd_justin_smith: what do you mean?
12:06justin_smithcsd_: sorry, reading comprehension fail
12:06justin_smithsaw schema, thought prismatic/schema, but that's not what it was at all
12:06csd_oh, no
12:07justin_smithcsd_: test coverage is an easy, if boring one
12:07justin_smithalmost always applies
12:07dbaschcsd_: you should not be using floating point for money
12:07csd_testing is definitely something i am lacking in
12:08justin_smithdbasch: if your account balance is so large that you get rounding errors, you deserve the rounding you get
12:08justin_smith(kidding)
12:08csd_dbasch: this isn't for transactions so i think it's fine in this case
12:09justin_smithcsd_: it should be easy enough to use BigDecimal, or store things in integer cents though
12:09csd_oh you guys are talking about the clj datatype, not the sql datatype
12:10justin_smithcsd_: even in sql you should be using a decimal or integral type and not a float
12:10csd_yeah it's decimal in sql
12:10justin_smith(some dbs have floats)
12:11dbasch,(= 0.01 (- 0.36 0.37))
12:11clojurebotfalse
12:11dbasch^ csd_
12:11dbaschdo you still want to use floating points for money? :)
12:11justin_smith,(= 0.01 (- 0.37 0.36))
12:11clojurebotfalse
12:11csd_floats are weird
12:11dbasch,(= 0.01 (- 0.37 0.36))
12:11clojurebotfalse
12:11dbasch(that’s what I meant)
12:11justin_smithI figured
12:12csd_how is using BigDecimal any better than float though?
12:12dbaschand those are doubles
12:12justin_smithdbasch: if you have a whole 37 cents, you can afford to lose a penny :P
12:12dbaschcsd_: fixed point
12:12justin_smith,(= 0.01M (- 0.37M 0.36M))
12:12csd_i have to admit i don't know much about the underworkings of floats
12:12clojurebottrue
12:13justin_smithcsd_: oh you have a world of wat to learn
12:13dbaschcsd_: every developer must know how floating point works
12:13justin_smith,(= (/ 0.0 0.0) (/ 0.0 0.0)) ; csd_
12:13clojurebotfalse
12:13dbaschyou wouldn’t pass an interview at most companies I’ve worked at if you don't
12:13justin_smith,(let [a (/ 0.0 0.0)] (= a a)) ; csd_
12:13clojurebotfalse
12:14justin_smithdunno why, I find NaN infinitely amusing
12:14dbasch,(= Double/NaN Double/NaN)
12:14clojurebotfalse
12:15dbaschFloat in fact has very restricted applications right now
12:15dbaschthe default for floating point should be Double
12:16justin_smithand in clj it is (when not rationals)
12:16justin_smith,(/ 3 4)
12:16clojurebot3/4
12:16dbaschIf you need to use floating point values and save memory, Float is an option but not necessarily the best
12:16dbaschyes, in Clojure Double is (sanely) the default
12:16dbasch(dec Float)
12:16lazybot⇒ -1
12:17csd_well i imagine i can replace parseFloat with parseDouble with little difficulty
12:17Bronsa how cool would it be if that returned -0.9999999997?
12:17technomancyhaha
12:18justin_smithI'm thinking a set of "nicks" that should get sloppy float representation
12:18justin_smithtwo minute hack
12:19technomancy$timer 120 hack done
12:19justin_smithhaha
12:19technomancydid I do that right?
12:19justin_smith$timers
12:20technomancy=(
12:20justin_smithI wonder if he disabled that one
12:20justin_smithI know it works
12:21justin_smith$timer 0:2:0 hack done
12:21lazybotTimer added.
12:21justin_smith$timers
12:21lazybot1: hack done (1 minute and 56 seconds remaining)
12:22technomancytime's a-wastin'
12:23technomancyI guess that's better though; no ambiguity about whether integers are milliseconds or whatever
12:23lazybothack done
12:23dbaschcsd_: keep in mind that the above example *is* doubles
12:23dbaschsome numbers simply cannot be represented in floating point
12:24dbaschcsd_: if you want an in-depth explanation, https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
12:25csd_apparently there's a lot to know
12:27technomancy^ truth
12:27dbaschcsd_: you can start here http://stackoverflow.com/questions/1089018/why-cant-decimal-numbers-be-represented-exactly-in-binary
12:28justin_smith$timers
12:28justin_smithOK I am very close :)
12:29justin_smith(inc Float)
12:29lazybot⇒ 0
12:29anybot⇒ 0.9976645522002479
12:29justin_smithw00t
12:30dbaschjustin_smith: rename it to pentiumbot :P
12:31dbaschcannot believe the Pentium FDIV bug is 20 years old
12:32justin_smithhttps://github.com/noisesmith/lazybot/commit/b783b8370ae75ba1293a5de4187c6fa2bb05337c
12:32csd_I think I know what I'll propose we work on. Right now if you submit the same link twice, it will get scraped twice. I'll suggest we address that.
12:32justin_smithdbasch: I remember it too, though I was a weirdo that did not use computers until I hit my 20s
12:32dbaschjustin_smith: I started programming in 1983…
12:33dbaschat this rate I think I’ll be competent at it by 2150
12:34dbasch(barring singularities)
12:35justin_smithdbasch: better than the common case of reaching an early plateau of semi-competance and refusing to move forward after that early success
12:35dbaschjustin_smith: they look like plateaus but really they have a downward slant
12:36justin_smithdbasch: or red-queen style mountain ranges get born all around you
12:37dbaschI was part of a team of C developers who refused to learn Java back in 2000
12:38dbaschand more recently I worked with a Java team that refused to try any other jvm languages
12:38justin_smithtechnomancy: so I was about 6 minutes off in my 2 minute estimate - that's damn good for software
12:39technomancyindeed; I wish I could make estimates that good =)
12:40Glenjaminfactor of 4?
12:48ed-gHello everyone. I'm following an older core.logic tutorial and it uses 'defrel and 'facts what is the modern way to do this? is it pldb? if so how do I install pldb?
12:49edwI'm trying to locally install/deploy a lib I've forked locally and lein always seems to want to load it from clojars. How does one go about installing a lib in one's ~/.m2?
12:49justin_smithedw: lein install
12:50justin_smithit helps if you set a custom version-name that will be unique to your local version
12:50edwI was wondering if that would help.
12:50justin_smithed-g: it seems there is no concrete db imple in pldb https://github.com/threatgrid/pldb/blob/master/src/pldb/logic.clj
12:50CookedGryphonHow do I go about mapping over two sequences which might be different lengths, in such a way that the shorter of the two lists is padded out with nils
12:50justin_smith*impl
12:56ed-gjustin_smith: hmm. Also, it does not work with newest core.logic, since it depends on nonexistent fn core.logic/contains-lval?
12:56crack_userhello gyus
12:57crack_usersome one knows if there are a form to put defn and let together?
12:58dbaschcrack_user: you mean letfn?
12:58oskarkvcrack_user not sure what you mean
12:59crack_userlike: (defn func [value] (let [var1 var2] values()))
12:59crack_userI will search about letfn
12:59justin_smithCookedGryphon: this is one way that works https://www.refheap.com/93155
12:59{blake}CookedGryphon, Extend the shorter one with "repeat" and a default value that works.
13:00dbaschcrack_user: it looks like you want to destructure function arguments
13:00justin_smith{blake}: trick is which is shorter :)
13:00dnolen_ed-g: pldb is built in and replaces the old logic db stuff
13:00crack_userdbasch: yep, it is avaliable?
13:00{blake}justin_smith, Duh. The one with fewer elements. =P
13:00justin_smith{blake}: I am just saying there is some logic, and some pitfalls, to be found there
13:01dbaschcrack_user: http://stackoverflow.com/questions/12575161/destructure-parameter-of-a-clojure-function-while-keeping-the-original-value
13:01oskarkvcrack_user http://clojure.org/special_forms at the bottom
13:01ed-gdnolen_: fantastic, thank you!
13:01{blake}justin_smith, lol, yeah...just being a smartass.
13:03crack_userdbasch that is it, thx for yout time
13:04{blake}justin_smith, I wonder--you could extend both out infinitely but stop when you hit a state where both lists supply the default?
13:04mi6x3mhey clojure, any way to print a string wihtout the additional logic of pr / prn?
13:05hiredmanprint
13:06dbasch,(.write *out* "foo")
13:06clojurebotfoo
13:06mi6x3mdbasch: yes write now I use (.write) on a (io/writer .... ) manually
13:07dbaschmi6x3m: you can rebind *out* and use print
13:08mi6x3m,(require 'clojure.repl)
13:08clojurebotnil
13:08mi6x3m(clojure.repl/source print)
13:08mi6x3m,(clojure.repl/source print)
13:08clojurebotSource not found\n
13:08justin_smith{blake}: both? map is varargs
13:09mi6x3mdbasch: print just delegates to pr
13:09mi6x3maccording to my repl :)
13:12{blake}justin_smith, I didn't know "both?" was a thing.
13:12justin_smith{blake}: you used the word both
13:13justin_smithI am saying it could have 10 args, 2 of which are infinite
13:14mi6x3mdoes writer support :encoding ?
13:15{blake}justin_smith, I thought the premise of the original question was two sequences.
13:19CookedGryphonjustin_smith: {blake} thanks
13:19justin_smith{blake}: oh yeah, I "invented" the n input generalization, good catch
13:19justin_smithit can be much simpler if you know it's only two inputs
13:34mi6x3mwhat namespace you put utils in, Clojure?
13:34mi6x3myour utils *
13:35mi6x3mmisc.util?
13:36justin_smithgroup.util, where group is the umbrella owner of various libs in one project
13:40mi6x3mjustin_smith: i settled for misc.util :)
13:46technomancysorta apropos of the evolutionary algorithm discussion last night http://reverseocr.tumblr.com/
13:47justin_smithtechnomancy: oh yeah, that's a fun one
13:48technomancyI wonder what's the average ballpark number of revisions it has to go through
13:48technomancyI guess it's harder because there's no gradual fitness, just binary
13:48Glenjaminit could do per letter presumably
13:48technomancyoh true
13:48technomancy
13:49justin_smithbut many of those scribbles don't even have a matching letter count
13:49justin_smithit could play mastermind style
13:49aperiodictechnomancy: there's also the same concept applied to face-detection: http://iobound.com/pareidoloop/
13:50mi6x3mtechnomancy: OCRad recognizes those things?
13:50aperiodicwhich is a little more interesting because it does have a fine-grained fitness measurement
13:50justin_smithaperiodic: plus you get to watch it iterate
13:51justin_smitha version of the reverse ocr that showed fitness and iterations would be cool
14:01technomancymi6x3m: supposedly. wild, huh?
14:01mi6x3mtechnomancy: this project is quite entertaining to be honest
14:07justin_smithtechnomancy: pareidoloop is good at rendering old men, as seen near the shady areas near a pier on a foggy night
14:28sorenmacbethahoy
14:28sorenmacbethcan someone with a far larger brain than myself help me with a macro?
14:29sorenmacbethhttps://www.refheap.com/ab0413ca651f4fe2fa39915df
14:29kungisorenmacbeth: I can try. But my brain is not "far larger"
14:30Bronsasorenmacbeth: you're passing the symbol x to the genmethods macro
14:30amalloysorenmacbeth: you can't do that without eval. you want your macro to generate code at compile time based on values that exist at runtime
14:30sorenmacbethI understand that `fields` is being treated a symbol instead of a sequence, but I don't understand why or how to fix it
14:30Bronsasorenmacbeth: the feature of macros is that the arguments are not evaluated
14:30csd_Is there any way to make `cond` return nothing at all, rather than nil?
14:30hiredmanno
14:30amalloycsd_: nil (n): nothing at all
14:31hiredmanan expression must return a value
14:31sorenmacbethamalloy: ok, that makes sense. where do I need eval?
14:31technomancycsd_: you can throw an exception
14:31kungisorenmacbeth: first why not use k# and v# to generate symbols for k and v
14:31csd_i just dont want my list getting cluttered up with nils
14:31amalloytechnomancy: or enter an infinite loop!
14:31csd_guess i have to filter them out somehow
14:31Bronsasorenmacbeth: you'd need to make genmethods a function rather than a macro and eval the result
14:31amalloycsd_: use mapcat instead of map or whatever
14:31technomancyamalloy: hehe
14:31sorenmacbethok
14:32sorenmacbethmy good friend eval
14:32sorenmacbeththanks folks
14:32Bronsasorenmacbeth: not that I would recommend using eval if it can be avoided
14:32llasramCalm advice about `eval`
14:33sorenmacbethBronsa: yes indeed. I am unfortunately and old hand at abusing eval
14:33sorenmacbethI was hoping to avoid it
14:33sorenmacbethbut once more into the breach
14:33amalloyindeed. do you really need this stuff to be determined by the shape of runtime objects, or do you know ahead of time what fields you'll be setting in various places?
14:34sorenmacbethamalloy: has to be at runtime I'm afraid
14:34llasramsorenmacbeth: why OOC?
14:34Bronsasorenmacbeth: a way to avoid using eval would be to use clojure.lang.Reflector/invokeInstanceMethod rather than the . form
14:35sorenmacbethBronsa: I saw that in a few example around the web. could you give me a concrete example?
14:36Bronsasorenmacbeth: `(. ~obj ~(symbol "method") ~@args) becomes `(clojure.lang.Reflector/invokeInstanceMethod ~obj "method" (into-array ~args))
14:37Bronsasorenmacbeth: note that this will use reflection each time the method is invoked -- it's going to be slow
14:38amalloyBronsa: IMO it's easier to just use eval anyway. it's not immensely slower, and it's in a place where you clearly don't care about performance anyway; and it's easier and more readable than doing reflection, because it looks like code you're used to seeing anyway
14:39sorenmacbethfwiw I'm just going to use eval, but I appreciate the example Bronsa
14:41Bronsait would be nice if `.` automatically compiled to a reflective runtime call if the method/class was not available at compile-time
14:42Bronsabut that would have issues with locals I guess -- (let [toString 'hashCode] (. "foo" toString))
14:42mi6x3mGiven that I am writing a viewer for about 30 examples showing various GUI stuff. I added a function to export separate Leiningen projects for all the demos but the code is dynamically generated and thus includes many dependencies which won't be needed by every example.
14:43mi6x3mis this approach better than generating >30 mini Leiningen projects?
14:43mi6x3mmanually writing them I mean vs. automatically generated from the viewer
14:50m1dnight_I'm going to make a chess engine in clojure I think
14:50m1dnight_Just not sure how yet
14:50m1dnight_I want to make it a pearl of functinoal programming
14:51jjmojojjmojo8 x 8 cylinders
14:51justin_smithm1dnight_: how much have you used clojure and / or fp so far?
14:53SegFaultAXBoard games are actually really good for FP languages.
14:54amalloySegFaultAX: well. it's very easy to write a correct algorithm, but if you end up actually wanting performance at some point you are in rough shape. performance matters a lot for board game AIs
14:55SegFaultAXamalloy: What I meant was it's trivial to model board games as pure functions over immutable data.
14:55amalloySegFaultAX: right. i think i was agreeing with that, while pointing out that there are some problems too
14:56m1dnight_justin_smith: had a course @ uni last year in haskell, doing my thesis in clojure
14:56dbaschamalloy: it’s not that easy, e.g. I wouldn’t say writing a program that wins at tic-tac-toe is trivial
14:56m1dnight_and had a course on algorithms an datastructures (whole year course) in lisp
14:56m1dnight_so I dare say I know wha ti'm doing
14:56m1dnight_I just have to iterate over code a few times until it's clean
14:57SegFaultAXdbasch: Why? There is a very simple perfect algorithm for TTT.
14:57amalloydbasch: i can't tell if you're just messing with me because TTT is solved, and a draw
14:57amalloyor if you actually think that writing a good TTT AI is hard
14:57SegFaultAX"AI"
14:58dbaschSegFaultAX: amalloy what I mean is, if you give someone a computer and tell them “write me a program that wins at tic-tac-toe” it will probably take them a while and they will make lots of mistakes even knowing that the algorithm itself is trivial
14:58justin_smithartificial intelligence is easy, but just try artificial common sense
14:58m1dnight_Right, i'll need an AI player too
14:59m1dnight_dangit
14:59m1dnight_I could do forkjoin though and use some simple metric of probability
14:59amalloySegFaultAX: *shrug* the term clearly applies, even if you think it's trivial
14:59amalloym1dnight_: that is like...thirty more levels of complexity way before you need to think about that
14:59dbaschamalloy: btw, of course I know that TTT was solved in 2008 by Deep Blue
14:59m1dnight_I know
15:00m1dnight_I'm just not sure how to do it yet
15:00m1dnight_I know I'll have a board and functions that make moves
15:00m1dnight_and return a modified board
15:00m1dnight_(defn make-move [piece white/red board]..)
15:00m1dnight_I think that should do it
15:01m1dnight_In haskell I could pattern match on the piece though, and write logic for each piece
15:01m1dnight_wait a minute no, a player tells the proram "move to that point" and I need to check if it's a valid move
15:01justin_smithm1dnight_: you can use multimethods / protocols that each piece implements for a similar logic
15:01m1dnight_you would use objects? or what do you mean by "that each piece implements"
15:01amalloym1dnight_: i would suggest modeling the board and ways to make moves first, then write a basic minimax algorithm that works for any game (taking in a function for producing legal moves from a position and determining whether a position is won), then start refining that with alpha-beta pruning or other simple stuff
15:02justin_smithm1dnight_: sorry, extended for each piece
15:03amalloylike, (defn minimax [position legal-moves make-move find-winner] ...) is a super-general function that will be very useful to write
15:03csd_why is () truthy? this trips me up so often
15:03amalloycsd_: because it is neither false nor nil
15:04csd_idk, imo everything empty should be nil/false
15:04justin_smithcsd_: seq fixes this ##(seq ())
15:04lazybot⇒ nil
15:04dbaschcsd_: that would be a bad idea
15:04amalloycsd_: that's a very expensive decision to make
15:04csd_how so?
15:05amalloywell it makes every call to if a lot more expensive
15:05dbaschcsd_: you’d have to special-case the empty sequence everywhere
15:05amalloyright now, (if x then else) involves two pointer comparisons
15:06amalloyyou instead want it to involve several polymorphic dispatches, some instanceof checks, and at least one allocation
15:06csd_ill just take your word for it :)
15:07amalloyit's not semantically clearer either. you get nil punning back, which is kinda nice, but you lose the ability to distinguish between {} and nil without some mental gymnastics
15:08amalloyman, i am looking back at the minimax implementation i wrote when i was new to clojure, and it is weird
15:08amalloyhttps://github.com/amalloy/ddsolve/blob/master/src/ddsolve/ai.clj#L53-L82 if anyone would like to gawk
15:09hyPiRionoh mutation
15:09jjmojojjmojoamalloy, it's good you put that TODO note in there
15:09m1dnight_amalloy, yeah, I've done a minimax before for tictactoe I believe
15:09m1dnight_I had fun doing that
15:09amalloyjjmojojjmojo: hey, there's still time. tomorrow hasn't arrived yet
15:10jjmojojjmojo:D
15:10csd_amalloy: is that bridge?
15:11amalloycsd_: it is. you can see some evidence of that in like... https://github.com/amalloy/ddsolve/blob/master/src/ddsolve/mechanics.clj#L31 and https://github.com/amalloy/ddsolve/blob/master/src/ddsolve/core.clj#L18
15:12csd_yeah core.clj is what made me wonder
15:12amalloyanyway, this ended up being a correct algorithm but many orders of magnitude too slow
15:13amalloylike i could analyze a six-card ending i think, if i was patient, but seven would take hours, and anything beyond that was probably going to blow the heap or something stupid like that
15:14amalloywhereas good computers can analyze full 13-card hands in under a second, or a few seconds for particularly complicated deals
15:20dbaschthe real challenge is writing an algorithm that can win at chessboxing
15:20llasramdbasch: tell me more...
15:20dbaschllasram: http://en.wikipedia.org/wiki/Chess_boxing
15:20llasramFascinating
15:21m1dnight_wu tang :D
15:21amalloydbasch: ITYM http://www.youtube.com/watch?v=TJy2kIWtyvQ
15:22amalloyactually that video has a bunch of fluff at the beginning. there are more action-packed ones to be found
15:22dbaschsomeone should make BattleChessBots
15:23llasramsomeone: you totally should
15:23dbasch(inc someone)
15:23lazybot⇒ 2
15:23amalloydbasch: anyway, the algorithm for chessboxing is easy. 1) get a factory robot to enter the match 2) have it stall through the chess phase; 3) punch your opponent hard enough to rip a car in half
15:24dbaschamalloy: what if your opponent is a concrete wall?
15:24amalloypretty sure that's not a problem for numerous factory robots
15:24amalloyor enter a wrecking ball, if you know who you'll be facing
15:24llasramHow good are factory robots at precisely punching fast-moving human-sized objects these days?
15:25turbofailgiven a sufficiently fast fist i'm sure a robot will have no problem with that
15:25dbaschamalloy: if we’re going to make assumptions, let’s win it for the special case where your opponents are very smart raccoons
15:25m1dnight_Darpa probably can hook you up with a good machine
15:25m1dnight_Have you seen those robots?!
15:26justin_smithm1dnight_: attach a chess-piece mover to bigdog
15:26m1dnight_chess-piece mover :D :D :D
15:26justin_smithmaybe strap watson on for fun
15:27SagiCZ1wow i missed that evolutionary algo discussion, gotta check it out
15:27SagiCZ1~lazy-logs
15:27clojurebotlazy-logs is http://logs.lazybot.org/
15:27dbaschBigDog vs Watson: The Movie
15:27justin_smithm1dnight_: maybe mash it up with this robot https://www.youtube.com/watch?v=4WX58CZwyiU
15:27amalloyman, speaking of darpa. i saw yesterday that they think "a computer that can write code itself" is an problem can be solved with just $11M, presumably because none of the companies who can afford $11M have ever thought of doing this themselves
15:27justin_smithdbasch: LOL - and they team up like in a jodorowsky movie in the end
15:27annelieshi sweeties
15:28justin_smithhello
15:28m1dnight_hahaha, that ketchup robot is the most funny robot ever
15:28anneliesis core.typed used in any significant projects?
15:28anneliesI like static typing but I have never seen core.typed used.
15:28m1dnight_https://www.youtube.com/watch?v=CzXMoo4nlUM
15:28dbaschamalloy: who wouldn’t want a Neural Turing Machine? I’d support that on kickstarter just for the name
15:28m1dnight_This one with, as said, watson strapped on it
15:28justin_smith(inc m1dnight_)
15:28lazybot⇒ 1
15:29m1dnight_and a ketchup bottle too
15:29m1dnight_because why not
15:29justin_smithright
15:29justin_smiththrows a brick at you, beats in in chess, and then spurts ketchup on you while you are down
15:29justin_smithspinning its hulk arms
15:29m1dnight_extra humiliation :D
15:29dbaschjustin_smith: or it could be a reboot of Star Wars, with Watson as C3P0 and BigDog as R2
15:30amalloyjustin_smith: it later turns out that the whole fight was as real as pro wrestling, and the ketchup is there to hide the lack of blood
15:30justin_smithright
15:31Bronsaannelies: I believe circleci is using core.typed
15:32technomancyllasram: http://i.imgur.com/PSaJyLu.gif
15:32Bronsaannelies: you might want to ask that question to ambrosebs though, he surely can answer that better than anybody else
15:32justin_smithannelies: this search result may be useful http://crossclj.info/fun/clojure.core.typed/ann.html
15:32grilix_sorry guys, is there any way to tell leiningen where to install the dependencies?
15:33justin_smithI assume everyone using core.typed is calling ann at some point
15:33anneliesjustin_smith: ohh nice
15:33anneliesdanke
15:33anneliesdat website
15:33amalloygrilix_: you mean you don't like ~/.m2, or something else?
15:33justin_smithcrossclj has an odd UI, but amazing info
15:34Bronsa(inc crossclj)
15:34lazybot⇒ 1
15:34justin_smith(inc crossclj)
15:34lazybot⇒ 2
15:34justin_smithwe should add a crossclj plugin to lazybot
15:35Bronsaand by we you mean you right? :P
15:35justin_smithBronsa: exactly
15:35grilix_amalloy: yeah, my project would run on a vm with a volatile fs (docker), the code is on a shared folder
15:35justin_smithI was using the "royal we"
15:35{blake}We are not amused.
15:39amalloyhuh, crossclj is interesting
15:41grilix_oh.. setting the ":local-repo" on project.clj seems to work, I'll go with that, thanks!
15:41noncom|2where do i get the version of clojure that runs on android ?
15:41noncom|2i just need the bare clojrue.jar i guess...
15:41Bronsahttp://crossclj.info/ns/org.clojure/core.typed/0.2.72/project.clj.html#outdated uuuh nice
15:42justin_smithoh sweet
15:42justin_smithI am going to be playing with crossclj.info more
15:43justin_smithand maybe we can crowdfund a usability study and a UX expert...
15:43TimMcgood stuff
15:43Bronsaheh
15:43TimMcJust needs more spacing.
15:44joobusnoncom|2: have you looked at lein-droid? I've used it. Using the clojure.jar on android is something you shouldn't have to do, i don't think.
15:44justin_smithTimMc: spacing, clear differentiation of types of content, differentiation of actions vs. information vs. information with optional actions related to said info...
15:44joobusnoncom|2: https://github.com/clojure-android/lein-droid
15:44razum2umanyone knows best practice to test if I need "at least one expectiation to be true" if I'd write (expect true (some? pred coll)) it will fail with a very unclear message "expected true. got false"
15:44noncom|2joobus: well, i used clojure like that before, in an AIDE project :) now i am trying to embed it as a java lib in a java app :)
15:45{blake}Arcadia is in alpha. But it targets the Unity (game) system which targets Droid (and iOS, OS X, Linux, etc.).
15:45noncom|2btw, is #clojure-android dead ?
15:46noncom|2or is there any new IRC chat for that ?
15:46joobusnoncom|2: the lein-droid repo was updated 2 days ago.
15:47joobusoh, nm, you were talking about the irc channel...
15:48noncom|2yeah.. i know that lein-droid is fine, but i wanted the jar solelu :) maybe i gt hte jar from a lein-droid project then :)
15:50joobusnoncom|2: https://clojars.org/org.clojure-android/clojure
15:50joobusnoncom|2: i think that is what lein-droid is using
15:50noncom|2joobus: oh, right! thanks! :)
15:59joobusanyone going to clojure-conj in DC on Nov 20-22?
15:59joobushttp://clojure-conj.org/
16:03{blake}Anyone know if lein-fruit works for iOS? Or the level at which it works, rather?
16:10m1dnight_~lazylog
16:10clojurebotI don't understand.
16:10m1dnight_~lazylogs
16:10clojurebotPardon?
16:10m1dnight_huh
16:10m1dnight_give me the logs! :p
16:10m1dnight_~lazy-log
16:10clojurebotPardon?
16:10justin_smith$lazy-logs
16:10justin_smithhrm
16:11m1dnight_~lazy-logs
16:11clojurebotlazy-logs is http://logs.lazybot.org/
16:11m1dnight_aha!
16:15afhammadis there a way to run all project tests from the repl?
16:18justin_smithafhammad: load all namespaces that define tests, then run clojure.test/run-all-tests
16:18justin_smithafhammad: just remember to force reloading of the test namespaces if you edit the tests before you run the next time
16:21afhammadjustin_smith: hmm ok. So theres no script that does this yet? i'm thinking loop through test folder, load namespaces and run them and i guess handle reloading after theyr run
16:22justin_smithafhammad: better to ensure they are reloaded before running
16:22afhammadtrue
16:23justin_smithafhammad: you could look at what lein test does
16:23afhammadjustin_smith: yes good call
16:23justin_smithbonus - if you did it that way you could use test-selectors too
16:24justin_smithafhammad: in a repl I usually have a specific test namespace I care about
16:24justin_smiththen I would use lein test to make sure all of the others still pass, once that ns is figured out
16:24justin_smithafhammad: in fact, I often just repeatedly run one test
16:25justin_smithwith its fixtures, of course
16:25afhammadjustin_smith: yeh thats probably more common
16:26justin_smithbeing a lisp, of course we all have our own special-snowflake unique workflow we prefer :)
16:31csd_note to self.. when translating from common lisp, do not try to keep the alists
16:34mdrogalisIs there an idiom, other than reduce/reduced, that invokes a function repeatedly until the last element out of that collection matches a predicate and returns a seq?
16:35llasrammdrogalis: maybe `iterate` (with `take-while` or such)?
16:35justin_smithmdrogalis: take-while?
16:35mdrogalisjustin_smith: take-while doesnt allow function invocation.
16:36mdrogalisllasram: That miiight work.
16:36mdrogalisYeah, I think that does it. :D Thanks.
16:36justin_smithmdrogalis: right, you would use iterate or repeatedly or whatever
16:36hiredmanit is called unfold, and doesn't exist in clojure.core but I am pretty sure there are implemenations around
16:36mdrogalisNo no, justin_smith. llasram got the points this time. :(
16:37justin_smithmdrogalis: hah
16:37mdrogalisMakes sense hiredman. Pretty sure I ask this question every 5-6 months.
16:37hiredmanhttp://www.enrico-franchi.org/2011/08/clojure-unfold-and-anamorphisms.html
16:38gfredericks~rest is uncons
16:38clojurebotA nod, you know, is as good as a wink to a blind horse.
16:39hiredman~botsnack
16:39clojurebotthanks; that was delicious. (nom nom nom)
16:39mdrogalisHeh
16:45amalloy$whatis logs
16:45lazybotlogs is is http://logs.lazybot.org/irc.freenode.net/%23clojure
16:46amalloyalso works. i just told clojurebot about ~lazy-logs because SagiCZ1 said he couldn't possibly remember a two-part command or something like that
16:50{blake}O
16:52{blake}Whoops. I'm trying to figure out how my app is linking in Bootstrap. I thought I understood but I'm confused again. It's pointing to /bootstrap/css/bootstrap.css, e.g., which is a directory that doesn't exist.
16:52{blake}I had been using the bootstrap clojure library which wraps some middleware around the routing function, which I believe is what captures references to bootstrap and points them to the right place.
16:53{blake}But it was out of date, so I took it out and uses the latest Bootstrap manually.
16:53{blake}And it works locally, but when I WAR it up and deploy, it can't find /bootstrap/css/bootstrap.css anymore.
16:53hiredmanhttps://gist.github.com/hiredman/4d8bf007ba7897f11594 it has been forever since I've done anything in my scratch.clj
16:54hiredmankind of a neat circle there, unfold is a recipe for creating a thing to be folded or something
16:55{blake}hiredman, That's cool.
17:04aaelonycan anyone recommend a clojure encryption library that can decrypt AES-256-CBC ?
17:12{blake}Hmmm. So, for some reason, "public/resources/bootstrap" in my clojure directory becomes "/WEB-INF/classes/public/bootstrap" in the uberwar.
17:13technomancyI've never used war files, but typically resources/ is the top-level directory of the project, not public/
17:16sdegutisDoes anyone in here use paredit.vim? I'm having some weird issues with it changing keybindings that don't seem to be documented, and I'm wondering if it's a known/unwritten issue.
17:16{blake}technomancy, Well, at the top level (looking through a decompressor) there's META-INF and WEB-INF. Then classes and lib underneath with a web.xml file describing the servlet. lib seems to contain direct includes (clojure, clout, compojure, hiccup, etc.) as well as my code and a "public" directory.
17:17{blake}Then "public" contains bootstrap. This is from my original structure which has resources/public/bootstrap.
17:17aperiodicsdegutis: I do. I haven't noticed that, but that could just be the keybindings I happen to use. What are you seeing?
17:18technomancy{blake}: that's beyond me; sorry
17:19{blake}technomancy, No problem.
17:19sdegutisaperiodic: Oh, I see. It's actually because I swapped ; and : that's causing it. Never mind, thanks anyway :)
17:20m1dnight_Hmm guys, I'm in a bit of a lock. I have modeled basic actors in clojure but now I'm stuck on how to build a list of actors such that I can address them with (send-message :actor_name :message)
17:20m1dnight_I should need something like a global variable that contains a hashmap of :actor_name mapped to an object reference (a blockingqueue in java)
17:21m1dnight_what do you guys recommend?
17:21m1dnight_so that when a user types (send-message :actor_name :message) it expands to a lookup in that variable by means of a macro
17:22noonianyou could do that with a function, don't need a macro
17:22m1dnight_e.g., expand to (let [queue (lookup-actor :actor_name)] (send-message queue :message)
17:22m1dnight_but the user should not have to declare the global address list of actors and stuff
17:24m1dnight_I want to hide all the bookkeeping and dirty work for using the actors from the user
17:24amalloywhy are you building an actor system from scratch? it is not an easy thing to do well, and it's hard to see what advantage you get. if you are really sold on actors, i'd suggest picking a language/ecosystem that loves actors (ie, erlang)
17:24m1dnight_amalloy: for my thesis
17:25m1dnight_so no, picking a language is not the solution :p
17:25m1dnight_i just mimic the erlang actor model in my implementation
17:25amalloythat's not really an answer. is your thesis "building an actor system in clojure"? if it's anything else, the i don't think building an actor system in clojure is a good way to do it
17:25m1dnight_amalloy: yes, it is.
17:26SagiCZ1i have a directory structure with lots of zip files, how could i extract them all while keeping the directory structure? any ideas? i wrote some clojure script for this, but it corrupted about 30% of the files for some reason
17:26justin_smithSagiCZ1: clearly the solution is a new clojure program without any bugs in it
17:27amalloySagiCZ1: are you trying to do this in clojure for some reason? i'd just do it with `find`
17:27SagiCZ1amalloy: i am just trying to do it somehow
17:27SagiCZ1could you elaborate the find method?
17:28m1dnight_find -type f -name "*.zip" -EXEC unzip {} \; something like that
17:28hyPiRion,(find {:a :b} :a)
17:28clojurebot[:a :b]
17:28m1dnight_oh, I was thinking about linux commands :p nvm
17:29{blake}Curiouser and curiouser: If I create a JAR file and run it on my server, the Bootstrap works out just fine. If I generate a WAR and put it in my jboss-as, it can't find the Bootstrap.
17:29SagiCZ1im on windows
17:29m1dnight_nvm me :p
17:29amalloySagiCZ1: oh man. windows. you are on your own, mate
17:29m1dnight_You could do it with an iso file though
17:30m1dnight_the link is on ubuntu.com somewhere :p
17:30SagiCZ1ok, and maybe the clojure way? what would be a way to unzip a file? i am using java.util.ZipFile but i suspect it for bugs
17:30m1dnight_but SagiCZ1 I don't understand how you could alter your dir structure when unzipping?
17:30{blake}SagiCZ1, Bugs in Java's ZipFile seem unlikely to me.
17:31SagiCZ1m1dnight_: imagine a file directory tree several levels deep and at the leaves, there are single files, each packed in its own zip archive.. i need the exact same thing, except all the files unpacked
17:31SagiCZ1*leafs
17:31SagiCZ1or leaves? idk
17:31amalloyleaves
17:31m1dnight_leaves
17:31m1dnight_FIRST
17:31amalloySTRIFE
17:31m1dnight_euhm, I'm thinking
17:32SagiCZ1m1dnight_: please do
17:32m1dnight_So you would want the files in the directories and remove the zip files?
17:32m1dnight_or have copy of the dir tree with a different root path?
17:32dvathI'm trying to call a Java method Values(java.lang.Object... vals) in Clojure as (Values. [{:foo 5}]) and it tells me that I cannot convert a vector to a java.lang.Object. Where can I find information for converting between the two?
17:32SagiCZ1m1dnight_: thats not important, both approaches are fine by me
17:32m1dnight_create a function that unzips a file at a certain path
17:32amalloydvath: you want (object-array [{:foo 5}])
17:32m1dnight_test it to see if it works fine, if so, your unzipping is safe
17:32amalloyvarargs are arrays
17:32SagiCZ1{blake}: btw, thanks for that information, i will focus on my code in that case
17:33SagiCZ1m1dnight_: and then?
17:33dvathamallow: I will give that a shot. Thanks!
17:33m1dnight_next, I would (dont shoot me guys) create function that returns a lazy list of all the zip files found (including their path, that is) and extract them to their location
17:33amalloydvath: also, your client will tab-complete usernames. you need never misspell a name again!
17:33m1dnight_shouldnt be too hard, I guess
17:33dvathamalloy: Haha thanks!
17:33SagiCZ1m1dnight_: yeah i was traversing the structure recursively using DFS and joining the path from the parent nodes as i went, but as i think about it, your approach would be whole lot easier
17:34m1dnight_yeah, how you traverse your tree doesn't really matter
17:34amalloySagiCZ1: see also file-seq
17:34m1dnight_just make sure you build up a list of proper paths
17:35SagiCZ1amalloy: wow, i was reinventing the wheel last 5 hours and came up with a square anyways.. thanks
17:35m1dnight_Yeah, disclaimer: I'm telling you base don what I know from clojure. I'm not a pro.
17:36m1dnight_based*
17:36SagiCZ1m1dnight_: thanks for your thoughts, very helpful
17:38lazylambdafellas, I have a problem with this https://www.refheap.com/93175. I get an exception when I call the fibs macro. Any ideas?
17:39amalloywhy in the world is fibs a macro?
17:40lazylambdaamalloy, I want to generate the numbers at compile time
17:40lazylambdaI am just playing around with macros
17:40lazylambdastill learning them
17:41amalloylazylambda: okay, so take as background the advice that this is a bad thing to actually do
17:42pdkcan't the clojure compiler fold constant expressions at compile time
17:42amalloybut the issue is that you are indeed correctly computing some fibonacci numbers, and your macro is expanding to (0 1 1 2 3)
17:42lazylambdaamalloy, I understand. I know that macros shouldn't be used when functions would do, I am just experimenting.
17:42amalloyand then it's like...what happens next is the same as if you typed (0 1 1 2 3) into the repl. it blows up because 0 is not a function
17:42nooniantake returns a lazy sequence also, try (into [] (take ...
17:43amalloynoonian: that would fix the immediate problem but not really help with understanding it
17:43noonianyou need to return something that wont throw an exception when its compiled as code
17:43mj_langfordI have a 3.2 MB file full of code generated from PDF->HTML->hiccup. Any idea how to make this into something prettier and easier to excerpt out of?
17:44noonianamalloy: well, you already pointed out why it throws an exception
17:44mj_langfordNot even confronting the semantic parts, I'll get to those, just is there a formatting library that helps with these sorts of "code as data" problems?
17:44pdkalmost makes you yearn for xslt
17:44amalloyfair enough, noonian
17:45lazylambdawhat I understand so far is that (fibs 5) is expanded at compile time to (0 1 1 2 3), I tested that with (macroexpand-1 '(fibs 5)). But I still don't understand why it's throwing an exception when I call (fibs n) in the code?
17:45joobusmj_langford: what language is the code in?
17:45Bronsa,(1 2 3)
17:45clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
17:45mj_langfordHiccup is a formatting library that generates html. It's a clojure library.
17:45Bronsalazylambda: invoking a number as a function doesn't work
17:46amalloylazylambda: because when you macroexpand something, it next gets evaluated
17:46joobusmj_langford: so it's 3.2mb of hiccup?
17:46mj_langfordYou got it :D
17:46amalloyand evaluating (0 1 1 2 3) is not good news
17:46lazylambdaamalloy, ah I see..so it's not actually returning a quoted list?
17:46mj_langfordI want to manually go in and extract some parts, but man, this is going to be rough if completely unformatted.
17:46m1dnight_,`'(1 2 3)
17:46clojurebot(quote (1 2 3))
17:46amalloylazylambda: you macroexpanded it: you tell me. do you see a quote in the value that's returned by macroexpand?
17:47noonianlazylambda: the evaluation semantics of unquoted lists in clojure is to treat the first item as a function, and try to apply it to the rest of the list
17:47joobusmj_langford: yeah, i got nuthin...
17:47Bronsalazylambda: wrap the take call with a (list 'quote ..), see how macroexpansion changes and what happens invoking the macro
17:47m1dnight_,(eval `'(1 2 3))
17:47clojurebot(1 2 3)
17:47m1dnight_there we go
17:48Bronsa(do we /invoke/ a macro?)
17:48m1dnight_eval is what happens after your macro expansion, so you hae to make sure it evaluates to a list, instead of to an application
17:48annelies(Thread/sleep (* 7 60 60 1000))
17:49amalloythat is an adorable way to part the channel
17:53mdrogalisAnyone else ever feel like Clojure could be served better with something less defy than defmethod? More like add-method?
17:53TimMcamalloy: I missed it.
17:53amalloyTimMc: (Thread/sleep (* 7 60 60 1000)), followed by /quit zzzzzzzzzzzzzzzzzzzzzzzz
17:54TimMchah
17:54TimMcAt some point I thought I had an irssi plugin that would show part/quit/nick messages for people who were recently active. I guess I don't have that enabled.
17:56lazylambdaThanks folks, I got it now. I missed the part that what is returned from a macro is evaluated. I was treating macros like functions.
17:56amalloyTimMc: i don't mind people making fun of me for using pidgin, but its join/part hiding is smarter than what y'all usually have
17:56amalloy(ie, it shows those things for recently-active folks)
17:58Bronsalooks like I'm the only one who doesn't mind not hiding join/part/nick changes
17:59TimMcBronsa: How do you see anything? o.o
17:59amalloyBronsa: if i ever turn that feature off, all the actual discussion gets hidden in a swamp of join/parts
18:00TimMcamalloy: Pidgin's fine, it just doesn't work well headless on a raspberry pi.
18:00BronsaTimMc: I really don't find it distracting, my eyes skip them automatically
18:00amalloyTimMc: i find your requirements absurd
18:00SagiCZ1whats the correct construct when i want to process an increasing number of elements in a sequence?
18:00SagiCZ1[:a :b :c :d] -> [[:a] [:a :b] [:a :b :c] [:a :b :c :d]]
18:00TimMchaha
18:00andyfamalloy: Bronsa: 2 folks that might know this off the top of their heads! When CLJ-865 ignore-metadata-on-macro-invocations behavior happens, does that only happen for macros defined with defmacro? For example, it seems like type hints are preserved on forms like (.read args), macroexpanded to (. arg1 (read other-args))
18:00amalloy&(reductions conj [] '(a b c d))
18:00lazybot⇒ ([] [a] [a b] [a b c] [a b c d])
18:00SagiCZ1i just need to process them with sideeeffects, no need to return it like this
18:01Bronsa,(meta (macroexpand-1 '^:foo (.foo bar)))
18:01clojurebotnil
18:01Bronsa,(meta (macroexpand-1 '^foo (.foo bar)))
18:01clojurebot{:tag foo}
18:02Bronsaandyf: *only* type hints are preserved in that case
18:02amalloyandyf: Compiler/macroexpand1 specifically attempts to preserve the tag in the case of (.foo bar)
18:02andyfBronsa: Special case in compiler for :tag key of metadata I guess?
18:02Bronsayep
18:02andyfAlso for (ClassName. args) ?
18:02BronsapreserveTag or some similarly named method
18:03amalloyyou can search for "sym.name.charAt(0) == '.'" to see the relevant code
18:03Bronsaandyf: I don't think so
18:03amalloyandyf: there's no need to preserve a tag there
18:03amalloythe value is known to be of type ClassName
18:03ag0rexSagiCZ1: something like this? (doseq [x (reductions conj [] '(a b c d))] (println x))
18:03andyfOK. Will look it up. Thanks. I'm working on an Eastwood linter for warning about probably-lost metadata on macro invocations, and trying to make it precise.
18:04amalloyandyf: it also works for ^String (Foo/bar x)
18:04Bronsaamalloy: uhmm, say I have foo(SomeInterface) and foo(SomeClass) where SomeClass < SomeInterface. could type hinting ^SomeInterface (SomeClass.) make any difference when invoking foo?
18:05amalloyBronsa: yes, probably so
18:05Bronsaamalloy: in that case the type hint would be valuable
18:06amalloyalthough i don't think the compiler actually supports that right now
18:06amalloyin the code for expanding Foo., it doesn't preserve your tag
18:06Bronsayeah right
18:09andyfSo seems like brief description might be: Java interop forms except those beginning with . discard all metadata except :tag. Other macros discard all metadata unless explicitly preserved by the macro definition.
18:10amalloyandyf: Foo/bar does not discard it
18:10amalloyit's the same as starting with .
18:11andyf,(meta (macroexpand-1 '^{:foo 7} (Math/abs 5)))
18:11clojurebotnil
18:11andyfLooks like it throws that metadata away. Keeps :tag, I know.
18:12amalloyright. i'm quibbling with "except those beginning with .", not with "all metadata except :tag"
18:13andyfSorry, my intended meaning is probably better expressed as: Java interop forms discard all metadata except :tag. Exception to that rule: If the first symbol in the Java interop form is ., then all metadata is preserved, because no macro-expansion occurs.
18:13BronsaI just tested the Class vs Interface thing, yeah not preserving tag in ctor forms is an issue
18:14amalloyi see. yes, that sounds right, andyf. except that as Bronsa showed, the other exception is that (Foo. x) throws away all metadata
18:14amalloyBronsa: if you have to, you can write ^Interface (new Class), right?
18:15andyfI'll make a table with examples :)
18:15Bronsahttp://sprunge.us/LBZP?clj
18:15amalloyand of course let-binding it to a hinted name works too
18:15Bronsaamalloy: I think so, let me test
18:15Bronsaamalloy: no, looks like a let binding is the only way to make it work
18:15Bronsawait I'm dumb.
18:16Bronsawell it doesn't work anyway.
18:16amalloyBronsa: i don't understand your paste
18:16amalloyit doesn't seem to actually try ^Interface (Class. x)
18:16Bronsahttp://sprunge.us/ALQK?clj
18:16Bronsaamalloy: this does ^
18:16Bronsahttp://sprunge.us/CGOB?java this is the java file btw
18:17Bronsawll tex input-mode
18:17Bronsahttp://sprunge.us/MSdV?clj there.
18:36andyfOK, not a table, but I think a reasonable summary of behavior, except it doesn't give an example of how to write a macro that explicitly chooses to preserve metadata: https://gist.github.com/jafingerhut/5c9344fd4c20445eb64b
18:37amalloyandyf: looks accurate and thorough
18:38andyfCool. That will probably end up in Eastwood docs on the linter, then, or something close to it.
18:39Bronsaandyf: there are also issues w/ primInvoke & inline btw
18:39andyfBronsa: Issues where they eliminate metadata?
18:39Bronsayes
18:40Bronsaone sec trying to find the ticket
18:41hiredmanclojurebot: Bronsa is <repl>there are issues
18:41clojurebotA nod, you know, is as good as a wink to a blind horse.
18:41Bronsaandyf: this is going to take a while, JIRA and stuff.
18:41gfredericks,(defn integers [] (interleave (range) (map - (rest (range)))))
18:41clojurebot#'sandbox/integers
18:42TEttingerhey, it's hiredman
18:42hiredman~hiredman
18:42andyfBronsa: No rush. It'll take me time to get the warnings precise for as much as I've got so far.
18:42clojurebothiredman is an evil genius.
18:42hiredmanfor the record I never said that
18:42TEttingerhiredman, I'm almost as curious as ddellacosta and arrdem about why clojurebot ignores them
18:44TimMc3!
18:44TEttingerhttps://github.com/hiredman/clojurebot/blob/fd3d1a7c036118ba4a3984fa789227c138133630/clojurebot-facts/src/clojurebot/facts.clj#L58-L61 TimMc, it would be 5
18:44TimMcOh yeah
18:44TimMcI forgot about callen.
18:45hiredmanTEttinger: more or less, at some point they did something, at this point I don't recall what, that made me feel the need to have clojurebot ignore them
18:45Bronsaandyf: http://dev.clojure.org/jira/browse/CLJ-1533 oh you reported this, lol
18:45TimMcTEttinger: I guess you could cross-reference the commit date with the IRC log.
18:45TEttingerit's a good bot.
18:45TEttingeryep
18:45andyfBronsa: But good you mentioned it, since your memory for the corners is often better than mine :)
18:45hiredmanTEttinger: and the whole re-evaluating people for not doing things is too much work, so I am not going to do it
18:46Bronsaandyf: note that even "(Math/abs ^long (f2 -3))" will emit a reflection warning
18:46technomancyisn't that what commit messages are for
18:46hiredmanclojurebot's ignore list is like 5 people, mine is like 344
18:47amalloyBronsa: isn't this a pretty different issue? the problem is not how you call abs or hint f2, it's the definition of f2 which is incorrect
18:47hiredmantechnomancy: in theory you could use commit messages for that
18:47technomancyhiredman: you don't store your irssi config in git?
18:47technomancyI'm scandalized
18:47TEttingerunfortunately, http://logs.lazybot.org/irc.freenode.net/%23clojure/2014-03-24.txt is by lazybot which ignores clojurebot
18:48hiredmantechnomancy: you are assume that I don't store it in git, is entirely possible I do but the commit messages are all "blarg"
18:48amalloyclojurebot: commit messages |are| for remembering why you dislike people - technomancy, 2014-11-11
18:48clojurebotc'est bon!
18:48Bronsaamalloy: no, one second
18:49Bronsaamalloy: http://sprunge.us/OYSP?clj maybe this is clearer
18:49hiredman(same terrible commit messages hold for clojurebot's source)
18:49hiredmanhttps://github.com/hiredman/clojurebot/commit/fdc537e03092b357aa8853757f891a831538b922 very informative commit message there
18:50Bronsaamalloy: the issue is that the compiler will transform (f2 1) in (.invokePrim f2 1) w/ preserving meta
18:50amalloyBronsa: i'd say that f2's definition is still wrong: it should clearly be (defn f2 ^long [^long x] (inc x)). that it works for f1 is more like a coincidence
18:50amalloyi don't want the compiler to compile that call f2 without issuing a reflection warning, because i'm boxing up stuff in a Long when i apparently intend not to
18:50Bronsaamalloy: well take (defn f2 [^long x] "foo") then
18:51Bronsaamalloy: hinting ^String (f2 1) will still not work
18:51amalloyBronsa: okay. that i will buy as an issue
18:51Bronsaamalloy: it's the example that's debatable, not the issue
18:51andyfBronsa: But the CLJ-1533 cases don't involve metadata being lost due to macroexpansion, right?
18:52Bronsaandyf: well, not by macroexpansion, no
18:52Bronsaandyf: it's lost at analysis time
18:52SagiCZ1is (filter #(and p1 p2)) faster than (->> coll (filter p1) (filter p2)) ??
18:52lazybotSagiCZ1: Uh, no. Why would you even ask?
18:52SagiCZ1sorry, didnt wanna trigger the bot!!!
18:53BronsaSagiCZ1: why would you do that ???
18:53lazybotBronsa: Oh, absolutely.
18:53andyfBronsa: I'll keep a reminder about that behavior, but will probably focus a linter specifically on macroexpansions that lose metadata.
18:53godd2I think he always answers that after a double ??
18:53lazybotgodd2: Definitely not.
18:53Bronsaandyf: sure, I just mentioned it in case it was relevant to the linter
18:54TEttinger??
18:54lazybotTEttinger: Uh, no. Why would you even ask?
18:54clojurebotCLABANGO!
18:54TEttinger???
18:54lazybotTEttinger: Yes, 100% for sure.
18:55TEttingerSagiCZ1, you might want comp instead of and there
18:56SagiCZ1TEttinger: good idea
18:56TEttinger,(let coll [1 2 3 4 5] (filter (comp odd? #(< % 4)) coll))
18:56Bronsauh, looks like the new :warn-on-boxed thing doesn't warn for f1
18:56clojurebot#<CompilerException java.lang.IllegalArgumentException: let requires a vector for its binding in sandbox:, compiling:(NO_SOURCE_FILE:0:0)>
18:56SagiCZ1TEttinger: wait, what? thats not the same though.. if p1 and p2 both return boolean
18:56TEttinger,(let [coll [1 2 3 4 5]] (filter (comp odd? #(< % 4)) coll))
18:56clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Argument must be an integer: true>
18:56andyftechnomancy: merci beaucoup for that reverse ocr link. I don't know why I find that so funny, but I do. http://reverseocr.tumblr.com
18:57technomancypretty nuts
18:57Bronsaandyf: lol. stupid computers
18:57TEttingerI have no idea what went wrong there
18:57SagiCZ1TEttinger: well odd returns boolean
18:57SagiCZ1which u then feed into the comparison
18:58TEttingerah
18:58amalloyTEttinger: you want every-pred, not comp
18:58TEttingerrather, < returns boolean
18:58dbaschboth return boolean
18:58TEttingerthe < gets executed first
18:58SagiCZ1yeah true. sorry
18:58TEttinger(inc amalloy)
18:58lazybot⇒ 189
18:58TEttingeralso
18:58TEttinger(inc SagiCZ1)
18:58lazybot⇒ 1
18:58SagiCZ1OH YEAH BABY I WAS WAITING FOR THIS SO LONG
18:58SagiCZ1sry :x
18:59SagiCZ1now i can finally feel like a useful part of this community!
18:59andyfSagiCZ1: I was almost expecting a "Sorry, wrong window" follow-up :)
18:59godd2That's a big change SagiCZ1, an infinite% change, by the looks of it
19:00SagiCZ1totally meant for this window.. :)
19:05SagiCZ1i have a little off topic, just asking for opinion.. let's say i have some extremely large computation, maybe in clojure, basically a pure function which eats input and returns some number.. lets say it takes 14 days to compute on my computer.
19:05SagiCZ1Is there an online service which would let me rent some processing time to compute this faster? would Amazon Web Services make sense for this?
19:05technomancyit would make sense if you could parallelize it
19:05justin_smithSagiCZ1: yeah, amazon has very granular time periods for renting instances
19:05noonianaws would work if you just want to free up your computer also
19:05andyfSagiCZ1: There are many services to rent processing time. Whether they are faster depends.
19:06technomancyI don't know if you'd get that much of a speed boost
19:07SagiCZ1technomancy: maybe there are some options which let you rent extremely powerful cpu for couple hours? instead of multiple slow cpu for something like a website?
19:08Guest1Should look into cascalog. Get the data into s3 and run it on EMR
19:08technomancySagiCZ1: yeah. IO performance is not great, but if it's CPU bound you could do well
19:08technomancyI guess they do have SSD-backed intstances now too if you do need IO
19:08aperiodicif it's embarassingly parallel it would probably be fruitful to try to run it on a GPU.
19:09SagiCZ1technomancy: and do i need to paralelize it for multiple cores (which i would probably be able to after some tinkering) or do i need to be able to harness multiple computers (which sounds way too complicated)?
19:09technomancySagiCZ1: depending on the problem it might not be that much more complicated to fan out to multiple machines
19:10technomancyfor map/reducey stuff
19:10SagiCZ1sounds good
19:10SagiCZ1Guest1: thanks for the tip
19:11justin_smithSagiCZ1: program in terms of threads and queues, and when you go multi-machine turn the queues into tcp-connections transporting the queued data
19:12SagiCZ1justin_smith: okay, didnt know the transition was doable
19:12justin_smithI mean that's a super high level description that leaves out a bunch of frustrations that you find your first time doing it, but it's the basic idea
19:12justin_smith:)
19:12technomancyhttps://github.com/technomancy/die-roboter <- proof-of-concept rabbitmq-based distribution
19:12justin_smithSagiCZ1: well, if it's good clojure code you already are not relying on shared state outside the messages on the queues
19:12justin_smithSagiCZ1: so the only overhead is setting up the connections and dealing with what to do when they go down
19:13justin_smithwhich things like rabbitmq are designed to do for you of course :)
19:13SagiCZ1justin_smith: thanks..
19:13SagiCZ1i really didnt know what to google, thats why i asked here
19:13aperiodicSagiCZ1: also if you haven't tried profiling and optimizing it at all yet I'd bet you could get it down to ~2 days without much effort.
19:14SagiCZ1aperiodic: it is a hypothetical problem, the code doesnt exist yet but since it will be crunching tens of gigabytes of data and computing something from them it will be inherently slow
19:14TEttingerSagiCZ1: no one's mentioned NVidia Teslas or Xeon Phis yet?
19:15justin_smithSagiCZ1: I guess I am being a little vague, but if you put some effort into it you can program with threads that share no more data than two machines communicating on a network would, so the the transition to using something like rabbitmq or hornetq or whatever is as seamless as possible
19:15SagiCZ1TEttinger: read about it.. but they are only for very specific problems.. like matrix multiplication.. you have to really design around it
19:15TEttingertesla can handle any GPGPU type tasks
19:15TEttingerwhich is any embarassingly parallel tasks
19:16SagiCZ1justin_smith: i guess there is a lot of benefit to using a whole farm of pcs instead of just one powerful cpu, right?
19:16TEttingernot for electrical cost
19:16technomancySagiCZ1: it depends what the data is being used for and whether the computation is likely to be run again
19:16justin_smithSagiCZ1: there's some flexibility to it
19:16SagiCZ1i see
19:17SagiCZ1i wish they taught me this in school
19:17technomancywell, freenode is like school but you actually learn practical things
19:17TEttingerit's a little beyond school level, I'd say...
19:18TEttingerI know some universities in China have access to phenomenal supercomputers, since they are on their campus
19:18justin_smithyeah, depends on the school - ncsa is at UIUC for example
19:18TEttingerbut the average student probably doesn't get neat them
19:18TEttinger*near
19:18SagiCZ1TEttinger: yeah i also thought about using my student status to get some free computation time
19:19SagiCZ1TEttinger: but its only for open source and the like
19:19aperiodicSagiCZ1: ah, okay. this does sound like it should be fairly amenable to a map & reduce paradigm. partition the input to single-machine-sized, map over the partitions to produce a preliminary result in each partition, and then reduce the map outputs to get the final number.
19:19TEttingerwhat are you calculating, I wonder?
19:19justin_smithcljcoins
19:20SagiCZ1it would be an evolutionary algorithm optimizing some trading strategies for stock/bonds i am designing.. the basic concepts are pre-designed and i the optimizing would tune parameters
19:20godd2I call dibs on the genesis block
19:20SagiCZ1so the parallelism can be done for each generation of the evolution
19:20aperiodicholy data dependencies, batman
19:21aperiodicprevious advice retracted
19:21SagiCZ1sorry if i was being too vague, i was trying to keep it short
19:21TEttingeryeah, since stocks (but not bonds, I would say), change so quickly, computation time matters here huh
19:22dbaschsome people code HFT strategies in assembly
19:22TEttingeryeah, high frequency trading is a strange land
19:23SagiCZ1TEttinger: no, i think you misunderstood, it wont be real-time trading computation.. just tune the strategy once and then use it for months unchanged
19:23TEttingeroh ok
19:23SagiCZ1so the time is not critical but it must be reasonable
19:23dbaschSagiCZ1: and you’ll tune it based on past data, I imagine
19:23SagiCZ1dbasch: exactly
19:23SagiCZ1thats where the tens of gigabytes of input come from
19:24dbaschwell, not like you could tune it with future data
19:24SagiCZ1:>
19:24godd2"Here's a picture of me when I was younger"
19:24dbaschI have a picture of my son from when he was -6 months old
19:25SagiCZ1so in light of these specifics, is there any other tip you could give me?
19:25dbaschSagiCZ1: don’t trade real money?
19:26SagiCZ1i meant for the computation
19:26dbaschSagiCZ1: have you used hadoop?
19:26dbaschif not it may be a good excuse to learn it, and it’s a useful thing to know
19:27TEttingeralso, tens of gigabytes of data might be faster if you can fit in in RAM
19:27technomancyhadoop is super clunky
19:27dbaschtechnomancy: agree, it’s not something you normally use unless you absolutely need to
19:27SagiCZ1i was thinking maybe how to get to the hardware.. and then deal with the software part.. but maybe hadoop would be a good start
19:28hiredmanI have found parkour and emr to work surprisingly well for little one off things
19:28technomancycascalog supposedly exposes the good parts of the hadoop infrastructure without the horrible APIs
19:28dbaschhiredman: yes, I use parkour too (although it was a bit painful to get it to work)
19:28mkw5053Cascalog is fun to learn and super easy to run on EMR
19:28justin_smithSagiCZ1: I read http://reverseocr.tumblr.com/ (which was brought up earlier) as a cautionary tale for those using algorithms to generate models - after all, according to the metrics that algorithm has, it succeeded in generating the target words
19:28SagiCZ1i feel like AWS is meant for... well web services.. can't find similar renting service focusing on single tasks run one-time
19:28hiredmantechnomancy: my understanding is cascalog pays a pretty high price for the abstractions it provides
19:28technomancyhiredman: yeah, maybe
19:29technomancybut the hadoop infrastructure is only useful if you need to colocate data and computation (hdfs cluster) and can't afford to ship it around
19:29technomancy(imo)
19:29SagiCZ1justin_smith: where is the tale? i just see the pictures
19:29TEttingerwell it depends how parallel your task is, but if you just want to have 100+ GB RAM to store the data in and can afford to have 36 slow cores, http://www.ebay.com/itm/DELL-C6100-C6105-CLOUD-SERVER-6x-1-8GHz-AMD-6-CORE-HEX-CORE-144GB-RAM-3x-250GB-/181306790824?pt=COMP_EN_Servers&amp;hash=item2a36ba13a8
19:29justin_smithSagiCZ1: the tale is "I used an evolutionary algo to make images that would be readable by OCR, these are the outputs"
19:30mkw5053EC2 m3.2xlarge has 30 GB of RAM, 160 GB SSD
19:30justin_smiththat is, the resulting algo is only as good as the tester of the success condition
19:30dbaschyou can spin an instance with 244GB of RAM
19:30dbaschr3.8xlarge
19:30TEttingerhow much would that run you, dbasch?
19:31mkw5053dbasch: that is awesome
19:31SagiCZ1justin_smith: that is true.. but the algo accomplished its task.. if the fitness function was to be readable by the ocr, then it succeeded.. but if the ocr scored at HOW readable it is, then you could evolve more and get better results
19:31dbaschTEttinger: $2.80/hr
19:31TEttingernice
19:31dbaschnot bad if you need it for a few hours once every few months
19:31hiredmantechnomancy: I've found it to do ok running in ec2 and reading from s3
19:32SagiCZ1hiredman: what are these: ec2 and s3 please?
19:32mkw5053Amazon Web Services
19:32dbaschI don’t know if they have those available as spot instances
19:32TEttingerelastic compute cloud, something storage something
19:32justin_smithsimple "secure" storage
19:32dbaschsimple storage service
19:32SagiCZ1thanks.. so we are still talking about aws, great
19:33technomancyS3: the only product with "simple" in its name that isn't a lie
19:33justin_smithoh, that's it, yeah
19:33dbaschsecure it’s not
19:33kenrestivolol https://github.com/hiredman/clojurebot/commit/b7cbf7edc499ae67999d0c64d7643bb4fdf3a2f4
19:33dbaschtechnomancy: simpledb was simple in the same way mongodb is web scale
19:33amalloykenrestivo: it's been a while since we saw Lajla, hasn't it
19:33kenrestivosssh, don't summon it
19:34technomancyamalloy: oh man you said his name now we're in for it
19:34SagiCZ1dbasch: and when you used it, was the performance any higher than my 5 years old computer?
19:34kenrestivos3 is simple? ever tried to set up permissions in s3?
19:35TEttinger,"Divine shadow?"
19:35clojurebot"Divine shadow?"
19:35technomancykenrestivo: it inherits some brain damage from just being part of aws, but the s3-specific parts seem to be simple
19:35kenrestivotrue.
19:35dbaschSagiCZ1: I never used the r3.8xlarge but in theory “32 vCPUs” should be better than most desktops
19:35technomancyif ec2 were as easy to use as s3 I probably wouldn't have a job
19:36technomancywell
19:36technomancyI would have a different job
19:36TEttinger,"Divine Shadow"
19:36clojurebot"Divine Shadow"
19:36justin_smithheh
19:36clojurebotIt's greek to me.
19:36dbaschtechnomancy: at least the e in ec2 doesn’t stand for easy
19:36technomancylol
19:36kenrestivoi thought it stood for "enterprise" which stands for "excessively complex"
19:36SagiCZ1dbasch: thanks, and could you describe the workflow, to get the computation there? how do i access the instance? .. i know there is a tutorial, but maybe u could just sumarize it?
19:37turbofailstands for "elastic," to remind you that if you slip up it'll snap back and slap you silly
19:37justin_smithSagiCZ1: with ec2 you just ssh in
19:37dbaschSagiCZ1: you pick an AMI (typically a Linux distro), perhaps there is one that’s already set up for scientific computing
19:37dbaschif not you need to do a bunch of package installation, and then save your AMI for the future
19:37justin_smithI mean you can choose to create a windows system if you want...
19:38dbaschonce you have it ready, it’s like ssh’ing into any old linux box
19:38SagiCZ1justin_smith: no, you would all laugh at me
19:38justin_smithhaha
19:38justin_smithjust saying ec2 allows that option
19:38SagiCZ1that sounds really simple, thanks dbasch
19:39dbaschSagiCZ1: of course there are a lot of minor gotchas and tutorials, but for the most part it’s no different than setting up a linux box anywhere
19:39SagiCZ1i've done some ssh'ing into some remote computers, so i know it works great
19:39justin_smithSagiCZ1: remarkably, without any audio or video to worry about, setting up linux for your task is not bad at all
19:39SagiCZ1cool
19:39andyfBronsa: Is tools.analyzer(.jvm) preserving metadata on forms like (StringWriter.) ? At least in the value of the :form key of the AST it seems to be.
19:39SagiCZ1justin_smith: thats what im thinking... i guess it could just show the progress in the console and then create some results file..
19:39Bronsaandyf: it should be, yes
19:40justin_smithSagiCZ1: for a remote box, better to use nohup or directly write to a log file
19:40andyfBronsa: Does it get stripped out during emit-form?
19:40andyfBronsa: I'm being lazy asking instead of just trying it, I know.
19:40justin_smithSagiCZ1: or you could be ghetto and run everything inside tmux or screen
19:40Bronsaandyf: it shouldn't :P
19:41andyfBronsa: So, intentional difference from Clojure?
19:41Bronsaandyf: yes. it's all in the macroexpander impl
19:42SagiCZ1justin_smith: yeah, i just wanted to know which way to start the journey... this sounds promising. sorry for being quite offtopic here, i am afraid of people on other channels after some bad experience hah
19:42dbaschSagiCZ1: whenever I do something like that I typically build an uberjar and then run it with nohup in the background
19:42justin_smithSagiCZ1: well, it's all pretty relevant to clojure, since most deployments of clojure are to places like that
19:42Bronsaandyf: t.a.jvm's macroexpander preserves metadata for everything, macros too
19:43Bronsaandyf: that's a saner behaviour IMHO but if it's a problem for anybody, no big deal it's just a matter of providing a custom macroexpander that behaves like clojure's
19:43SagiCZ1cool, didn't know that either.. i actually know nothing about deployment in clojure, i was using strictly REPL so far, will have to learn that too
19:43dbaschSagiCZ1: I make sure that my program writes (and flushes) output often enough so that I know what’s going on
19:44andyfBronsa: OK, thanks for the confirmation of behavior I'm seeing.
19:44Bronsagithub's new clojure highlighting colors are destroying my eyes
19:44SagiCZ1dbasch: yeah i dont know whats uberjar, but i will remember your advice
19:44dbaschSagiCZ1: lein uberjar
19:45SagiCZ1dbasch: oh ok
19:45dbaschyou typically don’t want to build (or have code) on aws, so you build locally and deploy everything in one jar ready to run
19:45SagiCZ1makes sense
19:45Bronsaandyf: now that I think of it, I can probably make that configurable in t.a.jvm
19:46andyf:clj-865-compatible true :)
19:48Bronsaandyf: the big issue with trying to be 100% clojure compatible is that some of the behaviour of Compiler.java is insane. supporting identical behaviour would mean willingly introducing bugs/edge cases in t.a.jvm and I'm not really into that
19:48jack_rabbit((clj-compatible-p) true)
19:48jack_rabbittrue
19:49andyfBronsa: Understood. I'm happy if I get the behavior I need from it.
19:49justin_smithjack_rabbit: looks suspiciously like common lisp
19:49jack_rabbitWell I never!
19:49andyfBronsa: And I am pretty sure I don't need :clj-865-compatible true behavior
19:50turbofailnah, in common lisp it'd be (funcall (clj-compatible-p) t)
19:50justin_smith(defn common-lisp? [sym] (or (.endsWith (name sym) "-p") ...))
19:50jack_rabbitjustin_smith, I like. :)
19:50turbofailor possibly (setf (clj-compatible-p) t) for maximum yuck
19:50justin_smithhaha
19:50jack_rabbitjustin_smith, I do like defun better than defn. defun has 'fun' in it!
19:51amalloywho let de fun out?
19:51jack_rabbitXD
19:51justin_smithjack_rabbit: I keep calling letfn flet
19:51andyfturbofail: Be careful when making fun on of the giants on whose shoulders you stand, for they may choose to wiggle
19:51SagiCZ1i started to learn lisps with Common Lisp quickly becoming familiar with setf only to be very dissapointed when later discovering clojure, that its not the clojure way to setf anything :)
19:52jack_rabbitjustin_smith, a macro will take care of that mistake. Unfortunately, your fellow programmers will hate you forever.
19:52justin_smithjack_rabbit: how many times has that exact statement been made I wonder?
19:52jack_rabbitMe too. :)
19:52jack_rabbits/Me/I wonder/
19:53jack_rabbitProbably disproportionately said about lisp code.
19:54justin_smithC/C++ would count there too I think
19:54jack_rabbitI was going to say that, but the 'take care of that mistake' part seemed out of place.
19:54jack_rabbitmacros are rarely the solution to a mistake.
19:55jack_rabbit:)
19:55jack_rabbit(In C/C++)
19:55justin_smithmacros: the cause of, and the solution to, many of programmings hardest problems
19:56jack_rabbitJust like alcohol
19:56Glenjamindo people use letfn often?
19:56jack_rabbitEvery once in a while.
19:56Glenjamini tend to find when i want to extract a local function, i already have a let at the right scope
19:56Glenjaminso i just let [f (fn [])]
19:57jack_rabbitI see that more often than letfn, sure.
19:57BronsaGlenjamin: I usually just use let, letfn only for mutually recursive functions
19:57Bronsawhich happens rarely
19:57justin_smithGlenjamin: I like it for something that needs a lot of decomposition, but does not need to be its own namespace
19:58Bronsaletfn doesn't really give you much over let if you don't need the parallel binding stuff
19:58jack_rabbitI'm not even aware of parallel binding stuff. :)
19:58justin_smithBronsa: right, but it's easier on my eyes if I am defining more than 3 functions in a block
19:58Bronsait might save you a couple of keystrokes if you need to define a bunch of functions, but that prevents you from binding non fn locals in the same block
19:59justin_smithBronsa: more about the eyeball movements than keystrokes, but sure
19:59justin_smithbrain-cycles
19:59Bronsa,(letfn [(a [] 1) (b [] (a)) (a [] 2)] (b))
19:59clojurebot2
19:59Bronsajack_rabbit: ^
20:00jack_rabbitwow.
20:00Bronsajustin_smith: I actually find letfn harder to parse than let+fn
20:00TEttinger,(letfn [(b [] (a)) (a [] 2)] (b))
20:00clojurebot2
20:00TEttingernice
20:00jack_rabbitis (let* ... clojure or CL?
20:00Bronsaboth
20:00jack_rabbitI can't remember.
20:00jack_rabbitahh.
20:00Bronsabut they are different things
20:00TEttingerlet* is a special form
20:00Bronsaclojure's let is cl's let*
20:00Glenjamin,(macroexpand '(let [a 1]))
20:00clojurebot(let* [a 1])
20:00Bronsaclojure's let* is the underlying special form on top of which let is implemented
20:01jack_rabbithmm.
20:01turbofaili.e. without destructuring and such
20:01jack_rabbitso what does let* mean? Looks the same given that macroexpand.
20:01jack_rabbitahh.
20:01Glenjamin,(macroexpand '(let [[a] [1]]))
20:01clojurebot(let* [vec__109 [1] a (clojure.core/nth vec__109 0 nil)])
20:01jack_rabbit...
20:01jack_rabbithmm.
20:02Bronsalet is basically just let* + destructure
20:02Glenjamindoes that mean destructuring function definitions expand to let*?
20:02jack_rabbitgross. So I should probably never need to use let*
20:02Glenjamin,(macroexpand '(fn [[a] [1]]))
20:02clojurebot(fn* ([p__134 p__135] (clojure.core/let [[a] p__134 [1] p__135])))
20:02jack_rabbit(directly)
20:02Glenjaminoh right, fn expands to let
20:02Bronsajack_rabbit: right
20:02Glenjaminmakes sense
20:03jack_rabbitI noticed clojure's let was equivalent to CL's let*. I just wasn't aware clojure had a let*.
20:04jack_rabbitAlthough I'm going to stay far away from clojure's let*.
20:04justin_smithjack_rabbit: see also fn*
20:05bbloomjack_rabbit: clojure's let* isn't like CL's anything
20:05bbloomit's an implementation detailo
20:05amalloybbloom: only core.logic has implementation-detailo
20:05jack_rabbitbbloom, right, I've gathered that.
20:05jack_rabbitbbloom, not implementation detail, but impractical.
20:06bbloomjack_rabbit: there's letfn, which is similar to parallel CL let, but only for recursive functions, not recursive values
20:06amalloyjack_rabbit: yes, implementation detail
20:06bbloomamalloy: (defn typo [in out] ...)
20:06amalloylet* in clojure is something that you should pretend doesn't exist
20:06jack_rabbitjustin_smith, unfortunately, google makes anything with symbols in it impossible to search.
20:06amalloyit only exists to enable you to bootstrap let
20:06bbloom~symbols
20:06clojurebotsymbols are kind of fun
20:06amalloyunlike in scheme where let* and let are two useful things with different tradeoffs
20:07bbloom~characters
20:07clojurebotexcusez-moi
20:07Glenjaminanything with an * on the end is probably intended for internal use
20:07amalloy~symbolhound
20:07clojurebotTitim gan éirí ort.
20:07bbloomclojurebot: characters |is| http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/
20:07clojurebotOk.
20:07jack_rabbitamalloy, cool. I don't know the standard, so I can't say whether it's an implementation detail or not.
20:07Glenjaminmaybe the fact you can't google is intentional
20:07bbloom~characters ; check out this link jack_rabbit
20:07clojurebotGabh mo leithscéal?
20:07amalloy$google symbolhound
20:07lazybot[SymbolHound: Search Better. Code Better.] http://symbolhound.com/
20:07bbloom~characters
20:07clojurebotcharacters is symbols
20:07bbloomclojurebot: forget characters |is| symbols
20:08bbloomi suck at clojurebot
20:08bbloomamalloy: you do it
20:08bbloom:-P
20:08amalloyhttp://symbolhound.com/?q=let*+clojure
20:08kenrestivowe've got symbols... cause we've got a band. and we've got symbols in the band.
20:08amalloybbloom: it can't really be done, because clojurebot is adversarial
20:08bbloomargh.
20:08Bronsajack_rabbit: clojure doesn't have a standard
20:08SagiCZ1can i specify encoding for slurping?
20:08jack_rabbitBronsa, still?
20:08justin_smithSagiCZ1: yes, its an optional arg
20:09SagiCZ1justin_smith: thanks
20:09amalloyjack_rabbit: clojure is a fiat language, not a standards language
20:09justin_smith,(slurp "http://www.google.com&quot; "x-Big5-Solaris")
20:09clojurebotWARNING: (slurp f enc) is deprecated, use (slurp f :encoding enc).\n#<SecurityException java.lang.SecurityException: denied>
20:09jack_rabbitamalloy, what does that mean?
20:09Glenjaminsmall italian car
20:09amalloylike ruby and python, the "standard" is whatever the most popular implementation does
20:10kenrestivomeans there's a BDL, not a commtttee
20:10jack_rabbitGlenjamin, that's what I got from search. XD
20:10justin_smith&(slurp "http://www.google.com&quot; :encoding "x-Big5-Solaris")
20:10lazybotjava.security.AccessControlException: access denied ("java.net.SocketPermission" "www.google.com:80" "connect,resolve")
20:10Bronsawhich sucks when the most popular implementation has bugs
20:10jack_rabbitamalloy, kenrestivo gotcha.
20:10jack_rabbitWhy is that? should it not be moving towards a standard?
20:11bbloomjack_rabbit: why should it?
20:11Bronsa.. or are they intended behaviour? who knows
20:11SagiCZ1is 'UCS-2 Little Endian' encoding i could specify?
20:11amalloyjack_rabbit: probably (although not certainly) that would be better than having no spec, but that's a time-consuming project that nobody wants to do
20:11bbloomjack_rabbit: clojure's design philosophy is one in which you must prove value to justify doing something, not just do something b/c it's the thing you do
20:11justin_smithjack_rabbit: it's originally the product of a single motivated programmer, he never designated a standard
20:11jack_rabbitbbloom, then more people can produce compliant compilers/runtimes, and it'll be more resiliant.
20:11jack_rabbitThe language will develop faster with more implementations, I would think.
20:12bbloomjack_rabbit: what does it mean to be "compliant"?
20:12Bronsabbloom: my happiness isn't valuable then? :P
20:12jack_rabbitbbloom, compliant with the standard.
20:12Glenjaminspeaking of which, what's the state of CinC these days?
20:12amalloyjack_rabbit: that doesn't convince me. languages with a standard and multiple implementationd don't change very fast
20:12bbloomjack_rabbit: the standard is Rich's Clojure implementation
20:12bbloomif that runs it, that's clojure
20:12jack_rabbitfair enough.
20:13BronsaGlenjamin: lots of work on the going on on the frontend, the backend is lagging behind a bit
20:13amalloylook at the time difference between C++99 and C++0x (which eventually became C++11): twelve years between standard versions!
20:13bbloomjack_rabbit: hell, two implementations done by rich don't even match up. clojurescript has intentionally different semantics
20:13bbloompeople code to an implementation anyway
20:13bbloomthe standards aren't that useful
20:13jack_rabbitamalloy, and even before C++0x, lots of compilers didn't even fully support C++99.
20:14bbloomjack_rabbit: evidence in favor of ignoring standards :-P
20:14jack_rabbitbbloom, fair enough. Makes lots of sense.
20:14jack_rabbitbbloom, right.
20:14amalloyi think a standard *is* useful, but not because it makes the language develop faster
20:14amalloyi think it makes the language develop more slowly, which is good once you're basically "done" and want stuff to stabilize
20:14bbloomGnu C++ and MSVC++ are pretty different
20:14Glenjaminjust knowing whether all the clojure core functions exist in cljs would be neat
20:14amalloyGlenjamin: spoilers: no
20:14{blake}Heh. Didn't the K&R C bible say something like "types should be reasonably converted"?
20:15Bronsabbloom: so you wouldn't like to have a definitive document setting in stone how in hell metadata should be handled, for example?
20:15bbloomGlenjamin: that would be nice :-P
20:15jack_rabbitIs there even more than one clojure implementation?
20:15Glenjamini knew that, but i can never remember which ones
20:15jack_rabbitAs of now?
20:15amalloyjack_rabbit: well, cljs
20:15bbloomBronsa: i just don't rely on metadata :-P
20:15clojurebotI don't understand.
20:15justin_smithclojure, cljs, clojure-clr
20:15jack_rabbitamalloy, what?
20:15bbloomBronsa: as far as i'm concerned, it's for exceptionally limited & obvious use cases, where it is immediatley converted in to ACTUAL data as fast as possible... or it's compiler specific hinting hackery
20:16bbloomBronsa: in the former case, i don't care about the corner cases. in the later case, it's impl specific anyway
20:16{blake}clojure-py, arcadia...
20:16bbloomthe only reason i cared was b/c i was doing a clojure implementation (mostly for fun) and was surprised that some stuff broke
20:16bbloomwould have taken me as long to read the spec as to debug the issue directly, so *shrug* :-P
20:16SagiCZ1justin_smith: how do i know which encodings are supported? i tried to supply some nonsense string and it didnt complain
20:17justin_smith SagiCZ1: https://docs.oracle.com/javase/7/docs/technotes/guides/intl/encoding.doc.html
20:17SagiCZ1thanks, i couldnt find it
20:17justin_smithof course look for the version of that page for your jvm
20:18Bronsa{blake}: I believe clojure-py is abandoned
20:19{blake}Bronsa: So, it's the most stable of all, you're saying.
20:19Bronsain a sense :)
20:20kenrestivoi haven't yet found a really good use for metadata. friend makes extensive use of metadata and it just made my head hurt... i kept thinking why not put all this data in-band and make the data structure deal with it.
20:20bbloomkenrestivo: after much waffling back and forth, i agree
20:20Glenjamini quite like https://github.com/circleci/bond/blob/master/src/bond/james.clj#L3 for metadata
20:21Bronsakenrestivo: 90% of the times that I use it, it's to mimic multiple value return
20:21{blake}kenrestivo: We got tons of metadata here. Mostly because we're describing equations and code, and having metadata allows us to separate that from, well, metadata.
20:21justin_smithGlenjamin: I am severely disappointed that bond.james/bond is not defined
20:21Glenjaminyou :require [bond.james :as bond]
20:21justin_smithoh, of course
20:22gfredericksmetadata on references is still pretty useful
20:22justin_smith:require [bond.james :as bond :refer [007]]
20:22Glenjaminnow that i look at this code
20:22Glenjamini could be done with a deftype that implements IFn
20:22justin_smithnot a valid symbol of course
20:23Glenjaminbut still, i quite liked the metadata approach to recording function calls
20:23kenrestivohmm, i could see that. tests and instrumentation. also i think add-watch/remove-watch uses metadata internally.
20:24Bronsakenrestivo: no they don't
20:24gfredericksGlenjamin: also implementing IFn is no fun (HA)
20:24gfredericksso the metadata approach is definitely easier in terms of impl & clarity
20:24Glenjaminoh right, you need to unroll all the aritiies
20:24Bronsakenrestivo: watches come with IRef, has no relation with IMeta
20:24kenrestivoBronsa: thanks
20:25gfredericks,(def a (atom []))
20:25clojurebot#'sandbox/a
20:25Bronsakenrestivo: IRefs should have a __watches field like IMetas have __meta
20:25gfredericks,(add-watch a ::history (fn [r _ old _] (alter-meta! r update-in [:history] (fnil conj []) old)))
20:25clojurebot#<Atom@103b248: []>
20:26gfredericks,(swap! a conj 12)
20:26clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.IReference>
20:26gfredericks,(add-watch a ::history (fn [_ r old _] (alter-meta! r update-in [:history] (fnil conj []) old)))
20:26clojurebot#<Atom@103b248: [12]>
20:26gfredericks,(swap! a conj 12)
20:26clojurebot[12 12]
20:26gfredericks,(meta a)
20:26clojurebot{:history [[12]]}
20:26kenrestivocool
20:26andyfBronsa: I don't understand you latest comment on CLJ-1325. Which one of those example compilation results do you find unexpected?
20:27Bronsaandyf: the second one
20:27andyfIs it the 2nd example, because the ret value will be boxed?
20:27Bronsaandyf: right
20:29Bronsaandyf: in this case boxing happens on the return value rather than on one of the args
20:30bbloom can we discuss metadata some more? i feel like Bronsa and i discussed it a bit once and i remember that i was still not sure why it didn't feel right... has anybody a good sense of the benefits, costs, and possible better designs of it?
20:31bbloomi wonder, would it be nicer if it just always went away if you did any sort of "change" to a value?
20:32bbloom(-> [] (with-meta {:foo 1}) (conj :x) meta)
20:32bbloom,(-> [] (with-meta {:foo 1}) (conj :x) meta)
20:32clojurebot{:foo 1}
20:32bbloomwould it be better if that (and basically everything) lost the meta?
20:32Bronsabbloom: that might be more consistent IMHO, yes
20:33bbloomBronsa: but would it be desirable?
20:34Bronsabbloom: it might be problematic in cases where you don't have control over what happens to some value you hand a function/macro
20:34Bronsae.g. metadata gets lost in a value consumed by a macro and there's no way for you to add it back because that value doesn't exist anymore
20:34Bronsabut I feel like those cases are rare?
20:35bbloomBronsa: wouldn't that be up to the macro then? basically "this macro preserves metadata on X and Y arguments" as a promise
20:35gfredericksbbloom: your criticisms are just about metadata on data, right, not metadata on references?
20:35Bronsaright now if I care about metadata I just wrap it in a with-meta, I can't trust any of the c.c functions to preserve metadata because some do and some don't and I can't remember which ones do
20:36Bronsa(and it's not always documented either)
20:36bbloomgfredericks: well metadata on references 1) works different and 2) is mutable, right?
20:36gfredericksbbloom: does 1 mean 2?
20:36gfredericksotherwise I'm not sure what "works different" means
20:36gfredericksbut yeah it's mutable
20:37bbloomgfredericks: lol yeah, sorry
20:37gfredericksyou could say it's fundamentally a different feature
20:37bbloomi've never actually used metadata on ref types other than vars, i guess
20:37gfredericksI think robert.hooke is a decent example
20:38gfredericksI believe it stores a reference to the original function as metadata on the var
20:38BronsaI'd be ok with metadata only on refs + a way to attach type hints
20:38Bronsametadata on values is untrustable
20:39gfredericksBronsa: seems strange to call out type hints as the only thing you might possibly ever want to say about a piece of code
20:40gfredericksBronsa: how would the current metadata-on-vars be implemented if you didn't first attach metadata to a symbol?
20:40gfredericksI know defn has an alternate proper-map form
20:41Bronsagfredericks: just how defn does it (def meta sym val)
20:41gfredericks,(defn foo [] {1 2} nil))
20:41clojurebot#'sandbox/foo
20:41gfredericks,(meta #'foo)
20:41clojurebot{:ns #<Namespace sandbox>, :name foo, :file "NO_SOURCE_PATH", :column 0, :line 0, ...}
20:41gfredericks,(get (meta #'foo) 1)
20:41clojurebotnil
20:41gfredericksor something
20:41Bronsagfredericks: it goes before the argvec
20:42Bronsaandyf: does eastwood have a linter for this?
20:42vermahey anyone use vim-fireplace here?
20:42gfredericks,(defn foo {:before-the "argvec"} [] nil))
20:42clojurebot#'sandbox/foo
20:42BronsaI guess :unused-ret-vals would catch that
20:42gfredericks,(-> foo var meta :before-the)
20:42clojurebot"argvec"
20:43Bronsaor even
20:43Bronsa,(defn foo ([]) {:wut 1})
20:43clojurebot#'sandbox/foo
20:43Bronsa,(:wut (meta #'foo))
20:43andyfSorry, reading back now. Looks like :unused-ret-vals should cover it?
20:43clojurebot1
20:43gfredericksoh dear
20:44Bronsaandyf: yeah it should
20:49andyfBronsa: amalloy: Do you happen to recall how a defmacro can be specially implemented to use metadata on one of its invocations? Would it need to examine the &form arg?
20:51amalloyandyf: yes
20:51gfredericksandyf: yeah that'll give you metadata on the whole form, or the macro name itself; for the args, you have it right there of course
20:52amalloyyou have to write something like (defmacro foo [& args] (-> `(sdlkl ~args) (with-meta (meta &form))))
20:52amalloyof course i wrote a copy-meta function that makes that a little shorter: (defmacro foo [& args] (-> `(sdlkl ~args) (copy-meta &form)))
20:52gfredericks,(defmacro andyf [] {:form (meta &form), :sym (meta (first &form))})
20:52clojurebot#'sandbox/andyf
20:53gfredericks,^:foo ^:bar (^:baz :boom andyf)
20:53clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
20:53gfredericks,^:foo ^:bar (^:baz ^:boom andyf)
20:53clojurebot{:sym {:baz true, :boom true}, :form {:bar true, :foo true}}
20:53andyfAh, clojure.core/fn does, too: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L42-L47
20:55vermaits a hard life being a vim user with clojure at least
21:05tuftis there a ring server people like for testing?
21:05tuftfast startup/teardown, single threaded, etc.
21:06amalloytuft: i uh...well, ring. just call your handler function, instead of attaching it to jetty
21:06amalloyzero startup, zero teardown, exactly as many threads as you create in your test
21:07tufttuft: ah hrm. my use case is i'm trying to mock a remote service out. client library is out of my control as well. i'm guessing this approach doesn't listen on a port =)
21:07tufter amalloy, haha
21:07tufthmm, maybe i can get tricky using with-redefs though
21:08amalloyso what you're actually asking for is not how to test a ring program, but how to write a ring program that will let you test some http client
21:08tuftamalloy: yes that's correct
21:09gfrederickstuft: also maybe useful: https://github.com/gfredericks/vcr-clj
21:10tuftgfredericks: wow cool
21:11tuftgfredericks: so if i understand correctly, with this approach i'll just run my test against the live server once and against the recorded responses thereafter
21:12gfrederickstuft: right
21:12amalloythat sounds like it would test rather more strictly than you want: if the client changes any detail of how it talks to the remote server, the canned responses won't work anymore?
21:14amalloybut maybe it's better than nothing
21:15tuftamalloy: i think i see what you mean. i lose some "fuzz factor" this way, as i can't ignore the specifics of the request when returning the response as easily?
21:15tuftseems like :arg-key-fn might apply, although not sure that works with the clj-http integration(?)
21:16tuftotherwise i think this has identical results to what i was going to do. it's an xmlrpc service i'm trying to mock out, so i was going to stand up a mock one to return captured responses from
21:17brehautstep one: back away from the xmlrpc
21:17amalloybrehaut: sometimes it's a necessary evil
21:17brehautsadly true
21:17hiredmanhttps://github.com/sonian/cartridge
21:17justin_smithhttps://github.com/brehaut/necessary-evil ; LOL
21:17amalloytuft: sure, if that's your plan, then letting gfredericks do it automatically is better than doing it by hand
21:17amalloyjustin_smith: you're welcome
21:17tuftbrehaut: yeah, sadly no choice there =\
21:18tuftamalloy: unless there's a plan you prefer i should consider =)
21:18amalloynot really. i just like nitpicking
21:19tuftbrehaut: thank you for this library!
21:19tuftworking great for me
21:19brehautno problem.
21:20tuft(inc brehaut)
21:20lazybot⇒ 24
21:42akurilinhey guys, question: jaba.jdbc currently wraps postgres driver version 8.4 . Current version of the postgres jdbc driver is 9.3 . What should one do to get that bumped up?
21:42akurilinIs a PR good enough or is there a more complex process?
21:43akurilinJust to make sure nobody's broken too hard in the upgrade
21:43akurilinseancorfield: ping.
21:50seancorfieldper the readme on the repo, there's a link to JIRA to create an issue
21:50seancorfieldhere http://dev.clojure.org/jira/browse/JDBC
21:51akurilinok appreciate yet
21:51akurilinHmm looks like the url param I'm looking for might not be in until postgres jdbc 9.4 :( Might have to fork.
21:52seancorfieldto be clear, java.jdbc has no dependency on postgres at all
21:52seancorfieldit has been tested by some people to work on 8.4
21:53seancorfieldi don't use postgres and i don't have any way to test it against postgres (since I don't want postgres on my work machine!)
21:53akurilinseancorfield: I'm looking at project.clj in current java.jdbc master and I'm seeing [postgresql "8.4-702.jdbc4"] under :dependencies
21:53akurilinam I looking at the wrong thing?
21:54seancorfieldthat's an artifact of testing from a long time ago - there's no actual dependency on postgres
21:55seancorfieldclojure contrib projects are built with maven, not leiningen
21:55seancorfieldso pom.xml is the relevant thing here
21:55seancorfieldproject.clj is only used for local testing
21:55akurilinah ok
21:56seancorfieldyou'll notice in the pom they have scope = test
21:56seancorfieldso they are purely test dependencies
21:56akurilinThat's true
21:56akurilinso Korma's basically using its own postgres dependency here
21:56seancorfieldyou should be able to pull in whatever version of postgres you want and use it successfully
21:57seancorfieldah... korma... that does some slightly naughty stuff with java.jdbc i believe that may preclude you passing options the way you want?
21:57akurilinheh yeah you have to pass a few things through to c3p0 in the way it expects you to
21:58akurilinin my case I need to pass assumeMinServerVersion to the postgres URL, but that's only available in the unreleased jdbc driver 9.4
21:58seancorfieldI didn't even think Korma was still being maintained but I see someone has taken it over from Chris...
21:59akurilinIt's "maintained"
21:59seancorfieldand I see you've been sending PRs there... good stuff...
21:59akurilinyeah it's a bit of an uphill battle, I ended up forking it for our org
21:59akurilinI'm not sure I want to commit to maintaining it at this point so a fork is a cheap short-term shortcut
21:59akurilinbut it won't solve the problem long term
22:01gfrederickshaha I have a korma fork too; I can't even remember why
22:02gfredericksapparently it is PR numbers #102 and #115
22:03akurilinHmm this is somewhat worrisome, we either come up with a way to maintain it or we tell people to migrate off of it
22:03akurilinI'm not against using straight clojure.jdbc, the dsl is pretty neat sometimes
22:03akurilinand free c3p0, but it's not really hard to set up by hand anyway
22:04seancorfieldand the java.jdbc docs even show how to set up c3p0 :)
22:04akurilin:P
22:04gfredericksmy forking was probably almost two years ago; I have no idea how/if korma has changed since then
22:04seancorfieldhttp://clojure-doc.org/articles/ecosystem/java_jdbc/connection_pooling.html
22:05seancorfieldI know quite a few people ran into problems with Korma because of the way it "encapsulated" how it manages connections etc.
22:05akurilinI was actually thinking of moving off of korma anyway because I need multi-database support and right now you have to define separate entities for that instead of picking a conneciton
22:05akurilinWe're moving to write db and read db and it's a bit awkward to do with korma from what I can tell
22:06akurilinseancorfield: sounds related to what you mentioned
22:06seancorfieldYup, that's the sort of stuff that folks run into problems with.
22:06seancorfieldWe just use raw java.jdbc and c3p0 at World Singles
22:07akurilinyeah I have both side-by-side right now and I always have to look down in shame when I explain how I ended up with that
22:10akurilinseancorfield: how do you guys deal with permutations of the same query from leading to combinatorial explosion of data access layer functions wrapping slightly different SQL statements?
22:13justin_smithsql!
22:13justin_smithit's the best sql dsl
22:15akurilinhaha
22:16justin_smithin all seriousness, I like the way yesql lets you just write sql, and then abstract that as something you can invoke in your code
22:17seancorfieldtuft: looked at HoneySQL?
22:18seancorfieldor SQLingvo
22:18seancorfieldthose are both linked from the java.jdbc home page
22:19akurilinseancorfield: do you use any DSL?
22:20seancorfieldWe use HoneySQL for our more complex reporting queries
22:20akurilinbtw I just looked up something in the maven for the first time ever, talk about being shielded from java :)
22:20akurilin*maven repo
22:20akurilinok neat
22:20akurilinthat's good to know
22:25seancorfieldthe developer that works on our reporting and analytics stuff loves HoneySQL - she's created some crazy complex data-driven visualization stuff
23:14sxI'm having some trouble understanding lein and dependencies. If I specify one dependency in my project.clj which in turn loads several more libraries, what is the correct way to override one of the sub-dependencies with a different version?
23:15TEttingersx, that would potentially break the library that expects the original version
23:15TEttingerthis is in general a can of worms
23:15sxTEttinger: yes true.. so I'm going down a dangerous and probably wrong path?
23:15sxok
23:15TEttingerthere may be a way people fix this
23:15TEttingerI in the past have forked libraries to update dependencies, and installed mine locally with `lein install`
23:16sxthat is helpful to know. i'll try another approach. thansk
23:16TEttingerthere's also metaverse if a lib absolutely needs one version and your code absolutely needs another
23:17TEttinger$google github clojure metaverse
23:17lazybot[metaverse/verse.clj at master · technomancy/metaverse · GitHub] https://github.com/technomancy/metaverse/blob/master/src/meta/verse.clj
23:18TEttingera bit more docs here https://github.com/Seajure/metaverse
23:18technomancyeeeeh it's more of a proof of concept
23:19technomancysx: top-level declarations override transitive deps