#clojure log - Sep 01 2013

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:04 callen: devn: probably wants an ifdef.

0:06 grandy: hello, 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 ... ?

0:08 tufflax: I'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?

0:09 grandy: what attributes

0:09 grandy: tufflax: well, just getters or whatever i need to do to get data about the event

0:10 tufflax: forgetting what they are called in java, maybe properties or something

0:10 tufflax: (.getKeyCode event) is the standard way

0:10 then there is like a few macros and stuff that you can use if you need to do multiple calls and chains etc

0:11 grandy: tufflax: ahh ok wasn't sure if seesaw carried its abstraction further down,.. makes sense

0:11 tufflax: thanks much

0:11 tufflax: grandy: I haven't actually used seesaw so not sure about that

0:12 grandy: tufflax: 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

0:50 clj_newb_2345: for a web app

0:51 should I use mongodb/monger or riak/welle ?

0:55 futile: datomic

0:55 clj_newb_2345: datomic

0:56 clj_newb_2345: how about for things that do not fit in datomic free edition>

0:56 Raynes: stfugtfo

0:56 clj_newb_2345: i.e. the "value" part of a key value store

0:56 rickjames: I'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

0:56 clj_newb_2345: I'd like to see types get integrated into clojure

0:57 it'd cut down 90% of the bugs I currently write

0:57 callen: I'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.

0:57 Design is more important.

0:57 clj_newb_2345: all unit tests prove is that code does not fail on previously documented cases

0:58 callen: Coq 's type system proves correctness.

0:58 rickjames: clj_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

0:58 callen: To the extent that types limit expression and pervert intent, they are rarely helpful except to noobies writing Haskell.

0:58 Raynes: rickjames: I doubt it.

0:58 I specifically do not want types.

0:58 If I wanted types, I'd go write some Haskell.

0:58 callen: clj_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.

0:58 rickjames: Raynes: : i'll stick with F# then, which in many ways is similar to Clojure

0:58 unlike Scala

0:58 callen: clj_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.

0:59 rickjames: nobody's stopping you using core.typed, but you should watch a few Rich Hickey talks.

0:59 Raynes: I 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.

0:59 clj_newb_2345: callen: I hated both haskell and ocaml's type system. Coq's type system, however, allows _proof of correctness_ that becomes a different game.

0:59 callen: rickjames: you might better understand where he's coming from, the design principles and priorities, etc.

0:59 rickjames: callen: I've watched most of the fundamental ones

0:59 callen: clj_newb_2345: I don't care.

0:59 rickjames: then you understand the emphasis on design rather than banging into guard rails.

1:00 rickjames: callen: : 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

1:00 callen: I don't mind optional typing, but obligatory typing is going to make me unhappy.

1:00 rickjames: lost

1:00 gradual typing

1:01 the good thing about clojure is that it's function oriented and none of this OO nonsense, so the IDEs can do good things

1:01 callen: rickjames: Clojure core libraries have a *design*.

1:01 rickjames: 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.

1:01 rickjames: callen: : yes, but without types its hard to understand

1:01 deep nesting

1:01 callen: Types are, loosely speaking, a form of reified design.

1:02 rickjames: it is for you, you're just not used to it yet.

1:02 ddellacosta: rickjames: not everyone seems to have that problem

1:02 callen: It comes with time and experience. Hickey *just* got done doing a talk saying people need to be more patient

1:02 clj_newb_2345: argh

1:02 rickjames: ddellacosta: : I understand that we're all different

1:02 callen: and not be so alienated by unfamiliar systems and designs.

1:02 it has nothing to do with being a certain person, it's only a matter of time investment.

1:02 clj_newb_2345: it's like "I want a combustion engine." "no, you just need horses" "you don't understand the flexibility that horses give you"

1:02 rickjames: I disagree

1:02 callen: there's no such thing as naturally understanding types or not.

1:03 rickjames: I don't like that argument that "everybody" will understand and appreciate eventually

1:03 ddellacosta: rickjames: 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

1:03 callen: you'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.

1:03 clj_newb_2345: or

1:03 you could make clojure better

1:03 rather than accept it as is

1:03 rickjames: I understand all of that

1:03 shaungilchrist: what if you could build a biological combustion engine out of horses?

1:03 rickjames: I really like the cloure community

1:03 clj_newb_2345: I fundamentally believe that types will take over; because programemrs who understand types are will be more productive thatn programmers who refuse to use types

1:03 callen: I 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.

1:03 Raynes: clj_newb_2345: 'take over'

1:03 lol

1:04 callen: The last time somebody attempted to improve upon core without really understanding Clojure, we got Midje.

1:04 rickjames: clj_newb_2345: : yes, all research is going into type systems

1:04 callen: please do repeat that mistake.

1:04 rickjames: "all"

1:04 Raynes: Drama drama.

1:04 ddellacosta: heh

1:04 callen: clj_newb_2345: types will never take over because computers aren't typed.

1:04 rickjames: Raynes: I hang out on LTU, and all I see is type system research

1:04 callen: clj_newb_2345: they can only achieve a certain level of penetration at the higher leels.

1:04 rickjames: so you've never heard of selection bias? :P

1:04 Raynes: rickjames: I never disputed that particular thing.

1:04 ddellacosta: haha

1:05 Raynes: rickjames: I think you were aiming at callen.

1:05 rickjames: i've been around LTU for a long time

1:05 that's what I see

1:05 callen: rickjames: so have I, so have a lot of Clojurians. Yet we're still here.

1:05 Raynes: I've been around Lisp for a long time. You should see the stuff I've seen, man.

1:05 rickjames: but to me types are for big systems and discoverability and IDE support

1:05 Raynes: There's like dynamic typing and shit in here.

1:05 rickjames: luckily clojure doesn't suffer from OO

1:05 callen: rickjames: 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.

1:05 Raynes: It's wild.

1:05 callen: rickjames: you need to understand that it's a valid choice and one that can be made as an informed individual.

1:05 rickjames: just my opinion guys, i know it goes against the grain here

1:06 not trying to ruffle feathers

1:06 callen: rickjames: because once you understand that, you can make your own decision to learn more Clojure or not, and stop wasting time.

1:06 no ruffled feathers, we deal with conversations like this regularly.

1:06 rickjames: callen: : i have learned clojure

1:06 callen: usually Haskell refugees that decided they want to write something that will compile a week after they write it.

1:07 rickjames: I'll probably buy yogthos book

1:07 ddellacosta: what is yogthos book? I know not of what you speak. Interested.

1:07 rickjames: his web app book

1:07 just went beta

1:07 callen: ddellacosta: yogthos wrote a book on Clojure Web Development based on Luminus.

1:07 ddellacosta: ah, cool

1:07 callen: ddellacosta: very proud of it :)

1:08 clj_newb_2345: url for book?

1:08 ddellacosta: nice

1:08 callen: ddellacosta: http://pragprog.com/book/dswdcloj/web-development-with-clojure

1:08 I need to get a fucking commission, I've been selling the shit out of his book for him.

1:08 ddellacosta: callen: it's too bad I must be the only clojure web dev using it in production not using luminus

1:08 *sigh*

1:09 Raynes: callen: Well, if he'd do a bit of marketing.

1:09 callen: ddellacosta: 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.

1:09 rickjames: yeah, from what i hear it's just putting the pieces together

1:09 callen: ddellacosta: my CMS experiment test bed is basically Luminus with whatever mad scientist experiment I am testing that week tossed in.

1:09 ddellacosta: which I then turn around and try to convince yogthos to add to Luminus.

1:09 like blackwater.

1:10 rickjames: and I appreciate Yogthos strong anti-OO stance on Reddit and HN

1:10 need more anti-OO peeps

1:10 clj_newb_2345: ddellacosta: are you using pedestal ?

1:10 callen: rickjames: even though I'm in the same camp, try to temper the anti-OO hate.

1:10 rickjames: callen: : why?

1:10 ddellacosta: callen: 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

1:10 callen: rickjames: the individual faculties in OO weren't the problem (except for statefulness), it was the way they were complected together in a messy fashion.

1:10 ddellacosta: clj_newb_2345: naw, pedestal is not something I really understand the need for right now.

1:10 callen: things like single-dispatch, multiple-dispatch, etc are very handy.

