#clojure logs

2013-01-04

00:13seangroveIf I try to set the value of an atom to the result of a (map ...) call, will the atom value be lazy or realized?
00:13seangroveIn the repl, it prints out seemingly correct, but that could be the repl forcing it to print
00:15seangroveOk, looks like a lazy seq
00:16seangroveAt least I caught it immediately rather than in some infuriating bug later, heh
01:24jlewislol
01:24jlewiswhoops, mischan
01:31mpanwhat's the thing that's like assoc but takes k and v in a single seq argument?
01:32mpanI recall there being a way to reduce pairs into an empty map?
01:32TimMcmpan: into
01:32mpanTimMc: thank you!
01:47AnonnyCan I get an example of a path in .lein-classpath should look like? (For when you're designing a lein plugin.)
01:54RaynesAnonny: Don't know if you saw, but I released that new version of laser a few days ago, complete with node
01:54Raynes:p
01:55AnonnyRaynes: I got it that morning. Thanks. It was much shorter than making the node by hand!
01:56RaynesAnonny: Everything going smoothly?
01:56callenRaynes: you need to make laser buzzword compliant and add Node.js
01:57AnonnyRaynes: On the laser side of things....
01:57Anonnycallen: or rename it pewpew
01:57Raynespewpew!
01:58RaynesWhy didn't I think of that? Best name ever.
01:59AnonnyRaynes: sent you something in dialog window
02:02callenRaynes: rename it now, before it's too late.
02:02callenRaynes: make a big structural change to justify the switch over
02:04Rayneslol
02:04Raynesseancorfield: YO
02:07Ember-http://i.imgur.com/4VXXz.jpg
02:54bbloomi'm not sure if i'm reading the docs right for the extend function
02:54bbloom(doc extend) ; this won't fit on IRC
02:54clojurebot"([atype & proto+mmaps]); Implementations of protocol methods can be provided using the extend construct: (extend AType AProtocol {:foo an-existing-fn :bar (fn [a b] ...) :baz (fn ([a]...) ([a b] ...)...)} BProtocol {...} ...) extend takes a type/class (or interface, see below), and one or more protocol + method map pairs. It will extend the polymorphism of the protocol's methods to call the supplied methods when an AType is
02:55bbloomit says "You can extend an interface to a protocol."
02:55bbloomwhat exactly does that mean?
02:58amalloy&(doc extend) ;; lazybot is less lazy than clojurebot, bbloom
02:58lazybot⇒ "([atype & proto+mmaps]); Implementations of protocol methods can be provided using the extend construct: (extend AType AProtocol {:foo an-existing-fn :bar (fn [a b] ...) :baz (fn ([a]...) ([a b] ...)...)} BProtocol {...} ...) extend takes a type/class (or inter... https://www.refheap.com/paste/8094
02:58bbloomheh, i figured people all have repls open and can doc it themselves
02:59bbloomit makes me really sad that JVM clojure uses interfaces and not protocols everywhere :-(
02:59Sgeocomamalloy, I thought you meant lazy as in lazy vs strict, so was confused
03:10bbloomit's kinda a shame
03:10bbloomthe extend function would be brilliant
03:10bbloom... if clojure used protocols instead of interfaces
03:28SgeoI should really read this paper on syntax parameters
03:30jonasenkovas_: ping
03:32kovas_jonasen: pong
03:32jonasenkovas_: I would not merge just yet
03:33kovas_jonasen: ok. but its exciting :)
03:33kovas_jonasen: can't wait for the weekend for some time to hack on it
03:33jonasenkovas_: There's still stuff to do. I got streaming *out* to console.log working locally :)
03:34kovas_jonasen: sweetness
03:34kovas_jonasen: are you coming to clojure/west?
03:34jonasennext, I'd like to get interrupt to work
03:35jonasenkovas_: unfortunately not.. Way too far away :(
03:35kovas_jonasen: understandable
03:35kovas_jonasen: if you get interrupt to work, ill put it in the UI
03:36jonasenkovas_: I already added a button for it :) But it's a no-op still
03:36kovas_jonasen: same with *out*
03:36jonasenkovas_: I've been thinking about that.. where should *out* go?
03:37kovas_jonasen: there are options
03:37kovas_jonasen: first, does it get stored in datomic? I think it does
03:37jonasenkovas_: It does
03:37kovas_jonasen: its a real bummer that there is no first-class list structure in datomic
03:38kovas_jonasen: but given the state of affairs, probably each line is an entity, with the text and the line number as attributes
03:39kovas_jonasen: and we stream them into the UI as they happen
03:39jonasenkovas_: that's basically what I'm doing
03:40kovas_tight
03:40kovas_you are a session master now :)
03:41jonasenkovas_: In the original evaluation service, you depended on the tx-queue.. is this important?
03:41jonasenkovas_: heh.. the server side maybe. The client side is still a mystery :)
03:42kovas_jonasen: yes, i believe it was
03:43kovas_jonasen: the evaluation service should only see the request after it goes into datomic. and the client should only see the response after it goes into datomic.
03:44kovas_jonasen: so listening on the queue seems to be the right way to do that
03:44kovas_jonasen: unfortunately the implementation is totally ugly
03:45kovas_jonasen: as of yet, no higher level functions for e.g. listening on certain attributes
03:45jonasenkovas_: Yes, I didn't do it that way. My thinking was that you can rely on it being in datomic if (d/transact ...) succeeds (ACID and all that)
03:46jonasenkovas_: But I can change it to a queue based desing.. that won't be a problem
03:47jonasen*design
03:47kovas_yeah, i think thats necessary for it to work in the general case
03:48kovas_right now both the "session service" and the "service called by the session service" are in the same process, so you can do that
03:48kovas_but in general, the evaluation service should be able to participate solely via datomic transactions
03:49kovas_(this distinction is totally complected in the current implementation so its pretty subtle)
03:50jonasenkovas_: I kind of agree. Since we use websockets we can totally seperate the request from the response (via the datomic transaction queue)
03:51jonasenIt's too bad that (:a datom) returns the entity id instead of the attribute keyword. It makes querying the queue much more awkward
03:53kovas_jonasen: yeah thats a total PITA. There must be a better way.
03:53jonasenkovas_: sorry if I miss some of your responses, I'm on a *very* shaky network today
03:54kovas_jonasen: np. I gotta go to sleep anyway, almost 4am here :0 keep up the good work!
03:55jonasenkovas_: Session is too fun to work on! Talk to you later
07:20flying_rhinohello
07:27sundbpHi. if i'm actively working with 2 different leinigen projects where project A depends on project B - what's the smoothest way to do it so that A easily picks up the local changes made to B?
07:30ejacksonsundbp: there are checkout deps: http://stackoverflow.com/questions/8335709/how-can-i-set-up-leiningen-to-work-with-multiple-projects
07:30sundbpthat's what i'm looking for
07:30sundbpthanks
07:30ejacksonnp
08:42flying_rhinohi guys, anyone heard of Grok project at Google?
09:31jcromartieso women
09:31jcromartiewhy don't they program
09:31jcromartiethe age old question right?
09:31jcromartiehttps://twitter.com/puredanger/status/287196600869199873
09:32p_l|workthe second answer :D
09:32llasramI'm going to go with "sexism"
09:33cemerickllasram: Probably only a problem on the margins.
09:33cemerickAggregating all the times I've hired programmers, I think I only got 1-2 resumés from women.
09:33jcromartieeven if it's just culturally determined, it might be possible that men are geared to modeling the state of a system in their head
09:34llasramOh, I don't mean that men are being preferentially hired
09:34jcromartiethat's seen as the critical mental skill in programming
09:34cemerickThere is an imbalance in STEM fields in general.
09:34jcromartieand functional programming kind of turns that on its head
09:34chouserIs this a pull request that got merged into a contrib lib? https://github.com/clojure/math.combinatorics/pull/1 That's not supposed to happen, is it?
09:35llasramI mean that there are a broad array of biases which (a) have pushed women away from STEM in general at young ages, and (b) a sexist culture in technology makes it more difficult for women to work on a personal level, so even fewer then elect to stay in it
09:36pjstadigchouser: a PR is just a branch that could/should be merged, and if you merge it manually with git the PR will get closed automatically
09:36pjstadigbut i guess the jira process even for contrib is patches in jira?
09:36pjstadignot merging branches
09:36chouserthat was my understanding.
09:36cemerickchouser: ut-oh
09:38TimMcjcromartie: I don't knwo that it's anything specific to Clojure.
09:38pjstadigin reality there's no difference between merging a branch and applying a patch
09:38jcromartieTimMc: no, but it might be an interesting thing to investigate
09:38pjstadigbut *sigh* i digress
09:38gfredericksidea: for projects named foo, use the ns naming convention foo.lib.* for utility functions that aren't app-specific and could be pulled into a separate lib if it was worth it
09:38jcromartieTimMc: vs. more stateful languages/paradigms
09:38pjstadighave we had our bi-weekly CA discussion yet?
09:38chouserIt looks like the author of the PR has his CA in, so that's good at least.
09:39TimMcjcromartie: I suspect that since the Clojure world is relatively small, it's harder for women to "break in" just because of the boy's-club effect.
09:39TimMcso the size may be more relevant
09:39`fogusI "solve" the merge problem by writing contrib libraries that no one contributes to. :-o
09:40jcromartieTimMc: I don't see a "boy's club" in the Clojure community… people are polite here. A "boy's club" carries a connotation of crude jokes and sexism.
09:40TimMcHmm, that's fair. I guess that's not what I meant.
09:40jcromartieyeah, I get what you mean though
09:41jcromartiesome other languages *ahem* are known for having four-letter words and porn in presentations at conferences
09:41chouser`fogus: brilliant
09:41TimMcAs a marginalized group, women in STEM probably look to see where the other women are -- which penalizes small communities.
09:42`fogusSTEM?
09:42TimMcThat's just my guess, though. I'm sure there's some good research already out there.
09:42TimMcScience, Technology, Engineering, Math -- I think
09:42`fogusOh! Right.
09:42`fogusI thought it was a new language.
09:42TimMcAcronym guessing is fun!
09:43jcromartiethe fact is that men demonstrate a greater variability in mathematical aptitude, and so there are more men in elite STEM fields simply due to that
09:43llasramTimMc: Being large enough to have focused evangelism definitely helps. An acquaintance of mine started a PyLadies group a few months ago, and it's been going like gangbusters
09:43SgeoOh woah, a Racket person is giving a talk at Clojure/West
09:43TimMcllasram: I personally know two women who use Python, but they're both scientists, so... :-)
09:44TimMcjcromartie: Variability? Ah, that's interesting!
09:44jballancI probably already know the answer to this, but is there a more idiomatic way of turning a string into an int than (Integer. int-str) ?
09:45jcromartiejballanc: that's pretty good
09:45TimMcjballanc: (Integer/parseInt x) :-P
09:45TimMcI dunno, that's just the form I use. read-string has way more complications than you probably want to deal with.
09:45TimMcbut it's there
09:45llasramOr, Long/parseLong since Clojure prefers longs for primitive integral values
09:46jballancyeah, just seems...I dunno...mildly dissapointing that something so central relys on the host platform
09:46jballancI guess read-string doesn't, but everything I've seen suggests shying away from that
09:46jballancnot to mention the issue with user-input strings
09:47llasramOr, you could look at it as a good thing that the language doesn't bother wrapping things trivially provided by the host platform :-)
09:47jballancI suppose...
09:47jballancbut then what's the CLJS equivalent?
09:47jcromartiejballanc: number parsing is a fiddly little thing
09:48jcromartiejballanc: there are too many ways to do it
09:48TimMcjballanc: Clojure is host-embracing.
09:48jballancwell...host embracing is one thing...host dependent is something else
09:48TimMcIt would be nice if it were wrapped, though -- you can't map Long/parseLong over a list.
09:48jballancso, for example, I want to turn a 'content-length' header into an integer value
09:48jcromartiejballanc: do you want an exception when it's an invalid format? or do you want a nil? or zero? do you want to round it if it has a fractional part? what if it's octal or hex?
09:49jballancjcromartie: yeah...I know it's not easy...but even the "happy path" conversion isn't abstracted
09:49jballancmeans that I have to write different code for clojure vs clojurescript vs clojure-something-else
09:50jcromartiejballanc: hm, good point
09:50TimMcejackson: You clever bastard.
09:50pjstadigjcromartie: oh yeah, i forgot that no other language has ever solved the problem of parsing ints portable :p
09:50jballanci.e. in my case of a content-length header from an http request, that should almost always be a well-formed integer-as-a-string
09:50jcromartiepjstadig: example?
09:51pjstadigRuby, Python
09:51pjstadigPerl
09:51pjstadigBasic
09:51pjstadigi don't know
09:51pjstadigC
09:51jballanc...and if it isn't well formed, then it's a violation of the http protocol, so I have bigger problems
09:53jcromartiepjstadig: those languages do have platform-specific quirks with regards to data types
09:53pjstadigJava
09:53jballancheh
09:53pjstadigjcromartie: example?
09:53jcromartiepjstadig: so, yeah :)
09:53jballancyeah, I can attest that Ruby has platform-specific quirks
09:54pjstadigjcromartie: all we're talking about is "3" -> 3
09:54jcromartieso Clojure probably needs parse-int, but would it just defer to the host? and have different behaviors on JS vs JVM?
09:55SgeoIs Clojure so host-embracing that if I were to write Racket-Clojure, reading an int when the string's not an int should return false?
09:55pjstadigClojure's hostiness means that there are semantic differences between Clojure and ClojureScript
09:55SgeoBecause that's what Racket's string->number does
09:55cemerickejackson: I endorse that notion as a decent null hypothesis
09:55pjstadigit doesn't mean that it's impossible to make abstractions
09:58jcromartieI don't think Clojure needs an abstraction around number parsing in core...
09:59jcromartiea lib maybe
09:59jcromartieit kind of sounds crazy to suggest that number parsing should be a lib though :)
09:59jballancheh, yeah
10:00jballancI guess one solution would be to modify the http request libraries to return numeric values for things that are expected to be numerical
10:00jballanc...but I doubt this would be the only example of needing something basic
10:00cemerickjcromartie: just part of having a numeric tower
10:00jballanccemerick: is that in the current numeric tower impl?
10:02cemerickjballanc: which one? :-P
10:02jballancd'oh... :(
10:02pjstadigcemerick: the one that's implemented as a lib :)
10:03cemerickpjstadig: which one? :-P
10:03pjstadighaha
10:03jcromartieI take it all back http://io9.com/5867401/there-really-is-no-difference-between-men-and-womens-math-abilities
10:03jcromartiemaybe
10:07cemerickjcromartie: once math is made as cool as playing FarmVille, then progress will come quickly
10:07cemerickviz. https://twitter.com/cemerick/status/287054644021174272
10:07jcromartiecemerick: ouch
10:07jcromartienumber munchers, man
10:07cemerickouch?
10:07clojurebotouch is <repl> what are you, a north korean seamstress
10:08jcromartiecemerick: I assumed you meant women playing FarmVille was a cause for the STEM imbalance
10:08jcromartiecemerick: my bad :)
10:08cemerickhah, no
10:09cemerickI mean, if an activity is considered socially acceptable, nay, cool and aspirational, then lots of things change.
10:09jcromartieyes
10:10cemerickBeing good at math was considered a black mark for everyone in my high school.
10:10cemerick"nerds that take calculus", etc.
10:10cemerickThere's a big social/class component there.
10:11cemerick...which gets it start years prior, with parents and other family that are either present and pushing math and science...or not.
10:15jajuHello people. I can a problem that I have described at: https://gist.github.com/4453240 - Can someone guide me as to what I am missing? I can provide more context.
10:15jajucan => have (oops!)
10:16jballanccemerick: I suspect part of the issue is also the degre to which failure is accepted at the critical stage where things like math and science start getting hard
10:16jcromartiecemerick: yeah, definitely, programming is probably the least cool thing a girl could do in HS
10:16jcromartiecemerick: unless she wanted to be swarmed by the guys that program… which, I don't know about that...
10:17jajuI have hugely simplified it - making assumptions as to what would be relevant to describe the problem.
10:18chouserBut none of that matters when it comes to tech conferences, because for those it's obviously up to the organizers to make sure they meet their quota of female speakers.
10:19jcromartiechouser: aren't things like quotas sexist, though? if you don't have a pool of qualified women to begin with, you end up with crappy speakers...
10:19jcromartieyou end up choosing or rejecting speakers based on sex, not qualifications
10:19chouserjcromartie: sorry, I forgot to put a joke marker on that one. Please add a ":-)"
10:19jcromartieoh right :)
10:20clojure-newbhey guys, I'm trying to find a reference somewhere to what '%' does in clojure, seems hard to find for me at least
10:21jcromartieI have to say, my experience with female programmers is that I don't have a large enough sample size to have met a good one… so that really makes it hard to be unbiased.
10:21cemerickjaju: I can't think of a reason why there'd be a difference between the two.
10:21jcromartieclojure-newb: what's the context?
10:21clojure-newbjcromartie: (and main (some #(.exists (io/file % (b/path-for main))) source-paths))
10:21llasramclojure-newb: In anonymous function defined with the #(...) reader macro syntax, it's the first argument
10:22ejacksonclojure-newb: its used as an argument to anonymous functions
10:22jcromartieclojure-newb: #(do %) roughly equals (fn [x] x)
10:22jajucemerick: Thanks. True, and I have spent the better part of my day getting frustrated at finding out why. I've left out a lot of context to keep the sample simple - is there any remote possibility of something affecting the behavior?
10:23clojure-newbthx guys, so if I go read up on anonymous functions again I should find some reference to this
10:23clojure-newbjust did not know where to look
10:23jcromartie,(macroexpand-1 '#(foo %))
10:23clojurebot(fn* [p1__27#] (foo p1__27#))
10:23ejacksonclojure-newb: yeah, wait till you try figure out what ` does :)
10:23jcromartieclojure-newb: #() just expands like that
10:24clojure-newbejackson: yeah, I got to go play in the REPL I think
10:27clojure-newboh I see… '%' is a synonym for %1
10:28ejacksonyup
10:28cemerickjcromartie: there's all sorts of "soft quotas"; e.g. a Clojure conf organizer might want to hit a 70/30 mix of Clojure/ClojureScript talks. If diversity is thought to be a desirable quality of a conf (along with speaker qualifications), then working to have more women and non-anglo speakers is valid.
10:28clojure-newbfor some reason I was happily using %1 by default everywhere
10:30jcromartiecemerick: true
10:31jcromartieso this is sort of the basis of my hypothesis that men are better at managing mental models of mutable state in programming: http://en.wikipedia.org/wiki/Spatial_visualization_ability#Gender_differences
10:31jcromartiebut the difference could be trained
10:31jcromartiedunno
10:32cemerickejackson: If only you hadn't published photos of yourself and describe your origins as 'Africa', unqualified. :-P
10:32jcromartiebut I generally think that modeling the state of a program is a spatial task
10:32jcromartiebut I am not a scientician
10:32ejacksonits all true, when I move to the US I fully intend to describe myself as an African American!
10:33cemerick'scientician' should be a word ;-)
10:33ejacksoncemerick: YES !!!
10:33cemerickjcromartie: if that were a problem (something that seems tenuous to me), it still wouldn't be the first order problem. If it were, then we'd have a large number of less-capable women programmers, not essentially-zero women programmers.
10:34jcromartiecemerick: obviously some women can be programmers, that much we know for a fact :) from that point we are working on hypothesis
10:35jcromartieI think I have only worked with 4 female programmers. One of them knew what she was doing.
10:35jcromartieSo that's about right.
10:35jcromartieFor the distribution of all programmers who know what they are doing.
10:35ejacksonbetter ratio than among men
10:36jcromartiehah yeah, I'd imagine the ratio would fall as my sample size grew
10:36xbathello! i'm a beginner
10:37xbati've got lein to work, but all my code is in just one file, and it's getting rather long
10:37llasramxbat: Hello!
10:37acuzioxbat: namespaces
10:37xbatand i can't work out how the namespaces work
10:37xbatright
10:37xbati use (ns namegoeshere) at the top of the new file
10:38xbatbut then how to i import it from the call one?
10:38xbatit keeps saying er Exception in thread "main" java.lang.ClassNotFoundException:
10:39hyPiRion(:require other.namespace)
10:39llasramjcromartie: Have you seen this? Was on HN etc when it was first posted. http://therealkatie.net/blog/2012/mar/21/lighten-up/
10:39craigbrohey,some nrepl issues to sort out here
10:39llasramjcromartie: From the women I know in tech and what I observe, I think what that post describes is the biggest problem
10:40chouserI've worked with a handful of female programmers. The worst among them was far more reliable than the worst male programmers I've worked with. The best were on par with some of the best males. They were all among the most pleasant colleagues to work with.
10:40chouserIs there something to see there?
10:40jlewis+1 on that... enough with the casual sexism
10:40craigbroI am using nrepl and when I try to complete a symbol in the repl buffer, it throws an error about not finding a class (the class name is the namespace of the symbol i'm tring to complete via long-form some.class.name/startofsymb<TAB>
10:41craigbroworks with short-form symbol completion tho
10:41jcromartiellasram: I'd say that stuff is not subtle at all. That's pretty overt, if you ask me.
10:42cemerickchouser: mostly that it's a pity that "a handful" seems to be typical
10:42jajucraigbro: What's your setup like?
10:43chousercemerick: hm, yes.
10:43llasramjcromartie: Then count yourself as part of the solution?
10:43matthavenerchouser: same experience, except last two places i've been were close to 50/50 male/female ratio
10:44craigbrojaju, I load nrepl.el
10:44craigbrothat is all
10:44craigbroI nrepl-jack-in
10:44craigbroeverything else works, short-form symbol completion is fine, just no long-form
10:45ejacksonThere is nothing inate that prevents women being coders, civil engineers (my sister is one) or any other male-dominated thing, nor men being nurses, primary school teachers or taking care of the kids (or flight-attendants as we have seen post 9/11). But we structure our society against it. Even if Clojure became super friendly to women I wouldn't expect a rise in the number of female speakers at conferences. It suc
10:45ejacksonks, but that's it.
10:45craigbrowhat url is this conversation in reference too?
10:45craigbroerr, post
10:46cemerickejackson: you're one of those optimists I always hear about :-P
10:46cemerickcraigbro: probably puredanger's recent tweet?
10:47ejacksonmy family is filled with women who overachieve in male fields, but they take a lot of stick for it, in those fields and in society at large
10:47jajuAh. Not sure, but I had similar problems with nrepl-jack-in. I switched to doing "lein repl" and then a plain "nrepl" in emacs.
10:48xbatnope, still can't find the new namespace
10:48xbatmaybe i need to edit project.clj?
10:48ejacksonxbat: are your files correctly named, and in the right directories ?
10:48cemerickAt the very least, if the Clojure community becomes more inclusive, then male Clojure programmers will become more attuned to the issues, and might positively influence their daughters, etc.
10:48xbatie: it's not compiling or something
10:48xbati don't know
10:48xbatthat's what i'm asking
10:48xbati put the new one in the same directory as core.clj
10:49ejacksonxbat: that should be fine
10:49xbatright, but it's not seeing it
10:49xbatwhat should i put in the ns thing at the top of the new file
10:49ejacksoncemerick: psychohistory, huh.
10:49xbatprojectname.namespacename ?
10:49chouserNone of my kids of either gender seem particularly interested in programming. Maybe I'm representing the activity badly across the board.
10:49ejacksonxbat: yup
10:49xbator project/namespace ?
10:49xbator just namespacename ?
10:49jajucraigbro: I never bothered to check nrepl-jack-in once I started using the workaround
10:50xbatok
10:50xbatwell i'll keep trying different versions 'til something works, then :(
10:50xbat(i was hoping there was something obvs i was missing)
10:50llasramxbat: Each file needs an (ns) form at the top, and the namespace name for each needs to match the file path
10:50jballancchouser: honestly, I don't know how much interest I'd have shown in programming if not for Apple IIe BASIC
10:50xbatok
10:50ejacksonxbat: try grabbing an example from somewhere and basing your work of that.
10:51llasramxbat: So within your project 'src' directory, you have "myproject/mynamespace.clj"
10:51llasramxbat: That needs (ns myproject.mynamespace)
10:52xbatoh, so it is a dot, not a slash
10:52chouserjballanc: there are options now -- khan academy sandbox and scratch have each generated temporary interest at my house, but neither have had the staying power of origami, crafts, video games, etc.
10:52cemerickejackson: I presume you mean from foundation? Perhaps. Just a variation of "think globally, act locally"
10:52cmajor7upgrading from lein1 to lein2. used "lein precate" to update the "project.clj". have ":java-source-paths ["src/xyz/java"]". lein2 compiles java, but is unable to find it when compiling clojure that imports those java artifacts (e.g. (:import org.xyz.Blah))
10:52jajuchouser: How old are they? My kids show no interest either, but I'd think it's the age-factor.
10:52chouser5 through 10
10:53jcromartiehttp://www.engr.utexas.edu/wep/firstsecond/visualization
10:53llasramxbat: Right. Clojure uses '.' to separate namespace elements. Which mostly only matter in getting mapped to directories for finding source to load
10:53jaju5.5 and 7.5 - and they show no interest (yet)
10:53xbatahha!
10:53xbatright, that worked :)
10:53xbatthanks a ton
10:54ejacksoncemerick: yeah. I do agree that we should actively encourage women in our community as much as possible. If that means we get a few more dodgy talks at conferences, its a small price.
10:54jcromartieI can't get my 2.75-year-old to program, and it makes me sad.
10:54chouserwould giving a dodgy talk be encouraging?
10:54jcromartieI might be jumping the gun.
10:54ejacksonI doubt much will come of it, but the effort should be taken.
10:55jcromartieI find "dodgy" talks to be embarrassing and discouraging.
10:55cemerickejackson: I doubt it'll result in anything dodgy. From an organizer's standpoint, it probably just means inviting potential speakers that might not send in a proposal. Sweetening the travel stipend and such might be effective, too.
10:55jcromartieyou don't want to make the few women in the audience *facepalm*
10:56`fogusTalk of dodgy talks seems speculative to me
10:57cemerick...especially given the frequency of dodgy talks that already pop up at confs. :-P
10:58`fogus(inc cemerick)
10:58lazybot⇒ 12
10:58ejacksoncemerick: oh yeah, I agree with that. I was just debunking the principal objection raised that if the pool of female clojurists is small, then having many talks by females will have an effect on quality.
10:59ejacksonsorry that I wasn't clear on that.
10:59TimMcejackson: For all I know, the pool of female potential speakers may be *higher* quality, since they've got more to prove in our society...
10:59cemerickejackson: ambiguity and mixed signals in irc? Never!!!1!
10:59cemerick;-)
11:02ejacksonmy attempted point was that the main objection raised is empty.
11:02TimMcThe travel stipend suggestion sounds like a good way to make the pool larger, which would circumvent any potential size-related problem.
11:03ejacksoni'm not sure, the travel budget is not meant to be profitable !
11:03ejackson(despite my earlier jesting)
11:04ejacksoni think reaching out and making direct invitations is a good idea.
11:04cemerickI hereby waive any travel stipends I'm awarded to make it a wash for at least one person.
11:05TimMc:-)
11:05`fogusI infer that reading Joy of Clojure will make you a worse Clojurist -> http://goodstuffahead.com/t/clojure
11:06TimMcaw
11:06chouserheh
11:06cemerickretribution for infix
11:07llasram`fogus: It makes you a bettor Clojurista instead?
11:07`fogusIt's painful to get beaten out by not one, but two Erlang books! ;-)
11:07llasramWell, maybe if you updated it for a modern Clojure version. Srsly
11:07pjstadig`fogus: rest assured that list seems dubious to me
11:07ejacksonaccording to whom ?
11:08`fogusllasram: That's a great idea
11:09abphttp://www.reddit.com/r/Clojure/comments/15wosh/clojure_functional_programming_books_site_written/c7qmg2q
11:09cemerick`fogus: the real problem is you haven't spread the payola around enough ;-)
11:09llasram`fogus: I was joking, but a refresh couldn't hurt. It is still my fave Clojure book though
11:09llasram(inc `fogus)
11:09lazybot⇒ 1
11:10craigbrohmm, note to self, do not put desk in front of south facing window in winter
11:10craigbrosun in eyes all day
11:10pjstadigspeaking of teaching programming to children male or female, does anyone recommend this book? http://www.laurenipsum.org/
11:11jcromartiehttp://www.humantechnology.jyu.fi/articles/volume4/2008/jones-burnett.pdf
11:11jcromartielooks like spatial ability does correlate with programming ability
11:11jcromartiefortunately it can be learned
11:11jcromartiebut does functional programming reduce the need for the spatial ability?
11:12abp`fogus The reasoning in his comment is still leaving me speechless.
11:13`fogusabp: Well, I can't fault him if he didn't like it. It happens.
11:13llasramI think you mean "burn the heretic!"
11:15cemerickllasram: isn't it 'nonbeliever'? (assuming you were recalling Life of Brian there)
11:15chouserI think midwestern programmers are under-represented among conference speakers, and in tech companies in general.
11:15abpInformation density isn't for everyone, perhaps. I love the style of writing.
11:15craigbromeh
11:16jcromartiechouser: midwesterners are not evenly distributed, women are….
11:16craigbroapparently not
11:16jcromartiethey are rather concentrated in the midwest
11:16jcromartiemaybe we should disperse them
11:16jcromartieor get more circummidwesterners to move inwards
11:17craigbroI think it's a liberal boondoggle myself
11:17chousermidwesterners can move, but you know what they say about taking the programmer out of indiana
11:17craigbroyes, more women in programming is good. However, it's like the banner people pick up
11:17`foguscraigbro: "liberal boondoggle"?
11:18craigbrobe kind, help others, and respect diversity of neurological/cutlural backgrounds
11:18craigbrosometimes that means "women in programming" groups and active support for women
11:18`fogusIs boondoggle good or bad?
11:18jcromartieso if women are better at verbal and worse at spatial, could functional programming be a more-verbal and less-spatial paradigm, and therefore could functional languages be better positioned to recruit females to their communities?
11:19jcromartiewithout trying to improve womens' spatial abilities
11:19craigbro`fogus: by boondoggle I mean, a project that is well intentioned but misses the real mark
11:20craigbrojcromartie: I think any idea of gender based neurological/cognitive difference is bogus -- within populations there is far greater diversity along those vectors than consistent difference across the two (at least at the level of the profession/practice of programming)
11:21jcromartiecraigbro: I think you'd be politically correct but factually wrong.
11:21llasramcemerick: I apparently meant "kill the heretic" http://www.youtube.com/watch?v=krb2OdQksMc#t=274s But yes :-)
11:21craigbro`fogus: not saying don't support women in programming, or do projects to helpthem explicitely, but I think it's bordering on an internet 'meme' of community disparagement
11:22`foguscraigbro: I have no idea if that's right
11:23TimMcjcromartie: It may be factually wrong but still pragmatically correct to believe.
11:23ejacksonis the representation of women in clojure lower than coding in general ?
11:23craigbrojcromartie: What? because my reading of cognitive and neurological studies has a different result than you, I am now being politically correct?
11:23TimMcThat is, a small statistical difference may not have any relevance to building a better society.
11:23TimMc*to methods of
11:24TimMcAnyway, I doubt any discovered difference can acocunt for the massive disparity we see today.
11:24jcromartiecraigbro: the studies that show differences and the studies that show no differences are not contradictory, they are for different areas
11:24nDuff...there's also no small amount of cultural impact. My fiancee was raised in a wealthy, principally-black community; her impression from her high-school years was that among men, sports starts were idolized, while women were pushed towards science and math.
11:25craigbrojcromartie: I did not say no difference. I said greater diversity within group -- aka the "deviation" is on par or stronger than gender correlation
11:25ejacksonnDuff: seriously ! That's interesting.
11:26jcromartieyeah, all said, I'm sure the social aspects are far bigger: workplace sexism; conditioning; etc.
11:26jcromartieis there a drive to recruit more female deisel mechanics?
11:26jcromartieor more female garbage collectors?
11:27craigbrosuch jobs do not tend to have the self self-valorization of programming 8^)
11:28ejacksoncraigbro: good observation.
11:29`fogusMaybe those fields don't see a lack of gender equality to be a problem?
11:29`fogusI have no idea
11:30tmcivercraigbro: that's your opinion. How about we let females (or whatever group we happen to be talking about) decide for themselves what valor-inducing job they want.
11:30ejacksontmciver: i think he was jesting...
11:31ejacksonmy lord, what a conversation to try have on IRC !
11:31ejacksoni think most of us agree that diversity is good for a community, and we are certainly not a diverse community (along several dimensions)
11:32ejacksonhow to change that, well...
11:32tmciverejackson: what kind of diversity? Diversity of thought, or diversity of sex, race, religion?
11:32ejacksontmciver: all of the above.
11:32chouserAlso, moral good or practical good?
11:33ejacksonboth
11:33ejacksonour context, down to the language we speak, affects the thoughts we have, and so how we code
11:33tmciverDiversity of thought should be, IMHO, all that matters. I don't care about the others.
11:33ejacksonhaving diverse people brings in different ways of thinking
11:34ejacksonthis is a practical good
11:34chouserAh, well, morality is a whole other thing. For a practical good, I'm content to make efforts to improve the team I'm working with in that regard, and let the rest of the industry worry about itself.
11:34jballanctmciver: the trick is that it's really, really hard to identify what makes for a good diversity of thought a priori
11:34ejacksonchouser: i think that's good for the wider community too !
11:35TimMctmciver: The gender imbalance may or may not directly be bad for the Clojure community, but is indicative of a problem in the larger (human) community.
11:35`fogustmciver: Very often people different than you and me come from very different backgrounds leading to very different experiences leading to very diverse ideas
11:35craigbroa think it is an amusing habit of programmers to think of "thought" or "skill" as things that are distinct from the rest of the human -- it's a sort of myopic egalitarian conceit
11:35tmciver`fogus: agreed, but that falls under 'diversity of thought' for me.
11:35chouserI think the whole idea of increasing the percentage of women in the industry is somewhat orthogonal to the specific treatment of individual women in certain sub-communities, conferences, etc. I'm much more likely to be persuaded about the moral component of the latter.
11:35ejacksondiversity of thought arises directly from the other diversities
11:36jballancchouser: likewise...and, let's be honest, most of the behavior that people identify as driving away women/minorities is just straight-out not professional behavior to begin with
11:37jballanceh, forget professional...I've seen a lot of behavior that would embarras me even if it were just a close circle of friends
11:37craigbrojballanc: yes. I think that's the case most of the time -- however, even professional behavior can mask assumtions. Like the boss always asking the women on the team to be in charge of organizing the surprise going away party for leaving party member
11:37chouserjballanc: yes. And if a specific incident harder for someone to deal with because they have had to deal with many more such indidents than a non-minority, then so much more shame on the one perpetrating it.
11:37tmciverIf there's a gender imbalance in a particular industry I don't care what the reason is as long as a group is not being actively discriminated against.
11:38tmciverAn imbalance might be due to either lack of interest or lack of ability.
11:38ohpauleezI'm catching up here - is all of this in response to something specific?
11:38ejacksonohpauleez: I think it was the tweet from @puredanger
11:38craigbroohpauleez: some discussion on twitter about the issue of gender imbalance
11:38ohpauleezahh gotcha
11:39TimMctmciver: True, but I really do think in this case that it's a matter of cultural prejudices.
11:39jballanctmciver: There's a third possibility... women and men may not differ in interest or ability, but I think there's no denying that there are developmental differences
11:39`foguschouser: I think I agree with you. Concrete bad behavior can be more easily addressed than societal issues.
11:39ejackson`fogus: can we identify any such behaviour in our community?
11:39craigbro"community" is a construct of little value
11:40`fogusejackson: Not that I know of. But I've not had the full range of experiences (and probably never will)
11:40craigbrothe behavior is social, so you have to look at individuals in specific social contexts
11:40craigbroaka, people at cons, on IRC, in blog posts etc...
11:40ejacksoncommunity: the aggregation of our mailing list, IRC, Githubs, conferences etc
11:40ejacksonoh, we agree :)
11:40craigbroaka, look at social interactions, not over-reified notions of a "community" being good or bad
11:41craigbroejackson: the reificiation of community results in it collecting the sins of individuals, and then painting member with that same brush
11:41ejackson`fogus: this is the problem right. Are you saying that its hard for us to identify such behaviour as we don't necessarily know what it is ?
11:42craigbroejackson: look at the whole 29c3 blowup for example -- suddenly even peopel doing supportive acts were assumed to be acting out of some horrid motive attributed to them via association with a unreedmably bad and gender-biased "community"
11:43ejacksonaaah them !
11:43craigbroalso concentrating on concrete social interactions is alot more effective for identifying and coutner-acting the biases
11:43craigbroaka, fix your interactions and your immediate social groupings, not try and fix a "community" in the abstract
11:45`fogusejackson: I think that's part of it. The other part of it is that as a white male living in the US, I rarely have people say things that are meant to belittle me in sexual/racial/cultural ways.
11:45craigbrosee what happens when I'm waiting for a scaling/perf test to complete???
11:45lazybotcraigbro: Yes, 100% for sure.
11:45nDuffejackson: Could you repost the question?
11:47craigbrocore.logic and SQLKorma killed my ORM
11:47ejacksonnDuff: oh I never posted it... it was just what I was working on before I got sucked into this
11:47craigbrohallelujah, it's dead
11:47ejackson`fogus: yes, I understand.
11:48craigbrofinally making the transition to nrepl from swank/slime
11:49`fogusejackson: And when it does happen it doesn't bother me because it's so rare that I can easily dismiss it. My wife on the other hand...
11:49chouserAs a midwestern Christian, I often hear things said that belittle me in a cultural way. But maybe that's not quite the same thing. :-)
11:50`foguschouser: Right! That never happens to me, so while I can sympathize it's hard to put myself in your shoes and tell if there is a strong anti-Midwestern-Christian bias. :-(
11:50ejacksonI could start a Fogus Belittlement League, if that would help :P
11:50craigbroyah, what kind of name is that anyways?
11:51`fogusejackson: have it me
11:51craigbrosounds more than foreign, sounds, alien
11:51craigbromade-up, like John Smallberries or John BigBoutte
11:51ejacksonSo we should ask, then ?
11:51TimMcWho shall bell the cat?
11:52craigbroI'm sure he's been called Bogus before, so we gotta do better than that
11:53`fogusYeah. I got over that by 2nd grade
11:54TimMcThere's gotta be some good acronym we can make.
11:54jballancyeah, I recently experienced first-hand just how obscure and unexpected belittlement can be
11:55TimMcWhat's the phrase again? "Bigotry is fractal."
11:55jballancI moved with my wife to Turkey, and then had to fly to Frankfurt for business...the guy at passport control asked "How long will you be staying in Europe?"
11:55jballanc...and I found myself slightly insulted by that
11:55jballancI mean...it's a crazy thing to be insulted by...but there you have it
11:56jballancI really wanted to snarkily reply "As long as I damn well please, seing as I live in Europe..." but I thought better of it and let it go
11:56chouserjballanc: sorry if I'm slow on the uptake -- insulting because Turkey is also Europe but he was implying it wasn't?
11:56jballancyeah
11:56jballancactually, it's not just specific to Turkey
11:56jballancwhen you enter the Schengen zone they ask you about your stay in "Europe"
11:56TimMchaha
11:57jballanceven though Schengen doesn't actually cover all of *Europe*
11:57jballanc...it just made me realize how completely context-dependent "belittlement" can be
11:58TimMcIt probably wasn't seen as belittlement by the passport control agent.
11:58wreckimnaked_Europe_ isn't really a precise concept, is it?
11:58TimMcMicro-aggressions.
11:58jballancTimMc: exactly! I'm sure he thought nothing of it
11:58TimMcwreckimnaked: I've never been clear on this alleged Europe/Asia boundary.
11:58ejacksonright, I'm going to gym, for my paid-for belittling !
11:58jballancand that one occasion didn't really mean anything to me
11:59jballancbut I could see how little things like that could add up over time to really alter someones outlook
11:59TimMcGoing barefoot has helped me understand that concept. Over time, the "clever" remarks really add up.
12:00craigbroand then core.logic ate my dog, and I haven't been able to get all the blood our of the rug
12:01wreckimnakedI've just came back from a trip to Prague for New Year's Eve
12:01wreckimnakedCzechs don't like the term _Eastern Europe_
12:01wreckimnakedthey prefer to be on _Central Europe_
12:02pipelinewhich is probably more correct
12:02TimMcwreckimnaked: "Well, it's east of everything *important*, see?"
12:02wreckimnakedyes
12:02pipelinewell, it used to BE eastern europe
12:02pipelineyou know before 1991
12:03n_b many in the UK prefer not to be Europe at all
12:03pipelinecentral europe stopped being a thing for about fifty years ;)
12:03TimMcI just want to say... <3 this IRC channel for having this discussion, and having it in a polite, civil, constructive way.
12:03n_bthe continent is still a massive geopolitical tangle
12:04TimMcwreckimnaked: And Russia's up there having an identity crisis or something.
12:04wreckimnakedTimMc: I have plans on visiting Russia soon
12:04TimMcI tend to think of it as Europe, Asia, the Middle East, and Russia. -.-
12:04wreckimnakedit seems like a big mess
12:05TimMcbut even "Russia
12:05wreckimnakedin terms of politics and the ongoing change on their mindset
12:05TimMc^W^W^W
12:05wreckimnakedI don't see it really as Europe
12:06wreckimnakedIt seems like a really different way of doing things when compared to France or Germany
12:06chouserEurope is the only part of Russia I've visited.
12:06wreckimnakedchouser: x)
12:08jballancyeah, European politics is waaaay more interesting than anything America has to offer ;-)
12:09gkoWe want Game of Thrones-style politics.
12:18technomancywhat, the season-ending fiscal-cliffhanger wasn't enough to boost the ratings?
12:18technomancytough crowd
12:20n_bjballanc: Fictionalised Danish Politics are among the most popular TV shows in Britain ;)
12:20n_bFiscal Cliff was more interesting when it was called Cliffmas
12:21n_bPersonally I was wishing for Chanukkah was a bit later in the year so we could have 8 days of Filibuster
12:38craigbroBTW yall
12:38craigbroI really appreciate the emacs clojure support's progress over the last year
13:00ambrosebsdnolen: hows this? https://github.com/frenchy64/typed-clojure/wiki
13:02aaelonythis is a pretty cool listing http://lanyrd.com/topics/clojure/
13:07dnolenambrosebs: awesome!
13:07dnolenambrosebs: yeah, I've been meaning to try my hand at typing some core, I will add what I can. thanks much.
13:08ambrosebsdnolen: lovely!
13:09ambrosebsdnolen: I've been researching a very cool inference algorithm which might relieve the need to annotate all anon fns
13:10ambrosebsdnolen: I'm always thinking how this relates to a static type system for miniKanren :)
13:11ambrosebsinferring anon fns seems critical to start with.
13:34ejacksonambrosebs: those docs are looking really good !
13:35ambrosebsejackson: good!
13:36ejacksondnolen: see what prismatic threw at me today: http://zinkov.com/posts/2012-06-27-why-prob-programming-matters/
14:01nybbleshello, does anyone know why (get {:a 1} :a (throw (Exception. ))) results in an exception getting thrown?
14:01hiredmanget is a function
14:02hiredmanall arguments are evaluated
14:04nybbleshiredman: ah that makes sense, d'oh :)
14:04nDuffnybbles: I'd suggest using something like ::default
14:05nybblesnDuff: how do you use ::default?
14:06bpr,(get {:a 1} :foo ::default)
14:06clojurebot:sandbox/default
14:06nDuff(let [result (get {:a 1} :a ::unset)] (when (= result ::unset) (throw Exception.)) result)
14:06bpr^ that too
14:06nDuff::default or ::unset is just a namespaced sigil
14:07dnolenejackson: heh, yes I saw that too. It actually reminded me to look closer at Church.
14:08dnolenejackson: also it seems Nada Amin is curious about probabilistic programming in support in core.logic as well ... so maybe we can work on this together at some later this year.
14:08peat_I have a novice question that I've been knocking my head against that I hope someone can elucidate me on. I have a seq of vectors, any pair of which can be compared like (compare v1 v2). My issue is that I'd like to get the "maximum" vector of the sequence. I figured out (reduce #(if (= 1 (compare %1 %2))) %1 %2) seq-of-vectors). However, I have some vectors that are different but have the same value (= 0 (compare v1 v2)) and would li
14:08peat_In imperative land, I'd initialize a collection and append to it as fits the condition. However, I'm struggling with an idiomatic functional equivalent.
14:09ejacksondnolen: oh yeah ? That would be fun.
14:09bpr,(doc sort-by)
14:09clojurebot"([keyfn coll] [keyfn comp coll]); Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
14:11nybblesnDuff: ah i see, that makes sense, thanks!
14:11magnarsI have a map, and a list of data structures representing transformations to be done to the map. The transformations should be applied to the map in order, with changes from one reflected when running the next. I am interested in gathering the diffs (additions, changes, retractions) to the map as a result of the list of transformations. Any thoughts or
14:11magnarsinsight in how this could be done in an idiomatic way?
14:11chouser,(apply max-key (list ["a" "b"] ["c" "d"]))
14:11clojurebot["c" "d"]
14:11chouserpeat_: ^^^
14:12bprchouser: i had forgotten about that
14:12chousermagnars: maybe 'reductions'?
14:12chouserbpr: it's easy to forget about. So specific.
14:13peat_chouser: Interesting, I'd looked at the max-key function, but it required that my key return an int
14:13antoineBhello, is there a "read" like function in clojurescript?
14:14ohpauleezantoineB: yes, read-string
14:14peat_chouser: will take a look at applying it in this manner.
14:14chouserpeat_: oh wait, I think I screwed up that example.
14:15chouserpeat_: and you're right.
14:15ohpauleezantoineB: it's in the cljs.reader
14:15aaelonyis anyone familiar with storm-starter? https://github.com/nathanmarz/storm-starter/blob/master/src/clj/storm/starter/clj/word_count.clj
14:16antoineBohpauleez: thanks
14:16ohpauleezantoineB: np! totally welcome
14:16chouserpeat_: I guess you can either use sort-by as bpr suggested, or roll your own max that uses compare instead of <
14:17chouserpeat_: for the latter, you'd probably want to use 'reduce', where the running value is the max vector so far
14:17antoineBis there a way do to (new TypeConstr args) in clojurescript?
14:18antoineBi can't use a constructor function as a regular function
14:18antoineBor how can i do (defmacro [sym] (~sym.)) ?
14:18peat_chouser: I was thinking it would be trivial if max-key worked on collections like compare. I suppose using the sort-by function would require me to still check items in the collection to only pull the first elements that were equivalent to the max
14:19karpovhi all. I am wondering if there's a good (idiomatic?) way to build a multi-dimensional map (i.e. map of maps of maps etc), given a list of records (or maps). like, I got a list of Person records, with Country, City and zip for each, and I want to have a map (of maps...) Country->City->Zip->list of people... Sounds like something common enough, right?
14:19magnarschouser: thanks for the suggestion, and also the rubber ducking: while typing in my response, trying to clarify the question, a solution appeared. :-)
14:19chousercool
14:20chouserpeat_: if you're wanting to learn functional style, take a crack at using 'reduce'. It's a tool you want to be comfortable with.
14:20bpr^
14:22antoineBnevermind my question you can't do in javascript "new Constr.apply(null, [arg0, arg1])"
14:23antoineBso passing a constructor as a function won't works
14:24peat_chouser: Agreed, my grasp of reduce is a bit rudimentary at the moment. My first attempt uses reduce, but somewhat arbitrarily decided ties. I'm still trying to wrap my mind around reduce when there are three entities: v1, v2, and a collection containing previously "winning" vectors.
14:24chouserthe function you pass to reduce only ever gets two args: the running value (previous result) and the next item from the input collection
14:25chouserDo you want a collection of previous winners? Or just the one (first? last?) winner?
14:26peat_chouser: Well, my first attempt was: (reduce #(if (= 1 (compare %1 %2))) %1 %2) seq-of-vectors), which returns a single winning vector, but I can actually have different vectors that tie when compared with compare.
14:27chousersure. do you want to collect all the ties?
14:27peat_chouser: Exactly.
14:28chousereven though they're all equal to each other?
14:29peat_chouser: Ties evaluate to 0 with compare, but they can actually be different.
14:30chouserok, so your running value will have to be some kind of collection (set or vector, I suppose, of vectors) which is different than the elements of the input sequence. That means you'll need the three-arg form of reduce
14:33peat_chouser: cool--I'll take a look at that form. Good to know that I'm at least barking up the right tree with reduce.
14:33chouseryep
14:35amalloyan easy solution would be to sort the list, and then take items from the front until they stop comparing as zero
14:36chouserHm, come to think of it, items that compare as 0 and yet are different are somewhat dangerous to have around. How did that happen? Are you sure you want it?
14:38amalloychouser: not at all, if you're using a custom comparator to focus on only a subset of their qualities
14:38bprchouser: perhapse the "compare" function is just testing for feature and not attempting to indicate equality. Would you still consider that dangerous?
14:38bprfor some feature*
14:38amalloyeg, sort them by first name, and find all the last names of all the people named abel
14:38chouserwell, don't try to put them in a sorted set or as keys of a sorted map -- that's definitely broken.
14:39chouseramalloy: but that's a property of the sort, which is fine. compare is controlled by properties of the objects themselves.
14:39TimMcSounds like that behavior should be pulled out as a custom comparator.
14:40amalloysure, if he's actually got the objects implementing Comparator in a half-baked way that doesn't match with equals, that's bad
14:45cemerickhi all, Mostly λazy ep 9 (it's a clojure-esque podcast) is out with ohpauleez and lynaghk http://bit.ly/138zzc8
14:45dnolencemerick: SWEET
14:45cemerickdnolen: I'm coming for you next. ;-P
14:45ohpauleezdnolen: lynaghk does an awesome impression of you
14:45dnolenohpauleez: haha
14:45cemericklol, it's true!
14:45dnolenoh noes!
14:52peat_amalloy: bpr: chouser: Sorry, stepped away before realizing there was still conversation on my humble question :-) To clear up what I'm up to, I'm going through the Peter Norvig's CS212 Udacity course (taught in python), but using it as a vehicle for learning some clojure. The example is a poker hand selector (naive algo obviously--no fancy hashing functions).
14:52ejacksoncemerick: you didn't start with star-date !
14:52cemerickhah
14:53cemerickejackson: please tell me someone has a current stardate site online somewhere
14:53ejacksonhahaha... i think its completely random ! But it would be fun.
14:53bprpeat_: gotcha. that sounds fun
14:54chouserpeat_: did you implement your own compare method?
14:54TimMc(let [*date (rand)] ...)
14:55peat_Two hands might be represented as: ["6C" "7C" "8C" "9C" "TC"] and ["6D" "7D" "8D" "9D" "TD"]. The hands are different, but their ranking is equal. I have a hand-rank function that does return a vector that can be compared with compare. So, those two hands, while not identical, would have (=0 (compare (hand-rank hand1) (hand-rank hand2)))
14:56chouserahhh. totally acceptable. :-)
14:57peat_chouser: well, I was hoping I could use compare as my comparison function. The hand-rank function would return the following for the those two hands: [[true nil nil true true nil nil [10 9 8 7 6]] [true nil nil true true nil nil [10 9 8 7 6]]]
14:58chouserI would recommend against convincing clojure's own compare function (or the java interop equivalent) to return 0 for things that are not equal
14:58chouserhaving your own rank-compare function would be plenty safe though, and nearly as convenient as making compare do what you were wanting.
14:58peat_In the Udacity course, they use python's max function which operates on tuples much the same as clojure's compare function works on vectors (modulo length)
14:59peat_But of course, they refactor into a procedural chunk of code to handle ties :-)
15:01dbushenkohas anyone figured out how to test clojurescript with phantomjs?
15:02peat_chouser: Actually, compare returning 0 for ties is good. I'd want to keep those!
15:03ejacksonis there a more idiomatic way to do (take-while identity (iterate f x)) seems like there must be ?
15:04amalloynope
15:04ejacksonok, thanks.
15:04ejacksoncan I rely on that not chunking me ?
15:04technomancya bunch of those kind of functions really should have identity as their default arg
15:05ejacksontechnomancy: that would be cool
15:05technomancyproblem is I hate having optional args anywhere but the last position
15:07hornairsis there any way to "multiplex" OutputStreams? not strictly a clojure question sorry. if I have an OutputStream thats half way through spitting out its stuff and a second client enters the world that would want to see the contents of the OutputStream from the start and continue to get successive reads from it how might I accomplish that?
15:08hornairsi guess I want a broadcasting stream of some sort
15:10pjstadighornairs: there are some classes in apache commons io
15:10pjstadighttp://commons.apache.org/io/apidocs/org/apache/commons/io/output/TeeOutputStream.html
15:10hornairsaw cool
15:10hornairsthanks pjstadig
15:15amalloytechnomancy: in a way, apply has optional args in the middle
15:16technomancyamalloy: true, as does reduce
15:16technomancybut exceptions outside clojure.core are annoying
15:16amalloyah, a clearer example
15:16chouserare/fold
15:16chousersigh
15:17chouserr/fold
15:18amalloyhah. a clever autocorrect?
15:19chouseryeah. just the wrong kind of clever
15:21ejacksonchouser: are you dictating ?
15:21ejackson:)
15:24TimMctechnomancy: reduce's args must bother you.
15:24atyzsorry if this seems dumb: I'm currently interacting with my DB with korma, I've run into a problem making my associations. my problem stems that in model a i have (defentity b (belongs-to a)), in order to do this i need to (defentity a). but now when i try to (defentity a) in model a. it fails because i can't redefine this entity
15:24TimMcOptional arg in the *middle*.
15:25atyzthis is irritating because i want to keep my models separate
15:25atyzand not require model a inside b
15:25gfredericksTimMc: he mentioned that already
15:25atyzwhat is the correct way to go about this
15:25gfredericksatyz: I think you just need declare
15:26gfredericks(declare b) (defentity a ...) (defentity b ...)
15:26atyzgfredericks: that is correct, but i don't want to have all of model bs functions inside the same namespace as model a
15:26sabermancraigbro: earlier you mentioned core.logic + korma obviating an orm - I'm curious, how are you using them together?
15:26atyzit feels dirty
15:27atyzso to me it feels liek the cleanest way to do it is to have an associations namespace, and include that inside my models
15:27atyzbut that also seems... silly
15:27craigbrosaberman: souped up defrel, we call them "observations" and some code to define tables and exports them to an SQL database
15:27gfredericksatyz: oh so you're defining a in one namespace and b in another?
15:27craigbrosaberman: so I get a consistent data model in core.logic, and also SQL. I generate sql using korma
15:28atyzgfredericks, i'm not. but it feels like i'm forced to.
15:28atyz(i really think i'm missing something)
15:28craigbrosaberman: it's a rather complex data model (malware analysis) and we need very fast writes, so no artificial keys, no enforce relations
15:29atyzits raelly simple, when i query for model a, i want it to look at the fk, and return the model b associated with it
15:29atyzand when i query model b, i want it to return all the as associated with it
15:29atyzmodel a and b are in separate namespaces
15:29sabermancraigbro: awesome info, I'm new to core logic, off to do some research :)
15:29craigbrosaberman: it's high normalized relational model, a series of "facts" ala core.logic (process-modified-path PID PATH TIME) ...
15:29atyzand therefor to make the queries i need to (defentity a/b) in each nameapce, which it won't allow me to do
15:29craigbroatyz: ah, namespace circular dependencies
15:30atyzyes, i feel like i'm missing it
15:30atyz*something
15:30craigbronope, not missing it
15:30gfredericksI don't know of any easy solution there :/
15:30atyzwhat is the correct way to handle this? it feels almost like i need to have an associations namespace and require those in each of the models
15:30atyzbut that just feels like a hack
15:31craigbroatyz: what I do is NOT use defenttiy
15:31craigbroand all that
15:31craigbroI use korma's sql generation, functioanlly
15:31craigbroand I just use table references, which are always keywords
15:31sabermancraigbro: so using c.l as an in-memory schema, essentially?
15:31atyzhmm in that case, defentity feels like such a handicap
15:32craigbrosaberman: sort of, there is no interaction between c.l and my sql gneeration code, except that there is a very obvious and direct mapping between the two that my domain experts only have to learn once
15:32craigbroatyz: that is my opinion as well, unless it's extended to do late-binding on entity references and all that
15:32atyzthansk gfredericks + craigbro
15:33craigbroatyz: or you put everything in the same namespace. Namespaces are not really like java packages
15:33craigbroatyz: or rather, i think they are much less granular than them
15:33atyzsorry, i'm new to clojure, still unsure of the correct ways of doing such things
15:33craigbroatyz: for isntance my app has one huge common namespace for models
15:33ibdknoxmost people have an entities.clj
15:34ibdknoxthere's not much of a solution here, it's a fundamental limitation of Clojure's lack of circular dependency resolution
15:34atyzibdknox: thats what i was thinking of doing, but that feels like such a hack and from what i understand, against the way of thinking in a functional language
15:34ibdknox?
15:34ibdknoxhow so?
15:34ibdknoxthat is in no way a hack, nor against functional thinking
15:35ibdknoxpeople usually have a routes.clj for compojure routes
15:35atyzforgive me if i'm wrong here, but i always thought a win of functional programming was that everything was very granular and you only really required what was needed
15:35craigbrohehe
15:36atyzby creating an entities.clj you're now carrying the weight of all your associations in every model
15:36atyzagain, i'm new to functional programming, so i may be very wrong
15:36ibdknoxatyz: you only bring in what you need
15:36craigbroweight?
15:36ibdknox(:require [blah.entities :refer [enta entb]])
15:36atyzaaaaaaaaaaahhhhhhhhhh
15:36atyzok, that makes sense
15:37atyzthank you
15:37atyzsorry, i was under the misconception that it was like many other languages where you just kind of required the file and everything that was in teh file came along with it
15:38ibdknoxwhen it comes to circular deps in Clojure you have two options: remove the mutual dependency or extract the commonality into an NS. When it comes to entity defs, the latter is the only real option regardless of the implementation
15:39craigbroibdknox you can use quotes symbols for entity names
15:39craigbroquoted symbols
15:39ibdknoxyou still need to resolve them to the other namespace
15:40craigbroor package qualified symbols
15:40atyzibdknox, craigbro - thanks
15:40craigbroyup, but resolve at runtime, not define time
15:40gfredericksyou still need the var to exist at compile-time
15:40gfrederickswhich could be done with some low-level hacks
15:40craigbronope you don't
15:41craigbroerr, well, to be spcific, you don't need it to be interned/bound in the ns at compiletime
15:41ibdknoxyou'd end up in macro hell with this strategy
15:41gfrederickscraigbro: I'm referring to the current korma impl
15:42craigbroyup
15:42craigbroibdknox: it deifnetly complexifies implementation
15:42ibdknoxit seems like entities.clj is a fine solution, I don't think we were meant to hack in circular dependency resolution :)
15:43craigbroibdknox: and I personally don't think it's worth all that much, as the entities.clj solution is fine IMO
15:43algernon-17
15:43gfredericks+17
15:43ibdknoxfor better or worse, it's the "Clojure way"
15:47atyzi must say, the way ibdknox has explained the entities.clj solution, i'm pretty ok with it
15:48ibdknoxamalloy: listen, that's mine. Back off.
15:48craigbroit makes the shrapnel in my leg from the c.l.l wars, ache
15:50atyzamalloy: haha
15:50peatHello everyone. :) I'm doing some work with Twitter, and I'm having trouble finding a lib that plays well with Twitter API v1.1. I'm willing to put in some time bringing a project up to 1.1 if there isn't one. Any recommendations from #clojure on a good place to start hacking?
15:54jeremyheilerI've never really used them, but I know of https://github.com/adamwynne/twitter-api and https://github.com/mattrepl/clojure-twitter
15:54jeremyheilerpeat: I'm not sure how compliant they are with 1.1 though
15:55peatjeremyheiler: Yes, I've been looking at both. I'm using twitter-api right now, and it looks like an easy path to 1.1 ... but I'm checking around to see if I'm missing something, or stepping on toes. ;)
15:55jeremyheilerpeat: ok cool. figured i'd throw those out there just in case.
15:58peatjeremyheiler: I appreciate it. :)
16:15gfrederickscraigbro: what are the "c.l.l wars"?
16:15TimMccomp.lang.lisp?
16:16TimMcUsenet, my son.
16:17gfredericksI'm too young to know about anything prior to the two-thousand-and-teens
16:17karpov... when ships were made of wood, and men of metal.. =)
16:17jballancsome reading material: http://www.donhopkins.com/drupal/node/109
16:17amalloyit's still around, guys. i don't know this "too young" stuff
16:17TimMckarpov: When Fortran was only Threetran
16:17TimMcwhen I was a boy
16:17arrdem(inc TimMc)
16:17lazybot⇒ 30
16:18gfredericks$karma gfredericks
16:18lazybotgfredericks has karma 13.
16:18Raynesgfredericks: No you're not.
16:18TimMchttp://www.stevemacdonald.org/lyrics/wiwab.html
16:18gfredericksdamn TimMc is a lot cooler than me
16:18TimMcOh, it's "Back when Fortran was not even Three-tran". Oh well.
16:18arrdem,`(doseq [x (range 9000)] (println
16:18clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
16:19gfredericksRaynes: what? you want to have a young-off?
16:19RaynesI remember VHS. :(
16:20chouserI used Beta
16:20gfredericksmy grandpa had both vhs and beta and would use them in parallel to copy movies he rented
16:20arrdemsilly Betamax...
16:20karpovwhoa.. what is that clojurebot thing? does it respond to code and attempt to execute it?
16:20metellus,(prn "yes")
16:20clojurebot"yes"
16:20arrdemkarpov: that's the point of clojurebot
16:20Rayneskarpov: There are two bots in here that can do that.
16:20TimMcMy mom apparently remembers seeing a relative use a wire-recorder.
16:20Raynes&(+ 3 3)
16:20lazybot⇒ 6
16:20jballancclojurebot: say hello
16:20clojurebotPardon?
16:21jballancyou heard me
16:21karpovI am new to IRC, obviously.
16:21ejacksonpish, I remember when IRC happened over drums.
16:21arrdem,`(doseq [x (range 9000)] (println "(inc clojurebot"))
16:21clojurebot(clojure.core/doseq [sandbox/x (clojure.core/range 9000)] (clojure.core/println "(inc clojurebot"))
16:21RaynesI remember when #clojure didn't have a lazybot.
16:21hyPiRionYou guys with technophilian parents, I envy you.
16:21arrdemglad I quoted that..
16:21arrdem$karma clojurebot
16:21chouserdotimes
16:21lazybotclojurebot has karma 15.
16:21metellus$karma lazybot
16:22lazybotlazybot has karma 11.
16:22gfredericks$echo (inc lazybot)
16:22hyPiRionecho (inc lazybot)
16:22lazybot(inc lazybot)
16:22hyPiRionyou fool.
16:22arrdemooh is it bot taunting day again?
16:23karpovthis is very cure, but I can see how the channel can erupt into a very disorderly kind of behaviour =)
16:23amalloy~guards
16:23clojurebotSEIZE HIM!
16:23arrdem~gourds
16:23clojurebotSQUEEZE HIM!
16:23amalloyyou see, we have that covered also
16:23arrdemespecially the gourds.
16:23ejacksonthat is genius !
16:24arrdemamalloy: appologies for stealing your party trick
16:24TimMc~botstack
16:24clojurebot/me puts lazybot on his head and gropes blindly for a third bot to complete the stack.
16:24amalloyarrdem: that's technomancy's favorite, not mine
16:25karpov* is testing this star thing
16:25portlyHi is anyone using luminus?
16:25hyPiRionseems like clojurebot doesn't have /me fixed properly.
16:26TimMchyPiRion: Probably because it is using the IRC protocol directly -- the equivalent of you putting /say in front of your messages.
16:26clojurebotAck. Ack.
16:26TimMccrap
16:27TimMcOr do you mean that it should special-case it?
16:27craigbroindeed, comp.lang.lisp
16:27jballanc~litany against cons
16:27clojurebotlitany against cons is "I must not cons. Cons is the perf-killer. Cons is the little death that brings total obliteration. I will face my cons and permit it to pass over me and through me, and when it has gone past I will turn my GC to see its path. And where it has gone there will be nothing; only I will remain."
16:28hyPiRionWell, it should either be special cased or rewritten
16:28arrdem~conj
16:28clojurebot(conj {:a 1} (when true {:b 2}))
16:28bprthat litany is awesome
16:28hyPiRion/me in front looks a bug, at least.
16:28TimMcI've seen people use it intentionally in that way before.
16:29hyPiRionhm.
16:29hiredmanit is not a bug in clojurebot, it is someone putting /me in front of a factoid incorrectly
16:30Raynesyogthos: ping
16:30arrdem,(doc gensym)
16:30metellus,(println (str (char 001) "ACTION forces an action"))
16:30clojurebot"([] [prefix-string]); Returns a new symbol with a unique name. If a prefix string is supplied, the name is prefix# where # is some unique number. If prefix is not supplied, the prefix is 'G__'."
16:30arrdem(inc metellus)
16:30lazybot⇒ 3
16:31RaynesThat's kind of dangerous.
16:31hyPiRionRaynes: kind of? .p
16:32metellusit's not great
16:32jballancwait...is clojurebot an op? can he kick people?
16:32metelluson the bright side, it can only do client-to-client things
16:32hyPiRionjballanc: no.
16:32jballancaww...
16:32metelluseven if it could, that wouldn't work
16:32jballancI mean...yeah, that's probably for the best
16:32metellusthat only works with ACTION because that's not part of the actual irc spec
16:32yogthosRaynes: hey what's up
16:32Raynes,(println (str (char 001) "PRIVMSG #clojure :Hi there, I'm clojurebot."))
16:32metellusit's just a client to client thing
16:33hyPiRionheh.
16:33jballancah
16:33metellusdoing /me is really just a PRIVMSG that irc clients special-case
16:33Raynesyogthos: I was going to tell you that portly was asking if anyone here uses luminus, but he left 30 seconds later not understading how IRC works.
16:33yogthosRaynes: hehe well next time he's back ;)
16:34arrdemRaynes: being that you hang out and shoot the breze until someone answers?
16:34RaynesYes.
16:34yogthosindeed
16:34yogthosI just leave it on pretty much now :)
16:34RaynesPeople come thinking is is their own private help line.
16:34RaynesWhereas there are real people doing other things that just haven't seen your question yet.
16:35Raynesyogthos: Do you have ZNC?
16:35yogthosRaynes: nope, I use limechat right now
16:35hyPiRionYeah
16:36jballanclimechat is nice
16:36yogthostells you when people ping you :)
16:36terom,(println (str (char 003) "4 dangerous?"))
16:36clojurebot dangerous?
16:36jballancused it for ~2 years...eventually gave in and switched to irssi though
16:36TimMcRaynes: I like to imagine IRC as a room full of mannequins that can be activated by their users. It makes a room full of idlers so much more interesting!
16:36yogthosha!
16:36solussdIs it possible to set session expiration to different values for different sessions with Noir? I know how to change them for everybody, but I'd like to implement a "remember me" checkbox that gives you a session that lives past the browser being closed- i want it to be opt-in.
16:36jballancTimMc: I'm convinced that IRC bots are the equivalent of programmer pets
16:37TimMc~botsnack
16:37hyPiRion~botsnack
16:37clojurebotThanks, but I prefer chocolate
16:37clojurebotThanks! Can I have chocolate next time
16:37yogthossolussd: not right now
16:37TimMcheh
16:37metellus~chocolate
16:37Raynesyogthos: You can use ZNC with whatever IRC client you use. It's just a thing you connect to instead of the IRC network directly that handles the connecting for you and keeps you connected all the time. It lets you connect from multiple devices, and when you're disconnected it keeps track of what is said and plays it back for you when you reconnect so that you have context to jump right into conversations.
16:37clojurebotI don't understand.
16:37ibdknoxsolussd: use another cookie for that
16:37Raynesyogthos: Also, every IRC client worth anything pings you when someone says your name.
16:37arrdemlol@jballanc
16:37yogthosRaynes: ah nice kinda like screen for irc :)
16:37Raynesyogthos: Exactly like screen for IRC. I'll give you an account on my ZNC instance when I get a chance.
16:38yogthosRaynes: looking at it right now this one right? http://wiki.znc.in/ZNC
16:38RaynesYep.
16:38yogthosRaynes: right on :)
16:38hyPiRionI just hook up to a screen session with irssi on it on my private server
16:38solussdibdknox: guess that'll work, thanks
16:38RaynesYeah, meh.
16:38TimMcscreen is screen for irssi
16:38arrdemtmux is screen for irssi
16:38TimMcThat too.
16:38jballancI take it ZNC proxys the IRC connection for you?
16:39jballancbecause I have a remote box that I could use with ZNC, but it's a good amount of latency away from home
16:44TimMcjballanc: Have you tried using mosh?
16:44TimMcI've not tried it yet, but it's supposed to help with SSH latency.
16:44jballancah, yeah...heard of that
16:44jballancmight have to give it a try
16:45jballancstill...my remote box is in AWS-west, and I'm in Turkey :(
16:52technomancylatency over IRC is a lot less annoying than latency over something like SSH
16:52technomancythat said, I have no idea what it's like from Turkey
16:54TimMcPoor brehaut down in NZ gets all our messages the next day.
16:54TimMcBut it's OK, 'cause he's already there.
16:56jballanctechnomancy: yeah, I guess that is true
16:57jballancmight have to give ZNC a spin (especially if my connection keeps being so flaky...)
16:57jballancoh, and in case you were curious...latency is generally not bad, but Ankara to Portland is north of 200ms on a good day
17:00mpanI'm looking at apply-macro and the docs are telling me not to use it. What should I use instead?
17:01amalloyeven if my znc latency were a full second it's hard to see why that would matter, granted that my messages still arrive in order. who cares if they arrive a little late, or i get messages a little after they were sent? it's not like irc is a synchronous communication medium, or something like voice chat
17:02TimMcamalloy: It means you get ninja'd all the time, that's all.
17:02arrdemvoice chat synchronous? my clan and I roll on a half-second+ lag on Mumble. way fun for sync-dropping.
17:03jballancugh...don't remind me...had a G+ hangout earlier today with a good .5 delay *plus* nasty echo
17:03TimMcarrdem: I *think* that was English. :-P
17:03jballanclike having a meeting in the Grand Canyon
17:04TimMcHey, imagine if we could actually send voice data over dedicated wires. You could probably get pretty good QoS!
17:04arrdemTimMc: some days I ponder whether I'm speaking a strict superset of English that describes games and computers...
17:04amalloyi didn't say voice chat was synchronous, arrdem, just that it cares about ping time more than irc does. if i ask a question on irc and get the response fifteen minutes later that's no big deal
17:04TimMcYou could, like, reserve an end-to-end circuit for the duration of the call.
17:05arrdemamalloy: understood, I'm being silly.
17:05jballancamalloy: yeah, I'll probably not even notice for IRC...ssh on the other hand...
17:06technomancyTimMc: interesting idea, but it would never work
17:07craigbroTimMc: what might one call such a system?
17:07jballancah, finally finished my Clojure/West proposal!
17:07jballanc...that was a long form
17:07llasrammpan: Don't find yourself in a situation where you need to `apply` a macro :-)
17:08llasrammpan: For the record, I have never found myself in such a situation
17:08mpanI find myself in a situation where that *might* be beneficial
17:08mpanprobably there's a better way
17:08llasramYeah, what's the context?
17:09mpanuh, so there's a macro called ask, and a macro called ask* which should be in terms of ask
17:09mpanshould I pastebin this?
17:09mpanoh, and uh, ask and ask* should be variadic
17:09llasramProbably
17:10mpanhttps://www.refheap.com/paste/8107 currently doesn't work because I've got it wrong and ask* is expanding to not what it should
17:10mpanit tells me e is qualified but shouldn't be, so I'm a bit lost
17:11llasrammpan: Actually `e` is ns-qualified, and the ask/ask* expansion looks like it should be otherwise fine
17:11llasramChange `e` to `e#` and you should be good to go
17:11terom currently doesn't work because I've got it wrong and ask* is expanding to not what it should
17:12teromups, sorry
17:12mpanwhere can I read up on such details?
17:12mpanthank you very much for explaining that
17:13mpanoh wait, this new e is generated?
17:13chrismoosHi, I'm trying to get something like putIfAbsent for a map in clojure…basically I am trying to initialize a default value for a key in a map and there will be concurrent threads attempting to initialize…any ideas?
17:13dnolenmpan: gensym'ed
17:13llasrammpan: Oh, yes -- the terminal '#' makes it autogensymed
17:13mpanjust curious, is there a way to get a literal unqualified sym "e" there?
17:14hiredmanchrismoos: clojure maps are immutable, there is no put of any kind
17:14llasram&`(e e# ~'e)
17:14lazybot⇒ (clojure.core/e e__142000__auto__ e)
17:14mpanoh cool
17:14chrismooshiredman: i've been trying with a ref
17:14mpanthank you all
17:15chrismooshiredman: using alter but if multiple threads go into dosync i end up initializing the key more than once
17:15dnolenmpan: ~'e, but you risk variable capture - just use e#
17:15hiredmanchrismoos: so have them check
17:15chrismooshiredman: i use a let inside the dosync but its only seeing the in-transaction value, not what has already been committed
17:15chrismooserr, let-if
17:17hiredmanchrismoos: transactions need to be side effect free, becuase anything in a dosync block can be run multiple times
17:18chrismooshiredman: yeah, so maybe i'm doing this wrong and using a ref with alter isn't appropriate.
17:18chrismooshiredman: https://groups.google.com/forum/?fromgroups#!topic/clojure/_BGJoqz-3tk
17:19hiredmanchrismoos: what about it?
17:20chrismoosdiscussion about what i'm looking to do except after reading (and trying) some solutions there it doesn't seem to work out correctly
17:21hiredmanare you doing side effects in the transaction or not?
17:22hiredmanthe code in the email does not do side effects in the transaction
17:22chrismoosi don't think so -- just making a record and assoc'ing it with alter
17:22hiredmanchrismoos: so then why do you care if there is a retry?
17:22hiredmanor if it gets assoc'ed multiple times?
17:22arrdemoh frick... dissoc-in didn't survive contrib did it?
17:23chrismoosi'm returning the assoc'd value and i don't want multiple threads using different instances
17:23dnolenchrismoos: I think you're not understanding how much work the STM does for you. The situation you're afraid of isn't going to happen.
17:23hiredmanchrismoos: then have the function you give to alter check for a value
17:24chrismooshiredman: did that but its referencing the in-transaction value which, for concurrent transactions, is missing the key
17:24chrismoosso it will continue to assoc it
17:24hiredmanchrismoos: but really if you are worried about mutiple different instances it sounds like you are using the stm to fiddling with mutable data, which is a bad idea
17:25hiredmanyou should only use values with the stm
17:26chrismooshiredman: admittedly i'm new to STM and so yeah -- i probably am going about this the wrong way
17:26dnolenchrismoos: if you're using a ref w/ a record in it, you're fine - you're worrying about something that the STM solves.
17:26ZporkRaynes, I worship his shadow.
17:26hiredmandnolen: unless he is associng a stringbuilder in to the ref and writing to the stringbuilder in a transaction
17:26dnolenhiredman: right
17:27hiredmanor other similar things
17:27chrismooshiredman: what about this? imagine you have a map and you want to check this map for a uniqueid for a given key. a unique id should only be generated once for a given key, so anyone that queries this key gets the same unique id. if there are multiple queries when the unique id doesn't exist only once generation should occur and all other readers should get the same thing.
17:28dnolenchrismoos: that is what STM does
17:28hiredmanchrismoos: sure
17:28chrismoosone sec writing pseudo code
17:28hiredmanbut random id generation is a side effect
17:29chrismoosokay well let's just say random id generation = (record. name) where name is a parameter
17:29S11001001chrismoos: but as such you don't even need random
17:29hornairshey Raynes, if I ask conch for seq output of a long running program and then iterate over that seq, will i get lines as they are output by the program or is the whole output buffered before being returned as a seq
17:29hiredmanbut nothing mutable is involed, and you don't care what random id you end up with, so you will end up with one which is fine
17:29Rayneshornairs: You'll get it as it comes.
17:30Rayneshornairs: Conch will read output into a queue under the hood and the lazy seq you get is fed by that. Keep in mind that if the program outputs a whole bunch of text and you don't read it, it'll accumulate in memory over time.
17:31arrdemwhat would the cleanest way be to apply a transformation a variable number of times to a map?
17:31arrdem(no side-effects here)
17:31hornairsRaynes: thanks! i am seeing the buffered behaviour but it must be something I am doing wrong, i am very new to this. a simple doseq should loop over it as it comes right?
17:31S11001001arrdem: nth of iterate
17:32Rayneshornairs: It could be that the output isn't being buffered by conch, but by the program itself. Sometimes programs output differently when they aren't run from a terminal.
17:32chrismooshiredman: https://gist.github.com/b75be902b2b578e2e55b
17:33chrismoosokay i just wrote that, basically i want concurrent calls to get-instance to always return the same value
17:33Rayneshornairs: A PTY is used to make the program think you're a terminal in those cases, but that's pretty hard to do in a JVM-based language and I didn't feel like writing any C and figuring out all that nonsense. It's better that you have a PTY in the middle. Check out the 'unbuffer' program from the expect package. It should come with 'expect' if you're on a Linux distro. If you're on a mac, you can get it from homebrew, but it's in a separate
17:33Raynes homebrew repo. If you're on Windows, give up and install Linux.
17:35pbostromchrismoos: the contains? check should go inside the dosync block
17:35amalloychrismoos: looks fine. no concurrency issues can arise, as long as you don't mind occasionally calling (create-some-instance) and then throwing it away
17:35chrismoospbostrom: if-let does a check too
17:35chrismoosinside dosync
17:35amalloyexcept that you're forgetting to deref m inside the dosync, of course
17:35chrismoosamalloy: i thought this exactly. but that's not what happens.
17:35hiredmanchrismoos: https://gist.github.com/67d1cc3236b3732df852
17:35chrismoosamalloy: yeah: typo
17:36hornairsRaynes: wow, thanks for the info! I'll check it out. The other program is phantomjs with console.logs which to the best of my knowledge wouldn't be buffered but I will investigate
17:36chrismoosamalloy: when i deref it gives me the current in-transaction value of the map. if multiple transactions are occurring concurrently and they all see the key not existing, they will all execute their alter after the if-let
17:36Rayneshornairs: If it doesn't turn out to be the case, let me know and we'll investigate conchisms.
17:37S11001001chrismoos: Your transaction should do this: Check the map for an id. If it's not present, take an id from the id source and stick it in the map.
17:37amalloychrismoos: so what? all but one such alter will be thrown away and retried
17:37S11001001chrismoos: and *that's it*. You have to leave the transaction before you can get that id back from the map
17:37dnolenchrismoos: it doesn't matter, one of them will win, and others will retry see the id and return the set value.
17:37pbostromchrismoos: when you alter the ref, the transaction will restart if the ref was changed by another thread
17:38amalloyhiredman: seems like (dosync (-> (alter m ...) (get k))) is easier
17:38chrismoosso if i move that get out of the transaction it should be good?
17:38chrismooserr, after it
17:38chrismoosafter the dosync
17:38S11001001chrismoos: yes
17:39hiredmanamalloy: *shrug*
17:40amalloyS11001001: are you sure he has to leave the transaction? if he attempts to return the id he put in, and it turns out some other thread run the race, then the transaction will retry; this continues until he's the one who wins the race, at which point the value from inside and outside the transaction is the same so it doesn't matter which he picks
17:40chrismoosokay thanks I really appreciate the help! i'm going to try this out now. btw - love clojure!
17:40S11001001chrismoos: There really isn't a problem with using it in the transaction, as long as you aren't doing side-effects. But there's no point remaining in the transaction either
17:41hiredmanI question the exercise
17:41S11001001amalloy: leave the transaction sooner and everyone's a winner; it's semantically the same but probably faster
17:53sveduboisWhat it means the symbols #^ from (def #^foo.bar x 1). (I suppose it is about the metadata)
17:54llasramsvedubois: Obsolete syntax. It's the same as ^symbol (which is shorthand for ^{:tag symbol})
17:55llasram(Where `:tag` is the metadata key the Clojure compiler uses to receive type hints)
17:56sveduboisAnd the utility?
17:56ToxicFrogImproved compile-time type checking and optimization, I believe.
17:57llasram(a) Avoid runtime reflection for JVM method invocations
17:57llasram(b) indicate primitive types, to avoid un/boxing
18:34bmaddyDoes anyone know what the ^:index trick is in (defrel property* ^:index p ^:index t)? I'm looking here: http://stackoverflow.com/questions/6713424/how-do-i-express-this-in-clojure-core-logic
18:34bmaddyThat's surprisingly hard to search for.
18:35dnolenbmaddy: it's just indexing - a performance optimization
18:36bmaddySo that's a core.logic feature then?
18:36dnolenbmaddy: yes
18:36bmaddygotcha. Thanks dnolen!
18:47arrdemherm... is there a cleaner way than a (loop (recur)) to compute (F^N x)?
18:49S11001001&(doc nth)
18:49lazybot⇒ "([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."
18:49S11001001&(doc iterate)
18:49lazybot⇒ "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
18:49S11001001arrdem: combine
18:50TimMcbmaddy: symbolhound might help.
18:51bmaddyHeh, it just sends me back to the page I was looking at. :)
18:51bmaddyCool site though. I hadn't seen that yet.
18:54TimMcIt only searches stackoverflow and maybe a couple other things.
18:55craigbrooi
18:57arrdemcheers S11001001
19:03arohnerdoes typed clojure support assertions on sets yet?
19:03arohnercan I assert that a fn only returns an elements of a specific set?
19:05arrdemarohner: (assert (contains? set item))
19:05arohnerarrdem: yes, but I'm specifically looking at using typed-clojure
19:10arrdemarohner: no clue, haven't worked with it yet
19:19seangroveI'm looking for a function that given a seq of exclusions, returns the first item from another seq NOT found in the exclusions
19:19seangroveI've written it a few times now, figure I should check if it's built-in at this point
19:20ppppaulany xml advice?
19:20technomancyseangrove: (partial first remove (comp set exclusions))
19:22seangrovetechnomancy: Let me stare at that for a few minutes
19:23arrdem_S11001001: that was (repeatedly) and (nth)?
19:24S11001001arrdem_: iterate
19:24S11001001repeatedly is for side-effects
19:24arrdem_ah OK
19:35seangrove,((partial first remove (comp set ["a" "b" "c"])) ["b" "c" "d"])
19:35clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core$first>
19:36seangrove,(filter (fn [item] (not (some #{item} ["a" "b" "c"]))) ["b" "c" "d"])
19:36clojurebot("d")
19:37seangroveBut I'm doing a full traversal of the last list there, just to get the first value
19:37amalloyseangrove: what on earth is that first one supposed to be? the partial and the comp are both nonsense
19:37seangroveamalloy: Apologies, I was struggling towards a more elegant version of the second one
19:38amalloy(first (remove '#{a b c} '[b c d]))
19:39seangroveamalloy: Definitely much more concise
19:39seangroveBut is there a way to return immediately once the first item is found, instead of filtering the whole list?
19:39seangroveOr, I suppose since it's lazy, that's how it'll work outside the repl anyway
19:40amalloythat's what the (first) does
19:40seangroveamalloy: Well, only on lazy seq's, right?
19:41amalloy*shrug* it produces the first element of anything seqable, as fast as that is possible to do
19:49ravsterhello everyone
19:50ravsterI'm trying to learn data.zip for moving through a xml file, but am having issues. Can someone point me to a tutorial for that project? They don't have tests so I can't even look at those.
19:50arrdem~zip
19:50clojurebotzip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))
19:51arrdemah. wrong zip.
19:51amalloy~zipper
19:51clojurebotzipper is http://clojure.org/other_libraries#toc5
19:51amalloy~zippers
19:51clojurebotzippers are probably not what you want, unless you're already sure you want them: they're great for modifying maps (for certain kinds of access patterns), but usually just get-in and update-in are easier.
19:51arrdem(inc amalloy)
19:51lazybot⇒ 39
19:52amalloyi should have included tree-seq in that snippet
19:53arrdem(inc S11001001) ; he solved my issue and isn't here to be thanked.
19:53lazybot⇒ 4
20:06arrdemamalloy: is conj as bad as cons?
20:06arrdemin the context of ~cons
20:06arrdem~conj
20:06clojurebot(conj {:a 1} (when true {:b 2}))
20:06arrdem~cons
20:06clojurebot(def ^:const x 42) will cause any compiled reference to x to be as if you wrote 42 instead
20:22gfrederickscouchdb makes it really painful to not have a fully lazy json parser :/
20:25ravsterdoes anyone here have experience with data.zip.xml? We're looking at what it does to a 2-page xml file, and its blowing up the computer.
20:26ravsterand/or what xml parsers would people recommend the use of?
20:26ravsters/what/'what other'
20:48bprDoes anyone know of any tools for managing a Maven repository hosted on S3?
20:49amalloy$google maven s3
20:49lazybot[java - maven s3 wagon provider - Stack Overflow] http://stackoverflow.com/questions/850570/maven-s3-wagon-provider
20:51bpramalloy: as far as i can tell, that's for doing mvn deploy on your own project
20:51bprI'm looking for a tool to install/remove 3rd party jars from s3, etc.
20:52hiredmans3cmd
20:52bprbut with that you have to know the expected maven repo layout
20:53hiredmanI suppose that is true
20:53bpri suppose you could basically mirror ~/.m2/repository using s3cmd
20:53hiredmanyes
20:53hiredmanthat is what I have done in the past
20:54bpri think a tool like lein-localrepo for s3 would be great
20:59bpramalloy, hiredman: thanks. I think i'm going to make a lein-s3-repo modelled after lein-localrepo.
20:59bpri'm surprised such a thing doesn't already exist
21:39xeqibpr: you could write something with pomegranate and load maven-s3-wagon-provider to do the deploy/uploads
21:40tufflaxSay if I want a type to implement two protocols, but the protocols have functions with the same name, what could I do about that?
21:43bprxeqi: thanks. I'm doing something of the like. The provider using is from [org.springframework.build/aws-maven "4.4.0.RELEASE"]
21:43tomojtufflax: shouldn't matter, the protocol fn is namespaced. if they have the same signature there will be problems generating the corresponding interface, though.. dunno about that
21:44tomojoh, no
21:44tomojno problems generating each protocol's interface
21:44bprxeqi: though I'm not that familiar with maven, so maybe I'll find that the wagon provider you mentioned is more appropriate.
21:44tufflaxtomoj: ok nice
21:46tomojbut you get "Duplicate method name&signature in class file user/Foo"
21:47tufflaxFoo is the type?
21:47amalloyso don't define the methods inline, tomoj
21:48amalloy(deftype Foo []) (extend Foo I1 ...) (extend Foo I2 ...)
21:48amalloyexcept my extend syntax is rubbish there
21:48tomojah
21:49tomojI'm surprised not to see my typehints make a difference in the protocol interface sigs
21:49amalloyprotocols are clojure things, not java things. the generated interface is a performance optimization
21:49tomojI guess datomic.Connection isn't an auto-interfaced protocol
21:53tufflaxHm, amalloy I'm a bit confused. So I1 and I2 like in different namespaces, and then you could do like (I1-namespace/bar (Foo.))? If bar is a function in I1?
21:53tufflaxs/like in/live in/
21:54dnolentomoj: type hints have no meaning on protocol interface sigs
21:55tomojah
21:56pandeirohow is `lein repl` able to require libs without any project.clj?
21:56dnolentomoj: it would be convenient, more consistent for interop, but I guess no one has been bothered enough to fix it.
22:01tomojdnolen: btw, I think I got condw working. but I don't think I actually need it. and my implementation is ugly. I may try to clean it up sometime and submit it
22:02dnolentomoj: nice, lemme know
22:09alexbaranoskyis Jonase of Eastwood fame on IRC ever? I need to compell him to do more work on Eastwood :D
22:21muhoopandeiro: ~/.lein/profiles.clj ?
22:25pandeiromuhoo: ah ok, yeah if you have plugins there, their jars are loaded on the classpath i guess
22:26muhoopandeiro: lein pprint
22:26muhooor lein deps :tree, maybe
22:27xeqipandeiro: lein also adds a couple of dependencies that way so they can be overritten later (lein-newnew I think)
22:27pandeiromuhoo: can't use that outside a project apparently
22:27muhoofirst cljs hello world http://spazcoin.bamfic.com
22:29muhoopandeiro: aye, looks like neither do. huh.
22:31mpanwhat's a convenient way to invert the control flow of quil? I have an app that needs to occasionally ask to redraw things, but otherwise the drawing should stay the same
22:32mpanrather, when the world changes, the sketch should be updated to reflect it
22:34mpanthe world is expected to stay unchanged for seconds at a time, then experience short bursts of frequent changes
22:57djwonkI'm looking for pointers on how to debug syntax error. I'm using Emacs and lein. `lein repl` barfs a big stack trace. I don't even know what file to start with. Any suggestions? Things to read?
22:58djwonkException in thread "main" java.lang.NullPointerException, compiling:(core.clj:5)
22:58mpanhttps://www.refheap.com/paste paste the relevant source if possible
22:58RaynesPaste the stacktrace too, because believe it or not there is useful information in it.
22:59RaynesThe stacktrace is probably more important than the source.
22:59mpanwait, to clarify, do you get this when you're running your code, or just from starting up the repl?
23:00mpanI may have misread
23:00RaynesFrom starting up the repl, which sounds like there is unnecessarily AOT compilation going on somehwere.
23:00Raynessomewhere*
23:01djwonkthanks everybody. I get it when running `lein repl`. I think the first thing I'm going to do is split apart my load function. right now it has a long list of files to load
23:03djwonkhttps://www.refheap.com/paste/8116
23:05xeqiwhats line 5 of dm.core?
23:06tomojmuhoo: neat
23:06tomojthe bitcoin client isn't cljs, I assume? is it clj?
23:07djwonkxeqi: a long line of (load "…" "…" "…")
23:07djwonkit makes me wonder if the way load is written is useful when something goes wrong
23:08SgeoIf something goes wrong, the thing to do is usually regret Clojure being on the JVM
23:08Sgeo>.>
23:09djwonknow that I split (load "a" "b") into (load "a") (load "b") I'm getting a line number that I can work with
23:10RaynesWhy are you using load?
23:12djwonkRaynes: I want the same namespace in different files. I learned this from http://stackoverflow.com/questions/4690758/splitting-a-clojure-namespace-over-multiple-files
23:12djwonkturns out that `load`ing an empty file gave the java.lang.NullPointerException
23:13djwonkwhich seems like an edge case that no decent programmer would ever run into
23:14mpandjwonk: by any chance, would what overtone does be useful for your use case?
23:14mpanthey also move stuff into a unified namespace, although their motivations differ slightly, see https://github.com/overtone/overtone/blob/master/src/overtone/live.clj
23:14djwonkmpan: play cool sounds? sure :) I'll look at the code to see what you really mean
23:15mpanthey have a number of namespaces, and then they move everything into one namespace, but a major motivator for them is that they have two such namespaces which share a lot of code
23:15mpanbut it seemed like it might benefit your use case also
23:16djwonkmpan: that seems like a good option. I'm not experienced enough to know the pros/cons. My approach was working ok until I loaded an empty file
23:17mpandjwonk: I'm not sure about the details of the tradeoffs, but one point is that this way, you have individual namespaces which behave normally with regard to what names are accessible where, but you also have one place to access everything
23:19djwonkmpan: that sounds good to me. right now, I'm just prototyping a board game with a lot of moving parts -- not sure how to organize until I get an idea of how big it is, so I'm going with the (in-ns 'example.core) and (load "…") approach for now
23:19djwonkI'd rather not name all of the other namespaces quite yet until I have to pick names … but that said, I have to pick names for files, so it sounds like the same difference
23:20tufflaxIf I want to make util.clj that has all my favorite utils, what's the best way to make it available to all my projects? I heard someone talk about "user.clj" but I don't remember much of that
23:20djwonkthat didn't make sense. I'm trying to avoid "naming the band" until I get an idea of who is in the band :)
23:20tmciverdjwonk: without knowing what you're trying to achieve my advice to you would be to avoid loading code this way. In general, each file should be its own namespace and you should 'require' the namespaces you need in each file.
23:20tomojtufflax: just make it a library and put it in the dependencies of all your projects
23:21tufflaxtomoj: so I need to make a jar and upload it somewhere then?
23:21tomojthere are ways to make a dependency magically available to all your projects, but don't do that :)
23:21djwonktmciver: did you see the stackoverflow post, though? Clojure itself uses this technique, so is it fair to knock it?
23:21mpando most people have their own local maven repo or something?
23:21tomojtufflax: well you can just `lein install` in the project dir if you don't need other people to be able to get it
23:21tmciverdjwonk: Yeah, clojure does do weird things like that that you shouldn't copy. :)
23:22tufflaxtomoj: ok thanks
23:22tufflaxtomoj: hm what's the "local repository"?
23:23tomoj~/.m2/repository
23:23clojurebotexcusez-moi
23:24djwonktmciver: what would you say are the biggest drawbacks to the approach I've chosen relative to the overtone style that mpan mentioned?
23:25djwonktmciver: I would guess that using the convention of one file per namespace handles dependencies better
23:25tufflaxtomoj: ok thanks
23:26djwonkand allows, for example, a function used by several other namespaces to be loaded (only once) when needed
23:26tmciverdjwonk: well, in my experience it's just rather unorthodox. Besides, I'm not sure what that technique buys you. I think it's more natural to divide your namespaces up in a logical way. Often times I'll start a project with all my code in one file/namespace and then break it up over time in a way that seems natural.
23:27djwonktmciver: that's why I'm keeping everything in one namespace. I'm splitting across files just for ease of editing.
23:27djwonkmy plan is to settle into decent namespaces once it becomes clearer where things go
23:28tmciverdjwonk: yeah, that sounds fine. I've been using clojure for about two years now (and I'm still a noob!) and I don't think I've ever used load.
23:29djwonktmciver: thanks for sharing the orthodoxy. :) appreciated.
23:29tmciverdjwonk: that's just my opinion; I'm sure there are use cases out there that would warrant such a thing, I've just never run into them.
23:31ambrosebsarrdem: RE: Typed Clojure sets: do you want a type like (IPersistentSet Number), or more specific?
23:33djwonk,(doc use)
23:33clojurebot"([& args]); Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer."
23:37tmciverdjwonk: I believe the conventional wisdom of use these days is: "only use :use with :only".
23:37tmciverdjwonk: but I think people generally prefer :require over :use.
23:37tomoj"don't use :use. use :require with :refer"
23:37tmciveror use :require with :as
23:38tomojyeah, :refer if you insist :)
23:38djwonkhmmm. that isn't really sinking in but I'll write it down and see if it makes sense later. :)
23:38djwonkright now, I just want to pile everything into one namespace until it makes sense to divide it up
23:39mpanhow bad of an idea is it to make a new quil sketch every world update?
23:40tmciverdjwonk: yeah, that's fine. But if you start publishing code, I'd consider getting rid of those use's :)