#clojure logs

2012-02-14

00:00ibdknoxit just works ;)
00:00lynaghkheh
00:00ibdknoxalso, CLJS is a bit slow for animations without a lot of work :(
00:00lynaghkI try to stick with CSS transitions though, because they are much faster
00:00lynaghkespecially on mobile devices.
00:00ibdknoxalso good ^
00:00lynaghktransformZ(0) FTW
00:01jhowarthAh ok. I was messing around with ClojueScript One yesterday and I liked their approach to events/animations. Was wondering if that stuff was in a library somewhere.
00:01justinlilly_homehow do you short circuit a return value in a clojure method?
00:01justinlilly_homeie: "If you invalidate <precondition> return X now"
00:02lynaghkibdknox, what did you think about David's suggestion that CLJS requires stuff should be built into lein?
00:02justinlilly_home(if (not (cond)) nil) is roughly what I'd do in java, but nil just noops rather than returns.
00:02ibdknoxlynaghk: the libs/externs stuff?
00:02lynaghkyeah
00:02ibdknoxlynaghk: I think it's reasonable
00:02ibdknoxwith the latest cljsbuild using jayq is pretty darn simple
00:03ibdknoxwith some sort of manifest it really will "just work"
00:03ibdknoxseems like a reasonable solution
00:03lynaghkI just forwarded you the email I sent him
00:03lynaghkbecause I hit "reply" instead of "reply all"
00:03lynaghkyeah, I just cut Cassowary CLJS into a JAR and everything seems to just work if you include the js path
00:03tmciverjustinlilly_home: you mean you *don't* want to return nil if precondition fails?
00:04ibdknoxlynaghk: yeah. I have no idea what foreign-libs is
00:04ibdknoxalso we shouldn't tell people to package libs with their apps
00:04tmciverjustinlilly_home: if you do want to return nil, just wrap your function body in an if: (if (cond) ;; do stuff
00:04ibdknoxif they're already widely CDN'd
00:04technomancyjustinlilly_home: you can't do it without putting both the success and short-circuit clauses in the tail position
00:04lynaghkso, besides jQuery
00:04ibdknoxgoogle has a couple others, but yeah
00:05justinlilly_homeahh. interesting.
00:06lynaghkibdknox; Eh, I think you might be biased as an excellent web practitioner. I'd rather err on the side of having things packaged so that libs just work.
00:06lynaghkPeople who are in a situation where using CDNs would matter already know about that, and can take the appropriate steps.
00:06ibdknoxthat's fair
00:07lynaghkBut for people who just want to get the library and start playing around, I don't want them to get tripped up because they're offline or some such.
00:07ibdknoxyeah
00:07lynaghkbut yeah, it's about build tools---we've been using CLJS just by calling the compile function (no cljs-build), because it's incorporated into a different toolchain.
00:09jhowarthidbknox: Animations with jayq are pretty slow?
00:09jhowarthibdknox: ^
00:10ibdknoxjhowarth: no, they're very fast because they use jquery's JS :)
00:10jhowarthCool I'll check it out.
00:11lynaghkibdknox, did you ever get around to profiling ClojureScript when you were building out those animations?
00:11technomancywow, golang straight up refuses to version dependencies
00:11technomancyif you want an old version, you copy it into your codebase: https://groups.google.com/forum/#!msg/golang-nuts/tLsxO2S4yoQ/VUrYr5q4RUMJ
00:13Scriptorwell, that's nuts
00:13Raynestechnomancy: Excuse me?
00:13lynaghkibdknox, the reason I ask is because I recall your gist showing how slow (doseq) is compared to a JS for loop. I was under the impression that loop/recur would be way faster, but that hasn't been my experience.
00:13technomancy"Conversely, if you find yourself in a situation where your code needs version 3.1 of a library and cannot work with newer versions, you need to make your own copy of that library: it's moved on without you."
00:14Raynestechnomancy: Is this a joke?
00:14ibdknoxlynaghk: monet has a "fast" loop
00:14technomancyit's always bugged me that golang's selling point is "it's static typing that you won't hate!" as if that's something new they're bringing to the table.
00:15Raynestechnomancy: How do you feel about Rust? I really like it.
00:15justinlilly_hometechnomancy: imo, its typed python that's faster.
00:15justinlilly_homeor perhaps "python for people who like pointers"
00:15RaynesPython is the comparison?
00:15Scriptortyped python?
00:15justinlilly_homeRaynes: I meant golang, sorry.
00:15RaynesI know.
00:15technomancyRaynes: haven't bothered to give rust a glance
00:15RaynesStill, Python is the comparison?
00:15Raynestechnomancy: Go do it. You might be surprised.
00:16Raynestechnomancy: http://rust-lang.org/
00:16technomancyI think people compare it to python because that's often the only language they've used that hasn't filled them with rage.
00:17technomancyRaynes: is that the mozilla one?
00:17RaynesI have to say, Ruby filled me with far more rage than Python did.
00:17RaynesYes.
00:17RaynesLook at the feature rundown there. It's fairly interesting.
00:17technomancy"Compilation model batch, ahead-of-time, C/C++ compatible" <- is that code for "no repl"?
00:18RaynesHaha, I think so, yes.
00:18technomancyok, not interested
00:18lynaghkibdknox; the loop/recur on canvas.cljs#126?
00:18RaynesStill, there are interesting ideas there.
00:18technomancyif you don't have a repl you should at least have the decency to be embarrassed about the fact
00:19technomancynot put it first on your features list
00:19technomancy"Type inference yes, only local variables" <- double-yawn
00:19technomancyat least go's inference can usually cross function boundaries
00:20Raynes"immutable by default, mutability is the special case"
00:20Raynestechnomancy: ^ If that doesn't set it apart from most 'systems' languages, I'm not sure anything ever could.
00:21ibdknoxlynaghk: yeah
00:21technomancymeh; not when ocaml has had decades poured into its compilers
00:21RaynesWell then
00:21RaynesI apologize for making you waste your time with this obviously utter garbage. ;)
00:21technomancy"Error handling: unrecoverable unwinding" <- seriously, I get the feeling they are not trying very hard on this feature list
00:21technomancy"CL-style conditions? yeah, those are cool. we don't have them."
00:21RaynesThanks for ruining my excitement. Dream killer.
00:21technomancyhaha
00:22Raynesamalloy_: Want to go talk about death and paint our fingernails black now?
00:23technomancyhttp://images.wikia.com/scottpilgrim/images/8/8f/SP3_sex-bob-omb_id.jpg
00:23RaynesI remember that scene of the movie.
00:24lynaghkibdknox: yeah, the slow looping burned us a little on an iPad visualization project we just shipped. We're about to start up a larger analytics project though, and I am definitely interested in figuring out where these performance issues are coming from
00:24lynaghkeven in my own cljs code, so I can drop to JS if required.
00:25lynaghkbut as it stands (as far as I'm aware) there isn't any metadata on the complied JS that'll point back to the cljs source to determine hotspots.
00:26Raynestechnomancy: http://www.youtube.com/watch?v=mL-qx-Y_15M&amp;feature=related
00:26technomancyhandy link!
00:58tylergilliesim studying lambda calculus and it defines zero as \sz.z does that mean that any function that takes two arguments and returns the second one is === zero?
01:06Apage43tylergillies: not as such
01:06Apage43those are church numerals; http://en.wikipedia.org/wiki/Church_encoding
01:07Apage43its a way of implementing arithmetic on top of lambda calculus
01:09tylergilliesApage43: thnx
01:47devnprotocols support [x & xs] right?
01:47amalloyno
01:47devnhaha, that makes more sense
01:47amalloyunless by that you mean three args: x, &, and xs
01:47devn:) no
01:47devnthanks alan
01:49devnamalloy: how's the clojuring?
01:49Raynesamalloy: I'm totally gonna use mustache for templates, I think.
01:49RaynesMustache has some cool things I didn't even know about.
01:49devnClostache?
01:50RaynesStencil.
01:50devnRaynes: im guessing you know about it already, but if you haven't seen it this seems to be under active development as well: https://github.com/fhd/clostache
01:51RaynesYep, it's under active development because I shat on the lib on twitter because I didn't know he followed me. I'm pretty ashamed about it.
01:51Raynes:p
01:51RaynesIt's spec compliant now, but stencil is still faster.
01:51devn:\
01:52RaynesContext: I thought he knew it wasn't spec compliant and was a little angry that he had them list his implementation on the official website. Turns out, he didn't even know there was a spec.
01:53RaynesShoulda seen me blushing.
01:53Raynes;)
01:53devnRaynes: either way, there's so much bitching in our communities
01:54devnit makes it sort of amazing to me that people continue to contribute to open source when i see some of the flames people get
01:54devnRaynes: not an enlive fan?
01:55devnRaynes: going to clojure/west?
01:55devnhow about euroclojure?
01:55RaynesWell, I didn't flame him.
01:56Raynestl;dr re: enlive: I found a bug. No one cares. Slightly annoyed, but meh, life goes on.
01:56RaynesCan't afford clojure/west. Certainly can't afford euroclojure.
01:56RaynesI'd love to go to Euroclojure
01:56devnsubmit a talk!
01:56RaynesI could have talked at c/w. I decided not to because I need to work on my book more than I need to go to conferences. It's sad, but true.
01:57devni missed the CfP
01:57devn:(
01:57RaynesEuroClojure is super duper tempting though.
01:57devneuroclojure has a sort of weird CfP IMO. maybe it's fairly normal, but i've never seen it.
01:58devnyou submit, they rate it, you resubmit to address how you will get it from their rating to a better rating, something like that
01:58RaynesThe only way I could go to euroclojure is if they paid for my travel which would be an insane thing to even hope for. I don't even what to know what that plane ticket would cost.
01:58devnnot that crazy, honestly.
01:58devni don't think they'll have 100 US clojure devs there
01:58RaynesI'd only do it if brehaut was going.
01:58RaynesI'd do it just to meet him.
01:58devn:D
01:58RaynesCool guy, that one.
01:59devnRaynes: i want to submit, but i am always hopping around about what i'd talk about
01:59RaynesI've got so many things I could talk about.
02:00RaynesI'd like to do a talk about Clojure editors.
02:00RaynesThat'd be cool.
02:00RaynesDo a demonstration of Emacs, Vim, IDEA, CCW, etc. Explain the benefits and disadvantages of all of them.
02:00devni think the stuff i want to talk about has to do with community building
02:01RaynesAaron Bedra's talk was close to that at the first conj.
02:01RaynesIt was well accepted, I think.
02:01devni started a clojure meetup in Madison, WI a year and a half ago. no one showed up but my friends for a couple of months, but i made it my business to keep showing up. we've been getting spikes, but the average is now around ~10 people
02:02devni want to tell people: you live in sibera. who cares? put up a flyer and wait. if you build it, they will come.
02:02RaynesI don't think that applies where I live at the moment. :p
02:02devni did no serious organizing. the only thing i've done is bought beer.
02:02RaynesThe people who show up would be doing so to ask me what computers are. ;)
02:02devnRaynes: so start an online meetup group.
02:02devn:)
02:03devnunite! organize!
02:03sCriptorsome place where all may gather and converse online
02:03devnsCriptor: this is not a meetup
02:03RaynesAn online meting group? Isn't that called IRC? :p
02:04devnnah, there's so much to be gained from interacting with other meat bodied creatures
02:05RaynesThat sounded kind of sexual.
02:05devnIt was meant to be.
02:05RaynesOh man.
02:05devnOh boy.
02:05devnSo...uh...
02:05RaynesI've been an adult for less than two weeks and you're already hitting on me.
02:05RaynesHave you no shame?
02:08sCriptordamn kids
02:11devnsCriptor: damn salt and papper neck beards
02:11devnpepper*
02:11Raynes'papper' has more of the effect you wanted. Sounds more oldmanish.
02:12devn*nod* -- good call
02:13devnit's like "warshing machine"
02:13devnpapper, figs, warshin' dishes, etc.
02:14RaynesWow, man. Mustache can do things I never knew.
02:14RaynesI figured it'd be insane to use it for HTML templating, but I'm slowly being convinced otherwise.
02:15RaynesFunfact: refheap will not load at all in IE 5.5
02:16RaynesIE 6 destroys the rendering but the site is functional.
02:16amalloytry AOL 1.0
02:16Raynesamalloy: I can't :(
02:16Raynesbrowserling doesn't have it
02:17RaynesRefHeap works in most browsers save for minor rendering quirks. BrowserID on the other hand supports only modern browsers. But that's perfectly fine for me, because I don't care if it even renders in IE9.
02:17amalloyfor reference, http://www.reddit.com/r/funny/comments/o7bxs/reddit_isnt_working_for_me_in_internet_explorer/
02:18RaynesAs long as it renders in ffx, chrome, safari, android browsers, and opera. All recent versions.
02:18RaynesWell, screw opera.
02:18RaynesThough it does render in it, I just don't care about opera.
02:18Raynesamalloy: That's awesome.
02:29GertmHi. I installed clojure through my package manager and I have 1.3 now. But when I install clojure-swank through leiningen, it brings in a clojure 1.2 jar, won't that cause problems?
02:37raekGertm: the clojure version you can install with your package managager isn't used by any tools, afaik
02:37raekGertm: you control the clojure version in the project.clj file of your project
02:37Gertmso,.. it's not a good idea to install it through the package manager?
02:38raekit's not very useful, no
02:39GertmSo what would be the best way of doing it?
02:39devnRaynes: we need a better haml-esque solution for clojure
02:39raekuse leiningen
02:40raekyou don't install libraries you want to use in your code (Clojure counts as a "library"...), you just specify them in your project.clj and let Leiningen fetch them for you
02:40Raynesdevn: That's kind of antiwhatiwant
02:40raek(leiningen plugins are often installed, though)
02:41Raynesdevn: I want HTML templates. If I were going to use haml, I'd just use hiccup.
02:41raek(through leiningen)
02:41devnRaynes: tell that to your designer
02:41RaynesNot sure I follow
02:41devndesigners don't write hiccup
02:41RaynesThey don't write HAML either.
02:42raekGertm: also, Leiningen will use Clojure 1.2 for its own process, but that doesn't affect you if you use Clojure 1.3 in your project
02:42devnRaynes: they almost certainly don't write hiccup whereas they might be willing to work with HAML
02:42RaynesI… guess.
02:43Gertmraek: but I want to use it with SLIME, won't it cause problems then?
02:43RaynesI'm not convinced I like HAML though. I'll have to look into it more.
02:43devnRaynes: ever use it?
02:43RaynesNo, which is why I need to look into it more.
02:44ibdknoxlol
02:44devnlook, i don't fucking *love* haml
02:44devnbut it's better than tinkering with straight HTML
02:44raekGertm: no, swank will run in your project process, which will use whatever version of clojure you specify in the project.clj
02:45devnibdknox: what don't you like about it?
02:45raekthat Leiningen uses Clojure 1.2 under the hood is an implementation detail
02:45Gertmok, I'll just give it a go and see what happens
02:45raekyou only need to be aware of that if you are hacking on a leiningen plugin or leiningen itself
02:45Raynesdevn: It seems like indentation-based HTML that is even more difficult to read.
02:46Gertmraek: not going to do either of those, so I should be fine :-)
02:46raekGertm: be sure to follow the official tutorials. there are a lot of outdated howto blog posts
02:46devnRaynes: without qualifying that statement im going to call BS
02:46RaynesThat's your basic human right.
02:46devnRaynes: even more difficult to read than what? why is it difficult to read?
02:46raekhttps://github.com/technomancy/leiningen
02:46raekhttps://github.com/technomancy/swank-clojure
02:46devnsure it's not the lack of familiarity creeping up on you?
02:47ibdknoxit's pretty hard to read
02:47devncompared to what?
02:47ibdknoxand yes, I've used it
02:47RaynesCompared to HTMl.
02:47RaynesHTML*
02:47RaynesThe tags are less obvious and it looks like indentation matters, maybe?
02:48RaynesBut hey, I've definitely never used it.
02:48devnindentation does matter. but why wouldn't i want a hierarchical document like HTML to be indentation-sensitive?
02:49RaynesSeems like it would be difficult to restructure a large document.
02:49devnthat's a symptom of a different problem
02:49RaynesBad editors?
02:50devnlarge document -- where are the modules? partials?
02:50RaynesWell, regardless -- it's pretty hideous.
02:50devnyou know, people say that about lisp
02:50devnso smug
02:50ibdknoxlol
02:50ibdknoxyou're awfully dogmatic about this
02:50RaynesCompared to? HTML, XML, whatever. It's just ugly.
02:50RaynesWell, maybe it's just me.
02:50RaynesI'm certainly not going to be smug about it.
02:51RaynesIt isn't as simple as "Omg there are parentheses there."
02:51devnibdknox: i find it equally ridiculous that it's okay to be dogmatic about syntax and what not
02:51ibdknoxhm?
02:51ibdknoxnot sure I follow
02:51devnibdknox: im not sure i formed a complete sentence
02:52devnibdknox: what i meant was: i read something like: "it's hideous" and I cringe
02:52devnbecause it's superficial
02:52ibdknoxI'm not sure I understand how that's superficial
02:52ibdknoxwhile it may not be the most reasoned response, it hints at a number of very important things
02:53RaynesI don't understand.
02:53devnibdknox: so what do you think about most peoples' reactions to parens in lisp?
02:53RaynesIf syntax isn't important, than why not prefer HTML over HAML?
02:53ibdknoxin CL? I completely agree
02:53RaynesIsn't the whole point of HAML to have a *better* syntax, regardless of how terrible I think it is?
02:53devnha, now we're getting somewhere
02:53ibdknoxhow code reads is arguably one of the most important aspects of language
02:53ibdknoxa language*
02:54RaynesLet's take Clojure and replace all parens with square brackets and all square brackets with parens and see how many people are interested in the result.
02:55devni understand that's rhetorical
02:55devnbut i honestly don't know which side you're arguing for
02:55RaynesI don't think I was ever arguing for either side.
02:55devnthat could reinforce an argument both for and against
02:55RaynesIf I was, it wasn't intentional.
02:56RaynesI think HAML is hideous. If you feel it necessary to invalidate my opinion because you feel syntax is superficial then that is definitely a personal choice.
02:56devnso it's a genuine question? as in: we should replace them and try and get a head count of who wants to use an inverted clojure?
02:56RaynesI don't care either way. :>
02:56RaynesIt'd be interesting.
02:56RaynesThe inverted Clojure experiment, I mean.
02:57devnRaynes: im not invalidating your opinion, but i've heard this complaint so often: SOAP sucks, XML sucks, and so on
02:58ibdknoxthey *do* suck
02:58ibdknoxlol
02:59RaynesSOAP sucks *because* XML sucks, doesn't it?
02:59Raynes*shrug*
02:59RaynesEverything sucks.
02:59devnso what is the alternative?
02:59devnJSON?
02:59clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
02:59RaynesA nice trollface, probably.
03:00ibdknoxhaha
03:00RaynesXML serves its purpose.
03:00devnRich said it himself at Clojure conj: What does XML have that clojure data structures don't? The X.
03:00RaynesXML serves its purpose, but it's ugly.
03:01RaynesCould I do it a better way and make it less ugly? No, probably not.
03:01devnyes but now you're just proving my point -- ugly < utility
03:02RaynesBu...
03:02Rayneswhat is this i dont even
03:02devn"i'm not even supposed to be here today"
03:06devnibdknox: Raynes: I want to be clear that I'm not saying HAML is the answer to our prayers or something, or that it isn't ugly. I just have a hard time hearing that it's "hideous" without anything to qualify that remark
03:06RaynesOkay.
03:08ibdknoxlol
03:08Rayneshttp://h.images.memegenerator.net/instances/500x/14567447.jpg
03:09devnbahaha
03:09ibdknoxhahaha
03:09ibdknoxwell done :p
03:11devnhttp://memegenerator.net/instance/14567514
03:13devnhttp://c.images.memegenerator.net/instances/500x/14567514.jpg
03:13RaynesHeh
03:13Raynesdevn: That website is like the best invention ever, btw.
03:14devnheh -- it's awesome until someone writes a bot to facilitate the generation of them in your company's private channel
03:15devni still get a kick out of a lot of them, but im dead to philosoraptor at this point :)
03:20devnRaynes: ibdknox: Sorry if I over-reacted there. I live in Wisconsin and it's cold here. I hope I see you guys at Clojure/west.
03:20RaynesYou'll certainly see ibdknox.
03:20RaynesAnd no harm done.
03:20Raynes$conditions 35554
03:20lazybotLast Updated on February 14, 2:02 AM CST; Mostly Cloudy; Dewpoint: 37 F (3 C); Precipitation today: 0.27 in (7 mm); Temperature: 38 F (3.3 C); Windchill: 35 F (2 C); Wind speed: 4mph; Wind gust: 6.0mph; URL: http://www.wunderground.com/US/AL/Eldridge.html.
03:20devn$conditions 53703
03:20lazybotLast Updated on February 14, 2:00 AM CST; Light Snow; Dewpoint: 27 F (-3 C); Precipitation today: 0.00 in (0 mm); Temperature: 28 F (-2.2 C); Windchill: 21 F (-6 C); Wind speed: 6mph; Wind gust: 6.0mph; URL: http://www.wunderground.com/US/WI/Madison.html.
03:20RaynesNot as bad as the 19F from last night.
03:21devnMy Wind gust is bigger than your Wind gust.
03:21Raynesdevn: You can give him $forecast and he'll give you NOTICEs about your forecast.
03:21devn$forecast
03:21RaynesWell, you need to give him a location. :p
03:21devn$forecast 53703
03:21RaynesUnfortunately I haven't planted my GPS chip on you yet.
03:22devnThat seems like exactly the kind of thing someone would say if they *had* planted a chip on me.
03:22Fossi-2 celcius is not cold :>
03:22RaynesI've been had!
03:23RaynesIt's cold if you aren't a bloody eskimo. -.-
03:23devnFossi: I guess what I meant by cold is: My winter anger is flaring up. I'm not meditating enough or something. Damned seasonal depression and all of that...
03:23devn</overshare>
03:23RaynesI should meditate.
03:23RaynesUnfortunately, I can't really sit still, ever.
03:23Fossiyou should take vit D ;)
03:23RaynesMuch less relax.
03:23devnFossi: I do! :)
03:23Fossiexcellent :)
03:24devnRaynes: If you're ever interested pick up Jon Kabat-Zinn's CDs, the first set. Also, check out his talk: http://www.youtube.com/watch?v=3nwwKbM_vJc
05:06skadyHi everybody. Is anybody actually reading or are all people just idling? ;-)
05:07raekskady: it's night in the US :-)
05:07RaynesI live in the US.
05:07RaynesI'm also awake at this ungodly hour.
05:07skadyWell, this does not mean that nobodys reading
05:08vijaykiranonly bots .. no one's reading :)
05:08skadyLast time I checked computer science guys loved to work at night ;-)
05:08RaynesMan, I have a job.
05:08edoloughlinQuiet down, please. I'm trying to get some sleep!
05:08RaynesIt doesn't involve academia. I need my sleep.
05:08RaynesI'm just busy being awesome and stuff.
05:09skadyStop being tired, be awesome instead! :-)
05:10skadyAnyway, I'm really interested in trying Clojure and would like to make use of it for a simple web app. But I'm lacking argumentation to defend this choice (part of bachelor thesis). My app involves a certain amount of concurrent tasks, so this a good reason to go for clojure as far as I read.
05:11vijaykiranis there any restriction which lang to use or something ?
05:11skadyBut other than that, I'm having a hard time finding further reasons to go for it (from a supervisors point who knows that I could just have done it with existing Java knowledge)
05:11skadyvijaykiran: No, not at all. Just want to have good reasons for my architecture :-)
05:11skadybut it's kinda hard to argue when you know so little about the language and ecosystem
05:11vijaykiranfunctional - lispy - concurrent - and JVM
05:12vijaykiranand no bloated frameworky stuff
05:13skadyAlright, so that's also what I have read only. Is there any reasons why so many people are actually getting interested in Clojure now? I mean, lisps have been around for quiet some time
05:13skadyonline*
05:14ejacksonskady - argue that you're a student, and as such need no justification for learning.
05:14vijaykiranapart from it is awesome - it is modern Lisp on JVM
05:15vijaykiranthat's why I'm interested in it though - different people might have different opinions
05:15skadyejackson: This would work for normal university projects, but this thesis is done in cooperation with a company whose employees might (probably not...) need to maintain it. Of course it is one argument for such an architecture decision.
05:16Raynesskady: Clojure is the first new and unique Lisp that has emerged in a while. It became popular because it is an extremely well-designed language and is backed by the JVM which means libraries and infrastructure galore.
05:16ejacksonyou're not an employee, you're a student, ergo: department of somebody else's problem.
05:16skadylike that one :)
05:17skadyRaynes: Thank you, guess I can use some of this information.
05:18lucianskady: a big reason people tend to like clojure is the data structures, and the literals
05:18ejacksonskady: in seriousness, just argue that Clojure provides all the upside of java in production, combined with significant clarity and ease of use improvements.
05:19lucianscheme is very clean and nice but small, and common lisp is practical but horrible. clojure tends to be in the middle
05:19skadyIf you would have to choose some simple webframework for clojure, what would you go for? Note: I don't need a full-blown web stack, but merely a simple web frontend for my application. I also need to have thread control (so that webframework should discourage it).
05:20skadyShould not discourage..
05:20vijaykirannoir seems to be recommended a lot
05:20vijaykiranI just pick the libraries on my own - enlive, moustache etc.
05:21RaynesI've learned to love mustache tonight.
05:21skadylucian & ejackson: Guess I can go with this. Thanks a lot :)
05:21ejacksonClojure FTW, baby.
05:21skadyAre you refering to the templating system mustache?
05:21vijaykiranno, the routes DSL
05:22vijaykiranenlive is the templating system I like
05:22vijaykiranmoustache: https://github.com/cgrand/moustache
05:23ejacksoni use ring and enlive
05:23RaynesI'm a big fan of the templating system.
05:23RaynesAs of tonight, I'm a much bigger fan of it than Enlive.
05:23RaynesAt least for what I'm using it for.
05:24raekskady: It could be worth checking this out: (noir builds on top of many of these libs) http://brehaut.net/blog/2011/ring_introduction
05:24skadyraek: Thank you
05:25skadySo ring seems to provide basic HTTP routing.
05:25skadyGuess ring + some tempate mechanism would suffice for the moment :-).
05:25vijaykiranring provides HTTP "abstraction" layer
05:26vijaykiranI guess you need either compojure/moustache to make your life easier
05:26vijaykiranto define the routing
05:27skadyOh, the compojure example looks very simple.
05:28ejacksoncemerick: Delorean monster truck !!! LMFAO
05:28cemerickseriously
05:28skadyWell, I guess this all helps a lot. Thank you all very much for your help. Will try too learn more about clojure first and then experiment with a few of these technologies.
05:28ejacksonmy day is complete, i'm going back to bed.
05:30Raynescemerick: So I read the mustache manual tonight.
05:30Raynescemerick: Turns out, it's about a 1000 times better than Enlive for what I was doing anyways.
05:31cemerickyou should use that, then :-)
05:31RaynesI totally am. It's why I'm up at 4:30AM.
05:32cemerickI figured you were just in a particular cycle of your sleep schedule rotation or something. :-P
05:32cemerickStill waiting for the One True Templating Solution.
06:29GertmLet me repeat the question for after the netsplit :)
06:29GertmVersions differ: 2012-01-06 (slime) vs. 20100404 (swank). Continue? (y or n) <- is this a problem?
06:32ArafangionGertm: "the" netsplit?
06:33RaynesGertm: Does hitting 'n' make it work?
06:33GertmArafangion: yes, didn't you hear? It was legen.. wait for it..
06:33RaynesGertm: Does hitting 'n' make it work?
06:33GertmLemme try.
06:34GertmAh, found the problem. Emacs was loading the quicklisp slime.
06:35GertmProbably best to move my common lisp setup to a different file if I'm doing clojure.
06:36RaynesI was going to be snarky and say "Well, there's your answer." if you had told me it worked.
06:36RaynesBut yes, the CL setup is not compatible with the Clojure setup in almost every situation.
06:36GertmNow I have to ask, why is this using such an old version of slime?
06:37RaynesYour best bet is to completely separate the configurations.
06:37RaynesBecause the SLIME guys never release anything and like making breaking changes every half a second.
06:37GertmCan't argue with that.
06:38Raynes:p
06:38Gertm:)
06:39RaynesBut yeah, it's just a really fast moving target and it's generally impossible to follow the development and still work reliably. At least, that's what I've heard. I don't actually work on that stuff.
06:39GertmOk, now I'm set up, let's start learning this language, shall we? :)
06:39RaynesWoot
06:40GertmI'm a little scared though.
06:41RaynesYou can do it.
06:41RaynesBe a man.
06:41GertmIt's the jvm that scares me tbh.
06:42GertmI know nothing about it.
06:42RaynesThe JVM is over there and you're over here. Just don't look it directly in the eyes and you should be just fine.
06:42RaynesMan, my analogies must have scared cemerick away.
06:42GertmSounds like a plan!
06:47RaynesOh man.
06:47RaynesThese mustache templates + Clojure are so elegant. I need a towel.
06:48RaynesThis was worth staying up until 6AM to do.
06:48RaynesEverything you CTCP me, God kills a kitten.
07:00tsdhI have some print-method defmethods for some classes, instances of those classes are now printed as I like them to have. Well, except for objects that are not printed but (implicitly) str-ed first, like in (format "%s" foo). Is there a way to have print-method activated also for stringifying objects except for invoking print-method myself with a StringWriter or so?
07:00Rayneshttp://d.images.memegenerator.net/instances/500x/14571907.jpg
07:01RaynesGoodnight fellow Clojurians
07:01ejacksongoodnight Mr Raynes.
07:06tsdhAh, print-str is my friend.
07:12GertmDoing (doc doc) in the slime repl throws a stacktrace at me, is this normal?
07:12cemerickdon't know about SLIME, but (doc doc) should work
07:12cemerick,(doc doc)
07:12clojurebot"([name]); Prints documentation for a var or special form given its name"
07:13GertmWhen I do it at the command line it works fine.
07:15cemerickyup, it should always work
07:15cemerickGertm: you've been using SLIME with other lisps?
07:15GertmI have, but I disabled the configuration.
07:15GertmIt works fine for everything else.
07:16cemerickOK. I don't use SLIME, but everything I've heard is that you should be prepared to be SOL if you use it with multiple lisps.
07:16GertmSOL?
07:16cemerickshit outta luck
07:17Gertmhmpf, lemme clean up my .emacs a bit more
07:17ejacksonGertm: have you done (use 'clojure.repl) ?
07:17Gertmejackson: in the slime repl? no
07:17cemerickejackson: should that be necessary? It's implicit in clojure.main/repl…
07:18Gertmejackson: well that solves it, thanks a lot! :)
07:18ejacksonyeah, you need to do that to get doc, it hung me out for a while too :)
07:18ejacksoncemerick: yup, necessary.
07:18GertmAs long as there is a solution to the problems, all is well.
07:18cemerickThat's really suprising.
07:19GertmCan I make slime execute that on startup?
07:19dEPyWorkhey guys
07:19dEPyWorkI was doing 4clojure and I'm stuck at flattening...
07:20dEPyWorkIs there a better option than going trough all elements and adding them to result list?
07:20ejacksoncemerick: yeah, it was so surprising that I submitted a bug report on leiningen... oopsie :)
08:08jsabeaudryIs there a facility for evaluating a form with a timeout?
08:09jsabeaudryAh, too early to ask questions like that!
08:10jsabeaudry;)
08:10osa1how can I create a function with an optional parameter?
08:10Fossiosa [foo & body]
08:10Fossiif you want variable param count
08:11cemerickjsabeaudry: you want evaluation to halt if the evaluation goes past the timeout?
08:11kmicujsabeaudry: can you give an example?
08:11Fossiif fixed just (defn ([] (print 1)) ([a] (print a)))
08:11jsabeaudrycemerick, I want to throw a TimeOutException
08:13osa1I'm trying to list files in a folder, (. (File. path) (listDir)) doesn't return me a clojure data structure, is there a way to do this with just clojure functions?
08:13jsabeaudrykmicu, sure, I want to provide a repl in my webapp (but not sandboxed, I understand the risks) however if I compute something too long by mistake I would like it to timeout
08:13cemerickjsabeaudry: The short answer is that you can execute code via a future and deref it with some timeout, but that future will continue to process even if the deref timeout expires.
08:14cemerickjsabeaudry: The long answer is that you want something like the interruptible-eval in nREPL. https://github.com/clojure/tools.nrepl
08:15jsabeaudrycemerick, The short answer is something like this? http://osdir.com/ml/clojure/2010-02/msg00913.html
08:16cemerickjsabeaudry: Yup; but again, evaluation will continue past the timeout.
08:16cemerickthe timeout only applies to the attempt to deref the future, not the evaluation
08:17jsabeaudrycemerick, Ok, I understand, thank you very much, I'll study interruptible-eval
08:19cemerickjsabeaudry: FYI, I'll be releasing an HTTP Ring handler/transport for nREPL soonish.
08:38jheandergood morning!
08:40jheanderI've just upgraded to leiningen 1.7.0 and now have problems that lein jar and lein deploy first cleans my working directory and re-runs lein deps. This clears out the "classes" dir that contains compiled protobuf files which are then missing from the jar. How can I solve this? Should I add some hook to the project.clj?
08:41jheanderusing clojure-protobuf 0.6.0-beta7 to compile the protobuf definitions...
08:42kmicujheander: Good morning at 3 pm :)!
08:43jheanderisn't it always morning on the internet? :)
08:43lucianof course it is
08:44dunibkmicu: good morning at 11:47pm!
08:45dunibI think it's easier just to say "good day", even if it's night time, it's wishing you a good tomorrow.
08:45dunibGoodmorrow is an option, but it sounds far too old-timey
08:45jheander:)
08:46luciani believe the convention is to always function on local time
08:46kmiculucian: Clojure docs not specify that.
08:46lucianso if i join a channel and it's morning, i'll say good morning
08:46luciankmicu: irc-tiquette does :)
08:47kmiculucian: give me the source :)
08:47jheanderkmicu: http://thinkmoult.com/ugt.html
08:48kmicumea culpa! ;]
08:48luciansee, it works
08:48lucianwe've just spent that time explaining UGT instead
08:49jheanderhaha! :)
08:51jheanderso anyone know how to work with hooks in leiningen 1.7.0? The clojure-protobuf code contains a nice (add-hook) but it doesn't seem like its invoked. Either because it hookes on a target that I don't run or because the hook is never loaded. Tried adding :hooks [leiningen.protobuf] to project.clj, but it does not make a difference...
08:54jheanderor, actually: adding :hooks makes the hook trigger correctly when running "lein javac", but it seems "lein javac" is not run during "lein jar"...weird :)
09:08samaaronafternoon all
09:08ckirkendallwell not all its morning here :)
09:09samaaronah, but there's only one true time: GMT ;-)
09:10samaaronbut if you want to pretend it's morning, then fine :-p
09:12osa1what are differences between binding and let?
09:12ejacksonhello samaaron
09:13samaaronejackson: howdy goodly sire
09:14cemerickosa1: let establishes named locals, binding establishes thread-local bindings for vars
09:15kmicuosa1: http://clojuredocs.org/clojure_core/clojure.core/binding
09:23samaarondoes anyone have any experience using native libs using more recent versions of lein?
09:24samaaroni've been using cake for the last year or so for this task - but i'm looking to move back to lein
10:06octeis there a way of checking if a variable is something iterable, like a vector/seq?
10:07TimMcocte: coll?
10:07octethanks
10:07TimMcocte: It's a little complicated, actually.
10:08TimMcYou can "iterate" over nil, and if you call seq on certain things you get back soemthing iterable
10:08octeTimMc, well, yes, but i want to know is if i can pass it to apply
10:09TimMc&(apply str "hello")
10:09lazybot⇒ "hello"
10:09TimMcocte: What you really want to know is, "Does seq accept this?"
10:09TimMcand there's not currently a clean way of finding out.
10:20octeTimMc, ah.
10:21octe&(seq? "hello")
10:21lazybot⇒ false
10:21octe&(coll? "hello")
10:21lazybot⇒ false
10:21octemhm, afer thinking about it, i do want to know if it's some kind of collection and can be used with apply
10:21octecoll? seems to work for my use
10:27kmicu&(ancestors (class "hello"))
10:27lazybot⇒ #{java.lang.Object java.io.Serializable java.lang.Comparable java.lang.CharSequence}
10:34kmicuocte: &(source coll?)
11:00raf_hello, I have what might be a stupid question. I want to read in a map from a file and bind it to a var. What is the easiest way to do that.
11:01ejacksonraf_: define it in the clj file
11:02ejackson(def my-var {:a 1 :b 2}) in my-data.clj. Then (use 'my-data.clj)
11:02TimMcraf_: Is this for a config file?
11:02raf_yes its config with db credentials
11:02TimMcYou can (read-string (slurp "file.clj"))
11:03TimMcand (binding [*read-eval* false] ...) around that if you don't trust the file.
11:03jsabeaudryIs it possible to have a security.policy file to be usable from both the uberjar and a source tree?
11:03raf_ok so does read-string eval the stirng?
11:03raf_bc i tried just slurp
11:03TimMcraf_: No, but see (doc *read-eval*)
11:03ejacksonTimMc: that's cute.
11:03raf_ok thanks guys!
11:04TimMcejackson: That's what she said.
11:04ejackson_)
11:06jsabeaudryLet me put it another way, is there a way to reference a file that is in the jar when specifying jvm-opts ?
11:06raf_awesome, it all works now. Thanks TimMc and ejackson
11:07TimMcjsabeaudry: I believe in Java-land there is a convention for that, like path/to.jar!path/inside.file
11:07TimMcs/convention/syntax/
11:08jsabeaudryTimMc, Are you aware of a way to "embed" jvm opts "in" an uberjar ?
11:09TimMcjsabeaudry: beyond catting a file to the fornt, no.
11:09TimMc*front
11:09TimMcYou might look at Manifest.mf specs
11:11jsabeaudryTimMc, Alright, I'll check that out, thanks!
11:21TimMcjsabeaudry: Can you do something sneaky like have a jar inside a jar and trampoline into that?
11:22TimMcjsabeaudry: And there's this, but I don't know enough about Java security to tell whether it is what you want: http://www.javakb.com/Uwe/Forum.aspx/java-security/606/Policy-file-in-a-Jar
11:24jsabeaudryTimMc, I guess that kind of trickery could possibly work but as of now it was more a matter of convenience than requirement. I'm taking note of that link though in a low priority issue :) good find!
11:54ejacksonits so great !
11:54seanmwhat is it? Don't think I've seen that before
11:56ejacksonaah, its the coolest
11:56ejacksonits -> but as soon as anything returns nil, the whole thing stops and returns nil
11:56achengsshort circuiting -> on nil
11:56seanmoh that is hot
11:56ejacksoni don't want to say its a monad.... only it is.
11:57ejacksonin effect
11:57cemerickit's not
11:57ejacksonbut I don't want to get battered by smart people, so I'm not going to stick to those guns
11:57cemerick:-P
11:57ejackson^^^
11:57seanmhaha
11:57seanmI'm with ya there
11:57cemerickejackson: see http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/
11:58achengsside question: what's the basic reason a domonad doesn't show up in a stack trace? it must be simple but I don't get it yet
11:58cemerickalso, see fnil for an oft-ignored nil-related fn
11:58ejacksonfnil !
11:58ejacksonsomething new
11:58ejacksonachengs: is domonad a macro ?
11:58achengsyes
11:59ejacksoncemerick: that's highly useful, thanks.
12:00achengsif I bind symbol foo to the result of a state-m domonad, isn't foo bound to a fn that takes a state and returns [value new-state]?
12:04ejacksonachengs: FWIW: I'm not good with this stuff and I don't have the particulars to hand, but a macro gets evaluated at read-time, so probably won't be around when the stacktrace is thrown. That will be on the code it outputs.
12:05seanmI think that's correct, it probably shows up in a stack as gensym's depending on how the macro's written
12:05achengsejackson: yes. so I was thinking foo never sees the domonad macro, but instead sees the fn left behind... and then gets bound like in an ordinary defn so when I call foo I thought I should see foo in the stack trace
12:06ejacksoni got nothing
12:06achengsI see m_bind's instead which are all on the same line (where the monad was defined) which is less useful.
12:07seanmI have pretty much 0 experience with stack traces in binds unfortunately
12:07seanmmaybe I should start messing with that
12:18jsabeaudryRegarding clojail, I granted java.security.AllPermissions but I am still getting FilePermission exceptions? Anyone encountered that problem?
12:23jimduey_acheng: You've got it right. Stack traces with domonad are pretty hard to trace through.
12:24Bronsai wonder why fnil isn't implemented like this https://gist.github.com/1828382
12:26jimduey_ejackson: -?> is very similar to (domonad maybe-m ...) in effect. Except maybe-m lets you bind the results of the various stages to symbols for use later. Similar to a nested series of when-let's.
12:27achengsjimduey: it might dissuade me from using monads for my current use case (framework for maintainers of tests which fail often due to dev work)... I guess the answer is this: a domonad leaves behind a do statement with m_bind's and m_results... and since this is not a fn, then binding foo to this and calling foo won't cause foo to show up in the trace
12:27ejacksonjimduey_: that's what I was intimating earlier, but knew there were brickbats about :)
12:27jimduey_:)
12:28ejacksonthe unwary inaccuracy is fatal in this town
12:28achengsejackson: and I'm guessing a proper monad can be combined or transformed as expected vs -?>
12:28ejacksonzakly
13:07dEPyany1 can help me with my compress function? http://pastie.org/3382433
13:07dEPyit's for http://www.4clojure.com/problem/30
13:07dEPyAnd I get OK result except the first item is not there in the final list
14:09technomancyweird; monitor-enter and monitor-exit are special forms
14:09technomancynever noticed that before
14:10robinkraftI'd like to create a comma-separated string by joining a few integers with a vector. the following works, but I know I'm missing some simple combination of map/reduce/apply that would make this more elegant.
14:10robinkraft(let [lat 90
14:10robinkraft lon -180
14:10robinkraft series [1 2 3]
14:10robinkraft j (partial join ",")]
14:10robinkraft (j [lat (j [lon (j series)])]))
14:11robinkraft(let [lat 90
14:11robinkraftcrap, sorry about the line breaks
14:12emezeskeIn case anyone needs another example of why package signing is a good thing: http://dev.horde.org/h/jonah/stories/view.php?channel_id=1&amp;id=155
14:12robinkraftgist here: https://gist.github.com/1829381
14:12TimMcrobinkraft: You want to turn [1 2 3] into "1, 2, 3" ?
14:12robinkraftUltimately I'd like "90, -180,1,2,3"
14:13ibdknox(join "," (concat [lat lon] series))
14:14TimMcrobinkraft: Wait, *sometimes* with spaces?
14:14robinkraftthat should do it!
14:14TimMcemezeske: https://github.com/technomancy/leiningen/issues/31 :-(
14:14robinkraftno, never with spaces
14:14clojurebotI don't understand.
14:15robinkraftibdknox: thanks!
14:15technomancyTimMc: regular maven signing just involves uploading a .asc file alongside your jar
14:15technomancyit doesn't necessarily mean placing any new files inside the jar from what I gather
14:15emezeskeTimMc: That's pretty cool.
14:16technomancyemezeske: we're considering having the next-gen clojars accept signed uploads only for releases.
14:16technomancyassuming we can make the signing process seamless
14:17technomancy(FSVO seamless)
14:17TimMctechnomancy: Oh, nice!
14:17technomancyTimMc: seems like issue 31 is pretty easy to solve just by adding more entries to :uberjar-exclusions, right?
14:18TimMctechnomancy: You already accepted a patch for that, silly.
14:18emezesketechnomancy: That's great. I had seen some arguments against that in here, but I think it is a very very good idea.
14:18technomancyTimMc: yeah, but the comments have someone mentioning a new issue
14:18TimMcemezeske: Yeah, signed jars as dependencies were annoying the hell out of me. I don't know if there's a good story for signed deps in uberjars...
14:18TimMcOh, really?
14:19technomancyTimMc: I asked for more clarification, just ignoring it till I hear more
14:19technomancysince the workaround is easy
14:19ritrerobinkraft: You can use list* instead of concat.
14:19technomancyemezeske: mind if I ping you once I pick up the signing issue? sounds like you've got some opinions on it. =)
14:19ritre&(clojure.string/join "," (list* 90 -190 [1 2 3]))
14:19lazybot⇒ "90,-190,1,2,3"
14:19TimMcrobinkraft: Your example output had sapces. *shrug*
14:20emezesketechnomancy: Sure! Not sure how much help I'll be though. :)
14:20robinkraftTimMc: sry bout that, I didn't notice. thanks for looking though
14:22robinkraftritre: appreciate the hint - that's exactly the level of generality I need
14:28jkdufairtechnomancy: jack_in.clj breaks in cygwin due to win/unix path issues and the use of (System/getProperty "user.home"). i'd love to fork and fix it. any ideas on how to even approach this?
14:29technomancyjkdufair: hm; not really, I haven't used cygwin.
14:30technomancyI know cygwin's inconsistency regarding home has caused a lot of issues in Leiningen itself
14:31jkdufairis it worth having an abstraction for that?
14:32technomancyunix doesn't have to cost money =)
14:32foodoo(Linux)
14:32jkdufairand can't afford a machine that can run a decent vm
14:32jkdufairfor linux
14:32technomancy"No one should be denied access to unix because of lack of funds."
14:33technomancysounds like a human rights declaration or something
14:33jkdufairof course, there's dual boot. bleh
14:33technomancyhappy to take a patch, I just don't know enough about the problem to advise.
14:33jkdufairok thx
14:36emezeskejkdufair: Yeah, dual boot is no fun. It's annoying knowing that there is a Windows partition next to your real OS.
14:36TimMc:-)
14:36emezeske:P
14:36jkdufairyeah cygwin works so well but alas there's no java for cygwin
14:37TimMchaha
14:37jkdufairEmacsOS. Now we're talking.
14:37jkdufairdidn't that used to exist at some point?
14:37TimMcemezeske: I don't mind too much, but then... the Windows partition on my laptop is actually a honeypot for thieves.
14:37ibdknoxnot nearly as efficient as vimOS ;)
14:37emezeskeTimMc: hahaha
14:37technomancyTimMc: thieves and border-crossing agents
14:37technomancyI guess it's more like dual-booting Emacs and Mozilla
14:42TimMctechnomancy: Correct.
14:42TimMcAnd hopefully they don't notice the big ol' encrypted Linux partition.
14:44alexykgiven a dec and a sequence of indices, how do I most elegantly get the seq of the elements of dec at those indices?
14:45technomancya vec?
14:45TimMc"dec"?
14:45TimMcdeque?
14:45technomancy(map my-vec [0 24 95 255])
14:46ibdknox(map my-vec (map dec indices))
14:46ibdknoxall possible interpretations of that question :)
14:47emezeskeibdknox: Have you had a chance to glance at https://github.com/ibdknox/crate/pull/1 yet?
14:47ibdknoxemezeske: yep, seems reasonable
14:47TimMctechnomancy: "You can't." :-P
14:47alexyk(dec …) what's wrong with you people! :)
14:47lazybot⇒ -1
14:47alexykvec
14:47alexykLion is evil
14:47emezeskeibdknox: Cool. I'm already using a bunch of that stuff in my closed-source project, and it's great
14:48ibdknoxemezeske: there are a couple other improvements I want to make at the same time
14:48TimMcalexyk: Oh, you should have mentioned you had a writing impediment!
14:48emezeskeibdknox: Ah, nice
14:48alexykTimMc: Lion has it, it's getting serious
14:48technomancyalexyk: "It looks like you're trying to chat on IRC. Would you like me to replace what you type with nonsense?"
14:48TimMcWe would have been more sensitive.
14:48technomancythe return of clippy!
14:48ibdknoxso I'll merge that in and add those at the same time and release 0.2.0
14:49alexyktechnomancy: so I need selection of a vector at given indices. Will your map still apply?
14:49ibdknoxI must not have that magical lion setting
14:49emezeskeSounds good. I'll be happy to iterate on that stuff if you have any concerns.
14:49technomancyalexyk: sure
14:49ibdknoxmy text does not get autocorrected
14:49technomancymagical lion setting sounds like an RPG quest
14:49TimMc&(map (vec (range 10 20)) [1 5 9])
14:49lazybot⇒ (11 15 19)
14:52jsabeaudryibdknox, emezeske, Is there any project that serves as an example of hiccup, crate and cljs-build crossovers?
14:53jsabeaudrynot separately but in synergy
14:53emezeskejsabeaudry: my closed-source project :( :(
14:53ibdknoxI haven't had a use for crossovers yet
14:54emezeskeI use crossovers for a few things, my favorite of which is a macro that defs html IDs and their selectors at one time
14:54emezeskeSo my server-side hiccup code uses the ID and my client-side stuff uses the selector
14:55emezeskeNo more typo-ed mismatches! :)
14:55ibdknoxI find that most of my errors in Clojure stem from typo'd keywords
14:55ibdknox:/
14:55technomancyso ur/web actually uses the compiler to ensure that every link within the webapp goes to an existing handler
14:55technomancyit's actually able to guarantee no 404s
14:56emezeskeyeah, I actually do also share my url-building code with crossovers
14:56emezeskeI dunno about guaranteeing no 404s ;), but less maybe
14:57augustlis there a document I can read to grok repositories and all that jazz in leiningen? Never used maven, java, etc. https://github.com/twall/jna seems to assume I already know how to do it.
14:57technomancyaugustl: try "lein help tutorial"
14:58augustlthanks
15:05augustltechnomancy: hmm, I can't seem to find any relevant information there
15:06augustlI still don't understand what I need to do in order to add jna to my project.
15:06augustlthe jna readme mentions no repositories, does that mean it's probably not in any repository?
15:08technomancylein search might tell you
15:09technomancyif they've published it on clojars or central then it would be reasonable not to mention it in the readme, but it's also possible they've simply neglected to publish it if they aren't expecting anyone to use it
15:09jsabeaudryaugustl, You want want to check how clojure-jna did it https://github.com/Chouser/clojure-jna
15:10augustlcan I somehow tell leiningen to use https://github.com/downloads/twall/jna/jna.jar?
15:11augustland not look for it in a repo
15:12augustlodd, clojure-jna has no package.clj
15:12technomancyclojurebot: repeatability?
15:12clojurebotrepeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability
15:12technomancyaugustl: see "Free-Floating jars" at the link above
15:12augustlah thanks
15:12dEPy,(concat 1 2)
15:12clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
15:13augustltechnomancy: so I'll have to write my own shell script and use curl, or something like that?
15:14augustlI've no problem trusting the github link
15:15technomancyaugustl: like it says, if you need it to work on more than one machine, you need to put it into a repository; otherwise use lein-localrepo
15:17technomancyaugustl: also report a bug with the project
15:18augustlit seems lein-localrepo is just an util for fetching etc, I can't add the URL to the jar in my project.clj, correct?
15:19Apage43these are all wrappers around Maven. If you want to be able to depend on it in a project.clj it has to live in a Maven repo somewhere.
15:19augustlhmm, it is here http://repo2.maven.org/maven2/net/java/dev/jna/jna/3.4.0/
15:20augustlas net.java.dev.jna, instead of com.sun.jna
15:20augustlsould I use that one then?
15:21augustlthen there's http://search.maven.org/#browse|-2700344 but that's a very old version
15:21Apage43http://search.maven.org/#search|ga|1|jna
15:21technomancydepends on the project
15:22augustlApage43: 3.0.9 is very old
15:22Apage43the net.java.dev.jna on maven central was uploaded on 21 Dec
15:22Apage43it's 3.4.0
15:22Apage43http://search.maven.org/#artifactdetails|net.java.dev.jna|platform|3.4.0|jar
15:22augustlyeah, but is it the same package? Who knows..
15:22Apage43github.com/twall/jna is the URL listed in the pom
15:23augustlhmm, maven can't find the artifact with "[net.java.dev.jna "3.4.0"]" in my project.clj
15:24augustlthis is hard :)
15:24TimMcwrong spec
15:24TimMc[net.java.dev.jna/platform "3.4.0"]
15:24TimMcaugustl: ^
15:25augustlah, there's an artifact id there too
15:25augustlthanks
15:25Apage43er
15:25Apage43you prolly want [net.java.dev.jna/jna]
15:25Apage43http://search.maven.org/#artifactdetails|net.java.dev.jna|jna|3.4.0|jar
15:25Apage43i linked to the wrong thing
15:26augustlah, that seems to work
15:35clj_newbRegular expressions define regular languages over unicode characters. Now, I want to define a regular language over arbitrary objects. Is there a library for this? [I have a vector of objects, and I want to know if it matches a certain abstract pattern.]
15:36TimMcI think I've seena lib for this in Java.
15:36foodooclj_newb: out of curiosity: What kind of things do you want to check? Something like vec[0].foo=4 && vec[1].bar=9 ?
15:37clj_newbI'm pattern matching keystrokes
15:37amalloyyou should invest in learning fnparse. it's more powerful than regexes (it's a full parser), and it lets you use anything as your tokens
15:37clj_newbso I have this WYSIWYG editor, and I need a way to define key bindings
15:38clj_newband I want to describe key bindings as regexes over key events (basically modifiers + characters)
15:38clj_newbamalloy: does it parse CFGs?
15:38TimMcIt's a full parser.
15:38amalloyit probably parses contextual grammars as well
15:38clj_newbhmm, EBNFs are equiv to CFGs right?
15:39TimMcI don't see why not.
15:40foodooclj_newb: I wonder if you approach the problem in a too complex way. Won't maps also work with the key symbols being the map-keys?
15:41foodooclj_newb: or do you plan to implement something as complex as Emacs or Vim bindings?
15:42clj_newbI'm going for something as complicated as emacs/vim
15:42foodooclj_newb: so we will soon have a new contestant for the best editor of all times :D
15:43clj_newbmore like another editor with 1 user
15:43TimMcclj_newb: SO use Emacs' or vim's command algorithms.
15:44TimMcMultics Emacs, for instance, has recursive lookup tables.
15:44clj_newbTimMc: besides the source code, are their algorithms documented anywhere?
15:45clj_newbactually, why don't I define my key short cuts
15:45clj_newbas a stack laguage
15:45clj_newblike a miniforth
15:45TimMcFinite State Machines
15:46TimMcclj_newb: Probably? I read about it somewhere...
15:50jaimefso I remove all references to clojure*jar, and run lein and it bombs on "main" java.io.FileNotFoundException: Could not locate leiningen/core/main__init.class
15:56TimMcjaimef: Whoa, back up.
15:56RaynesHahaha
15:57Rayneshttps://refheap.com/paste/750 Immortalized.
15:58TimMcRaynes: You need a new hobby.
15:58RaynesIt's true.
16:04superjudgeQuestion: I am looking at ways to create a sort of REST "transit" thingy, i.e. something that offers a REST API to the "outside", and makes calls to another REST API on the "inside". The purpose is wrap the inside interface to present a simpler interface to the outside, and to make some transformations of the results obtained from the inside interface. I am fairly new to doing "real" stuff in Clojure, and it has been a while since
16:04superjudgedid any Java work, but I seem to remember that servlets are not very suitable for making outbound HTTP calls. I have been looking at compojure, compojure-rest, and Noir, and they all seem very nice for creating "terminating" services, but it is not obvious to me if there is a reasonable way of doing "transits". Any pointers would be highly appreciated.
16:05superjudgeIn this particular case it is actually an instance of elasticsearch that sits on the "inside", and I wish to offer a simpler interface and mangle the query results somewhat.
16:05cemericksuperjudge: You want a decent HTTP client. Try https://github.com/dakrone/clj-http
16:08superjudgecemerick: Yeah, I actually played with that, but will it play nicely to just make outbound HTTP calls in a "handler" (I don't know the correct term here, but I mean making outbound calls from something that I assume is essentially a Java servlet)? It won't wreak havoc with threading models and whatnot?
16:09cemericksuperjudge: well, whether you make a call synchronous with the handling of the inbound request depends on a lot of factors that are hard to generalize without knowing the semantics of the HTTP apis involved.
16:10cemerickYou can certainly call out and block on the response to the API you're wrapping if need be.
16:10cemericki.e. it's not going to break anything; will certainly be more resource-intensive than performing calls asynchronously, but it might be the only correct way to do things.
16:11superjudgecemerick: Yes, I assume that would be what would happen if I do not take any other measure than just do, say, an outbound "get" or "put" with clj-http?
16:12cemericksuperjudge: you may have no choice if you need to ensure certain semantics.
16:13cemerickIf the operations involved were idempotent, then you could fire and forget, but otherwise…
16:15superjudgecemerick: yeah, but I guess also in the case where I actually want to get a response back, transform it, and then send the transformed response back as the response of the original, incoming request, there is some fairly involved stuff to map things together in an async model, I guess. And I guess it also depends a lot of the actual network and "dispatching" model of the underlying servlet container.
16:17hiredmansuperjudge: have you seen drewrs elasticsearch client?
16:17hiredmanhttps://github.com/drewr/esperanto
16:17superjudgecemerick: but anyway, cool, I'll do some more tests with clj-http tomorrow, and I shall also dig a little bit in the documentation of Tomcat and Jetty
16:18superjudgehiredman: no, that one I haven't seen, I'll certainly check it out! Thanks!
16:18cemericksuperjudge: I wouldn't worry too much about tomcat or jetty; I'd expect them to be a non-factor (or, they should be).
16:23superjudgecemerick: yeah, I was just thinking from the perspective of whether you could actually do outbound calls non-blocking and hook into the network handling code of e.g. Tomcat or Jetty. But maybe I am way off from how they are actually implemented? It is obviously much simpler to just make blocking outbound calls, I am just curious on what alternatives there could be.
16:24superjudgeAlso, I have done some Node.js coding lately, which has obviously twisted my mind in strange and unforeseen ways...
16:24cemericksuperjudge: "network handling code"?
16:25cemerickTomcat and Jetty likely have no infrastructure for making outgoing HTTP calls.
16:26yaziriansounds more like http server push
16:26cemerickoh, I see
16:26yazirianwhich i know nginx has modules for, probably others do too
16:26cemerickThey both support asynchronous response, a la comet IIRC
16:26ibdknoxwhy not just use netty?
16:26ibdknoxnon-blocking from the ground up
16:27cemerickThat doesn't really save you anything resource-wise though; you're still going to be chewing up a thread making the external HTTP call.
16:27ibdknoxas in making an http call out of the app?
16:27yaziriandepends on the implementation, those calls can be aggregated into something nio-based
16:27ibdknoxthat can be done nio too
16:28ibdknoxnetty is a generic networking platform
16:28superjudgeibdknox: is netty also a servlet container? Does it work with things like composure? Sorry, as I said, I have been away from the Java world for quite some time...
16:28lucianis it like twisted in scope?
16:28yaziriancertainly doesn't need to be 1:1 ratio of threads to back-end requests
16:28ibdknoxsuperjudge: compojure you mean? Yes, I have examples of Noir on netty
16:29superjudgeibdknox: Oh, that sounds interesting!
16:29ibdknoxyeah, you can think of it as a much more mature node.js
16:31jaimefTimMc: back up?
16:31superjudgeSo, what I am basically driving at is just this, i.e. is it possible to both have these pretty nice frameworks like compojure AND the efficiency of non-blocking network layer, but without all the nasty callback stuff of Node.js (and a much nicer language, like, say, Clojure).
16:32superjudgeI'll absolutely have a look at netty then.
16:35ibdknoxsuperjudge: you should check out Noir :)
16:37superjudgeibdknox: Yes, I've actually played with that as well, and it is really nice!
16:38superjudgeI still haven't figured out fully on what different levels the popular "framework" operate on, and how much I need for just doing REST stuff, but I already did some simple REST things on Noir, which actually worked very well and was very simple.
16:39ibdknoxsuperjudge: Noir is built on compojure and is just a very thin abstraction to make it easier to organize and deal with writing stuff in compojure
16:41ibdknoxif you don't use any of the other stuff Noir provides, it's basically at the same level just with a slightly more flexible syntax :)
16:41brehautsuperjudge: if you dont mind me pimping my own stuff: http://brehaut.net/blog/2011/ring_introduction
16:41brehaut(it doesnt cover noir (sorry chris))
16:41ibdknoxbrehaut: I cry at night on the days I see this ;)
16:42brehautibdknox: its on the list of things to do!
16:42ibdknoxit's a great rundown of it. superjudge it's worth the read
16:42brehauthonest
16:42superjudgebrehaut: he, he, I actually just found that blog entry like 10 minutes ago or so! Seems very good, I am reading it now...
16:43superjudgeGot to go put the kids to bed now, but thanks a lot everyone, I now have some new leads to follow!
16:43brehautsuperjudge: the code *should* all work with clojure 1.3 and the more recent versions of all the libraries but i havent completed testing all that yet
16:45superjudgebrehaut: sounds great, I'll continue going through it tomorrow. I'll let you know if I find anything not working!
16:45brehautthanks
16:47seancorfieldbrehaut: if you do decide to update that blog post, maybe you could refer to clojure.java.jdbc instead of clojure.contrib.sql?
16:47brehautseancorfield: oh right. very good point
16:48brehautseancorfield: i'll do that right now so as not to forget
16:50seancorfieldi'll overlook the lack of FW/1 coverage there, but like ibdknox, i too cry at night about it :)
16:51ibdknoxNoir was out when he wrote it :p though it was a baby then :)
16:51brehautseancorfield: FW/1 didnt even exist for clojure when i wrote that did it? noir i actually chose to omit
16:51seancorfieldbrehaut: i'm just teasing :) yeah, the article predates the clojure port of FW/1...
16:53brehaut:)
16:53seancorfieldi started it in late may '11 but got stuck trying to work with enlive in early june and put it aside until after the conj
16:53ibdknoxbrehaut: out of curiosity, why *did* you omit it? Just because it was so new?
16:54brehautibdknox: newness and the article was also already monsterously long
16:54ibdknoxtrue that
16:54brehautid been working on it for about 4 months when i decided to just post the damn thing
16:54Raynesbrehaut: 4 months?
16:54Raynesbrehaut: Dude, I write all my blog posts in one or two days.
16:55RaynesYou need discipline.
16:55seancorfieldheh, i have blog posts partly written that have laid around for months
16:55brehautyeah. i started it in feb, and posted it in june?
16:55ibdknoxlol
16:56seancorfieldi just looked at the FW/1 commit history - i had that convo with cemerick at Strange Loop and "re-launched" FW/1 a few days before the Conj, it seems...
16:56seancorfieldone day i'll actually get ppl using it :(
16:56seancorfieldmaybe i can bring some of my FW/1 CFML communit over to Clojure with it :)
16:56ibdknoxmore Clojurians! :D
16:57seancorfieldthe original CFML version is widely used... and the most watched / most forked CFML project on github (or it was last time i looked)... which is a bit sad really...
16:57technomancyhaving just written lein-scalac
17:10mi6_x3mhello
17:10mi6_x3mI am an enterprise Java dev
17:10mi6_x3msick of writing down every data type
17:10mi6_x3msince I am also a scientific research guy I though id give clojure a try
17:10mi6_x3mwill it help me overcome my rage?
17:11amroyou must search deep inside yourself for that
17:11foodoomi6_x3m: That partly depends on yourself
17:11technomancyit will help you channel your rage in productive ways
17:11mi6_x3mwell I am working with F# and it helps me a lot, I expect the same from clojure
17:12alexykhow do you concatenate a bunch of strings adding "\n" in between?
17:12technomancyclojure.string/join
17:12foodoomi6_x3m: Maybe you should start playing around on http://4clojure.com The first puzzles are pretty simple even for non-Clojorians
17:14mi6_x3mId rather know if I can easily interface with existing Java libs
17:14mi6_x3mHybernate, say
17:14mi6_x3mlog4j etc.
17:14mi6_x3mi.e. how "practical" is clojure
17:15foodoomi6_x3m: http://clojure.org/java_interop
17:15foodoomi6_x3m: that's how you can work with practically every Java lib
17:16brehautseancorfield: http://brehaut.net/blog/2011/ring_introduction fixed
17:16mi6_x3mfoodoo: thank you!
17:16mi6_x3mseems to be the right thing to learn then
17:17alexykgiven a list of words, what's the idiomatic way to get a map of word counts?
17:18amalloy&(dor frequencies)
17:18lazybotjava.lang.RuntimeException: Unable to resolve symbol: dor in this context
17:18amalloy&(doc frequencies)
17:18lazybot⇒ "([coll]); Returns a map from distinct items in coll to the number of times they appear."
17:20chewbrancami6_x3m: I highly recommend watching some of the clojure videos, such as http://blip.tv/clojure/clojure-for-java-programmers-1-of-2-989128
17:20mi6_x3mchewbranca: I got a nice book to read :)
17:20mi6_x3mor do they talk about something eles than a language introduction
17:20seancorfieldmi6_x3m: at work we use Clojure as a general purpose dynamic scripting language for the back end of our Internet dating platform
17:21mi6_x3mseancorfield: cool
17:21seancorfieldso we're doing a lot of practical stuff with it - persistence, html email generation, xml, json, logging, log file analysis, interacting with 3rd party rest apis etc
17:22mi6_x3msweet than I am definetely starting with it
17:22foodooseancorfield: do you have a blog about this stuff?
17:22seancorfieldyou can read about some that here: http://corfield.org/search/real+world+clojure
17:22chewbrancami6_x3m: the design and pragmatic decisions made in clojure greatly influenced my interest in the language, a lot of thought went into the features of the language itself, so its interesting to hear it straight from Rich Hickey's mouth
17:23seancorfieldfoodoo: yeah, i blog about clojure a lot :)
17:23foodooseancorfield: bookmarked
17:23seancorfieldthe clojure stuff is all here: http://corfield.org/cat/clojure
17:40dnolenhmmm ... seems like there's some real interest in ClojureScript from the various JS communities
17:42ibdknoxdnolen: oh?
17:45TimMcjaimef: Yes, there was no context in your question, it was impossible to tell what you meant by "removing clojure*jar". I'm heading out to dinner right now though, so I probably won't see your response.
17:46TimMc&(let [] (require '[clojure.string :as s2]) s2/join)
17:46lazybotjava.lang.RuntimeException: No such namespace: s2
17:46TimMc&(do (require '[clojure.string :as s2]) s2/join)
17:46lazybot⇒ #<string$join clojure.string$join@548695>
17:46TimMc&(do (require '[clojure.string :as s3]) s3/join) ;; just to make sure...
17:46lazybot⇒ #<string$join clojure.string$join@548695>
17:47amalloysubforms of 'do forms at the top level are treated as separate top-level forms
17:47TimMc^ Is that behavior because a top-level do's subforms are independently read and eval'd...
17:47TimMcOK, thanks. :-)
17:51technomancyTimMc: aka the gilardi scenario
17:58scgilardi-I happened to be looking up progn in the common lisp hyperspec today. I smiled when I saw "If progn appears as a top level form, then all forms within that progn are considered by the compiler to be top level forms." (precedent for something like the special handling done by clojure's do when it's top level)
17:58robinkraftCan anyone recommend particularly good tutorials/readings on recursion in Clojure? I can follow along in examples, but I have a lot of trouble modifying them or rolling my own.
17:58robinkraftI need to make a collection monotonically increasing. (mono-inc [3 1 5]) ==> [3 3 5]. This seems ripe for loop/recur, but per my earlier question I'm still having trouble wrapping my head around that form.
17:59robinkraftI thought something like (apply max (partition 2 1 [3 1 5])) might work, except that this throws an error (probably for obvious reasons for a non-newb): clojure.lang.LazySeq cannot be cast to java.lang.Numberclojure.lang.LazySeq cannot be cast to java.lang.Number
17:59robinkraftIt's also incomplete - I need to retain the max, and so I can use it to compare with the next value in the vector. So it's sort of a moving maximum with replacement.
18:00robinkraftI could really use suggestions on how to approach this
18:01arohnerrobinkraft: what do you want mono-inc to do? I don't understand the example
18:01aperiodicwell, (apply max (partition 2 1 [3 1 5])) fails because partition returns a list of lists, so applying max to that fails because max doesn't accept lists as args
18:02robinkraftarohner: if I have a series of integers [1 5 4 3 2 6 7], I want to build a vector of the maximum of a moving window of 2 elements. So compare 1 and 5, keep 5, compare 5 and 4, keep 5 again, etc. The result would be [5 5 5 5 6 7]. I'll deal with the 1 at the beginning elsewhere
18:03arohnerrobinkraft: that sounds like a job for reduce
18:04brehaut(defn mono-inc [s] (second (reduce (fn [[max v] i] (let [new-max (Math/max max i)] [new-max (conj v new-max)])) [(first s) []] s)))
18:04robinkraftaperiodic: thanks. how would you recast the result of partition so apply max doesn't throw an error?
18:05brehauti think i might have misread the problem though
18:05jkkramer,(rest (reductions max [1 5 4 3 2 6 7]))
18:05clojurebot(5 5 5 5 6 ...)
18:05robinkraftbrehaut: that worked. Still reading through it though
18:05arohnerjkkramer: wow!
18:05robinkraftarohner: seriously!
18:06robinkraftjkkramer: nice!
18:06jkkramer:)
18:06robinkraftholy cow that blows my mind.
18:06jkkramerbasically a translation of his description: "compare 1 and 5, keep 5, compare 5 and 4, keep 5 again, etc."
18:06hagnaafter thinking it over I'm going to get the joy of clojure just in case anyone cares :)
18:06brehautjkkramer: oh, nice :)
18:07brehauti always forget about reductions
18:07robinkraftok, so I'm glad to have dodged loop/recur again, but I could still use some schooling on that. any favorite blog posts, book chapters, etc.?
18:07hagnarobinkraft: maybe the joy of clojure has it
18:08aperiodicrobinkraft: well, you could map (apply max %) over the result of parititons
18:10robinkrafthagna: thanks, I'll check it out
18:10Apage43it would still be broken for the actual problem though
18:11robinkraftaperiodic: thanks, that indeed is the way to go
18:11robinkraftApage43: righto, but at least it does something! I'd rather it do unexpected things than give me errors
18:11brehaut,(let [s [1 5 4 3 2 6 7]] (map max s (rest s)))
18:11arohnerrobinkraft: recur goes back to the top of fn, calling the fn with the arguments supplied to recur
18:11clojurebot(5 5 4 3 6 ...)
18:12arohner'loop' is exactly like let, except that if there's a recur inside the loop, it goes to the loop rather than the top of the fn
18:12Apage43right. loop is a let you can recur to.
18:13brehaut,(let [s [1 5 4 3 2 6 7]] ((comp (partial apply map max) (juxt identity rest)) s))
18:13clojurebot(5 5 4 3 6 ...)
18:13hagnarobinkraft: yeah me too
18:13hagna,(println "what's a coma for?")
18:13clojurebotwhat's a coma for?
18:14robinkraftok, the fog is beginning to burn off. so the loop [] form defines which arguments need to be supplied in the recur form
18:14hagna,(println "s/coma/comma")
18:14clojurebots/coma/comma
18:14Apage43robinkraft: right. And their values the first time through.
18:14brehaut,((comp (partial apply map max) (juxt identity rest)) [1 5 4 3 2 6 7])
18:14clojurebot(5 5 4 3 6 ...)
18:14brehautfinally
18:17robinkraftHA!
18:17robinkraft(loop [myvec [1 2 3]
18:17robinkraft outint 0]
18:17robinkraft (if (= 0 (count myvec))
18:17robinkraft outint
18:17robinkraft (recur (rest myvec) (inc outint))))
18:17robinkraft,(loop [myvec [1 2 3] outint 0] (if (= 0 (count myvec)) outint (recur (rest myvec) (inc outint))))
18:18clojurebot3
18:18robinkraftawesome! thanks gang.
18:18robinkraftI'll do useful things in the future :)
18:25alexykhow do I sort tuples [[1 2] [2 3]] first by 2nd and then by 1st position?
18:28alexyki.e. making keyfn for sort-by?
18:32brehaut,(sort (fn [[a1 a2] [b1 b2]] (compare [a2 a1] [b2 b1])) [[1 2] [2 1]]) ; alexyk
18:32clojurebot([2 1] [1 2])
18:33brehautwhoa there colloquay
18:33alexykdo descending in 2nd?
18:33brehautalexyk: ?
18:34brehautdo you mean you want the order reversed?
18:34alexykhow do we invert order in a given position?
18:34alexykyes
18:34brehaut,(sort (fn [[a1 a2] [b1 b2]] (* -1 (compare [a2 a1] [b2 b1]))) [[1 2] [2 1]])
18:34clojurebot([1 2] [2 1])
18:34brehautthats reversing all of it
18:34alexykonly the sorting order in the 2nd position pls :)
18:34brehauti guess you could also flip the arguments to compare
18:35alexykor 1st, breaking the ties
18:35brehaut,(sort (fn [[a1 a2] [b1 b2]] (compare [a2 b1] [b2 a1])) [[1 2] [2 1]]) ; ?
18:35clojurebot([2 1] [1 2])
18:35alexykfirst by 2nd asc, then 1st desc
18:35brehautsorry ive screwed that up
18:35alexyknp trying to figure the idion
18:35brehauti meant to put b first
18:36alexykidiom
18:36brehautalexyk: basicly, sequence shaped things are an equality partition (timmc, wheres that chart?)
18:36brehautand vectors are in that equality partition
18:37brehautso you can put things into vectors in the order you want them to have sort preference
18:37alexykyes
18:37brehauti think what you want is ##(sort (fn [[a1 a2] [b1 b2]] (compare [b2 a1] [a2 b1])) [[1 2] [2 3]])
18:37lazybot⇒ ([2 3] [1 2])
18:38alexykI wonder how this can be done in sort-by
18:38alexykor sort is easier like this
18:38brehautyou want to control the comparison rather than the key
18:38brehaut(you can control both with sort-by 3-ary overload)
18:39alexykyeah
18:39ibdknox,(doc sort-by)
18:39clojurebot"([keyfn coll] [keyfn comp coll]); Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
18:40brehautalexyk: if you just wanted then to be second elem then first you could do ##(sort-by (comp vec rseq) [[1 2] [2 1]])
18:40lazybot⇒ ([2 1] [1 2])
18:40brehautbut if you want the individual elements to be tested differently you'll need a full comparitor
18:55mrBliss,(sort-by (juxt second first) [[1 3] [2 1]])
18:55clojurebot([2 1] [1 3])
19:10alandipertseancorfield: i ran 'PORT=8888 lein run' per your jayq/fw1 tutorial post, and get 'no :main found' - any idea what i'm doing wrong? thanks!
19:11ibdknoxalandipert: sounds like you need to add a :main key to your project.clj
19:12ibdknoxpointing to whatever starts the server
19:12alandipertibdknox: which is something in fw1-template i'm guessing?
19:13ibdknoxshould be proj-name.main based on the template that I see here
19:13ibdknoxmaybe you nuked that key when you copied the cljs-build args into project.clj? :)
19:13ibdknoxbecause it *should* be there by default
19:14alandiperthm, i don't think so, i'm a paredit *master* ;-)
19:14ibdknoxhehe
19:14alandiperti don't see any jetty related code in the stuff it generated
19:14ibdknoxthere's a fw1/start function
19:14ibdknox(I know nothing, I'm just looking at the template)
19:15ibdknoxhttps://github.com/seancorfield/fw1-template/blob/master/src/leiningen/new/fw1/main.clj
19:18alandipertibdknox: hm, yes, none of the stuff in the template ended up in my project
19:18ibdknoxalandipert: haha that would make it hard
19:25octehmm
19:35Squee-DLooking for someone from the Upper North Island who is competent with clojure to come and do a meetup in auckland.. I know theres at least one person in here from Hamilton.. Please ping me if you are that person :D
19:35Squee-Dor know who it is :D
19:35Squee-Derr Yeah NZ Upper North Island..
19:35ibdknoxbrehaut is from somewhere around there I thought
19:36taliosbrehaut is in Hamiltion, I'm in Auckland
19:37taliosSquee-D - we were just discussing the clojure auck meetup session for the next JUG
19:37talioswe've been planning on doing one for ages.
19:37taliosSquee-D - you're at visfleet? thought you guys were a ruby shop?
19:37Squee-Dtalios you've seen the Java meetup group are trying to find someone to take one?
19:38Squee-Dthats more one eyed than it probably sounds to you :D
19:38taliosSquee-D - I corun the Java Meetup. Both of us organizers are clojure-ish peeps
19:38Squee-DTalios did i meet you half an hour ago?
19:38taliosSquee-D - you probably did :)
19:39Squee-DI was the noisy fellow who wants proof that we're not restful
19:39taliosOh - I'm the REST Nazi whose hanging in #rest ;)
19:39Squee-DI really want to push the clojure agenda, i'm fascinated, i think it's the one language that might put me off ruby.
19:39taliosarbscht was also there
19:39Squee-Dsweet i assumed so
19:40taliosSquee-D - restful != REST
19:40Squee-Dthat ok with me :D
19:40Squee-Di'l lalso join #restful
19:40Squee-Doh look it redirects to #rails
19:40Squee-D;)
19:42taliosmuhahaha
19:42Squee-DI have some realtime processing requirements that I think clojure would be more natural for than say, node.js or EM
19:43Squee-DI'd rather no one need think too hard about threads and thread safety, mutablity, etc.
19:44talioserlang!
19:45brehautSquee-D: ping
19:46Squee-Dsup brehaut, wanting to make the clojure intro happen
19:46Squee-Dtalios i think i prefer clojure - i THINK.. i don't know.
19:47taliosbrehaut should also come up and guest on the podcast :)
19:47brehautSquee-D: something could be fun. im not sure if count as competant though
19:47brehauttalios: that could be fun
19:47Squee-Dbut i have considered erlang based on it's existing uses and track record. I'm still exceptionally green when it comes to functional languages
19:47technomancymost of the software for which erlang is a good fit has already been written =)
19:47brehauttechnomancy: zing!
19:47ibdknoxhaha
19:48tmciverAnyone know where clojure.contrib.seq-utils/separate lives now?
19:48ibdknox~contrib
19:48clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
19:49ibdknoxnot on the list!
19:49amalloytmciver: the blackest pits of hell. just use (juxt filter remove)
19:49tmciverI just checked... a quick search for seq-utils turned up nuttin
19:49tmciveramalloy: how did I know you would suggest juxt?
19:49ibdknoxamalloy: what was in it?
19:49amalloyibdknox: in what?
19:49tmciveramalloy: ;) thanks.
19:50amalloyseq-utils? i dunno. some of it might have been marginally useful
19:50ibdknoxyeah
19:50weavejesterWould partition-by work the same way?
19:50tmciverNope
19:50amalloybut most of it is like: (defn separate [pred coll] [(filter pred coll) (remove pred coll])) ;;whoops forgot juxt (defn find-first [pred coll] (first (filter pred coll))) ;; whoops forgot comp
19:51ibdknoxhaha
19:51weavejester,(partition-by even? (range 10))
19:51clojurebot((0) (1) (2) (3) (4) ...)
19:51weavejesterAh, it doesn't group
19:51ibdknox,(doc partition-by)
19:51clojurebot"([f coll]); Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions."
19:52weavejester,(->> (range 10) (sort-by even?) (partition-by even?))
19:52clojurebot((1 3 5 7 9) (0 2 4 6 8))
19:52ibdknoxhaha
19:52weavejesterOf course, that's worse than using juxt :)
19:52tmcivercheater
19:54tmciverI was surprised to not see seq-utils listed at the "where did clojure contrib go?" link.
19:54ibdknoxyou should add it with the "to the blackest pits of hell" bit
19:55amalloyi miss str-utils2
19:56amalloyor no, i liked c.c.string
19:56brehautamalloy: you havent ported your favorites to useful?
19:57amalloynah. most of it was silly stuff i shouldn't have been doing anyway
19:57brehautlol
19:57amalloylike (defn drop [n s] ...) to make it look like sequences and cooperate with ->>
20:05weavejester,(vals (group-by even? (range 10))
20:05clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
20:05weavejester,(vals (group-by even? (range 10)))
20:05clojurebot([0 2 4 6 8] [1 3 5 7 9])
20:06weavejesterI just recalled that group-by is probably closest to separate.
20:07tmciverHmm, not bad.
20:10jweissanyone know a good way to make clojure data/code pretty in html? not sure if i should leave everything up to pprint. would be nice if i could add extra indentation, but *current-level* that controls it is private.
20:10technomancyjweiss: iirc there's some more customization coming in the next pprint for code dispatch
20:22TimMcbrehaut: http://www.brainonfire.net/files/seqs-and-colls/main.html#tbl-eqpart
20:23brehautalexyk: ^
20:28dnlcttrany clojurescript one experts in the room?
20:28brehaut~anyone
20:28clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
20:29dnlcttrthe repl is hanging
20:30dnlcttri followed the instructions on this page (https://github.com/brentonashworth/one/wiki/Getting-started) and none of the commands at the bottom of the page get any response
20:30dnlcttrbut there's no error message either
20:30dnlcttrjust... silence
20:37arbschtSquee-D: hi
20:37talios'lo arbscht
20:37Squee-Dholas
20:38seancorfieldalandipert: sorry, was busy... just noticed your problem with fw1-template... did you get it resolved?
20:38Squee-Dso wait. OOCSS, how dya deal with a:hover ?
20:38seancorfieldi just tried lein new fw1 alan and it has :main alan.main in the generated project.clj
20:38taliosSquee-D: I was just remembering ages ago talking to Brendon about getting your devteam and ours together for a session on dev practises
20:38arbschtSquee-D: you're looking for a clojure person for a meetup? as in to present something?
20:39taliosarbscht - didn't we nominate you :)
20:39Squee-Darbscht yeah this was without realising you two miscreants were in this chan already
20:39arbschtoh right :)
20:40taliosSquee-D: you use maven for your clojure don't you. *looks stern and angry like*
20:40taliosI should do a new release actually.
20:42Squee-DI dont clojure much at all
20:43Squee-DI'm no fan of maven, because i really despise xml, it's worse than yaml. :)
20:44Squee-Di'm sure someone is working on a clojure wrapper for maven config as we speak
20:45technomancyhehe
20:45taliosSquee-D: well I did the original implementation of polyglot-maven for clojure about 2 or so years ago, worked well, but also kinda fell over with things like the release plugin
20:45taliosround-tripping a pom rewrite didn't quite….. work so well when you have programatic poms.
20:46Squee-Dyeah i can see that
20:46technomancythere's talk of a lossless reader that could make it easier
20:46technomancywell, talk of the need of one; I don't know if there's talk of anybody writing one
20:46talioslein for the win for clojure-only projects.
20:46Squee-Ddid you just do elipsis -space- . -space- . ?
20:47technomancytalios: https://github.com/technomancy/lein-scalac <- mwahahaa
20:47taliosSquee-D - stupid osx autocorrection :)
20:47taliostechnomancy: i saw that.
20:47Squee-Doh ok, i thought you were being a thorough dork :D
20:47technomancynot that I recommend using it in its present state
20:47TimMcOn my work computer, all those ellipses show up as question marks (because my terminal encoding is fucked.)
20:48TimMcAt one point? I thought some was using question marks? all the time?
20:48taliostechnomancy: the problem was more how polyglot maven read the clj into an internal POM Model ( it works via reader/writer classes ). The writer writes out the expanded/interpreted model.
20:48brehautTimMc: ‽ …
20:48taliosTimMc: I often have that problem with smily faces everywhere :)
20:48technomancyoh yeah, that's way trickier.
20:48talios:)
20:48TimMcBut now I'm on my laptop, where everything is sunshine and unicorn and interrobangs.
20:48brehauttechnomancy: does lein-scalac exist just to let fogus right parts of his programs in basic?
20:49brehauts/right/write/
20:49technomancybrehaut: oh man, that's like ... a 2-in-1 plugin
20:49technomancyexcellent
20:49taliostechnomancy: worked fine for the yaml/json poms which were static representations, but when you bring in functions and a dsl problems strike
20:49technomancyno, that was just me screwing around with the heroku scala maintainer over lunch
20:50brehautthat would make more sense
20:50jweissis there any example of custom pprint dispatch out there? I'm starting to think i need one.
20:50technomancyfun fact: the scalac ant task has a bug where the classpath attribute isn't discoverable via reflection
20:50technomancyso lancet hates it
20:51arohner1with midje, is it possible to mock defs (as opposed to defns)?
20:57brehautk
21:06TimMctechnomancy: I see now that the Gilardi Scenario is precisely why I was having trouble making an in-sandbox-ns macro -- require and import statements in the body of the expansion have to execute in the outer namespace because the whole form is eval'd at once.
21:11TimMcamalloy: Does this import+ syntax seem more reasonable to you? https://refheap.com/paste/738 [] around packages, () around classes as needed.
21:12TimMctmciver: ^
21:12TimMcI'm still concerned about whether splitting up java.awt.geom into java.awt and geom is "grep-poison", but since :require already does that with packages...
21:13amalloyrequire actually doesn't do that, quite
21:13TimMcYeah, it is limited.
21:13amalloyask technomancy, he'll probably murder you for supporting any nesting at all. dude loves to grep
21:15TimMcHmm, I don't know if :require allows arbitrary levels, or if it just supports at most 2.
21:15TimMcLooks like the deepest nesting is prefix-list + libspecs, period.
21:16TimMctechnomancy: https://refheap.com/paste/738, is the subpackage nesting murder-worthy?
21:21tmciverTimMc: it looks better to me but I'd like to hear why nesting is bad.
21:25alandipertseancorfield: np, but no, as of yet unresolved
21:26seancorfieldyou have lein-newnew installed? which version?
21:26seancorfieldi have 0.2.2 of newnew
21:30citizenparkeremezeske: Any chance you're around? n00b question about lein-cljsbuild
21:35TimMctmciver: If I grep the codebase for "java.awt.geom" (knowing that some classes in there are used), I wouldn't be able to find that import statement.
21:35TimMcI'd have to know to only search for "java.awt", which is unlikely.
21:40brehautTimMc: would it be possible to attach metadata to the NS to describe what (fully qualified) java classes have been imported?
21:41TimMcbrehaut: Sure, but that doesn't help a developer using grep on .clj files.
21:41brehautTimMc: indeed; but perhaps working at a level higher than text is worth it?
21:42TimMcI'm not sure what you're suggesting.
21:43TimMcTo get this information, one would have to eval the CLJ files.
21:43brehautthats true, but then, i dont see whats wrong with that ;)
21:43TimMc...because that's not how one searches a codebase?
21:44brehautonly due to historical accident
21:44TimMcI literally have no idea what you are trying to argue here.
21:44brehauti think that grepping text files of programs is a horribly archaic way to find things
21:44brehautwhen you could introspect structured data
21:45TimMcSure.
21:45TimMcThis isn't structured source, this is runtime values.
21:45brehautits still structured data though
21:45TimMcsure...
21:45TimMcDo you have a tool to replace grep?
21:46TimMcIf not, I should probably design (or at least document) with grep in mind.
21:46brehautnot for this specific instance, but apropos is similar
21:55brehautTimMc: (defn find-imports [fqn] (keep (fn [ns] (when (-> ns meta :imports (or #{}) (contains? fqn)) (.getName ns))) (all-ns))) – point being, its like it would be hard to write the apropriate tooling
21:56brehautand important not is missing from the above english
22:02tmciverTimMc: the current import implementation suffers from this problem.
22:02tmciverBut I agree with brehaut; I'm not sure if it's that big a deal.
22:03tmciverYou could always just grep for 'java.awt'...
22:03TimMcif you know to
22:03TimMcSomeone unfamiliar with the codebase would not.
22:03TimMctmciver: clojure.core/import doesn't allow package splitting
22:04tmciverIf they're familiar with import they would.
22:04clojurebotExcuse me?
22:04tmciverclojurebot: you're not excused.
22:04clojurebotI don't understand.
22:04TimMcNot according to the documentation, leastways.
22:06tmciverBut you can do things like (:import (java.io InputStreamReader); you'd have to know not to grep for java.io.InputStreamReader
22:07TimMcThat's different from splitting the package name itself.
22:07tmciverperhaps no.
22:07TimMcNo Java or Clojure developer would expect to necessarily see the fully-resolved classname.
22:08TimMcHow about we just leave package splitting out for the moment and make sure there is room for that syntax later?
22:09tmciverYeah, that's what I was just thinking. So for the user to write java.awt and java.awt.geom separately.
22:10TimMcFor now, yeah.
22:12tmciverI think it makes sense to let something like this evolve over time.
22:14brehautis there an emacs key binding thats the cycles through windows in the reverse order to C-x o ?
22:15brehautoh, C-x O
22:16TimMcC-u -1 C-x o
22:16TimMc:-P
22:16TimMcC-x o and C-x O are the same for me, I think.
22:17brehautTimMc: i cannot tell if thats serious or a joke
22:17TimMcThe C-u -1 thing works, but is ridiculous.
22:17TimMcthe o vs. O thing is serious
22:19brehautTimMc: can you explain the ridiculous one?
22:20TimMcbrehaut: M-x other-window takes an optional count of how many windows to skip.
22:21brehautTimMc: oh right, so C-u provides an argument to the next command?
22:21TimMcyep
22:22brehautemacs magic frightens me a little
22:22brehauts/little/lot/
22:23TimMcbrehaut: Would you mind doing C-h k C-x O
22:23TimMcI want to know what it's bound to for you. (Are you using Emacs 24? I'm on 23.)
22:23brehautim on 24
22:23brehaut (lambda nil (interactive) (other-window -1))
22:23TimMchah!
22:24brehautso basicly exactly what you suggested but with less magic?
22:24TimMcyup
22:25brehautwhat does (interactive) mean?
22:26brehautive clearly not mastered any of the built in help features of emacs
22:30TimMcI'm not sure.
22:32Frozenlockbrehaut: Interactive is for commands: functions available to the user with M-x.
22:34brehautFrozenlock: thanks
22:34Frozenlocknp
22:37Frozenlockbrehaut: carefull with emacs, you will be spending most of your day in it before you realize :P
22:37brehautFrozenlock: thats exactly why i gave up using it years ago :P
22:38brehauttalios, Squee-D: perhaps if you are wanting to do a clojure intro at the UG, waiting until the technomancy gets a preview of lein 2 out the door might be smart? the repl-y integration alone is probably worth the wait.
22:38Squee-Di don't know what that is
22:39brehautSquee-D: its a better repl for clojure http://github.com/trptcolin/reply
22:39Squee-Di know roughly what lein is, but i was far more interested in clojure the language and functional composition
22:39Squee-Doh
22:39brehautSquee-D: lein is the defacto standard front end to clojure; clojure the language doesnt really come with a user interface
22:39brehautlein provides all that
22:40Squee-Di use Clojure Repl on my Samsung s2 mostly :P
22:40Squee-Dbut i have run up an app or two using lein
22:41Squee-Dand the local repl.. intellij's built in repl console also adds some of the reply stuff, especially navigation
22:41Squee-Dand completion iirc
22:42brehauttheres lots of good repl options for clojure, especially now that nREPL is coming together. the advantage with lein is that its probably the path of lowest resistants to getting new users up and running
22:42Squee-Dyeah understood
22:42taliosSquee-D - iClojure for the console gives full completion and stuff
22:42taliosvery wicked and full of awesome
22:43brehautSquee-D: unfortunately the bog standard repl that comes with clojure/lein 1.x is a bit crap
22:43talioshttps://github.com/cosmin/IClojure
22:43taliosmaven clojure plugin now supports that if its in the class path, need to release that version tho
22:43Squee-DI'm looking forward to some tiem with the clojure way book as soon as i get a holiday :P
22:44Squee-Dcool nice link
22:45taliosthe whole lisp syntax remains a love/hate relationship with me. i hate my flip-flopping mind
22:45brehauttalios: does your editor of choice support paredit?
22:46taliosbrehaut - not sure actually ( Sublime Text 2 )
22:47brehauttalios: ah. i suspect not then. paredit makes life a lot better
22:48brehauttalios: i switched away from textmate because of the lack there. ive settled on emacs for now, but eclipse with ccw looks very promising too
22:57Squee-Dparedit?
22:57Squee-Dsounds like something i could plug into sublime
23:05brehautif you use structural editing for a while you wonder how you ever achieved anything without it
23:08bbloomI'm a big-time vim guy, but haven't tried paredit.vim yet… anyone use it? as good as emac's? vim-esque enough to tolerate?
23:08fryguydo people in here typically use gui emacs or terminal emacs?
23:10brehautfryguy: i cant speak for others but i use a mix
23:10brehaut(and forcing myself to use terminal emacs made me learn a lot more of the keyboard navigation)
23:11fryguyi'm trying to convert from vim, and i'm so used to just running vim remotely in a terminal to do editing in development sandboxes. Seems like there's not a great solution for this in emacs. I mean, I guess I could just do the same thing, and run emacs -nw remotely.
23:12ibdknoxwhy not just use VIM?
23:12ibdknox:)
23:12fryguybut then I see things like auctex that make me want to have gui support. I guess I could just do a mix and run it in local gui mode when I need it
23:12fryguyibdknox: seems like slime + swank is going to be better in the long run than vimclojure + nailgun
23:12brehautfryguy: im pretty sure you can tunnel remote emacs sessions to a local client
23:13brehautnot that i understand how though
23:13jlffryguy: to run gui emacs on the remote system, you can just tunnel x over ssh
23:14fryguyjlf: sure, using someting like NX I guess. which seems possibly viable, but then it means I need to get X installed remotely, and that's not feasible for all of the things I'm going to be connecting to
23:14jlfyou can also use tramp or sshfs to run it locally and edit remote files, or set up a local emacsclient to connect to a remote emacs server over tcp
23:15fryguyi'm trying to figure out how to deal with the "sane vim setup available everywhere" in emacs-land
23:15jlfno nx necessary, just x11
23:15fryguyjlf: sure, but x11 forwarding tends to be slow
23:15jlfthe point being, timtowtdi
23:15amalloytramp is a good choice IMO, but of course jlf carries a bit more weight than i do on this
23:16jlfheh, i tend to use sshfs myself but don't tell #emacs :)
23:16fryguysshfs is horribly slow for doing any sort of directory traversal in my experience (for example, ctags).
23:17fryguynfs is maybe more viable, but again, it's something that's not available everywhere
23:18jlfime x11 forwarding is plenty fast for emacs if it's tuned a bit, but i tend not to work over large network distances
23:19fryguyI'm thinking that maybe the right thing to do is to just figure out how to make tramp mode do what I want, and just run emacs locally. or at least that's a reasonable first iteration.
23:20amalloyi'd be interested in what tuning you did, jlf - my experience has been pretty awful
23:20fryguyI'm trying to avoid a situation where I have something like "to edit files on these 5 servers I have to do steps a,b,c, and d. And then to edit files on THESE OTHER 5 servers I have to do steps e,f,g, and h because something isn't available" I want a consistent cross machine experience when the machines are things i may or may not have sysadmin control over
23:20jlfiirc eshell understands tramp somehow so it will execute programs on remote machines if the cwd is remote
23:21fryguyjlf: yah, I was just reading about that, which seems like it might be the key for some of my hangups for things (remote debuggers, remote ctags, running unit tests, etc)
23:22jlfamalloy: it's been a while since i messed with it but let me take a look...
23:23fryguyi wonder how tag jumping for remote files works...
23:32MenTaLguYso I'm trying to extend leiningen's deps command with some code that requires one of the deps jars before it can run
23:33MenTaLguYit's simple enough to run the code *after* the normal deps task in the hook
23:33MenTaLguYbut the problem is that the classloader won't look at the downloaded jar if it wasn't already present at startup time (it appears)
23:33MenTaLguYrecursively re-invoking leiningen in a new VM might be one option
23:34MenTaLguYthough I'm not sure how to do that
23:44taliosMenTaLguY - you could create your own class loader instance and load the classes
23:44taliosinto the same vm
23:44taliosthats kinda getting lower level into the JVM than you might want tho
23:45MenTaLguYyeah ... I was kind of hoping that eval-in-project would accomplish that actually
23:45MenTaLguYbut it doesn't seem to help