1:10 rickjames: callen: thought CLOS was a good idea

1:10 ddellacosta: clj_newb_2345: not saying it isn't useful, just don't have use for it personally yet.

1:11 callen: rickjames: you clearly didn't use CLOS.

1:11 rickjames: it's all about dispatch

1:11 methods and data don't belong together

1:11 callen: as someone who suffered under the dominion of other peoples' CLOS experiments, No.

1:11 CLOS was produced very stateful and hard to follow code.

1:11 CLOS produced*

1:12 rickjames: nobody ever told us what OO is really about except the Smalltalk guys who were wrong

1:12 clj_newb_2345: they were so fucking wrong we gave them a turing award

1:12 rickjames: any non-multiple inheritance or single dispatch is just plain wrong

1:12 callen: Nobody knows what the Smalltalk guys were really saying because it changed over time

1:13 once they tried something they didn't work, or somebody else attempted it and failed, they would pivot.

1:13 now Alan Kay is pretending he invented FP and immutability.

1:13 rickjames: callen: : 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

1:13 callen: give it 5 years and he'll claim he was originally talking about things like Agda and Coq too.

1:14 rickjames: fuck that. Unix forever.

1:14 rickjames: forever?

1:14 callen: stateful images are a bad idea.

1:14 rickjames: never ever, ever anything better?

1:14 callen: does IRC disable peoples' ability to detect hyperbole?

1:15 rickjames: I've always seen Clojure as a language work bench kind of like what Simonyi is trying to do and maybe failed at since

1:15 callen: anyway going back to my point, Alan Kay and the Smalltalk community in general tries to claim everything good that happens was their idea.

1:15 including Erlang, FP, immutability, CLOS, etc.

1:15 rickjames: oh yeah, and the Java guys ate it up hook, line, and sinker...with a bad model to being with

1:16 callen: enough about things that aren't Clojure though.

1:17 rickjames: and more about composable systems

1:17 in a way, F# is the clojure of the statically-typed world

1:18 Scala still wants OO

1:18 callen: I'm sure there's are F# and Scala channels available on FreeNode.

1:18 Raynes: I… don't know why that holds true.

1:18 callen: there are*

1:18 Raynes: F# isn't a Lisp.

1:18 callen: F# is an OCaml derivative, it has nothing to do with Clojure and hasn't really taken any ideas from it.

1:19 The 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.

1:19 Raynes: rickjames: http://www.shenlanguage.org/

1:19 rickjames: i understand that

1:19 callen: rickjames: I'm asking politely, we can stop discussing things that aren't Clojure in this channel?

1:19 Raynes: have you tried to write any Shen? It's WEIRD.

1:19 Raynes: No.

1:19 I don't want to. :P

1:19 rickjames: Shen is pretty wild

1:20 Raynes: Like I said, I specifically do not want static typing.

1:20 callen: Raynes: I expected it to be a branch off of CL, it feels like the Galapagos of Lisps.

1:20 it's very weird.

1:20 rickjames: mutants aren't necessarily weird

1:20 ;)

1:20 callen: http://tech.puredanger.com/2013/08/31/clojure-and-testing/?utm_source=dlvr.it&utm_medium=twitter

1:20 ddellacosta: I'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"

1:20 rickjames: i never said that

1:21 callen: ddellacosta: it's more that I got bored with the particular track of conversation as it was going.

1:21 rickjames: i said that most research is going into type systems these days

1:21 callen: ddellacosta: I was hoping to steer it into waters that were either entertaining or productive.

1:21 I've failed.

1:21 ddellacosta: callen: sorry. I'll stay out of it now. You didn't fail, I did. :-(

1:21 rickjames: i'm lame and need a debugger...any chance of Ritz getting to CounterClockWise?

1:21 callen: ddellacosta: no no, your input is every bit as valid as mine.

1:22 ddellacosta: rickjames: in any case, actually it wasn't you.

1:22 clj_newb_2345: is there actualy a working port of shen on clojure?

1:22 callen: ddellacosta: if not more so, since you're not a bastard to everybody.

1:22 ddellacosta: haha

1:22 clj_newb_2345: i tried one, and the examples from the shen book didn't even work

1:22 callen: ddellacosta: I blame Zen.

1:23 clj_newb_2345: you're not going to be happy until Clojure is ported to COBOL.

1:23 rickjames: listen guys, COBOL is the future..BAs can write code then and we can happily go back to working at McDonalds

1:24 * callen watches the quality thermometer of the channel drop a few more notches

1:24 ddellacosta: callen: Zen is totally the problem. heh

1:24 callen: ddellacosta: sometimes I help people in here while in a state of Zen confusion, then

1:24 rickjames: callen: : your sarcasm sensor went down a few notches too

1:24 callen: ddellacosta: the advice will be valid but not necessarily helpful.

1:25 ddellacosta: callen: that is awesome, hahaha

1:26 callen: ddellacosta: if you watch carefully when I'm helping people and others have to interpret, sometimes that's what is happening :)

1:28 futile: rickjames: 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

1:29 callen: I can't believe I'm saying this, but I think that sort of nonsense is beneath you futile.

1:29 futile: that I have any expectations at all is shocking.

1:30 futile: callen: but C++ is the best place to get RTTI and metaprogramming that Clojure needs while still being thread-safe

1:30 callen: "C++"..."best"

1:30 futile: Not to mention, we'll get templates for free that way!

1:30 rickjames: no, I don't want to go back to the 90s

1:30 futile: Plus multiple inheritance, which Java simply lacks.

1:30 rickjames: how did we get this C++ "resurgence" anyway

1:30 * futile facepalms

1:30 callen: we didn't. Can we talk about Clojure now?

1:31 rickjames: callen: no, it's Saturday night, we need to talk about Prolog

1:31 a real declarative language

1:31 ;)

1:31 futile: I guess there are some languages which references to aren't universally understood to be jokes.

1:32 rickjames: I think Clojure has a Prolog library anyway

1:32 ...almost

1:32 Raynes: Let's talk about how bad Windows is.

1:34 futile: No.

1:34 So, next time I want to make that joke, what language makes it most obvious it's a joke?

1:34 rickjames: I'm porting Clojure to my VIC-20

1:35 futile: Maybe Rust?

1:35 Oh wait no, Ruby.

1:42 rickjames: yogthos: congrats on your book

1:58 Raynes: So how about that Erlang

1:59 Apage43: oh erlang

2:15 muhoo: yogthos has a book?

2:16 Raynes: Dude.

2:17 14 people have said those exact words in the last hour.

2:23 dissipate_: anyone see this? http://www.infoq.com/presentations/Clojure-Macros

2:23 damn, macros are scary!

2:24 arcatan: Speaking of Clojure

2:26 dissipate_: speaking of clojure in #clojure? hmm...

4:49 ddellacosta: midje errors are close to useless

4:49 #$(*!

5:00 callen: ddellacosta: this is why I tell people to use clojure.test :)

5:01 ddellacosta: callen: 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.

5:01 callen: probably what I should do is try writing some extensions for clojure.test which add the bits I like about midje.

5:01 callen: ddellacosta: which?

5:02 you know prism exists right?

5:02 ddellacosta: callen: features? in particular turning repl based filtering on and off

5:02 callen: no.

5:02 callen: https://github.com/aphyr/prism ?

5:02 callen: yessir

5:02 50% of my c.t workflow :)

5:02 ddellacosta: callen: well, maybe I'll see about extending that to add some of the other candy midje gives you…very nice.

5:03 callen: but seriously, the filtering is awesome, I really like it. But as far as fixtures and whatnot, clojure.test is the way to go.

5:03 callen: I find that there are three camps in this channel.

5:03 ddellacosta: they are?

5:03 callen: 1. Those that don't care and use clojure.test 2. Those that care, and use clojure.test (me) 3. Those that use midje.

5:04 ddellacosta: you need leiningen style test selectors in the REPL?

5:04 ddellacosta: ddellacosta: 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

5:05 whoops, used my name for some reason. I is idiot

5:05 callen: I get your meaning anyway :)

5:05 ddellacosta: callen: um, what do you mean when you say leiningen-style test selectors?

5:06 callen: 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)

5:06 callen: https://github.com/technomancy/leiningen/blob/master/src/leiningen/test.clj https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md

