#clojure logs

2013-01-22

00:00frozenlockcjfrisz: No problem. I'm mostly in the same situation; learning JS with clojure :)
00:00TheBusbytechnomancy: I'm very tempted
00:00TheBusbythough it might be easier to setup a proxy service and offer others. collect the bribes myself you see
00:00technomancyarrdem: any time someone says "I wouldn't use it myself, but it'll be great for newbies" my BS detector goes off
00:00arrdemtechnomancy: haha good rule
00:02arrdemwhy is the coffee always gone...
00:02TheBusbytechnomancy: "I wouldn't use it myself, but it'll be great for newbies" = pmap?
00:03technomancyTheBusby: pretty much
00:03craigbroi use pmap!
00:03technomancyyou can s/newbies/presentations/ and it still works
00:03craigbroi use it quite a bit
00:03craigbroin production code even
00:03TheBusbycraigbro: you're scaring me now
00:03craigbrohowever I do stupid partition tricks
00:04craigbroto limit the number of threads
00:06TheBusbyspeaking of core contributors, are there any that aren't US TZ? I thought a few were EU but couldn't tell who
00:06craigbroalso, I exxagerate the quite a bit (two places)
00:06TheBusbycraigbro: you'll like reducer's fold I think ;)
00:06craigbroyah, haven't had time to look at those yet
00:07craigbroI'm perpetually behind the times it seems
00:07craigbrodidn't use paredit, was slow to pick up threading macros...
00:09noprompti just wanna verify here, if i have an ns containing soley records the ns name should be (ns foo.types) or (ns foo.type)?
00:09TheBusbyno worries, I still haven't played with reader tagged literals
00:09noprompti'm confused as to what constitutes "heterogenous"
00:09amalloynoprompt: pick any old name you want
00:10nopromptamalloy: ha! i suppose that's fine too :)
00:10craigbronoprompt: lots of different things
00:12nopromptcool. every language seems to have preferred conventions and i'm still new to clojure.
00:13craigbronoprompt: I would callit foo.types
00:14nopromptcraigbro: i think that makes sense
00:15technomancynoprompt: also make sure it makes sense to use records; most people who are new to clojure use them when they should be using maps
00:15craigbronoprompt: my collection of functions for importing frm a given data type I call foo.import
00:16noprompttechnomancy: absolutely. i made sure to do a lot of reading and consideration before choosing them in my case.
00:18nopromptwould a css compiler constitute a good use case for records/protocols?
00:18technomancyI think not.
00:19technomancyif you are considering introducing types merely for the purposes of dispatch it's likely that you're trying to treat clojure like an OOP language
00:20nopromptouch. :)
00:20nopromptso what would be the right way to model it?
00:20nopromptmaps, functions, and macros?
00:20technomancymaps and functions until you need polymorphism, in which case defmulti
00:21technomancy(but you will need less polymorphism than you think)
00:21craigbroi like to think of it as needed less typoed polymorphism
00:21nopromptok, so originally i had gone that route, which is ok since i'm using version control.
00:21SegFaultAXIs there something like hiccup for css?
00:21arrdemherm.. how to do a recursive macro?
00:21craigbroand using lots of value polymorphism
00:22nopromptyes there are a couple libraries.
00:23ibdknoxwow the pull requests thread makes me sad :(
00:23amalloyarrdem: that's too vague a question to answer
00:23arrdemamalloy: yeah it is...
00:24SegFaultAXibdknox: ?
00:24ibdknoxSegFaultAX: https://groups.google.com/forum/?fromgroups=#!topic/clojure/0gwjKtatf-0
00:24nopromptSegFaultAX: there's gaka and cssgen
00:25craigbrokiller 1.5.0 feature; print-table output compatible with Emacs org mode...
00:26technomancyibdknox: but not particularly surprising
00:26ibdknoxtechnomancy: not anymore :/
00:26TheBusbyibdknox: I think it's only going to get worse as the community grows
00:27ibdknoxit should
00:27ibdknoxit's broken
00:27frozenlocktechnomancy: separated IRC channel? #clojurescript then?
00:27SegFaultAXtechnomancy: I'm only at the top of the thread, but #clojurescript is a thing.
00:27technomancySegFaultAX: are there people in it?
00:27TheBusbyibdknox: I agree, I have tons of patches/updates/etc (not sure if they're worth anything) that have simply never been submitted because of all this drama
00:27SegFaultAXtechnomancy: As of now, like 6 haha
00:28ibdknoxTheBusby: it has kept me from contributing :(
00:28TheBusbyibdknox: the great thing with git though is you can easily maintain your own fork
00:28ibdknoxmm
00:29TheBusbythough beta2 has broken some of my reduces stuff... :( Sticking to alpha2 until 1.5.0 gets released
00:29TheBusbys/reduces/reducers/
00:29luxbockshould I use records, structs or just regular maps to represent a playing card, e.g. {:rank :K :suit :clubs} ?
00:30technomancyluxbock: maps for sure
00:30SegFaultAXluxbock: A map is probably sufficient. Even just a pair.
00:30technomancyor yeah, you could use a vector if you can keep the positions straight in your head
00:30TheBusby^^^ sarcams I hope
00:30nopromptso what is the ideal use case for a record?
00:31luxbockalright, I was confused because I've seen people use both structs and records, but yet someone here said earlier that most of the time neither one is needed
00:31technomancynoprompt: if you are implementing a very tight loop and you wish to sacrifice flexibility for speed
00:31SegFaultAXluxbock: When you want to have a distinct type, probably.
00:31technomancyluxbock: structs are completely deprecated
00:31SegFaultAXWhoops, noprompt ^
00:31technomancyluxbock: records are highly over-used
00:31luxbockalright, good to know
00:32craigbroso, if records are overused, what about defprtocol and reify?
00:32SegFaultAXtechnomancy: Do you mean defstruct is deprecated?
00:32technomancycraigbro: protocols are also overused. reify doesn't seem to be because most people understand it's only necessary for Java interop.
00:33technomancySegFaultAX: yeah, I don't know if it's official, but there's no reason to use them
00:33SegFaultAXtechnomancy: Good to know. I knew it had fallen out of favor, I didn't realize it was actively cautioned against.
00:33craigbrook, here is an example. I have a informal type, called sample-info
00:34craigbroit's a map witha set of keys in it, guaranteed to be there, tho it's usually merged with other information
00:34luxbockfor the deck, I'm guessing I should use a vector? I need mostly to shuffle it and deal out cards
00:35craigbrowhat would be the way to mark those maps such that people could be sure those keys were there?
00:35craigbroerr, what i mean is
00:35SegFaultAXluxbock: Vector works great. I have some sample code if you like?
00:35craigbroI want to throw an error if I pass in a map that has one of those keys missing
00:35technomancycraigbro: just use preconditions
00:35craigbroI would prefer not to use runtime preconditions
00:36luxbockSegFaultAX: yes please
00:36SegFaultAXcraigbro: Why do you need to strictly enforce the presence of keys?
00:36craigbroand I also want some form of documnetation, or making explicit, that this is a known map
00:36SegFaultAXluxbock: Crud, it's on my other laptop. Sec.
00:36luxbockI'm trying to build an equity calculator for poker as an excercise
00:37technomancycraigbro: you have all the tools you need to do that in defn
00:37noprompti should have joined this room sooner :)
00:37frozenlockAaaaand I killed my browser #(let [lock (atom true)] (some-async fn... (reset! lock nil)) (while @lock ))
00:38craigbroI guess the real goal is that i want a shared abstract that other programmers on the team can use
00:38craigbronot so much throw an error if a key is missing
00:38craigbrohmmm
00:38alexbaranoskycraigbro: https://github.com/runa-dev/clj-schema ?
00:38craigbroI guess I miss the pedagogical role that class/types play in OO langs
00:38craigbroor even functioanl langs with static typing
00:39SrPxWhat's Clojure's equivalent to CL's progn?
00:40technomancycraigbro: you can write Clojure that way, but it's not necessary and doesn't help much
00:40technomancySrPx: do
00:40SrPxtechnomancy: ty
00:40craigbrodo?
00:40clojurebotdo does not
00:40Raynes&(do :you :love :me?)
00:40lazybot⇒ :me?
00:41SrPxc:
00:41luxbockSegFaultAX: I have to run but I'll get back to you later about that sample code, thanks
00:41SegFaultAXluxbock: I have it
00:41nopromptSegFaultAX: i think i'd still like to see it
00:41SegFaultAXluxbock: https://gist.github.com/4592392
00:41craigbrotechnomancy: oh, but it does help
00:41luxbockah nice, ty
00:42SegFaultAXluxbock: It's part of a project I'm building to tutor a friend of mine interested in clojure.
00:42craigbrotechnomancy: when you have a team working on a dynamic language like clojure
00:42luxbockcool
00:42SegFaultAXluxbock: But it is a mostly functioning blackjack game.
00:42craigbroclj-schema might do the trick
00:43technomancycraigbro: people aren't going to suddenly forget to pass in the right arguments just because you're not using a record type
00:43SegFaultAXnoprompt: ^
00:43nopromptSegFaultAX: ty, reading it now.
00:44craigbrotechnomancy: surr they will, or more likely the return value of some function they called that previously returned a map of that type, has changed and no longer does
00:44craigbrotechnomancy: I would prefer a runtime error or at least warning, instead of something like silenty returning a weird/nil value or something
00:45craigbrotechnomancy: I am not arguing for records either
00:45technomancyif you had a proper type inference engine it would catch something like that, but records are a long way from that
00:46TheBusbycraigbro: I think it's safe to say that the above isn't "normal" Clojure, so unless you really feel confident you're doing the right thing, don't.
00:46craigbrotechnomancy: yah, without the static checks, preconditions are the obivous choice, precondition + clj-schema might be the sweet spot
00:47craigbrotechnomancy: right now, I do it via documentation, naming convention for fn params
00:47craigbroaka convention
00:47craigbroTheBusby: what is the "above"?
00:48SegFaultAXnoprompt: I'm open to comments if you have any. There are some weird parts because it's an interactive port of a Python implementation. We're still building up to a completely working game.
00:48craigbroI always dug CLs type system
00:48craigbroopt-in
00:49craigbrowhen I saw the work on a typed CLJ, I immediately thought of that
00:49nopromptSegFaultAX: oh, i think i'm far from being able to make judgements about the code. i've only been using clojure for about 2.5 months, and mostly in my free time.
00:49technomancyeven that is a long way from a proper inference engine unfortunately
00:49SegFaultAXnoprompt: Oh, cool. Welcome! :)
00:49craigbroyah
00:49craigbroI could dig being able to use something like the type hints tho
00:50nopromptSegFaultAX: but i'm going to meditate on it and the comments others have made.
00:50craigbroto say "this kind of map"
00:50TheBusbycraigbro: just adding my vote to ditch records and listen to technomancy. There are a number of specialized Clojure features that look really cool, but should only be used in special circumstances.
00:50craigbroTheBusby: the use of records is not even on the table here
00:50TheBusbycraigbro: sorry, nmind then
00:51craigbroTheBusby: I am using maps now, but I wanted some kind of notation/representation of the "types" of the maps I use
00:51noprompti'm slowly backseating ruby as my primary programming language in favor of clojure at work. :)
00:51nopromptruby's nice for shell scripts though.
00:51TheBusby{:type :magic: :data "foo"}
00:53SegFaultAXnoprompt: In my day job I do mostly Ruby, and Erlang before that. I have mixed emotions about Ruby as a language; there are some features that I absolutely adore, but the vast majority is just needlessly complex.
00:53craigbroI guess I wish type hints ala #^foo didn't have to be java classes
00:54SegFaultAXcraigbro: What other type hints would there be?
00:54craigbroprotoclols?
00:55TheBusbyyou could play with typed-clojure maybe?
00:55SegFaultAXIs typed-clojure actually in a usable state?
00:56amalloycraigbro: hinting protocols would do no good to the core language. so you might as well use your own custom tags that the compiler will just ignore
00:56craigbroamalloy: that's the conclusion I just came to in my repl 8^)
00:56amalloy(defn ^:int foo [^:stringable x])
00:56amalloynot that i'd want to read such code
00:56nopromptSegFaultAX: i agree. ruby used to make me feel very happy, and in many ways it still does. but OO feels a bit like a cage after working more with FP langs.
00:57craigbroamalloy: really a docstring is just as good then
00:58craigbroand if I wanted anything more, I could use preconditions and clj-schema
00:58aduooo typed clojure
00:58craigbrothanks yall
00:59aduI thought it was (defn ^int foo [^stringable x])
01:00craigbroadu: the : makes it a keyword, which makes the compiler ignore it
01:00craigbrowhich is what we want, as it's a tag for humans, and not a tag for the compiler (in this case)
01:01SegFaultAXThat seems like it could be problematic.
01:01aduwhat if you have a type called "private"?
01:01SegFaultAXIs a 1 character difference visually distinctive enough to signal that this type hint, aint.
01:02SegFaultAXadu: I don't think you could since that's a keyword in Java.
01:02craigbroone char and a color in emacs 8^)
01:04craigbroSegFaultAX: I think I prefer docstrings anyways
01:04craigbroas they will show up when a user asks for the documentation of the fn, but the type hints get dropped
01:04SegFaultAXcraigbro: I agree with that.
01:11tomojwish I could extend ILookup (and, hell, IAssociative?) to java.net.URI
01:12tomoj(assoc #uri "/foo" :query-params {:bar 3})
01:15noprompttechnomancy: i noticed you contributed to cssgen, the project uses records. it hasn't been updated in some time, in hind site would you say records are not needed?
01:15noprompts/are not/were not
01:16craigbrourls/uris don't store query params as maps tho
01:17craigbroclojurewerkz or someone out there has a bit of code that explodes/compsoes urls into/outof maps
01:17craigbroeasy enought o write yourself too, plus handle things like specifying a map for query params...
01:20tomojthat's what I'm doing now
01:20tomojbut I want to just make java.net.URI better
01:21tomojI guess I don't have a right to extend core protocols to URI
01:21craigbroproxy?
01:21clojurebotproxy is not reify
01:22SegFaultAXcraigbro: Citation needed. I'd like to see that :)
01:22craigbrocitation for what?
01:23tomojURI is final
01:23SegFaultAXcraigbro: "explodes/compsoes urls into/outof maps" this is immediately relevant to something I'm working on. Happen to remember where you read it?
01:23tomojI don't think I want to proxy it anyway
01:23craigbroI was thinking of this: https://github.com/michaelklishin/urly
01:23SegFaultAXcraigbro: Thanks!
01:23amalloydoesn't cemerick have a uri library?
01:24tomojcemerick.url?
01:24clojurebotcemerick: Yeah, MacKay's book is great too.
01:24SegFaultAXamalloy: This one? https://github.com/cemerick/url
01:25amalloyi'd try that before the one from clojureworks, personally
01:25craigbrotomoj: fuck, URI is declared final
01:25SegFaultAXamalloy: Oh man, this is exactly what I'm looking for. Thanks!
01:26xeqicemerick is full of useful libraries
01:26SegFaultAXamalloy: I was basically porting this functionality from Python and it appears cemerick has already done it.
01:26Raynesamalloy: The one from cemerick is great for URLs specifically, but not URIs in general. Not sure about the clojurewerks one, but I've avoided it because it blows my mind that you'd need to use Java directly to do whatever that thing does.
01:27craigbroRaynes: your avg URL parsing is pretty simple, true, but full coverage, can be a pain, and might as well use the java libs if you are in clojure already
01:27tomoj(.mutatePath u "/Protocols") ???
01:27lazybottomoj: Yes, 100% for sure.
01:27Raynescraigbro: No.
01:28Raynescraigbro: I mean, they hava Java source files in the code.
01:28tomojhttps://github.com/wtetzner/exploding-fish
01:28RaynesYou'd definitely want to use the Java URI stuff.
01:28Raynestomoj: I've used exploding fish. It was nice
01:29craigbroRaynes: oh, that's kinda gross
01:29SegFaultAXWho maintains clojuredocs.org?
01:29RaynesI think nobody at this point.
01:29tomojI wonder if I'm allowed to extend ILookup to goog.Uri in cljs
01:30SegFaultAXRaynes: Is it looking for a maintainer? Is there a better online source for up-to-date clojure documentation?
01:30RaynesSegFaultAX: It is a ruby codebase so nobody wants to maintain it.
01:30RaynesI think people are hopeful someone will come with a Clojure version and light the way.
01:31RaynesAlso, it might be closed source.
01:31RaynesWhich is mindblowingly awesome.
01:32SegFaultAXhttps://github.com/zkim/clojuredocs
01:32RaynesOkay, in that case it was closed source when it first came out.
01:32RaynesI know it was at some point.
01:33craigbroit's all open sources
01:35craigbroI prefer emacs' ability to open a jar
01:36craigbroand then I read the code
01:36nopromptoh! i simply love closed source!
01:36nopromptit's like commercial grade orange juice. it contains oranges*.
01:37craigbrowell, there ya go noprompt, a project to transition from ruby to clojure
01:37SegFaultAXI don't really have any particular issue with proprietary software.
01:38nopromptcraigbro: haha! i think rogue might be better for that! ;)
01:38craigbrowasn't there some big discussion about replacing it on the mailing list awhile back?
01:38SegFaultAXExcept for datomic. I really want to crack datomic open and see how it works.
01:39nopromptrogue needs a ton of work too as i'm sure clojuredocs does
01:40craigbrowhat is rogue?
01:40nopromptrouge is a clojure for ruby
01:41nopromptthe problem is, the more you use clojure, the less you want to work with ruby
01:42nopromptmore generally the more you FP the less you want to OOP
01:42nopromptat least this has been my experience
01:42SegFaultAXnoprompt: It isn't really an OOP thing, I think.
01:43SegFaultAXnoprompt: OOP and FP are really orthogonal in a lot of ways.
01:43SegFaultAXnoprompt: It so happens that OOP in a languages means lots of mutable state, which is a shame.
01:43SegFaultAXIn a lot of languages*
01:44nopromptSegFaultAX: yeah, that's usually why constants are commonly frozen or simply placed in refs in ruby.
01:45noprompts/refs/defs
01:45SegFaultAXnoprompt: Well, "constants" aren't really constants in Ruby. And frozen-ness is something else.
01:46SegFaultAXnoprompt: Anyway, I'm simply saying that it's possible to have a language that combines FP and OOP successfully (eg Scala)
01:46SgeoIt's really not difficult to imagine a purely-functional OO system
01:46SgeoI would like to see one
01:47SgeoMore difficult may be purely-functional + Smalltalk-like environment
01:47SegFaultAXSgeo: I think Scala is pretty close. It isn't pure in the sense that functions are still technically non-deterministic. But it's a good example of a mixture of both paradigms, I think.
01:48nopromptperhaps it's just been my general experience with programming in an OO style and the mentality of it's proponents
01:49nopromptarguments about design based solely on empiricism, design patterns, etc.
01:49SegFaultAXnoprompt: I blame the bloggers. They often (incorrectly) set FP and OOP as diametrically opposed when they really aren't.
01:49nopromptSegFaultAX: i can appreciate that and agree.
01:50SegFaultAXCan someone please g-line Inoperable?
01:50nopromptSegFaultAX: but many books are also guilty of the same charge, which is not surprise since many of those authors are likely the same bloggers you're referring to.
01:51craigbrowell
01:51craigbroobject identity, which is one of several core parts of OO, is antithetical to FP
01:52craigbropolymorphism, encapsulation, inheritance are not
01:53SgeoIs inheritance even a core part of OO?
01:53craigbronope
01:53craigbrowell, class inheritance isn't there are prototype based OO languages, JS for example
01:54carkoo is a collection of properties (inheritance being one of these). pick any 3 and you have proper OO
01:54carkin my opinion
01:54cark=P
01:55SegFaultAXcark: That's part of the problem, isn't it? The fact that you can have an /opinion/ on the /definition/ of OOP. It's kind of a meaningless phrase, a catchall for certain types of common patterns and behaviors.
01:56carkyou have the same problem about functional programming
01:56carksome people cannot imagine proper FP without a strong type system à la ML
01:56nopromptSegFaultAX: it really is and i think you're right. ask a dozen programmers what OOP is and you'll likely get that many answers.
01:56ChongLifunctional programming is programming with functions; what's the problem?
01:56SgeoI wonder if there's anyone who would hold the opinion that Smalltalk isn't real OO
01:57SegFaultAXSgeo: It would be ironic, wouldn't it?
01:57ChongLicark: those people are silly
01:57carkChongLi: see that definition is too broad even for me =P
01:57ChongLicark: it depends on the definition of function
01:57ChongLiand that's how it really ought to be
01:58aduSmalltalk is the definition of OO
01:58SgeoMaybe someone so caught up on syntax that they think . for method call is somehow fundamental
01:58carkChongLi: how about the purely functional crowd ...
01:58ChongLithey've added an extra qualifier
01:58ChongLi"purely"
01:59carktake clojure as an example
01:59SegFaultAXWell a "pure function" is different from the function most people think of when they think about "functions"
01:59carkit isn4t really purely functional
01:59ChongLino, it doesn't enforce purity
01:59carkbut purity has a big role in clojure nevertheless
01:59ChongLitake javascript as another example
01:59aduand scheme people would say clojure is unhygenic
02:00ChongLiI consider it a functional programming language
02:00ChongLiand it's definitely not pure!
02:00carkadu: woah i wouldn't mix that in =P
02:00aduhaha
02:00ChongLiyeah, macros have nothing to do with it
02:00Sgeoadu, I think most Clojure people who agree that Clojure is unhygienic but that it doesn't pose a severe problem
02:00carkChongLi: indeed
02:00SgeoAlthough I would say it's more hygienic than CL
02:01adueven some scheme implementations are based on unhygenic foundations
02:01carkChongLi: so, i think across the realm of ML, clojure and JS we've established that functional programming takes many forms
02:01ChongLimacros in essence are merely the application of functions at a different stage in the process
02:01carkwhich one is true ?
02:01craigbroocaml!
02:02SgeoDoes Smalltalk count as functional? It might not be "as" functional like Haskell in that things like function composition aren't easy, but that doesn't really mean not functional at all
02:02SgeoIt takes some a few functional idioms here and there
02:02ChongLiall you need for functional programming are first class functions with lexical closures
02:02carkSgeo: i think there are some gotchas with blocks
02:02SegFaultAXSgeo: I think the problem is that Smalltalk functions are non-deterministic.
02:02SegFaultAXChongLi: Well, and real functions.
02:02clojurebotfunctions are maps
02:02SgeoSegFaultAX, so not "purely" functional, sure
02:03aducark: Apple blocks?
02:03SegFaultAXSgeo: If you like.
02:03Sgeocark, gotchas?
02:03ChongLiSegFaultAX: what do you mean real functions?
02:03SgeoWell, I think historically Squeak blocks weren't closures, but now they are
02:03carki'm no expert with smalltalk, but i think blocks were not really lexical closure until (somewhat) recently
02:04carkSgeo: you beat me to it =P
02:04carki blame the cat
02:05craigbrobeddddddddd
02:05aduI really like clojure
02:06carkso do I... it's great...but sometimes OO is better suited
02:06nopromptadu: me too :)
02:06aduI wonder if I could write a clojure interpreter in scheme
02:10SegFaultAXChongLi: Functions without side effects. Referentially transparent.
02:12ChongLiyeah, pure functions
02:57tomojexploding-fish doesn't even work for me :(
03:09Raynestomoj: I used to use it in refheap.
03:10Raynestomoj: But monger does what I was using it for.
03:31babycljhi, is there an elegant way to compare if a value falls between 2 values; e.g, test if X is between 0.5 and 1.5.
03:31amalloy(< x a b)
03:32amalloyer, (< a x b). you get the idea
03:32babycljamalloy: ok so no bultin function to do those kind of thing -- pardon me, newbie. :-)
03:32babycljthanks
03:33amalloyhuh?
03:33amalloythat's exactly what < is
03:33amalloy&(< 0.5 1 1.5)
03:33lazybot⇒ true
03:33amalloy&(< 0.5 2 1.5)
03:33lazybot⇒ false
03:33babycljnvm, I get it
04:16ucbdoes anybody know if there's an emacs mode to collapse forms?
04:16ucbI seem to recall that there was one somewhere...
04:17ChongLicollapse? you mean code folding?
04:17ucbyes
04:18ChongLihttp://stackoverflow.com/questions/2399612/why-is-there-no-code-folding-in-emacs?answertab=active#tab-top
04:18ucbif you had (defn f [a b c] (do-something...) (more exps)) you'd end up with something like (defn f ...)
04:18ucbaha! thanks ChongLi
04:18ChongLihope it works well for you!
04:19ucbme too! :)
04:33ucbChongLi: hideshow works a charm; especially after you add hideshowvis (for the +- symbols on the margin) http://tinypic.com/r/1jxgk5/6
04:35ro_stucb: awesome, you're using riemann
04:35ro_stimpressions so far?
04:35ucbro_st: yeah, really nice. We've been using it at work for a while now. We're trying to upgrade to latest master but for some reason it's dropping packets :(
04:35ro_steek
04:35ucbro_st: but all and all, very nice
04:36ro_sthow are you collecting dat?
04:36ro_sts/dat/data
04:36ucbcollectd mostly
04:36ucb(you can see the beginning of the collectd parser there)
04:37ro_stwe're using AWS, so we're looking into feeding riemann into cloudfront custom metrics
04:37ucbooh
04:37ucbfuncy!
04:38ro_sthave you ever needed support for riemann, and if so, what was the support like? either from the community or the maintainers
04:39ro_stalso, would you mind pasting the bit of elisp that does that folding happiness you demonstrate? a pm is fine :-)
04:39ucbro_st: it's a standard package hideshow (comes as built-in in 24.x) and I added hideshowvis (from marmalade)
04:39ucbro_st: I didn't do much other than enable hideshowvis for clojure-mode
04:39tomojsay you need to do some initialization once per entire test run
04:39ucbro_st: as for support on riemann, we haven't had the need to reach out yet, it mostly works :)
04:40ucbro_st: mostly = we haven't come across something that doesn't work yet, but I'm sure we will at some point
04:40tomojI guess maybe you can use a hook?
04:40ucbtomoj: entire test run being the entire test suite?
04:42ucbro_st: http://www.emacswiki.org/emacs/HideShow
04:42ro_stthanks, just installing the vis
04:42ucbcool
04:44tomojucb: yes
04:44ucbtomoj: I'm guessing you need to then tear down the state at the end?
04:45tomojsure, but I'm thinking mostly of running with `lein test`
04:45tomojif I'm running tests from the repl I can setup and teardown in the repl around my run-all-tests call
04:45tomojand with `lein test`.. it'll just die off anyway I tihnk
04:45tomojmaybe not
04:46ucbwell, if you're setting up a db and some tables they won't go away once lein test is finished
04:46ucbit it's just an atom or so, then yes
04:46tomojit's a cljs browser repl environment
04:46ro_stucb: working. thanks
04:46tomojI don't think I can close the browser if I even can open one, so it's just them jvm piece
04:47ucbtomoj: for browser testing try clj-webdriver
04:47ucbtomoj: also see the section on fixtures http://richhickey.github.com/clojure/clojure.test-api.html
04:47lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure/clojure.test-api.html and try to stop linking to rich's repo.
04:48ro_stucb: used clj-webdriver?
04:48tomojfixtures run per-ns though
04:48ucbro_st: some, yes
04:48tomojclj-webdriver looks interesting, but I just want to test cljs library code
04:49tomojI don't need to automate the browser
04:49ucbtomoj: indeed; I don't know what you're doing but a long-running state is a bit of a smell if you ask me :)
04:49ucbi.e. normally fixtures should do the trick
04:49ucb"normally"
04:50ro_sttomoj, we got around that by putting the code in clj and using cljsbuild crossovers
04:50ro_stthen we could use midje
04:50tomojit looks like one.test creates a new browser env every time you use in-javascript
04:50ro_stbut i'm guessing you want to test cljs specifically
04:50ro_stcljsbuild's advanced example config has phantom js stuff all wired up
04:50tomojoh, no, it does one browser env per ns I guess
04:51ro_stphantom drives a headless webkit
04:52tomojno microsecond timers, hmm
04:52ro_sthttps://github.com/emezeske/lein-cljsbuild/blob/master/example-projects/advanced/project.clj#L42
05:58oskar__If I
05:58oskar__o
05:58oskar__ops
06:15nico``test
07:40borkdudein emacs, when I have accidentally split a windows, with C-x 2 or C-x 3, can I undo it?
07:41daimrodborkdude: ,,winner-mode
07:42daimrodit's not #emacs /o\
07:42borkdudeC-x 0
07:42borkdudedaimrod I know, but the atmosphere in #clojure is better and half of the people or more use emacs anyway here ;)
07:42daimrodC-x 0 will remove the window, winner-mode is a mode to undo/redo windows configuration.
07:43borkdudedaimrod ah, will look into it
07:44bozhidarborkdude: there are different kind of Emacs users :-)
07:44bozhidarborkdude: that said the atmosphere here is definitely nicer
07:45daimrodFSVO better.
07:46borkdudedaimrod tnx, winner-mode is exactly what I needed
07:47daimrodborkdude: yw, I've bound `C-c u' to `winner-undo' and `C-c r' to `winner-redo' <right> and <left> are too far for me :)
07:48ljosHi. Anyone any who have used jayq in clojurescript? how do I do $(document).delegate(...) . I can get the js to run, but not cljs. I think I am missunderstanding the api or something.
07:49ljosI would think it should be (delegate ($ js/document) selector event fn), but that does not seem to work for me...
07:56zphdshi all… Kinda new to clojure. Was playing around with 'refs' and I can't seem to wrap around why this tiny snippet isn't working
07:57zphdshttp://dpaste.com/887305/
07:57zphdsWhy is my ref-set not working?
07:57borkdudezphds you might want to wrap that in some parens
07:57zphdsoh wait
07:57zphdsyeah
07:57zphdsduh
07:57zphds*brainfart*
07:58zphdsborkdude, thanks!
07:58borkdudeyw
08:08no7hingf
08:09no7hingdamn, wrong window
08:32gfredericksljos: (.delegate ($ js/document) ...)
08:36Thallasios_Xelonhello :)
08:36gfrederickssomebody convince me not to create a date lib
08:36Thallasios_Xelongrefredericks you really help me last time thx
08:37gfredericksThallasios_Xelon: phew!
08:37Thallasios_Xelonif a have a lazy sequence,and i want to print it,it will evaluate?
08:37Thallasios_Xelonbecause of the print?
08:38borkdudeThallasios_Xelon of course
08:38borkdudeThallasios_Xelon if you want to print every element that is
08:38clgvThallasios_Xelon: the lazyseq usually does not print if you do not iterate over its elements and print them
08:38borkdude,(print (range))
08:38clojurebot(0 1 2 3 4 ...)
08:38Thallasios_Xeloni think thats my problem,i dont interate
08:39Thallasios_Xelonok i will figured it out
08:39borkdudesometimes you just see some LazySeq with some numbers
08:39Thallasios_Xelonalso (let [x lazy1 ] x) is x evaluated?
08:39clgvborkdude: humm wait where did I have that from. maybe some special print function...
08:39gfredericks&(prn (take 5 (range)))
08:39lazybot⇒ (0 1 2 3 4) nil
08:40gfredericksThallasios_Xelon: x isn't any more evaluated than it was already
08:40Thallasios_Xelonx is just a lazy sequence,not the result of the evaluation...
08:40Thallasios_Xelon?
08:41gfredericksx is whatever lazy1 is
08:41borkdude,(str (range))
08:41gfredericksyour experssion is equivalent to just `lazy1`
08:41Thallasios_Xelonlazy sequences make me tired ,ok i will read more,thx guys
08:41borkdude&(str (range))
08:42borkdude?
08:42clgvThallasios_Xelon: for evaluation your code or some print functions code needs to iterate over the elements of the lazy-seq
08:42Thallasios_Xelon(doall (concat ....) makes concat "non lazy"?
08:42clgv,(str (range))
08:42clgv,(str (range 100))
08:42clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
08:42clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
08:42clgv,(str (range 100))
08:42clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
08:43clgvupps it's broken now
08:43borkdude:(
08:43clgv&(str (range 100))
08:43clgvRaynes: lazybot seems to be on vacation ;)
08:43gfredericksThallasios_Xelon: it doesn't make it non-lazy, it just realizes the lazy seq; so the effects of laziness are removed, yes
08:44borkdude,(str (lazy-seq [1 2 3]))
08:44clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
08:44gfredericksyou're thought is probably correct, it's just misleading to say that it changes the behavior of concat somehow
08:44borkdude&(str (lazy-seq [1 2 3]))
08:44Thallasios_Xelonok gfredericks i will kill the lazyness,for now until i know how it works
08:44Thallasios_Xelonbye guys thx
08:44clgvborkdude: but you are right, it was the string conversion. I used it in GUI
08:44borkdudeanyway, this evaluates to "clojure.lang.LazySeq@7861" on my machine
08:45clgvclojurebot: botsnack?
08:45clgvclojurebot: botsnack
08:45clgvhumm weird^^
08:45borkdudedid I break smth again?
08:45no7hingnot hungry
08:46llasram~botsnack
08:46llasram!!!
08:49ejacksoni bet I know who is *hungry*...
08:49ejackson$botsnack
08:49lazybotejackson: Thanks! Om nom nom!!
08:49ejacksonyeeeeah
08:51Bronsaciaolol
08:51Bronsalol*
08:52konr_trabWhy doesn't this work?
08:52konr_trab,(try (assert (= 3 4)) (catch Exception e "nope"))
08:52clojurebotkonr_trab: Pardon?
08:52Bronsa, (try (assert (= 3 4)) (catch Throwable e "nope"))
08:52clojurebotBronsa: Huh?
08:53Bronsa:(
08:53ucb,(assert (= 1 0))
08:53clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.AssertionError: Assert failed: (= 1 0)>
08:53Bronsa&(try (assert (= 3 4)) (catch Throwable e "nope"))
08:53lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
08:53Bronsawhatever, use that.
08:53ucbheh
08:55konr_trabthanks!
08:56clgv,(println "I am back!")
08:57clgv&(inc 0)
08:57lazybot⇒ 1
08:57clgvah lazybot is back :)
09:05gfredericksis the latest clojure still 1.5-RC1?
09:06TimMcI think RC2
09:14no7hingseems like this has been picking up speed in the last couple of weeks: http://dev.clojure.org/display/design/Promises
09:14no7hingcan one dare to hope for that being in 1.6?
09:16no7hingas in: is there some history of design documents popping up and then appearing in (one of) the following releases
09:17clgvno7hing: well 1.6 is nowhere near so there should be a high probability ;)
09:18Ember-still waiting for 1.5 final
09:19VinzentSwank still doesn't work with the latest RC :(
09:21alexnixonI'm seeing a bug in production ca
09:21alexnixon*sigh* try that again..
09:22clgvno7hing: well you can use these features with the linked lib
09:23alexnixonI'm seeing a bug in my compojure application whereby a "deref" call throws an InterruptedException (however there are no .interrupt calls in my code). So something is calling .interrupt on my thread, but I have no idea what. Minimal example of the exception here: https://www.refheap.com/paste/8859
09:24alexnixondoes anyone know in what circumstance this might occur?
09:26alexnixonanswering my own question: looking at the implementation of future-cancel, it seems that may interrupt a thread. So in Clojure, if you cancel a future which is blocked by a deref, you may get an InterruptedException. Is this a bug?
09:26no7hing@clgv do you mean with clique?
09:28no7hingit's been some month since i've looked in there
09:28weavejesteralexnixon: Interrupts generally result in an InterruptedException for threads.
09:28no7hinglooks like it's coming along nicely though
09:29clgvno7hing: yeah. thats the one linked on the page
09:29alexnixonweavejester: yeah that's fair enough, what I find surprising is InterruptException bugging me when I'm using only Clojure constructs, despite it not being mentioned in the docs
09:30weavejesteralexnixon: It sounds like a doc problem then. My guess is that it's desired behaviour, as otherwise you wouldn't know if a future was canceled or not.
09:34no7hingchecked it last time in september and he's really been on a run since then
09:36alexnixonweavejester: it doesn't seem particularly intuitive to me. The exception is being thrown from within the thread that is being cancelled. So if it gets cancelled when on line 26 (say, computing (+ 2 2)) it doesn't throw an exception. If it gets cancelled when on line 27 (deref @p 1 :foo), it does throw an exception.
09:36alexnixonweavejester: (that's what I believe to be true, though I could be wrong)
09:37weavejesterI believe InterruptedException only occurs for blocking I/O
09:37weavejesterWhich deref does, I think
09:38weavejesterI might be wrong about that though, looking at the docs
09:38alexnixonit uses http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Future.html under the hood
09:38alexnixon(futures, that is)
09:40alexnixonand promises are built on CountDownLatches http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/CountDownLatch.html#await()
09:40alexnixonwhich is an InterruptedException-throwing blocking call
09:51clojure-newbhey guys, I'm looking for a concise/elegant way to remove a given item from every nested vector in a vector, always the same element… was hoping to find a 'delete-in', any ideas ?
09:51clgvalexnixon: yeah a promise uses a countdownlatch
09:51clojure-newbdata might be [[123 "blurb" :something][321 "more blurb" :something]]
09:51clojure-newband lets say I want to remove :something
09:52gfredericksclojure-newb: do you need the resulting structures to be vectors as well?
09:52clojure-newbgfredericks: not particularly
09:53gfredericks,(map #(remove #{:something} %) [[123 "blurb" :something][321 "more blurb" :something]])
09:54clojure-newbgfredericks: nice, using sets ?
09:55gfredericksyeah, #{:something} is a function that returns :something when you pass it :something or nil otherwise
09:55gfredericksso it works as a predicate here
09:55clojure-newbcool, thanks!
09:55gfredericks,(map #{:something} [1 2 something [:something] true])
10:04arrdemis there a clojure debugger... some way to step through the evaluation of a form?
10:19arrdemw00t working combinator...
10:29luxbockwhat is the reason for why this: https://www.refheap.com/paste/8861
10:29luxbockgives me this: CompilerException java.lang.RuntimeException: Can't have fixed arity function with more params than variadic function, compiling:(NO_SOURCE_PATH:1)
10:31gfrederickscan I extend a protocol to arrays? how does that work with array types being parameterized?
10:31arrdemluxbock: the issue here is simple, in the (format-cards <card>) case which one gets called?
10:31arrdemluxbock: see... the [& cards] takes 0 OR MORE arguments
10:31arrdemluxbock: there is no minimum of 1 as you assume here
10:32luxbockah
10:32luxbockI see
10:32luxbockdoes the problem go away if I add in ([] nil) or do I also have to add ([card & cards] stuff)?
10:33luxbockappears it won't
10:33arrdemluxbock: you want to add [card & cards], or reduce out your [card] case into [ & cards]
10:33luxbockalright
10:33luxbockthanks
10:34arrdemno problem
10:34arrdemgotta earn my keep in this chan somehow XP
10:39oskar__What is the easiest way to replace a word in a string with (word), or something like that, i.e., I want to be able to reference the match in the replacement
10:42AtKaaZ,java.io.File/separator
10:42AtKaaZ,(-> "c:\\some" (.split "\\"))
10:42AtKaaZ&(-> "c:\\some" (.split "\\"))
10:42lazybotjava.util.regex.PatternSyntaxException: Unexpected internal error near index 1\ ^
10:42AtKaaZ&File/separator
10:42lazybotjava.lang.RuntimeException: No such namespace: File
10:42AtKaaZ&java.io.File/separator
10:42lazybot⇒ "/"
10:43S11001001&(-> "c:\\some" (.split "\\\\"))
10:43lazybot⇒ #<String[] [Ljava.lang.String;@90f268>
10:43S11001001&(-> "c:\\some" (.split "\\\\") seq)
10:43lazybot⇒ ("c:" "some")
10:43AtKaaZoh really?
10:43AtKaaZthat's odd
10:43S11001001AtKaaZ: the selection of string methods that actually interpret their args as regexes is utterly arbitrary
10:43S11001001I would trust String methods as far as I can throw them
10:44arrdemTIL S11001001 can throw bytes
10:44S11001001which is 0mm, since they are abstractions and not things I can pick up and throw
10:44jkkramer,(clojure.string/replace "a word in a string" #"(word)" "**$1**") ;oskar__
10:45AtKaaZit's just that I've seen this code (.split File/separator) which obviously works with "/"
10:45AtKaaZbut fails on windows :))
10:45S11001001for example replace(CharSequence,CharSequence) does literal replacement, replaceAll(String,String) does regex replacement
10:45S11001001it's dumb.
10:45AtKaaZthat's what it does in java too right?
10:46AtKaaZoh you mean under the hood those are used by clojure
10:46S11001001not so much under the hood as sitting on top of the hood, flipping you the bird
10:47AtKaaZlol
10:50craigbromorning
10:52phuffG'morning :)
10:53phuffI have some config that defines which libraries to require at runtime
10:53phuffLike {:libspec "myproj.services.myservice"}
10:53phuffAnd I want to look at a variable in (myproj.services.myservice/short-name)
10:54phuffOr call a function in it
10:54phuffI can require it like this: (require (symbol (:libspec service-definition)))
10:54phuffBut I'm having trouble figuring out how to refer to the variables in it when the libspec is in a string like that.
10:55phuffI tried: (ns-resolve (symbol (:libspec service)) (symbol "short-name")) to get the value of short-name in the lib specified in (:libspec service) but it didn't return the string I was looking for.
10:58jkkramerphuff: ns-resolve returns a var, which must be deref'd to get its value
10:59phuffjkkramer So if I want to get a variable who has a fully namespace-qualified symbol as defined in a string I don't use ns-resolve?
11:02jkkramerphuff: ns-resolve is fine (assuming doing what you're doing at runtime is a good idea)
11:02jkkramer&(ns-resolve 'clojure.core 'map)
11:02lazybotjava.lang.SecurityException: You tripped the alarm! ns-resolve is bad!
11:03jkkrameranyway, that returns a var and @(ns-resolve 'clojure.core 'map) returns the value - the map function in this case
11:03phuffAh @ is what I'm looking for!
11:03phuffI was trying intern
11:03phuffBut that wasn't quite right either
11:03jkkramer@var is the same as (deref var)
11:04phuffIntern kind of does the same thing though doesn't it?
11:04jkkramerno, intern creates a var
11:04phuffIt looks like it can read a var, too, though?
11:04jkkramerintern returns a var if it exists, otherwise creates it
11:05jkkrameri think
11:05jkkrameranyway, reading the docs will answer it. gotta go
11:11phuff1Thanks for the help jkkramer
11:41devinus_gfredericks: is korma bad?
11:42gfredericksjust magical
11:42gfredericksand changing apparently
11:42AtKaaZmagillion (magical cameleon)
11:43gfredericksI'm trying to figure out how it manages connections
11:43gfredericksor how to hook into clojure.java.jdbc to transform the return values from queries
11:48gfredericksseancorfield: ping
11:48seancorfieldgfredericks: pong?
11:49gfredericksseancorfield: I'm trying to wrangle korma into doing what I want and am curious about your opinion re. clojure.java.jdbc
11:49gfredericksspecifically I'm trying to support postgres arrays, and in particular I want to have them returned from a SELECT as sequences
11:50gfredericksmy issue doing this in a korma transform function is that the transform function might be run after the connection is closed, and apparently the java.sql.Array type used needs to read stuff from the connection
11:50gfredericksso turning it into a seq at that point fails
11:50gfredericksI was curious if clojure.java.jdbc could support arbitrary transformations on types coming out, or something like that
11:51gfredericksI was looking at the resultset-seq function and can see a point in there where the transformation could be done, but that would require patching
11:51gfrederickswas just mulling thoughts trying to figure out whether this is best done at the korma level or within c.j.jdbc
11:53seancorfieldYes, I've been considering that because it would make supporting a couple of Oracle quirks a bit easier.
11:53gfredericksone thought was a protocol in c.j.jdbc for reading jdbc types
11:53gfrederickswhich I guess would default to identity
11:53gfredericksto give the current behavior
11:53seancorfieldMy initial thinking was "No, it should be done by the user" but then - like you - I found a couple of places where it's too late for the user to do it :(
11:54seancorfieldc.j.jdbc is getting a fairly major overhaul at the moment so now is the time for stuff like this if you can come up with a clean way to do it via optional keyword arguments or something (or protocols - I hadn't considered that path).
11:54gfrederickswell I expect korma could be modified to make sure the stuff gets done before the connection is closed; I guess I thought there might be other reasons it could be nice at the c.j.jdbc level; worth asking at least
11:55gfredericksseancorfield: I could have a protocol patch ready pretty fast I think
11:55seancorfield'k
11:56seancorfieldGit has the latest source (in the 0.2.4-SNAPSHOT - which will actually become 0.3.0 due to the API changes)
11:56TimMckorma chameleon
11:57craigbrome gusta korma
11:57gfredericksseancorfield: I think we're on 0.2.2, but hopefully the patch will be equally valid at both points
11:58craigbrogfredericks: i am heavy user of korma too
11:58gfredericksseancorfield: would a pull request be a good place for further discussion? or a jira ticket?
12:04gfredericksseancorfield: https://github.com/fredericksgary/java.jdbc/commit/c5ea0ac2b8a0fedc383b985c90c3f69956b1f287
12:04gfrederickstests still pass
12:12technomancygfredericks: you troll you
12:13gfrederickstechnomancy: wat? why?
12:14technomancy"would a pull request be a good place to discuss a change to a contrib library?" =)
12:14gfredericksoh; yeah, I honestly couldn't remember if there were some edge cases where that was acceptable
12:14gfredericksafter more thought it does sound unlikely
12:15TimMcI think CLJS takes PRs, but not contribs.
12:16gfredericksI knew I wasn't crazy
12:16gfredericksTimMc: no idea why the difference?
12:16TimMcNope.
12:18augustlwhat does #' mean in a macro?
12:19llasram&#'var
12:19lazybotjava.lang.RuntimeException: Unable to resolve var: var in this context
12:19mattmossvar, methinks
12:19craigbrowhois maintaing korma now?
12:20llasram&#'deref
12:20lazybot⇒ #'clojure.core/deref
12:20pjstadigclojurescript does not take pull requests
12:20llasramThere we go -- an example that isn't lies
12:20pjstadigthat was the source of the whole thread on the clojure ML
12:20augustlhmm
12:20gfredericksthat it used to? or somebody thought it should?
12:20pjstadighttps://github.com/clojure/clojurescript/pull/20#issuecomment-11119404
12:21llasram&(map class [#'deref deref])
12:21lazybot⇒ (clojure.lang.Var clojure.core$deref)
12:21edtsechcraigbro: alexbaranosky
12:22craigbrothanks
12:23augustlllasram: I don't get it at all :)
12:25gfredericksaugustl: it means the same inside a macro as outside
12:25gfredericksthe reader expands it to (var foo)
12:25augustlah
12:25gfredericksvar is a special form that looks up the var that a symbol refers to
12:25llasramMy pedagogical approach needs work
12:25llasram(inc gfredericks)
12:25lazybot⇒ 14
12:25gfredericksphew; no more unluck
12:27augustlattempting to grok the "context" macro in compojure
12:28clerksyIs there a way to call "lein test" from nrepl? I am a long time vim user currently trying out emacs. I would like to not have to leave emacs and hit the command line.
12:28craigbroclersky: M-x shell RET lein test
12:28clerksyAhh
12:29clerksycraigbro: Thanks, that clearly applied to all term commands then.
12:29craigbrowell, all term cmds that don't need a real tty
12:29craigbroaka, don't use curses and just spit text to stdout
12:29clerksyYeah
12:29craigbrohowever, you can also to M-x terminal
12:29craigbroif you want those
12:30craigbroit'll do auto paging etc..
12:30craigbroyou can run top inside it etc...
12:31clerksycraigbro: Thanks :)
12:56TimMcpjstadig: I could have sworn CLJS had a friendlier development model, including use of git as collaboration tool.
12:56Morgawrhello, I'm not sure if this is the proper place to ask but is it normal that the default example for the clojurescript one project (bare app with clojurescript) doesn't work? I input my name http://www.morgawr.eu/clj/#form here and it doesn't show me the following view...
12:57Morgawrit works fine in development mode, but after I build it, that's what happens
13:01technomancyMorgawr: I get the impression clojurescript one isn't actively maintained
13:01RaynesI never found it all that useful to begin with.
13:01RaynesPeople mostly just misinterpreted what it was for, probably because of its weird name.
13:02MorgawrI was mostly looking for a way to get started with clojurescript.. Like, I just want a simple environment where I can create powerful clojure functions that I can use in a web page
13:02progoHumm... I've got enlive deftemplate NPEing on me. Googled for some results for bad paths but I use absolute paths that are correct.
13:02Morgawreverybody pointed me to clojurescript one as the best place to start tinkering
13:05luxbockis there an easy way to use a map as though it's keys and values were reversed?
13:05technomancyluxbock: you can do (zipmap (vals m) (keys m))
13:06luxbockalright, thanks
13:06technomancyor if you're feeling fancy (apply zipmap ((juxt vals keys) m))
13:07technomancy(don't actually do that)
13:07luxbockhehe
13:07arrdemherm... so I started a clojure codebase for my compilers class and turns out I can only get away with a clisp. should I do a straight port and just get used to (setf), or try to add (reader?) macros to get clojure atop clisp?
13:09technomancyarrdem: you could help pjstadig with his elisp compiler =)
13:09technomancyCL is basically a superset of elisp
13:09technomancyarrdem: do they actually require clisp, or will any common lisp implementation do?
13:10arrdemtechnomancy: the prof has a 1k+ line code generator for SPARC in ANSI clisp, so there's a lot of reason to use clisp over clojure XP
13:10arrdembut any clisp
13:10arrdem'll do
13:11technomancy"clisp" is the GNU implementation of common lisp
13:11arrdems/clisp/common lisp/g
13:11RaynesCL is the commonly abbreviated form of "Common Lisp".
13:12technomancyif you're allowed to use ABCL you could probably use clojure's data structures
13:12technomancybut I don't imagine it would be much fun
13:13dnolenMorgawr: you're probably better off starting with lein-cljsbuild and going through this http://github.com/magomimmo/modern-cljs
13:14Raynesdnolen: That's also a weird name.
13:14Raynes:p
13:14arrdemok well thanks for the hints... pjstadig's compiler looks cool
13:14RaynesClojurescript is, by definition, modern.
13:14ChongLihaha
13:14ChongLimodern cljs
13:14RaynesCalling it 'modern cljs' makes it sound like he is revitalizing a 30 year old language.
13:15ChongLithat's the whole point
13:15ChongLiI love it
13:15technomancyyeah, I think it's intended to be ironic
13:15RaynesIt's possible he knew the irony.
13:19dnolenRaynes: heh, true but at least it starts from first principles
13:19Raynesdnolen: Oh, it looks great.
13:21mcohen3anyone used something like (.scheduleAtFixedRate (Executors/newScheduledThreadPool 1) to schedule a function? this seems to work fine if i pass something like #(println "hello") but if i use the name of the var of my function, it never seems to fire
13:21mcohen3pulling my hair out on this one
13:21mcohen3i've tried #(my-function) and just my-function as the arg
13:21mcohen3no joy either way
13:22seancorfieldgfredericks: sorry, got pulled away... the source for 0.2.2 is radically different to 0.2.4-SNAPSHOT so you'll definitely need to work out a patch against master
13:22seancorfieldI'm open to a discussion back and forth on github first prior to a patch on JIRA (since dnolen and nadamin seem to have set a good precedent there :)
13:23ChongLia link to this modern cljs github should be on a wiki somewhere
13:23ChongLithis is great
13:23llasrammcohen3: Just passing `my-function` as the Runnable should work fine. I'd guess your function is throwing an exception or otherwise failing to act as expected
13:24seancorfieldgfredericks: oh, that protocol commit is much simpler than i expected... nice...
13:26luxbockhow do I turn a numeral character into an integer? i.e. \9 = 9
13:26progo(Integer. (str \9))
13:26llasram&(Long/parseLong (str \9))
13:26lazybot⇒ 9
13:26AimHere,(integer/parseInt \9)
13:26luxbockah
13:27Raynes&(Long. \9)
13:27lazybotjava.lang.IllegalArgumentException: No matching ctor found for class java.lang.Long
13:27Raynes&(Long. "9")
13:27lazybot⇒ 9
13:27mcohen3thanks llasram
13:27Raynes&(Long/parseLong \9)
13:27lazybotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String
13:27RaynesHeh
13:27augustlwoha, macros! Writing my first useful macro DSL after 6 or so months of Clojure, pretty neat stuff
13:27TimMc&(- (int \9) 48)
13:27lazybot⇒ 9
13:27TimMc^ don't do that
13:28AimHere&(- (int \9) (int \0)) might be better style, although not good either
13:28lazybot⇒ 9
13:28Raynesaugustl: Hope it is a macro DSL around a usable functional interface.
13:28dnolenChongLi: done
13:30augustlRaynes: hmm, not following
13:30augustlRaynes: pretty sure the answer is yes though
13:31Raynesaugustl: Your code shouldn't be based around macros. The idea is to write your code with plain functions and then, if you want, write some macros to make working with that function-based interface nicer.
13:31RaynesI wasn't assuming the former, but I was mentioning it just in case.
13:31augustlRaynes: np, I appreciate it :)
13:33ChongLidnolen: which wiki is this?
13:33dnolenChongLi: look at the CLJS github landing page, there's a tutorial link now, and under the main wiki page a tutorials section
13:33dnolenand link to modern-cljs from there
13:34ChongLiahh nice
13:34TimMc&(- (int \9) 16r30)
13:34lazybot⇒ 9
13:35ChongLiI think it's pretty amazing how github has basically become the social network for programmers
13:35ChongLiis that the right term for it?
13:35ChongLiI guess it's more than that
13:36AimHereSocial? Programmers? What sorcery is this?
13:36ChongLithe really cool thing about it is that all the stuff is part of the repo so if github ever turned on the users they'd already have all their data cloned locally
13:37AimHereWhen I were a lad, programmers were made to sit alone in darkened rooms with green screen terminals, to be let out only to gather pizza and caffeinated beverages. Social networking was something they were actively shunned from
13:40ChongLihaha
13:50TimMcChongLi: What are you on about, IRC is clearly the social network for programmers.
13:50TimMcI can tell because that's what I use.
13:50Rayneshttp://i.imgur.com/2Fer8.gif when I have to go where people are.
13:50ChongLihaha
13:53luxbockis there a way that I could extend Clojure's >, < and = to compare playing cards that are represented as {:rank :ace, :suit :spade} and some other maps to represent their rankings?
13:54cbp`what's the deal with clojure-doc.org
13:54cbp`seems down most of the time
13:54AimHereI don't think clojure supports operator overloading
13:54luxbockalright, so I'll just write my own operators
13:54dnolenluxbock: you cannot override >, <. = can be overridden if you're using deftype
13:55technomancyluxbock: you can use :refer-clojure :exclude in the ns clause to bring in a different definition of anything in clojure.core
13:55technomancybut you can't extend the ones in clojure.core
13:56ibdknoxwow, I never realized they picked clojure-doc.org
13:56ibdknoxthat was dickish
13:57technomancyibdknox: eh? it's the same people as the people maintaining clojuredocs.org
13:57technomancythe long-term plan is to merge the two
13:57ibdknoxwat
13:57ibdknoxI though it was a rogue effort originally
13:58technomancyyeah, it's just blocked on getting a proper clojure web UI written for the existing clojuredocs API
13:58ibdknoxin that case it makes even less sense... a subdomain would've been far smarter
13:58ibdknoxwell that's good :)
13:58ibdknoxconfusing for now, but in the end a great outcome
13:58technomancythe original maintainer was MIA for a long time; they probably had access to the machine but not the DNS records
13:59technomancypossibly still MIA?
13:59TimMcnext.clojuredocs.org would be nice... if they could get it.
13:59ibdknoxah
14:00amalloyi have to say, if it's really the same people they've done a terrible job of saying so. i, like ibdknox, thought it was some totally different group of guys rudely using a near-identical domain
14:00ibdknoxyeah, I remember the threads
14:00ibdknoxit was definitely a splinter thing in the beginning
14:01technomancythe original maintainer disappeared and did a half-hearted handoff to one of the guys behind the new effort IIRC
14:02technomancywhole thing was a bit of a mess from the start; closed-source rails app =(
14:02TimMc$kill
14:02lazybotKILL IT WITH FIRE!
14:03amalloyluxbock: if you're interested, one of my first clojure projects was a card-game player, and the card-ranking mechanism is pretty simple at https://github.com/amalloy/ddsolve/blob/master/src/ddsolve/mechanics.clj#L31-L50. there's no real need to make > and < recognize cards
14:05amalloydon't take the project as a whole too seriously; i recognize now that it's loaded with bad ideas. but ranking cards is easy enough
14:05Raynesamalloy: trollface
14:05Raynesamalloy: Whoa, one of your first clojure projects? So you started around the time defrecord was invented?
14:05amalloyyes, i started just as 1.2 was coming out
14:05RaynesJesus, how on earth are you better at Clojure than I am if I've been doing it so much longer? Sheer experience to begin with?
14:06RaynesI'd guess so.
14:07ibdknoxRaynes: he's actually an AI designed solely to write clojure code and troll #clojure.
14:07ibdknoxRaynes: the guy we've met is a paid actor
14:07RaynesHe must be well paid.
14:07ChongLihmm, would core.logic be good for doing card game rules?
14:07RaynesHe lives 3 miles from me. Or at least, will in two weeks.
14:07amalloyhe would have to be, to put up with smelly humans all the time
14:08amalloyi mean, i am also a human and do not find humans in general smelly at all
14:08RaynesSomething fishy is going on here.
14:32TimMcHow do I tell lein2 to use my credentials.clj.gpg for Clojars?
14:33TimMcDEPLOY.md tells me to set :creds :gpg for Clojars, but I don't know where that goes.
14:34technomancyTimMc: I think in :repositories in the :user profile; lemme check
14:36gfredericksI need to learn to use irssi better; nearly missed seancorfield's replies :/
14:36TimMcWhat URL do I use for Clojars?
14:36technomancyTimMc: you can use #"clojars"
14:36ChongLigfredericks: lastlog is your friend
14:37gfredericksit tells me it would print 2107 lines
14:37TimMctechnomancy: So, any repo URL containing "clojars" will get my credentials?
14:37ChongLiput a query after it
14:37gfredericksooh
14:37gfrederickslike my nick
14:38ChongLi /lastlog -clear
14:38TimMcI suppose as long as the set of repos I try to push to is controlled by me...
14:38ChongLito get rid of it
14:38technomancyTimMc: right; I guess that could go wrong if you are tricked into using lein on a project with a hostile :repositories entry
14:38gfrederickslastlog is my friend
14:39TimMc#"^https://clojars\.org/.*&quot; should be fine.
14:39technomancyI thought irissi was for vim users?
14:39technomancyTimMc: it's just https://clojars.org/repo/ fwiw
14:40ChongLiirssi is just an irc client
14:41TimMctechnomancy: profiles.clj: {:user {:repositories [["clojars" {:url #"^https://clojars\.org/.*&quot;, :creds :gpg}]]}} then?
14:41gfrederickstechnomancy: I was using erc for a while. abedra said it was terrible and I should use irssi so I switched back unquestioningly.
14:41technomancyTimMc: sure
14:41technomancywhat
14:41craigbroI'm prety sue itjustuploads your public key
14:41gfredericksalso amalloy was always complaining about my away thing which I never understood.
14:42craigbroand doesn't ship any private keys
14:42gfredericks(I never understood the away thing; I usually understand amalloy)
14:42technomancyChongLi: I'm using "vim users" here as a shorthand for "people who don't use Emacs but still like things that run in a terminal" =)
14:42ChongLitechnomancy: oh
14:42ChongLiI use irssi and emacs
14:42TimMctechnomancy: "https://clojars.org/repo/ and #"^https://clojars\.org/.*&quot; have a type mismatch merging profiles." -- but then it knows to look for GPG credentials anyhow...
14:42ChongLiI guess that makes me a weird edge case
14:44ChongLiI've been using irssi since long before I ever tried emacs, however
14:44technomancyTimMc: oh, my bad. all you need in the user profile is this: :repositories [["clojars" {:creds :gpg}]]
14:44technomancyTimMc: the regex goes in credentials.clj.gpg
14:44TimMcIs that "clojars" string a regex, or a literal match?
14:44TimMc*name match
14:44technomancyTimMc: in that case "clojars" is a literal match, yes.
14:45technomancyso that profile merge will apply it to the existing clojars repositories entry
14:45TimMcAh, OK.
14:45technomancyprobably could use some clarification in the docs
14:45gfredericksis lastlog an irc feature or irssi?
14:45ChongLiis there any way to get a cljs browser repl without it starting a web server right on the spot? I'm already using ring to serve my application
14:45TimMcAnd I guess I need gpg-agent running as well.
14:46ChongLigfredericks: I couldn't tell you, I've been using irssi exclusively for so long
14:46ChongLihaha
14:48ChongLiirssi has lots of nice scripts, by the way
14:48ChongLihttp://scripts.irssi.org/
14:58gfrederickstechnomancy: you hate protocols?
14:58FrozenlockOh wow... ibdknox's lecture at clojure conj stops at a huge cliffhanger! https://www.youtube.com/watch?v=V1Eu9vZaDYw
14:59technomancygfredericks: I hate how people use protocols without understanding that they're sacrificing flexibility for performance.
14:59technomancygfredericks: also I love vars
14:59gfrederickstechnomancy: inflexibility versus what approach? multimethods?
15:00technomancygfredericks: versus anything that uses vars
15:00gfrederickslike robert.hooke?
15:00pjstadigtechnomancy: what you're saying doesn't make sense
15:00technomancyno, like defn and defmulti
15:00pjstadigprotocol functions are put into vars
15:00gfredericksis this about :reload and such?
15:01Raynes*shrug*
15:01RaynesI've never understood why he doesn't like them.
15:01Frozenlocktechnomancy: If I have java objects that I want to convert to maps (each with its own method), are protocols still bad?
15:01RaynesThey serve a specific purpose and are faster than multimethos for that purpose.
15:01pjstadigprotocol functions are functions and they live in vars
15:02pjstadigyou can map them, comp them, wrap them, partial them
15:02technomancypjstadig: sorry, I was referring to records and the fact that they usually go hand in hand
15:02technomancygfredericks: imagine this: you have two objects which print identically but are not equal
15:02pjstadigyeah records are a pain if you recompile them, because clojure generates an interface
15:03technomancyalso, protocols usually force awkward arity choices upon you
15:03technomancyin many cases where they're used people introduce nonsense hierarchies which aren't actually used by the function but are just used for purposes of dispatch
15:03gfrederickstechnomancy: what was the identical-printing-objects thought related to?
15:03ChongLito me protocols seem most useful if you want to implement your own collections with deftype or something
15:04technomancygfredericks: reloading records
15:04ChongLiotherwise just use maps and vectors
15:04pjstadigprotocol functions can have multiple arities
15:04pjstadigthey can't take primitive hints though, so that's definitely a tradeoff
15:04pjstadigand i guess they can't take varargs either
15:04gfrederickstechnomancy: I'm curious if you approve of https://github.com/fredericksgary/java.jdbc/commit/c5ea0ac2b8a0fedc383b985c90c3f69956b1f287
15:05technomancypjstadig: they can have multiple arities, but they force you to put the dispatch object first, which often interferes with what the function is actually about
15:05pjstadigyeah sure that's a tradeoff
15:06pjstadigi think the best practice is to use protocol functions as an internal implementation method, and have public functions that call them
15:06pjstadigso you can use varargs and order the args how you like
15:06technomancygfredericks: in that case you're probably justified given that you're likely to be in perf-critical code
15:07technomancyit bugs me when I see them exposed in application-level code
15:07gfrederickspjstadig: dnolen's approach of the -foo naming convention for protocol fns seems to have that organization as a side-effect
15:07gfrederickstechnomancy: yeah I haven't seen any compelling uses for protocols/types/records in app code
15:07danlarkinphil is right
15:07danlarkinprotocols are balllllllllllllllllllllllllllls
15:07technomancygfredericks: also you're undeniably intertwingled with all kinds of crazy class hierarchies there anyway, so normal rules of taste don't necessarily apply
15:07gfredericks:)
15:07bbloomgfredericks: yeah, i do that -foo protocol method and foo no - public method for *all* my protocols
15:08pjstadigdanlarkin: butt out
15:08danlarkinprotocols can sC-u 42 u ck it
15:08technomancydanlarkin: oh man you beat me to it
15:08ChongLiFrozenlock: multimethods have you specify your own dispatch function
15:08pjstadigyou just saw me talking to phil
15:08pjstadig:-p
15:08danlarkinno you butt out pjstadig
15:08ChongLiand then define methods on the value which results from that dispatch function
15:08technomancy~gentlemen
15:08pjstadig(he's looking at my laptop screen)
15:08technomancyaw come on clojurebot; ruining my timing
15:09danlarkinsrsly
15:09technomancyclojurebot: gentlemen
15:09pjstadigthe tubes must be clogged
15:09hiredman~ping
15:10FrozenlockChongLi: Protocols do it too, don't they? (extend-protocol class fn...
15:10dnolengfredericks: that protocol fn + fn naming style was actually already in place in CLJS
15:11ChongLiFrozenlock: no, protocols dispatch on types
15:12ChongLiyou could write a multimethod that uses even? as its dispatch function, for example
15:12ChongLiand then do different things whether the number is even or odd
15:12ChongLias a silly example
15:14AimHere(defrecord EvenNumber [x] ...)
15:14FrozenlockChongLi: Silly example, but straight to the point :)
15:14gfredericksdnolen: did you specifically backport core.logic to that style? now that I think about it I'm not even positive core.logic does have that style :/
15:15TimMctechnomancy: And what is Clojars' releases URL?
15:15technomancyTimMc: https://releases.clojars.org/repo/ but you never need creds for that
15:15TimMc?
15:15technomancybecause you deploy to it through the regular repo + promotion
15:15TimMc"No credentials found for releases"
15:15TimMcIt sure sounds like lein is trying to find it.
15:16technomancyare you trying to deploy to it?
15:16TimMc"lein deploy"
15:16dnolengfredericks: oh yes, the CLJS version of core.logic uses that style. When the CLJ/CLJS story improves I'm planning having one codebase w/ the CLJS protocol style
15:22bbloomdnolen: how up-to-date does the cljs core.logic stay?
15:27ChongLiare there any plans for some kind of CLJ/CLJS subset for common libraries?
15:32bbloomChongLi: it's something that lots of folks are interested in
15:32bbloomit seems like a self-hosting cljs compiler is a more pressing desire that would make that sharing between platforms easier to achieve
15:33TimMctechnomancy: Ah, it is `lein deploy clojars`.
15:33ChongLithat would be pretty cool
15:33ChongLiwould it run on headless V8 a la node?
15:34ChongLiwe'd finally be able to write some fast-starting shell scripts in clojure
15:41dnolenbbloom: doesn't stay up to date at all
15:41bbloomdnolen: yeah, that's what i figured. it's a pita to maintain two libs :-/
15:42bbloomi was working on my little dom manipulation library in clojurescript, but the implementaiton wasn't interesting: the interface was the interesting bit... so i used Apache Batik for an SVG DOM and then worked out the interface all in clj instead of cljs... the iteration times were much better
15:42dnolenbbloom: yes and they probably actually need to be slightly different for performance reasons as well. PHMs are not as fast in CLJS
15:43bbloomdnolen: how big is the perf gap?
15:45dnolenbbloom: around 6-8X for zebrao last time I checked. CLJS takes 17ms-20ms, CLJ ~2.5ms
15:45bbloomdnolen: any idea the underlying source of the slowness?
15:46dnolenbbloom: I can't use PHMS
15:47dnolenbbloom: those CLJS numbers are within 1.5X of miniKanren under Racket & Chez Scheme so they are pretty good.
15:47bbloomdnolen: heh, yeah that's impressive
15:47dnolenbbloom: it is.
15:48dnolenbbloom: you'll definitely being able to do serious logic / constraint stuff in the browser.
15:48dnolenbe able
15:48ChongLiPHM?
15:49bbloomChongLi: persistent hash map
15:49ChongLioh
15:49bbloomthe backing type for most map objects
15:49ChongLithey aren't in cljs?
15:50bbloomthey are, he's just saying they are a tad slower than clj on the jvm
15:50ChongLiah
15:50bbloomdnolen: although i'm curious why that's the case...
15:51dnolenbbloom: PHM does a lot of allocation, we're also missing native bit population count operator (not sure if that's a bottleneck but it's suspicious)
15:52dnolenso I avoided PHMs
15:52dnolenit's been a while since I checked JSC or SM, but back when I originally did the PHM benchmarks, SM & JSC were 8-10X slower
15:52dnolenV8 is better but still far cry from JVM
15:53ChongLidoes jvm have popcount?
16:00dnolenChongLi: it does
16:01ChongLiman, javascript is the craziest language that people actually use
16:01ChongLiimplicit coercions on equality operations? wow
16:02TimMcChongLi: Doesn't PHP do that?
16:02AimHerePerl too, I thought
16:03TimMc&(.bitCount 42)
16:03lazybotjava.lang.IllegalArgumentException: No matching field found: bitCount for class java.lang.Long
16:03TimMc&(Long/bitCount 42)
16:03lazybot⇒ 3
16:04TimMc3 million Blub programmers can't be wrong!
16:04ChongLihaha
16:09dnolenhttps://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1418
16:09dnolenis what bit-count looks like in CLJS
16:12brehautdnolen: minor minor quirk, "Counts the number of bits set in n" [v]
16:12brehautdocs say n, args says v
16:13tickingam I the only one finding incanter very unclojury and rather common lispy ^^?
16:16gfrederickshow do I build a contrib project for pushing to clojars?
16:17gfredericksthe pom.xml has some odd parent entry in it that I assume takes special handling
16:19dnolenbrehaut: thanks
16:20dnolenticking: it's an old Clojure library.
16:22tickingdnolen, possible, I've seen many other old libs though that don't use implicit variable bindings and macros everywhere ^^
16:24technomancyticking: yeah, but those libs got it right by luck =)
16:24SgeoAre recruiters evil?
16:25bhenry1hello
16:25technomancySgeo: most are. possibly not all.
16:26SgeoHow do I be careful?
16:26SgeoBecause I've been talking to one, I think
16:26gfrederickstry to keep them on the phone
16:26gfredericksask them where the bomb is
16:26gfredericksand how to disarm it
16:26gfredericksstay calm
16:26SgeoSomeone suggested that the only reason he asked me to make changes to my resume rather than changing it directly was because I used LaTeX
16:28bhenryi just did a `git pull` on my emacs.d from emacs-live and there is no more clojure-jack-in. can someone point me at the documentation of changes?
16:28SgeoProbably doesn't help that I didn't give an answer when he asked how much I was looking for
16:28tickingtechnomancy hrhr
16:28SgeoMoney... stuff... is beyond me
16:29craigbronrepl-jack-in?
16:30TimMcSgeo: I pretty much just hang up on recruiters at this point. THere might be some nice ones, but I'm done wasting time on the jerks.
16:30SgeoWhat, exactly, do the jerks do that are evil
16:30SgeoOr jerk-y?
16:31technomancySgeo: most recruiters cast a wide net because taking the time to actually making sure that a candidate is a good fit for a position does not scale
16:31dnolenticking: yeah I'm with technomancy. Early Clojure libs went wild with dynamic binding & macros
16:32bhenrycraigbro: thanks!
16:32pjstadigtechnomancy: the other really annoying thing with protocols is that they don't play nicely with M-.
16:32technomancypjstadig: hush, you're only encouraging him
16:33technomancyoh wait
16:33Raynesalex_baranosky: Is there a way to find out which fact is taking a bazillion years (infinite looping) when running midje tests?
16:35RaynesOh wow, what luck. It happened to be the first one I commented out.
16:35RaynesThat's dadgum magical.
16:36craigbromany, binary search is fast!
16:36craigbros/many/man
16:36gfredericksRaynes: actually you were just 1 over the max-tests limit
16:37augustllooking for suggestions on how to better implement "doit" https://www.refheap.com/paste/8875
16:38clerksyOk, I am the only one who finds paredit annoying as can be?
16:38TimMcSgeo: They call me at work. On my work phone.
16:38AimHereYou're not, clerksy
16:38technomancyclojurebot: paredit?
16:38clojurebotparedit tutorial is http://p.hagelb.org/paredit-outline
16:38clerksyI am just picking this up, but man if forces parens in wrong spots and I still cant find how to remove them
16:38augustlclerksy: I love it! If you're the type of person that isn't a good fit for paredit, you should change your personality :)
16:38TimMcHow antisocial is that?
16:38gfredericksaugustl: wow man what the heck is that doing
16:38Frozenlockclerksy: No, but apparently it's the best thing since butter, so don't say it... :P
16:39SgeoTimMc, o.O
16:39augustlgfredericks: mapping the second item in a list
16:39clerksytechnomancy: Thanks, I will check this out.
16:39TimMcAlso they usually don't take the time to find out anything about me.
16:39augustlgfredericks: it's for some sexp rewrites for a macro..
16:39AimHereI occasionally go into paredit mode and think 'Okay, I can see the point of this' and then I spend 2 minutes trying to delete a loose pair of parens and I turn it off again for 6 months
16:39technomancyclerksy: actually I was trying to remember if I had already taught clojurebot a certain factoid
16:39gfredericksaugustl: destructuring would help
16:39technomancyclojurebot: paredit |is| not for everyone, but what you need to understand is how to become the kind of person that paredit is for.
16:39clojurebotIn Ordnung
16:39technomancythere we go
16:39TimMchaha
16:40augustlexactly :)
16:40Raynesclerksy: You get used to it. It's a lot more useful than it is annoying.
16:40TimMctechnomancy: Unfortunately, clojurebot has misinterpreted that. You included an " is " later in the factoid.
16:40gfredericks,((fn doit [f xs] (map (fn [[a b & cs]] (list* a (f b) cs)) xs)) '((123 "foo" 456) (123 "bar" 456)))
16:40clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval29$doit>
16:40augustlgfredericks: ah
16:40technomancyTimMc: I thought |is| forced it to be at the right place?
16:41clerksyRaynes: I hope so.
16:41gfredericks,((fn doit [f xs] (map (fn [[a b & cs]] (list* a (f b) cs)) xs) '((123 "foo" 456) (123 "bar" 456)))
16:41clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
16:41TimMctechnomancy: That's only for forgetting, I think.
16:41gfredericks,((fn doit [f xs] (map (fn [[a b & cs]] (list* a (f b) cs)) xs) '((123 "foo" 456) (123 "bar" 456))))
16:41clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval87$doit>
16:41Raynesclerksy: When you find yourself in a cave and it's dark and you're likely to be eaten by a grue, you'll be happy you can wrap yourself in protective parens with a single keystroke.
16:41technomancyTimMc: curses
16:41TimMcseveral, yes
16:41gfredericksaugustl: I give up; you can debug it :)
16:41technomancyclojurebot: paredit |is| not for everyone, but what you need to understand ís how to become the kind of person that paredit ís for.
16:41clojurebotAlles klar
16:41technomancyTimMc: tada!
16:42augustlgfredericks: didn't know about list*, nice
16:43augustlclerksy: it's probably annoying to not be able to do anything you want, but that's the power of it
16:43TimMctechnomancy: ...nice.
16:43TimMcUnfortunately, there's no way to kill the old one.
16:43augustlgfredericks: much better, thanks :)
16:43technomancyblargh
16:44gfredericksaugustl: for super funs use (partial map ...)
16:44TimMcaugustl: Needs more destructuring.
16:44gfredericksi.e., (def doit (partial map ...))
16:44technomancyTimMc: I could break into hiredman's place of residence, but I think he runs it off-site
16:45augustlended up with this: (map (fn [[x1 x2 & xs]] (list* x1 (str "prefix-" x2) xs)) xs)
16:45hiredmanI should write a bnf for clojurebot factoids and redo the parser
16:47TimMc&(let [do2 (fn [f] (fn [[a b & c]] (list* a (f b) c)))] (map (do2 #(str "prefix-" %)) '((123 "foo" 456) (123 "bar" 456))))
16:47lazybot⇒ ((123 "prefix-foo" 456) (123 "prefix-bar" 456))
16:47augustlnow write a do-n :)
16:53pjstadighiredman: haha you and bnf
16:55tickingdnolen, it's really interesting to see how the style changed, thanks for the insight :D
17:03maiohow can I reduce list so that I get every Nth element of it?
17:04AimHere.(map first (partition-all 5 (range 50)))
17:04AimHere&(map first (partition-all 5 (range 50)))
17:04lazybot⇒ (0 5 10 15 20 25 30 35 40 45)
17:04maionice, thanks :)
17:07augustlmmm, decomplecting
17:08FrozenlockVery nice! It's a shame that I always forget about partition.
17:09TimMcbnf bnf bnf bnf wubwubwub
17:10tomojI guess the expectation with ring's session middleware is that you return a response with {:session (update-session (:session req))} ?
17:11tomoji.e. "don't change the session at all" is (fn [app] (fn [req] (assoc (app req) :session (:session req))))
17:11tomojwhich still calls write-session
17:21augustltomoj: I've only used the cookie store
17:21augustlworks well enough for me :)
17:22technomancytomoj: I think if you return a map without a session key it shouldn't change it?
17:22technomancyyou have to explicitly say :session nil to clear it IIRC
17:38FrozenlockDamnit github, stop messing my readme.org files!
17:39RaynesDamnit Frozenlock, stop using org-mode for readmes.
17:39technomancygithub's org implementation is a lost cause
17:40brehautmarkdown all the things :(
17:43Frozenlockbrehaut: I'd rather write a txt
17:43FrozenlockOr write an org and then export to txt. Mouhahaha!
17:43RaynesFrozenlock: Why not write org and export to markdown?
17:43Raynes;)
17:44FrozenlockDidn't know it could... must be the single file format I've never exported an org file to. o_O
17:45RaynesFrozenlock: Dunno if it can. Pandoc can do pretty much anything these days. I one exported kleenex to handkerchief.
17:46bbloomRaynes: does pandoc produce decent results?
17:47Raynesbbloom: I was using it to write my book at one point.
17:47bbloomRaynes: i meant for conversions
17:47Raynesbbloom: I was using it to convert markdown to latex. Do the math.
17:47bbloomah ok
17:47Raynes:p
17:48FrozenlockShould I refer to hash-maps as maps, or smaps?
17:48RaynesGinger smaps.
17:48bbloomFrozenlock: not all maps are hash maps
17:49Frozenlock(╯°□°)╯︵ ┻━┻
17:49weavejesterDoes anyone know of a safe Clojure pr-str implementation?
17:49bbloomweavejester: what do you mean by "safe" ?
17:50weavejesterOne where (= x (read-string (pr-str x))) is always true
17:50bbloomcan't exist really
17:50technomancysure it can
17:50weavejesterEr, let me clarify that - always true or throws an exception.
17:50bbloomwell it certainly DOESN'T
17:51bbloomweavejester: ok, well that's a different thing :-)
17:51bbloomyou can implement that trivially as an assertion type thing
17:51technomancyweavejester: so I forgot about this from our discussion earlier, but my first attempted patch for Clojure was to fix this: http://dev.clojure.org/jira/browse/CLJ-17
17:51weavejesterUnfortunately I ran into a problem with records
17:52bbloom(defn pr-str-safe [x] (let [s (pr-str x) y (read-str s)] (assert (= x y)) s)))
17:52weavejestertechnomancy: Interesting
17:52weavejesterbbloom: Doesn't work with records
17:52bbloomweavejester: it throws an exception is they aren't equal, which is one of your requirements
17:53technomancyweavejester: reader syntax for arbitrarily-named keywords/symbols is definitely the way to go in the long-term
17:53weavejester(let [x #foo {:a 1}] (= x (read-string (pr-str x))))
17:53weavejesterThat is always false
17:53bbloomis that a tagged literal or a record?
17:53weavejesterA record isn't like a map, apparently. Printing and then reading it results in a value that is not equal to the original
17:53weavejesterA record
17:53Raynesbbloom: I hereby challenge you to a game of texas hold 'em.
17:54bbloomRaynes: um, ok... but why?
17:54weavejesterI also tried (= (pr-str x) (pr-str (read-string (pr-str x))))
17:54RaynesBecause poker is fun.
17:54weavejesterBut I realized that wouldn't work with maps, due to key ordering
17:55bbloomRaynes: heh, indeed, but i don't play online - in person only
17:55dpwrightHello, I'm having a little trouble compiling/serving a LESS css file using Dieter with Compojure/Ring -- I'm not sure if this is the right room to ask about this sort of thing or if there's somewhere more specific, but I thought I'd try here first
17:55bbloomRaynes: and only with cash :-)
17:55RaynesI really would hate to take your paycheck from you.
17:55technomancylazybot plugin
17:55bbloomi don't have a paycheck, so it wouldn't be an issue :-P
17:55bbloombesides, i wouldn't want to steal your milk money
17:56RaynesOooh burn.
17:56bbloomalthough i'm not really sure why we're trash talking about poker all of a sudden, lol
17:56brehautdpwright: just ask your question. if someone can help, they will
17:56dpwrightThe long and short of it is I'm getting a null pointer exception whenever I try to access a file which exists in the folder I've specified as dieter's assets folder
17:57weavejesterMaybe I should write an edn-printer
17:57dpwrightYou can see the stacktrace if you go to wedding.test.dpwright.com and click the "link" link... "sample.less" is a file in the resources/assets/css folder
17:58dpwrightthat link was generated with dieter's link-to-asset function
17:58dpwrightmy suspicion is that I'm hooking the dieter middleware in wrong, or something
17:58bbloomweavejester: if you want to extend fipp, i'd be happy to help
17:58weavejesterfipp?
17:58bbloomweavejester: github.com/brandonbloom/fipp
17:59weavejesterbbloom: Ahh, well I'm not really after a pretty-printer
17:59weavejesterJust a way of storing Clojure data structures
17:59bbloombut it's almost as fast as a normal printer :-) and my plan is to be able to compile a non pretty printer statically
18:01technomancyall I want from a pretty-printer is the ability to reformat my code like this: http://technomancy.us/50
18:01weavejesterbbloom: Hm… it seems like they'd be different goals...
18:02bbloomtechnomancy: totally doable :-P
18:02bbloomweavejester: how so?
18:02technomancybbloom: I assumed so; just thought I'd check to make sure
18:04weavejesterbbloom: Well, pretty printing is about making things easier for a human to read. An EDN writer would be focused on adhering safely to a spec that, as far as I can tell, in some cases is subtly different from Clojure.
18:04weavejesterOr rather, stricter than Clojure
18:05bbloomweavejester: so the \i part of "fipp" is for being idiomatically data driven. i'd like to evolve towards a model where you can generate various types of output from common input documents. ie a pretty formatted representation, or one with color coding, or an html representation, or compile a non-pretty fast printing version, etc
18:06bbloomweavejester: it's not there yet, and i need to put some thought into the details of that document format (it will likely evolve to be somewhat DOM-like in the sense that each node has a tag, some attributes, and some children) and how to process it
18:06weavejesterHmm, it feels a little complex...
18:06TimMcweavejester: (fn [& _] (throw (RuntimeException.))) is a safe implementation. :-P
18:07weavejesterTimMc: :P
18:07clojurebot:negative/num-1 + :positive/num-1 = :zero/zero
18:07bbloomweavejester: it's more complex than a single hand coded print routine, but as you've discovered, that doesn't scale
18:07weavejesterbbloom: Doesn't scale?
18:07weavejesterI'm dealing with heavily io-bound data. Scaling isn't the problem for me :)
18:08bbloomweavejester: i mean scale in the design sense
18:08bbloomin order to get print/read to work correclty, it requires people write correctly bijective functions
18:08weavejesterThe problem is storing a data structure that can be always be read.
18:08bbloomyou can generate those functions from a grammar!
18:08weavejesterYe-eeesss…
18:08bbloomfipp is only interested in the print side of the equation for now, but the same ideas can be applied: data all the things
18:09weavejesterI was kinda looking for a solution I could implement in… say… an hour :)
18:09bbloomyeah, not gonna happen even if you go the naive route of hand coded functions lol
18:09kovaslol
18:10weavejesterbbloom: Well… I think it might be possible
18:10weavejesterI mean, pr-str works, it just doesn't validate.
18:10weavejesterSo I just need to ensure that a data-structure adheres to the rules of EDN
18:10bbloomuse that asserting version i wrote above ^^ use that during development
18:10weavejesterbbloom: The asserting function doesn't work with records, and I need to store records.
18:11bbloomi dont understand what the issue is with records
18:11weavejesterOkay, try this...
18:12bbloom,clojure.reflect.Field
18:12clojurebotclojure.reflect.Field
18:12bbloom,(pr-str (clojure.reflect.Field. 1 2 3 4))
18:12clojurebot"#clojure.reflect.Field{:name 1, :type 2, :declaring-class 3, :flags 4}"
18:12bbloom,(read-string (pr-str (clojure.reflect.Field. 1 2 3 4)))
18:12clojurebot#clojure.reflect.Field{:name 1, :type 2, :declaring-class 3, :flags 4}
18:12bbloomseems to work to me...
18:13bbloom,(let [obj (clojure.reflect.Field. 1 2 3 4)] (= (read-string (pr-str obj)) obj))
18:13clojurebottrue
18:13bbloomworks fine
18:13weavejesterUh… hm… it does for me now as well...
18:13weavejesterLet me retry with the data from before.
18:14weavejesterAhah
18:14weavejesterIt's because I used map->record
18:14dpwrightThis is how I'm passing the middleware to the handler I've specified using the lein-ring plugin as my ring handler: https://gist.github.com/4599677
18:15weavejesterOr… huh, map->record works under some circumstances.
18:15weavejesterAnd not under others
18:15dpwright(I'm just getting started with ring and compojure and figuring how it all fits together, so I'm not sure this is correct)
18:15weavejesterMaybe if it's in a different namespace...
18:16dpwrighttrying to access any file which doesn't share the first portion of its filename (before the extension) with a file in the assets directory results in a 404, but anything which does (for example, I have sample.less in assets; I could try sample.foo, sample.blah, sample.anythingelse), results in this null pointer exception
18:17bbloom,(clojure.reflect.Field. 1 2 3 4)
18:17clojurebot#clojure.reflect.Field{:name 1, :type 2, :declaring-class 3, :flags 4}
18:17bbloom,(= (clojure.reflect.Field. 1 2 3 4) {:name 1 :type 2 :declaring-class 3 :flags 4})
18:17clojurebotfalse
18:17bbloom,(= {:name 1 :type 2 :declaring-class 3 :flags 4} (clojure.reflect.Field. 1 2 3 4))
18:17clojurebotfalse
18:17bbloomweavejester: not sure what issue you're having
18:17TimMc,(doc map->record)
18:17clojurebotNo entiendo
18:18weavejesterbbloom: I'm finding that under some circumstances, (= x (read-string (pr-str x))) returns false for some records I created.
18:18bbloomweavejester: are you sure you don't have old instances?
18:18weavejesterTimMc: By map->record I mean map->{record name}
18:18bbloomif you re-evaluate the defrecord, then the types are different for new instances
18:19weavejesterbbloom: It's a new REPL, and the problem occurs when running in the main class, too.
18:19weavejesterbbloom: Hang on, I'm trying to work out how to minimally reproduce it.
18:19bbloomweavejester: try to isolate it in a new project
18:19weavejesterThat's what I'm doing :)
18:19brehautdpwright: i cant answer you dieter question, but re:ring/compojure, do you understand that compojure basically just creates ring functions, and that ring functions just map a request to a response?
18:22TimMcweavejester: "sometimes" -- some objects in the same REPL, or some REPL sessions?
18:22dpwrightbrehaut: I understand in so much as I know that's what compojure's doing, but having never written ring functions without compojure or used ring without the lein-ring plugin I couldn't really claim to understand what the ring functions compojure outputs would actually look like/represent
18:23gfredericksprobability a random ping-pong game contains the score 7-11: 1989/8192
18:23weavejesterTimMc: I'm starting a new REPL each time to test it.
18:23brehautdpwright: have a look at http://brehaut.net/blog/2011/ring_introduction (sorry for tooting my own trumpet)
18:24weavejesterOdd...
18:24brehautdpwright: you particluarly want the preamp, 'the basics…' and 'compojure' sections.
18:24weavejesterI get true when running a REPL in the project that defines the record
18:24brehauts/preamp/preamble/
18:24weavejesterAnd false in another project that depends on the record
18:25weavejesterThe other project has a :main namespace though, so maybe that's it...
18:26weavejesterHm, no. Even if both environments start off as blank "user" namespaces
18:26dpwrightbrehaut: Thanks! I think I've come across this page before, back when I was trying out noir, and I skipped it at the time because noir hides a lot of that away
18:26weavejesterAnd I run the same code
18:26dpwrightI'll read it through properly now
18:26weavejesterThe project repo REPL works, the dependent project REPL doesn't...
18:27weavejesterCurious.
18:27weavejesterI'm using a checkouts dir, so I know the code is identical.
18:28hiredmanweavejester: checkouts will make it be less likely to work
18:28weavejesterhiredman: Hm, why?
18:29hiredmanweavejester: I imagine what you are seeing is records with the same "name" that are backed by different jvm classes with the same name
18:30weavejesterhiredman: Yes, that's my thought, but I don't know why that would be the case.
18:30weavejesterOkay, here's what I'm doing:
18:30hiredmanwhich could happen if you aot compile (which generates classes for records) then turn around and eval a .clj
18:30weavejester(require 'foo.core)
18:30hiredmancheckouts just give .clj src, and I ampretty sure the jar is still on the classpath too
18:30weavejester(def f (foo.core/map->Foo {:id 1}))
18:31weavejester(= f (read-string (pr-str f)))
18:31TimMcweavejester: Get the classes of the input object and the read-back object and compare them.
18:31weavejesterIn project "foo", this returns true
18:31weavejesterIn project "bar", which has a dependency on "foo", this returns false,
18:31hiredmanweavejester: I imagine if you reload the srouce for foo.core comparison will come out fine
18:31hiredmanhave you cleared out classes recently?
18:32weavejesterThese are from blank REPLs.
18:32TimMclein clean
18:32weavejesterOhhh
18:32weavejesterGood idea!
18:32TimMcThere's a classes dir, possibly in ./target
18:33weavejesterHighly possible. Project "foo" is just a library. Project "bar" has a -main gen-class.
18:34hiredmanweavejester: yeah, so you could have some stale transitively compiled code
18:34weavejesterAh, yes, that works now that I've lein-cleaned. Let's see if it works with a :main namespace now as well
18:35weavejesterYep, it does.
18:36weavejesterAh geez, I should have guessed it was an unclean targets dir with an obsolete record class.
18:36weavejesterhiredman: Thanks a lot!
18:36TimMc(-> (map->Foo {:a 1}) class (.getResource "/clojure/lang/RT.class"))
18:37hiredmanTimMc: no /
18:37TimMc^ Something like that, but with Foo's class in the path string and run once on each object might have told you what you needed to know.
18:37weavejesterResources never begin with a /
18:37TimMcIn this case they do.
18:37weavejesterReally? Huh...
18:37TimMcI mean, empirically.
18:38hiredmanTimMc: most likely a quirk of a particular classloader
18:38TimMcPerhaps.
18:38weavejesterSo anyway, this bug is kinda odd, because it means the map->Foo function was returning a different class to the one read-string was constructing.
18:39weavejesterI guess a quirk of the classloaders...
18:39TimMcclojurebot is requiring no slash; my REPL is requiring the presence of one.
18:39weavejesterI'm not sure why it would be different. Maybe something specific to nREPL...
18:39weavejesterI thought this error occurred outside of nREPL, but maybe I imagined that.
18:43hiredmanweavejester: classloading can get weird, it is mutating state after all
19:02jballancI may be smoking something...but is there a "standardized" way of providing a default implementation for a protocol method?
19:02bbloomjballanc: extend to java.lang.Object ?
19:02jballancI vaguely recall a hack to define defaults using a macro and metadata
19:02jballancbbloom: yeah...that's the sort of hack I'd kinda like to avoid
19:02bbloomjballanc: how is that a hack?
19:03bbloomisn't that exactly what you want?
19:03bbloomor rather: how is that different than what you want?
19:03jballancI just want any type that implements the protocol to get the method
19:03jballancnot every object
19:04bbloomOh, ok, sorry, my brain is elsewhere :-P
19:04hiredmansounds like it should be a function
19:04hiredmannot a protocol function
19:04RaynesThat's just a function, jballanc.
19:04jballancwell, that's what I'm doing now
19:04RaynesYou don't need a protocol for that.
19:04bbloomyeah what they said :-)
19:04jballancwell, no I mean I have a protocol with 3 functions
19:04jballanctwo are different for each type
19:04jballancbut the third is shared
19:05bbloomyou can use extend
19:05bbloom(def common-bits {:the-fn (fn [this x y z] ...)})
19:05hiredmanso your protocol is not granular enough
19:05jballanchiredman: yeah...this is probably YAGNI
19:05bbloom(doseq [t [TypeA TypeB]] (extend t common-bits))
19:05hiredmanthe third shared bit should be a function written in terms of the protocol
19:06jballancgood point
19:06bbloombut in the common case, hiredman is right
19:06jballancbtw...has defn- fallen out of favor?
19:07jballancI thought I had read that a while back
19:07RaynesI don't use it.
19:07RaynesI know a few other people who don't care for it.
19:07technomancyI like it
19:07RaynesIt doesn't matter, but I prefer it because there is unlikely to be any more convenience macros for creating private vars in clojure.core.
19:08hiredmanprivate is silly
19:08bbloomi use it, but only b/c there isn't a good mechanism for building a public API namespace from the components of several implementation namespaces
19:08RaynesAnd if they aren't going to cover everything, they shouldn't cover anything.
19:08bbloomoddly, i miss that __ALL__ hackery from python
19:08Raynes^:private is a lot more descriptive than defn-
19:09technomancyanything that makes it more likely for authors to be careful about implementation details is OK in my book
19:09jballancyeah, in this case I want to write a very generically-named convenience like "exists?"
19:09jballancbut I worry about it leaking
19:09pjstadigyou could letfn like (letfn [(foo [a] (* a2))] (defn frobnicate [b] (foo b)))
19:10bbloomkovas: speaking of mathematica, do you know of any algebra systems in clojure? i know that there is that mathematica bridge and whatnot, but i'm just curious to see how other people have approached implementing a simple algebra system in clojure. i think i want a really really simple one for basic linear expressions and keyword getters
19:10pjstadigclosures are a nice classic way to encapsulate
19:10tomoj"finger trees in clojurescript" sweet! "Concrete measure type should be bound to these vars with with-measure macro" aww
19:10kovasbbloom: i saw something on github.. lemme see if i can find it
19:11hiredmanpjstadig: but encapsulation is silly
19:12bbloomkovas: i was considering putting together a really simple one suited to my particular needs. my purposes are basically analogous to angular's expressions & filters, but with some differences
19:12hiredmanfrom a consumer of libraries standpoint, why would you limit the amount of functionality exposed?
19:12kovasbbloom: theres https://github.com/bmillare/dj.math , but who knows what it does
19:12kovasbbloom: i would do my own if i was you
19:12bbloomkovas: that's the plan, but was just curious
19:13kovasbbloom: everyone seems to have their own idiosyncratic take in this space
19:13bbloomwhich space are you referring to? symbolic systems? or binding expressions?
19:13pjstadighiredman: no it's not. it seems silly to say it's silly
19:13technomancypjstadig: he's just messing with you
19:13kovassymbolic systems
19:13bbloomkovas: yup
19:14kovasand algebra
19:14kovaswhich may or may not have some reasonable symbolic system underneath it
19:14kovasi did a pretty fun google scholar search last night
19:14hiredmanpjstadig: it is, as a consumer of libraries, when I want to use function X, but function X is private, or let bound or whatever, it is annoying
19:14kovassearch term: prolog compiler term rewriting
19:14bbloomyeah, i just need a basic algebraic system: pretty much simple arithmetic, get-in, assoc-in, etc
19:15technomancyhiredman: wait are you joking or not?
19:15bbloomkovas: needs to be pluggable tho, b/c i'm gonna want like number -> currency formatted string, and then parsing back the other way
19:15hiredmanencapsulation leads to attempts to be overly generic, while limiting the ability to actually reuse the code, by hindering people trying to customize it to their needs
19:15hiredmantechnomancy: I am not
19:16hiredmanclojure's private is slightly less hideous then java's
19:16bbloomkovas: but i don't need systems of equations or anything, just single output in both directions... i do.. however.. need compilation :-)
19:16technomancyhiredman: as a consumer of libraries it's very annoying for me to bring in a function and then to have it change in a future version because it turned out to be an implementation detail
19:16hiredmantechnomancy: *shrug* if you don't want api churn stop updating deps
19:16kovasbbloom: yeah i hear you on that
19:16technomancyhiredman: not always an option
19:17technomancyI'm glad I have the ability to rely on implementation details when I deem the time is right, but doing it by default is just plain crazy
19:17kovasbbloom: the literature is fun but a long way from being immediately useful
19:17kovasbbloom: have you looked at "lenses" ?
19:17bbloomkovas: yes, but lenses are not what i want at all
19:17pjstadighiredman: as a consumer of my library you'll use the function i let you use *shrug*
19:18bbloomkovas: lenses are concatenative and compositional in a way that i simply don't need. they introduce a bunch of ambiguity and complexity that i don't care about
19:18kovasbbloom: don't you just want rules for (currency (number x)) and (number (currency y)) ?
19:18kovasyes i agree
19:19bbloomkovas: little more complex than that, b/c it might be: (format-number the-number the-format-string)
19:19kovasthough i feel they could be made simpler, if you remove some of their requirements
19:19bbloomkovas: in that case, i need to be able to say "well, the-format-string is a modifier, not an input"
19:19bbloomor just say "the format string isn't two-way bindable"
19:19kovasnot an input because its not gonna change?
19:19kovasi see
19:19bbloomyou need some kind of type system
19:19bblooma very simple one will do
19:20kovasmost types can be emulated with another layer of symbolic wrapping
19:20bbloomyes
19:21bbloomand i don't mind if it's a little trickier or more work to implement a new function in this world
19:21bbloomb/c the included set should be sufficient for most needs
19:21kovasthings get more complicated before they get simpler
19:21kovasjust like term rewriting :)
19:22bbloomand even if you need a custom expression/filter/converter/whatever, you only need a few of them & they are very specific to your app, so forcing people to write two annotated functions for convert & convertBack is fine
19:23jballanchiredman: but then what about convenience functions? in my case, I want to do a head request on a url to check for existence
19:23kovasI'm having flashbacks just thinking about the topic
19:23bbloomkovas: ha
19:23hiredmanjballanc: and?
19:23kovasthe number of things to worry about seems large
19:24kovasbut if your over the hump in terms of implementation thats promising
19:24jballanchiredman: well, that doesn't seem like a method that anyone would care to use outside of my library
19:24jballancbut, more importantly in my mind, what do I call it?
19:24bbloomkovas: i'm over the hump on model -> view -> platform
19:24bbloomkovas: still need to work out the finer points of model <- view <- platform
19:24hiredmanjballanc: yeah, but on the flipside, what is the advantage to hiding it?
19:24kovasbbloom: so is the UI just one big data structure, or are there references between a set of structures?
19:25jballanchiredman: if everyone only used "require", none ;-)
19:25bbloomkovas: there are exactly 2 atoms: model & view
19:25jballancwell...require without a :refer :all
19:25jballancbut I've been burned by trivial naming conflicts too many times in the past...
19:25kovasok
19:25hiredmanjballanc: people have to explicitly bring in names from your namespaces, you should not worry about polluting theirs
19:26kovaswell that makes things simpler
19:26bbloomkovas: yup :-)
19:26kovasbbloom: is view totally derived from model, or does it have its own state as well?
19:27jballanchiredman: yeah, I guess I can see that p.o.v. too...which is why I asked
19:27bbloomkovas: (platform/start-app initial-model unexpanded-view)
19:28pjstadigyou can't design a library expecting that people could be depending upon any and every function you define
19:28pjstadigthat just makes for software too tightly coupled
19:28bbloomkovas: where those two values are NOT atoms
19:28pjstadiginterfaces and implementations are a good thing, and it is good that they are separated
19:30kovasbbloom: can you save the current state of the UI as a value?
19:30bbloomkovas: you bet your ass you can :-)
19:30kovastight
19:30kovasyeah that was basically my goal for the widgets in session
19:30bbloomkovas: but the view is platform dependent
19:30kovasmake them interactively, come back to them, share them, extract and put inside in larger apps
19:31bbloomkovas: you can also save the state of the model as a value and that's portable between views (assuming your views are well formed)
19:31arrdemcan anyone point me to a good CL package demo? #lisp is pretty dead ATM.
19:31kovasok
19:32kovasi don't understand what it means to be well formed
19:32kovasjust that they assume a certain structure in the model?
19:32bbloomkovas: yeah, basically they act on a model of the same schema
19:33bbloomthe schemas are not-reified as of yet
19:33kovashave you watched stu's "orm is a problem of our own making" talk?
19:33bbloomno, but i also hate ORMs :-P
19:33bbloomi'll add it to the viewing queue
19:33kovasit made me reconsider if its a great idea to have the model be one big tree
19:34kovastheres just a moment in there
19:34kovaswhere he rants against document databases
19:34kovasthe claim being, documents are a bad way to store data because of the schema lockin
19:34bbloomi think the model as one big tree is a bad way to store data, but it's not a bad way to operate on it
19:34kovasbut great as the output of query
19:34kovasyeah
19:34bbloomi envision that most apps would have a separate view model
19:35bbloomand i consider it a separate problem to synchronize the model and view model
19:35kovasright
19:35bbloomfor now, i'm only interested in the view model
19:35brehautkovas: thats not quite his argument; he says its stupid for anything that isnt documents
19:35kovasfiar
19:35kovasfair
19:35kovasbrehaut: right :)
19:35bbloomkovas: do you have a link to that talk
19:35bbloom?
19:36kovashttp://www.infoq.com/presentations/Impedance-Mismatch
19:36kovaspretty good talk
19:37bbloomkovas: enqueued
19:37kovasmy dream right now is to have a direct translation from datomic to UI and back
19:37kovaseven if the UI is pretty simple and dumb
19:38kovasand I'm wondering if you can attach view or view-model info to the attributes
19:38kovasso in the db you would have something like [page-entity :left-column left-column-content-entity]
19:39kovasand :left-column would have some appropriate view function attached to it which is applied to the content to give you the realized UI
19:39bbloomkovas: i view all of that as higher level stuff that i don't need to think about yet :-)
19:39kovasyeah
19:40kovasfor sure
19:40kovasor, lower level in a sense
19:40bbloomeverything i'm building is designed to be a target for both humans and computers
19:41ohpauleezOut of curiosity, are there any other Clojure folks who have a Leap Motion dev unit?
19:41bbloominitially, a design tool, but eventually, higher order code as well
19:41kovasright
19:41kovasis this personal project, or something for salesforce?
19:41bbloomkovas: i quit salesforce after only a few months
19:41kovaslol
19:42kovasif only i could sell a startup and spend the rest of my days solving big problems
19:42bbloomkovas: in short: making applications is too damn hard and i think i'm the crazy bastard to fix it. so i'm gonna do that & i have a year or two of runway to prove that
19:42kovasthats awesome
19:43kovasit sure is too damn hard
19:43kovasjust don't fall into the trap of premature optimization on "lets make money off this" :)
19:44bbloomkovas: i had a 1year vest that i didn't wait out. this is savings from the first time i started a company ... i didn't use them that time since i got funded :-P
19:44kovasbadass
19:45bbloomi'm always happiest when i'm poor :-P haha
19:45bbloomalthough the food isn't as good....
19:45kovaslol. if you need some help getting $$ of your hands, you know where to send the check
19:45kovasoff
19:46kovaswhere are you moving to in nyc?
19:47bbloomkovas: no idea yet
19:47bbloomapartment hunt next week
19:47kovasi moved here in january last year
19:48kovasits a little rough coming in the middle of winter
19:48kovasbut at least theres a higher vacancy rate
19:52kovasbbloom: what are the experiences that made you optimal for solving this problem?
19:52kovasyou mentioned something about this yesterday
19:53bbloomi doubt #clojure cares about my life, so i'll take this over to a private msg
20:32Frozenlockkovas: Nice video, but as Datomic isn't OSS, it leaves an informercial aftertaste in my mouth :/
20:33kovasfrozenlock: true. i'll take free-as-in-beer tho.
20:34kovasfrozenlock: for me, it happens to hit home very directly.
20:42TimMctechnomancy: I'm tempted to start using ^:api instead of ^:internal.
20:55brainproxyso cool ... been working on this clojure-based REST gateway thing for like 7 months; works great on linux and mac; fired it up for the first time this evening on win7
20:55brainproxyusing lein.bat
20:55brainproxyrequired 0 code changes to work properly
20:56bbloomnice
20:58carkjava really IS run anywhere =P
20:59brainproxycark: i know, i was just resigned to the fact that *something* somewhere inside would breadk or have to be tweaked
20:59brainproxybut it didn't, made me smile for sure
21:00carkI have a similar experience to yours...been developing under windows not even knowing if the application would end up on linux or solaris. Enventually it did end up on solaris, never had to change a line in clojre either
21:01carkfunny thing is i'm mostly clueless about any unix =P
21:02carkstill ended up doing support for postgres on solaris =(
21:02brainproxyhehe
21:03tmciverbrainproxy: sounds cool. Do you have a url to that project?
21:03carknope
21:03brainproxytmciver: it's a commercial product, all closed source unfortunately
21:04tmcivertease
21:04brainproxytmciver: i hope at some point we can pull out some of the generic pieces and open source them
21:05brainproxywe've been busy building abstractions on top of datomic, and I think there's a lightweight framework lurking in there somehwere for modeling forms and views as entities and functions in datomic
21:50FrozenlockGiven this "(defmulti my-multi (fn [smap] (:some-k smap)))", I would expect "(defmethod my-multi :val-of-key-from-smap [x] (print "yeah!"))" to work.. but it doesn't. Am I not dispatching on the value retrieved in a map?
21:51gfredericksFrozenlock: looks fine to me
21:51gfrederickshave you tried rebooting?
21:51FrozenlockNo o_O
21:51gfrederickswhat's not working?
21:51FrozenlockRebooting, like in the 90's?
21:52gfredericksyeah sometimes the start menu gets stuck
21:52FrozenlockNo method in multimethod 'my-multi' for dispatch value: {:some-k :some-value}
21:52gfredericksIMPOSSIBLE
21:53FrozenlockWhat?
21:53clojurebotwhat is 2d6
21:53gfredericksI'll go try it
21:53FrozenlockI'm rebooting my repl, shouldn't be long..
21:54gfredericksFrozenlock: worked fine for me
21:54FrozenlockAh! It works now.
21:54gfredericksyeah must've been the start menu
21:54FrozenlockIs this dangerous to use in production, or is it really just sometimes in the repl?
21:54gfredericksI have no idea what was wrong
21:55gfredericksdid you do several defmultis on the same fn name?
21:55FrozenlockHopefully IT WILL NEVER HAPPEN AGAIN! :)
21:55FrozenlockThanks for the help
21:55FrozenlockYes
21:55gfredericksI guess it could be something like that :/ not sure how they're implemented
21:56muhoostate
21:56muhooobjects. java. trouble.
22:03amalloyyes, defmulti is broken by design
22:04amalloyie, (defmulti foo f) (defmulti foo g) ;; the second defmulti didn't do anything, and the dispatch function is still f
22:06bbloomgrumble grubmle death to def
22:06tpopewhat "design" is that?
22:07bbloomtpope: i think the premise is that if you reload a file, you don't want to break any other namespaces that installed methods into your dispatch table
22:07tpopeah
22:08yedihttp://blog.getprismatic.com/blog/2013/1/22/the-magic-of-macros-lighting-fast-templating-in-clojurescript
22:08bbloomdefmethod basically "installs" a handler into some mutable cell owned by defmulti
22:08bbloomand that has all the usual problems associated with mutation and state :-/
22:11muhoobbloom: thank you for macroexpanding
22:15spjtIs there some way to limit a clojure process to a single thread?
22:16gfredericksspjt: I expect s/clojure/java/ should give you the same answer
22:18Frozenlockbbloom: But isn't a multi limited to its namespace?
22:18spjtI saw some examples of how to limit it in Java, looks complicated.
22:18Frozenlockspjt: Everything looks complicated in java :p
22:18gfredericksFrozenlock: no you can extend a multimethod from anywhere
22:18gfredericksFrozenlock: that's most of the point of multimethods
22:18spjtI guess I'll just run it in Parallels with only one core active.
22:19Frozenlockgfredericks: So if you load a library with a defmulti named "foo", "foo" is locked for everyone else??
22:19lazybotFrozenlock: Definitely not.
22:20jkkramerlazybot is correct
22:20gfredericksFrozenlock: I can't reconcile that statement with the rest of the conversation
22:20jkkramermethods are "installed" into the var of the defmulti, which is namedspaced
22:20gfredericks(defmethod some.other.ns/varname ...)
22:21jkkramermy favorite defmulti feature: (defmulti foo "docstring" f) (defmulti foo "docstring" f) ;; obliterates foo's docstring
22:21FrozenlockAhh ok! Well that's what I meant by limited to its namespace
22:22gfredericksFrozenlock: crisis averted!
22:22FrozenlockIndeed, I was about to scrap all my new shiny defmultis :p
22:27spjtMaybe I could ask in a more clojurey way. Basically, what I'm doing is running a bunch of sends, using a function that takes a "long" time to complete. Does the agent prevent writes while the function is running?
22:27Frozenlockyedi: Brilliant
22:30yediim still trying to understand how they accomplished it... need to wrap my head around macros
22:31gfredericksmacros: they are things to use
22:31yediit's crazy that they got it so much faster than all the other cljs templating libs
22:31Frozenlockyedi: is it? cljs still seems to be a small world
22:32gfredericksyeah I don't think crate even tries
22:33FrozenlockIt looks like it uses the same templating; I'll be able to switch the library without too much problem.
22:34gfredericksFrozenlock: it'll be less composable though
22:34gfredericksor at least I assume the more you break stuff into separate functions the more the perf suffers
22:45hiredman~apropos clojure
22:45clojurebotProgramming Clojure is a Book Edition. (http://www.freebase.com/view/m/0dg9_5h)
22:45hiredman~apropos java
22:45clojurebotJava Virtual Machine is a Video Game Platform. (http://www.freebase.com/view/m/045rk)
22:46amalloy(inc lazybot)
22:46lazybot⇒ 12
22:46hiredmanhah
22:48technomancybbloom: FWIW the hard-locked dispatch function is a completely different problem from defmethod updating the method table
22:48bbloomin what way?
22:48technomancythey're two separate problems
22:49bbloomthe assumption is that some other namespace somewhere is dependent on your dispatch function
22:49technomancythough I suppose the brokenness around the former was introduced specifically in order to deal with complications around the latter
22:49bbloomyup...
22:49technomancyso they're related, but still two separate distinct problems
22:50technomancyit's easy to imagine a defmulti that allowed the dispatch function to be updated without blowing away the method table
22:50hiredmantechnomancy: the method table and the dispatch function are tied to each other via the cache of dispatch function results
22:50technomancyand if it weren't for Jira and the broken contribution process I would be tempted to try to fix that
22:50bbloomtechnomancy: lol. did you speak up in that crazy thread?
22:50bbloomi feel like your involvement with lein should carry some weight
22:50technomancybbloom: I've said everything I have to say
22:50bbloomheh
22:51technomancyexcept that I think a separate cljs mailing list is a good idea
22:52bbloomtechnomancy: *shrug* i don't think it would hurt, but i haven't seen significant cljs-specific mail traffic
22:52technomancyhiredman: sure but during development you shouldn't have any qualms about blowing away the cache
22:55technomancybbloom: that thread is just people yelling at Andy Fingerhut and Sean Corfield anyway
22:55technomancyno one who's actually in a position to make a difference will even touch it
22:57bbloomtechnomancy: at least stuart halloway is on the electronic CA thing
22:59technomancyoh, I missed that