#clojure logs

2013-09-19

00:03akurilinHas anybody tried setting transaction isolation level in clojure.jdbc? Am I correctly seeing that there's currently no way to?
00:05akurilincallen, I know I mentioned that already, but I have to reiterate that blackwater is absolutely priceless when mocking db interfaces for testing.
00:06akurilincallen, some of those calls are tricky to spot without intentionally disabling the db or nuking the schema, which obviously breaks integration tests.
00:26chordno one is here
00:30nopromptchord: i'm here.
00:30nopromptchord: heh, from the look of it there are lots of people here.
00:30callenakurilin: I'm glad it's been so useful to you. I know I hate not being able to see wtf is going on :)
00:30coventryDoes (fn eager-map [& colls] (doall (apply map colls))) exist?
00:30nopromptchord: maybe you meant, "no one is chatting?"
00:30callenakurilin: I'm 99% certain you use it more than I do because I've been doing so much datomic stuff lately, haha. :)
00:31callenmaybe I should add datomic support?
00:32chordlets start the starcraft clone in clojure project
00:32coventryI prefer thermonuclear war.
00:32callenI prefer troll hunting.
00:32nopromptchord: lol okay!
00:33nopromptcallen: is chord a troll?
00:33chordcallen why are you so against starcraft
00:33nopromptchord: are you a troll?
00:33chordno
00:33nopromptchord: yeah, sorry man, it's hard to know these days. sometimes you gotta ask the hard questions, ya know?
00:34callenchord: I'm not, I'm all for displacing the evil Blizzard Empire.
00:34tbaldridgecallen: yeah he is, he gets on here every few nights and babbles about Erlang or Haskel, or CL trying to convince people Clojure is sub-par in one day or another
00:34tbaldridge*in one way or another
00:34callentbaldridge: you don't have to tell me, I'm the one that pasted the screenshot of him accusing me of incest in /query
00:34brehauttbaldridge: wrong address?
00:34nopromptthat's so lol
00:34callentbaldridge: I'm starting to think he's the loper-os guy.
00:35nopromptcallen: i don't think that would make sense.
00:35callentbaldridge: also I liked your article on __call__ and IFn. :)
00:35nopromptcallen: then why don't you marry it?
00:35noprompt:-{P)
00:36chordso then lets start making the starcraft clone, I already made a concession and said that using clojure instead of haskell is ok
00:36callennoprompt: do you write any Clojure that touches a database?
00:36coventryI suppose the fact that I want eager-map so bad reflects how ridden with side-effects this code is. Hmm.
00:36nopromptcallen: sure.
00:36callencoventry: (doall ...) ALL THE THINGS
00:36callennoprompt: which library do you use?
00:37nopromptcallen: umm i've used monger for MongoDB, neocons for Neo4J, and Korma for SQL.
00:37brehautcoventry, callen: or doseq!
00:37callennoprompt: Korma/JDBC - https://github.com/bitemyapp/blackwater/
00:38callennoprompt: do you find yourself wanting something similar with monger or no?
00:38nopromptcallen: you mean timing queries?
00:38nopromptloggin them?
00:38callennoprompt: it's just dev mode logging, the timing is icing on top.
00:38coventryeager-map seems better than doseq in these cases. It's just a function being called on every collection element.
00:38callenso you can quickly see if a slow query is coming through.
00:39nopromptcallen: not really. i just usually interact with the repl mostly and assume the lib i'm using is doing the right thing.
00:39nopromptsometimes i might be interested, but i'm not an sql expert.
00:39nopromptif shit gets weird, slow, buggy, etc. then i look at the code and start digging around.
00:40callennoprompt: yes keep going?
00:40callendevn: hi!
00:40devnhowdy
00:40callendevn: I finally wrote a library somebody other than myself uses. lol.
00:40callenI almost got Raynes to use bulwark, but he was lazy about integrating it. :)
00:40brehautcallen: i did that once. im very sorry to all those people
00:40devndude, i managed to keep a post about rich's talks for the last 5 years on the front page of HN for 24 hours
00:40nopromptcallen: but i should reword all of that as, "i wouldn't mind having this feature"
00:40callendevn: how have your programming perambulations been?
00:41callendevn: oh that was you?!
00:41devnmoving slowly, ebbing and flowing
00:41devnyeah, i just started writing for the changelog
00:41callendevn: that was a fantastic post. I used it to spread the good word to coworkers.
00:41brehautdevn: are ypu a githuber mow?
00:41devnmy first post got them more play on HN than many moons before it
00:41devnnah
00:42nopromptcallen: i mean you give a shit right? and by extension i do, now that you've shown me this.
00:42callenone thing I have to avoid with Rich Hickey is the tech industry interviews. They're usually kinda bad.
00:42devn*shrug*
00:42devnthey're different
00:42devnthey're for a different audience
00:42nopromptcallen: no kidding.
00:42callennoprompt: hum. not sure what you mean.
00:42devnknowing the audience is half the battle
00:42callendevn: Hickey's *talks* are generally considered easy mode. I don't know what his interviews should be classified under.
00:42nopromptdid anyone see the interview with ryan dahl at the nodejs summit or something.
00:42nopromptgod it was halarious.
00:43callenno, link?
00:43devncallen: they tend to be pretty jammed with information
00:43nopromptit was set up like a pre-game show or something. weird.
00:43devnnoprompt: no
00:43callenI actually think hickey's talks are sparse. Valuable! but sparse.
00:43devnthat's why they're good
00:43devnthere was a comment on HN to that effect
00:43noprompthttp://www.youtube.com/watch?v=Fc26auhSLqM
00:44devnsome people don't get the synergy between philosophy and pragmatism
00:44callenwell I think it's because the value of Hickey's talks is in making certain the point is hammered home. I think that's far more valuable than Simon Peyton-Jones babbling about GHC inside baseball.
00:44callennoprompt: didn't Dahl rage-quit Node.js dev?
00:44devnit's all about the "why" to me
00:44devntoo many talks without enough "why"
00:44nopromptcallen: i dunno, i think he still commits.
00:45devnrich always brings the why, is excruciating detail
00:45callennoprompt: he had a rather public hissy fit.
00:45devns/is/in/*
00:45nopromptcallen: i think he rage-quit twitter.
00:45callendevn: and that's the part that's really missing with my coworkers, anecdotally.
00:45callendevn: many of them are "aware" of things like immutability, Scala, Clojure, Datomic, etc
00:45callenbut many haven't really had the epiphany yet.
00:45callenHickey's talks are a vehicle to the epiphany.
00:45devncallen: i share this with everyone i can:
00:45devnyou cant be told your favorite band
00:46nopromptchord: so what's up buddy? we doing starcraft or what?
00:46devnone finds it on his/her own
00:46callendevn: I tend to think of programming in more engineering-centric terms :)
00:46devnthe journey is what makes the discovery feel personal and rel
00:46devnreal
00:46noprompteww that video is so gross.
00:46callennot because I think we should regard ourselves as proper engineers, but because I think that's the rigor we should strive for.
00:46chordnoprompt so you know how to make starcraft with clojure?
00:46nopromptthe guy talks about nodejs like it's a stock or something.
00:47devncallen: you're fooling yourself a bit then
00:47noprompt"great growth there"
00:47callendevn: I know there's other things thrown in.
00:47callendevn: but the personal expression is there, the rigor is not.
00:47nopromptchord: what? no. i thought you were the hot shit programmer with all the plans.
00:47devnwithout expression, rigor is meaningless
00:47chordnoprompt: hey i already said I made the concession of not using haskell and using clojure instead, its your job to be the clojure hot shit expert not mine since i use haskell
00:47callennoprompt: why the fuck is he explaining (terribly) asynchrony to these muggles?
00:48nopromptmuggles lol
00:48nopromptoh, callen, every time you use that word it tickles me.
00:48devnbe nice folks
00:48chordnodejs is a horrible language to use
00:48callenomg I agree with chord on something
00:48devnstop the hate.
00:48callenI...am...oh god.
00:48callenWHAT DOES IT MEEEAAAAAAN
00:49brehautit means everyone hates node
00:49chordthe only reason to use nodejs is beacuse you've got a team of javascript programmers that can't be bothered to learn another language
00:49nopromptchord: i'll write it in haskell with you. can you show me the ropes? i got up to like chapter 9 or something in "Learn You A..."
00:49devndont hate on languages like that in here
00:49callennoprompt: farther than most.
00:49devnit's tasteless
00:49chordnoprompt: shit i'm reading chapter 11 right now
00:49callendevn: JS is not a language, it's compiler output ^_^
00:49callennoprompt: word on the street is people get stuck on typeclasses in LYAH.
00:50callenchord: so I take it you haven't run into the monomorphism restriction in Haskell yet?
00:50callennoprompt: no, I don't know why.
00:50callennoprompt: also what you said earlier about giving a shit, I couldn't really tell what you meant.
00:50noprompttasteless is an interesting concept.
00:51callenI think every time I watch a video of Dahl talking, I have fangs grow and start sticking out of my mouth.
00:51chordnoprompt: ok so heres the plan since we both haven't finished reading the book, we'll go with clojure and callen can be our clojure hot shit expert
00:51noprompttasteless implies that whatever it is that is tasteless tastes like the current taste in your mouth.
00:52nopromptcallen: i wonder if chord is like one of those chat bots or something.
00:52nopromptgee what'da'ya think?
00:52callentoday I learned I'm a Clojure Hot Shit Expert.
00:52callenshould screenshot it for mom so she can post it on the fridge.
00:52noprompttoday i learned that mapcat rulez.
00:53callennoprompt: did you not see my flatten -> mapcat identity -> into progression earlier?
00:53noprompti'm gonna write that on the wall in a bathroom somewhere with a paint pen.
00:53callenfelt like a moron.
00:53nopromptcallen: yes i was there
00:53callenI'm so terrible ;_;
00:53callennoprompt: I'm still trying to figure out what you meant earlier re: giving a shit
00:53noprompt(into {} '([:mind "blown"]))
00:53noprompt:P
00:54callenI know I'm terrible, but being confronted with it gives it a new flavor.
00:54chordcallen you gonna help noprompt and I make the starcraft clone?
00:54callenchord: I'll send you my contract rate details.
00:54callenchord: what's your email?
00:54nopromptcallen: oh heh. i was just saying that normally i don't worry about stuff like that until i have to, but since you made something that will do it for me now i care enough to add it to my project.clj whenever i hack on an app that uses an sql store.
00:55callennoprompt: yay. :)
00:55SegFaultAXWhat's this?
00:56calleneverybody scatter!
00:56callenConcurrent trolling: IRC'ing while queueing in DotA. Perfection.
00:57nopromptwell after a few weeks of being back in college, i think it's safe to say the computer science major is not for me. after this semester i think i'm going to just go back to math.
00:57chordnoprompt ok you in for making the game without callen
00:57callennoprompt: I thought you worked for a living?
00:57noprompti can't remember one math class i didn't enjoy.
00:57nopromptcallen: i do, but i take a class here or there.
00:58callenahhh.
00:58nopromptcallen: one day i'll have a degree.
00:58nopromptit's pretty much a big fat waste of time though, since i'm not really motivated by money or anything like that.
00:59callenSegFaultAX: do you do anything with SQL databases in Clojure?
00:59nopromptnow, the acquisition of knowledge is appealing.
01:00chordGOOD FOR YOU NOPROMPT UNLIKE CALLEN WHO ASKED FOR MONEY TO MAKE STARCRAFT
01:01callenthe people who made StarCraft got paid too.
01:01coventryActually, he was just telling you to fuck off.
01:01callenpretty hard to pay rent otherwise.
01:01nopromptZING!
01:02SegFaultAXcallen: Yes.
01:02callencoventry is here with the hard facts.
01:02callenSegFaultAX: https://github.com/bitemyapp/blackwater/
01:02SegFaultAXcallen: Oh yea I saw that.
01:02chordnoprompt so you gonna help with starcraft
01:03nopromptchord: bro, i'd love to but you've been talking about that for the past 15 mins or so and i haven't seen a github repo or nothin. man, it's pretty much, like, you know, um, vaporware dude.
01:03SegFaultAXchord: Please stop spamming the channel.
01:04chordnoprompt: i'm not a clojure expert thats why i'm waiting for you to make initial commit
01:04nopromptchord: s'to late bro.
01:05nopromptSegFaultAX: just so you know, i had no part in this. he kept asking me to help him with the starcraft port and, well, as you can see i have politely declined.
01:05havenwoodchord: I see you've gone from trolling (or whatever it is) #ruby to trolling #clojure.
01:06SegFaultAXnoprompt: I know. This is like day 3 of this shit.
01:06chordwhat are you talking about I didn't troll #ruby
01:06noprompthavenwood: is he looking for the starcraft port in #ruby?
01:06chordhavenwood making shit up now
01:07dissipatechord, you should apply to work at blizzard. get them to switch to clojure.
01:08chordno we need to make starcraft clone independently from blizzard
01:08havenwoodchord: Well, to be fair trolling isn't entirely a mischaracterisation from the logs i'm reading. >.> But no intent to insult, if well intentioned carry on and don't mind me.
01:09chordso is there any game that you guys would make with clojure since you all hate starcraft
01:09dissipatechord, why?
01:09dissipatechord, tic tac toe
01:10nopromptchord: uh, BioShock Infinite, duh.
01:11chordeww you guys like first person shooters?
01:11SegFaultAXnoprompt, dissipate: Why are you feeding the trolls?
01:12nopromptSegFaultAX: alright. ok. i'll stop.
01:12chordi'm not trolling
01:12SegFaultAXchord: Fine, you've polled repeatedly to see if anyone wants to help you with a game. No one does. Kindly move on.
01:14nopromptchord: yeah! go peddle your pie-in-the-sky ideas else where! we don't want none!
01:14chordwhy are you guys so resistant to making a game
01:21callenSegFaultAX: it's been going on longer than three days.
01:21indigo:\
01:24chordcallen: don't you want to become famous for being the first to make a brilliant game in clojure
01:26pizzasaucetest
01:28bjachord: sometimes I consider writing a better cockatrice-compatible mtg client
01:29pizzasaucehello
01:29bjachord: then I realize I have a daughter, a wife, and a job
01:29nonubynot strictly a clj question, but if I have a domain model where a change is subject to a relatively long running operation, e.g. user (1:*) virtual machines, and progress is often required to be visible, what approaches are available? I figured about just having a :status on the vm entity that progresses from requested, building, to ready but not sure if thats really the best approach
01:30pizzasaucebja: you have a family you mean.
01:30bjayeah, family, job, an addiction to reddit
01:30bjaI think the last is most burdensome
01:31sontekAny of you guys using cassaforte (cassandra client) with clojure? Wondering if its the best one to use
01:31pizzasaucebja: what is reddit and why it is addictive?
01:31havenwoodpizzasauce: http://www.reddit.com/
01:31bjapizzasauce: http://www.reddit.com/ (and I'm sorta sorry for linking you this. cya in a few months)
01:32chordhttp://www.reddit.com/r/haskell
01:32callenpizzasauce: hi
01:32callenbja: you linked him to Reddit? You monster.
01:32pizzasauceit says:"reddit is a website about everything"
01:33pizzasaucehi callen
01:33bjapizzasauce: lies. just cats.
01:33pizzasaucebja: why it is addictive?
01:34bjapizzasauce: so many lolcats to view, so little time
01:35pizzasaucebja: oh, funny pictures you mean. yes they can be addictive.
01:35callenpizzasauce: lolcats.
01:35pizzasaucecats pictures, yes.
01:35callenbja: I've mostly taken a break from recreational redditing besides the occasional brief brain-break to check r/history, getting a lot more reading done :)
01:37bjacallen: without reddit, I might be tempted to better document and test my codebases. wouldn't want my coworkers getting the wrong impression about future productivity.
01:45noonianis it more idiomatic for a var name that represents a field called name in a thing to use something like tname or t-name? with most fields I would just use the field name but I try to avoid redefining core functions even locally
01:46radshey guys, I'm trying to test out core.async with clojurescript
01:46radsit seems like when I use a loop inside a go block, the code inside the loop doesn't run
01:47radsfor example, this appears to do nothing until I remove the loops: https://gist.github.com/rads/44b0aa0aaa7f46c5761b
01:47dnolenrads: you need to use CLJS w/ core.async *master*
01:47dnolenif you are on CLJS >= 1877
01:48radsoh ok. how do I specify that in my project.clj?
01:51iamjarvocan anyone spot any errors here? i am new to clojure http://pastie.org/private/zgah9uihuif42uuvclzicq error i get is Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: index in this context, compiling:(shoutr/core.clj:7:15) thanks!
01:51francis_wolkeI'm unable to use macros at the clojurescript repl, but on compilation of my foo.cljs file, they work fine. Are you unable to use macros at the repl in clojurescript, or am I making a mistake somewhere along the chain?
01:52jared314try it with routes below index
01:52noonianiamjarvo: you need to move the definition of index to above defroutes, or else (declare index) before the defroutes
01:52francis_wolkeClojure has a one-pass compiler.
01:52francis_wolkeErr... single pass
01:53bjafrancis_wolke: pretty sure that clojurescript's compiler chain will keep evaluating defmacros until they run out
01:53iamjarvoahh interesting
01:53nooniani think its actually 2 pass but on a per-form basis, at least for the regular clojure
01:54bjaotherwise https://gist.github.com/emidln/bd33d9c0b40d20f60508 wouldn't be very useful
01:54iamjarvothanks guys
01:54bjaalthough I guess with source maps working, it's not super valuable anyway
01:55bjastill useful for sending stack traces to raven
01:55callenrecursion of macroexpansion doesn't really make the compiler multi-pass, it's just inherent to the nature of macroexpansion, no?
01:56callenor I might've misread. either way. I am quite tired :)
01:58francis_wolkebja: I'm not sure what the implications of what you stated are to repl development. IMO evaluating them until they run out wouldn't prevent their use at the repl - the compiler does that for clojure too
01:59francis_wolke*the also clojure compiler does this.
01:59bjain my cljs repl, I can do (ns foo (require-macros [my.macro :refer [supermacro]])) and then (supermacro)
02:00bjaerr, :require-macros
02:00dnolenrads: in your :dependencies list you need [org.clojure/clojurescript "0.0-1889"]
02:01bjafrancis_wolke: or are you talking about defining macros at your cljs repl?
02:02radsdnolen: I figured out how to use the master core.async with :source-paths. is that still a requirement with this new clojurescript version?
02:02francis_wolkebja: Nope. Just using them.
02:02francis_wolkebja: interestingly, I can use them when doing it as you described, but my ns definition from the cljs file does not carry over to the cljs repl.
02:03francis_wolkebja: thanks
02:03dnolenrads: until the next core.async release - though prior to this people were either using snapshot or installing manually anyways
02:03bjadnolen: there's a core.async release?
02:04bjawow, missed that
02:05radsI'm a little confused on the difference between a snapshot and installing manually -- if I use "0.1.0-SNAPSHOT" as a version, leiningen won't find it
02:05augustlis there anything like mori - Clojure's data structures implemented in JS, as a stand alone library - for the JVM?
02:05radsthe only way I'm familiar with using a different version is to use :source-paths
02:07bjarads: I think if you mvn install it, lein can find it
02:09noidiaugustl, clojure's data structures rely heavily on functional programming, so I don't think they're a good fit for Java
02:09radsbja: never used maven outside of leiningen, so I don't know how to do that either :/
02:09bjarads: if you have a pom.xml, you can just do "mvn install" in your core.async directory
02:10bjaI think there is a lein plugin that lets you run something like "lein install" to get similar functionality
02:10bjait might even be core lein functionality, not sure
02:10s4mueldefault functionality
02:10s4muels/default/core/, better word :)
02:11noidiaugustl, I assume you meant Java, because Scala has its own persistent data structures, and in JRuby you can probably use Hamster
02:13radsbja: so when I `mvn install` from a local checkout of core.async, it's supposed to put it somewhere where my leiningen project can read it as a snapshot version?
02:15bjarads: after quick inspection, lein install seems to generate a pom.xml and a jar that it doesn't install anywhere particularly useful. You can then type mvn install to get the snapshot installed somewhere that lein can find it.
02:16radsI tried that, but it didn't seem to work. still getting an error from leiningen saying 0.1.0-SNAPSHOT can't be found in any repo
02:17bjado you have anything in ~/.m2/repository/org/clojure/ ?
02:17bjaspecifically, a core.async directory?
02:19radsyeah, it's there
02:19bjais there a 0.1.0-SNAPSHOT directory?
02:20radsyes, but it only has a resolver-status.properties file
02:20radsthere are other release verisons with jars in them
02:21radsit seems that the mvn install put it in core/async/core.async instead for some reason
02:22dnolenaugustl: https://github.com/krukow/clj-ds
02:24bjarads: perhaps either the pom.xml isn't correct or mvn install is ignoring the <parent></parent> element that would position it under org/clojure
02:27bjaah
02:27bjarads: run git clean -fdX in your core.async checkout
02:27bjait'll get rid of pom.xml
02:28bjaapparently pom.xml is old and was removed about a week ago (but added to gitignore in the next commit) so a normal git clean -fd won't rid you of it
02:28bjait seems as though mvn install doesn't respect the <parent> tag
02:29bjaif you inspect pom.template.xml, you'll see that the groupId for the project was changed to org.clojure
02:30radsclean it, then run lein install again?
02:30augustldnolen: cool, thanks
02:30augustlnoidi: haha, good point, I meant java yeah :)
02:31bjaclean it, then run script/build/pom
02:31bjathat should generate you a new pom
02:31bjaand then you can mvn install
02:33radsyeah, that seemed to work. leiningen still can't find it though :(
02:33bjarads, it probably has a different version
02:34bjathe pom.xml I just generated via master has a version of 0.1.225.0-34a630-alpha
02:34radsif it's 0.1.0-SNAPSHOT, doesn't it pull the most recent version?
02:34bjarads: only if the pom.xml specifies the version as 0.1.0-SNAPSHOT
02:35bjathe script/build/pom grabs the git revision (it seems). I didn't author the tool, so perhaps somewhere here with more knowledge could elaborate
02:36radswell, I can just specify that version in my project.clj
02:38radsin NPM I can specify a git repository and a revision (or "master") to stay up to date. I guess that's the advantage of hindsight, though?
02:40bjarads: I remember doing the same thing with pip for python
04:00kralnamaste
05:25edoloughlinI'm switching from Eclipse to Emacs and can't seem to get nrepl working. I can jack-in, switch to my namespace but when I try to call a fn from the namespace I get a "CompilerException [...] compiling: (NO_SOURCE_PATH:1:24)" any ideas?
05:25edoloughlinIt's a lein 2 project.
05:26edoloughlinSorry. My own fault. I just remembered I opened my files using /ssh:...
05:39borkdudedoes pr-str force evaluation of a lazyseq? (in that case I can omit a doall)
05:42hhenkelHi all, is there a way to do a "let" of a set and add more values if a condition is matched ( a parameter is set to true)?
05:44clgvhhenkel: example?
05:45clgvdo you mean something like that (cond-> #{1 2 3} (= (+ 1 2) 3) (conj 4))
05:45clgv,(cond-> #{1 2 3} (= (+ 1 2) 3) (conj 4))
05:45clojurebot#{1 2 3 4}
05:48hhenkelclgv: (let [data #{[:a :b :c]} (if (:use-https config) ;; ADD :https-port))
05:49clgvhhenkel: ok. so you mean like the one above
05:49hhenkelclgv: yes looks like that is what I've been looking for.
05:50clgv,(let [config {:use-https true :https-port 443}] (cond-> #{[:a :b :c} (:use-https config) (conj (:https-port config)))
05:50clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: }>
05:50clgv,(let [config {:use-https true :https-port 443}] (cond-> #{[:a :b :c]} (:use-https config) (conj (:https-port config)))
05:50clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
05:50clgv,(let [config {:use-https true :https-port 443}] (cond-> #{[:a :b :c]} (:use-https config) (conj (:https-port config))))
05:50clojurebot#{[:a :b :c] 443}
05:56hhenkelclgv: So I would do something like this: (let [needed-values (cond-> #{[:host :host :http-port :context-root]} (:use-https config) (conj (:https-port)))) ?
06:39clgvhhenkel: yeah. ideally the `let` would become superfluous in that function, but that depends of the context
06:39clgv*on
07:21katratxohi all, newbiew question, reading the documentation, (:use x) in a namespace declaration uses `refer` but i also have seen (:require [x :refer y]), when do you want to use the latter ?
07:23llasramkatratxo: Always. `use` is semi-deprecated. If you aren't in the habit of using it already, no need to start :-)
07:23ddellacostakatratxo: use will import everything into your namespace. require will let you selectively import vars into your namespace. Generally don't use use
07:24ddellacostakatratxo: if you really want to, you can mimic it with :refer :all, which arguably is a bit more explicitly, but in general avoid it (what llasram said)
07:25katratxollasram, ddellacosta thanks!! :)
07:26ddellacostakatratxo: np. Also, this is a great article to read on Clojure namespaces if you haven't already--should clear some things up: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
07:45supersymAimHere: I finally did a (distinct (map sum (drop 1 (subsets numbers)))) for those partial sums you helped me with... think it makes for a pretty elegant expression
07:46supersymbtw...me thinks lazy-compile prismatic graphs = pwnage; I don't think I can do without their plumbing lib anymore =)
07:47AimHereIndeed. I really need to find a way or remembering all those little clojure collection operations
07:49supersymyeah I have the same though, have LightTable wired up with a few keys to open 2, 3 good cheatsheets/search resources online
07:51supersymnow the fun part of my game design has come... AI/decisions/strategy ^^
08:00clgvsupersym: what are you developing?
08:03borkdudedoes someone here use the clj-configurator library?
08:05potetmDo we do clojurescript questions in here as well as JVM clojure?
08:06borkdudeI do not understand its behavior: (process-tree {:a "foo"} {:a "bar"} []) ;;=> {:a "foo"}, while I expect {:a "bar"}
08:06hashcatwhat's different between == and =
08:06hashcatI've tried many thing to distinguish
08:06hyPiRion(doc ==)
08:06clojurebot"([x] [x y] [x y & more]); Returns non-nil if nums all have the equivalent value (type-independent), otherwise false"
08:07hyPiRionfor numbers only
08:07hashcatoh thanks
08:08potetmWhen I try to compile my project using the latest clojurescript, I get a bunch of errors like the following: Reflection warning, clojure/tools/reader/default_data_readers.clj:177:15 - call to format can't be resolved.
08:08potetmSame for digit and write
08:09potetmIt was working fine prior to 0.0-1853
08:09potetmI've determined that that's the build that broke it
08:10potetmAnyone have any idea what changed between 1847 and 853?
08:10potetms/853/1853/
08:11potetmIt's almost like some of the automatically included core functions aren't being imported.
08:13bjapotetm: you could do git diff r1847 r1853
08:13potetm@bja tried that, I have no idea what would cause this. The diff isn't that big actually.
08:14bjaif you just want the commits
08:14bjagit lg r1847..r1853
08:14bjaerr, log
08:14potetmLooks like they included tools.reader in that version
08:15bjawhere lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %C(blue)<%an>%Creset %s %Cgreen(%cr)' --abbrev-commit --date=relative
08:15supersymclgv: a local variety of backgammon
08:16clgvsupersym: ah ok, with an AI opponent?
08:16hyPiRionbja: ty, I lost that one for some time ago, and forgot where I found it
08:17bjahyPiRion: np. It's not originally mine, but I like to pass it on as it's pretty useful
08:17hyPiRionyeah
08:17potetmYeah it looks like the inclusion of tools.reader is what did it.
08:17potetmBut, from the error, it looks like it can't resolve symbols in tools.reader itself.
08:17potetmWhich makes no sense to me.
08:17supersymclgv: well nothing true AI, but I can recall most of my decision moments when I play a game and translate those for the machine to look at
08:18bjapotetm: is it critical that you use r1853?
08:18potetmNo, I'm just trying to bring it up to date. It happens in every version after 1853
08:18bja1859 is pretty well supported, and there have been numerous tags since that have varying degrees of third party library support
08:20potetmHang on, let me look at my dependency tree. Could be I'm transiently including an older version of tools.reader
08:20bjapotetm: how does one do that? I know I can lein classpath
08:20potetmPiss that's it
08:20potetmlein deps :tree
08:20Bronsapotetm: that might be it, the tools.reader version that clojurescript uses doesn't have any reflection
08:20supersymoften all I need is a few predicates and overall strategy of def/off and all that remains is a 2, maybe 3 moves it could take... the trick is of course on how to ensure the long term strategy follows through... but this is all just play time, I don't see myself resorting to e.g. genetic algorithms yet
08:21potetm@bja @Bronsa Well that was the problem. Thanks for taking the time to rubber ducky with me :)
08:21bjaalways happy to play the goldfish
08:21potetmExtremely helpful!
08:22Bronsapotetm: anyway, reflection warnings only means some performance loss, it doesn't mean that the code is not going to work
08:23supersymanyway its intresting as practice experiments since those rules we have are specific for this game, and the problem isn't infinite possibilities like with chess
08:23potetm@Bronsa I'm guessing it's some sort of versioning issue. I'm going to try to get that all hammered out and see if I have any luck.
08:24clgvsupersym: huh? genetic algorithms? I think you need methods on game trees for that kind of game.
08:25Bronsapotetm: tools-reader pre 0.7.5 includes some reflection warnings
08:25potetm@Bronsa that's it then. We were running 0.7.3
08:26Bronsapotetm: last released version is 0.7.7 :)
08:27potetmI'm probably just going to use whatever's in the latest clojurescript release
08:28bjalayout practice question: if I have two src trees, src/clj and src/cljs, is it considered bad form to put cljs-only macros inside /src/cljs
08:28bjai.e. src/cljs/foo/macros.clj
08:29bjaassuming the macros have no actual applicability to normal clojure code (running them would either be nonsensical or outright errors)
08:31supersymclgv: see... I'm no game designer, and thats a new term to read up on ;)
08:32supersymwell in theory of course (also in practice) you can derive the optimal strategy from using those algorithms
08:34potetmNow I get "Use of undeclared Var my.namespace/format" all over the place
08:34potetmI'm guessing format is no longer supported in cljs?
08:42Bronsapotetm: it was removed from clojurescript, if you need it just use goog.string.format
08:52FenderHi guys, I need something like a synchronized block in Java for creating a DB connection on demand. This takes half a sec and is side-effecty, so atoms are not the weapon of choice. What should I use?
08:54Fenderin Java it'd be "if (x==null) {synchronized (some_lock) {if (x== null) x=createDbConn()}}} return x;"
08:54BronsaFender: `locking` is the clojure equivalent of java synchronized
08:54FenderI know but somehow this seems too Javaic and less clojuric
08:55Fenderpeople say it's supposed to be used for Java Interop stuff
08:55Fenderso I am looking for the idiomatic solution
08:56FenderI could manage it with a delayed connection that is deref every time when needed
08:56BronsaFender: yeah, you could use `delay`
08:57Fenderbut I don't want to define a delay block at startup because it assumes that the delay-contained connection does not change it params
08:57Fenderit probably never will, but still
08:58Fenderbasically I'd like a swap! that blocks all other threads
08:59Fenderagents also dont look like a good solution because of the async overhead
09:00Fenderso refs are still in the game
09:02llasramFender: You can have a memoized function which returns delays. So one delay per connection parameters
09:02llasramNB that I mean "memoized" in the broad sense -- you'd need to do something simple but custom to handle cache expiration
09:05Fenderthat seems like an idea but not that simple
09:05FenderI am investigating refs with commute right now
09:06llasramRefs also happen in transactions which may be restarted, so I don't think that's what you want either
09:07llasramI really think you want delays. Actually -- do you even need the memoization? That's essentially just a connection pooling layer
09:07llasramAfter you get the delay by opening it once, you can just pass that delay around
09:08Fenderhmm
09:08Fendersounds good
09:09FenderI just looked for refs w commute coz of this: "Note that a change made to a ref by commute will never cause a transaction to retry. commute does not cause transaction conflicts."
09:10Fenderbut essentially, I'd have the same problem as with delay when some parameters change
09:10Fenderok, I will try the delay solution
09:10devnI think I know what the answer will be but do you prefer: (-> (java.io.File. "foo") .exists) or (. (java.io.File. "foo") exists)?
09:11llasramdevn: (-> "foo" io/file .exists)
09:11devnmeh
09:12devni think that's a tad confusing
09:12llasramI tried :-p
09:12llasramwhat
09:12llasramWelp, we must agree to disagree
09:12devnhaha, well let me state my case
09:12devni think it's weird to see io/file in that position
09:13Fenderwhy not (.exists (io/file "foo"))?
09:13devnFender: just playing around with some different colors
09:14Fender^^
09:14Fenderyour optimizing your code for nice representation in EMACS?^^
09:14llasramdevn: Ok. I personally don't find it any more odd than seeing any other function in a threading-macro chain
09:15devnFender: nah, just trying out different variations
09:16devnsince we have . and .. it seems a little odd to use ->
09:16devnbut in some ways i prefer to see the leading . on .exists, because it's clear what its purpose is
09:16llasramEh. `.` is the special form, but I don't see it used much outside of the old parts of clojure.core
09:17llasram`..` ditto re: not seeing much outside of old parts of clojure.core
09:17clojurebotI don't understand.
09:17llasramYou can get the same effect with `->`, but can thread and interweave arbitrary functions and methods
09:17llasramSo it's more flexible
09:18devnllasram: except in this case, this is all java
09:18devnjava.io.File on a java.io.String, calling the method .exists
09:18llasramSure, until you want to add something that's not :-)
09:18devnit seems like a no-brainer to use . there
09:19llasramI'm just reporting what I see in existing Clojure code
09:19llasramFeel free to experience the Lisp Curse (tm) yourself :-)
09:19devnllasram: im not disagreeing, just thinking maybe everyone else is wrong and im right ;)
09:19llasramhaha
09:20llasramSee -- the Lisp Curse in action!
09:42Fenderllasram, the delay version is quite simple so I consider this the idiomatic solution
09:42Fenderthanks
09:54clgvllasram: devn: people that have to do a lot of java interop tend to use ".." when possible for cascading java method calls
09:57squidzis there a way to run something everytime leiningen auto-recompiles?
09:57squidzeither in-code or an external script. I think I saw something similar for adding test runners
10:13supersymsquidz: leininen auto-recompile?
10:15supersymas far as I know, leiningen doesn't do anything on that front, although quite a few employ a strategy like this https://github.com/aphyr/prism/blob/master/src/com/aphyr/prism.clj#L97
10:16squidzsupersym: yeah I mean I want to run ascript.sh everything lein cljsbuild auto updates
10:20supersymso if a plugin does recompile your code, I think your best bet is to use a hook to wrap some functionality
10:20supersymor something like http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Shebang_Scripting_in_Clojure
10:20supersymif you want to use a .sh file
10:22hyPiRionsquidz: lein-shell and some hack on :prep-tasks?
10:23hyPiRionnot that it autoupdates, but you could probably add in a robert.hooke-hook on cljsbuild
10:23squidzhyPiRion: thanks that might be interesting
10:28FenderOK, here's another question:
10:29FenderI use a lib that in turn uses Math.TANH which is very slow
10:29FenderNow I want this faster but I don't want to download the source, change it, compile the complete lib ...
10:29Fenderthe function that I want to use is the apache fastmath TANH
10:30Fenderis it possible to use with-redefs to redefine this?
10:30Ember-oh god, please someone kill me
10:31Ember-I wonder what the client would say if just accidently this project would happen to end up with this library called Clojure...
10:32hyPiRionYou could probably use reflection to replace the old java math.TANH with the apache fastmath one. No need for with-redefs, and it could be a bit faster.
10:32hyPiRionThat being said, it doesn't immediately strike me as the viable solution.
10:32Fenderme neither
10:33Fenderthe lib is supposed to get a new version like3 months ago
10:33Fendernow I don't want to meddle with the lib itself
10:34Fenderproblem is: the run time of my little proggy is 73% Math/TANH
10:34Fenderat least so says the sampler of JVisualVM
10:35Fenderso I think it's quite worth the effort
10:35Fender... until the lib (encog) is updated
10:36FenderEmber, define JAR deliverables in your contracts and never say what language you use!
10:37Ember-yeah, unfortunately I came to this project only after this had already started
10:37Ember-got to say, XML and XSD stuff with Java makes me insane
10:37Ember-we already wrote this custom XML writer to keep us sane
10:38Ember-but with XSD and validation there is no way going around Java apis
10:38clgvFender: to be sure use instrumentation instead of sampling
10:40Fenderclgv, you mean profiling with instrumentation?
10:40Fenderor something else
10:40clgvFender: yes
10:41clgvFender: sampling can be misleading when you have very frequent calls to a function which in fact takes not too much time
10:41Fenderok, I will check this
10:42hyPiRion(also, don't worry too much unless you need the performance)
10:45Fenderit's a financial app that spawns like tens of thousands of neural networks to predict close prices of stocks and so on
10:45hyPiRionoh, then I see
10:46Fenderso it runs several hours at night and if the 73% is remotely true, then it would be really worth it
10:58mdrogalisWhat's the best way to have a function that I wrote available at every project? It's just a small function, not enough for a library
10:58mdrogalisMaybe something using a Leiningen profile.
11:00supersymmdrogalis: I use LT which has injections for the REPL, but I'd still need to add stuff if I want it in deployment
11:00mdrogalissupersym: It's not something I'd deploy. What's LT?
11:00supersymLight Table..
11:01technomancymdrogalis: if it's just for dev convenience you can put :injections [(some form)] in your user profile
11:01mdrogalissupersym: Ah, alright.
11:01mdrogalistechnomancy: Thanks! I was never quite sure what injections did.
11:01mdrogalisHandy :)
11:05technomancyjust have to be careful it doesn't sneak into published jars
11:07borkdudeis there a way to let lein test quit after the first failure or error?
11:08mdrogalistechnomancy: Got it. I appreciate it!
11:08technomancyborkdude: https://github.com/pjstadig/lein-fail-fast
11:09vijaykiranlein-fail-fast
11:09vijaykiranah what technomancy said :)
11:10borkdudethanks
11:12mavbozodoes ring-session some kind of session-id?
11:12mavbozophp session has session id and can be retrieved by session_id()
11:16supersymmavbozo: from what I understand you can just make these... for example using lib-noir https://github.com/noir-clojure/lib-noir/blob/master/src/noir/session.clj#L20
11:21echo-areaOn github, if I want to replace a pull request whole patch with a new one, is it the only way to create a brand new pull request?
11:24mdrogalistechnomancy: Hm, I can't seem to get injections to work. Can you gist me a little example of defining a function for usage in projects?
11:25mpenetecho-area: you can use reset, if you're using magit, type "x" until you're happy (or choosing a commit) then apply whatever commit you want over it then force push "P -f"
11:25mpenetecho-area: but it can be considered dirty I guess
11:26mpenetecho-area: I dont even know how to do it using the cli, magit spoiled me. If you're not using magit check git-reset man page
11:27echo-areampenet: Ah I see. Since my personal remote repo is only used by me I think that'd not be a big problem. But it indeed is cleaner if my remote repo is not changed
11:27echo-areaAnd for the old discussions, I think we'd better leave it the way it was.
11:28mavbozosupersym: thank you. It turns out that ring's request map contains :session/key. That's what I need.
11:31supersymcool
11:45gfrederickssometimes I feel like a read-only view over a reference type would be nice
11:47gfrederickse.g., I want to create a flag to tell some worker threads when to quit. But if I used an atom then it's technically modifiable from any thread. I'd rather have something the workers can see but only the manager thread can modify.
11:48mdrogalisNevermind technomancy, I got it. :)
11:57edwAnyone here use Carmine with Redis?
11:58mpenetedw
11:58mpenetyes
11:59edwmpenet: Cool. You ever have a problem with it returning a string when you're looking for a byte array?
12:00mpenetedw: not really, how do you write your data?
12:01edwThis is some content that I'm pushing via `redis-cli ... -x hset key field`.
12:01mpenetedw: I dont write byte array directly to redis tho
12:01edwmpenet: Ah. I'm wondering if redis-cli does some escaping.
12:02mpenetedw: I think the binary support in carmine is done via nippy
12:02mpenetso it's prefixed with an id etc etc, might not be compatible with what you do on the cli, but you can overwrite that behavior with a fn I think
12:04mpenetedw: but I dont write binary data via carmine so take this with a grain of salt
12:04edwmpenet: Yeah, I'm playing with the `parse-raw` macro, doesn't seem to work, which leads me to suspect that my data is getting ASCII-ified by the client. Data I insert via Carmine is fine.
12:15mpenetedw: well, redis stores it as strings so it wont natively be able to guess to return you a byte array unless nippy did it's thing over it
12:15mpenetedw: my guess it that you get the same reply as from the cli using "get"
12:15edwI think what's happening is that a Unicode BOM is being inserted, which is giving me a bad hair day.
12:18TimMcYou got BOM'd.
12:19TimMcHappened on a weekly basis when I was working in NLP.
12:20hyPiRionI sometimes work with Unicode character outside the BMP. Java doesn't like that, especially when it tries to write stuff to disk :(
12:21mdrogalishyPiRion: Is there any way to get Lein :injections to play well with nrepl in Emacs?
12:22hyPiRiontechnomancy: ^
12:23hyPiRionmdrogalis: I don't think so, but I haven't worked much with injections to nrepl-mode
12:23mdrogalishyPiRion: Ah, okie dokie. Thanks anyhow. :)
12:47technomancymdrogalis: injections is completely orthogonal to the client you use to connect
12:47technomancymaybe what you want is :init-ns support; that is trickier
12:59mheldis there a thing I can use in compojure which will log out the urls + parameters I'm hitting?
12:59mheldlike when I POST /login with some params, it'd be great to see them in the console
13:01`cbpmheld: I think you can just do (POST "/login" {:as post} (pr post))?
13:02clgvmheld: if someone implemented that in a lib it is very likely a ring middleware
13:04mdrogalisThanks for the hint, technomancy
13:04clojurebotI don't understand.
13:04xeqimheld: (defn logging-middleware [h] (fn [req] (pr req) (h req)))) ; and then add logging-middleware to your middleware stack
13:04mheldclgv: perfect, found what I want -> https://github.com/pjlegato/ring.middleware.logger
13:05mheldit added a bunch of shit to my deps, but that's ok for now!
13:06clgvmheld: great. if you want to get rid of the dependencies later on you can just lookup how they did it and implement your own lightweight version
13:20mlb-Can clojure.data.xml parse a XML document, but retain xmlns information (prefix and dtd)?
13:23mtp"probably"
13:23mtpi'm just guessing though
13:27mlb-mtp: can't find any documentation that refers to "xmlns". With default usage, all prefixes appear stripped and all xmlns attributes aren't displayed
13:30rasmustocallen: I tried profiles.clj again, but lein doesn't seem to have c.t.n.r on the classpath (it's in my .m2 from when I added it as a project dep)
13:45marco2So I've been playing around with the core.async library, but I've been getting some weird results: https://gist.github.com/MarcoPolo/6626584 , is this normal, or am I doing something wrong?
13:45clojurebotPardon?
13:51cesparefoo , bar
13:51cesparewhat does clojurebot respond to?
13:52hyPiRion,
13:52clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
13:52cesparebut not any comma
13:52cesparewhy did it respond to marco2?
13:52hyPiRionif it's first in the sentence
13:53hyPiRionoh, it's the sentient part of clojurebot. Ignore that
13:53cespareit just randomly spouts off?
13:53TimMc"sentient"
13:53hyPiRionnot randomly, but unpredictably at least
13:53cesparei see
13:54TimMccespare: It interprets 1 in N messages as being addressed to itself.
13:54TimMcThis sometimes (but not usually) results in hilarity.
13:55hyPiRionTimMc: in N? What is N?
13:55TimMcI don't know.
13:55hyPiRionaha
13:59TimMc967198 total lines in my log of this channel, with 25600 containing '< clojurebot>' and 19031 containing '> ,'
14:00jared314,
14:00clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:00jared314just testing
14:00TimMcThat's 6569 unprompted responses. (Seems low.)
14:01TimMchyPiRion: So N is about 140.
14:04hyPiRionTimMc: I assume it's 1/140 unconditionally?
14:04havenwoodprolly 1 in 150
14:04havenwood,(/ 967198.0 (- 25600 19031))
14:04clojurebot147.23671791749123
14:04hyPiRionmakes sense
14:04TimMchavenwood: 7/1000 more likely
14:05hyPiRion,(rationalize 147.23671791749123)
14:05clojurebot14723671791749123/100000000000000
14:05hyPiRiondang you.
14:05havenwoodTimMc: Ah, good point.
14:05rasmustoclojurebot, now with sentience
14:05clojurebotTitim gan éirí ort.
14:06TimMcSentience is easy, sapience is hard.
14:06havenwoodClojurebot speaks Irish Gaelic now?
14:07hyPiRionclojurebot speaks every language.
14:08hyPiRionIt's best at Clojure though.
14:08rasmusto,(prn ",(prn \"test\")")
14:08clojurebot",(prn \"test\")"\n
14:08BronsahyPiRion: TimMc https://github.com/hiredman/clojurebot/blob/master/src/hiredman/clojurebot/noise.clj#L12
14:09rasmustocan I printlnl that?
14:10hyPiRionBronsa: The point was was to reverse engineer it :(
14:10Bronsa:(
14:10hyPiRion(inc Bronsa) ; Anyway, for source and all
14:10lazybot⇒ 11
14:14marco2So it appears work fine when run normally in the page, but fails when run through the browser repl
14:15marco2that's interesting...
14:18TimMcBronsa: So where does the excess 5/1000 come from? Maybe it's from factoids.
14:19BronsaTimMc: that, and also when clojurebot responds to questions/mentions
14:19dnolenmarco2: it should work regardless of being in page or in browser REPL
14:19Bronsa(I guess)
14:20TimMc123181 end in "?"
14:20TimMcclojurebot, why
14:20clojurebotwhy not?
14:21TimMcclojurebot why
14:21jared314clojurebot, what are you working on?
14:21clojurebotCool story bro.
14:21TimMcand 1695 with '> clojurebot[,:]'
14:26tangramm_Hi folks, can anybody help me with a emacs clojure question? I'm trying to browse a clojure file from a dependency lib of my cljs project (cemerick.cljs.test)
14:27tangramm_is there any key binding (i'm using nrepl) for that?
14:27Kalimarmeta .
14:27Kalimarmake sure it's compiled first - ctrl c ctrl k
14:27tangramm_i know that meta-. works in clojure
14:28tangramm_but you can't compile cljs file with macros if
14:28tangramm_you dont evaluate first the macro
14:28tangramm_i see it in david nolen post
14:29tangramm_i saw it
14:33jared314clojurebot, (doc juxt)
14:33clojurebotExcuse me?
14:34jared314,(doc juxt)
14:34clojurebot"([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
14:34supersymjuxt is awesome
14:34dnolentangramm_: there's just no way to do that yet, I don't think any CLJS emacs tools hook into the information provided by the analyzer
14:35dnolentangramm_: probably because there's no sensible interface to that stuff, lynaghk has been playing around with some ideas
14:35Kalimartangramm_ yeah sorry, missed the detail of the question. Sounds like dnolen has the answer though
14:36jared314,(doc clojure.core/juxt)
14:36clojurebot"([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
14:36callenrasmusto: and you're adding it to :dependencies in your profiles.clj?
14:37callenrasmusto: the problem cesare had was that he was adding it to :plugins not :dependencies
14:37tangramm_dnolen: thanks, You are in all places David! I was searching your post related to this evaluation problem, ... At last i am working in a clj file to bring the code inside emacs
14:38callenRaynes: I just rolled into work, was up late last night because I'm a nightbird.
14:38rasmustocallen: ah, I do have it in :plugins. And I guess it's not a plugin :)
14:38Raynesme 2
14:38callenrasmusto: it's a dependency
14:38rasmustocallen: thanks for fielding my ignorance
14:38callenrasmusto: you don't "require" a plugin. leiningen runs them.
14:38callenI didn't know people didn't know there were :dependencies in profiles.
14:39callennow I know that people don't know, so I can save them pain next time.
14:39rasmustocallen: I'm very unfamiliar with leiningen plugins in the first place, so that's part of the problem
14:41callenrasmusto: you should learn more Leiningen, it can make your life better.
14:41rasmustocallen: oh, I absolutely plan to.
14:42callenI know Leiningen "just works" and that's truly wonderful, but it has more to offer beyond being a nearly-perfect project dependencies manager :)
14:42callendependencies/build/repl/run/etc
14:42callennot really sure what to call it.
14:42callenit's just Leiningen. :)
14:45jared314,(doc clojure.string/re-quote-replacement)
14:45clojurebot"([replacement]); Given a replacement string that you wish to be a literal replacement for a pattern match in replace or replace-first, do the necessary escaping of special characters in the replacement."
14:55sm0keHello is there a rest friendly introduction to compojure?
14:56sm0kesomewhere?
14:56dsabaninhey guys
14:56sm0kei used to do web services in jersey ... and finding it hard to grok compojure
14:57sm0kefor instance i am still not able to figure out how to access query params and request body
14:57chrisfjonessm0ke: you might want to check out https://github.com/clojure-liberator
14:57chrisfjonessm0ke: might be a better level of abstraction to work at if you're used to jersey
14:58sm0kechrisfjones: i am really not looking for jersey in clojure..i want to understand compojure ..but thw wiki seems sketchy to me
14:59callenreally? condp = instead of case?
14:59callenhttp://clojure-liberator.github.io/liberator/tutorial/conneg.html
15:00dsabaninI'm having problems getting to a certain field in Java from clojure. https://www.refheap.com/18813
15:00dsabaninI need to get to TransportGitSsh/PROTO_SSH
15:01dsabaninany ideas how?
15:01marco3sm0ke, what are you speciFically trying to Figure out?
15:02sm0kemarco3: simple stuff...how do i access query params?
15:02dsabaninobvious way of just doing TransportGitSsh/PROTO_SSH yields: Unable to find static field: PROTO_SSH in class TransportGitSsh
15:02jared314it looks like a private field
15:02sm0kemarco3: how do i get post request body
15:02chrisfjonessm0ke: access to query params and request body is the realm of ring rather than compojure, although compojure adds some nice sugar for destructuring: https://github.com/weavejester/compojure/wiki/Destructuring-Syntax
15:03chrisfjonessm0ke: might be a worthwhile exercise to build something simple using raw ring first, then move to compojure when routing becomes important
15:03dsabaninjared314 so there's no way to get to that? (not really good with Java)
15:04jared314you could use java reflection
15:04jared314in clojure
15:04marco3sm0ke: here is a snippet of code: https://gist.github.com/MarcoPolo/53b680c8a006d4718c8e
15:05marco3that runs a standard sql lookup and returns the value
15:05marco3AlgorithmIDs is a post parameter given, so that's an example of the destructuring syntax
15:07sm0kei think i am just being thick here...let me search some more
15:07sm0keis compjoure build on ring?
15:07callenmarco3: hi! It looks like you're using Korma. Might I suggest a handy-dandy logging library? github.com/bitemyapp/blackwater/
15:07marco3yup!
15:07augustlsm0ke: it's the other way around. Compojure parses ring requests.
15:08chrisfjonessm0ke: ring is like the servlet api, and compojure is like spring routing on top of that (not a rock solid analogy, I know)
15:08marco3callen: woah, that's sexy
15:09coventryCallenpy the pointy paperclip.
15:10sm0keyay i found a chapter on ring in clojure programming
15:11marco3So I want to write a library to bring core.async/thread behavior to clojurescript through web workers, but I've been brainstorming on the best way to pass the code to the webworker
15:11marco3anyone have any ideas?
15:12marco3The first idea was to just send the function as a string, then the webworker would inject the function into itself and run it, returning the result
15:12marco3but the problem with that is that closured variables wont work
15:13callenmarco3: the most straight-forward way is not attempt to fuck with the way core.async works
15:13callena wrapper library or something.
15:13marco3callen: It'll be written on top of core.async
15:13mdrogalismarco3: Curious, why?
15:13callenalso webworkers don't really fit into the core.async model conceptually
15:13marco3callen: why?
15:13callenI don't know if the practical limitations are relevant, but it's worth thinking about
15:13callenwebworkers aren't green threads :)
15:14marco3mdrogalis: Web workers are great for running heavy computation, but they are really annoying to program
15:14callenthey're also kinda fat. Not really suited to the way core.async works.
15:14mdrogalisYeah, that ^ :/
15:14callenmore of a glorified fork.
15:15coventryI thought there was a thread pool underneath clojure core.async.
15:15callencoventry: sure, but webworkers is clojurescript.
15:15callencoventry: and what makes core.async green threads lightweight is that threads from the pool get retasked on yield.
15:15coventryOh, I didn't realize webworkers were limited in that way.
15:15marco3you could make webworkers leaner by creating the same idea of a pool of webworkers and reusing them
15:16callenyou're back to rewriting core.async again
15:16marco3and core.async would be used primarily to converting the message interface into channels
15:16callenyou'd be better off coordinating a higher level pool of webworkers with a core.async channel and some kind of coordinator fn.
15:16coventryBrenton Ashworth talked about making an app with webworkers in his most recent relevance podcast. I could be misremembering, but I thought core.async was somewhere in the picture there too.
15:16marco3that's exactly what I want to do
15:16callennot a task I'd want to tackle honestly. core.async JS apps are already fast. webworkers seems like a lot of hassle for little gain for now.
15:17chrisfjonesmarco3: since web workers have 0 context aside from whats passed in via the message, how would you deal with var access and other bindings?
15:17marco3chrisfjones: Yup, and that's my main problem right now. I don't know the best way to provide that context
15:18marco3callen: If you wouldn't use webworkers normally, there would be no point to this
15:18callenmarco3: https://github.com/pedestal/app-tutorial/wiki/Parallel-Processing
15:18marco3but if you need webworkers, this would be a great option
15:18callenI try to avoid getting sucked into frontend dev quagmires.
15:18callenbut good luck! :)
15:18chrisfjonesmarco3: yipe, well you'd have a small leg up due to immutability but I have no idea how you'd deal with shared state like atoms... although in core.async code you *should* be just dealing with channels
15:19marco3callen: this looks interesting, I figured you could use webworkers for pedestal, thanks!
15:21marco3chrisfjones: There are going to have to be a lot of limitations, but hopefully the end result should just deal with channels
15:22AimHereHmm, isn't there a predicate to test for regular-expressionness? I'm sure I can do something like (= (class foo) java.lang.RegularExpression) but it seems like an omission otherwise
15:23coventryI was wrong about Brenton Ashworth's app using web workers with core.async. He only mentions pedestal dataflows. (About 45 min in.)
15:23marco3coventry: shame :(
15:23tbaldridgecoventry: it's possible, and I think I've seen some examples of it, still experimental.
15:24dnolencore.async and webworkers do make sense in terms of using core.async to coordinate them sensibly, make something interesting could be done w/ atoms here?
15:24dnolens/make/maybe
15:24marco3dnolen: how so?
15:24callenthat's what I was thinking, but you'd have to resist the urge to use core.async as anything but a coordination mechanism.
15:24tbaldridgecoventry: IIRC, he had a version of a project that used Web Workers, and one that used Core.Async, just not one that used both.
15:24dnolenmarco: data disappears from calling context if you put it into a worker
15:25tbaldridgednolen: all of pedestal works off of message passing, so you could pretty much stick a queue anywhere you wish
15:25marco3yeah, through arraybuffers
15:25dnolenmarco3: otherwise you have pay for true clone, defeats the point of persistent data structures
15:26dnolenmarco3: also need to put all of ClojureScript into the workers, but maybe that really isn't a problem for worker code?
15:27dnolenin anycase webworkers mostly suck IMO, but for some problems it's all you have
15:27tbaldridgeI think the idea is that all APP code is in a WebWorker UI code in the main thread
15:27marco3dnolen: loading clojurescript core shouldn't be a problem, especially if you keep reusing webworkers
15:28marco3dnolen: yeah I know, but there are necessary sometimes. The way we use them now really sucks
15:29marco3dnolen: there could be a hybrid approach where you clone certain data, while passing off other bigger data.
15:29marco3how unreasonable would it be to try to resolve all symbols in given function, so you can pass the whole context into the webworker?
15:29dnolenmarco3: yeah, I'm sure something reasonable could be constructed, perhaps some kind of new reference type just for worker communication
15:30dnolenmarco3: so when you write it worker, less of issue since you have new abstractions for building it.
15:30tbaldridgeThis is where I think Pedestal's approach really shines the APP->UI communication deals purely with deltas (transforms over the UI, app data), so there really isn't a problem sending them to/from webworkers.
15:31dnolentbaldridge: do you see that working for all use cases, the whole point of sending around array buffers to workers is about performance
15:33marco3tbaldridge: Yeah you could have the whole data engine in a webworker and pass messages using arraybuffers, and everything should work just fine
15:33tbaldridgednolen: No I don't think it will work for every type of program, but I think the proper approach is to simply build applications as services with queues in-between them. Much like we build the server-side stuff today.
15:33dnolentbaldridge: yeah I don't disagree w/ that
15:35kovasanyone at rich's talk?
15:35tbaldridgeI wish I was
15:35kovasfollowing on twitter
15:35marco3I'll think about it some more and come back with some results :)
15:35kovaslots of retweetable lines
15:35coventrykovas: What's the hash tag?
15:35kovas#strangeloop
15:36kovasor just search for @richhickey
15:36callenif I didn't have Clojure for this project I'd have lost my sanity ages ago.
15:36coventryThanks.
15:36callenData canonicalization from ugly sources is *_*
15:36dnolenmarco3: hrm, I actually think maybe something cool w/ core.async, array buffers and workers could be done that make it sane ...
15:36callenmarco3: uh oh. now you've done it. dnolen is going to go off to his laboratory now.
15:37dnolenmarco3: esp if no one can touch the array buffer but it's hidden behind a channel
15:37dnolenworth thinking about
15:39chrisfjonesmarco3: If you could 'transparently' take advantage of web workers by writing simple core.async code, that would definitely drive a lot of cljs adoption
15:39callenchrisfjones: and create more demand for browsers that have webworker support.
15:40callenhow did that API end up so terrible anyway? Can we blame the W3C for that?
15:42dobry-den,(:a {:a 1 :b 2} :lol)
15:42clojurebot1
15:42`cbp`wat
15:42dobry-denWhat exactly is that form doing with :lol?
15:42coventryExactly nothing.
15:43`cbpdobry-den: default value for when :a is not found
15:43dobry-denOh, I thought you had to use get for that
15:43dobry-denThanks
15:43hyPiRion,(:a :a :a)
15:43clojurebot:a
15:43callen,(:LEL {:a 1} :NOTLEL)
15:43clojurebot:NOTLEL
15:43dobry-deni dont know why that didn't occur to me
15:44callendobry-den: you get used to it.
15:44dobry-denespecially since the code i encountered names the 3rd argument "default-token"
15:44callentakes practice for some of the less obvious patterns in Clojure to "stick"
15:45`cbpHmm you can't add meta to nil?
15:45coventryOr keywords or strings.
15:46hyPiRionor numbers, or anything java
15:56timsgHow does one access the doc strings sometimes attached to namespaces?
15:56ucbcallen: http://www.youtube.com/watch?v=KsMKOx6fumc
15:56ucbcallen: even if for the lols
15:59callenucb: after I'm done getting trolled to death by Apple Developer support
16:00coventrytimsg: It's in the metadata on the ns symbol. https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5244
16:01timsgcoventry: thanks!
16:02gfrederickscoventry: timsg: at runtime you'll want the metadata on the namespace though
16:02gfredericks,(-> 'clojure.core the-ns meta)
16:02clojurebot{:doc "Fundamental library of the Clojure language"}
16:03timsggfredricks: aha, yeah that's the use case, thanks
16:04coventrygfredericks: Thanks. timsg: Sorry, I had only proven that statement correct, not tried it.
16:05callenucb: I've actually seen this before, it's great :)
16:06callenucb: https://www.youtube.com/watch?v=hiRPc254dGE
16:07callenucb: your company should benchmark datomic using different backends including couchbase :)
16:07coventrygfredericks: When does the namespace get the metadata? Is it some kind of gen-class magic?
16:07timsgcoventry: np
16:08callenucb: These guys got a ton of attention for their efforts: http://www.techempower.com/benchmarks/
16:08coventryNo, the gen-class stuff is irrelevant.
16:09mdrogalisFWIW: You can't publish Datomic benchmark metrics.
16:09callenoh right, I forgot about that.
16:09callenmdrogalis: is private discussion publication?
16:09mdrogaliscallen: *Shrug*
16:09mdrogalisI'm no lawyer.
16:15callenucb: http://www.youtube.com/watch?v=wgEosl2rEEw
16:16ucbcallen: I spoke to Rich about us backing up datomic. He said "yeah, give me your card, I'll email you" and never did. It was the tech version of a date that ends up nowhere ("I'll call you…")
16:16rplacacoventry: my memory is that the namespace gets metadata when first created and nothing after that
16:18callenucb: :(
16:18ucbcallen: oh well :)
16:19supersymthe double-colon prefix, what I don't get.. how can keywords collide?
16:20llasramsupersym: metadata, for example. Two different libraries might want to use the same base keyword in metadata to mean entirely different things
16:20ucbcallen: http://www.youtube.com/watch?v=rt4CQc1MSso#t=76
16:21supersymllasram: ah, I see. thnx
16:22callenucb: Skyrim
16:22callenthat's what it makes me think of.
16:23tbaldridgeucb: you could try #datomic bobby (from Cognitect) hangs out there most of the day.
16:23ucbheh
16:23ucbtbaldridge: for backing plans?
16:23tbaldridgeucb: he's really good at answering those sort of questions
16:24potetmOkay, I'm having an issue getting source maps running in clojurescript
16:25potetmWhen I run the repl, I'm getting a ton of errors like the following:
16:25potetmWARNING: Symbol IFn is not a protocol at line 24 file:/Users/potetm/.m2/repository/jayq/jayq/2.3.0/jayq-2.3.0.jar!/jayq/core.cljs
16:26gfrederickscoventry: I'm trying to figure out where in-ns happens but I'm not sure where
16:26potetmGranted, I'm running the snapshot, but this makes no sense to me.
16:26dnolenpotetm: there's no support for incremental compilation, make sure you run lein cljsbuild clean before you try to generate a source map.
16:26gfrederickscoventry: but that's my guess
16:26ucbtbaldridge: ok, cool, thanks
16:26dnolenpotetm: no support yet
16:26potetm@dnolen I am doing a clean
16:26potetm@dnolen no support for what?
16:27dnolenpotetm: for source maps under incremental compilation
16:27potetm@dnolen, this is a clean build
16:27dnolenpotetm: so you can use auto, and you must run clean every time.
16:27dnolens/can/can't
16:27potetm@dnolen got it
16:28dnolenpotetm: if you still encounter the issue then we need a minimal project that demonstrates it, file a ticket in JIRA w/ exact command steps at the shell to reproduce
16:52nopromptcallen: have you ever used multi-term (emacs)
17:02ToBeReplacedi have a map like {:a {:A {:x 1 :y 2} :B {:x 3 :y 4}} :b {:A {:x 5 :y 6} :B {:x 7 :y 8}} that i need to transform to change the inner map to the :y value -> {:a {:A 2 :B 4} :b {:A 6 :B 8}}
17:02ToBeReplacedright now, i have a nested reduce-kv, which is basically unreadable
17:02ToBeReplacedthoughts on better way?
17:06rasmustocallen: seems like c.t.n.r/refresh was having issues with (:use blah.foo) in a few of my namespaces, I have it working otherwise though :)
17:08seangrov`Our team is all traveling the actualy ClojureCup days, but we're thinking about taking two days beforehand to do it on our own. Thinking about building an open-source error reporting service (airbrake, errbit) and cljs library so that errors are reported to a clojure server that matches it to the correct source map, so you can collect client-side errors from users in production code and trace it back to the original code.
17:08seangrov`Any thoughts from anyone? Think it could be pretty nice for core.async and other production apps.
17:08pepijndevosI'm curious what this would look like in Clojure https://gist.github.com/pepijndevos/6580712
17:08seangrov`Not as a commercial service, but a nice tool for smaller sites
17:09seangrov`pepijndevos: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6486 ?
17:10rasmusto,(flatten [:a [:b :c :d [:e :f]]])
17:10clojurebot(:a :b :c :d :e ...)
17:10pepijndevosseangrov`that is NOT what that function does
17:10seangrov`pepijndevos: Just a guess from the name :P
17:11pepijndevos{:a {:b 1}} -> {"a[b]": 1}
17:11rasmustopepijndevos: how would you do that in clojure?
17:12pepijndevosphp has this weird way of encoding arrays in url parameters
17:13pepijndevosThe python code I wrote uses recursion and mutable state. The Clojure function would probably not use mutable state, so getting the values back out could be harder.
17:14zanesWhat was the rationale behind separating out + and +' and family in 1.3.0? Performance?
17:14pepijndevosprobably
17:15pepijndevosI think the one does some "expensive" overlow checks
17:15seangrov`pepijndevos: presumably something similar to this the https://www.refheap.com/76d8a1e629c87d2b77d9d8727
17:15seangrov`Just two helper functions I have in my cljs to serialize cljs objects to rails query params
17:15seangrov`But can't help you more than that tonight, need to sleep
17:15pepijndevosmee too
17:16pepijndevosI'll try to implement it tomorrow for fun
17:25rasmustopepijndevos: sorry for my dumb response, I read "PHP" in the gist and my brain turned off
17:28coventrygfredericks: Yeah, it happens in in-ns. Thanks.
17:31chronnoToBeReplaced: (clojure.walk/postwalk #(get % :y %) {:a {:A {:x 1 :y 2} :B {:x 3 :y 4}} :b {:A {:x 5 :y 6} :B {:x 7 :y 8}}})
17:32ToBeReplacedchronno: not using because :y may be in the earlier map ex: {:a {:y {:x 1 :y 2}} would collapse to {:a 2} not {:a {:y 2}}, but thanks
17:33chronnoToBeReplaced: oh, ok :-)
17:33ToBeReplacedi really want to say something like "do this to the innermost map", but "innermost map" is hard to define efficiently
17:33ToBeReplacedor alternatively, "do this to the nth level of nesting"
17:34ToBeReplacedi guess that's what i really mean... i want reduce-kv on the nthe nested level
17:34nopromptToBeReplaced: maybe use zippers?
17:35ToBeReplacednoprompt: you're probably right
17:35nopromptToBeReplaced: you could also try mucking around with get-in, but zippers might be the ticket.
17:36ToBeReplacedi've never used a zipper in production before, why not now!
17:39noprompti <3 emacs.
17:41ToBeReplacedhow would you turn {:a {:b 1 :c {:d 2 :e 3}}} into [:a :b 1] [:a :c :d 2] [:a :c :e 3] or similar?
17:41callenrasmusto: don't use :use
17:42callennoprompt: a couple of times. didn't have a fantastic experience but it seemed neat. Why?
17:42ToBeReplacedi guess just write ugly if map? and conj code
17:43nopromptcallen: oh because i just hacked up a really cheap rip off to work with :shell last-night. https://github.com/noprompt/matilde/blob/master/emacs.d/noprompt-multi-shell.el
17:43robinkIs the way to define a default value for a functional argument simply to have an or (optionally within a let if you're worried) within the function's body? i.e. (fn doathing [& [optionalarg]] (or optionalarg (give-me-a-default-value) "Hardcoded_Default"))
17:43TimMcnoprompt: What, writing docs in comments instead of actual docstrings?
17:43ToBeReplacedrobink: i would use a multiple-arity function
17:44robinkToBeReplaced: Ah, OK
17:44nopromptTimMc: no. i didn't realize that when you have a comment that spans multiple lines, you have to dedent a bit to get it to line up properly.
17:44mschueneor you can do it with keybord arguments easily
17:44ChousukeToBeReplaced: you want all paths to leaves? hm
17:44robinkmschuene: Ah, OK
17:44nopromptTimMc: specifically for ^:doc comments for defs.
17:45mschuene(fn doathing [& {:keys [a b c] :or {a default-a b default-b c default-c}}])
17:45ChousukeToBeReplaced: you should be able to do that recursively if you write the function to generate a lazy seq of lazy sequences.
17:45nopromptwow. you know you're a lisp programmer when you start accidentally replacing spaces with dashes in normal conversation.
17:45robinkmschuene: Also looks like the :or keyword is allowed in let, that may be an option w/ fn/loop as well.
17:45nopromptjust noticed i typed last-night.
17:45callennoprompt: you're a wizard harry.
17:46callens/wizard/lisper/g
17:46TimMchah_COMMA_-that_QUOTE_s-funny_BANG_
17:46callencommas are whitespace.
17:46TimMc(Sorry for the lame mix of pre and post munged stuff.)
17:46nopromptcallen: i still crack up from time to time whenever i think of "PHP muggles".
17:47callennoprompt: it's a word that has earned a permanent place in my vocabulary.
17:47callenit's too apropos not to use.
17:47nopromptcallen: 'spretty funny.
17:48Chousukeif lisp is magic, what are the Dark arts?
17:48callennoprompt: http://www.youtube.com/watch?v=QPcOZcmHO-s
17:48callenChousuke: mutation
17:48Chousukecallen: that's just transfiguration
17:48mschuenereader macros which are forbidden in clojure
17:49callenmschuene: ztellman would like to have a word with you about that :)
17:49callenhttps://github.com/ztellman/sleight
17:49callennot quite the same, but you can get damned close.
17:50indigoI thought reader macros were forbidden for a reason
17:50mschuenecallen: my comment was half ironic about that ;)
17:51mschuenedosn't sleight applies the transformation after it read the forms ?
17:51callenindigo: you don't win much for your trouble re: macros.
17:51mschuenethen you still have to use normal clojure forms and can't for example introduce new syntax
18:02ToBeReplacedChousuke: yes -- was looking for paths to leaves... writing that code isn't hard, it just looks kinda ugly
18:02TimMcRight, I want to be able to directly embed PNG-encoded Piet subroutines in my fns, and reader macros would be good for that.
18:02ToBeReplaced,((fn paths [root m] (if (map? m) (mapcat (fn [[k v]] (paths (conj root k) v)) m) [root])) [] {:a {:b 1 :c {:d 2 :e 3}}})
18:02clojurebot([:a :c :d] [:a :c :e] [:a :b])
18:05clj_newb_2345core.log
18:05clj_newb_2345core.logic
18:05clj_newb_2345is it the best prolog implementation on clojure right now?
18:06dnolenclj_newb_2345: core.logic isn't really a Prolog :P
18:07clj_newb_2345dnolen: minikanen != prolog?
18:08dnolenclj_newb_2345: Prolog is it's own language with it's own syntax and different semantics, miniKanren is an embedding of relational programming in some host language
18:09clj_newb_2345dnolen: what is the best "prolog" in? clojure then
18:09clj_newb_2345is it a modification of On Lisp's prolog?
18:09dnolenclj_newb_2345: no, it's a miniKanren implementation, unrelated to On Lisp's Prolog
18:10dnolenclj_newb_2345: I don't know if it's the "best", but it's 2 1/2 old and people have used it production.
18:10clj_newb_2345no no, I meant what is the best example of prolog in clojure? -- On Lisp's implemnetation ?
18:10dnolenactually almost 3 years old now
18:11dnolenclj_newb_2345: doesn't exist? but you can do Prolog-y things with core.logic
18:12danielszmulewiczwow, elm is making a splash at Strange Loop apparently. Watching this introduction right now: http://www.infoq.com/presentations/Elm
18:13danielszmulewiczHas anyone tried it?
18:14danielszmulewiczInteresting from a Clojurescript perspective. Kind of a rival. Maybe. Dunno.
18:19rasmustocallen: I had some :use blah :only [bar baz] that I didn't want to switch to :requires for the sake of "clean git history"
18:20rasmustocallen: I now know that nobody gives a damn about git history unless it breaks bisects or somesuch
18:21callenrasmusto: switch to :require, learn to use rebase.
18:22callenrasmusto: version control is supposed to help you fearlessly change code, not hinder.
18:22rasmustocallen: on it. I'm even tempted to rebase some "public" history that I'm sure nobody has looked at
18:22callenThe first law of callen is: Do the right thing for the code.
18:22rasmustodon't worry, I'm all about making massive changes for the sake of the code
18:22rasmustoespecially now that it works for the most part
18:23rasmustoplus it gives me a chance to learn emacs
18:23dnolendanielszmulewicz: Elm is cool but it's closed world, so not much of competitor
18:25danielszmulewiczdnolen: Interesting. And looking at the presentation, that's what I was thinking too!
18:26danielszmulewiczdnolen: I'll probably rummage the FRP offerings in Clojure to achieve the same benefits. Reagi is on my list.
18:27dnolendanielszmulewicz: Elm approach still probably nice for certain kinds of applications, but I think ClojureScript just has a broader scope and is agnostic about how to build interactive systems from a language perspective.
18:28callendevn: you're so positive and friendly :P
18:28callenElm is as much a framework as anything else. I don't know why anybody would compare it with a general purpose language.
18:30danielszmulewiczcallen: not comparing what they are, comparing what they provide
18:31callena framework provides different things than a language. the particulars are almost irrelevant.
18:31callennobody expects to sensibly compare Clojure with Ruby on Rails.
18:31callenfrontend doesn't change that.
18:32callenin a different world, this is a type error.
18:35danielszmulewiczcallen: it was a tentative proposition that generated useful comments. A win from my perspective.
18:36dnolendanielszmulewicz: fwiw, I think it makes sense to compare, Elm is very much a language - but it also brings a philosophy about how to built interactive systems - Smalltalk-esque in that way.
18:37callenYou can't really think of it as a general purpose language because the opinionated-ness constraints it to what it chooses to be opinionated about.
18:38callenif you made a CMS that used a custom programming language, but the custom programming language was so opinionated that you could make CMSes with it, then it's just a quirky CMS.
18:38callennot a language in its own right in any meaningful capacity.
18:38callenthat you could only make*
18:38callenyou don't get to claim a higher title just because the implementation details are quirky.
18:41danielszmulewiczdnolen: I wonder also how much elm and clojurescript overlap/compete in attracting the kind of people that look into building web UIs in a novel way.
18:42dnolendanielszmulewicz: I would zero overlap, I wouldn't use Elm ever
18:42dnolenwould say
18:42callendanielszmulewicz: there's an #elm channel where queries about elm can be served.
18:42danielszmulewiczdnolen: that doesn't surprise me:-)
18:43dnolendanielszmulewicz: ClojureScript doesn't get in the way of interacting directly w/ the DOM which is a must for most serious applications.
18:43tsantosIs there a way to write executable scripts in Clojure? I'm looking for something like #!/usr/bin/env clojure. Maybe somehow through leon?
18:43tsantoserr, lein
18:43callentsantos: there's lein exec, but it's not a fantastic use of Clojure :)
18:44clj_newb_2345you can do it with nailgun
18:44indigoLots of overhead while the JVM starts up, unless you use an already running repl
18:44clj_newb_2345to reduce the jvm startup time
18:44callenclj_newb_2345: don't tell people to use nailgun.
18:44tsantoshehe
18:44callenif you need to reduce JVM startup time use drip or grench.
18:44ToBeReplacedtsantos: generally, make an uberjar, or use clojurescript
18:44callengrench exec is probably the way to go for scripts.
18:44callenmaybe.
18:45tsantosHow would you execute the ClojureScript?
18:45tsantosI'm using it for web development right now but I don't write one-offs with it
18:45danielszmulewiczdnolen: Elm's promise is that you don't need to touch the DOM. Don't we crave for high-level abstractions that hides away the DOM?
18:45ToBeReplacedtsantos: compile the file, then put #!/usr/bin/env node at the top
18:46tsantosOh, looks like I need to do a bit of research on that. I haven't used node before. Thanks!
18:46dnolendanielszmulewicz: sometimes yes, sometimes no
18:48danielszmulewiczdnolen: Fair enough. Thanks for your input.
18:49ToBeReplacedtsantos: clojurescript compiles to javascript, which is executable on the desktop via nodejs -- most package managers should have node available, so it's pretty portable
18:50clj_newb_2345what is nodejs?
18:50tsantosToBeReplaced: Thanks. I got brew to install it.
18:50clj_newb_2345on shit
18:50clj_newb_2345nodejs + clojurescript = no need for java?
18:56ToBeReplacedclj_newb_2345: different platform, different experience; nodejs (or actually, V8, but I haven't tried bypassing nodejs before) + clojurescript lets you mitigate the complaint of jvm startup time for "shell" scripts
18:58ToBeReplacedthat's actually how i'm starting to get wet with clojurescript -- I don't have enough confidence yet to use it on frontend, but i'm writing new shell scripts in cljs instead of python to see how it goes
18:59tsantosToBeReplaced: one thing that occurs to me is that you can't leverage the huge library of stuff contained in Clojars
19:02ToBeReplacedtsantos: that was one of my initial concerns, but it hasn't been an issue for me -- turns out the number of external libraries i'm interested in for a shell script is close to zero... the only notable one missing is something as good as joda-time
19:04supersymone other option is to have a long running JVM instance
19:04supersymlike they do here: https://github.com/michaelsbradleyjr/node-clojurescript
19:04supersymyou can just compile against that instance
19:06delexihello together. I just wanted to give clojure a shot, installed clojure 1.5.1, downloaded the lein-script and put it into my PATH and finally installed clojure-mode and nrepl, as stated in the getting started tutorial on clojure-doc.org. I ran `lein new command-line-args` and then did an M-x nrepl-jack-in and got the following error message: "error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: /bin/bash: line
19:06delexi1: lein: command not found". What did I do wrong?
19:06callenI've been getting better at thinking before typing. It's helped me recently on my project that's in Clojure.
19:07ToBeReplaceddelexi: it's not finding lein... my guess is that if you check your path in emacs, it'll be missing
19:07coventrydelexi: Did you make the script executable?
19:08coventryOh, I guess if the lein new worked, you did.
19:08delexicoventry: yes.
19:08ToBeReplaceddelexi: it's prob in your path in the shell but not in emacs -- log out and back in (or similar)
19:09delexiToBeReplaced: I will try that, thanks.
19:13brehautmorning talios
19:14taliosMorning
19:14taliosmove to auckland and work with us!
19:14brehautlol!
19:14taliosyou love javascript right? :)
19:14brehauti use javascript frequently; its different ;)
19:14taliosand looks like clojure is starting to foistered upon us
19:14brehautexcellent
19:15brehauti am available for contract work in the new year
19:15brehautremotely
19:15brehaut:P
19:15taliosin one project so far, sadly not the main project
19:15brehautalways good to start small
19:15brehautwhat are you using it for?
19:15taliosthat's actually maybe a possibility :) you're close enough to visit now and then
19:15taliosstorm jobs, log processing, cassandra fo
19:16taliosfoo
19:16taliosmain project is still very Hibernate/JTA/OSGi so trying to work out how to best put clojure in there is kinda hard, scala would just slot in, but clojure… poses some different idioms
19:16brehautyeah, clojure isnt such a fan of that set up
19:17callenI've got a recursive function that produces a hierarchical one-to-many projection, thus making my tail recursive attempt at traversal seem like not a good fit.
19:17taliosbeing more on the "go away OO" side doesn't really play with an instance services model
19:17callenis there potentially a pattern (I'd like to avoid zippers) that I am missing?
19:17brehauttalios: my guess is that you'd be best doing something like datomic does for its java API
19:17delexiToBeReplaced: yupp, this worked excellent(ly?). Thank you!
19:18amalloytree-seq, callen?
19:18brehauttalios: and writing java classes that act as an interface into clojure via RT
19:18taliosbrehaut - yep, RT is kinda a hacky kludge tho :)
19:18callenamalloy: I'll play around and see if it's a good fit. Thank you :)
19:18brehauttalios: its the approach that rhickey endorsed
19:19callenonly problem is processing a child requires knowing the data of the parent.
19:19taliosbrehaut - and given everything is still hibernate/jta - bridging the two worlds might be ik. I'm trying to see if we can go Datomic first :)
19:19brehauttalios: agreed, that wouldnt be ideal at all
19:19taliosbrehaut - being endorsed doesn't make it any left kludgy :)
19:19taliosless
19:20talios"the best and blessed way" is good, but not…. ideal.
19:20brehauttalios: well the idea is that you put your ugly java mess into java, and dont let the pain bleed into clojure.
19:20brehauttalios: the problem is that java likes to make layering hard :P
19:20taliosyou mean like hibernate/jta/osgi :) heh
19:20taliossadly thats a lot to keep in java :)
19:21brehauttalios: everyone has to live with their poor life choices ;?
19:21brehauts/;?/;)/
19:22ToBeReplacedTIL tree-seq is a thing
19:22clj_newb_2345_anyone know of a good set of resources for machine learning _exercises_ ?
19:22clj_newb_2345_i.e. things of the form "here's the data, write a program to achieve XYZ on the data"
19:22clj_newb_2345_rather than just texts and texts of math ?
19:23ToBeReplacedcallen: something like this? (fn paths [root m] (if (map? m) (mapcat (fn [[k v]] (paths (conj root k) v)) m) [root]))
19:23ToBeReplacedcallen: example of hierarchical one-to-many where you see the data of the parent, i think?
19:24callenI think I might have to do a zipper'ish thing
19:24callenToBeReplaced: thanks, but I only sort of understand what you're going for there.
19:25callenthe root is a map, that has fields of scalars and colls, but also fields of scalar maps and vectors of maps. the mappy ones have to be processed recursively.
19:26ToBeReplacedcallen: postwalk?
19:26callenToBeReplaced: nah, I've already abandoned that whole ns/
19:27`cbp:(
19:27ToBeReplacedwell, postwalk if they can be looked at independently... if they depend on the data before it, you can use the pattern above -- that's an example of getting all of the nested paths to leaves
19:28callenthey cannot be looked at independently.
19:28callenI have to retain direct parent information.
19:28callenand in fact, the parents and their direct children have to be processed side-by-side.
19:29callenbut, after they've been processed, I have to recurse same logic down all of the children
19:29callenthus producing the one-to-many thing I'm talking about.
19:30coventryWhat is the ?r doing in this core.logic code? https://github.com/swannodette/logic-tutorial/blob/master/src/logic_tutorial/tut3.clj#L7
19:32coventryWhat are the underscores in righto doing, for that matter? The same thing as in zebrao?
19:32callenI guess I essentially want to "map" a recursion across all of the children
19:33callenI'm tempted to do so without loop/recur (because it's not tail recursive AFAICT) and just hope it doesn't break.
19:33callenHave I missed something?
19:33callenperhaps I change my function to process seqs of docs instead of single docs, and tail recur against that?
19:34ambrosebscoventry: ?r is sort of like [x y & r]
19:34callenyes...this might be promising...
19:35ToBeReplacedcallen: (fn [parents-seq child]), no?
19:37coventryambrosebs: Thanks. Still confused, but that's a help. I'm planning to look at the sourceforge minikanren documentation. Are there any other sources you'd recommend?
19:37coventryHeh. Looks like The Reasoned Schemer IS the minikanren documentation.
19:38ambrosebscoventry: this is a bit a of fun, probably slightly old tho. https://github.com/frenchy64/Logic-Starter
19:39ambrosebscoventry: also http://minikanren.org/#writtenTutorials
19:41coventryThank, ambrosebs. This is great.
19:45ambrosebscoventry: my tutorial has a good intro to match if that's what you're after.
19:47`cbpIs there a cond-let or something similar? :P
19:50coventryambrosebs: Just trying to get a taste at the moment.
19:51ambrosebscoventry: the talks on minikanren.org are fun
19:52Bronsammh
19:52Bronsasuppose I have (letfn [(a [] 1) (b [] (a)) (a [] 2)] (b))
19:53Bronsa(letfn [(b [] (a)) (a [] 2)] (b)) is equivalent to that right?
19:53Bronsae.g. the first binding of a doesn't affect in any way the expression since it gets overwritten
19:53ambrosebsBronsa: yes
19:53amalloyi'm a little surprised letfn lets you overwrite bindings, actually
19:53Bronsaamalloy: me too
19:54Bronsaambrosebs: in your hygienic transformation pass do you take this case into account?
19:54ambrosebsBronsa: yes
19:54indigoHm, any good libraries for OAuth 2.0 providers in Clojure?
19:54indigoNot consumers
19:55ambrosebsBronsa: I'm not sure if it was overkill, but I just gave unique bindings to each letfn.
19:55Bronsaambrosebs: currently I transform it (more or less) to (letfn [(a_1 [] 1) (b [] (a_1)) (a_2 [] 2)]) (b_1)) which is wrong
19:56BronsaI'll probably just discard every rebound binding
19:56ambrosebsBronsa: Hmm no I think I worked out the unique bindings beforehand, so the same names get the same hygienic transform.
19:57ambrosebsBronsa: TBH I'd rather never think about hygienic transform of letfn again!
19:59ambrosebsBronsa: this is what I do currently https://gist.github.com/frenchy64/6631311
20:01ambrosebsBronsa: looks like I do a normal pass of the bindings, and then use the "last" hygienic name for each shadowed binding.
20:05Bronsaambrosebs: yeah, I can't do that the way I implemented it: I can only walk forward
20:05ambrosebsBronsa: damn :/
20:05BronsaI'll just discard the first binding before the pass
20:05Bronsaand not think about it.
20:05Bronsaafter-all it's just a no-op, no reason to keep it in the ast
20:07ambrosebsBronsa: I guess not.
20:10ambrosebsBronsa: worth documenting as a difference IMO
20:11Bronsaambrosebs: yeah
20:43Bronsaugh. APersistentMap implements both clojure.lang.Associative and java.lang.Map; both c.l.A and j.l.M contain the method "boolean containsKey(Object)"
20:47brehauttypehints for all !
20:50callenindigo: not really. I might consider writing an OAuth2 provider for Clojure though.
20:50indigocallen: I found one https://github.com/pelle/clauth
20:51amalloybrehaut: is that relevant? you could call either the Map or the Associative implementation, but since it's impossible for APM to provide two implementations they'll be the same anyway
20:51indigoAlthough build is failing ;P
20:51callenindigo: be sure to report back any victories and problems with it.
20:51Bronsabrehaut: my main wtf is that defrecord doesn't fail with a "Must hint overloaded method: containsKey"
20:51callenindigo: I'd like to know if it's any good. It looks pretty damned old.
20:51brehautamalloy: oh true
20:51indigoYeah, it seems like the author took a hiatus on it
20:51indigoBut the last commit was a day ago
20:51indigoHe might be using an old redis library
20:51callenindigo: barely, that was a tiny change to the project.clj - most things haven't changed since 2 years ago.
20:56indigoWell, no better way to learn OAuth2 and Clojure better than to fix up an old library for it
21:00SegFaultAXindigo: What a coincidence, I was just working on oauth-plugin earlier today.
21:01indigoHaha, nice
21:03SegFaultAXsquashing bugs.
21:03indigoAlways a good endeavor :)
21:09rbxbxweird, I was working on oauth2 stuff this morning as well ._. oauthpocalypse
21:11ddellacostaweird, I was thinking I'd fix this up this weekend: https://github.com/ddellacosta/friend-oauth2
21:13indigoDamn
21:13indigo#oauth2-lovers
21:13ddellacostajust remember kids, the "auth" in oauth2 is "authorization!" *sigh*
21:14indigo:P
21:14ddellacostaactually, I kind of hate oauth2 now that I've dug into it enough.
21:16indigoAnd someone in #startups said that no one gets anything done in Lisp
21:17indigo:|
21:17indigoddellacosta: Yeah? What's wrong with it?
21:19ddellacostaindigo: well, it's more that I hate that it is used--promoted! (https://developers.google.com/accounts/)--as an authentication method, when it is in fact an authorization protocol.
21:20ddellacostaindigo: I am guilty of promoting this misconception by writing a plugin for an authentication library using it. But, someone would have.
21:21indigoHaha :P
21:21ddellacostathe hilarity of that google accounts page is that they clearly state, right next to their "sign in with google" button promoting oauth2 as a way to authenticate your users, that oauth2 is about authorization.
21:22coventryWhat's the terminology in The Reasoned Schemer for the wildcards and list destructuring demonstrated in this example? Trying to understand the principle behind the fact that the wildcard in the second example will only match the minimal possible value of 1. https://github.com/frenchy64/Logic-Starter/wiki#matche-sugar-combining-wildcards-and-destructuring
21:22coventryEr, s/second example/third matche clause/
21:23coventryNo, sorry. Had paged back an example. The *second* matche clause.
21:24ddellacostahaha
21:24indigoIt does say that they use OAuth for authentication and authorization
21:25indigo"Google APIs use the OAuth 2.0 protocol for authentication and authorization."
21:25indigohttps://developers.google.com/accounts/docs/OAuth2
21:25ddellacostaindigo: yes, fair enough, you're right--Google does say that. But tell me what this doc says: http://tools.ietf.org/html/draft-ietf-oauth-v2-22
21:26ddellacostaindigo: sorry, I'll shut up now…this is my own little pet peeve. The battle is already lost with this one.
21:26marco2Is there an alternative to (clj->js ...) in clojurescript?
21:26coventryAnyway, those examples make it clear what's going on in dnolen's tut3. Thanks again, ambrosebs.
21:26ddellacostamarco2: to do what?
21:26indigoYeahhhh... OAuth2 is a cluster
21:27ddellacostamarco2: if you just want to create a JS object, you can use js-obj
21:28marco2ddellacosta: The same thing actually, for some reason it breaks the second time I compile the file with cljsbuild
21:28ddellacostamarco2: hmm…give us a refheap/gist/etc.
21:35nopromptdamn i love it when i clean up some messy/bad code.
21:35bbloomgit rm -r somedir # orgasmic
21:36`cbplein clean till it stops saying it doesn't find the method :)
21:38coventryI guess the idea in that wildcards/destructuring example is that the period symbol represents a cons. Perhaps minimality doesn't enter into it?
21:38`cbpactually i don't love that :|
21:53Bronsais there a (comp butlast butlast)?
22:09marco2ddellacosta: It seems like it has to do with the latest version of clojurescript
22:09marco2https://gist.github.com/MarcoPolo/6632280
22:09noto2http://clojuredocs.org/clojure_core/clojure.core/drop-last
22:10TEttingerBronsa: ^
22:10Bronsa(inc TEttinger)
22:10lazybot⇒ 3
22:10TEttingeryay
22:10ddellacostamarco2: what errors/exceptions do you get with this?
22:13marco2ddellacost: The first compilation yields the expected: {command: "function"}
22:13marco2Subsequent compilations yield: {command: null}
22:13ddellacostamarco2: that compiled just fine for me
22:13ddellacostamarco2: ah, okay
22:13marco2ddellacost: you getting the same thing?
22:20ddellacostamarco2: so, I'm not sure what the issue is. When I compile it and run it in the browser it runs fine for me--it dumps out "Object {command: "function"}" every time.
22:22ddellacostamarco2: and I'm not sure what you mean by re-compiling. Are you talking about re-compiling the CLJS? Do you do a lein cljsbuild clean first, and then re-compile? 'Cause that works fine for me too.
22:33yedihows the machine learning landscape in clojure like?
22:36marco2ddellacosta: Here is the whole project https://github.com/MarcoPolo/test-cljs. I run lein trampoline cljsbuild repl-listen to spawn the webserver, then lein cljsbuild auto
22:37marco2ddellacost: then I modify the core.cljs
22:37marco2ddellacosta: then it fails
22:38ddellacostamarco2: does the compilation fail, or does the compiled JS fail in runtime?
22:39marco2ddellacosta: it compiles successfully, but I think the compiled output is incorrect since the value of (clj->js ...) is incorrect
22:40ddellacostamarco2: post whatever exception/error you are having in a refheap or gist as well.
22:48marco2ddellacosta: there isn't an exception. The first time the file compiles the value of (clj->js {:command "stuff"}) is correctly {command:"stuff"}. when the file is changed (new line added/deleted) it compiles without errors, but the output becomes {command:null}
22:48marco2ddellacosta: Thanks for helping btw
22:49marco2Let me try running it on a different computer...
22:50ddellacostamarco2: you're welcome. I don't think the computer is the issue.
22:51ddellacostamarco2: how are you running this, btw? I see you don't have any handlers setup to load the html--are you just opening the index.html file in your browser? How does it find the javascript?
22:51marco2ddellacosta: with lein trampoline repl-listen, then going to localhost:9000
22:52marco2but reading the file might work too
22:52ddellacostahuh
22:52ddellacostasorry, I guess you said that
22:52marco2no worries
22:54ddellacostaseriously, I really don't know. I guess testing another machine will at least tell you if your environment is out of wack, 'cause right now I'm not sure what is up. I do see the "command": null thing too though, on your code.
22:54marco2Yeah I ran it on another computer, same results.
22:55marco2It might have something to do with incremental compilation from r1877
22:55marco2I'll post a bug on jira
22:57ddellacostamarco2: I kind of suspect this is not it, but have you tried running it not in advanced compilation?
22:58ddellacostamarco2: like, just change optimizations to whitespace and see if that changes anything.
22:58ddellacostait smells a bit like that kind of issue but, again, that's kind of a wild guess.
22:59marco2ddellacosta: Yeah, should have mentioned, it works fine on simple compilation
23:00ddellacostamarco2: ah, okay, that is important. What happens if you name your object something longer than "t" and then compile in advanced?
23:00nopromptdoes anyone beside me wish there were a weekly clojure podcast?
23:01ddellacostamarco2: it could be a namespace collision you're experiencing.
23:01tbaldridgeThe ThinkRelevance podcast is almost weekly sometimes, but that's less Clojure and more general computing
23:02noprompttbaldridge: right. and it's a nice podcast. but it'd be cool if there was something maybe once a week with news/interviews etc. more focused on what's happening.
23:03chordanyone started on a clojure game?
23:03marco2ddellacosta: nope, that wasn't it. I used something-much-longer, but same results. It's also happened when I didn't even bind it.
23:04noprompttbaldridge: wait, isn't the the cognicast now?
23:04marco2chord: As in writing a game in clojure?
23:04noprompt*it the
23:04nopromptmarco2: no. he's a troll.
23:04ddellacostamarco2: alright, I'm out of ideas. I've got to get back to work, but good luck figuring this out. Sorry I couldn't help more!
23:05marco2ddellacosta: No worries, thanks so much! I'm following you on github btw!
23:05chordmarco2: noprompt is just mad that he gave up on the game in clojure idea so quickly
23:06marco2ddellacosta: it worked find in r1859 but not r1877 so I suspect incremental compilation is to blame
23:06marco2chord: I did a game in clojurescript, it was awesome!
23:06ddellacostamarco2: ah, okay. Interesting…will have to take a closer look then.
23:06ddellacostamarco2: Thanks for the follow! :-)
23:06noprompttbaldridge: there was mostly lazy, but cemerick, i guess, i probably too busy to update it consistently.
23:07chordmarco2: you can help us make starcraft clone in clojure
23:09frozenlockArrrg.... I stop using Clojure for 6 months and 'lein clojars' stops working >.<
23:11gfredericksfrozenlock: lein holds grudges
23:12chordmarco2: you gonan help with starcraft clone?
23:15frozenlockAnd now it asks for a gpg key. :(
23:16frozenlocktechnomancy: I suppose it's your doing? :p
23:16marco2chord: I'd love to, but I have school + work :(
23:23ddellacostaknow of any examples of FRP written in ClojureScript using core.async?
23:25chordmarco2: you're already failing school so you might as well work on starcarft clone
23:26frozenlock"Uberjar aborting because jar failed: zip file is empty" o_O
23:36frozenlocklein deps ----> java.util.zip.ZipException: zip file is empty
23:37frozenlockIs there something new in Lein that I should know about?
23:37ddellacostaseems like most of what I'm reading regarding FRP assume you are using a typed system (since all the papers use Haskell, this is unsurprising). I'm having trouble sorting out what is *
23:38ddellacosta…core in FRP from what results from the type-system
23:38ddellacostaor, maybe that is core
23:38coventryfrozenlock: You may have corruption in your ~/.m2.
23:38frozenlockcoventry: Thanks, I'll try to wipe it clean
23:39frozenlockI must say, lein is faster than before! (or it's just my newer machine..?)
23:41coventryHas anyone read ztellman's sleight? I'm having trouble understanding why he bashes the core/pr-on var in a delay. Is there something running earlier in lein which depends on the canonical behavior of pr-on? https://github.com/ztellman/sleight/blob/master/src/sleight/reader.clj#L19
23:45frozenlockcoventry: Nope :(
23:45frozenlockI think I screwed something when I tried to upload one of my dependencies using lein-clojars
23:48frozenlockLein deploy says that it can't sign the jar... I think it just stops there rather than uploading an unsigned jar
23:56frozenlock"To disable signing of releases, set `:sign-releases` to false in the `:repositories` entry you are targeting." Where is :repositories? Do I need to create a profiles.clj for that? :-/
23:56coventryIt seems unlikely that that scenario would cause the lein deps error you saw.
23:57frozenlockI pretty sure I somehow managed to corrupt the last jar I uploaded to clojars, because when I try an earlier version everything works fine.
23:58frozenlock*I'm