5:06 ddellacosta: callen: midje makes this extremely easy and nice to do.

5:06 callen: uses metadata on the vars to create aliases for subgroups of tests and to set defaults

5:07 covers most of what c.t users wanted I think.

5:07 ddellacosta: callen: 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

5:07 callen: nah, straight up lein. That is why I asked if you wanted it in the REPL.

5:09 ddellacosta: callen: ah, so, no--what I'm talking about is midje's auto test, which you can filter on the fly

5:09 autotest

5:10 callen: I mean, I like the syntactic candy of => as well, but that's neither here nor there. "is" works just fine for me

5:10 callen: filter on the fly?

5:10 ddellacosta: callen: 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

5:10 callen: filter on the fly--add an argument to the fact (test) to say, this one is now filtered

5:11 callen: and then it gets picked up in the repl as it's looping through, so only that one shows.

5:12 callen: how does the autotester communicate with the REPL? most curious.

5:12 I will ponder and investigate this.

5:12 ddellacosta: callen: autotest is a function run from the repl

5:13 callen: you call it like "(autotest :filter :some-name)" and that filters your tests

5:13 callen: I see. Does it continually execute?

5:13 ddellacosta: callen: yep

5:13 callen: and when you're ready, you can switch it off by calling autotest again

5:13 for my particular workflow, it's super handy.

5:13 callen: do ho. I can already guess what marick's code looks like.

5:14 ddellacosta: callen: the problem is, yeah, it's kind of horrible.

5:14 * callen rubs hands together and grins, baring a fang

5:14 ddellacosta: hahaha

5:14 I 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

5:15 callen: yap.

5:15 ddellacosta: but, apparently the devs are doing some cleanup work, so I hope it can get "trimmed back."

5:15 I would be interested in midje light

5:15 which is to say, I should probably just add some features that I want to prism/clojure.test

5:15 brb

5:16 callen: probably :)

5:17 ddellacosta: heh, yep.

5:18 callen: while I've got your ear, cheshire is the go-to for json these days, is that right?

5:18 callen: yeppers.

5:18 ddellacosta: 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.

5:18 ddellacosta: and, for http request, I guess clj-http? Making a JSON api request

5:18 callen: You'll at least come away with an appreciation of what's true or not, whether you're happy or not.

5:19 ddellacosta: 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)

5:19 ddellacosta: callen: 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.

5:19 callen: if you want a "dumber" http client, clj-http-lite and others exist.

5:20 ddellacosta: callen: 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.

5:20 callen: no harm at all.

5:20 the behavior of clj-http was relevant to me recently because I was ripping a slow API

5:21 most people should be satisfied with it

5:21 ddellacosta: ah, okay

5:21 callen: I was also parallelizing the crap out of it.

5:21 ddellacosta: parallelizing?

5:22 callen: doall partition future map

5:23 ddellacosta: woah

5:23 you know, I have not yet used future once.

5:23 callen: t'was a 50mb dump of raw data from the api.

5:23 ddellacosta: yowsers

5:23 not that big all things considered I guess, but still, big

5:23 callen: I was under a time limit and needed the data snappily.

5:24 big if one considers that it was a SLOWWWW Rails server and relatively small amt of data per transaction

5:24 required optimizing chunking behavior + future dispatch across chunks

5:24 ddellacosta: ah, rails

5:24 callen: nothing too crazy, but it required hand tuning to extract the data quickly.

5:24 ddellacosta: gotcha. I always end up writing wget scripts for that kind of crap

5:24 'cause I'm lazy.

5:25 callen: no caching on the part of the API...sigh.

5:25 ddellacosta: hmm, bummer.

5:25 callen: ddellacosta: required code interaction to generate sequences of 'work'

5:25 wget is wise.

5:26 ddellacosta: callen: 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.

5:26 callen: yeah, related.

5:26 data fiefdom that I was...sidestepping.

5:27 ddellacosta: haha

5:27 gotcha. ;-)

6:24 adamt: Hi. 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?

6:31 Apage43: adamt, what exactly are you trying to accomplish?

6:31 i mean, you could slurp and read-string it

6:32 ,(read-string "(fn foo [a b c])")

6:32 clojurebot: (fn foo [a b c])

6:32 adamt: given a function, i would like to be able to dynamically construct a webform from which the function can be called.

6:33 but 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.

