#clojure logs

2013-09-01

00:04callendevn: probably wants an ifdef.
00:06grandyhello, learning clojure and doing a simple seesaw project, just trying to figure out the most idiomatic way to access the attributes of an instance of java.awt.event.KeyEvent ... ?
00:08tufflaxI'm doing tools.namespace/refresh and it says it refreshes stuff, but when I try my code it is still an old version. What could be wrong?
00:09tufflaxgrandy: what attributes
00:09grandytufflax: well, just getters or whatever i need to do to get data about the event
00:10grandytufflax: forgetting what they are called in java, maybe properties or something
00:10tufflax(.getKeyCode event) is the standard way
00:10tufflaxthen there is like a few macros and stuff that you can use if you need to do multiple calls and chains etc
00:11grandytufflax: ahh ok wasn't sure if seesaw carried its abstraction further down,.. makes sense
00:11grandytufflax: thanks much
00:11tufflaxgrandy: I haven't actually used seesaw so not sure about that
00:12grandytufflax: didn't notice anything in the source, but i'll use your suggestion for now b/c i'm only handling a handful of events
00:50clj_newb_2345for a web app
00:51clj_newb_2345should I use mongodb/monger or riak/welle ?
00:55futiledatomic
00:55futileclj_newb_2345: datomic
00:56clj_newb_2345how about for things that do not fit in datomic free edition>
00:56Raynesstfugtfo
00:56clj_newb_2345i.e. the "value" part of a key value store
00:56rickjamesI'm a strongly typed guy for mostly IDE reasons. I"m curiously if typed.clojure will ever make into mainline instead of being a lint-like tool
00:56clj_newb_2345I'd like to see types get integrated into clojure
00:57clj_newb_2345it'd cut down 90% of the bugs I currently write
00:57callenI'm with Hickey on this subject. Types and tests make for fine guard rails, but you don't drive a car by banging into the guard rails back and forth, side to side.
00:57callenDesign is more important.
00:57clj_newb_2345all unit tests prove is that code does not fail on previously documented cases
00:58clj_newb_2345callen: Coq 's type system proves correctness.
00:58rickjamesclj_newb_2345: : I like Clojure for it's anti-OO stance and it's core seq semantics, but i tell you what, i want some strong IDE support with types
00:58callenTo the extent that types limit expression and pervert intent, they are rarely helpful except to noobies writing Haskell.
00:58Raynesrickjames: I doubt it.
00:58RaynesI specifically do not want types.
00:58RaynesIf I wanted types, I'd go write some Haskell.
00:58callenclj_newb_2345: all the fucks I given, you won't find a single one. I am perfectly familiar with the various sub-turing-complete verified languages and experiments.
00:58rickjamesRaynes: : i'll stick with F# then, which in many ways is similar to Clojure
00:58rickjamesunlike Scala
00:58callenclj_newb_2345: I don't find them compelling. Like Raynes, I've written Haskell before (less than he has though), and I found the types more problematic than helpful.
00:59callenrickjames: nobody's stopping you using core.typed, but you should watch a few Rich Hickey talks.
00:59RaynesI like statically typed languages, Haskell especially. It's a nice place to visit, but I wouldn't want to live there for the most part.
00:59clj_newb_2345callen: I hated both haskell and ocaml's type system. Coq's type system, however, allows _proof of correctness_ that becomes a different game.
00:59callenrickjames: you might better understand where he's coming from, the design principles and priorities, etc.
00:59rickjamescallen: I've watched most of the fundamental ones
00:59callenclj_newb_2345: I don't care.
00:59callenrickjames: then you understand the emphasis on design rather than banging into guard rails.
01:00rickjamescallen: : yep, but that reminds me of some HN discussions...I can write some Clojure code that I understand, but once I look into core libraries with no types and nested after nested s-expressions, i'm lose
01:00callenI don't mind optional typing, but obligatory typing is going to make me unhappy.
01:00rickjameslost
01:00rickjamesgradual typing
01:01rickjamesthe good thing about clojure is that it's function oriented and none of this OO nonsense, so the IDEs can do good things
01:01callenrickjames: Clojure core libraries have a *design*.
01:01callenrickjames: which goes back to what I was saying earlier, you just need to understand the design principles and you'll know what's going on.
01:01rickjamescallen: : yes, but without types its hard to understand
01:01rickjamesdeep nesting
01:01callenTypes are, loosely speaking, a form of reified design.
01:02callenrickjames: it is for you, you're just not used to it yet.
01:02ddellacostarickjames: not everyone seems to have that problem
01:02callenIt comes with time and experience. Hickey *just* got done doing a talk saying people need to be more patient
01:02clj_newb_2345argh
01:02rickjamesddellacosta: : I understand that we're all different
01:02callenand not be so alienated by unfamiliar systems and designs.
01:02callenit has nothing to do with being a certain person, it's only a matter of time investment.
01:02clj_newb_2345it's like "I want a combustion engine." "no, you just need horses" "you don't understand the flexibility that horses give you"
01:02rickjamesI disagree
01:02callenthere's no such thing as naturally understanding types or not.
01:03rickjamesI don't like that argument that "everybody" will understand and appreciate eventually
01:03ddellacostarickjames: I mean, the bottom line is, if you don't want to use clojure, don't, or use it with core.typed but the design choices are pretty much…you know, made in clojure
01:03callenyou're creating a Jung-esque personality/brain type where none exists. People are people, invest the time and stop making excuses for a lack of faculty.
01:03clj_newb_2345or
01:03clj_newb_2345you could make clojure better
01:03clj_newb_2345rather than accept it as is
01:03rickjamesI understand all of that
01:03shaungilchristwhat if you could build a biological combustion engine out of horses?
01:03rickjamesI really like the cloure community
01:03clj_newb_2345I fundamentally believe that types will take over; because programemrs who understand types are will be more productive thatn programmers who refuse to use types
01:03callenI would put one proviso to what clj_newb_2345 said, that it would be best if you appreciated the design of Clojure before attempting to improve upon it.
01:03Raynesclj_newb_2345: 'take over'
01:03Rayneslol
01:04callenThe last time somebody attempted to improve upon core without really understanding Clojure, we got Midje.
01:04rickjamesclj_newb_2345: : yes, all research is going into type systems
01:04callenplease do repeat that mistake.
01:04callenrickjames: "all"
01:04RaynesDrama drama.
01:04ddellacostaheh
01:04callenclj_newb_2345: types will never take over because computers aren't typed.
01:04rickjamesRaynes: I hang out on LTU, and all I see is type system research
01:04callenclj_newb_2345: they can only achieve a certain level of penetration at the higher leels.
01:04callenrickjames: so you've never heard of selection bias? :P
01:04Raynesrickjames: I never disputed that particular thing.
01:04ddellacostahaha
01:05Raynesrickjames: I think you were aiming at callen.
01:05rickjamesi've been around LTU for a long time
01:05rickjamesthat's what I see
01:05callenrickjames: so have I, so have a lot of Clojurians. Yet we're still here.
01:05RaynesI've been around Lisp for a long time. You should see the stuff I've seen, man.
01:05rickjamesbut to me types are for big systems and discoverability and IDE support
01:05RaynesThere's like dynamic typing and shit in here.
01:05rickjamesluckily clojure doesn't suffer from OO
01:05callenrickjames: you need to understand that it's possible for somebody to know the research, have used a real type system, and still chosen to reject it.
01:05RaynesIt's wild.
01:05callenrickjames: you need to understand that it's a valid choice and one that can be made as an informed individual.
01:05rickjamesjust my opinion guys, i know it goes against the grain here
01:06rickjamesnot trying to ruffle feathers
01:06callenrickjames: because once you understand that, you can make your own decision to learn more Clojure or not, and stop wasting time.
01:06callenno ruffled feathers, we deal with conversations like this regularly.
01:06rickjamescallen: : i have learned clojure
01:06callenusually Haskell refugees that decided they want to write something that will compile a week after they write it.
01:07rickjamesI'll probably buy yogthos book
01:07ddellacostawhat is yogthos book? I know not of what you speak. Interested.
01:07rickjameshis web app book
01:07rickjamesjust went beta
01:07callenddellacosta: yogthos wrote a book on Clojure Web Development based on Luminus.
01:07ddellacostaah, cool
01:07callenddellacosta: very proud of it :)
01:08clj_newb_2345url for book?
01:08ddellacostanice
01:08callenddellacosta: http://pragprog.com/book/dswdcloj/web-development-with-clojure
01:08callenI need to get a fucking commission, I've been selling the shit out of his book for him.
01:08ddellacostacallen: it's too bad I must be the only clojure web dev using it in production not using luminus
01:08ddellacosta*sigh*
01:09Raynescallen: Well, if he'd do a bit of marketing.
01:09callenddellacosta: maybe, maybe not. Luminus is itself just a "good defaults" stack that is based on Ring and Compojure. I don't think you're that far afield.
01:09rickjamesyeah, from what i hear it's just putting the pieces together
01:09callenddellacosta: my CMS experiment test bed is basically Luminus with whatever mad scientist experiment I am testing that week tossed in.
01:09callenddellacosta: which I then turn around and try to convince yogthos to add to Luminus.
01:09callenlike blackwater.
01:10rickjamesand I appreciate Yogthos strong anti-OO stance on Reddit and HN
01:10rickjamesneed more anti-OO peeps
01:10clj_newb_2345ddellacosta: are you using pedestal ?
01:10callenrickjames: even though I'm in the same camp, try to temper the anti-OO hate.
01:10rickjamescallen: : why?
01:10ddellacostacallen: probably the biggest diff is database access, we are just using "raw" clojure.java.jdbc. Otherwise, our templating system is enlive which we may be getting rid of to use a pretty straightforward client-side templating solution
01:10callenrickjames: the individual faculties in OO weren't the problem (except for statefulness), it was the way they were complected together in a messy fashion.
01:10ddellacostaclj_newb_2345: naw, pedestal is not something I really understand the need for right now.
01:10callenthings like single-dispatch, multiple-dispatch, etc are very handy.
01:10rickjamescallen: thought CLOS was a good idea
01:10ddellacostaclj_newb_2345: not saying it isn't useful, just don't have use for it personally yet.
01:11callenrickjames: you clearly didn't use CLOS.
01:11rickjamesit's all about dispatch
01:11rickjamesmethods and data don't belong together
01:11callenas someone who suffered under the dominion of other peoples' CLOS experiments, No.
01:11callenCLOS was produced very stateful and hard to follow code.
01:11callenCLOS produced*
01:12rickjamesnobody ever told us what OO is really about except the Smalltalk guys who were wrong
01:12clj_newb_2345they were so fucking wrong we gave them a turing award
01:12rickjamesany non-multiple inheritance or single dispatch is just plain wrong
01:12callenNobody knows what the Smalltalk guys were really saying because it changed over time
01:13callenonce they tried something they didn't work, or somebody else attempted it and failed, they would pivot.
01:13callennow Alan Kay is pretending he invented FP and immutability.
01:13rickjamescallen: : hehe..yeah..but they were on the right track with good dev environments...except imaging that was hard to deal with the file system with
01:13callengive it 5 years and he'll claim he was originally talking about things like Agda and Coq too.
01:14callenrickjames: fuck that. Unix forever.
01:14rickjamesforever?
01:14callenstateful images are a bad idea.
01:14rickjamesnever ever, ever anything better?
01:14callendoes IRC disable peoples' ability to detect hyperbole?
01:15rickjamesI've always seen Clojure as a language work bench kind of like what Simonyi is trying to do and maybe failed at since
01:15callenanyway going back to my point, Alan Kay and the Smalltalk community in general tries to claim everything good that happens was their idea.
01:15callenincluding Erlang, FP, immutability, CLOS, etc.
01:15rickjamesoh yeah, and the Java guys ate it up hook, line, and sinker...with a bad model to being with
01:16callenenough about things that aren't Clojure though.
01:17rickjamesand more about composable systems
01:17rickjamesin a way, F# is the clojure of the statically-typed world
01:18rickjamesScala still wants OO
01:18callenI'm sure there's are F# and Scala channels available on FreeNode.
01:18RaynesI… don't know why that holds true.
01:18callenthere are*
01:18RaynesF# isn't a Lisp.
01:18callenF# is an OCaml derivative, it has nothing to do with Clojure and hasn't really taken any ideas from it.
01:19callenThe main language I'm aware of that has taken anything in terms of "lessons" from Clojure's designs would be Elixir, and even that isn't a strong relation.
01:19Raynesrickjames: http://www.shenlanguage.org/
01:19rickjamesi understand that
01:19callenrickjames: I'm asking politely, we can stop discussing things that aren't Clojure in this channel?
01:19callenRaynes: have you tried to write any Shen? It's WEIRD.
01:19RaynesNo.
01:19RaynesI don't want to. :P
01:19rickjamesShen is pretty wild
01:20RaynesLike I said, I specifically do not want static typing.
01:20callenRaynes: I expected it to be a branch off of CL, it feels like the Galapagos of Lisps.
01:20callenit's very weird.
01:20rickjamesmutants aren't necessarily weird
01:20rickjames;)
01:20callenhttp://tech.puredanger.com/2013/08/31/clojure-and-testing/?utm_source=dlvr.it&utm_medium=twitter
01:20ddellacostaI'm okay with discussing non-Clojure things as long as we don't make statements like "developers who don't realize type systems are the Right way to program are wrong"
01:20rickjamesi never said that
01:21callenddellacosta: it's more that I got bored with the particular track of conversation as it was going.
01:21rickjamesi said that most research is going into type systems these days
01:21callenddellacosta: I was hoping to steer it into waters that were either entertaining or productive.
01:21callenI've failed.
01:21ddellacostacallen: sorry. I'll stay out of it now. You didn't fail, I did. :-(
01:21rickjamesi'm lame and need a debugger...any chance of Ritz getting to CounterClockWise?
01:21callenddellacosta: no no, your input is every bit as valid as mine.
01:22ddellacostarickjames: in any case, actually it wasn't you.
01:22clj_newb_2345is there actualy a working port of shen on clojure?
01:22callenddellacosta: if not more so, since you're not a bastard to everybody.
01:22ddellacostahaha
01:22clj_newb_2345i tried one, and the examples from the shen book didn't even work
01:22callenddellacosta: I blame Zen.
01:23callenclj_newb_2345: you're not going to be happy until Clojure is ported to COBOL.
01:23rickjameslisten guys, COBOL is the future..BAs can write code then and we can happily go back to working at McDonalds
01:24ddellacostacallen: Zen is totally the problem. heh
01:24callenddellacosta: sometimes I help people in here while in a state of Zen confusion, then
01:24rickjamescallen: : your sarcasm sensor went down a few notches too
01:24callenddellacosta: the advice will be valid but not necessarily helpful.
01:25ddellacostacallen: that is awesome, hahaha
01:26callenddellacosta: if you watch carefully when I'm helping people and others have to interpret, sometimes that's what is happening :)
01:28futilerickjames: no no, you got it all wrong. Clojure needs to be ported to run on top of C++, that's the only way to get pure type safety as well as efficiency
01:29callenI can't believe I'm saying this, but I think that sort of nonsense is beneath you futile.
01:29callenfutile: that I have any expectations at all is shocking.
01:30futilecallen: but C++ is the best place to get RTTI and metaprogramming that Clojure needs while still being thread-safe
01:30callen"C++"..."best"
01:30futileNot to mention, we'll get templates for free that way!
01:30rickjamesno, I don't want to go back to the 90s
01:30futilePlus multiple inheritance, which Java simply lacks.
01:30rickjameshow did we get this C++ "resurgence" anyway
01:30callenwe didn't. Can we talk about Clojure now?
01:31rickjamescallen: no, it's Saturday night, we need to talk about Prolog
01:31rickjamesa real declarative language
01:31rickjames;)
01:31futileI guess there are some languages which references to aren't universally understood to be jokes.
01:32rickjamesI think Clojure has a Prolog library anyway
01:32rickjames...almost
01:32RaynesLet's talk about how bad Windows is.
01:34futileNo.
01:34futileSo, next time I want to make that joke, what language makes it most obvious it's a joke?
01:34rickjamesI'm porting Clojure to my VIC-20
01:35futileMaybe Rust?
01:35futileOh wait no, Ruby.
01:42rickjamesyogthos: congrats on your book
01:58RaynesSo how about that Erlang
01:59Apage43oh erlang
02:15muhooyogthos has a book?
02:16RaynesDude.
02:17Raynes14 people have said those exact words in the last hour.
02:23dissipate_anyone see this? http://www.infoq.com/presentations/Clojure-Macros
02:23dissipate_damn, macros are scary!
02:24arcatanSpeaking of Clojure
02:26dissipate_speaking of clojure in #clojure? hmm...
04:49ddellacostamidje errors are close to useless
04:49ddellacosta#$(*!
05:00callenddellacosta: this is why I tell people to use clojure.test :)
05:01ddellacostacallen: I do in my other project. I feel torn between a rock and a hard place, because clojure.test just *works*, whereas Midje has a bunch of really nice features that actually, legitimately, speed up my testing.
05:01ddellacostacallen: probably what I should do is try writing some extensions for clojure.test which add the bits I like about midje.
05:01callenddellacosta: which?
05:02callenyou know prism exists right?
05:02ddellacostacallen: features? in particular turning repl based filtering on and off
05:02ddellacostacallen: no.
05:02ddellacostacallen: https://github.com/aphyr/prism ?
05:02callenyessir
05:02callen50% of my c.t workflow :)
05:02ddellacostacallen: well, maybe I'll see about extending that to add some of the other candy midje gives you…very nice.
05:03ddellacostacallen: but seriously, the filtering is awesome, I really like it. But as far as fixtures and whatnot, clojure.test is the way to go.
05:03callenI find that there are three camps in this channel.
05:03ddellacostathey are?
05:03callen1. Those that don't care and use clojure.test 2. Those that care, and use clojure.test (me) 3. Those that use midje.
05:04callenddellacosta: you need leiningen style test selectors in the REPL?
05:04ddellacostaddellacosta: I am part of your magical other camp: 4) those that use both, because neither one is entirely satisfactory, but complain about both, and consider using expectations while their at it
05:05ddellacostawhoops, used my name for some reason. I is idiot
05:05callenI get your meaning anyway :)
05:05ddellacostacallen: um, what do you mean when you say leiningen-style test selectors?
05:06ddellacostacallen: I mean, I have a specific flow that I use a lot where I'll filter on one test, plug away at it, make it pass, and then un-filter everything and run all my tests (rinse, repeat)
05:06callenhttps://github.com/technomancy/leiningen/blob/master/src/leiningen/test.clj https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md
05:06ddellacostacallen: midje makes this extremely easy and nice to do.
05:06callenuses metadata on the vars to create aliases for subgroups of tests and to set defaults
05:07callencovers most of what c.t users wanted I think.
05:07ddellacostacallen: ah, hmm, so, you'd have to reload the namespaces to get those to get picked up in the repl? Not sure how that works
05:07callennah, straight up lein. That is why I asked if you wanted it in the REPL.
05:09ddellacostacallen: ah, so, no--what I'm talking about is midje's auto test, which you can filter on the fly
05:09ddellacostaautotest
05:10ddellacostacallen: I mean, I like the syntactic candy of => as well, but that's neither here nor there. "is" works just fine for me
05:10callenfilter on the fly?
05:10ddellacostacallen: and I absolutely positive prefer the fixtures that clojure.test provides, midje's idea of a fixture is confusing and doesn't work half the time
05:10ddellacostacallen: filter on the fly--add an argument to the fact (test) to say, this one is now filtered
05:11ddellacostacallen: and then it gets picked up in the repl as it's looping through, so only that one shows.
05:12callenhow does the autotester communicate with the REPL? most curious.
05:12callenI will ponder and investigate this.
05:12ddellacostacallen: autotest is a function run from the repl
05:13ddellacostacallen: you call it like "(autotest :filter :some-name)" and that filters your tests
05:13callenI see. Does it continually execute?
05:13ddellacostacallen: yep
05:13ddellacostacallen: and when you're ready, you can switch it off by calling autotest again
05:13ddellacostafor my particular workflow, it's super handy.
05:13callendo ho. I can already guess what marick's code looks like.
05:14ddellacostacallen: the problem is, yeah, it's kind of horrible.
05:14ddellacostahahaha
05:14ddellacostaI like a lot of things about midje, I don't think it's all bad, but it feels like something which grew too fast with not a lot of thought about how it was structured
05:15callenyap.
05:15ddellacostabut, apparently the devs are doing some cleanup work, so I hope it can get "trimmed back."
05:15ddellacostaI would be interested in midje light
05:15ddellacostawhich is to say, I should probably just add some features that I want to prism/clojure.test
05:15ddellacostabrb
05:16callenprobably :)
05:17ddellacostaheh, yep.
05:18ddellacostacallen: while I've got your ear, cheshire is the go-to for json these days, is that right?
05:18callenyeppers.
05:18callenddellacosta: I find that when I am troubled by or dissatisfied by a tool, it helps to make a nice pot of tea and do a nice read-through of the code.
05:18ddellacostaand, for http request, I guess clj-http? Making a JSON api request
05:18callenYou'll at least come away with an appreciation of what's true or not, whether you're happy or not.
05:19callenddellacosta: so, it depends. it merits mention that clj-http is based on the apache client and is designed to be hyper-robust (it will retry failed requests, that sort of thing)
05:19ddellacostacallen: yeah, I should read through midje, but last time I tried, the insane level of metaprogramming and confusingly named vars put me off. Will try it again sometime.
05:19callenif you want a "dumber" http client, clj-http-lite and others exist.
05:20ddellacostacallen: yeah, I'm on quick and dirty mode now, will address other issues when I start having them. Side project kinda thing. But, no harm in using clj-http I think, I'm not making a lot of requests with it.
05:20callenno harm at all.
05:20callenthe behavior of clj-http was relevant to me recently because I was ripping a slow API
05:21callenmost people should be satisfied with it
05:21ddellacostaah, okay
05:21callenI was also parallelizing the crap out of it.
05:21ddellacostaparallelizing?
05:22callendoall partition future map
05:23ddellacostawoah
05:23ddellacostayou know, I have not yet used future once.
05:23callent'was a 50mb dump of raw data from the api.
05:23ddellacostayowsers
05:23ddellacostanot that big all things considered I guess, but still, big
05:23callenI was under a time limit and needed the data snappily.
05:24callenbig if one considers that it was a SLOWWWW Rails server and relatively small amt of data per transaction
05:24callenrequired optimizing chunking behavior + future dispatch across chunks
05:24ddellacostaah, rails
05:24callennothing too crazy, but it required hand tuning to extract the data quickly.
05:24ddellacostagotcha. I always end up writing wget scripts for that kind of crap
05:24ddellacosta'cause I'm lazy.
05:25callenno caching on the part of the API...sigh.
05:25ddellacostahmm, bummer.
05:25callenddellacosta: required code interaction to generate sequences of 'work'
05:25callenwget is wise.
05:26ddellacostacallen: is this related to your new startup? I'm wondering if it is bio-related data. Dunno if you can say, but sounds potentially interesting.
05:26callenyeah, related.
05:26callendata fiefdom that I was...sidestepping.
05:27ddellacostahaha
05:27ddellacostagotcha. ;-)
06:24adamtHi. Given a file with a single function inside, like (fn foo [a b c] ..) i would like to extract the names of the function arguments. What would be the most practical way of doing that?
06:31Apage43adamt, what exactly are you trying to accomplish?
06:31Apage43i mean, you could slurp and read-string it
06:32Apage43,(read-string "(fn foo [a b c])")
06:32clojurebot(fn foo [a b c])
06:32adamtgiven a function, i would like to be able to dynamically construct a webform from which the function can be called.
06:33adamtbut yeah, i can just read it and use first and rest to get to the arguments, but I wondered whether there were a prettier way.
06:33Apage43if you're actually being given a function that's defined somewhere (that is, defn'd in a namespace), thereis
06:34Apage43as they all have metadata on the var
06:34Apage43,(meta #'+)
06:34clojurebot{:arglists ([] [x] [x y] [x y & more]), :ns #<Namespace clojure.core>, :name +, :column 1, :added "1.2", ...}
06:34Apage43you'd be after :arglists
06:34adamtwell, it's not defined, i actually use load-file and bind the resulting function, and then i call it.
06:37Apage43well if you're okay with the function being placed into the current namespace you can always use a (defn) in that file
06:39Apage43 this seems like a pretty weird thing to be doing at any rate
06:40adamtI'm considering whether i should reveal why :P
06:41Apage43you could also attach metadata to it
06:41adamtWe use a tool called GLU for continuous deployment. That tool uses models written in json for describing a deployment. Instead of manually creating these silly big json documents, we're experimenting with ways to construct them in a neater way.
06:41Apage43^{:args '[a b c]} (fn [a b c] ..) in your file
06:41adamti think i'll rather just skip to the functions with first and rest, instead of defining arguments twice.
06:42adamtAnyways, I'm then toying with the idea of using clojure as a templating-language to construct these json models.
06:43Apage43there's the riemann approach of having a "config" file that is really just a clojure file evaluated in a namespace that has all the stuff most users would be after already imported
06:43Apage43http://riemann.io/quickstart.html
06:45Apage43I'd personally do something like that, and have them use (defn), possibly with metadata to indicate which functions they want to expose to the form
06:45adamtYeah, something like that. I would still need to extract the arguments to use in the webinterface, for our purpoes though
06:45Apage43and then search the namespace (with ns-publics) once you load it
06:45Apage43and grab the :arglists off the metadata of the vars
06:46adamtbut then i would need to make sure the namespaces are unique
06:47adamtthat was why i liked the idea of just using the path to the file, and then loading the file, no matter how fragile that is
06:50adamtMaybe i should just have asked like this; given a fn bound to a variable, is there any way to introspect it to get its parameters, if then function has no attached metadata.
06:51Apage43nope
06:51Apage43 (let [current-ns *ns* new-ns (gensym)] (eval `(do (ns ~new-ns) (load-file "test.txt"))) (in-ns 'current-ns) (ns-publics new-ns))
06:52Apage43^-- load "test.txt" in a namespace with a generated name, and return a map of the vars in it
06:52Apage43which you can grab the metadata off of
06:52adamtwould that work if i didn't attach extra metadata to the function?
06:52Apage43if the thing in the file is a (defn), not a (fn)
06:53adamtokay, thanks. :-)
06:56Apage43also lets you put several of them in a single file
07:25Apage43er, i totally messed up the switching back to the namespace you'd been in before bit though
08:53yawnthi
09:16dissipate_yawnt, hi
09:25silasdavisI have some maps which are my documents, I have them indexed under various hierarchical indices based on the values of their keys. Currently I have just copied the map in its entirety into each index it belongs, and since it's the same map this is basically free. However sometimes I want to update a document and have those changes reflected across every index, and sometimes I want to delete it.
09:26silasdavisDo I need to start storing references in my indices or can I use structural sharing somehow to change (mutate?) the underlying shared object
09:26silasdavisit strikes me that if I could do that latter it might not be a good idea anyway, has anyone solved a similar problem in clojure?
09:29silasdavis(my indices are just various associative arrays where each level is defined by a key-chain like ["name" "sex "age"] which would result in a index like {"fred" {:male {3 <map> 34 <map>}}} )
09:37ckirkendallcemerick got some time to help someone out with clojurescript.test
09:38cemerickckirkendall: just heading out; maybe send a Q to the ML?
09:38ckirkendallwill do
10:13grandyhello, is there a jvm that most people generally prefer to use w/ clojure? i'm just using the default osx one and trying to figure out if i should look at others
10:14TimMcI haven't heard of any practical differences.
10:14grandyok that's good
10:14TimMcI mean, the thing Android uses has problems, but it's not optimized for Clojure's usage patterns.
10:38ziltiWhere can I find the basic protocols for Clojure (IMap, IAssociative and those)? Are they even there the way the ones are at ClojureScript?
10:41si14guys, how can I set up a macro that should be nested into another one to work properly? like "recur" in "loop".
10:43ziltisi14 can you make an example? Basically you should just place it into the first one the way you place a function.
10:43si14moreover, I need to pass some variables from external macro to an internal one.
10:44zilti*should just be able to
10:44ziltiJust pass it in as an argument, then
10:45si14here is an example: https://github.com/mikera/matrix-api/blob/master/src/main/clojure/clojure/core/matrix/impl/ndarray.clj#L106
10:45si14and https://github.com/mikera/matrix-api/blob/master/src/main/clojure/clojure/core/matrix/impl/ndarray_magic.clj
10:45si14what's going on there is that I need to generate a few versions of my code, specializing for different types.
10:47ziltisi14 which macro exactly is the example, and what part of it?
10:47si14so I define macro with-magic, that uses clojure.walk to replace some symbols (ending with "#") inside the provided form, creating versions that I need.
10:47si14it worked fine until I decided to throw in a macro.
10:48ziltiThe symbols ending with # get replaced with something else, so you can't rely on that for replacement purposes.
10:49si14that is, define a macro to be used inside with-magic and using some "magic" variables (so the expanded code should receive that replacement, too). the problem is that this new macro is not expanded yet when replacement is done
10:49si14right now I'm solved this problem with "macroexpand-1", but this stinks IMO
10:50si14zilti: it works right now, but I'll replace the symbol.
10:50ziltisi14 I would've recommended macroexpand as well. The arguments don't get interpreted, that's the whole point of a macro
10:52si14zilti: I thought that if I will be able to leave some "context" after throwing in the code with replacements, I can avoid macroexpansion in my macro and instead use that "context" in nested macroses.
10:52si14so I need something like "let", but for macroexpansion time, I suppose.
10:53ziltisi14 probably "binding", since that's afaik the only way to "communicate" to nested structures besides argument passing.
10:54si14zilti: I'm not sure if it will work for compile time, will it?
10:54shiranaihitoi'd like to have a global variable for a little helper class for accessing a database.. can i just (def dbhelper <helper>) .. or is there a better way?
10:54ziltisi14 It will.
10:55si14zilti: OK, thank you.
10:55ziltiWhere can I find the basic protocols for Clojure (IMap, IAssociative
10:55ziltiand those)? Are they even there the way the ones are at ClojureScript?
10:56shiranaihitooh, and what kind of stuff does the "/" -accessor work with?
10:56shiranaihito(besides static Java methods..?)
10:56ziltishiranaihito: Stuff in namespaces, and Java fields
10:57shiranaihitozilti: ok, cool.. so if i "def" a variable in a namespace, i can access it with ns/var from other files?
10:57si14zilti: I've asked about this around a year ago in the mail list, the answer was "in the source code" :)
10:57ziltishiranaihito: yes. But you first have to require that namespace of course
10:58shiranaihitoyeah
10:58shiranaihitohmm..
10:58s4muel,(clojure.string/join "," [1 2])
10:58shiranaihitozilti: how would you arrange what i described above? -having a global variable for a helper class
10:58clojurebot"1,2"
10:58ziltisi14: That's where I looked, but it's not really there... Do you know in which file?
11:00ziltishiranaihito: I'm not exactly a pro, so I don't know if it is idiomatic. But yes, (def dbhelper <helper>) looks fine. If it has to be mutable, put it in an atom.
11:00shiranaihitozilti: alright, thanks! :)
11:01ziltisi14 Nevermind, found it!
11:14shwouchk_Hello
11:16shwouchk_I'm reading up on clojure, and have just read a section about 'transient'. While it seems quite a nice construct, it seems a shame that the same functions could not be used on a transient and on a regular data structure. Is there a workaround to this/
11:16shwouchk_?
11:18bjashwouchk_: at least for me, the ceremony around calling the ! versions is a good reminder that I'm working with something different. I wouldn't want that reminder to not exist.
11:19shwouchk_bja: but on the other hand if you've written a set of utility functions, you wouldn't be able to reuse them on the transient data. Doesn't that bother you at all?
11:20ziltishwouchk_: Transients can only be used inside one single function anyway. You'll get an exception as soon as you pass a transient outside and try to use it then.
11:21shwouchk_zilti: what about conj!? is it not a function?
11:21ziltishwouchk_: Yes it is. Oh I see what you mean
11:24bjashwouchk_: not really. I'm not using transients a great deal right now, so it may bother me more if I was more exposed. That said, most of my utility functions exist as higher order functions. Almost none of them would apply to smashing on the data structure directly.
11:27shwouchk_bja: I see
11:28shwouchk_maybe I'm thinking too far ahead
11:31technomancyshwouchk_: transients should only be used for optimizing very small portions of code that have been identified as a bottleneck
11:32technomancytypically re-use isn't a priority because transient code is so different from regular code
11:32technomancywhile you're writing regular code, you should never be asking "what happens if this changes out from under me", and if you're not asking those questions, it's probably not code that would work with transients
11:34shwouchk_technomancy: I'm not sure I agree with your last statement.
11:35technomancymaybe that's not the best way to put it; but part of the point of clojure is that there are certain concerns you can put out of your mind entirely.
11:36technomancythe choice to use transients in the choice to sacrifice the certainty of persistence in favour of performance, but if that bleeds into more than a tiny chunk of the codebase it's going to cause problems
11:37shwouchk_I see
11:38technomancythat's also part of why transients are prohibited from crossing thread boundaries
11:40shwouchk_technomancy: that much is obvious
11:40bbloomalso worth noting: you'll get the majority of benefit from transients if you just use the right clojure.core functions
11:41bbloom(doc into) ; for example
11:41clojurebot"([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."
11:41shwouchk_I see.
12:13ckirkendallAre there any issues with using loop recur in go blocks. Seems a lot better than (while true ...) (loop [msg (<! ch)] (when msg (recur ..))
12:16bbloomckirkendall: that works just fine. people just frequently don't do that b/c they often want to read multiple messages from ch and that approach will require (recur (<! ch)) which duplicates the receive
12:16bbloomckirkendall: write whatever works best for the particular communication pattern you're trying to encode
12:17ckirkendallbbloom: I want to be able close down the event loop when the channel closes.
12:19ckirkendallbbloom: if you are using (while true ...) and someone closes the channel wont it just chew cpu or am I confused?
12:25grandyquestion: what would be a good clojure (or generally functional) way to implement a repl, where some repl commands alter global state (like incrementing a global counter, or something more elaborate) ?
12:27grandyanyone please take a stab at an answer, i'm new to clojure and working on a toy app for learning/entertainment
12:27bbloomckirkendall: "goroutines" will be garbage collected if nobody else holds a pointer to any of the channels that the routine is waiting on
12:27bbloomckirkendall: if you have an infinite loop that is blocked reading from a channel, but no-one is alive to write to that channel, then the GC will clean up and the infinite loop will disappear
12:45grandylogging the channel so if anyone has advice please share :)
12:48callentechnomancy: my new favorite name for Common Lisp uses the term from Hickey's recent talk - Choose-a-phone.
12:48callengrandy: you're implementing a REPL?
13:34tufflaxI'm using tools.namespace, but calling refresh does not properly refresh my code. When I try running my code it's still the old version that runs
13:34tufflaxwhat could be wrong?
13:35tufflaxIt works correctly for my friend with the same code
13:37kmicuSame code base, but also same workflow and tools versions?
13:49tufflaxkmicu: yes, I can't think of much that's different
13:49kmicuWhat output do you get from (refresh)?
13:50tufflaxthe correct output, like "refreshing <some namespaces> :ok"
13:50kmicuAnd you have only one nREPL running?
13:51tufflaxyes
13:52kmicuMaybe lein clean, restart OS and try one more time. :]
13:52kmicuSometimes it helps ;P
13:52tufflaxyeah I'll try
13:52tufflaxthanks
13:53kmicuYou should also compare project map with your friend.
13:53tufflaxyou mean working directory?
13:54kmiculein pprint prints project map
13:54tufflaxok
13:54tufflaxI'll do that
13:55kmicuI never had any problems with tools.namespace.repl refresh
13:55kmicuAnd today is always low traffic here.
14:27tazjinHej! In the current standard Clojure web stack (Ring, Compojure, Hiccup, Korma etc.) - how is security handled? Specifically, how do we protect ourselves against SQL injections, XSS, how is user input sanitized and so on? I've been googling but I can't find any info.
14:28weavejesterThose are all slightly different questions.
14:28tazjinYes, but I'm asking all of them
14:29weavejesterSQL injections are typically handled by the SQL library. You avoid string substitution, and instead use the mechanism provided by the library.
14:29tazjinThe only mention of "security" on the Luminus page for example refers to hashing passwords, pedestal has it once as a buzzword - there is no info really
14:29weavejesterI believe Korma handles that pretty transparently, however.
14:30tazjinI should mention I come from Haskell where we use types to block most attacks stemming from user input
14:30weavejesterBy creating an unsafe or untainted string type, presumably?
14:31tazjinBy wrapping string types into custom types and only exposing constructors that perform input sanitization, that way you can't get any user input without sanitizing it unless you explicitly specify that you want that
14:32tazjinBut that's a different world from Clojure! ;-) So I guess the thing that frustrates me a bit is that the Clojure community just doesn't seem to talk about security - I can't find any info, not even relevant blog posts :(
14:33hyPiRionWell, I'm pretty sure korma/jdbc/honeySQL all prepare their statements before inserting contents. That way, it can only upsert the type specified in the DB schema.
14:33weavejesterI guess because web security is the same for any language. You need to HTML escape user data, ensure it's not substituted directly into SQL strings, and so forth. Haskell's type system provides safety from some mistakes the developer could make, but underneath it's the same principle as any other system.
14:33kmicutazjin: why not Haskell web stack then?
14:34weavejesterI suspect that core.typed could be used for providing safety like that
14:34tazjinkmicu: I do use Haskell for private projects, but we don't use it at work! And I like Lisps in general (and Clojure in particular)
14:35kmicuAs weavejester wrote, security is pretty PL agnostic topic.
14:35aaelony"We figured out how to design rocket parts just w hand movements through the air (seriously). Now need a high frame rate holograph generator." -Elon Musk https://twitter.com/elonmusk Wish we could write lambas this way ;)
14:35tazjinweavejester: I don't want to model my security the same way it is done in Haskellland, I'm just wondering how it's done in Clojureland.
14:37weavejestertazjin: Using types to prevent user data from mixing with app data isn't a bad idea; but as far as I know, no-one's built that yet. So there are certainly things from Haskell we could pull in.
14:37weavejestertazjin: However, aside from the type safety, web security is the same in any language.
14:38tazjinBasically, I just don't know what the state is. If I run lein new compojure-app foobar, pull in JDBC, Korma and a Postgres driver and start putting user input form forms into my table - is there something in this stack that takes care of it? If I store user input in my DB and later display it on the page, is it sanitized? There's no info easily available on whether *I* need to do everything or whether the components
14:38tazjin I use already do *something*
14:38tazjinI'm not sure if I'm phrasing this weirdly, I might be
14:39weavejestertazjin: SQL libraries typically protect you so long as you're not substituting the values directly into strings.
14:39weavejestertazjin: In Hiccup at least, user data needs to be manually escaped with a function (at present), though there are designs to make that automatic (the only problem is that would slow down the library).
14:40weavejesterIn general it's a good idea to know the common attack vectors
14:40weavejesterAs no language will protect you if you don't
14:41tazjinMaybe not the language itself, but the frameworks. It's nice to know that DB libraries help with escaping queries, but why am I not told about that anywhere?
14:41tazjinAs an example have a look at this page of a Haskell web framework: http://www.yesodweb.com/page/about (scroll down to "Type-safe security")
14:42tazjinI don't want to start a war about "this is better" or anything, I just miss a listing like that from the things I use in my Clojure web stack
14:43weavejesterI guess because it's considered common knowledge. Pretty much all DB libraries, for every language, have some mechanism for quoting variables.
14:44weavejestertazjin: A listing like the one in yesodweb would be useful
14:44tazjinThat's one out of 10 points listed on the Yesod page, what about HTML templating libraries escaping inserted strings? Form generation libraries adding security tokens and failing on additional inputs being submitted? I basically have to look at every component of the stack manually to figure out what is already taken care of and what I have to think about
14:46weavejesterYes, but it's not like you can take web security for granted, even with Haskell.
14:47weavejesterIt would be useful to have a document that tells you how to avoid common security problems in Clojure, though.
14:47weavejesterThe basic answer is that SQL libraries will sanitize inputs, but everything else is up to you to set up.
14:48tazjinTrue, it just seems to be hard to find somebody who knows all of those things to compile them. I'm inclined to post a thread on Reddit and collect everything people know, from automatically sanitized SQL statements to handy HTML escape functions in Hiccup
14:49benkay+1 to that, tazjin
14:49weavejesterThat sounds like a good idea. There's a ring-anti-forgery middleware library, a crypto-password library for key derivation functions, and Friend handles a lot of the authentication/authorization part.
14:52weavejesterCollecting all that information in one place seems a good plan.
14:52tazjinwell, a Reddit post is far from being a good knowledge repository but it's a start.
14:54weavejestertazjin: Might I suggest adding a page to the Ring wiki?
14:55tazjinThat's an idea, but first the info needs to be compiled. I'm writing up a small post
14:55kmicuThat's the spirit!
14:58si14my attempts to come up with macro communication failed, so let me just introduce a minimal example: https://gist.github.com/si14/0dadea5bd7f23de47544
14:58si14how can I communicate that "important-data" to internal macro?
14:59weavejestersi14: You could use two bindings, one for compile-time and one for run-time.
14:59si14weavejester: how the first one can look?
15:02weavejestersi14: Hm… the way you have your example set up, the way I was considering might not work.
15:03si14weavejester: and which one did you consider? I'm happy to lay it out in different way if it's possible to save this "environment" behaviour, when external macro defines an environment for internal one.
15:04weavejestersi14: I was considering adding an outer binding, unquoted, e.g. (binding […] `(binding […] ~body))
15:04weavejestersi14: I believe that was required to fix a similar issue in Hiccup
15:05qdhfgfgh3gg1Do skype,yahoo,other chat and social communication prog (facebook&twitter) spy 4 israel&usa???
15:05qdhfgfgh3gg1Do they record and analyse everything we type on the internet???
15:05lazybotqdhfgfgh3gg1: Yes, 100% for sure.
15:05lazybotqdhfgfgh3gg1: Yes, 100% for sure.
15:05si14weavejester: AFAIK this requires that an internal macro should be called *from* an external one
15:06si14and not from inside of transformed code.
15:06si14well... "called". expanded
15:06benkayDo things equal other things?
15:07hyPiRionbenkay: depending on what you define as equality
15:07weavejestersi14: Yes, that's why on reflection, I decided it probably wouldn't work :)
15:07benkayhyPiRion: I want to explore lazybot's evaluation after seeing that bit of spam and lb's response ;)
15:07hyPiRionbenkay: oh
15:08hyPiRionIt's obviously not about the amount of question marks of the end of the line. Right, lazybot??
15:08lazybothyPiRion: Uh, no. Why would you even ask?
15:09weavejesterlazybot: Does the CIA have a mind-reading satellite???
15:09lazybotweavejester: Yes, 100% for sure.
15:10benkaylazybot: were you and i just discussing this???
15:10lazybotbenkay: How could that be wrong?
15:10weavejesterlazybot: Do you like three question marks and dislike two question marks??
15:10lazybotweavejester: Definitely not.
15:10benkayah, grammar.
15:11s-hmaybe it's round-robin??
15:11lazybots-h: Definitely not.
15:11hyPiRionMaybe people should read the source, just to be sure???
15:11lazybothyPiRion: Oh, absolutely.
15:12s-hhaha
15:12weavejesterlazybot: What do you think about four????
15:12weavejesterObviously not a lot :)
15:13hyPiRionhttps://github.com/flatland/lazybot/blob/master/src/lazybot/plugins/yesno.clj
15:13benkaythis isn't strictly a clojure question, I suppose, but what are the implications of shuffle calling the default randomness source on, say, a VPS?
15:17dcbAnyone have an example of how to hook test.generative specs up to leiningen in order to run specs from the command line?
15:19tazjinweavejester, kmicu: This is what I intend to post on Reddit. Objections? http://pastebin.com/hxpDhuk6
15:20weavejestertazjin: That seems okay. I'd have made it shorter, though.
15:21kmicutazjin: also put this at https://groups.google.com/forum/#!forum/clojure
15:22tazjinweavejester: Shorter is better because of people's attention spans, sure, but it leads to more misunderstandings. Also, do we want security advice from people with short attention spans? :)
15:22kmicuLength is ok, but put this in mailing list.
15:23tazjinkmicu: Will do
15:23weavejesterLike… "Other frameworks like Rails and Yesod have documentation on how to solve common web security problems, but I was unable to find any for Clojure. Could people suggest libraries or information for solving issues like SQL injection, XSS, CSRF, etc.?"
15:23kmicuA lot of people don't care about reddit.
15:23weavejesterYeah, mailing list would be better.
15:24tazjinthe mailing list only seems to be slightly more active than Reddit, but I guess it's better to have it on both!
15:24Brand0So that person is looking for a library that will fix all of his/her web security problems?
15:26weavejestertazjin: A quick look over both reveals that the mailing list has a lot more posts and replies than reddit.
15:26kmicuAnd a better quality discussions.
15:31xeqitheres also clojure-sec for discussion of interested parties, though thats not web specific
15:31si14solving SQL injections, OMG
15:31callenSQL injections were a solved problem for a long time.
15:31callenThe only real problem was that bad languages run by bad people who write bad code were propagating bad practices.
15:32callenBrand0: the easiest way to fix your security problems is to not write any code. No code, no bug.
15:32si14I mean, really, "libraries for solving SQL injections"
15:33weavejestersi14: What do you mean?
15:33xeqisi14: sarcasm?
15:33tazjinsi14: You're missing the point, I'm sure it's a solved problem but I want to know where and by what it's solved. And that info is hard to find at the moment
15:34weavejesterTo my mind it's less SQL injection, and more things like CSRF.
15:34tazjinBrand0: That person (me) is not looking for some magic all-in-one solution (and that's not what my post says), I just want to compile all the knowledge we have about "How we do security"
15:34weavejesterIt wouldn't be a bad idea to have a document discussing basic web security from a Clojure perspective.
15:34si14xeqi: sort of.
15:34tazjinI've posted to the mailing list btw, but it said the post has to be approved first.
15:35xeqitazjin: yep, first posts are moderated
15:35weavejesterFirst posts have to be approved, but it's pretty quick, in my experience.
15:35weavejesterIt's to cut down on spam.
15:36Brand0tazjin, sorry I didn't know you posted a link. I don't really understand you mean by "compile all the knowledge" either
15:36si14tazjin: it's solved by being aware of SQL injections at first place. Parameterized queries also don't hurt
15:36si14neither have anything with Clojure.
15:36Brand0There's so much information on the web about web vulns tht it's not even funny
15:38tazjinBrand0: Of course there is generic knowledge about it, but how does somebody new to Clojure learn about the ring anti-CSRF middleware? Or about Hiccup's escaping functions? Or JDBC/Korma sanitizing queries? There's no overview of that (and there is in other communities)
15:39kmicuKill haters with fire or with above statement.
15:40weavejesterWell, you can search for the equivalents. e.g. Google "ring csrf"
15:41weavejesterA single document would be helpful
15:41kmicuIndeed.
15:41weavejesterBut it would be more for people who perhaps have less experience with web security.
15:42Sorellatazjin, you solve SQL injection by not using Strings to represent SQL queries.
15:42tazjinkmicu: I'd prefer just not having haters, there's no need for that in a mature community! :)
15:42Sorellatazjin, (shell injection and other "injections" likewise)
15:42tazjinSorella: I'm not doing that, don't worry!
15:43weavejesterMore documentation is rarely a bad thing :)
15:43kmicuThat's the point.
15:43xeqiuntil it goes out of date
15:43weavejesterWell, true
15:43kmicuThat's another point :)
15:43weavejesterThere's still some information on Wikibooks they won't let me remove.
15:45technomancyand comments on the dev.clojure.org wiki; ugh
15:45callentechnomancy: hrm?
15:45callenweavejester: have any opinions on Clojure core development?
15:46weavejestercallen: Not really… why do you ask?
15:47technomancycallen: "Getting started with emacs" on dev.clojure.org has a bunch of junk comments about swank-clojure that only apply to old revisions
15:47technomancyand I don't have privs t oremove them
15:47technomancy"for hysterical raisins."
15:47callentechnomancy: 'tis a place of the dead.
15:47hyPiRionSince Alex Miller came aboard and started working on issues, I am looking at it more optimistically. Hopefully they'll have a higher throughput
15:47callenhyPiRion: klish and I are double-teaming him :P
15:47amacdougallAnyone know much about enlive template auto-reloading? When I check (-> *ns* meta :net.cgrand.reload/deps), the URL of the HTML file appears, but when I change the file and reload the page, I'm still getting output from the old template -- meaning the namespace was not reloaded.
15:48technomancy"...and my axe!"?
15:48futileso, i dunno why Swing gets so much crap. its just as good/bad as Cocoa. its a fine GUi toolkit.
15:49amacdougallI can debug it further, but maybe someone already has it working and can point at something dumb I'm doing. :)
15:50xeqitazjin: I saw you got several answers to your security queries earlier. Do you have any more question not related to library/feature discovery?
15:50tazjinfutile: For me it'd be because making Swing look and feel native is a *lot* of work, whereas with Cocoa it's included (but then, of course, not platform independent)
15:50callenfutile: have you interacted with Swing from Java?
15:51callenand yeah, what tazjin said too.
15:51futiletazjin: ah. in my case ive abandoned trying to embrace the native look/feel. this is my latest Cocoa app: https://raw.github.com/sdegutis/bahamut/master/bahamutapp.png
15:51tazjinxeqi: No specific questions right now, I'm looking to compile all the info about existing security measures we have though. I wasn't facing a particular use-case (I'm not even developing a web app), it's just something that I thought about randomly
15:52futilecallen: if thats bad, its only a complaint against java, not swing.
15:52callenfutile: seesaw is doing a lot of cleanup for you.
15:52futilecallen: so far swing in clojure isnt that bad
15:52futilecallen: seesaw looks neat.
15:53tazjinfutile: I guess that's fine as long as you don't try to sell it ;-) (unless you sell it to business people with no sense of aesthetics)
15:53futilebut im always hesitant of third-party abstractions on top of other abstractions.
15:53futiletazjin: no, its fine for anyone. because it looks awesome.
15:53futile:P
15:53xeqifutile: are you making sure to construct and interact with all your components only on the event dispatch thread? While also not doing too much work in the EDT?
15:53futilexeqi: yep
15:54futilexeqi: im not gonna say its 0-lines-of-code or anything, sure its a bit of work. but so is any quality app.
15:55futileits great to get to as little complexity as possible. but ive noticed a trend of even trying to get rid of legitimate complexity. thats unrealistic.
15:56futilethen again, .setSize seems to be having no effect... *grumble*
15:57futileAny ideas why this text field wouldn't be set to 300,200? https://www.refheap.com/18206
15:59Brand0tazjin, you should start something like that ... it actually sounds like it would be useful
16:00Brand0you could model it after that github for clojure style & best practices
16:00tazjinBrand0: That's exactly what I just did! I posted on /r/clojure and on the mailing list (though the post there is still pending moderation) to collect info from people :)
16:00Brand0tazjin, link?
16:00fkeyHow do i make this a valid statement? "(.b (reify Object (a [this]) (b [this statement] (. this ((first statement) (rest statement))))) '(a))"
16:01tazjinBrand0: http://www.reddit.com/r/Clojure/comments/1lj3b2/compiling_clojure_security_knowledge/ - I don't have a link to the mailing list post yet :)
16:01fkeyI am receiving "#<TypeError: this$.first is not a function> at line 174"
16:01xeqifutile: perhaps you want .setPreferredSize
16:01Brand0tazjin, oh, I thought you already started a repo
16:01xeqialso, do you want to set DISPOSE_ON_CLOSE for that JFrame?
16:01futilexeqi: ah, good idea. Thought that was only necessary when you had a layout manager, but maybe it's implicitly using one.
16:02tazjinBrand0: Hah no, I only started this about 30 minutes ago. Give it some time! :)
16:02fkeyGiven a quoted list, the 1st element is the name of function to execute and rest are the argumetns
16:02callenhttp://okmij.org/ftp/Computation/IO-monad-history.html
16:03Brand0gonad history
16:05fkey"(.b (reify Object (a [this]) (b [this statement] (. this (a (rest statement))))) '(a))" works fine :|
16:06fkeyis it something to do with resolving function calls at compile time with objects?
16:06fkeyi am using clojurescript btw
16:06fkey&(.b (reify Object (a [this]) (b [this statement] (. this ((first statement) (rest statement))))) '(a))
16:06lazybotjava.lang.IllegalArgumentException: Can't define method not in interfaces: a
16:07fkey(.b (reify Object (a [this]) (b [this statement] (. this (a (rest statement))))) '(a))
16:07fkeyoops
16:07fkey&(.b (reify Object (a [this]) (b [this statement] (. this (a (rest statement))))) '(a))
16:07lazybotjava.lang.IllegalArgumentException: Can't define method not in interfaces: a
16:14xeqiyogthos|away: the TOC for http://pragprog.com/book/dswdcloj/web-development-with-clojure has "Unit Tests" as a "finishing touches". What libs did you use for this section?
16:38dnolenfkey: you just have a simple error, what output are you expecting
16:38dnolen?
16:43fkeydnolen: sorry about that! basically i am trying to call a method of an object given it's name
16:44dnolenfkey: what is the expected result? your method implementation doesn't make sense
16:44dnolen(.a (reify Object (a [this] :foo)))
16:45dnolenfkey: ^ if you just want to understand how to write it properly
16:45fkeydnolen: im using clojurescript. i am just expecting that the function "a" to be called by "b" , when "b" is passed the argument '(a)
16:45fkeydnolen: in this case, just expecting "nil"
16:46dnolenfkey: seems like you figured it out, the last version works
16:47fkeydnolen: really? ='( i'm using clojrescript.net, must not be updated or something
16:47fkeydnolen: oh, you mean last command i gave?
16:47dnolenfkey: yes
16:47dnolenfkey: it works
16:48fkeydnolen: oh, yeah i expected that one to work.. heres the issue though
16:48fkey(.b (reify Object (a [this]) (b [this statement] (. this ((first statement) (rest statement))))) '(a))
16:48fkeythats the key, replacing the hard coded 'a' with (first statement)
16:49fkeythis is what i am trying to achieve, which does not work
16:49dnolenfkey: yes that's impossible
16:50dnolenfkey: you simple cannot dynamically call methods like that from symbols in ClojureScript
16:51dnolens/simple/simply
16:52fkeydnolen: urgh, really? i technically can use a separate name space for my scenario...i was originally doing this because of a bug in clojurescript i found with hashmaps
16:52fkeyso mabey the name spacing is the best shot to go for then
16:52dnolenfkey: yep impossible. what the hashmap bug?
16:54fkeydnolen: i think you reported it for me? it was something like (def foo { :a (fn [] ) :b (fn[] ((:a foo))
16:54fkeydnolen: someone said it had to do with something with compiling
16:54fkeylate time evulation should occur but it wasn't
16:54dnolenfkey: oh right, I will say putting functions in maps like that isn't really idiomatic, but that should work.
16:55dnolenfkey: not a bug with hashmaps, a bug in the compiler really
16:55dnolenfkey: nothing to do w/ latetime evalution, it's just flat out compiler bug
16:55fkeydnolen: basically my goal is to allow the user to run a script, but i am trying to limit the commands what the user can run..i am supplying the function definitions
16:55fkeydnolen: so i think namespaces could work in this scenario
16:59fkeydnolen: to spare me some grief, would that idea work?
17:00dnolenfkey: I'm not sure what you are trying to do. but sure exporting some functions from a namespace is one way.
17:03zeroemanyone familiar with using clojurescript & core.async targeting nodejs?
17:03zeroemgetting an oddball error and Dr. Google isn't helping
17:06fkeydnolen: alright..another question now; (ns test) (defn foo []) ((symbol "test/foo")) gives "#<Error: Invalid arity: 1> at line 1"
17:06fkeyshould that work?
17:06dnolenfkey: it is impossible to call functions like as well
17:07dnolenfkey: in Clojure on the JVM this all requires var hackery, and ClojureScript doesn't have vars
17:08fkeydnolen: hm, so what would be another alternative?
17:08fkeydnolen: can i do something like ((symbol "someFunctionPrefix-nameOfFunction)) ?
17:09dnolenfkey: no you cannot. You're best bet is to just the hash-map approach, to avoid the compiler bug just don't do it at the top level
17:09fkeyah nope
17:09dnolenfkey: (defn foo-maker [] {:a (fn []) :b (fn [x y])}) (def foo (foo-maker))
17:10dnolenfkey: I'll look into the bug when I get a chance but this is the workaround
17:14squidzdoes anybody know if core.typed works as well/at all with clojurescript?
17:15fkeydnolen: mabey i have to re-think my approach. that work around does not solve my problem. i need a function to call another function given it's name and parameters. the name and parameters will be created and supplied at run time, not compile time...
17:17glosoliHmm in Emacs nREPL package, is there some way to turn on syntax colouring in REPL buffer ?
17:18fkey(defn test []) ((first '(test)))  is mainy what i need, but you said it cant be achieved. I know this can be done in javascript pretty easily
17:19fkeyie, function Class () {}; Class.prototype.foo = function(funcName, args) { this.call(funcName, args); }
17:19fkeysomething of that sort..not sure how to achieve that in clojure though
17:19fkey*clojurescript
17:19fkeydnolen: either way, thanks for helping me out
17:21zeroemsorry, took ridiculously longer to generate the error again, behold my woes:
17:21zeroemhttps://gist.github.com/zeroem/939939874537e81bb9be
17:21fkeyfunction Class () {}; Class.prototype.foo = function(funcName, args) { this[funcName](args); } would work to in my scenario
17:27cjfriszIs it a known problem that circular dependencies in ClojureScript cause a stack overflow error from the compiler and give no helpful error message?
17:33fkeydnolen: found workaround
17:33fkey(.b (reify Object (a [_] :worked) (b [_] ((aget _ "a") ) )))
17:33fkey&(.b (reify Object (a [_] :worked) (b [_] ((aget _ "a") ) )))
17:33lazybotjava.lang.IllegalArgumentException: Can't define method not in interfaces: a
17:34fkeybah, needs to run in cljs to work
17:34zeroemoh, huh. I guess there's no >!! and <!! in cljs
17:34zeroemderp
17:40Denommusanyone working with Clojure on Android? My application can't find my R class
17:43fkeyhmm, now is there a way to call "apply" or "call"?
17:45bbloomfkey: have you tried (find-doc "apply") ?
17:45Denommusthe autogenerated R is on the com.spell.chat package, and on compile-time I can import com.spell.chat.R, but on runtime it gives me java.lang.NoClassDefFoundError: com.spell.chat.R$string
17:46fkeybboom: i have not, im on clojurescript.net
17:46bbloomcjfrisz: it really might not be known, since who makes circular dependencies anyway? :-P
17:46bbloomcjfrisz: you can search/file for bugs with the terrible search tool in the top right corner of http://dev.clojure.org/jira/secure/Dashboard.jspa
17:47cjfriszbbloom: ah, jira, my old friend…
17:47cjfriszI knew I should look there, but I tried to weasel my way out of it
17:47bbloomcjfrisz: don't get me started, it will cost me precious social capital… heh
17:48fkeyhm, ill look but this seemed to work
17:48fkey(.b (reify Object (a [_] :worked) (b [_] (aget (aget _ "a") "call" ) )))
17:48cjfriszbbloom: hmm…looks like dnolen closed that bug on 27 July
17:49bbloomfkey: oh, you're in cljs land. um, yeah clojure functions are just normal javascript functions. apply should work on them, but you need to use something like this-as or something like that, i forget if you need to muck with the 'this' pointer in js
17:49bbloomfkey: dnolen would know better than me
17:51Denommusis there a specific channel for clojure in android?
17:59rhg135hello, is there a way to get the get a seq of locs that are children of a loc in a zipper, like clojure.zip/chilre but returning a seq of loc instead of nodes?
18:02amalloy(take-while identity (iterate zip/right (zip/down loc))) seems like the right direction, dunno if it's exactly right
18:04Denommusis there a way of showing all the Java classes of a package?
18:05rhg135thx amalloy
18:14Denommuswell, it seems I did it
18:19rhg135how?
18:19clojurebotwith style and grace
18:19gdevwhy?
18:19clojurebotwhy is Why
18:19gdevwhen?
18:20rhg135heh
18:57rurumateHow to decide at runtime which function in a chain of calls should be applied? is there some macro magic to turn B into something like A? https://www.refheap.com/18212
19:00hyPiRionNot sure if cljs has it, but replacing `the-fun` with `(cond-> convert js->clj)` works in Clojure
19:01rurumatehyPiRion: ok but can we rid of the let?
19:01hyPiRionsure
19:01hyPiRion,(-> 2 (* 3) (cond-> (= 1 2) inc) (* 2))
19:01clojurebot12
19:01hyPiRion,(-> 2 (* 3) (cond-> (= 1 1) inc) (* 2))
19:01clojurebot14
19:02rurumatewhat
19:04futilewat
19:04hyPiRionrurumate: read up on the docs on how cond-> works, it's not that much magic
19:04futileI'm excited about this new project :)
19:05hyPiRion,[(cond-> 1 true inc) (cond-> 1 false inc)]
19:05clojurebot[2 1]
19:06futileIs grok now an exclamation?
19:06rurumatebut umm will it actually work
19:07rurumate(= 1 1) seems like known at compile time
19:07rurumatecontains no free variables...
19:09hyPiRionrurumate: why does that matter?
19:09rurumatenot sure.. about to test this code
19:12rurumate(defn make-even [n] (-> n (cond-> (if even? n identity inc)))
19:12rurumate,(defn make-even [n] (-> n (cond-> (if even? n identity inc)))
19:12clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
19:12rurumateoh noes
19:12rurumate,(defn make-even [n] (-> n (cond-> (if even? n identity inc))))
19:12clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
19:12hyPiRionthat's not how it works
19:13rurumate,((fn make-even [n] (-> n (cond-> (if even? n identity inc)))) 1)
19:13clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>
19:13rurumatewhopee
19:13rurumate,((fn [n] (-> n (cond-> (if even? n identity inc)))) 1)
19:13clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>
19:13rurumateunmm
19:13hyPiRionsir, (cond-> x y z) is the same as (if y (z x) x)
19:14rurumate,((fn [n] (-> n (cond-> (if even? identity inc)))) 1)
19:14clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>
19:14rurumate,((fn [n] (-> n (cond-> even? identity inc))) 1)
19:14clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>
19:14rurumateouch
19:14hyPiRionrurumate: there's no else clause in cond->
19:15hyPiRion,(cond-> 1 true (* 2) true (+ 6))
19:15clojurebot8
19:15rurumate,((fn [n] (-> n (cond-> #(even? % identity inc))) 1)
19:15clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
19:15hyPiRion,(cond-> 1 false (* 2) true (+ 6))
19:15clojurebot7
19:16hyPiRionrurumate: what are you trying to do? return 1+n if n is odd, and n if n is even?
19:16rurumateaye
19:17hyPiRioncond-> doesn't take expressions, it takes values. So it's not possible to refer to the value in a test clause
19:18hyPiRion(it does take expression for the calculation part though)
19:18rurumatehyPiRion: but that's what I was trying to do!
19:19rurumateI want to decide at runtime what function to use, not at compile time..
19:19hyPiRionrurumate: so you want to do either this, OR that?
19:19hyPiRionas an if?
19:20hyPiRionI'd guess you can use as-> for that, but read up on them and play around with them
19:21rurumatehyPiRion: if-else is enough..
19:21hyPiRion,(cond-> 10 (* 2) (+ 1) (as-> x (if (even? x) x (inc x))))
19:21clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>
19:22hyPiRionwhy did I use cond-> there
19:22hyPiRion,(-> 10 (* 2) (+ 1) (as-> x (if (even? x) x (inc x))))
19:22clojurebot22
19:22hyPiRion,(-> 10 (* 2) (as-> x (if (even? x) x (inc x))))
19:22clojurebot20
19:31rurumate,((fn [n] (-> n ((if (even? n) identity inc)))) 3)
19:32clojurebot4
19:32rurumatefinally.. just needed another pair of parens
19:42Denommus... using clojure in android seems to be too much of a complicated task
19:45grandycallen: actually not a full repl for clojure but a sort of command line UX for a gui app
19:52grandylooking for advice on how to approach a simple app i'm building in a way that is going with the grain of clojure rather than against it... the app is a seesaw ux app that implements a text box and depending on what gets typed in, various things happen
20:02xeqigrandy: that sounds like seesaw + create a jframe with a JTextField and attach a change event listener
20:08Denommus...
20:10DenommusI can't get my current activity, for some weird reason
20:12xeqiDenommus: I haven't seen many people using clojure on android. You might have a better chance of awnsers asking questions at https://groups.google.com/forum/#!forum/clojure-android
20:12Denommusthanks
20:15mmoriarityhey guys, i'm having a weird issue that i can't seem to track down. i have a namespace with a main function that parses some text and uses clojure.data.json to print some json. when i run this as a .clj script with clojure.main, it works correctly. when I AOT compile it, the json gets truncated. any ideas why?
20:17xeqimmoriarity: how are you running the two versions?
20:19futileAdverbs are overrated.
20:19mmoriarityjava -cp /Users/matt/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar:target/meals.parser-0.1.0-SNAPSHOT.jar clojure.main -m meals.parser.core /Users/matt/Meals/meal-plan.pdf and java -cp /Users/matt/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar:target/meals.parser-0.1.0-SNAPSHOT.jar clojure.main -m meals.parser.core /Users/matt/Meals/meal-plan.pdf
20:19futile"To copy, simply drag the file to the destination."
20:19mmoriaritythe former truncates prematurely, the latter works correctly
20:20futile"It effectively transforms the instance into the proper base class"
20:20mmoriarityoh crap, those are the same, one sec
20:20mmoriaritythis one is what fails: java -cp /Users/matt/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar:target/meals.parser-0.1.0-SNAPSHOT.jar meals.parser.core /Users/matt/Meals/meal-plan.pdf
20:21hyPiRionmmoriarity: What happens if you uberjar it?
20:21mmoriaritysame problem
20:22mmoriarityi was originally uberjaring it, but then i wanted to isolate the problem
20:23mmoriarityadding clojure.main -m consistently makes it work, but i presume that's not running my compiled class then
20:23mmoriaritybut rather the .clj
20:24gunsmmoriarity: Sounds like the main thread is exiting before your print is complete
20:25xeqior something going on with *print-lenght*
20:26gunsIf you're doing your printing in a separate thread, make sure you wait on it before exit
20:26mmoriarityi'm not doing it on a separate thread, i'll paste the main function
20:27xeqi`java ... clojure.main -m meals.parser.core` will used the AOT'd class, but with a layer of indirection where it initializes the clojure.main class and then calls into your -main
20:27gfredericks,(->> 2 (rand-int) (fn []) (repeatedly 5))
20:27clojurebot(1 0 1 0 0)
20:27mmoriarityhttp://pastebin.com/tA4msr9s is my main function
20:28mmoriarityand it was doing this before i added shutdown-agents
20:30xeqimmoriarity: are you getting ... at the end of your output?
20:31mmoriaritynope
20:31mmoriarityjust chops off mid-word
20:33xeqimmoriarity: can you try adding (flush) after the (json/pprint ...) ?
20:34mmoriarityi'll give it a shot
20:35mmoriarityxeqi: that did it! thanks for your help
20:36xeqihmm, that sounds like its http://dev.clojure.org/jira/browse/CLJ-987
20:36xeqiwhich is marked fixed
20:36xeqifor 1.5
20:37mmoriarityperhaps data.json is doing something different
20:44xeqiah! json/pprint delegates to pprint/write which doesn't have a flush or prn in it like pprint/pprint
20:45mmoriaritywell there we go! does that mean clojure.main is doing some extra flushing?
20:46callencute.
20:46callenxeqi: nice sleuthing.
20:46xeqimmoriarity: yep https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj#L444
20:46coventryclojure.walk2/macroexpand-all says that it does not perfectly emulate recursive macroexpansion by the compiler because it does not understand special forms like "let." What's an example where this makes a difference?
20:47mmoriarityxeqi: thanks for helping figure that out :)
20:50amalloycoventry: (defmacro m [] 10) (macroexpand-all '(let [m #(+ 1 2)] (m)))
20:50amalloybut i don't know why you'd use walk2; clojure.tools.macro does a much better job
20:55coventryamalloy: Thanks for the example and the suggestion. Will take a look at c.t.m/mexpand-all. It sounds like what I need. Do you know if its expansion is faithful to what the compiler does?
20:56amalloyit's close but not perfect
20:56amalloyi can't really remember the edge cases at the moment though
21:00coventryThanks. Sounds like a hairy problem.
21:05coventry"clojure.tools.macro/mexpand does not correctly deal with macros that use &env" according to http://sgeo.tumblr.com/post/37646341234/clojure-macroexpansion
21:07bbloomin my experience, all non-standard macroexpanders are all broken in some subtle ways
21:07SgeoThere's a standard macroexpander?
21:07bbloomSgeo: yeah, it's in compiler.java
21:08coventrySgeo's recommendation of jvm.tools.analyzer sounds promising. I think it just gets the answer straight from the compiler.
22:11ddellacostabrowserchannel vs. web sockets + IE8/9 shim? Thinking of using clj-browserchannel for pubsub/notifications setup.
22:12ddellacosta+ core.async
22:22callenddellacosta: browserchannel is a little baroque, but you don't need to worry about out of date websocket clients masquerading as if they know what's what.
22:23callenddellacosta: my preferred path is websockets + client sniff blacklist + IE shim.
22:23ddellacostacallen: client sniff blacklist = "you are bad no web sockets for you?"
22:23callenddellacosta: yeah, to cherrypick the ones that have ancient websocket versions and shoo them to a page telling them to stop being scumbags.
22:23ddellacostacallen: if you had to support IE8/9 and were writing this all in CLJS, would you still take that approach?
22:23callenif I was hyper-worried about it always-always-always working, I'd consider browserchannel but I'd want to evaluate it first before committing to the choice.
22:24callenddellacosta: WS:// + IE shim is what I'd probably do in your case, again, unless there's an extreme imperative for reliability.
22:24ddellacostacallen: I mean, I'm hoping to build it flexibly enough that I can swap out web sockets at some point anyways, once we don't have to support older browsers/etc.
22:24ddellacostahmm, will have to think about that.
22:25ddellacostacallen: okay, that's helpful, thanks for the advice!
22:25callenddellacosta: well, the only thing I'd believe myself to be missing out on with browserchannel if I went with WS:// is retry logic / conn management.
22:25callenddellacosta: browserchannel has a lot of that "try, try, try again" type stuff baked in and battle-tested already.
22:25callenI'm not aware of any libraries that do that for WS://
22:26ddellacostacallen: that's good to know and think about.
22:27callenddellacosta: that "uh oh, we lost the connection!" thing in gmail? BrowserChannel.
22:27ddellacostacallen: ah, cool. Yeah, I like the "feel" of gmail, and basically maps onto the kind of user experience we want to have
22:28callenddellacosta: well thing is, you can do the same with websockets.
22:28callenit's just, again, I'm not aware of any battle-hardened libraries for it.
22:29ddellacostacallen: right, point is, if I get the equivalent experience from both, but get a bit more support and reliability (at the expense of some efficiency) with browserchannel, it's probably the right choice.
22:29ddellacostaespecially if we can swap it out at some point, when we feel more comfortable w/websockets as a general technology
22:29kornyAnyone have thoughts on how to fake a Java object with a private constructor (for testing)
22:30kornywe are currently defining a protocol and a type that look the same as the object, but it's pretty verbose
22:31kornythe code under test has no type hints, so anything that implements (.getFoo %) and (.getBar %) and (.getFoo #(.getAttrs %)) will do
22:31callenddellacosta: seems sound.
22:31ddellacostacallen: thanks again for the advice.
22:32callenddellacosta: meh, you just ask good questions that I can actually answer. Stop doing work I've touched on before and I'll leave you alone.
22:32ddellacostaheh
22:33kornywe can't use proxy (as no interface exists) nor reify (as we can't call a constructor) :(
22:33ddellacostaon the other hand, I wish we could offer korny some help…dunno how to create class w/private constructor via Clojure…what about creating POJ and using that to test?
22:33ddellacostaPOJO that is
22:33callenkorny: huh.
22:33kornyIs there a simple way to make a POJO?
22:33ddellacostaer, I meant like in Java. :-/
22:33kornywithout making a protocol
22:33callenkorny: are you sure you can't wallhack the private constructor?
22:33kornyeeuw :)
22:33callendon't eww at me.
22:33kornythat was in response to "in Java" :)
22:34ddellacostawhat does "wallhack" mean? I've never heard that before.
22:34ddellacostaoh, haha
22:34callenddellacosta: it's an actual fn.
22:34ddellacostayou can eww at me.
22:34ddellacostahuh
22:34callenkorny: wallhack the private constructor and reify.
22:34kornywall hack - vaguely think I remember that, my java is rusty
22:34callenkorny: wallhack is Clojure
22:35kornycool
22:35callenI use a similar trick to bypass peoples' obnoxious "(defn-"s.
22:35ddellacostahttps://github.com/arohner/clj-wallhack ?
22:35callenddellacosta: yeah, it used to be contrib.
22:36kornyah, found it. We could use that - sadly the actual constructor is horrible, so doesn't help hugely.
22:36ddellacostagotcha. Well, every day I learn something new.
22:36callenkorny: you want to construct the object, but you don't want to call the constructor?
22:36kornyI want to fake the object so I can pass it to tests
22:36kornyThe real object is SFTP attributes
22:37callenfaking is tricky, since a custom class wouldn't be identical to what their tests expect
22:37korny… which are built from binary flags returned from an SFTP server
22:37futileSo, anyone else noticed that you can become an expert at anything a lot quicker these days by just searching StackOverflow?
22:37bbloomkorny: if you need to do some funky java thing, why not just write a small amount of actual java?
22:37technomancycallen: you use wall-hack for clojure-private?
22:37callenfutile: that's not how you become an expert, it just makes it easier to pull up resources.
22:37futileIt's like google on steroids for finding out about things.
22:37callentechnomancy: no, I was speaking to the pattern of sidestepping.
22:37ddellacostabbloom: I suggested that and got eew-ed at
22:37kornybbloom: yeah, that might be necessary. It's a pity as we really just want a fake JavaBean(™) for a test
22:37technomancyoh, ok
22:37futilecallen: the "a lot quicker" part was caused by stackoverflow
22:38ddellacostakorny: hmm, what about rather than that, using some java mock libs via Clojure then?
22:38bbloomddellacosta: korny: writing java sucks, but it sucks a lot less than extremely complicated contrortions to write java in clojure
22:38ddellacostabbloom: definitely agreed
22:39futilebbloom: what?
22:39futilebbloom: I'm using Swing directly in Clojure and it's perfectly fine.
22:39bbloomfutile: you're writing clojure in clojure :-P
22:39kornywe have a working solution in about 20 lines of clojure, it's just ugly as it's 2 protocols and 2 types :(
22:39futilebbloom: ok
22:40bbloomfutile: java interop is part of clojure, but if you need to do shit with various constructors, subclassing, annotations, class loaders, static functions, nested classes, and other hackery
22:40bbloomfutile: just for some examples…. you should write java
22:40bbloomsadly....
22:40futilebbloom: does that apply only to writing java, or also to interop'ing with java that already does this?
22:41kornybbloom: definitely - we were trying to write Hamcrest matchers in clojure, had to build a Java interface first
22:41futilebbloom: my plan is to use Clojure and only do Java interop when necessary but avoid writing .java files
22:41bbloomfutile: yeah, that's everybody's plan, but some libraries would just be a bitch to use from clojure.
22:41futilebbloom: any in partciular?
22:42bbloomfutile: *shrug* i use very few libraries in general… and the ones i do typically have very simple functional interfaces, so i haven't had to take my own advice yet
22:42futilebbloom: yay
22:44kornyfutile: calling java from clojure is easy. Anything where java needs to call back to clojure, especially if you need non-trivial types, can be hard.
22:45TEttingerkorny, yeah. Clojure-Java is definitely better when clojure's calling the shots
22:46futileSeems like we could use a nice language to bridge Clojure to Java.
22:46kornyfutile: for example, making Hamcrest matchers means something like "class IsEqual<T> extends BaseMatcher<T>" … way beyond what hen-class can cope with
22:46futileMaybe we can call it Clojava
22:46kornygen-class
22:47kornynot sure why colloquy corrected that to "hen-class" :)
22:47TEttingerfutile: Scala. You would just have to deal with stuff like http://scalaz.googlecode.com/svn/continuous/latest/browse.sxr/scalaz/Kleisli.scala.html#25623
22:47kornyI quite liked how Groovy does it - optional typing, copes with generics.
22:48kornyanyway, thanks y'all for help, time for lunch
22:48xeqikorny: isn't that (:genclass :extends BaseMatcher) due to type erasure?
22:48futilekorny: check out limechat, best ird client ive ever used
22:48futile*irc
22:49kornyxequ: doesn't seem to work, doesn't produce a class that Java likes
22:49TEttingerI wonder how hard it would be to make an idiomatic clojure-over-java wrapper generator for java libraries.
22:49TEttingerlike using clojure maps rather than HashMaps
22:51johnmn3not sure what happened.... cljisbuild is just hanging, saying it is compiling to the js file... but never finishes
22:52bbloomjohnmn3: have you tried a clean? and have you also tried increasing the memory given to the JVM? are you using advanced mode compiling?
22:53johnmn3I brought it down to just whitespace. I'll try cleaning again. Haven't had mem issues before.
22:54alexbaranosky_does anyone know of any good library for creating uniform and normal distributions of moments in time between T1 and T2?
22:54johnmn3nothing will break if I delete the target/ and out/ dirs, right?
22:54bbloomjohnmn3: should be fine
22:55johnmn3bbloom: k
22:55xeqijohnmn3: auto or once ?
22:55johnmn3xeqi: once... but both
22:57futileIs there a common user-error that would cause my (proxy) method to not get called?
22:59johnmn3It's pretty strange. I've compared the cljsbuild settings in project.clj against a known working version, and it's still hanging... going to try rebooting pretty soon. It's a strange environment, because I'm running on the ARM based chromebook.
22:59clojurebotHuh?
23:05xeqifutile: not calling it, calling a method of the same name but different types
23:06futileaha! Do you have to ensure the types are the same?
23:07futileI suppose if the method isn't overloaded, then overriding the superclass's method just requires naming it the same and having the same arity, and the types don't matter, right?
23:08xeqifutile: I believe so
23:08futileBeen stuck on trying to make a custom DocumentFilter for a few minutes here, losing the battle.
23:23futileWoo solved.
23:27cgagwhat was wrong
23:39johnmn3sorry, got disconnected. Not sure if anyone got this: https://www.refheap.com/18222
23:42cgagjohnmn3: did that fix your problem? or this is to help people diagnose it?
23:42johnmn3cgag: nope, just posting up what I had... still not working.
23:42johnmn3I mean, cljsbuild should never take 10 minutes right?
23:43johnmn3I haven't tried walking away for 30 minutes to see if that does it...
23:43cgagi've only run it on like 200 lines of code, but ive never seen it take more than 30 seconds, and that's before the jvm is warmed up
23:44cgaghave you ever had it compile successfully?
23:45futilecgag: re "what was wrong", it was that I was overriding "insertString" but only "replace" was getting called when I typed text into it for some reason
23:49johnmn3cgag: yea, it was compiling fine, last time was messing with it a few weeks ago.
23:55johnmn3hmm. another project isn't compiling either... trying with a fresh project