#clojure logs

2014-01-11

00:00KeithPMTEttinger: Hmmmm… Let me try that.
00:01gtrakKeithPM: shortcut is (if-let [s (seq my-seq] blah)... (seq ..) will return nil when it's empty, which is falsy
00:02KeithPMgtrak: OK thanks…. Will check it out
00:02hansel-hanamalloy: what's a simple way to run a loop within the app that handles evictions every, say, 10 seconds?
00:03amalloyhansel-han: you don't really have to do the evictions every ten seconds. you can just do the evictions whenever you want to read or write the thing
00:03amalloythat is, it doesn't have to be a separate asynchronous process
00:03hansel-hanamalloy: haha, of course. yeah, thanks.
00:07amalloyKeithPM: what is permx supposed to do? compute permutations of a sequence or something?
00:08KeithPMamalloy: Yes, that's the plan :)
00:08jonasenandyf: ping
00:08andyfjonasen: pong
00:08KeithPMamalloy: I kinda described my algorithm in the gist.
00:09jonasenI can make the release if when you're ready
00:09TEttingerhm is there a way to (using a macro or something) fill out a for comprehension's bindings at run-time? or compile-time for a macro
00:09jonasenandyf: we should still change README.md to not mention Leiningen 1 installation
00:09andyfjonasen: cool. I think the known issues are pretty well described in the README.next.md, so as long as that gets moved to README.md when the release is done, it should be good enough to go.
00:10andyfYes, that vestigial mention is still in README.next.md, with a question of whether we care about Leiningen 1 any more. I have not done any testing with Leiningen 1
00:10TEttingerthe chas.
00:11technomancyandyf: putting :min-lein-version "2.3.0" will at least let people with old versions know why if things aren't working for them.
00:12andyftechnomancy: thanks for the tip
00:13jonasenandyf: Also, should we bump the version number a bit higher. You and Bronsa has done more work than 0.0.2 -> 0.0.3
00:13andyfjonasen: Sure. Pick what sounds good to you. Do you want me to make any of these edits? Don't want to interfere with any changes you want to make.
00:14amalloyare you averse to solving it differently, KeithPM? https://gist.github.com/amalloy/8367369 is a much simpler way to do it
00:14jonasenandyf: you can make the changes if you want to. Ping me when its done and I cut a release.
00:14andyfok
00:15andyfwhat version #? 0.1.0?
00:15KeithPMamalloy I solved it once before with a list comparehension, lemme check
00:15jonasenandyf: sure
00:15amalloyusing a sorted-map of {int, x} instead of a vector of xs to support efficient removal-in-the-middle, and then a nested for instead of the rather involved map/concat/recursion thing
00:17KeithPMamalloy: Definitely takes some study :) Thanks
00:17TEttingernice amalloy
00:17TEttingerthat thing's a work of art
00:39andyfjonasen: I think it should be ready to go. README.next.md moved over, project.clj is updated. Version number is 0.1.0 in all of the places I think it needs updating.
00:40andyf'lein test' passes, and the crucible projects re-run are under way, and so far (about 10% through) look the same as my last run except for the version number update.
00:41jonasenandyf: I'll ping you when it's released
00:45gcganleyare there any meetups around boston anytime soon?
00:45jonasenandyf: it's on Clojars now :)
00:46andyfjonasen: Awesome! I will try it out on a machine where I haven't been developing it, to ensure the install goes smoothly.
00:46jonasenandyf: will you [ANN] it on the mailing list?
00:46andyfYou are welcome to. Either way is fine with me.
00:47jonasenandyf: since it's your work and you know what's new I think maybe you should announce it
00:47andyfWill do.
00:56wei__is there a good way to execute db functions in java.jdbc without bashing together strings?
00:57noonianyou can use something like honeysql or kormasql
01:20andrewchambhello
01:20andrewchambI have a question about core.logic
01:21andrewchambin a conde does the goal tests go top down>
01:21andrewchamb?
01:22andrewchambI want a certain goal to succeed first, then the others
01:22andrewchambso kind of priority
01:33dnolenandrewchamb: there is no order that can be guaranteed
01:36andrewchambdnolen: oh ok, i was playing around trying to make a system which converts bytecode to assembly using core logic http://pastebin.com/rEcQJXQh
01:36andrewchamband i was trying to make it match more complicated patterns first
01:37andrewchambi guess i can just run the rules one after the other to get order
01:38andrewchambin that i was trying to make it convert a divide and a mod into a single divmod, but if that fails it just converts it into seperate divides and modulos
01:39andrewchambim really new to clojure
01:40dnolenandrewchamb: core.logic is not a good introduction to clojure :)
01:41andrewchambhaha yeah, but i started clojure cause core.logic is something python doesnt have :P
01:41dnolenandrewchamb: trying to do things dependent on order with core.logic will be very frustrating, as order is not a very declarative property
01:41andrewchambthats not really dependent on order since that bytecode is in single static assignment form
01:42andrewchambmemory access needs another field represesnting time though
01:43dnolenandrewchamb: I mean order of goals
01:43andrewchamboh ok
01:43andrewchambyeah
01:43andrewchambi suppose i can enumerate matches then select the longest
01:43andrewchambthough that might not be efficient
01:44andrewchambmy problem is once i find a match, i must rewrite the things im matching against, so it doesnt make sense to find all the matches
01:45andrewchambMy understanding of how minikanren worked was that it just goes top down trying to unify, i guess its probably more complicated than that
01:48andrewchambdnolen: does it try and prove the goals in (parallel/concurrently) and then returns them in the order it finds them?
01:53andrewchambthanks for the help btw, core.logic is pretty neat
02:07seangroveAh, ff, cljs compiler, why you OoM me...
02:18seangroveGetting to the point that we can't compile with :advanced compilation on pretty consistently
02:19seangrovednolen: Is there some jvm flags we can set to use 16G of memory or something to get past this?
02:20Arafangionseangrove: I'm confused.
02:21Arafangionseangrove: You previously mentioned cljs. Now you're asking about the jvm? Is it the compiler that is causing the problem, or the output?
02:21Arafangion(I suspect the compiler)
02:21seangroveArafangion: the compiler
02:21ArafangionCool. I actually have very little experience with clojure. (None, infact). However, you can indeed configure teh memory limit for the JVM.
02:22ArafangionBut from memory, the JVM tends to like contigious memory, which gets problematic on 32-bit systems.
02:30amalloywhat does contiguous memory have to do with a 32-bit system? or with the jvm?
02:32Arafangionamalloy: I dunno. Maybe they felt it simplified their memory model? I did notice that on Solaris at the time, the JVM was able to use all the memory space.
02:32Arafangionamalloy: But not on other systems.
02:33Arafangionamalloy: And 64-bit systems have a freaking rediculously large memory space, even with 41 or 47 bits available, so that's not a limitation anymore. (surely)
02:34andyfjonasen: [ANN] finally sent (got sidetracked with other things for a bit)
02:39jonasenandyf: Great! Hopefully people will find it useful. You've put a lot of effort into this release. And the fact that tools.analyzer(.jvm) has now been seriously battle tested is awesome!
02:39andyfjonasen: Thanks. I may slow down a bit on further enhancements for a while, but would like to make some more improvements to it in the future. Thanks for writing the original!
02:40jonasenimprovements always welcome! :)
02:45rurumate_I have a tree (nested sequence) of symbols, now trying to replace all '<> with 'foo everywhere. I figure it's best to use clojure.zipper, but have never used it. Any hints how to do it?
02:46jonasenrurumate: maybe http://clojure.github.io/clojure/clojure.walk-api.html#clojure.walk/postwalk-replace
02:47amalloyoh man, don't use zip for that. that won't work at all. use clojure.walk/postwalk, or writing your own recursive function isn't too hard
02:47rurumatejonasen: thanks
02:47rurumatejust curious, what would be a typical use for clojure.zipper then?
02:50rurumatepostwalk-replace works just fine
02:58amalloyclojure.zip is, i suppose, for when you care about the relationships between nearby nodes in a tree, or the relative positions of two nodes
02:58amalloyin practice i've never had a real use for it
03:27bitemyapphttp://i.imgur.com/QXqJJju.jpg
03:46andrew______anyone in here at the moment?
03:46rurumateI am
03:48andrew______i'm just curious if anyone can explain why some functions would accept other expressions vs function literals with zero arguments, such as working with (future). it seems any function literal, with zero arguments, is the same as an actual expression, no?
03:48andrew______why differentiate between them?
03:50alexyakushevandrew______: It's not clear to me what you are talking about, can you show an example?
03:51amalloyandrew______: it's just more convenient to not have to write the (fn [] ...), and it avoids cluttering your code with uninteresting artifacts
03:51amalloythe only downside is that future has to be a macro instead of a function then, but iirc there's ##(doc future-call) if you need the function version
03:51lazybotjava.lang.SecurityException: You tripped the alarm! future-call is bad!
03:51andrew______consider the difference between pcalls and pvalues. they are the same, but one takes expressions, the other #() functions with zero arguments. Seems unnecessary, since any function literal with zero arguments can be written even easier as a simple expression
03:52andrew______#(+ 5 6) rather than just (+5 2)
03:53amalloywait, are you asking why the version taking a function literal exists?/ because it's nice to have available functions that work with values rather than (in addition to) macros that work with expressions
03:53andrew______but if the function is not allowed to accept any arguments, then how is this different than an actual expression?
03:54amalloyit's different because a function is a value that exists at runtime, and an expression is a thing that only exists in the mind of the programmer and the compiler
03:57amalloyyou can write a function that calls some other function twice: (defn twice [f] [(f) (f)])
03:58amalloyhow do you make that take an expression instead of a function? it has to be a macro, and then you can't, say, map it over a list of functions
03:58andrew______in the case of pcalls vs pvalues, it just seems odd to me that the programmer would prefer to add the # to the expression and make it a function when otherwise it is the same thing you are doing
03:59andrew______pcalls will only accept functions with ZERO arguments, so your (twice) wouldn't be available; so what is the point of passing a no-argument function rather than just an expression?
03:59amalloy(defmacro twice* [expr] `[~expr ~expr]) is a pretty poor translation for several reaspons, but ignoring those, you can (map twice f g h), which you can't do for twice*
03:59amalloyer, (map twice [f g h])
04:02andrew______amalloy: your point makes sense when talking about functions with arguments, but what is the difference between passing a no-argument function and passing an expression, as is the difference between pcalls and pvalues functions?
04:04andrew______perhaps if you had a stored function with no arguments, but the function referred to outside state, like an atom? then it would make sense to pass a no-argument function, of course this would not be a pure function if it used outside state. is that the purpose of pcalls, what it expects?
04:05amalloyyou're missing the analogy. in my example, twice* is like pvalues, and twice is like pcalls. those take an expression and a function, respectively. twice* is nicer to work with sometimes, but isn't compatible with map. in the same way, pvalues is not a function that you can pass to any other function, whereas pcalls is
04:06amalloyanother example: i can write a function (defn decorate-with-logging [f] (fn [x] (...magic using f...))), and i can call that function on the *value* pcalls, but i can't call it on pvalues
04:06amalloy(decorate-with-logging pvalues) => "compiler exception what is this i don't understand, pvalues isn't a value"
04:07amalloy(decorate-with-loggin pcalls) => "sure thing bro, here's your new decorated function"
04:07andrew______both pcalls and pvalues return a lazy sequence.
04:09andrew______you seem to be talking more about the implementation of pcalls vs pvalues, but to the programmer, why would you choose one over the other? writing #(+ 6 4) is no different than the expression (+ 6 4)
04:09amalloyi haven't called pvalues at all, or pcalls, in any of my examples
04:09amalloyi don't care what their return value is; i'm talking about what their values, the functions themselves, are
04:09andrew______you said your twice function was like pcalls, and you were pointing out how twice implements differently than twice*, but I'm talking about the programmer using pcalls or pvalues
04:10andrew______(pcalls #(+ 4 5) #(* 5 7)) vs (pvalues (+ 4 5) (* 5 7))
04:10andrew______I just don't see why the pcalls version is necessary
04:11amalloynobody would ever write that call to pcalls in that scenario
04:11amalloyit's there for when your f or g are already functions, or when you need to use pcalls itself as a function for whatever reason
04:11andrew______ah so maybe the book I'm reading (Practical Clojure) is just using a poor example
04:12andrew______if your f and g are already functions, then since pcalls requires that the functions accept zero arguments, then what would these functions be doing that would make them necessary to stand alone as functions? would they typically be referring to outside state?
04:13andrew______if I write a pure function with zero arguments, it would be meaningless I would think, since it's really just a single value return, like an expression
04:14amalloypure functions of zero arguments are perfectly sensible. for example, it's a way to say "here's some computation i might need you to perform in the future, but don't do it yet because it's expensive"
04:15andrew______that makes sense. ok, i'm just trying to understand the point of it all. i guess one could generate no-argument functions at runtime via a macro, and pass those to pcalls for parallel processing, that would make sense, perhaps.
04:16andrew______or if those function were not pure and did something with outside state, that would make sense too for pcalls
04:16amalloyandrew______: that's what the ##(doc delay) macro is, really, a pretty wrapper around a no-argument function
04:16lazybot⇒ "Macro ([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls. See also - realized?"
04:17andrew______i see.
04:18andrew______well, it makes me think, that's for sure
04:22andrew______i think the book i'm reading is outdated. i shows metadata maps as being prefixed by #^ but I think now it is just the ^ right?
04:24ro_stanyone using cljx here?
04:24amalloycopyright four years ago, andrew______. so, yes, miles out of date, but that doesn't really have anything to do with pcalls/pvalues
04:25andrew______i know, different topic.
04:26amalloyall the p* functions are just marketing anyway. "look how easy it is to make your whole program magically parallel!". but in practice you have to work harder to make things usefully concurrent
04:26amalloybut yes. ^ is preferred over #^ in all cases, since...1.1? maybe 1.2
04:40andrew______the one issue I would think it quite necessary often is to know when a task ends that you sent to another thread. i know there are Watches for, is it agents? but what about all the other thread tools?
05:27ro_sti'm using cljx and prismatic's Schema. requiring Schema in my cljx for some reason doesn't put the schema source in out (with :optimizations :none). however, if i manually make a cljs file and require Schema, then it works. which is odd, because cljsbuild is just reading the cljs produced by cljx
05:28ro_stprismatic schema is itself a cljx project
05:29ro_stdnolen: any ideas? or should i check with cemerick?
05:31ro_stgah. timezones :-|
05:45AeroNotixcan I add methods to a java type using extend-type (or anything else)?
05:46AeroNotixIt looks like extend-type is to extend a type to implement protocols
05:46AeroNotixBut I just want to add methods, I suppose I could wrap a java class with my own type, but it seems a bit meh
05:47AeroNotixhmm, proxy/
05:47AeroNotix?
05:53AeroNotixand can I have private methods on def{record,type} ?
06:13bitemyappAeroNotix: ick. So much java stuff.
06:14bitemyappAeroNotix: are you integrating with some Java necessity foisted upon you?
06:14pyrtsaWhat would "private" even mean for a Clojure record where all fields are "public" and "final" in the Java terminology? :)
06:14bitemyappyeah the private part is pretty baffling.
06:16AeroNotixbitemyapp: exactly, yeah. I need to use an SDK from authorize.net
06:17AeroNotixbitemyapp: which otherwise I'd have to write SOAP bindings to their API. Which is woefully undocumented.
06:17AeroNotixpyrtsa: if I deftype something, I wanted to have a field which is not accessible.
06:18AeroNotixwith def{record,type} they *need* to implement a protocol/interface?
06:19AeroNotixbitemyapp: this is what I have so far: https://gist.github.com/AeroNotix/17904c5daef83d1cbe05
06:20AeroNotixfeels like I'm hacking a type there with the Reporter interface
06:20AeroNotixprotocol*
06:21AeroNotixThis is my first non-toy clojure code.
06:22mercwithamouthhow would one go about listening out for for links clicked with enfocus. say if i want to chain selectors.. #thisid.link with 'blah' title? https://gist.github.com/anonymous/8369691
06:26ggherdovHi. What's the canonical answer to the question "what book should I pick to get started in clojure" ?
06:26mercwithamouthProgramming Clojure(oreilly)
06:26ggherdovmercwithamouth: thanks
06:26mercwithamouthTo be honest i'm enjoying reading that one and clojure in action together.
06:26mercwithamouthI find it's better to pic a given subject then flip through several books....
06:28ggherdovmercwithamouth: I see
06:29mercwithamouthpick*
06:29ggherdovmercwithamouth: any tought to "the joy of clojure" by that guy with a dragon face on twitter ?
06:29ggherdovfogus
06:30ggherdovpreface by steve yegge sounds cool
06:30ggherdovanyways
06:33wei__is there a good way to execute a .sql file with java.jdbc?
06:33mercwithamouthi bought it...i glance at it from time to time but i'm sill new to clojure as well.
06:34mercwithamouthit can't hurt.
06:36mercwithamouthany enfocus gurus?
06:40mercwithamouthahh i see now
07:24bitemyappggherdov: joy of clojure is cool, don't listen to anything yegge says.
07:25bitemyappggherdov: JoC is good for people that have some degree of familiarity with either Lisp or FP.
07:29ggherdovbitemyapp: thanks. It's kinda my case, did some Ocaml in a past life
07:34ddima_bitemyapp: why so harsh regarding yegge? ;)
07:38Glenjamini found it a tad dry and difficult to get into
07:38Glenjaminbut i think i was looking for something a bit more "do this, do that"
07:46daGrevishi
07:46daGrevislooks okay? https://github.com/daGrevis/Project-Euler-in-Clojure/blob/master/004.clj
07:49bitemyappggherdov: close enough.
07:49bitemyappGlenjamin: do this, do that is clojurebook.com
07:50bitemyappddima_: doesn't think, not much indication he's learned much in the last (counts in head) 9 years or so I've followed his writing.
07:52andrew_____no doubt
07:54andrew_____favorite programming bloggers?
07:55bitemyappmy favorite programmers don't blog. They have better uses for their time.
07:55bitemyappI usually end up trying to extract information out of them on the occasion I catch them on twitter/reddit/IRC/stack overflow/haskell wiki
07:56bitemyappor, at the very least, I don't know any of them for what blog they might or might not have.
07:57andrew_____well there certainly are some good ones out there blogging, but none who deal with my new interests in FP and Clojure
07:57andrew_____at least none that i've found
07:57andrew_____for example there are some amazing bloggers in the iOS world, objective-C stuff
07:59bitemyappandrew_____: the best resources I've found for Haskell and FP have mostly involved the wiki, Stack Overflow, white papers, books...code.
08:01andrew_____i'm thinking about getting this book on FP: http://tinyurl.com/oy6fdwp
08:03bitemyappandrew_____: do you know ML or Haskell?
08:03andrew_____no, but i'd learn some ML quick with that book (there is actually very little Haskell in that book)
08:03daGrevisI have a coll. how can I check that all items in it are true?
08:03bitemyappandrew_____: the original was only ML. IIRC, the author switches it up to flip between with strict-by-default and lazy-by-default.
08:03andrew_____daGrevis map a simple if over the collection
08:04bitemyappandrew_____: no.
08:04bitemyapp,(every? identity [true false true])
08:04clojurebotfalse
08:04bitemyapp,(every? identity [true true true])
08:04clojurebottrue
08:04daGrevisandrew_____, i'm using map already ;)
08:04andrew_____could do that too, of course
08:04bitemyappdaGrevis: what I just demonstrated is the idiom to use in Clojure.
08:04daGrevisbitemyapp, thanks )
08:04bitemyappyou can't actually do it with a map.
08:04bitemyappit's a fold.
08:04andrew_____oh yes, you are right
08:04andrew_____could reduce it, then?
08:05bitemyappbut why would you?
08:05daGrevisis fold a func?
08:05andrew_____for fun, of course!
08:05bitemyappandrew_____: I don't think it's the right time for that okasaki book.
08:05bitemyappdaGrevis: fold is a catamorphism. reduce is a function. In Haskell, foldl, foldl', and foldr are functions.
08:05bitemyappdaGrevis: reduce is foldl, ie, left.
08:06bitemyappdaGrevis: Clojure's reduce is augmented with a weird hack to make it a short-circuiting left fold.
08:06daGrevisbitemyapp, i see
08:09andrew_____well, it's been fun, fellas
08:09andrew_____i'm going to read some more now
08:09andrew_____i'll save okasaki for next week
08:12ddima_bitemyapp: ahk, thanks. haven't followed him too closely, but he gets mentioned a lot ;)
08:18daGrevishey how could I say (range 1 infinity)?
08:19hyPiRion(iterate inc 1)
08:19hyPiRionor (rest (range))
08:19daGrevishyPiRion, thanks
08:24hyPiRionnp
08:35daGrevishow can I say (take-while fn-with-args coll)
08:35TimMcdaGrevis: (range 1 Double/POSITIVE_INFINITY)
08:35TimMc(another approach)
08:36daGrevisTimMc, cool ;)
08:36TimMcBut bear in mind that if you really expect to hit some truly large numbers, range will not give you an infinite seq.
08:36daGrevisI guess I can use anon-fn
08:36hyPiRiondaGrevis: that depends on the arguments. Usually you can wrap it in an anonymous function or use partial
08:36hyPiRionyeah
08:36daGrevis:)
08:36TimMcYou want (iterate inc' 1) for that, since inc' will autopromote to BigInteger as needed.
08:37daGreviswhat's '? TimMc
08:37TimMcJust part of the name of in'
08:37TimMcerr, inc'
08:37TimMc(doc inc')
08:37clojurebot"([x]); Returns a number one greater than num. Supports arbitrary precision. See also: inc"
08:37hyPiRionTimMc: Now I want to check if that's actually a problem
08:39daGrevisTimMc, in that case,what's the difference between inc and inc'?
08:39daGrevisshit it shounds like ink in my head
08:39hyPiRiondaGrevis: It's usually easier to explain with an example
08:39hyPiRion,(inc Long/MAX_VALUE)
08:39clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
08:39hyPiRion,(inc' Long/MAX_VALUE)
08:39clojurebot9223372036854775808N
08:50TimMcdaGrevis: See the "N" at the end of the latter result? That's how Clojure prints BigInteger, which isn't a fixnum.
08:51daGrevisTimMc, I see, thanks :)
08:51TimMchyPiRion: That'll take a while... maybe try starting higher? :-P
08:51hyPiRionTimMc: No, that's why I want to try it :p
08:52TimMc&(time (/ 1 0))
08:52lazybotjava.lang.ArithmeticException: Divide by zero
08:53hyPiRionTimMc: JVM_OPTS='' time lein eval '(last (iterate inc 1))'
08:54TimMcheh
08:55TimMchyPiRion: You don't think JVM startup time won't significantly affect the measurement? ;-)
08:55hyPiRionTimMc: I'll subtract a minute or two, for good measure :p
08:55daGrevis(take 1 coll) gives back (x). is there a better way to get back x without (first (take 1 coll))
08:56TimMc(first coll) will do it
08:56hyPiRiondaGrevis: (first coll) works, or (nth coll 1)
08:56hyPiRion(nth coll 0) I mean. Silly me
08:57daGrevishyPiRion, ye, stupid me. :)
08:58Morgawribdknox: I noticed https://github.com/LightTable/LightTable/commit/e184b1b982cdd0b7aa8d2cb3276d54f13d98db53 this merge in LT, aside from the common flamewarsy issues... it's just a regex that changed "he" with "they" even in places where it doesn't make sense (they's, they doesn't, etc etc), shouldn't this be reverted or fixed in these places?
09:01TimMchaha
09:02TimMcA friend of mine who writes fiction often complains about not having a tool that can automatically swap out genders when he's midway through writing a story.
09:02hyPiRionMorgawr: yeah, looks a bit out of place.
09:03MorgawrhyPiRion: I know that "feminist software foundation" is just a troll/satire thing and I don't want to get into the matter (not worth the internet hate because of it), but objectively that merged request is just wrong because unmatched verbs lol
09:03Morgawr(regardless of the legitimacy of changing he/she with they/one)
09:04TimMc(But being a programmer, acknowledges that this would be mucho difficult.)
09:04MorgawrTimMc: bonus points if somebody finds how to do that in a single regex
09:06hyPiRionMorgawr: I don't know much about FSF, but I've realised the problems with he/she in documentation. At least they are attempting to remedy the issue, whether that's automated or not.
09:07TimMchyPiRion: https://github.com/LightTable/LightTable/pull/1055 It's a troll.
09:07MorgawrhyPiRion: http://knowyourmeme.com/memes/events/c-plus-equality-c
09:07hyPiRionOh, and by FSF I meant Feminist Software Foundation, not Free Software Foundation
09:08TimMcI doubt a legit request would confuse male defaulting with transphobia.
09:08MorgawrI just call Poe's Law in these cases and move on
09:08Morgawrbecause it's really not worth it to argue
09:09bitemyappit says something that the PR was merged.
09:10TimMcbitemyapp: Yeah, that makes me sadpanda. It sets a bad precedent at the very least.
09:10bitemyappOne day, I'll have a library popular enough to get a PR from the feminist software foundation.
09:10Morgawrit was merged mostly because ibdknox can't be arsed to bear with this bullshit (at least that's what I infer from his tone), after all it's from upstream code so it shouldn't even be his concern (it will be re-merged as it was when the upstream code is updated anyway so who cares)
09:11TimMcAh. Fair point.
09:12bitemyappmy antipathy for post modernism is glowing red.
09:12Morgawrbitemyapp: I feel you
09:13bitemyappI think half of po-mo is an excuse for the developed world to navel-gaze so hard that western society collapses in on itself.
09:13bitemyappand we'll deserve it.
09:28Glenjaminbitemyapp: cheers for the tip, i've done enough now that i'm ready to properly tackle JoC once the 2nd edition is done :)
09:28Glenjaminthese testimonials sound good though, i might pick up clojure programming anyway
09:29RickInAtlantaI am reading the MEA right now
09:29RickInAtlantaMEAP
09:29bitemyappI just learned this exists: http://en.wikipedia.org/wiki/Grand_Canal_(China)
09:29Glenjamini've got the meap, but too lazy to read it all as pdf :D
09:29bitemyappMind boggling.
09:30RickInAtlantaI downloaded it as .mobi, using kindle reader
09:30Glenjamini'm pretty sure i did the one that involves a paper book arriving at some point, so i expect a surprise present in the springtime
09:38daGreviswhat is this line doing? let [ns (sort > nums)
09:39daGrevisexactly, sort > nums
09:39daGrevissort isn't defined in that file and I can't find it in core api
09:39Morgawrdmi3y: defines 'ns' within the let binding by sorting "nums" using > comparator
09:39Glenjaminsort nums using >
09:39lumafi,(sort > [3 2 4 1 5])
09:39clojurebot(5 4 3 2 1)
09:39Morgawr,(doc sort)
09:39clojurebot"([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array."
09:39daGrevislumafi, Morgawr it's not here :( http://clojuredocs.org/quickref/Clojure%20Core
09:40daGrevisthanks
09:40hyPiRionTimMc: (last (iterate inc 1)) takes more than one hour, at least
09:40hyPiRionI gave up at that point
09:40MorgawrdaGrevis: http://clojuredocs.org/clojure_core/clojure.core/sort using the "search" at the top
09:40Morgawrbut yeah, I usually use "doc" and "source" because they are great tools
09:40Morgawrone of the reasons I love clojure
09:41RickInAtlantahyPiRion: Isn't that an infinite sequence?
09:41MorgawrhyPiRion: not sure if serious
09:41hyPiRionRickInAtlanta, Morgawr: No
09:41hyPiRionwell, yes, but it errors
09:41hyPiRion,(last (iterate inc (- 100 Long/MAX_VALUE)))
09:42clojurebotExecution Timed Out
09:42hyPiRionwhops, wrong way
09:42hyPiRion,(last (iterate inc (- Long/MAX_VALUE 100)))
09:42clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
09:42Morgawrah, I see, it errors
09:46expezHow do you load your project when using cider? Do you have to use C-c C-k on each file? Right now cider-jump et. al does nothing when acting on my own code.
09:52progoC-c C-k on core.clj does the trick
09:55expezthanks
10:15mklappstuhlwhats the best place to jump start into clojurescript knowing javascript and some clojure?
10:16insamniachttp://www.youtube.com/watch?v=MTxNnYfWHOw
10:16insamniacunless you don't like watching videos
10:18insamniacReally I shouldn't be answering, 'cause you and I are in the same boat.
10:18RickInAtlantahttps://github.com/magomimmo/modern-cljs
10:19insamniacNeat. Thanks, Rick.
10:19RickInAtlantanp
10:19insamniacAre you in the atl-clj meetup group?
10:19RickInAtlantaYep
10:20RickInAtlantaAre you?
10:20insamniacI wanted to go to that Datomic presentation
10:20insamniacyeah, but I live in Augusta
10:20RickInAtlantaThat is tuesday
10:20RickInAtlantaah, ok
10:20insamniacyeah.. I have like 2 vacation hours, otherwise I'd be going.
10:21RickInAtlantaIs there much Clojure in Augusta?
10:22insamniacI have no idea. Certainly not where I work. I don't socialize too much, but I don't think I've met anyone who's even heard of it. Unless they heard it from me.
10:23MorgawrAmsterdam clojure meetup representative checking in! :D
10:23insamniacI work with Java people who are reluctant to even adopt Groovy.
10:24RickInAtlantaThere seem to be a few companies using Clojure in Atlanta. We probably have about half a dozen people who attend the meetings that get to use it for work
10:25edwWhen I was in Philly, we have an FP meet-up, which was always fun because you'd have the Clojure and Scala people there, feeling complete mutual hostility.
10:27RickInAtlantaThere has been some talk about starting a FP group in Atlanta. The Clojure group meets every month, but Scala only met a couple of times last year
10:27edwMy company is a next door to Foursquare, and one of my guys' gf works there, and so he was at the company Xmas party, where once of their alpha nerds ridiculed him for working at a company that used Clojure.
10:27mklappstuhlinsamniac: don't really like videos. want to setup a quickstart stack and get my hands dirty kind of :)
10:28RickInAtlantamklappstul, did you see my link, to modern-cljs
10:28RickInAtlantahttps://github.com/magomimmo/modern-cljs
10:28mklappstuhlRickInAtlanta: that link (modern cljs) looks good :)
10:28insamniacOh look at Rick's link
10:28RickInAtlanta:)
10:28edw(This ridiculing guy was a big Scale guy.)
10:29Morgawredw: sounds like sour grapes :P does he get to work in Scala at the company?
10:29insamniacI think Foursquare is one of the first mentioned when you ask who uses Scala.
10:30insamniacearly adopters
10:30Morgawroh okay, I didn't know that (not much into the Scala world or companies world :P)
10:30edwMorgawr: I think so. I think he's a true believer. Some people aren't content to do their thing, they need to convince everyone else that what they're doing is wrong. For my part, I tell people to STFU about our Clojure use because I see it as a competitive advantage.
10:31edwMorgawr: Twitter's big into Scala.
10:31edwIs there a JVM-hosted Haskell?
10:32MorgawrI'm waiting for the day the world realizes that all these new language iterations are eventually going to converge into something that a few people have been using since the late 50s/early 60s, known as "Lisp"
10:32Ember-most likely no since JVM doesn't support TCO and that's kinda mandatory for Haskell
10:32Pupnik_edw, yeah but i dont remmeber the name
10:32Ember-this one guy I know started to create a Haskell to java bytecode compiler
10:32Morgawra quick googling gave me this http://jaskell.codehaus.org/ not sure if relevant
10:33Ember-he said it was pretty straightforward until he had to implement TCO where he hit a brick wall
10:33edwEmber-: Ah, good point. That's why I'm basically not a Scheme programmer anymore.
10:33Pupnik_while you're at it give haskell lisp syntax
10:34MorgawrPupnik_: it's called typed clojure ;)
10:35edwPupnik_: While I'm a parens (and brackets and brockets and braces) man, Haskell's syntax is justifiable IMO because it's basically maths notation in seven-bit ASCII.
10:37AeroNotixSo much misunderstandings in the last few sentences
10:37insamniacyeah, what the hell is a brocket
10:37insamniachah
10:38edwE.g. "x <- A" can be read like "x is an element of A" and <- sort of looks like "∈".
10:38edwinsamniac: Sorry, spent too much time in #scheme with Riastradh: angle brackets.
10:38Morgawrinsamniac: a two-year-old red deer with its first horns
10:38Morgawrhttp://www.thefreedictionary.com/brocket
10:38insamniachaha
10:39edwWow, the Free Dictionary wants to send notifications to my Message Center. Umm, no, but thank you.
10:40edwhttp://mumble.net/~campbell/scheme/style.txt
10:40Morgawredw: sorry, I use that becaue duckduckgo redirects me there when I use !d
10:40Pupnik_AeroNotix, care to elaborate?
10:40edwActually, he uses "brokets".
10:41edwhttp://en.wiktionary.org/wiki/broket
10:41edwNot _his_ neologism. Perhaps an MIT AI Lab thing.
10:41AeroNotixPupnik_: Morgawr saying that everything will eventually converge on everything being a lisp. It's just fail
10:42AeroNotixand the JVM supports tail recursive calls
10:42MorgawrAeroNotix: it was mostly a joke of mine
10:42Morgawrbut trends seem to go that way feature-wise :P
10:42AeroNotixjust not eliminating the stack at tail calls
10:42AeroNotixbut recursive ones work, AFAIK
10:43edwI've been very fortunate in that I had a lot of experience on the metal in assembly, bit twiddling in C, etc, but also with Scheme. I think you need nice mix of high and low. The stars and the gutter.
10:43AeroNotixMorgawr: sure, go write a typesafe applicative monad in Clojure. I'll wait.
10:44edwAeroNotix: Isn't sime Quixote working on typed Clojure?
10:44edws/sime/some/
10:44insamniacambrose
10:44Morgawr^
10:44AeroNotixWhat kind of typesystem is it going to have, though?
10:45edwWhat's the term the Scala true believers throw around imperiously?
10:45MorgawrAeroNotix: https://github.com/clojure/core.typed
10:45Morgawr(I don't personally know much about the details in typed clojure, the repo and docs probably know more)
10:45Morgawrbut yeah, interesting project yadda yadda might be worth considering for the future yadda yadda
10:45Pupnik_theres a clojure lib that ports haskells monad stuff over
10:45Pupnik_thought not the type system
10:45edwVery odd how Haskell programmers seem to have less of a chip on their shouder than Scala one do.
10:46AeroNotixPupnik_: and therein lies the fail
10:46edws/one/ones/
10:46AeroNotix(
10:46AeroNotix(I'm not saying these things are needed, but they are different features which don't exactly fit in Clojure, and thus, mean that it is not converging on Lisp)
10:47edwAeroNotix: Good of you to keep the "fail" thing going. I was afraid that we might be living in a world where people didn't say "rofl" instead of laughing.
10:48AeroNotixedw: what on Earth are you talking about? Address my points instead of using ad hominem.
10:49insamniacTake a coffee break..
10:49AeroNotixMorgawr: I just dislike fanaticism
10:49AeroNotixthere's no need for it
10:49insamniacWho's being fanatical?
10:50AeroNotixMorgawr was bordering the line, insamniac
10:50AeroNotixbut w/e. No big deal.
10:50Morgawrit was a joke D:
10:50MorgawrI'm far from a lisp fanatic
10:50Morgawronly lisp I've ever used is Clojure after years of coding in C (and I still consider that my favorite language)
10:51edwAeroNotix: Sigh. A bit quick on the ad hominem trigger, yes? I've simply got sick of people saying "FAIL!" and "EPIC FAIL!"
10:51AeroNotixedw: cool
10:52edws/got/gotten/
10:52AeroNotixTyped clojure sounds annoyingly like Dialyzer
10:52edwAeroNotix: Please recall that I was defending Haskell's syntax supra.
10:53AeroNotixedw: ok, standing down. I don't care.
10:53edwAeroNotix: Sounds good to me.
10:53AeroNotixAnyone with experience of typed clojure and dialyzer?
10:54AeroNotixWatching a video here seems to make it look very similar in usage
10:54dnolenAeroNotix: Typed Clojure is not really all that related to dialyzer at all
10:54dnolenAeroNotix: dialyzer is not a type system
10:54Morgawrisn't dyalizer more like a linter?
10:54dnolenAeroNotix: Typed Clojure is a fully typed dialect of Clojure, based on Typed Racket, tons of prior research
10:54Morgawrdialyzer*
10:55AeroNotixMorgawr: bit of both, really
10:55AeroNotixdnolen: hmm ok
10:55dnolenMorgawr: yes
10:55dnolenAeroNotix: good chunk of ML derived type system ideas are present in Typed Clojure and then some, like typed heterogenous maps
10:56edwI wonder, on the topic of type inference, how much it even makes sense in Clojureland, since so many data structures are simply maps. Maps that could theoretically by checked against schemas, I suppose, which could constitute a sort of type membership test. Hmm.
10:56AeroNotixdnolen: interesting. Are people using it in production?
10:56dnolenAeroNotix: yep
10:56AeroNotixwicked
10:56insamniacdnolen: Is there gonna be a talk on Om that will make it to ClojureTV any time soon?
10:56Morgawrtalking about linters, saw this a few minutes ago https://groups.google.com/forum/#!msg/clojure/uITu1sT3SaQ/c85ih4zM4qwJ
10:56dnoleninsamniac: don't think so, but I expect to giving talks about it plenty this year
10:57insamniacCome on down to Georgia
10:57insamniacYou'll have at least one person in the audience.
10:57dnoleninsamniac: heh :)
10:57edwdnolen: Is the name inspired by the restaurant?
10:58dnolenedw: no play on DOM, and Om from sanskrit
10:59edwGood restaurant though. UES. Fugue states have been entered after meals there.
11:02RickInAtlantasorry, was away.... insamniac two
11:05insamniacRickInAtlanta: Are there any big conferences in ATL? I've only just started to try and be less antisocial.
11:06insamniacThe wife does like going to ATL for the vegan restaurants though.
11:06RickInAtlantainsamniac: DevNexus is next month.
11:06RickInAtlantaI think there is going to be an open source conference in late spring or early summer...
11:06insamniacInteresting. Now to get my boss to pay for it.
11:07RickInAtlantaconference isn't expensive. $240 for 2 day event. but it is a monday and tuesday... I was going to go last year, but I just started a new job the week before, and didn't feel like asking for time off right away
11:10RickInAtlantahttp://greatwideopen.org/ open source conference in Atlanta, April 2 and 3
11:14dnolenlsdafjklsd: you there?
11:14insamniacRickInAtlanta: Cool. I will make an effort to attend both of those.
11:14lsdafjklsddnolen: ya man
11:15dnolenlsdafjklsd: this is yours right? https://github.com/swannodette/om/issues/54
11:15lsdafjklsddnolen: no
11:15dnolenlsdafjklsd: oh hmm, very similar looking code :)
11:15dnolenlsdafjklsd: k thanks
11:17lsdafjklsddnolen: that's wierd :p
11:22webstonnehello
11:23insamniacHell-o
11:24webstonnewhat is the hot jobs in Clojure right now?
11:24webstonneweb apps?
11:25MorgawrI'm working on game development but I'm probably one of the few people (maybe 5? 10?) doing so in clojure
11:25webstonneyou use HTML5 with that?
11:25Ember-I can guarantee that there are more than 10 ppl worldwide doing game development with clojure
11:25webstonneand Clojure as the scripting?
11:25MorgawrI've done a couple of ClojureScript games with HTML5 yeah but now I'm working on a Clojure (JVM) engine
11:25Morgawrnon-html5
11:25MorgawrEmber-: I hope so :D
11:26webstonneI see ...
11:26Ember-the very least I could see clojure as a server side language for mmorpgs and such
11:26Ember-that's game development too
11:26webstonneI'm just trying to get a feel on where things are
11:27RickInAtlantahave you seen moorepl? It is a browser based mud that allows players to script the environment in Clojure.
11:27Glenjamindnolen: can cljs/om run server-side? is there a suggested approach for rendering the initial page load in a crawler-friendly way?
11:27RickInAtlantaNot production ready, but it looked like a neat experiment
11:27edwwebstonne: We (at my start-up) use Clojure extensively for web service development and data processing.
11:27dnolenGlenjamin: https://github.com/swannodette/om/issues/47
11:28Glenjaminawesome, thanks
11:28dnolenGlenjamin: but also you could easily make a small library that generates the type of markup that React expects
11:28dnolenGlenjamin: I think this is the real solution versus running CLJS server side
11:28Glenjaminthe thought struck me as i was watching the react presentation from jsconfeu
11:28webstonneyes, data processing ... thanks. I was thinking about that
11:29MorgawrRickInAtlanta: can't find it via google, got a link?
11:29edwwebstonne: Cascalog was actually, about three years ago, the catalyst for my dropping Scheme (for fun) and Python (for profit) and using Clojure in production.
11:29edw...for both fun and profit.
11:29Glenjaminthe "big data" team at my work seem to just be using hive - which seems like cheating to me
11:30RickInAtlantaah I spelled it wrong, murepl https://github.com/nathanielksmith/murepl
11:33edwGlenjamin: We wound up moving from Heroku Pg to Redshift for a lot of our reportorial work.
11:34Glenjaminthey mostly just have a big oracle db, i think hadoop was just an excuse to spend some cash
11:36delihiroshi all. I'm reading IFn.java (https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java) now, but I can't understand why invoke being defined like this. Is there any reason for that?
11:37webstonneYou think ClosureScript will give Hive a run for it's money?
11:38edwGlenjamin: I spent a lot of time working with Hadoop in the context of Cascalog a few years ago, and we've spent a lot of time with EMR at the current gig. The esteem in which I hold Hadoop monotonically decreases. It works--or can be made to work--but it's a skanky kludge.
11:38edwIt drove me away from Cascalog.
11:38webstonneand become a first class query language working with big data?
11:38edwwebstonne: Not sure what you mean; are you suggesting a MongoDB-style DB using CLJS as a query language?
11:39GlenjaminSQL is so good because it's a declarative approach to extracting data, and its been around long enough that pretty much everyone knows it
11:39Glenjaminto be better than SQL for querying data, you'd have to be *very* good
11:39Glenjaminmeanwhile someone will take whatever you've done, and write a way to translate SQL into it
11:39Glenjaminand the cycle begins again :p
11:39webstonneMongoDB-style DB using CLJS as a query language? ... yes something on that order
11:40Glenjamindelihiros: it's a speed trick for the JVM afaik
11:40Glenjamin"Object... args" is slow
11:40Glenjaminso if you can avoid that, you'll be faster
11:41edwA good friend of mine (who is very opinionated) has said that you can either make MongoDB safe or fast. Sort of like the MySQL of old.
11:41delihirosGlenjamin: oh, didn't know that, thank you
11:41Glenjamini think neither is true
11:41Glenjaminwe're using it as a non-primary
11:41Glenjaminso we turned off fsync, and write concerns, and journalling
11:41Glenjaminand it's still not that fast
11:42edwI think, uncharacteristically, my friend was being generous.
11:42MorgawrRickInAtlanta: wow, murepl looks cool as hell, thanks for the link!
11:42RickInAtlantaGlenjamin: I am getting ready to start a project, I was going to use Mongo. Do you have an alternative I should explore?
11:42edwRedis, on the other hand, has become my hammer.
11:42GlenjaminRickInAtlanta: i hear good things about rethink, but it depends on your problem space
11:43Glenjaminmongo will probably be good-enough
11:43RickInAtlantaMorgawr: yeah, he did a talk about it at the Atlanta meetup group. I thought it was fantastic.
11:43Glenjaminas would postgres/mysql
11:43edwRickInAtlanta: It comes down to what your data looks like, and how you want to query it, and what you're willing to be slow vs fast, and whether you're willing to spend shit-tonnes of money.
11:44RickInAtlantaedw: cost is a much bigger issue than speed in this case
11:44MorgawrRickInAtlanta: is there a video of such talk?
11:44Glenjaminsomeone was pointing out to me the other day that for most side-projects, in-memory maps + slurp/spit to disk is probably "good enough"
11:44edwFor example, if your data set is big, Redis is out of the question. (Or if you want to, you know, not program atop a fairly primitive datastructure store.)
11:44RickInAtlantaMorgawr: no, no video. sorry
11:45MorgawrRickInAtlanta: aw, shucks, but still great project
11:45edwGlenjamin: Yes, that or Pg.
11:45Glenjaminmm
11:45Glenjaminmy main complaint about pg
11:45Glenjaminis that its a proper database
11:45Glenjaminwith strict types
11:45Glenjaminand i'm lazy when i use dynamic languages
11:45edwGlenjamin: I say Pg because it's easy to provision and writing to a local disk is not always possible.
11:46Glenjaminyeah, i'm on heroku for my app so currently thinking i'll use pg
11:46edwGlenjamin: Yes, I hear you on that. There's always serializing to TEXT/BLOB columns.
11:46Glenjaminbut so far i'm managing to get away with only using cookies + logs :D
11:47edwGlenjamin: Exactly. I'm becoming a big fan of HTML local storage. If only iClould would sync that across my devices.
11:47webstonnemaybe this is the video I need to watch to see some of the future possibilities of Clojure may be heading ... http://www.youtube.com/watch?v=2WLgzCkhN2g
11:47Glenjaminoo, that'd be neat
11:47Glenjamini've got a /hax URL on mine that spits out a QR code containing the whole session data
11:47webstonneMaster Plan for Clojure Enterprise Mindshare Domination - Neal Ford
11:48edwQR codes can hold an aribtrary amount of data? Do they just get larger?
11:48Glenjaminmy session is small :D
11:48Glenjaminbut technically, yes i think they can be arbitrarily large
11:48edwThat would be the first justifiable use of QR I've come across.
11:49Glenjaminand if you know you're in a high-fidelity situation you can turn down the error correction to decrease entropy
11:49Glenjaminlogin on desktop, transfer to mobile is a nice flow
11:49webstonnethanks for all the great input. catch you all later
11:49edwBack in the old days, there was a product that would scan paper and turn it into binary files. It was big (to the extent that it was ever big) back when computer magazines had pages of code in them.
11:50Glenjamindo you recall when TV shows about games used to broadcast the binary at the end of the credits?
11:50edwWhat was that? Shit, that was almost thirty years ago.
11:50edwGlenjamin: Sadly, I missed that.
11:55Glenjamini'm failing to find any reference to this on the internet
11:55Glenjaminbut i'm sure it was a thing
12:03Glenjamindo you guys think i should invest my time learning emacs, or learning lighttable & making plugins for the bits it doesn't do yet?
12:05AeroNotixDepends how much you care
12:05AeroNotixemacs really integrates well with Lisps, LightTable is not really proven in the sense that emacs is
12:06variousteme
12:06edwGlenjamin: Emacs but keep an eye on Lighttable.
12:06Glenjaminyeah, i'm trying to guess whether the learning curve of emacs is more of a problem than the immaturity of lighttable
12:07edwGlenjamin: Emacs will be around in fifty years.
12:07Morgawredw: not if lighttable beats it ;)
12:07edwI've been using Emacs for over twenty.
12:08edwMorgawr: I hear you. And I wouldn't mind, I suppose.
12:09edwLet me know when I can M-C-h to select a top-level form in Lighttable. But again, I'm a big fan of it.
12:09edwMorgawr: It being LT.
12:14mercwithamouthi switch between emacs and light tablee every few weeks.
12:16gcganleyim thinking of moving from vim to emacs because i'm learing clojure. is there a way to adapt keystrokes from vim to emacs?
12:16mercwithamouthevil
12:16mercwithamouth...if i'm not mistaken though vim as fireplace is it?
12:17edwNot to be confused with 'vile'.
12:17gcganleyoh wow thats exactly what im looking for, but is it more worth it to relearn the keystrokes of emacs or just use evil
12:18edwgcganley: In general, I think, when learning something new, you should let the essence of that thing wash over you, and not try to constantly be thinking about it in relation to something which has a completely differen gestalt.
12:19edws/differen/different/
12:20edwgcganley: These days, Emacs is fairly approachable if used with a windowing system. We had web designers using XEmacs in an X11 session back in '98 at CDNOW. Now _that_ was a nightmare.
12:21edwgcganley: I used to be Emacs-in-a-terminal true believer, but I've been using Emacs as a Cocoa app for the last six months, and I'm OK with that now.
12:21gcganleyedw: im dual booting windows 8.1 and arch linux but i mainly use windows for the gameing and rebooting into archlinux is a bit of a hassel, is the win32 version of emacs as mature and powerful as the *nix version/
12:21gcganley*?
12:21clojurebot* is just for when you are lazy and sloppy
12:22mrhankydoes anybody know a good resource for using cljs.async? i don't get this whole stuff :/
12:22edwgcganley: I don't know, but I believe that there's a Windows build of Emacs 24.4, which means it's the same Emacs we Unix/Mac users are using.
12:23edwOr a 24.3, which is the latest stable release.
12:23edwLots of great polish in 24.4 though.
12:24gcganleyedw: is it strictly needed to learn elisp to use emacs to its full potential or is it just something you use for key binding customization
12:24gcganleyedw: also thanks for helping out
12:24edwgcganley: You should consider starting up Emacs, typing Control-H then 't' and then spending an afternoon learning Emacs.
12:24edwgcganley: No, you don't need to know elisp at all for Emacs to be an awesome editor.
12:25edwgcganley: You're welcome.
12:25Glenjamini've done C-h t twice now
12:25Glenjaminafter the first time i didn't touch emacs for a month or two
12:26Glenjaminthen accidentally opened it in my shell and couldn't remember how to exit
12:27edwGlenjamin: C-x C-c. I was utterly traumatized by vi when I first encountered in back in '89. I pissed off the sysadmin because I would hang his serial line because I'd disconnect. ESC ":q!"
12:27Glenjaminyeah, i found it in the end
12:28Glenjaminit doesn't help that cocoa emacs allows cmd+q
12:28edwGlenjamin: Maybe the point is that you _can't_ quit until you learn how. :P
12:28gcganleyyeah my Visual Studio buffers are full of :x
12:28Glenjamini was doing C-h a and looking for "quit"
12:28Glenjaminnot knowing the term i needed was kill
12:28Glenjaminfor years the only vim i knew was :q!
12:28edwgcganley: A friend and colleague would send me email messages filled with stuff like that.
12:29edwGlenjamin: Right! ":q! EDITOR=emacs crontab -e ..."
12:29Glenjaminheh, even worse
12:29GlenjaminEDITOR=nano
12:40gtrakhow do I make this work? ## (read-string "cljs.core//")
12:40lazybotjava.lang.RuntimeException: Invalid token: cljs.core//
12:40Glenjamingtrak: what are you trying to do?
12:41gtrakslurp the spitted output of the cljs analyzer back into a data structure.
12:41gtrakchokes on the '/' var.
12:41Glenjaminoh, i see
12:41gtrakso, prn is creating something that read can't handle
12:43Glenjamin## (read-string "clojure.core//")
12:43lazybot⇒ clojure.core//
12:43gtrakspecial-case?
12:44Glenjamininteresting
12:44echosaHey, all. Google has failed me. What can I do about this: "Don't know how to write JSON of class org.h2.jdbc.JdbcClob" (using clojure.data.json and clojure.java.jdbc)
12:44gtrakwell, I can special case it in mine with some replaces
12:44echosaThe issue seems to be with SQL tables defined with "text" columns
12:44gtrakthen replace it later...
12:45Glenjamin## (let [/ 1] /)
12:45lazybot⇒ 1
12:45gtrak##(symbol "cljs.core//")
12:45lazybot⇒ cljs.core//
12:45gtrak##(name (symbol "cljs.core//"))
12:45lazybot⇒ ""
12:45gtrakhmm
12:45gtrak##(name (symbol "cljs.core/" "/"))
12:45lazybot⇒ "/"
12:46gtrakah, lol
12:46gtrak##(symbol "cljs.core/" "/")
12:46lazybot⇒ cljs.core///
12:46Glenjaminhrm
12:46gtrakthat makes no sense
12:47gtrakah, my fault, actually, extra slash
12:47gtrak##(symbol "cljs.core" "/")
12:47lazybot⇒ cljs.core//
12:47Glenjamini think it's a reader thing
12:47Glenjamini can assign to "user//"
12:47Glenjaminand access as "/"
12:47Glenjaminbut not as "user//"
12:47gtrakit's definitely a reader thing
12:48Glenjamini guess either prn should turn it into a call to symbol, or the reader should handle it
12:49Glenjaminweird that clojure.core// works though
12:49Glenjaminalthough it wants a second newline on the repl for some reason
12:52gtrakI'm doing a string/replace on input, followed up by a clojure.walk
12:53gtraknot the worst thing in the world
12:54echosaAh, had to add a custom :row-fn to my (sql/query) call that does this: (with-open [rdr (java.io.BufferedReader. (.getCharacterStream value))]
12:54echosa {:id (:id row) :name (apply str (line-seq rdr))})
12:54echosaOops. That shouldn't have been two lines/messages.
12:57Glenjaminhrm, seems inelegant - is there a protocol you can extend to tell clojure.java.jdbc what to do?
12:59Glenjaminechosa: it looks like you should be able to extend the http://clojure.github.io/java.jdbc/#clojure.java.jdbc/ISQLValue to your type
13:00Glenjaminor actually, it's the json bit that's missing the protocol
13:00Glenjaminhttp://clojure.github.io/data.json/#clojure.data.json/JSONWriter
13:01echosaAh, JdbcClob is not in the list of "known implementations"
13:01Glenjaminmm
13:01echosaNot sure how to add an implementation. Off to Google I go!
13:01Glenjaminyou can just implement that protocol for JdbcClob, and it should work nicely
13:02Glenjaminhttp://clojure.github.io/clojure/clojure.core-api.html#clojure.core/extend
13:02echosaThis is my first clojure experience and project. Trying to learn it. I've written Lisp stuff before, just never clojure.
13:03Glenjaminif you've used haskell at all, this is similar to type classes
13:05gtrakefff yes
13:05gtrakabout 20 minutes away from a cljs-autodoc proof of concept :-)
13:07TimMchyPiRion: I think I left (last (iterate inc 1)) running overnight once.
13:07Glenjaminpresumably it runs forever?
13:08gtrakmore importantly, start of infrastructure to do more
13:08TimMcWhat you should do is (time (try (last (iterate inc (- Long/MAX_VALUE 100000))) (catch ArithmeticException ae :whoops!)))
13:08TimMchyPiRion: ^ then you can estimate how long it would take starting at 1
13:09Glenjamini guess clojure doesn't automatically coerce a long into a double?
13:10Glenjamin(like JS)
13:24echosareally dumb, newbie question: Can someone explain reify?
13:26xificurC,(doc reify)
13:26clojurebot"([& opts+specs]); reify is a macro with the following structure: (reify options* specs*) Currently there are no options. Each spec consists of the protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args+] body)* Methods should be supplied for all methods of the desired protocol(s) and interface(s). You can also define overrides for meth...
13:27andersfechosa: if you're familiar with java, reify is very much like creating anonymous classes
13:27echosaxificurC: I've read the docs, but I still get confused when I see "reify" or "reified" in the stuff I'm reading.
13:27gfredericks"reified" would be a more general idea
13:28echosaandersf: Ah. Hm. I need to keep that in mind when I'm reading about it. Might help me understand better. Thanks.
13:28xificurCyou can take a protocol or interface and extend it or override some of its methods
13:28gfredericksechosa: "reify" could refer to that general concept or to the macro clojure.core/reify
13:29Glenjamin"make this instance respond to these protocols in this way" - is that the idea?
13:29gfredericks,(deref (reify clojure.lang.IDeref (deref [this] {:this this :foo 42})))
13:29clojurebot{:this #<sandbox$eval47$reify__48@161c2fb: {:this #<sandbox$eval47$reify__48@161c2fb: {:this #<sandbox$eval47$reify__48@161c2fb: {:this #<sandbox$eval47$reify__48@161c2fb: {:this #<sandbox$eval47$reify__48@161c2fb: #>, :foo 42}>, :foo 42}>, :foo 42}>, :foo 42}>, :foo 42}
13:29gfrederickslol
13:29gfredericksfantastic example there :P
13:30echosaThere's a bot in here that executes code? That is fantastic.
13:30xificurCe.g. you can return an object that implements ISeq but change its seq method
13:30gfredericks,(count (reify clojure.lang.Counted (count [this] 30000)))
13:30clojurebot30000
13:31echosaSo, similar to method overloading? At least that's what the (count) example seems to show.
13:31gfredericksechosa: what other langs are you familiar with?
13:32echosaPHP, JavaScript, Java, in that order
13:32gfredericksaw dang PHP is the one I know the least :)
13:33Glenjaminvar a = {}; a.toString = function() { return "abc" }; console.log("" + a)
13:33Glenjaminkinda like that, if i'm following correctly
13:34matt444emacs newb question. I'm using clojure mode, can wrap with parens using M-(
13:34matt444But cannot wrap brackets
13:34matt444How are people doing this?
13:34gfredericksmatt444: I always make an empty pair of brackets and then use slurp
13:34xificurCC-<right>
13:34gfredericksI don't often do things optimally though
13:35echosamatt444: I let paredit handle my braces/parens/brackets/quotes for me.
13:35matt444echosa: not sure what you mean
13:35echosaparedit is an emacs package you can install
13:36echosaand it's awesome for handling all those things I mentioned
13:36matt444i know, i have it
13:36echosatakes a few minutes to get used to it
13:36matt444it comes with clojure mode
13:36echosaah, then specifically you can do what gfredericks sais about slurping
13:36echosa*said
13:36gfrederickswhich is M-) I think
13:37echosaI believe so
13:37gfredericksat least for me
13:37gfredericks(from inside the [])
13:37matt444maybe paredit isn't on be default with clojure mode, should check
13:37echosaso given: "thing to wrap"
13:37gfredericksmatt444: the modes are usually listed at the bottem
13:37gfredericksM-x paredit-mode to toggle on/off
13:37echosaI would do this: () "thing to wrap"
13:37echosathen inside the () type M-)
13:37matt444gfredericks: bottom of what?
13:37gfredericksmatt444: right below the buffer
13:37echosacheck your modeling for "Paredit"
13:38Glenjaminjust above the minibuffer in the bottomright
13:38echosa*mode-line
13:38gfredericksusually inside parens
13:38gfredericksit lists the major mode and all the minor modes
13:39xificurCechosa: back to reify, take an interface like ISeq that supports first and rest/next etc. You could take this interface and extend it with a new method or substitute some of its method with another
13:39matt444(Clojure Paredit Fill)
13:39matt444I guess those are my modes?
13:39xificurCso you could change rest to e.g. drop the first 2 values instead of just 1
13:40matt444So with paredit what is the keybinding to wrap brackets?
13:40echosaxificurC: Awesome. I think I get it now. :)
13:40echosamatt444: See my example above for the paredit way of doing it.
13:40xificurCanyway, I have a question of my own: how should I test a function's side effects?
13:40clojurebotexcusez-moi
13:40echosaOtherwise, there's another excellent packages called wrap-region
13:41xificurCmatt444: ctrl+right
13:41gfredericksxificurC: what sort of side effects?
13:41matt444echosa: I don't get your example. You want me to type: () "thing to wrap"?
13:41gfredericksxificurC: I'm not sure what you meant by "extend it with a new method" but it sounds wrong
13:41xificurCshould work when you are inside a bracketed expression. You will 'slurp' the next s-expression/symbol/...
13:41matt444echosa: I'm trying to wrap text that already exists
13:42gfredericksmatt444: type literally: [ C-f M-)
13:42dannoQuestion: The reader. I read a few books on it, and I seem to think that the reader is like java.io.Reader, but it reads clojure forms, unevaluated.
13:42dannoI am in the right frame of mind?
13:42gfredericksdanno: java.io.Reader is an interface for doing IO
13:42dannoyeah, just doing an analogy
13:42gfredericksdanno: the clojure reader is more like a function that converts textual data to clojure data
13:42xificurCgfredericks: like a function that takes a csv file and splits it into many?
13:42gfredericksdanno: not necessarily anything to do with IO
13:43matt444what is the meta key on osx?
13:43dannogfredericks, doesn't it read in chunks?
13:43echosamatt444: "thing to wrap" was just some example text that, in my example, would end up wrapped in parens
13:43dannomuch like IO does? (I know it is not IO, I am just trying to make mental bridge) ;)
13:43echosaI was basically just saying you should put () before whatever you want to wrap, then inside the parens type M-)
13:44matt444echosa: I want to wrap brackets, not parens
13:44gfredericksdanno: it has a lot more to do with parsing than IO; e.g., read-string will convert a string to a clojure data structure
13:44muhoois it wrong to find it worrisome that so many web tools rely on macros, to the point that stuff like this is necessary? https://github.com/flyingmachine/liberator-templates/blob/master/src/com/flyingmachine/liberator_templates/core.clj#L42
13:44dannogfredericks: thanks, that helped! ;)
13:45echosaThen type [] instead of () and do the same thing
13:45gfredericksdanno: ##(read-string "[1 2 {3 4}]")
13:45lazybot⇒ [1 2 {3 4}]
13:45echosaSorry, I wasn't clear on that
13:45matt444echosa: so type: [] before the thing I want to wrap, then M-)
13:45matt444?
13:45gfredericksmatt444: yes
13:45echosatype M-) with your cursor inside or on the [], yes
13:45gfredericksM-) will slurp the next thing into the form your point is over
13:46gfredericksthe paredit cheatsheet has a nice before/after syntax showing you what things do
13:46matt444ok, will try it once I can figure out what the meta key is, thanks
13:46xificurCmatt444: meta is usually Alt
13:46Glenjaminmatt444: meta is either tap <esc> or hold alt
13:46Glenjamindepending on your terminal
13:46Glenjaminin default Terminal alt isn't meta by default, but you can change it
13:47matt444holy wow it worked
13:47matt444thank you
13:47Glenjaminhttp://cdn.osxdaily.com/wp-content/uploads/2013/02/meta-key-mac-os-x-terminal.jpg
13:47Glenjamintaken from http://osxdaily.com/2013/02/01/use-option-as-meta-key-in-mac-os-x-terminal/
13:48xificurCso, any cool ideas how to test if a function that splits one csv file into several ones could be put in a test?
13:48matt444i use iterm, thanks though
13:48gfredericksxificurC: oh sorry I thought you were commenting on the reader discussion
13:48gfredericksxificurC: start test by creating a CSV file, run the function, then check that the split ones are there
13:49xificurCgfredericks: I did that but I thought I could put some test cases in a file, you know, automated testing
13:50echosaCorrection: my slurp command is C-), not M-)
13:50xificurCbut since its a function that only does side effects testing (is (= nil (function-here))) doesnt make much sense :)
13:52Glenjaminyou probably have to either abstract away the filesystem, or actually interact with the filesystem
13:53echosaOnce you write an (extend) do you have to do anything to activate it or have it picked up? It's like mine isn't getting run. Does it need to be in the same namespace as the original protocol?
13:56arrdem-*/
13:56arrdem0
13:59dannoNoob Q: (println (1 2 3)) //java.lang.Long cannot be cast to clojure.lang.IFn
13:59danno(println 1 2 3) of course is fine
14:00hyPiRiondanno: 1 is not a function name
14:00hyPiRion(1 2 3) would be the same as doing 1(2, 3) in C-like languages
14:01dannohyPiRion: Got it, thanks
14:01danno(+) is interesting that it returns 0, since I was expecting some sort of function
14:02hyPiRion,(+ (*) (+))
14:03clojurebot1
14:03dannohyPiRion: Wow
14:04dannohyPiRion: I am sure I will read about the comma here shortly, is that a macro of some sort?
14:04Glenjaminthe comma just tells the irc bot to eval
14:04dannooh
14:05hyPiRionyeah, in clojure code, it's considered whitespace
14:05dannoSo (+ (*) (+)) will evaluate to (+ 1 0) which evaluates to 1?
14:05dannochecking
14:05hyPiRionyes
14:05danno,(*)
14:05clojurebot1
14:05dannoboom
14:05dannonice
14:06Glenjaminechosa: as long as it gets evalled, and the protocol matches it should "just work"
14:06echosaThat's what I thought, but it doesn't seem to be working
14:07Glenjaminif you try it in a repl
14:07echosa(extend org.h2.jdbc.JdbcClob json/JSONWriter {:-write write-clob})
14:08echosawith a require of [clojure.data.json :as json]))
14:08Glenjaminnow try (json/-write <clobinstance>)
14:08Glenjaminwait, no
14:08dannoNoob Q: So quote is meant for representing data that will not be evaluated unless you want it to be evaluated?
14:09echosaick.. making a clobinstance by hand doesn't sound like a good time :-/
14:09Glenjamin(json/pprint <clobinstance>)
14:12echosaWell, I figured it out. The (extend) was find, but the function I was calling was not. Fixed that and it fixed the issue.
14:12echosaHowever, now I've run into another issue which, I think, will mean I can't use the (extend) and will have to go back to defining the :row-fn in my sql/query calls.
14:12echosa"The object is already closed."
14:13echosaBy the time I get to where json needs to do it stuff, the DB connection/object is closed, so I can't get the string text value out of the JdbcClob object
14:13echosawhich is really frustrating
14:13echosaJdbcClob is starting to seem really useless, but that's what my SQL stuff is using for columns defined as type "text"
14:14Glenjaminechosa: http://clojure.github.io/java.jdbc/#clojure.java.jdbc/IResultSetReadColumn
14:15Glenjamini think that will let you do what you need
14:21echosathis clob really seems like more trouble than it's worth
14:22Glenjaminthe usual assumption is if its in a text/blob field, you don't want to eagerly read it
14:22Glenjaminbecause its "big"
14:22Glenjaminand therefore requires special handling
14:23Glenjaminideally you'd want to only read the stream when sending it down the wire as a response - so you never need the whole thing in memory. Although that might be far trickier
14:23echosaI understand that, however it seems that special handling needs to take place during the query, which makes sense and is how I had it working before, but keeps me from being able to extend the JSONWriter protocol to do the processing for me.
14:24Glenjamincan you just keep the database resource open until the end of the request?
14:25echosainstead, I have to add a custom function I found online as the :row-fn for sql/query calls, passing in the row and the clob value to be converted
14:25echosahm, maybe? not exactly sure how that would work or how clean it would be
14:30kristofOh
14:30kristofDoes Clojure have finalizers?
14:30kristofThis was something I sometimes missed in Common Lisp, since you could potentially leak file handles and resources because GC is so arbitrary
14:31bbloomkristof: java has finalizers, yes
14:31kristofOk
14:31kristofIs there any clojure-interface to that or do you have to use the interop?
14:33bbloomkristof: i could be wrong, but i don't think overriding finalize is exposed at the CLJ level. you need to write a java class & use that
14:33bbloomsomebody else may correct me if i'm wrong
14:33bbloombut it's definitely a host-only feature, since javascript doesn't have finalizers, for example
14:34kristofAh, alright
14:34bbloomit's pretty rare you need finalizers for cleanup though, unless you're wrapping something native/external, b/c everything in the java base class library already has finalizers for managing external resources
14:34kristofOh, my Java is lacking, so I didn't know that
14:34bbloomkristof: see also ##(doc with-open) for deterministic cleanup
14:34lazybot⇒ "Macro ([bindings & body]); bindings => [name init ...] Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order."
14:35echosafuck it, I'm going back to the :row-fn solution. I can't get anything else to work.
14:35kristofbbloom: Right, but with-*** macros are good for when only one body of code is accessing a resource, but sometimes you need to keep the resource open for many different functions, potentially
14:36kristofand then close when they're all out of scope. Which is the point of finalizers, of course, which ties resource deallocation to the object instead of the accessing functions
14:36gfrederickshuh; I just tried to do a finalizer and it looks like it was called twice
14:36kristofBut yes, I suppose I'll learn more Java :)
14:36gfredericksthen I looked at the docs and it said they're never called twice o_O
14:36bbloomkristof: i'm quite familiar with the problems, just trying to let you know what tools are available
14:37bbloomgfredericks: yeah, sooo turns out they are never called twice... unless they wind up keeping the object aline
14:37bbloomalive*
14:37bbloomgfredericks: a pointer to the object might escape during finalization, i dunno.. say to *1 in your repl or something like that :-P
14:37gfredericksbbloom: *1 isn't the case here
14:37gfredericksyeah it's consistently called twice
14:37kristofbbloom: Oh, alright. :) So the answer is that the JVM is going to do finalizing automatically for a lot of common resources, and if it doesn't then I can simply write a Java class.
14:37bbloomgfredericks: i've seen taht for sure
14:37gfredericksI put the thing in a var and then redef the var
14:37gfredericksI'll try making it a local
14:38gfredericksstill twice
14:38gfredericksI did (let [x (reify ...)] "not using x")
14:38gfredericksmaybe something weird about the clojure compiler
14:39bbloomkristof: yes. or use a custom scheme such as a ref count or something like that
14:39bbloomkristof: gfredericks: there is also a finalization queue thinggie i don't know much about
14:40hyPiRiongfredericks: It's because Clojure is twice as good as java
14:40bbloomgfredericks: http://docs.oracle.com/javase/7/docs/api/java/lang/ref/ReferenceQueue.html
14:41bbloomgfredericks: are you using reify or something?
14:41hyPiRionbbloom: gfredericks| I did (let [x (reify ...)] "not using x")
14:43bbloomthere was something about with-meta too at some point
14:43bbloomoooh yeah
14:44gfredericksI'll try a deftype
14:44bbloom,(instance? clojure.lang.IObj (reify))
14:44clojurebottrue
14:44bbloomreify creates an object, then promptly creates another one with metadata on it :-/
14:45gfredericksactually let me log the object id
14:45bbloomgood thinking
14:46gfredericksyeah two different objects
14:46gfredericksgood ole' reify
14:47gfredericksyep just once with deftype
14:47mercwithamouthhmm what's the purpose of using 'declare'?
14:47gfredericksmercwithamouth: referencing things before defining them
14:47bbloommercwithamouth: lets you definite mutually recursive top-level functions
14:48bbloommercwithamouth: declare creates a mutable Var object but doesn't initialize it like def does
14:48mercwithamoutho_O
14:49gfredericksclojure clojure mutable clojure redefine mutate clojure clojure
14:49mercwithamouthhttps://github.com/ckirkendall/chatter-box/blob/master/src/client/chatter_box/chat_view_component.cljs like line 19
14:50bbloommercwithamouth: that's just sloppiness actually
14:50steeriolet me think up an easy example for you
14:50bbloommercwithamouth: somebody wrote the functions in a haphazard order & then added a declare to the top to let them use things before they were defined
14:50mercwithamouthbbloom: the example i showed? yeah it didn't seem beneficial to me
14:51bbloommercwithamouth: yeah, you can just re-order that file to be def-before-use and the declare will go away
14:51mercwithamouthahh so if you do that...you don't have to worry about what order your functions are?
14:51steerioit's _not_ for that
14:51steerio:)
14:51steerioi mean what you say is technically true
14:51bbloomlol thanks steerio i was trying to figure out how to say that
14:51steeriobut let's say your function "foo" calls "bar" at some point, which calls "baz", which in turn uses "foo"
14:51steeriothere would be no right order without using declare
14:52mercwithamouthlol well thank you for stopping me before before i mapped that usage to my mind =P
14:52mercwithamouthsteerio: i see
14:52mercwithamouthok that makes sense.
14:53bbloommercwithamouth: i basically only ever use it when i have some tree traversal & there is like a top-level traverse function & all the other functions need to call it, but it can't be defined until all the other functions exist
14:53steeriobut in this example, using declare on exactly one function's var is enough
14:54mercwithamouthbbloom: i gotcha
14:54mercwithamouthuseful...
14:55steerioi used it in other situations but it's definitely rarely needed
15:08mercwithamouthhrmm now is anyone here awesome as far as enfocus is concerned?
15:11Raynes~anyone
15:11clojurebotJust 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 ..."
15:12mercwithamouthRaynes: lol i was waiting for that =P
15:12RaynesSorry <3
15:13mercwithamouthi'll save it for tomorrow when I can form intelligent questions. i'm trying to figure out how to get defsnippet to work...and i have quite a few other things i'd like to try
15:27dubonlinhi all... I've got a question about things evaluating to themselves in clojure. Here it says that "Strings, numbers, characters, true, false, nil and keywords evaluate to themselves." http://clojure.org/evaluation
15:27dubonlinAnd basically every single book and blog and whatnots about Clojure repeats this.
15:27TEttingerdubonlin, yeah. for example...
15:27TEttinger,(+ 1 2)
15:27clojurebot3
15:27TEttinger,1
15:27clojurebot1
15:27dubonlinYes, I know that
15:27dubonlinMy question is: what about regexp?
15:28TEttingerhm
15:28dubonlindon't they also evaluate to themselves?
15:28TEttinger,#"/s+"
15:28clojurebot#"/s+"
15:28TEttinger,#"\s+"
15:28clojurebot#"\s+"
15:28TEttingerinteresting
15:28TEttingerthey actually evaluate to a pattern IIRC
15:28dubonlinIsn't that "missing" from that page?
15:29TEttinger,(class #"\s+")
15:29clojurebotjava.util.regex.Pattern
15:29dubonlin,(class (eval #"\s+"))
15:29clojurebotjava.util.regex.Pattern
15:29TEttingerso there you go, they evaluate to something that could be construed as being different from the literal
15:30ddimadubonlin: i think its mentioned in the doc-page of 're-pattern'
15:31dubonlinTEttinger: and so it's the REPL which knows how to print the Pattern? And what it prints happens to look like the literal?
15:31ddimahm, its not. well.
15:31TEttingerI'm guessing that, dubonlin
15:31TEttinger,(java.util.regex.Pattern.)
15:31clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching ctor found for class java.util.regex.Pattern, compiling:(NO_SOURCE_PATH:0:0)>
15:31TEttinger,(java.util.regex.Pattern. "\s+")
15:31clojurebot#<RuntimeException java.lang.RuntimeException: Unsupported escape character: \s>
15:31hyPiRiondubonlin: Regexes doesn't evaluate to themselves because you cannot compare them
15:33ddimaa little confused, my repl doesnt print the pattern "string" itself when evaluated
15:33ddimamore like #<user$eval151$fn__152 user$eval151$fn__152@2b22a363>
15:35sandbagsIs there a way to do a "global require"? I'm using print-foo for debugging and would rather not have to require it in every file
15:36joegallosandbags: https://code.google.com/p/clj-nstools/
15:36ddimasandbags: you could "monkey patch" clojure.core ;)
15:38sandbagshrmm... thanks for the suggestions ;-)
15:38Morgawrjoegallo: that's pretty cool, thanks for sharing
15:38`cbpyou could probably make leiningen do that?
15:38ddimaits not really something you shoud want to do imho
15:38joegalloi'm actually with ddima on this one
15:38`cbpmaybe bind one of the less used dynamic vars to your fn :-D
15:38sandbagsyes i was hoping for something built in
15:38joegallobut, yeah, sure, if you must do it, then there's this thing over here
15:38joegalloand may god have mercy on your soul
15:38sandbagsor in lein
15:39ddimajoegallo: well, at first it will be awesome, and then two months later... world of hurt ;)
15:39joegalloyup
15:39sandbagsah well, it's not such a big deal, i am just lazy
15:39sandbagsand easily irritated by such things :)
15:40`cbpmaybe use slamhound to write your ns declarations
15:41sandbagsthing is, if i have to modify my ns declarations that defeats the purpose of not having to modify my ns declarations :)
15:42technomancyIMO that belongs in your editor rather than your project config
15:42gtrakcemerick: working autodoc on a cljs analyzer dump :-) http://i.imgur.com/BrAc61U.png?1 Will work on an writing up the issue for cljsbuild.
15:42technomancyit should be an nrepl -op
15:42`cbpi thought the purpose was to be lazy
15:42technomancythen there's no way it can pollute your source accidentally
15:42cemerickgtrak: sweet
15:42Morgawryeah I agree with ddima, I wouldn't want to use something as obfuscate as hiding namespace inclusion, just thought joegallo's link was still cool (To show stuff you can do with Clojure)
15:42sandbagstechnomancy: yes that makes sense to me
15:44sandbagsanyone used jamii's strucjure library?
15:44sandbagshttps://github.com/jamii/strucjure
15:49technomancysandbags: sorry, I should have mentioned that it's not reasonably easy to implement right now
15:50rurumate##java has 386 nicks, #clojure 684 8o
15:50technomancyjust that's the way it "should" be
15:50sandbagstechnomancy: yes that's what i understood you to mean :)
15:50technomancyworking on it though
15:51sandbagsbetter yet
15:52dubonlinI still don't get it.
15:52dubonlin,(eval (eval 3))
15:52clojurebot3
15:52dubonlin,(eval (eval #"[0-9]"))
15:52clojurebot#"[0-9]"
15:52dubonlinso regexp don't eval to themselves but they eval to something that evals to itself?
15:54hyPiRiondubonlin: Well, sort of
15:55arohnerhas anyone gotten a datomic peer running on heroku to connect to a cloudformation transactor? How does authentication work?
15:56hyPiRionregexes prints a version of themselves which gives the exact same semantics as the original one
15:56arohnerI have a tiny app that I'd like to avoid starting another AWS instance for
15:56ddimaohdamn, when i asked why my repl didn't behave the same way, my muscle memory actually typed #(" instead of just #". I should put the wine aside ;)
15:59dubonlinddima: ^ ^
16:00gfredericks,(nth (iterate eval 42) 1000)
16:00clojurebot42
16:00gfrederickswait since when does clojurebot support eval?
16:00gfredericks&(eval 42)
16:00lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
16:00gfredericks,(def foo 12)
16:00clojurebot#'sandbox/foo
16:00gfredericks,(System/exit 1)
16:00clojurebot#<SecurityException java.lang.SecurityException: denied>
16:00TEttingerhaha
16:00gfredericks,(eval '(System/exit 1))
16:00clojurebot#<SecurityException java.lang.SecurityException: denied>
16:00TEttingernice try gf3
16:00TEttingergfredericks
16:00gfrederickshooray
16:01gfredericks,eval
16:01clojurebot#<core$eval clojure.core$eval@c1f463>
16:01gfredericksI always found it odd that eval bots didn't support eval
16:02gfredericks,(alter-var-root #'eval (constantly identity))
16:02clojurebot#<core$identity clojure.core$identity@153bf5b>
16:02gfredericks,(eval 'foo)
16:02clojurebot(eval (quote foo))
16:02gfredericksoops I broke it
16:03gfredericks,(+ 1 2 3)
16:03clojurebot(+ 1 2 3)
16:03dubonlin,(eval (eval (re-pattern "\\d+"))) ; so a java.util.regex.Pattern evals to itself?
16:03clojurebot(eval (eval (re-pattern "\\d+")))
16:03dubonlinerf
16:04dubonlingfredericks: thanks for breaking the bot ^ ^
16:04dubonlingfredericks: now fix it :)
16:05abakerso for getting into using EDN as a local config file - looks like spit/pr-str and slurp/read-string is that the idiomatic way of doing it?
16:05gcganley(def life 42)
16:06abakeror is there an edn library out there that's more commonly used for managing config files
16:06hyPiRiondubonlin: (eval (eval x)) always return x, unless it is a seq or list
16:06bja_abaker, I use environ
16:07abakerbja_: that looks like it abstracts environment variable access across shell env, JVM properties, and lein.. I was thinking more of reading a config file like, ~/.my-app-config, where the file was EDN and could very quickly read/write it out
16:08bja_what kind of config do you need that is more complicated than strings and ints?
16:08abakerlists of stuff, some stuff with their own lists of properties, etc
16:09bja_then I don't really know of anything in general use, spit/slurp would be my solution
16:09dubonlinhyPiRion: thanks a lot, copy/pasting all these explanation down : )
16:10abakerok thanks
16:10abakerlots of innovation compels me to ask what the latest thoughts are ;)
16:11steerioenviron does support vectors, maps, etc.
16:12steeriothrough profiles
16:12steeriohttps://github.com/technomancy/leiningen/blob/stable/doc/PROFILES.md
16:13abakerthanks
16:14bja_steerio, that requires you to have lein around when you're in prod thought right?
16:14abakerrelated EDN question - is there a standard Java library out there for exposing non-clj code via EDN data structures (e.g. adding an EDN serializer to a web service) ?
16:14bja_i.e. you can't just uberjar and ship an example properties file or a shell file to be sourced and integrated in your ops platform?
16:15abakerah looks like there is: https://github.com/bpsm/edn-java
16:17bja_abaker, you could always write a wrapper in clojure and AOT it
16:17bja_around something proven like tools.reader
16:18gtrakbja_: clojure's a little heavy to be used for just one thing like that, for most java proejcts
16:19technomancybja_: you can use environ without lein; no problem
16:19technomancywhatever daemonization tool you use just gets pointed at a config file containing k=v stuff
16:20bja_technomancy, I know that. the question was relating to if you use advanced data structures in a lein profile for environ, it probably wouldn't also work with environment variables or properties files
16:20technomancybja_: oh right; didn't read that far back =)
16:20technomancybja: yes, environment variables aren't good for nested config; try carica for that
16:23bja_I wish I had access to the config wrapper I wrote over environ at my last job. I liked being able to specify config settings with defaults in a single place (foo.config) and then reference them throughout the project in a sane manner
16:23bja_it was nice being able to look at one place and know all the settings and all the defaults
16:23technomancycarica gets you that
16:24bja_carica doesn't load stuff via environment variable though does it?
16:25technomancyno, just maps on disk
16:25bja_it seems to let you override stuff, so you could easily build a function/macro that uses environ to override stuff while providing sane defaults
16:25gfredericks,(+ 1 2)
16:25clojurebot3
16:25gfredericks,(eval (Object.))
16:25clojurebot#<Object java.lang.Object@e1b565>
16:26technomancybja_: oh yeah; that's practically a must with environ--not being able to change config without restarting is terribad
16:28bja_I used my system to implement config changes via the server's http interface if you had the right credentials
16:28bja_made it easy for the ops guys
16:29bja_also let them do things like use curl to find out system state
16:29bja_makes debugging easier
16:29gfredericksI'm digging through five year old files to figure out what to keep; just found a repo called "meajure" with a bunch of php in it o_O
16:29gf3TEttinger: WHAT DID I DO!?!?
16:29gf3oh gfredericks
16:29gf3rude
16:29TEttingersorry
16:29pcnOh, that's a sonian project
16:29gfredericksgf3: yeah nice try
16:29amalloy(inc gfredericks)
16:29lazybot⇒ 35
16:30gfredericksgf3: fix all my other mistakes too
16:30gf3ugh
16:30technomancymore like meaculpa
16:32gfredericksoh I think it was a mediawiki install for tracking stuff _about_ a project called "meajure"
16:32gfredericksphew
16:32ddimathere should totlally be a package named "meaculpa"
16:32ddimawhat could it be? hmm.
16:32ddimaprobably something for ignoring failing tests, like to good old -DskipTests
16:37ddimasorry if i broke any conversational thread, im just not funny ;)
16:37gfredericksooh I even found some stuff from before I knew how to do version control
16:38gfredericksfiles name foo.MMDDYY
16:39gfredericksa python file that contains one line: def zToQ(i,
16:41arohnerIf I have s3-wagon-private set up, can I resolve deps 'normally', through central + clojars, then upload everything to my private s3 repo?
16:50gtrakwhat emacs bits end up calling the rizt nrepl complete middlewares?
16:50gtrakritz*, rather.
16:53gtraknrepl-ritz, I'm guessing
16:58logic_progin core.async, is there a way to do _rate limited_ channels ?
17:01dnolenlogic_prog: it's not difficult to make a throttle chan
17:02logic_progdnolen: something that requires taking a (timeout 10ms)
17:02logic_progbefore every [msg (<! ...) ] ...
17:02dnolenlogic_prog: yes a throttle channel
17:02logic_progi.e. something like (let [_ (<! (timeout limit)) \n msg (<! ... )] ... ) ?
17:02dnolenlogic_prog: it worth figuring out how to write it yourself, it's pretty informative
17:08grandyhello, just curious if clojurescript supports aspect oriented constraints?
17:13dnolengrandy: it probably can with some work
17:13grandydnolen: cool
17:18logic_progif a channel is full, and multiple sources do (>! ) on the channel, is it fifo ?
17:20dnolenlogic_prog: yes unless you use a dropping or sliding buffer
17:20Kaini1123I am learning Clojure and wrote a program that can execute WHILE-programs (usage example: https://gist.github.com/anonymous/8376364 ) Code: https://gist.github.com/anonymous/8377244 I need some feedback: Is this code ugly or doing not idiomatic things? How can I make this code "better" (more Clojure-style)?
17:31tbaldridgeis there any way at all to gen a class that inherits an abstract class, while at the repl?
17:31tbaldridgebesides proxy that is.
17:33amalloyKaini1123: looks pretty good to me, with a few small issues
17:33hyPiRionKaini1123: It's a very long "snippet", but most things look fine by me. Only thing I'd do different is to make the execute-statement to a multimethod
17:34amalloyeg, execute-statements should just be (reduce execute-statement vars code)
17:35amalloyand line 58, read-variables, should be using the same into/{} as ask-variables is - apply hashmap mapcat is not very nice
17:35Kaini1123hyPiRion, I think 170 lines is ok for this kind of problem, multimethod, I'll look into that
17:36Kaini1123amalloy, looks like I didn't know about into/{} when I wrote this method :)
17:37hyPiRionKaini1123: yeah, it's fine for the problem, but people on IRC would probably not be as tempted to look at it
17:38hyPiRionThat's what I meant
17:40Kaini1123probably true, but you two did
17:40Kaini1123however thanks for the feedback
17:45steeriobja_: yes, that's right about leiningen. sorry, got distracted.
17:45steerioi mean about environ vs leiningen
17:53rhg135hello *
17:54rhg135https://www.refheap.com/22781 anybody got an idea why that inner loop isn't running untiul AFTER the client disconnects?
17:55rhg135according to a trace i know that but it doesn't help much
17:56rhg135it worked a few moments ago but i can't recall what i changed
17:58justin_smithis accept-seq both lazy and blocking?
17:58rhg135hmm
17:58rhg135i think
17:59justin_smithalso, are you certain that the io/writer flushes on newline?
17:59justin_smithyou may need to explicitly flush
17:59rhg135now
17:59rhg135no*
17:59rhg135hence why i manually flush
18:00justin_smithahh, so jim/write! flushes?
18:00rhg135yup
18:00justin_smithoh and sorry, now I see that the def of accept-seq is right there
18:01rhg135i think the server socket doesn't get created until it's closed
18:01rhg135that's weird
18:01FatsDTWhy doesn't (group-by .isDirectory (.listFiles (clojure.java.io/file "."))) work?
18:01justin_smiththat is weird
18:01TEttingerhm, any ideas why an uberjar would be far slower at runtime than running with lein run ? I have a bunch of resources in the project's root/resources , if that helps
18:01justin_smithFatsDT: .isDirectory is not callable
18:01rhg135i thought clojure wasn't that lazy
18:01justin_smithit is a method
18:02justin_smithFatsDT: to group-by you need something callable, try #(.isDirectory %)
18:02TEttingeror memoize
18:02TEttinger,(doc memoize)
18:02clojurebot"([f]); Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use."
18:02TEttingererr that wasn't it
18:02TEttinger,(doc memfn)
18:02clojurebot"([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn. name may be type-hinted with the method receiver's type in order to avoid reflective calls."
18:03FatsDTjustin_smith: Thank you!
18:03justin_smithTEttinger: memfn is depricated, I think
18:05bbloomjustin_smith: eh, i wouldn't say "deprecated" as if there were anythign wrong with it
18:05bbloomit's just not all that useful any more now that we have the #() syntax
18:07rhg135nope
18:07rhg135i tried returning the socket
18:07rhg135still doesn't run
18:16mrhankyfolks, i need some hint on using core.async with clojurescript
18:17rhg135mrhanky, elaborate
18:19mrhankyi have a piece of code, it runs a repl with print and read-line on clojure. i now want to run this with clojurescript on a webpage. this code starts a loop and freezes the rest of my webpage. how can i run this piece of code async so i wont freeze my browser and i'm able to block it when it calls my defined read-line?
18:19mrhankyhttps://www.refheap.com/22782
18:19mrhankythe code itself runs just fine, but freezes the browser
18:19mrhankyi just dont get it how to make it async
18:24rhg135mrhanky, tbh i'm rather confused by all this async stuff too
18:24mrhankyglad i'm not the only one :)
18:24rhg135all the callbacks
18:26logic_progis there any high performnace logging frameworks for clojure? I want things on the orer of 1000 ops / second
18:28pcnWhat does logging mean?
18:28pcnDo you mean like a database that does mvcc for fast writes, or do you mean writes messages to a file?
18:29logic_progpcn: I have a data structure, I am doing lots of (assoc obj ...) 's to it
18:29logic_progerr, (assoc-in obj keys value) ...
18:29logic_progand I want to log all these [keys value] pairs
18:30logic_progso I can "replay" the datastructure"
18:32rhg135another small question
18:32hyPiRionlogic_prog: When do you want to read the data? Is there any need to consider concurrency?
18:32rhg135how do you apply a js method on a iseq
18:33rhg135?
18:33bacon1989Hi, so I want to follow the clojureone tutorial, so I can get a better idea on how to make a website using clojure, but it doesn't seem to be working
18:33bacon1989for this site http://clojurescriptone.com/
18:33logic_proghyPiRion: I don't need to support concurrency, there's one writer, and many readers
18:33logic_proghyPiRion: what are my options for "how do you want to read the data?"
18:33bacon1989it suggests to type lein bootstrap, which doesn't seem to be an actual command
18:34bacon1989is the tutorial possibly out of date?
18:35hyPiRionlogic_prog: Well, you could either read it after the operations have been done, or while the operations are performed. If you do it while the operations are performed, you may either want a snapshot or don't care about such a snapshot
18:37hyPiRionIf you don't need a snapshot, I recommend to just use an ArrayList. It has effectively no time overhead.
18:38michaniskinbacon1989: I am not sure about cljs1, but another option is http://hoplon.io
18:39michaniskinbacon1989: the "getting started" page has the practical info there
18:39michaniskinbacon1989: and http://github.com/tailrecursion/hoplon-demos <-- demo apps
18:39bacon1989michaniskin: ok thanks, I'll check it out
18:40michaniskinbacon1989: you can ask questions in #hoplon if you run into problems
18:47steerioi wonder why it takes 1.5 seconds to require clj-http
18:48logic_progwhat hapened to fleetdb ?
18:49logic_progis there any other database implemente din pure java
18:50steeriocassandra, neo4j? :)
18:52justin_smithfor sql there is h2 (has in-memory and on-disk storage options)
18:53eevar_there's also Derby
18:55rhg135logic_prog, h2
18:55rhg135ohh
18:56rhg135dat damn lag
18:56logic_progerr, sorry
18:56logic_progby "pure java", I meant "pure clj"
18:56rhg135ohhhhhhh
18:57eevar_logic_prog: in other words you're asking for Datomic?
18:57logic_progeevar_ : hmm
18:58logic_progI didn't get a Christmas gift.
18:58logic_progCan someone open source datomic and we'll call it even?
19:14logic_progis there a way to tell clojure/split to "create the directorie structure if they don't exist" ? i.e. (spit "foo/bar/cat/test.txt" ...) will create direcotires foo/, foo/bar, foo/bar/cat if they don't alreay exist
19:15Tolstoylogic_prog: something like (.mkdirs (.getParentFile (as-file "foo/bar/whatever.txt")))
19:17logic_progTolstoy: nice, thanks
19:19Tolstoylogic_prog: Raynes has a nice little collection of file related convenience functions over at: https://github.com/Raynes/fs if you don't mind an extra dependency.
19:59bitemyapparrdem: bloody steak and coffee might be the optimal way to start a day.
20:04Raynesbitemyapp: I've always been fond of looking in the mirror and sobbing, myself.
20:10bitemyappRaynes: followed by...ADVENTURE?!
20:10RaynesAlways
20:10bitemyappRaynes: http://www.youtube.com/watch?v=-EWDMHwZ064
20:40TEttingerhm, does anyone know a way to make an uberjar run with specific JVM options (namely '-server') when double-clicked?
20:40michaniskinTEttinger: unix or windows?
20:41TEttingerwindows, but maybe also linux/mac OS X
20:41TEttinger(OS X versions that don't support Java 7)
20:41michaniskinoh, dunno then, sorry
20:41TEttingermichaniskin, were you going to suggest a shell script
20:41TEttinger?
20:42michaniskinJAR files can have arbitrary trash at the beginning of the file
20:42justin_smithhttp://stackoverflow.com/questions/1667830/running-a-jar-file-without-directly-calling-java
20:42michaniskinincluding a shebang and shell command like `java -server -jar "$0"`
20:42hyPiRionmake the program check its input arguments, and if none, make it call itself with specified arguments and shutdown
20:43justin_smithTEttinger: see second answer using cat (for linux at least)
20:43hyPiRionlazybot uses this for its --background startup, see https://github.com/flatland/lazybot/blob/master/src/lazybot/run.clj
20:44justin_smithclojure is also shebang compatible
20:44justin_smith#! is a comment until end of line
20:45michaniskinjustin_smith: wow, i didn't know that, awesome
20:46michaniskin,(read-string "#! asdf\n[1 2]")
20:46clojurebot[1 2]
20:46justin_smithhrm...
20:47mrhankycan anybody tell me why this is not run async? i call start by js console after page load: https://www.refheap.com/22783
20:47justin_smithmichaniskin: oh, wait, I thought that wasn't working, I missed the \n :)
20:48justin_smithbut yeah, that shows it working as expected
20:48noonianits either because you aren't calling any async operations or because of the indentation :P
20:48TEttingerwait hyPiRion... that solution won't work if Java isn't on the PATH will it?
20:49hiredmanzip files (which jars are) can also contain abitrary stuff at the begining
20:49mrhankynoonian, i dont really understand this async stuff, i'm trying the whole day now with no result :/
20:49hiredmanso you can prepend a shell script
20:49justin_smithhiredman: yeah, that is what the cat solution in the SO link above does
20:51hiredmanI use shebang clojure scripts a lot
20:52hiredmanI have an uberjar of pomegranate on a public url on s3, so the first thing I do in the script is load that, then use pomegranate to load the rest of the deps I want
20:52noonianmrhanky: what are you trying to do asynchronouslu?
20:53hiredmanhttps://gist.github.com/hiredman/6664075 makes a youtube playlist from the list of strangeloop music alex posted after the conference
20:53justin_smithhiredman: wow, cool
20:55hiredmanI have a home automation project that is a single file ring app using the same pattern
20:55mrhankynoonian, the (println "Consize returns ...), it runs a another piece of code and prints the result at the end of execution. this can take some seconds. i'm using clojurescript so calling the start function freezes my browser until ready
20:58TEttingerhyPiRion, I think that Java by default for non-JDK installs does not add the java executable to PATH on windows
20:59TEttingerso would exec still work?
21:02justin_smithTEttinger: what does double clicking a regular jar do under windows?
21:02noonianmrhanky: you example might work if you use >! instead of put!
21:03TEttingerjustin_smith, I assumed it used the OS to associate a filetype with a default command
21:03TEttingerwhich could use an absolute path
21:03mrhankynoonian, i dont use put!
21:03noonianmrhanky: here's a version where I broke out the function into a helper: https://www.refheap.com/22784
21:04nooniansorry, my bad heh
21:05noonianbasically, the go block isn't going to make normal synchronous code run in the background or anything, but it does make the blocking channel operations not block the thread if they are used inside a go block
21:06noonianmrhanky: it might be easier to start with a simpler example, without the (VM ...) stuff
21:12mrhankynoonian, are there any resources you can recommend on this topic?
21:16noonianmrhanky: i've just started with core.async myself, but i think this video by David Nolen gives a pretty good introduction: http://www.youtube.com/watch?v=AhxcGGeh5ho
21:22mrhankynoonian, a bit too long for this night, but i'll boomark and watch tomorrow, thanks
21:23nooniannp, have fun
21:26Tolstoymrhanky: Looking at your refheap, and removing the comments, the reason it doesn't block is 1) because you're in a go block (which doesn't block), and because you're use <! (println...) and println isn't a queie.
21:26TolstoyEr, queue.
22:44logic_progis there any database that allows efficient _append_ operations?
22:47logic_proghiredman: is https://github.com/hiredman/Amontillado/blob/master/src/amontillado/core.clj complete?
22:47logic_progI was searching for "bitcask clojure"
22:47logic_proghiredman: and I got your github repo above
23:50kanjaI played around with clojure a few years ago - I use emacs so I had slime/swank. Are things the same, or is there a new toolset to use?
23:51Tolstoykanja: https://github.com/clojure-emacs/cider
23:52Tolstoykanja: But the plugins for eclipse, intellij are reasonably mature, and there's LightTable.
23:53kanja@Tolstoy LightTable looks pretty cool and the recent opensource-ing of it is super awesome
23:53kanjaI could see trying that out
23:53kanjabut I'm pretty baked into emacs
23:54kanjaI do a significant amount of python/javascript development in it
23:54TolstoyAt this point, it's not better than Emacs, IMHO, if you're already Emacs fluent.
23:54kanjaah k
23:55kanja@Tolstoy I'm going to try cider then, thanks!
23:55TolstoyNo prob. ;)
23:56kanjaActually another question :) I want to play around with cloact - what's a good entry point for http dev? pedestal?
23:59TolstoyPersonally, I think pedestal is a bit heavyweight and opinionated.
23:59TolstoyFor server side, I'd use compojure.