6:33 Apage43: if you're actually being given a function that's defined somewhere (that is, defn'd in a namespace), thereis

6:34 as they all have metadata on the var

6:34 ,(meta #'+)

6:34 clojurebot: {:arglists ([] [x] [x y] [x y & more]), :ns #<Namespace clojure.core>, :name +, :column 1, :added "1.2", ...}

6:34 Apage43: you'd be after :arglists

6:34 adamt: well, it's not defined, i actually use load-file and bind the resulting function, and then i call it.

6:37 Apage43: well if you're okay with the function being placed into the current namespace you can always use a (defn) in that file

6:39 this seems like a pretty weird thing to be doing at any rate

6:40 adamt: I'm considering whether i should reveal why :P

6:41 Apage43: you could also attach metadata to it

6:41 adamt: We 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.

6:41 Apage43: ^{:args '[a b c]} (fn [a b c] ..) in your file

6:41 adamt: i think i'll rather just skip to the functions with first and rest, instead of defining arguments twice.

6:42 Anyways, I'm then toying with the idea of using clojure as a templating-language to construct these json models.

6:43 Apage43: there'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

6:43 http://riemann.io/quickstart.html

6:45 I'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

6:45 adamt: Yeah, something like that. I would still need to extract the arguments to use in the webinterface, for our purpoes though

6:45 Apage43: and then search the namespace (with ns-publics) once you load it

6:45 and grab the :arglists off the metadata of the vars

6:46 adamt: but then i would need to make sure the namespaces are unique

6:47 that 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

6:50 Maybe 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.

6:51 Apage43: nope

6:51 (let [current-ns *ns* new-ns (gensym)] (eval `(do (ns ~new-ns) (load-file "test.txt"))) (in-ns 'current-ns) (ns-publics new-ns))

6:52 ^-- load "test.txt" in a namespace with a generated name, and return a map of the vars in it

6:52 which you can grab the metadata off of

6:52 adamt: would that work if i didn't attach extra metadata to the function?

6:52 Apage43: if the thing in the file is a (defn), not a (fn)

6:53 adamt: okay, thanks. :-)

6:56 Apage43: also lets you put several of them in a single file

7:25 er, i totally messed up the switching back to the namespace you'd been in before bit though

8:53 yawnt: hi

9:16 dissipate_: yawnt, hi

9:25 silasdavis: I 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.

9:26 Do I need to start storing references in my indices or can I use structural sharing somehow to change (mutate?) the underlying shared object

9:26 it 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?

9:29 (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>}}} )

9:37 ckirkendall: cemerick got some time to help someone out with clojurescript.test

9:38 cemerick: ckirkendall: just heading out; maybe send a Q to the ML?

9:38 ckirkendall: will do

10:13 grandy: hello, 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:14 TimMc: I haven't heard of any practical differences.

10:14 grandy: ok that's good

10:14 TimMc: I mean, the thing Android uses has problems, but it's not optimized for Clojure's usage patterns.

10:38 zilti: Where can I find the basic protocols for Clojure (IMap, IAssociative and those)? Are they even there the way the ones are at ClojureScript?

10:41 si14: guys, how can I set up a macro that should be nested into another one to work properly? like "recur" in "loop".

10:43 zilti: si14 can you make an example? Basically you should just place it into the first one the way you place a function.

10:43 si14: moreover, I need to pass some variables from external macro to an internal one.

10:44 zilti: *should just be able to

10:44 Just pass it in as an argument, then

10:45 si14: here is an example: https://github.com/mikera/matrix-api/blob/master/src/main/clojure/clojure/core/matrix/impl/ndarray.clj#L106

10:45 and https://github.com/mikera/matrix-api/blob/master/src/main/clojure/clojure/core/matrix/impl/ndarray_magic.clj

10:45 what's going on there is that I need to generate a few versions of my code, specializing for different types.

10:47 zilti: si14 which macro exactly is the example, and what part of it?

10:47 si14: so 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:47 it worked fine until I decided to throw in a macro.

10:48 zilti: The symbols ending with # get replaced with something else, so you can't rely on that for replacement purposes.

10:49 si14: that 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:49 right now I'm solved this problem with "macroexpand-1", but this stinks IMO

10:50 zilti: it works right now, but I'll replace the symbol.

10:50 zilti: si14 I would've recommended macroexpand as well. The arguments don't get interpreted, that's the whole point of a macro

10:52 si14: zilti: 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:52 so I need something like "let", but for macroexpansion time, I suppose.

10:53 zilti: si14 probably "binding", since that's afaik the only way to "communicate" to nested structures besides argument passing.

10:54 si14: zilti: I'm not sure if it will work for compile time, will it?

10:54 shiranaihito: i'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:54 zilti: si14 It will.

10:55 si14: zilti: OK, thank you.

10:55 zilti: Where can I find the basic protocols for Clojure (IMap, IAssociative

10:55 and those)? Are they even there the way the ones are at ClojureScript?

10:56 shiranaihito: oh, and what kind of stuff does the "/" -accessor work with?

10:56 (besides static Java methods..?)

10:56 zilti: shiranaihito: Stuff in namespaces, and Java fields

10:57 shiranaihito: zilti: ok, cool.. so if i "def" a variable in a namespace, i can access it with ns/var from other files?

10:57 si14: zilti: I've asked about this around a year ago in the mail list, the answer was "in the source code" :)

10:57 zilti: shiranaihito: yes. But you first have to require that namespace of course

10:58 shiranaihito: yeah

10:58 hmm..

10:58 s4muel: ,(clojure.string/join "," [1 2])

10:58 shiranaihito: zilti: how would you arrange what i described above? -having a global variable for a helper class

10:58 clojurebot: "1,2"

10:58 zilti: si14: That's where I looked, but it's not really there... Do you know in which file?

11:00 shiranaihito: 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:00 shiranaihito: zilti: alright, thanks! :)

11:01 zilti: si14 Nevermind, found it!

11:14 shwouchk_: Hello

11:16 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:16 ?

11:18 bja: shwouchk_: 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:19 shwouchk_: 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:20 zilti: shwouchk_: 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:21 shwouchk_: zilti: what about conj!? is it not a function?

11:21 zilti: shwouchk_: Yes it is. Oh I see what you mean

11:24 bja: shwouchk_: 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:27 shwouchk_: bja: I see

11:28 maybe I'm thinking too far ahead

11:31 technomancy: shwouchk_: transients should only be used for optimizing very small portions of code that have been identified as a bottleneck

11:32 typically re-use isn't a priority because transient code is so different from regular code

11:32 while 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:34 shwouchk_: technomancy: I'm not sure I agree with your last statement.

11:35 technomancy: maybe 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:36 the 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:37 shwouchk_: I see

11:38 technomancy: that's also part of why transients are prohibited from crossing thread boundaries

11:40 shwouchk_: technomancy: that much is obvious

11:40 bbloom: also worth noting: you'll get the majority of benefit from transients if you just use the right clojure.core functions

11:41 (doc into) ; for example

11:41 clojurebot: "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."

11:41 shwouchk_: I see.

12:13 ckirkendall: Are there any issues with using loop recur in go blocks. Seems a lot better than (while true ...) (loop [msg (<! ch)] (when msg (recur ..))

12:16 bbloom: ckirkendall: 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:16 ckirkendall: write whatever works best for the particular communication pattern you're trying to encode

12:17 ckirkendall: bbloom: I want to be able close down the event loop when the channel closes.

12:19 bbloom: if you are using (while true ...) and someone closes the channel wont it just chew cpu or am I confused?

12:25 grandy: question: 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:27 anyone please take a stab at an answer, i'm new to clojure and working on a toy app for learning/entertainment

12:27 bbloom: ckirkendall: "goroutines" will be garbage collected if nobody else holds a pointer to any of the channels that the routine is waiting on

12:27 ckirkendall: 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:45 grandy: logging the channel so if anyone has advice please share :)

12:48 callen: technomancy: my new favorite name for Common Lisp uses the term from Hickey's recent talk - Choose-a-phone.

12:48 grandy: you're implementing a REPL?

13:34 tufflax: I'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:34 what could be wrong?

13:35 It works correctly for my friend with the same code

13:37 kmicu: Same code base, but also same workflow and tools versions?

13:49 tufflax: kmicu: yes, I can't think of much that's different

13:49 kmicu: What output do you get from (refresh)?

13:50 tufflax: the correct output, like "refreshing <some namespaces> :ok"

13:50 kmicu: And you have only one nREPL running?

13:51 tufflax: yes

13:52 kmicu: Maybe lein clean, restart OS and try one more time. :]

13:52 Sometimes it helps ;P

13:52 tufflax: yeah I'll try

13:52 thanks

13:53 kmicu: You should also compare project map with your friend.

13:53 tufflax: you mean working directory?

13:54 kmicu: lein pprint prints project map

13:54 tufflax: ok

13:54 I'll do that

13:55 kmicu: I never had any problems with tools.namespace.repl refresh

13:55 And today is always low traffic here.

14:27 tazjin: Hej! 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:28 weavejester: Those are all slightly different questions.

14:28 tazjin: Yes, but I'm asking all of them

14:29 weavejester: SQL injections are typically handled by the SQL library. You avoid string substitution, and instead use the mechanism provided by the library.

14:29 tazjin: The 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:29 weavejester: I believe Korma handles that pretty transparently, however.

14:30 tazjin: I should mention I come from Haskell where we use types to block most attacks stemming from user input

14:30 weavejester: By creating an unsafe or untainted string type, presumably?

14:31 tazjin: By 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:32 But 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:33 hyPiRion: Well, 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:33 weavejester: I 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:33 kmicu: tazjin: why not Haskell web stack then?

14:34 weavejester: I suspect that core.typed could be used for providing safety like that

14:34 tazjin: kmicu: 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:35 kmicu: As weavejester wrote, security is pretty PL agnostic topic.

14:35 aaelony: "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:35 tazjin: weavejester: 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:37 weavejester: tazjin: 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:37 tazjin: However, aside from the type safety, web security is the same in any language.

14:38 tazjin: Basically, 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:38 I use already do *something*

14:38 I'm not sure if I'm phrasing this weirdly, I might be

14:39 weavejester: tazjin: SQL libraries typically protect you so long as you're not substituting the values directly into strings.

14:39 tazjin: 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:40 In general it's a good idea to know the common attack vectors

14:40 As no language will protect you if you don't

14:41 tazjin: Maybe 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:41 As 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:42 I 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:43 weavejester: I guess because it's considered common knowledge. Pretty much all DB libraries, for every language, have some mechanism for quoting variables.

14:44 tazjin: A listing like the one in yesodweb would be useful

14:44 tazjin: That'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:46 weavejester: Yes, but it's not like you can take web security for granted, even with Haskell.

14:47 It would be useful to have a document that tells you how to avoid common security problems in Clojure, though.

14:47 The basic answer is that SQL libraries will sanitize inputs, but everything else is up to you to set up.

14:48 tazjin: True, 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:49 benkay: +1 to that, tazjin

14:49 weavejester: That 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:52 Collecting all that information in one place seems a good plan.

14:52 tazjin: well, a Reddit post is far from being a good knowledge repository but it's a start.

14:54 weavejester: tazjin: Might I suggest adding a page to the Ring wiki?

14:55 tazjin: That's an idea, but first the info needs to be compiled. I'm writing up a small post

14:55 kmicu: That's the spirit!

14:58 si14: my attempts to come up with macro communication failed, so let me just introduce a minimal example: https://gist.github.com/si14/0dadea5bd7f23de47544

14:58 how can I communicate that "important-data" to internal macro?

14:59 weavejester: si14: You could use two bindings, one for compile-time and one for run-time.

14:59 si14: weavejester: how the first one can look?

15:02 weavejester: si14: Hm… the way you have your example set up, the way I was considering might not work.

15:03 si14: weavejester: 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:04 weavejester: si14: I was considering adding an outer binding, unquoted, e.g. (binding […] `(binding […] ~body))

15:04 si14: I believe that was required to fix a similar issue in Hiccup

15:05 qdhfgfgh3gg1: Do skype,yahoo,other chat and social communication prog (facebook&twitter) spy 4 israel&usa???

15:05 Do they record and analyse everything we type on the internet???

15:05 lazybot: qdhfgfgh3gg1: Yes, 100% for sure.

15:05 qdhfgfgh3gg1: Yes, 100% for sure.

15:05 si14: weavejester: AFAIK this requires that an internal macro should be called *from* an external one

15:06 and not from inside of transformed code.

15:06 well... "called". expanded

15:06 benkay: Do things equal other things?

15:07 hyPiRion: benkay: depending on what you define as equality

15:07 weavejester: si14: Yes, that's why on reflection, I decided it probably wouldn't work :)

15:07 benkay: hyPiRion: I want to explore lazybot's evaluation after seeing that bit of spam and lb's response ;)

15:07 hyPiRion: benkay: oh

15:08 It's obviously not about the amount of question marks of the end of the line. Right, lazybot??

15:08 lazybot: hyPiRion: Uh, no. Why would you even ask?

15:09 weavejester: lazybot: Does the CIA have a mind-reading satellite???

15:09 lazybot: weavejester: Yes, 100% for sure.

15:10 benkay: lazybot: were you and i just discussing this???

15:10 lazybot: benkay: How could that be wrong?

15:10 weavejester: lazybot: Do you like three question marks and dislike two question marks??

15:10 lazybot: weavejester: Definitely not.

15:10 benkay: ah, grammar.

15:11 s-h: maybe it's round-robin??

15:11 lazybot: s-h: Definitely not.

15:11 hyPiRion: Maybe people should read the source, just to be sure???

15:11 lazybot: hyPiRion: Oh, absolutely.

15:12 s-h: haha

15:12 weavejester: lazybot: What do you think about four????

15:12 Obviously not a lot :)

15:13 hyPiRion: https://github.com/flatland/lazybot/blob/master/src/lazybot/plugins/yesno.clj

15:13 benkay: this 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:17 dcb: Anyone have an example of how to hook test.generative specs up to leiningen in order to run specs from the command line?

15:19 tazjin: weavejester, kmicu: This is what I intend to post on Reddit. Objections? http://pastebin.com/hxpDhuk6

15:20 weavejester: tazjin: That seems okay. I'd have made it shorter, though.

15:21 kmicu: tazjin: also put this at https://groups.google.com/forum/#!forum/clojure

15:22 tazjin: weavejester: 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:22 kmicu: Length is ok, but put this in mailing list.

15:23 tazjin: kmicu: Will do

15:23 weavejester: Like… "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:23 kmicu: A lot of people don't care about reddit.

15:23 weavejester: Yeah, mailing list would be better.

15:24 tazjin: the mailing list only seems to be slightly more active than Reddit, but I guess it's better to have it on both!

15:24 Brand0: So that person is looking for a library that will fix all of his/her web security problems?

15:26 weavejester: tazjin: A quick look over both reveals that the mailing list has a lot more posts and replies than reddit.

15:26 kmicu: And a better quality discussions.

15:31 xeqi: theres also clojure-sec for discussion of interested parties, though thats not web specific

15:31 si14: solving SQL injections, OMG

15:31 callen: SQL injections were a solved problem for a long time.

15:31 The only real problem was that bad languages run by bad people who write bad code were propagating bad practices.

15:32 Brand0: the easiest way to fix your security problems is to not write any code. No code, no bug.

15:32 si14: I mean, really, "libraries for solving SQL injections"

15:32 * si14 why don't we have one?!

15:33 weavejester: si14: What do you mean?

15:33 xeqi: si14: sarcasm?

15:33 tazjin: si14: 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:34 weavejester: To my mind it's less SQL injection, and more things like CSRF.

15:34 tazjin: Brand0: 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:34 weavejester: It wouldn't be a bad idea to have a document discussing basic web security from a Clojure perspective.

15:34 si14: xeqi: sort of.

15:34 tazjin: I've posted to the mailing list btw, but it said the post has to be approved first.

15:35 xeqi: tazjin: yep, first posts are moderated

15:35 weavejester: First posts have to be approved, but it's pretty quick, in my experience.

15:35 It's to cut down on spam.

15:36 Brand0: tazjin, sorry I didn't know you posted a link. I don't really understand you mean by "compile all the knowledge" either

15:36 si14: tazjin: it's solved by being aware of SQL injections at first place. Parameterized queries also don't hurt

15:36 neither have anything with Clojure.

15:36 Brand0: There's so much information on the web about web vulns tht it's not even funny

15:38 tazjin: Brand0: 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:39 kmicu: Kill haters with fire or with above statement.

15:40 weavejester: Well, you can search for the equivalents. e.g. Google "ring csrf"

15:41 A single document would be helpful

15:41 kmicu: Indeed.

15:41 weavejester: But it would be more for people who perhaps have less experience with web security.

15:42 Sorella: tazjin, you solve SQL injection by not using Strings to represent SQL queries.

15:42 tazjin: kmicu: I'd prefer just not having haters, there's no need for that in a mature community! :)

15:42 Sorella: tazjin, (shell injection and other "injections" likewise)

15:42 tazjin: Sorella: I'm not doing that, don't worry!

15:43 weavejester: More documentation is rarely a bad thing :)

15:43 kmicu: That's the point.

15:43 xeqi: until it goes out of date

15:43 weavejester: Well, true

15:43 kmicu: That's another point :)

15:43 weavejester: There's still some information on Wikibooks they won't let me remove.

15:45 technomancy: and comments on the dev.clojure.org wiki; ugh

15:45 callen: technomancy: hrm?

15:45 weavejester: have any opinions on Clojure core development?

15:46 weavejester: callen: Not really… why do you ask?

15:47 technomancy: callen: "Getting started with emacs" on dev.clojure.org has a bunch of junk comments about swank-clojure that only apply to old revisions

15:47 and I don't have privs t oremove them

15:47 * callen bashfully digs toe into ground, "no reeeasssonnnn"

15:47 technomancy: "for hysterical raisins."

15:47 callen: technomancy: 'tis a place of the dead.

15:47 hyPiRion: Since Alex Miller came aboard and started working on issues, I am looking at it more optimistically. Hopefully they'll have a higher throughput

15:47 callen: hyPiRion: klish and I are double-teaming him :P

15:47 amacdougall: Anyone 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:48 technomancy: "...and my axe!"?

15:48 futile: so, i dunno why Swing gets so much crap. its just as good/bad as Cocoa. its a fine GUi toolkit.

15:49 amacdougall: I can debug it further, but maybe someone already has it working and can point at something dumb I'm doing. :)

15:50 xeqi: tazjin: I saw you got several answers to your security queries earlier. Do you have any more question not related to library/feature discovery?

15:50 tazjin: futile: 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:50 callen: futile: have you interacted with Swing from Java?

15:51 and yeah, what tazjin said too.

15:51 futile: tazjin: 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:51 tazjin: xeqi: 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:52 futile: callen: if thats bad, its only a complaint against java, not swing.

15:52 callen: futile: seesaw is doing a lot of cleanup for you.

15:52 futile: callen: so far swing in clojure isnt that bad

15:52 callen: seesaw looks neat.

15:53 tazjin: futile: 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:53 futile: but im always hesitant of third-party abstractions on top of other abstractions.

15:53 tazjin: no, its fine for anyone. because it looks awesome.

15:53 :P

15:53 xeqi: futile: 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:53 futile: xeqi: yep

15:54 xeqi: im not gonna say its 0-lines-of-code or anything, sure its a bit of work. but so is any quality app.

15:55 its 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:56 then again, .setSize seems to be having no effect... *grumble*

15:57 Any ideas why this text field wouldn't be set to 300,200? https://www.refheap.com/18206

15:59 Brand0: tazjin, you should start something like that ... it actually sounds like it would be useful

16:00 you could model it after that github for clojure style & best practices

16:00 tazjin: Brand0: 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:00 Brand0: tazjin, link?

16:00 fkey: How do i make this a valid statement? "(.b (reify Object (a [this]) (b [this statement] (. this ((first statement) (rest statement))))) '(a))"

16:01 tazjin: Brand0: 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:01 fkey: I am receiving "#<TypeError: this$.first is not a function> at line 174"

16:01 xeqi: futile: perhaps you want .setPreferredSize

16:01 Brand0: tazjin, oh, I thought you already started a repo

16:01 xeqi: also, do you want to set DISPOSE_ON_CLOSE for that JFrame?

16:01 futile: xeqi: ah, good idea. Thought that was only necessary when you had a layout manager, but maybe it's implicitly using one.

16:02 tazjin: Brand0: Hah no, I only started this about 30 minutes ago. Give it some time! :)

16:02 fkey: Given a quoted list, the 1st element is the name of function to execute and rest are the argumetns

16:02 callen: http://okmij.org/ftp/Computation/IO-monad-history.html

16:03 Brand0: gonad history

16:05 fkey: "(.b (reify Object (a [this]) (b [this statement] (. this (a (rest statement))))) '(a))" works fine :|

16:06 is it something to do with resolving function calls at compile time with objects?

16:06 i am using clojurescript btw

16:06 &(.b (reify Object (a [this]) (b [this statement] (. this ((first statement) (rest statement))))) '(a))

16:06 lazybot: java.lang.IllegalArgumentException: Can't define method not in interfaces: a

16:07 fkey: (.b (reify Object (a [this]) (b [this statement] (. this (a (rest statement))))) '(a))

16:07 oops

16:07 &(.b (reify Object (a [this]) (b [this statement] (. this (a (rest statement))))) '(a))

16:07 lazybot: java.lang.IllegalArgumentException: Can't define method not in interfaces: a

16:14 xeqi: yogthos|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:38 dnolen: fkey: you just have a simple error, what output are you expecting

16:38 ?

16:43 fkey: dnolen: sorry about that! basically i am trying to call a method of an object given it's name

16:44 dnolen: fkey: what is the expected result? your method implementation doesn't make sense

16:44 (.a (reify Object (a [this] :foo)))

16:45 fkey: ^ if you just want to understand how to write it properly

16:45 fkey: dnolen: im using clojurescript. i am just expecting that the function "a" to be called by "b" , when "b" is passed the argument '(a)

16:45 dnolen: in this case, just expecting "nil"

16:46 dnolen: fkey: seems like you figured it out, the last version works

16:47 fkey: dnolen: really? ='( i'm using clojrescript.net, must not be updated or something

16:47 dnolen: oh, you mean last command i gave?

16:47 dnolen: fkey: yes

16:47 fkey: it works

16:48 fkey: dnolen: oh, yeah i expected that one to work.. heres the issue though

16:48 (.b (reify Object (a [this]) (b [this statement] (. this ((first statement) (rest statement))))) '(a))

16:48 thats the key, replacing the hard coded 'a' with (first statement)

16:49 this is what i am trying to achieve, which does not work

16:49 dnolen: fkey: yes that's impossible

16:50 fkey: you simple cannot dynamically call methods like that from symbols in ClojureScript

16:51 s/simple/simply

16:52 fkey: dnolen: 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:52 so mabey the name spacing is the best shot to go for then

16:52 dnolen: fkey: yep impossible. what the hashmap bug?

16:54 fkey: dnolen: i think you reported it for me? it was something like (def foo { :a (fn [] ) :b (fn[] ((:a foo))

16:54 dnolen: someone said it had to do with something with compiling

16:54 late time evulation should occur but it wasn't

16:54 dnolen: fkey: oh right, I will say putting functions in maps like that isn't really idiomatic, but that should work.

16:55 fkey: not a bug with hashmaps, a bug in the compiler really

16:55 fkey: nothing to do w/ latetime evalution, it's just flat out compiler bug

16:55 fkey: dnolen: 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:55 dnolen: so i think namespaces could work in this scenario

16:59 dnolen: to spare me some grief, would that idea work?

17:00 dnolen: fkey: I'm not sure what you are trying to do. but sure exporting some functions from a namespace is one way.

17:03 zeroem: anyone familiar with using clojurescript & core.async targeting nodejs?

17:03 getting an oddball error and Dr. Google isn't helping

17:06 fkey: dnolen: alright..another question now; (ns test) (defn foo []) ((symbol "test/foo")) gives "#<Error: Invalid arity: 1> at line 1"

17:06 should that work?

17:06 dnolen: fkey: it is impossible to call functions like as well

17:07 fkey: in Clojure on the JVM this all requires var hackery, and ClojureScript doesn't have vars

17:08 fkey: dnolen: hm, so what would be another alternative?

17:08 dnolen: can i do something like ((symbol "someFunctionPrefix-nameOfFunction)) ?

17:09 dnolen: fkey: 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:09 fkey: ah nope

17:09 dnolen: fkey: (defn foo-maker [] {:a (fn []) :b (fn [x y])}) (def foo (foo-maker))

17:10 fkey: I'll look into the bug when I get a chance but this is the workaround

17:14 squidz: does anybody know if core.typed works as well/at all with clojurescript?

17:15 fkey: dnolen: 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:17 glosoli: Hmm in Emacs nREPL package, is there some way to turn on syntax colouring in REPL buffer ?

17:18 fkey: (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:19 ie, function Class () {}; Class.prototype.foo = function(funcName, args) { this.call(funcName, args); }

17:19 something of that sort..not sure how to achieve that in clojure though

17:19 *clojurescript

17:19 dnolen: either way, thanks for helping me out

17:21 zeroem: sorry, took ridiculously longer to generate the error again, behold my woes:

17:21 https://gist.github.com/zeroem/939939874537e81bb9be

17:21 fkey: function Class () {}; Class.prototype.foo = function(funcName, args) { this[funcName](args); } would work to in my scenario

17:27 cjfrisz: Is it a known problem that circular dependencies in ClojureScript cause a stack overflow error from the compiler and give no helpful error message?

17:33 fkey: dnolen: found workaround

17:33 (.b (reify Object (a [_] :worked) (b [_] ((aget _ "a") ) )))

17:33 &(.b (reify Object (a [_] :worked) (b [_] ((aget _ "a") ) )))

17:33 lazybot: java.lang.IllegalArgumentException: Can't define method not in interfaces: a

17:34 fkey: bah, needs to run in cljs to work

17:34 zeroem: oh, huh. I guess there's no >!! and <!! in cljs

17:34 derp

17:40 Denommus: anyone working with Clojure on Android? My application can't find my R class

17:43 fkey: hmm, now is there a way to call "apply" or "call"?

17:45 bbloom: fkey: have you tried (find-doc "apply") ?

17:45 Denommus: the 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:46 fkey: bboom: i have not, im on clojurescript.net

17:46 bbloom: cjfrisz: it really might not be known, since who makes circular dependencies anyway? :-P

17:46 cjfrisz: 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:47 cjfrisz: bbloom: ah, jira, my old friend…

17:47 I knew I should look there, but I tried to weasel my way out of it

17:47 bbloom: cjfrisz: don't get me started, it will cost me precious social capital… heh

17:48 fkey: hm, ill look but this seemed to work

17:48 (.b (reify Object (a [_] :worked) (b [_] (aget (aget _ "a") "call" ) )))

17:48 cjfrisz: bbloom: hmm…looks like dnolen closed that bug on 27 July

17:49 bbloom: fkey: 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:49 fkey: dnolen would know better than me

17:51 Denommus: is there a specific channel for clojure in android?

17:59 rhg135: hello, 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:02 amalloy: (take-while identity (iterate zip/right (zip/down loc))) seems like the right direction, dunno if it's exactly right

18:04 Denommus: is there a way of showing all the Java classes of a package?

18:05 rhg135: thx amalloy

18:14 Denommus: well, it seems I did it

18:19 rhg135: how?

18:19 clojurebot: with style and grace

18:19 gdev: why?

18:19 clojurebot: why is Why

18:19 gdev: when?

18:20 rhg135: heh

18:57 rurumate: How 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:00 hyPiRion: Not sure if cljs has it, but replacing `the-fun` with `(cond-> convert js->clj)` works in Clojure

19:01 rurumate: hyPiRion: ok but can we rid of the let?

19:01 hyPiRion: sure

19:01 ,(-> 2 (* 3) (cond-> (= 1 2) inc) (* 2))

19:01 clojurebot: 12

19:01 hyPiRion: ,(-> 2 (* 3) (cond-> (= 1 1) inc) (* 2))

19:01 clojurebot: 14

19:02 rurumate: what

19:04 futile: wat

19:04 hyPiRion: rurumate: read up on the docs on how cond-> works, it's not that much magic

19:04 futile: I'm excited about this new project :)

19:05 hyPiRion: ,[(cond-> 1 true inc) (cond-> 1 false inc)]

19:05 clojurebot: [2 1]

19:05 * rurumate grok

19:06 futile: Is grok now an exclamation?

19:06 rurumate: but umm will it actually work

19:07 (= 1 1) seems like known at compile time

19:07 contains no free variables...

19:09 hyPiRion: rurumate: why does that matter?

19:09 rurumate: not sure.. about to test this code

19:12 (defn make-even [n] (-> n (cond-> (if even? n identity inc)))

19:12 ,(defn make-even [n] (-> n (cond-> (if even? n identity inc)))

19:12 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

19:12 rurumate: oh noes

19:12 ,(defn make-even [n] (-> n (cond-> (if even? n identity inc))))

19:12 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

19:12 hyPiRion: that's not how it works

19:13 rurumate: ,((fn make-even [n] (-> n (cond-> (if even? n identity inc)))) 1)

19:13 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>

19:13 rurumate: whopee

19:13 ,((fn [n] (-> n (cond-> (if even? n identity inc)))) 1)

19:13 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>

19:13 rurumate: unmm

19:13 hyPiRion: sir, (cond-> x y z) is the same as (if y (z x) x)

19:14 rurumate: ,((fn [n] (-> n (cond-> (if even? identity inc)))) 1)

19:14 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>

19:14 rurumate: ,((fn [n] (-> n (cond-> even? identity inc))) 1)

19:14 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>

19:14 rurumate: ouch

19:14 hyPiRion: rurumate: there's no else clause in cond->

19:15 ,(cond-> 1 true (* 2) true (+ 6))

19:15 clojurebot: 8

19:15 rurumate: ,((fn [n] (-> n (cond-> #(even? % identity inc))) 1)

19:15 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

19:15 hyPiRion: ,(cond-> 1 false (* 2) true (+ 6))

19:15 clojurebot: 7

19:16 hyPiRion: rurumate: what are you trying to do? return 1+n if n is odd, and n if n is even?

19:16 rurumate: aye

19:17 hyPiRion: cond-> doesn't take expressions, it takes values. So it's not possible to refer to the value in a test clause

19:18 (it does take expression for the calculation part though)

19:18 rurumate: hyPiRion: but that's what I was trying to do!

19:19 I want to decide at runtime what function to use, not at compile time..

19:19 hyPiRion: rurumate: so you want to do either this, OR that?

19:19 as an if?

19:20 I'd guess you can use as-> for that, but read up on them and play around with them

19:21 rurumate: hyPiRion: if-else is enough..

19:21 hyPiRion: ,(cond-> 10 (* 2) (+ 1) (as-> x (if (even? x) x (inc x))))

19:21 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>

19:22 hyPiRion: why did I use cond-> there

19:22 ,(-> 10 (* 2) (+ 1) (as-> x (if (even? x) x (inc x))))

19:22 clojurebot: 22

19:22 hyPiRion: ,(-> 10 (* 2) (as-> x (if (even? x) x (inc x))))

19:22 clojurebot: 20

19:31 rurumate: ,((fn [n] (-> n ((if (even? n) identity inc)))) 3)

19:32 clojurebot: 4

19:32 rurumate: finally.. just needed another pair of parens

19:42 Denommus: ... using clojure in android seems to be too much of a complicated task

19:45 grandy: callen: actually not a full repl for clojure but a sort of command line UX for a gui app

19:52 looking 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:02 xeqi: grandy: that sounds like seesaw + create a jframe with a JTextField and attach a change event listener

20:08 Denommus: ...

20:10 I can't get my current activity, for some weird reason

20:12 xeqi: Denommus: 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:12 Denommus: thanks

20:15 mmoriarity: hey 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:17 xeqi: mmoriarity: how are you running the two versions?

20:19 futile: Adverbs are overrated.

20:19 mmoriarity: 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 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:19 futile: "To copy, simply drag the file to the destination."

20:19 mmoriarity: the former truncates prematurely, the latter works correctly

20:20 futile: "It effectively transforms the instance into the proper base class"

20:20 mmoriarity: oh crap, those are the same, one sec

20:20 this 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:21 hyPiRion: mmoriarity: What happens if you uberjar it?

20:21 mmoriarity: same problem

20:22 i was originally uberjaring it, but then i wanted to isolate the problem

20:23 adding clojure.main -m consistently makes it work, but i presume that's not running my compiled class then

20:23 but rather the .clj

20:24 guns: mmoriarity: Sounds like the main thread is exiting before your print is complete

20:25 xeqi: or something going on with *print-lenght*

20:26 guns: If you're doing your printing in a separate thread, make sure you wait on it before exit

20:26 mmoriarity: i'm not doing it on a separate thread, i'll paste the main function

20:27 xeqi: `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:27 gfredericks: ,(->> 2 (rand-int) (fn []) (repeatedly 5))

20:27 clojurebot: (1 0 1 0 0)

20:27 mmoriarity: http://pastebin.com/tA4msr9s is my main function

20:28 and it was doing this before i added shutdown-agents

20:30 xeqi: mmoriarity: are you getting ... at the end of your output?

20:31 mmoriarity: nope

20:31 just chops off mid-word

20:33 xeqi: mmoriarity: can you try adding (flush) after the (json/pprint ...) ?

20:34 mmoriarity: i'll give it a shot

20:35 xeqi: that did it! thanks for your help

20:36 xeqi: hmm, that sounds like its http://dev.clojure.org/jira/browse/CLJ-987

20:36 which is marked fixed

20:36 for 1.5

20:37 mmoriarity: perhaps data.json is doing something different

20:44 xeqi: ah! json/pprint delegates to pprint/write which doesn't have a flush or prn in it like pprint/pprint

20:45 mmoriarity: well there we go! does that mean clojure.main is doing some extra flushing?

20:46 callen: cute.

20:46 xeqi: nice sleuthing.

20:46 xeqi: mmoriarity: yep https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj#L444

20:46 coventry: clojure.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:47 mmoriarity: xeqi: thanks for helping figure that out :)

20:50 amalloy: coventry: (defmacro m [] 10) (macroexpand-all '(let [m #(+ 1 2)] (m)))

20:50 but i don't know why you'd use walk2; clojure.tools.macro does a much better job

20:55 coventry: amalloy: 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:56 amalloy: it's close but not perfect

20:56 i can't really remember the edge cases at the moment though

21:00 coventry: Thanks. Sounds like a hairy problem.

21:05 "clojure.tools.macro/mexpand does not correctly deal with macros that use &env" according to http://sgeo.tumblr.com/post/37646341234/clojure-macroexpansion

21:07 bbloom: in my experience, all non-standard macroexpanders are all broken in some subtle ways

21:07 Sgeo: There's a standard macroexpander?

21:07 bbloom: Sgeo: yeah, it's in compiler.java

21:08 coventry: Sgeo's recommendation of jvm.tools.analyzer sounds promising. I think it just gets the answer straight from the compiler.

22:11 ddellacosta: browserchannel vs. web sockets + IE8/9 shim? Thinking of using clj-browserchannel for pubsub/notifications setup.

22:12 + core.async

22:22 callen: ddellacosta: 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:23 ddellacosta: my preferred path is websockets + client sniff blacklist + IE shim.

22:23 ddellacosta: callen: client sniff blacklist = "you are bad no web sockets for you?"

22:23 callen: ddellacosta: yeah, to cherrypick the ones that have ancient websocket versions and shoo them to a page telling them to stop being scumbags.

22:23 ddellacosta: callen: if you had to support IE8/9 and were writing this all in CLJS, would you still take that approach?

22:23 callen: if 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:24 ddellacosta: WS:// + IE shim is what I'd probably do in your case, again, unless there's an extreme imperative for reliability.

22:24 ddellacosta: callen: 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:24 hmm, will have to think about that.

22:25 callen: okay, that's helpful, thanks for the advice!

22:25 callen: ddellacosta: 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:25 ddellacosta: browserchannel has a lot of that "try, try, try again" type stuff baked in and battle-tested already.

22:25 I'm not aware of any libraries that do that for WS://

22:26 ddellacosta: callen: that's good to know and think about.

22:26 * ddellacosta goes to dig into clj-browserchannel's code

22:27 callen: ddellacosta: that "uh oh, we lost the connection!" thing in gmail? BrowserChannel.

22:27 ddellacosta: callen: ah, cool. Yeah, I like the "feel" of gmail, and basically maps onto the kind of user experience we want to have

22:28 callen: ddellacosta: well thing is, you can do the same with websockets.

22:28 it's just, again, I'm not aware of any battle-hardened libraries for it.

22:29 ddellacosta: callen: 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:29 especially if we can swap it out at some point, when we feel more comfortable w/websockets as a general technology

22:29 korny: Anyone have thoughts on how to fake a Java object with a private constructor (for testing)

22:30 we are currently defining a protocol and a type that look the same as the object, but it's pretty verbose

22:31 the code under test has no type hints, so anything that implements (.getFoo %) and (.getBar %) and (.getFoo #(.getAttrs %)) will do

22:31 callen: ddellacosta: seems sound.

22:31 ddellacosta: callen: thanks again for the advice.

22:32 callen: ddellacosta: 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:32 ddellacosta: heh

22:33 korny: we can't use proxy (as no interface exists) nor reify (as we can't call a constructor) :(

22:33 ddellacosta: on 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:33 POJO that is

22:33 callen: korny: huh.

22:33 korny: Is there a simple way to make a POJO?

22:33 ddellacosta: er, I meant like in Java. :-/

22:33 korny: without making a protocol

22:33 callen: korny: are you sure you can't wallhack the private constructor?

22:33 korny: eeuw :)

22:33 callen: don't eww at me.

22:33 korny: that was in response to "in Java" :)

22:34 ddellacosta: what does "wallhack" mean? I've never heard that before.

22:34 oh, haha

22:34 callen: ddellacosta: it's an actual fn.

22:34 ddellacosta: you can eww at me.

22:34 huh

22:34 callen: korny: wallhack the private constructor and reify.

22:34 korny: wall hack - vaguely think I remember that, my java is rusty

22:34 callen: korny: wallhack is Clojure

22:35 korny: cool

22:35 callen: I use a similar trick to bypass peoples' obnoxious "(defn-"s.

22:35 ddellacosta: https://github.com/arohner/clj-wallhack ?

22:35 callen: ddellacosta: yeah, it used to be contrib.

22:36 korny: ah, found it. We could use that - sadly the actual constructor is horrible, so doesn't help hugely.

22:36 ddellacosta: gotcha. Well, every day I learn something new.

22:36 callen: korny: you want to construct the object, but you don't want to call the constructor?

22:36 korny: I want to fake the object so I can pass it to tests

22:36 The real object is SFTP attributes

22:37 callen: faking is tricky, since a custom class wouldn't be identical to what their tests expect

22:37 korny: … which are built from binary flags returned from an SFTP server

22:37 futile: So, anyone else noticed that you can become an expert at anything a lot quicker these days by just searching StackOverflow?

22:37 bbloom: korny: if you need to do some funky java thing, why not just write a small amount of actual java?

22:37 technomancy: callen: you use wall-hack for clojure-private?

22:37 callen: futile: that's not how you become an expert, it just makes it easier to pull up resources.

22:37 futile: It's like google on steroids for finding out about things.

22:37 callen: technomancy: no, I was speaking to the pattern of sidestepping.

22:37 ddellacosta: bbloom: I suggested that and got eew-ed at

22:37 korny: bbloom: yeah, that might be necessary. It's a pity as we really just want a fake JavaBean(™) for a test

22:37 technomancy: oh, ok

22:37 futile: callen: the "a lot quicker" part was caused by stackoverflow

22:38 ddellacosta: korny: hmm, what about rather than that, using some java mock libs via Clojure then?

22:38 * futile punches ambiguity

22:38 * ddellacosta says in a handwavey way

22:38 bbloom: ddellacosta: korny: writing java sucks, but it sucks a lot less than extremely complicated contrortions to write java in clojure

22:38 ddellacosta: bbloom: definitely agreed

22:39 futile: bbloom: what?

22:39 bbloom: I'm using Swing directly in Clojure and it's perfectly fine.

22:39 bbloom: futile: you're writing clojure in clojure :-P

22:39 korny: we have a working solution in about 20 lines of clojure, it's just ugly as it's 2 protocols and 2 types :(

22:39 futile: bbloom: ok

22:40 bbloom: futile: 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:40 futile: just for some examples…. you should write java

22:40 sadly....

22:40 futile: bbloom: does that apply only to writing java, or also to interop'ing with java that already does this?

22:41 korny: bbloom: definitely - we were trying to write Hamcrest matchers in clojure, had to build a Java interface first

22:41 futile: bbloom: my plan is to use Clojure and only do Java interop when necessary but avoid writing .java files

22:41 bbloom: futile: yeah, that's everybody's plan, but some libraries would just be a bitch to use from clojure.

22:41 futile: bbloom: any in partciular?

22:42 * futile is subclassing DocumentFilter

22:42 bbloom: futile: *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:42 futile: bbloom: yay

22:44 korny: futile: 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:45 TEttinger: korny, yeah. Clojure-Java is definitely better when clojure's calling the shots

22:46 futile: Seems like we could use a nice language to bridge Clojure to Java.

22:46 korny: futile: for example, making Hamcrest matchers means something like "class IsEqual<T> extends BaseMatcher<T>" … way beyond what hen-class can cope with

22:46 futile: Maybe we can call it Clojava

22:46 korny: gen-class

22:47 not sure why colloquy corrected that to "hen-class" :)

22:47 TEttinger: futile: 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:47 korny: I quite liked how Groovy does it - optional typing, copes with generics.

22:48 anyway, thanks y'all for help, time for lunch

22:48 * korny should IRC more

22:48 xeqi: korny: isn't that (:genclass :extends BaseMatcher) due to type erasure?

22:48 futile: korny: check out limechat, best ird client ive ever used

22:48 *irc

22:49 korny: xequ: doesn't seem to work, doesn't produce a class that Java likes

22:49 TEttinger: I wonder how hard it would be to make an idiomatic clojure-over-java wrapper generator for java libraries.

22:49 like using clojure maps rather than HashMaps

22:51 johnmn3: not sure what happened.... cljisbuild is just hanging, saying it is compiling to the js file... but never finishes

22:52 bbloom: johnmn3: have you tried a clean? and have you also tried increasing the memory given to the JVM? are you using advanced mode compiling?

22:53 johnmn3: I brought it down to just whitespace. I'll try cleaning again. Haven't had mem issues before.

22:54 alexbaranosky_: does anyone know of any good library for creating uniform and normal distributions of moments in time between T1 and T2?

22:54 johnmn3: nothing will break if I delete the target/ and out/ dirs, right?

22:54 bbloom: johnmn3: should be fine

22:55 johnmn3: bbloom: k

22:55 xeqi: johnmn3: auto or once ?

22:55 johnmn3: xeqi: once... but both

22:57 futile: Is there a common user-error that would cause my (proxy) method to not get called?

22:59 johnmn3: It'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:59 clojurebot: Huh?

23:05 xeqi: futile: not calling it, calling a method of the same name but different types

23:06 futile: aha! Do you have to ensure the types are the same?

23:07 I 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:08 xeqi: futile: I believe so

23:08 futile: Been stuck on trying to make a custom DocumentFilter for a few minutes here, losing the battle.

23:23 Woo solved.

23:27 cgag: what was wrong

23:39 johnmn3: sorry, got disconnected. Not sure if anyone got this: https://www.refheap.com/18222

23:42 cgag: johnmn3: did that fix your problem? or this is to help people diagnose it?

23:42 johnmn3: cgag: nope, just posting up what I had... still not working.

23:42 I mean, cljsbuild should never take 10 minutes right?

23:43 I haven't tried walking away for 30 minutes to see if that does it...

23:43 cgag: i'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:44 have you ever had it compile successfully?

23:45 futile: cgag: 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:49 johnmn3: cgag: yea, it was compiling fine, last time was messing with it a few weeks ago.

23:55 hmm. another project isn't compiling either... trying with a fresh project

Logging service provided by n01se.net