#clojure logs

2011-04-05

02:42hirak8what's the best option for connecitng clojure to mongodb?
02:43hirak8i've found congomongo & karras among others
02:43hirak8but don't know which to use, if either
02:45hirak8seems like congomongo is most popular, but the main clojars package seems out of date. makes me concerned
02:45amalloyhirak8: congomongo has been fine for me
02:46hirak8amalloy: do you pull it from clojars or github?
02:46amalloyclojars
02:47hirak8k
02:47hirak8amalloy: do you happen to know if it supports sharding & replica sets?
02:48amalloyno idea. i use it for pretty basic storage. indexing is as complicated as i've gotten
02:48hirak8k
03:06amalloyanyone surprised that ##(doc inc) has x as a param, but calls it num in the docstring?
03:06sexpbot⟹ "([x]); Returns a number one greater than num."
03:13TobiasRaedermorning
03:14no_mindwhat is the most suitable datastrucute/datatype for creating a cache
03:15amalloyhashmap
03:15amalloyhi TobiasRaeder
03:15no_mindamalloy: but cache needs mutability. A cache will become dirty and needs to be refreshed
03:16amalloyno_mind: (a) that depends entirely on what you're caching; (b) so what? wrap it in an atom or a ref and you're all set
03:37ejacksonMorning all
03:38raekmornin
03:44cemerickfeh, good night :-P
03:44cemerick:-)
03:46ejacksoncemerick: are you just getting up, or just going to bed ?
03:46cemerickejackson: the latter
03:46ejacksonhave mercy ! I hope it was some cracking code :)
03:47ejacksonlol I know that feeling. Or the feeling that I *wish* I'd gone to bed two hours ago....
03:47cemerickIt's been a crazy month or two.
03:48ejacksonknow that feeling
03:48ejacksoni've got a client on my hands who fails to understand that I can only implement the spec he gives me, errors and all
04:10w0tan_i'm learning functional programming via SICP. how much of that should be valid in clojure? basic vocab aside
04:10AWizzArdYou can apply those principles to Clojure.
04:11amalloyw0tan_: sicp is great, and translates pretty well. some of the later examples use set! all over the place, and those don't translate so well
04:11amalloy(is what i've been told, anyway. i never got that far through the book *ashamed*)
04:13w0tan_heh, i'm sure i'm nowhere near that point anyway
04:13w0tan_good to know, though. thanks
04:15ejacksonw0tan_: the other thing to watch out for is that you don't come across Clojures sequence functions which are massively powerful.
04:15xkbhi
04:15xkbI'm looking for a good example of a with-something macro, the kind that wraps a call and provides it with extra parameters
04:15xkbdo you know any good examples?
04:16xkblike for example with-auth or with-user or something like that
04:17ejacksonbut its a fantastic place to start
04:17ejacksonxkb... I wrote a simple once last week.... one second
04:17ejacksonhttps://gist.github.com/897978
04:18ejacksonthat binds *connection* dynamically for use is wrapped functions
04:18ejacksonmost basic example
04:18xkbejackson: thanks, I'll check it out
04:18xkbseems like most of these macro's rebind a var to some global
04:18amalloyxkb: also https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/transform.clj#L31
04:18amalloywhich is not doing any var binding, just a let
04:19xkbI'm working on a Last.FM api wrapper
04:19xkbwhere some of the calls are oauth based and others arent
04:24xkbamalloy: thanks for the link!
04:24xkbgotta love github :)
05:10pyrhi
05:10pyrI forget what the idiom is to do the equivalent of apply on a member function
05:11pyr(on a java instance method i mean)
05:17amalloypyr: don't?
05:18DantasHi everyone !!! One noob question: To create a lazy-seq the function could not be optimized to use tail call : (defn list-generator [base increment coll] (lazy-seq (list-generator (+ increment base) increment (cons base coll))))
05:18Dantasi try to generate this list-generator with tail call and the lazy doesn't works
05:18Dantas:(
05:19pyramalloy: i mean
05:19pyri can (apply str [some seq elements])
05:19Dantass / try / tried
05:19pyrbut I can't (.someMethod object [list of elements])
05:19pyrbut I can't (apply .someMethod object [list of elements])
05:19pyrsorry
05:20amalloypyr: indeed. java objects don't know about clojure seqs, so this makes sense. there are a few ways to do something *like* it
05:20amalloybut they mostly involve reflection or, if the class method supports varargs, mucking with java arrays
05:20pyrmeh
05:20pyrok
05:24amalloyor you could do something like (defn variadic-add-method ([obj] (.add obj)) ([obj x] (.add obj x)) ([obj x y] (.add obj x y))) ... (apply variadic-add-method my-obj [some args])
05:25angermanhm. next coding gig will likely involve cakephp.
05:26pyramalloy: yeah i get the point
05:26pyrthx
05:27amalloypyr: yeah. in short, it's kinda gross. but it occurs to me you could easily write a macro version of variadic-foo-method
05:27amalloywhich would expand into a version of foo taking up to N arguments
05:33pyramalloy: that's what i concluded, meaning it's a wrong path :)
05:33pyri'll do it another way
05:33amalloygood idea :)
05:58nachtalp-hmm... where did clojure.org go? %)
05:59ejacksonnowhere ?
06:02nachtalp-ejackson: i get redirected to some register.com site...
06:03fliebelme to
06:03Fossimuhaha
06:03Fossiseems somebody forgot to renew...
06:03ejacksoni do not.
06:03fliebelejackson: What if you refresh your dns cache?
06:03nachtalp-Fossi: guess so :)
06:03ejacksonwhy would I want to break clojure.org :)
06:04ejacksoni like it
06:04fliebel:)
06:04Fossigood they have a grace period
06:04Fossinothing worse than having your domain snatched from under your ass
06:12fliebel??? (isa? (reify actor (act [this world] this)) actor) => false
06:14fliebeluh? oh… (instance? begame.object.actor (reify actor (act [this world] this))) => true
06:15fliebelSo do I have to use the interface rather than the protocol to check for a relationship?
06:18joodiedoes anyone know of a clojure library containing string "formatting" predicates, like numeric / email / url that sort of thing?
06:30DantasHi everyone !!! One noob question: To create a lazy-seq the function could not be tail called ? : (defn list-generator [base increment coll] (lazy-seq (list-generator (+ increment base) increment (cons base coll))))
06:31joodieDantas: yes. The tail call in a lazy seq lazy-seq.
06:31joodie*is* lazy-seq
06:32Dantasjoodie: so cant be tail call ?
06:32Dantasjoodie: right
06:33joodiethe point of lazy-seq is that it typically wraps *around* where you'd normally put your tail call.
06:33joodienote that lazy-seq isn't a function.
06:48xkbwhats the emacs keybinding for clojure aware autocomplete again?
06:48xkbso not meta-/
06:51danbellwhen I have swank running, C-C tab
06:51xkbdoes that also work in clojure-mode?
06:51danbellyou mean w/just normal core symbols?
06:51danbellnot sure
06:52xkbah it does
06:52xkbthanks
06:52danbellcool
06:52xkbseems meta-tab has the same binding
06:52danbellI noticed it's C-C tab when I'm editing a .clj file
06:53danbellmeta-tab when I'm in the repl
07:36Chousuke_eh, clojure.org seems to have expired :|
07:36joodiehttp://clojure.org/ works for me
07:37Chousuke_I get a generic squatter page thingy.
07:37joodiehmmm
07:37Fossiyeah
07:37markskilbecklikewise
07:38joodiewierd. maybe someone's messing with the DNS.
07:38Fossino, it went into autorenew
07:38bartjlikewise
07:40joodie74.54.82.222 ?
07:40bartjhttp://www.whois.net/whois/clojure.org
07:41bartjExpiration Date:03-Apr-2012 14:24:30 UTC
07:41Chousuke_Last Updated On:05-Apr-2011 09:34:35 UTC this one is more interesting
07:42Chousuke_so yeah, it probably expired today and that service grabbed it automatically.
07:42joodieah. now it has switched to 75.126.104.177 for me to
07:42joodietoo
07:42clgvclojure.org looks fine right now - but 1.2.1 is missing on downloads page still ;)
07:42joodiegrrr
07:43ttmrichterDoesn't look fine from here.
07:43ttmrichterLooks like a squatter.
07:43Chousuke_clgv: your dns is probably not updated yet. :/
07:43clgv ping clojure.org
07:43clgvPING clojure.org (75.126.104.177) 56(84) bytes of data.
07:43clgv64 bytes from wikispaces.com (75.126.104.177): icmp_req=1 ttl=51 time=131 ms
07:45ttmrichterPING clojure.org (74.54.82.222) 56(84) bytes of data.
07:45ttmrichter64 bytes from CAPAHOJE.COM (74.54.82.222): icmp_seq=1 ttl=43 time=267 ms
07:45Chousukeclgv: yeah, that's the old ip, but it seems it expired this morning.
07:46ChousukeI hope rhickey can get it back :/
07:47clgvlol first signs of IP4 address shortage?
07:48Chousukenah, just someone forgetting to renew the domain :P
07:48clgvtststs ;)
07:49fliebelWhat would be the most zen way to align 2 maps when iterating? So that {:foo 1 :baz 2} {:foo 3 :bar 4 :baz 1} gets me :foo, 1, 3 first, and then :baz, 1, 2, in some form.
07:50Chousukehmmh
07:50AWizzArdfliebel: you could combine the (vals of-your-maps) into a set and map over that.
07:50AWizzArdThat fn would lookup all vals and combine those too.
07:51Chousukethat would lose the key information though
07:51AWizzArdah, not vals but keys I mean
07:52AWizzArdIn general: if this is not an operation you don't need to do often, then don't care much about maximum efficiency. Just write some code that can do it and continue with other tasks.
07:52ChousukeIf it is an operation you need to do often, consider finding another data structure. P
07:53fliebelsomething like (map (juxt identity (partial get m1) (partial get m2)) (intersection (keys m1) (keys m2))
07:53Chousuke(partial get m1) = m1
07:54fliebelih, right, IFn
07:59fliebelHm, why doesn't keys return a set?
07:59fliebelokay, I know...
08:05fliebelChousuke: re data structure: any suggestions?
08:07Chousukehard to say, since I don't know what else you do with it :)
08:09fliebelChousuke: I iterate over it, do collision detection with it, retrieve items by key, align the keys so I can transition from one to the other. So, quite a lot.
08:09Chousukehmm, you might be able to use a sorted map though
08:09Chousukethat way you can at least get a seq of items in key order
08:10fliebelChousuke: I don't care about key order much. With a sorted map, two asymmetric maps still don't align.
08:11AWizzArdfliebel: why do you have two maps m1 and m2 in the first place?
08:11AWizzArdA potentially suitable data structure might be a MultiMap
08:11pdkby collision detection
08:11pdkare we talking in the physics sense or detecting collisions in the map
08:11AWizzArdYou can easily simulate one.
08:12Chousukefliebel: Maybe you could even use finger trees? (no idea if you can, but they seem pretty flexible.)
08:13fliebelAWizzArd: They represent frames, and in between frames, I generate more frames that smooth the transition. So I can get away with running the game logic a few times per second and still have smooth movement.
08:13fliebelpdk: physics, the values of my map have an java.awt.Rectangle.
08:14fliebelChousuke: That would be awesome.
08:15Chousukefliebel: Maybe you can find a suitable measure that will help you determine if a branch in the finger tree needs to be considered for collision detection, or something.
08:17Fossifliebel: i'd really look into literature
08:17Fossithere's a ton of specialised data structures for this
08:18Fossimight not be immutable though
08:18fliebelChousuke: Right now I sort my map values by the x of the objects and limit the collision detection to the y axis. I had a priority map to do this a while back.
08:19Fossibut i guess you could at least look into wings 3d or the like whether they have some clever things
08:21fliebelFossi: Okay, I could study CS and come up with an awesome data structure. But since this is only a 2D game, and not big-data, I'd rather use something that does the job and move on.
08:22fliebelBut it;s interesting to do nonetheless. I built a quad tree, and then decided it is not what I want.
08:23fliebelChousuke: I think that would be an R-tree. Every branch has a rectangle that contains all its children, if your node is in there, go down.
08:23AWizzArdIf you do extreme concurrent updates, then locking will do as well as what Clojure already does. If no concurrent updates are required, then a single thread working on a mutable data structure is even faster.
08:23fliebelhttp://en.wikipedia.org/wiki/R-tree
08:24Fossihmm, so this is 2d anyway?
08:25fliebelyes
08:26Fossii guess that makes things a tad easier :)
08:26_fogus_Anyone want to help me proof a draft of a blog post that I want to post today?
08:27fliebel_fogus_: Proof? As in checking grammar? I'd like to, but I think you'd better ask a native.
08:28_fogus_fliebel: Well, a set of eyes will help tremendously
08:29_fogus_http://ietherpad.com/jUpl9dXraQ Please add comments to the document directly. :-)
08:33kephale00Isn't one of the primary tasks of a programmer to write new functions for specific tasks? What these people you are addressing call "bloat" stems from the fact that there are indeed many functions that are frequently reused.
08:37ejackson_fogus_: I'm game if you're still needing a hand.
08:37_fogus_ejackson: Indeed.
08:37ejacksonshoot
08:38_fogus_ejackson: http://ietherpad.com/jUpl9dXraQ
08:40joodieI don't see the problem with "bloat". Even Common Lisp isn't halve as large as the JRE.
08:41ejacksondo you mind if I just put in suggestions ? I'll assume if you disagree you can just pull them out
08:41joodieBloat's only important when you can't *find* the function you're looking for.
08:41joodieWe're not living in the early 80s anymore.
08:42joodiebesides, "clean" != "small"
08:44joodiesince we're asking for feedback anyway: does anyone have comments on https://github.com/joodie/pretzel ?
08:44kephale00Well, the counter argument is that some people haven't upgraded their brain's RAM, so remembering too many functions is an issue for them.
08:44joodieand those people use what language? C without the std lib?
08:44kephale00as fogus notes, Scheme
08:45joodiescheme isn't that small either
08:45fliebelI thought scheme was about 90 functions or so?
08:45kephale00i dont remember off-hand
08:47chouserkephale00: I think that's closer to the source of the consternation
08:48chouseror at least a useful question: *why* do people complain about the "size" of CL (and now Clojure?)
08:49chouserdo they just hate these languages and will throw anything at them hoping something will stick?
08:49kephale00How many people actually are complaining about the size of these languages? The vast majority of active programming languages are growing in size at some rate.
08:49kephale00chouser: i think the last point is more on target
08:50kephale00Well, i have to admit that i don't have numbers to back up that statement, but from what i've seen at least most languages seem to be growing
08:50chouseror do they want to like the language, but find themselves frustrated by something, and (falsely?) identify the source of the problem as the "size"?
08:51chouserkephale00: It's probably fair -- what software is shrinking? :-)
08:51kephale00BTW, whats the deal with swank-clojure? I saw technomancy talking about it last night, but my dependencies on 1.3.0 are having issues
08:52fliebelchouser: What I know for myself, is that it was just the task of finding a function that gets you from x to y.
08:53fliebelWhen you don't know half clojure/core yet, it can be hard a times to find the correct function.
08:53chouserfliebel: fair enough. For me, I found reading Common Lisp code nearly overwhelming, and haven't yet pinned down all the reasons.
08:54fliebelSo I'd say size is not the problem, organization and documentation is.
08:54kephale00chouser: well there are some oddities with CL just because of historical artifacts in the language
08:55chouserBut probably included were: unfamiliarity with parens, no visual distinction between flow-control forms and regular functions, no visual distinction between words defined by the language vs. the user (compounded by the ability to use first and define later)
08:56chouserand honestly, complete lack of type declarations probably doesn't help either.
08:57chouserit adds up to a whole lot of unfamiliar-looking code, and very few hints about how to start breaking it apart so it can be understood.
08:58kephale00chouser: WRT type declarations… people don't seem to complain about that much in Python
08:58chouserkephale00: true, but many of those other hints are provided. Flow control looks very different (except perhaps for list comprehension)
08:59joodiekephale00: I think that's because clojure attracts more Java programmers
08:59ttmrichterchouser: You've hit my historical reason for not liking Lisps there. There's nothing in the code to catch my eye to alert me to "syntactical" elements, etc. It's hard for me to break apart CL and/or Scheme code as a result. It looks like a morass of words, not like structured code.
08:59TimMcttmrichter: I think a lot of that has to do with the terseness, the semantic density.
09:00chouseralso, foo.bar.baz gives you some "context" for understanding (or guessing) what baz means, in a way that (baz (bar foo)) doesn't really.
09:00_fogus_http://blog.fogus.me/2011/04/05/_-count-common-lisp-count-clojure/ Thanks all!
09:00TimMcI'm used to skimming Java at high speed, picking up for loops and such, and I have to slow down for Lisps.
09:00kephale00Sorry to toss this in the middle of the discussion, but: [WARNING] POM for 'swank-clojure:swank-clojure:pom:1.3.0:compile' is invalid. It will be ignored for artifact resolution. Reason: Not a v4.0.0 POM.
09:00ttmrichterTimMc: In terms of semantic density I'll pit Haskell against Lisp any time.
09:00TimMcHaha, true.
09:00ttmrichterBut I don't get this "morass of words without differentiation" vibe from Haskell.
09:01TimMcInteresting.
09:01joodiemorass of punctuation, though :)
09:01chouserClojure does help a little, I think. Square brackets for bindings are a nice little hint.
09:01joodieI'm not really kidding.
09:02ttmrichterjoodie: True. :)
09:02ttmrichterBut avoiding the pointless style helps in avoiding the more egregious overuse of punctuation.
09:02Fossiactually i have the same problem with haskell when i pick it up
09:02chouserA very small standard library could help, but of course that has costs that _fogus_ has eloquently described.
09:02kephale00ttmrichter: well if you're going to rag on Haskell for punctuation then APL needs to be brought up
09:03ttmrichterPart of what attracts me to Clojure -- the first "real" Lisp (and the second Lisp) to do so -- is that there's a small smattering of actual syntax in the language.
09:03Fossibecause you have to know that the type Webapplication is something like Request -> Response and a whole load of monads
09:03ttmrichter() and [] have meanings and can thus catch my eye when reading code, as a simple example.
09:03_fogus_EEEPPP! http://clojure.org/
09:03Fossibut i guess that's also just not knowing the libraries
09:03ttmrichterSome Lisps let me use (), [] and {} at will, but there's no semantic difference between these at all.
09:04TimMc_fogus_: WTF
09:04kephale00_fogus_: whoa
09:04chouser_fogus_: yeah, oops. get someone on that, if it's not too late
09:04kephale00i wonder if this has anything to do with my dependencies breaking...
09:04ttmrichterClojure adds some and this shapes my ability to read Clojure code.
09:04fliebel(inc clojure.org-discussions) => 3
09:05clgv$dec fliebel
09:05sexpbot⟹ -1
09:05clgv;)
09:05ttmrichterIn ways I could never read CL or Scheme when I gave them a shot.
09:05ttmrichterjoodie: I know you're not kidding. There is a certain breed of Haskell programmer (long may they rot in Hell!) who thinks it's somehow meaningful to make "operators" like {{{__^^)))()))))))())}.
09:05fliebelclgv: :( Now I feel negative
09:05clgv$inc fliebel
09:05sexpbot⟹ 0
09:05clgvbetter?
09:05fliebelyea
09:06ttmrichterFossi: That's a different level of problem.
09:06ttmrichterThat's just not knowing the domain the code is embedded in.
09:06clgvhumm university DNS seems to have cached clojure.org still
09:06ttmrichterMy problem with Lisps, Fossi, is that I can't even read SIMPLE code. I have to decode it. Every time.
09:07TimMcttmrichter: That's partly a lack of familiarity, I'd guess.
09:07Fossihmmm. dunno, most code in clojure i've seen is pretty application specific
09:07TimMcThere are a *lot* of functional idioms that I'm still getting used to.
09:07Fossiand if your indention style is sane it's better than java
09:08ttmrichterTimMc: Partially, yes. But I have honestly given CL and Scheme the old college try using my standard approach: do all personal projects in the language being targetted for three months at least.
09:08ttmrichterIt's not functional idioms that bug me.
09:08ttmrichterI do Haskell. I do Erlang.
09:08ttmrichterI just can't read Lisps. I have to decode them.
09:08TimMchuh
09:09ttmrichterTake two reasonably complex functions: one in a Lisp (but not Clojure as much) and one in Erlang.
09:09ttmrichterI'll be able to skim the Erlang code without much effort, picking out the key things I need to understand in depth.
09:09clgvlol the guy linked in fogus' post from Loper OS recommend Mathematica? :P
09:09ttmrichterThe Lisp code I'll have to read every word in-depth to decode.
09:09ttmrichterIt's probably a mental defect on my part. :)
09:10chouserttmrichter: are you having any more success with Clojure than with Scheme or CL?
09:11ttmrichterHell yes.
09:11dnolenclgv: rhickey recommends Mathematica as well.
09:11chouserI hadn't tried Scheme, but had tried CL a couple times and never gotten any traction.
09:11ttmrichterI *LIKE* Clojure.
09:11ttmrichterWhereas in the past I've admired Lisps intensely but didn't like them.
09:12chouserttmrichter: very interesting.
09:12ttmrichterLisps are insanely elegant (minus some historical cruft, of course).
09:12kephale00does lein check clojure.org for dependencies?
09:12clgvdnolen: for real? for what purposes? I'd only recommend Mathematica for symbolic algebra and other tightly math realted tasks
09:12dnolenttmrichter: I used to think similar things about the readability of Lisps, until I read a lot of Scheme. The shape of the code does have meaning.
09:12ttmrichterBut I've never warmed up to them (Dylan aside) until Clojure.
09:13ttmrichterdnolen: I've done Scheme. Had the same problem.
09:13dnolenttmrichter: but did you *read* a lot of Scheme.
09:14dnolenas in not your own code.
09:14kephale00gagh.. it does… i guess a custom leiningen until clojure.org comes back up is in order
09:15ttmrichterdnolen: I always do. For Scheme I always tried to read library implementations. I think I was using Gambit at the time?
09:15ttmrichterSomething like that.
09:15Fossikephale00: so leiningen depends on clojure.org being up?
09:15Fossithat's pretty bad
09:15kephale00Fossi: yeah it does, and yeah it is pretty bad
09:16kephale00[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '2819a4be8ef8de2268f8d5a91d62cee0026ab531'; remote = '<html>
09:16kephale00<head>
09:16kephale00<meta' - IGNORING
09:16kephale00[WARNING] POM for 'swank-clojure:swank-clojure:pom:1.2.0:compile' is invalid. It will be ignored for artifact resolution. Reason: Not a v4.0.0 POM.
09:16kephale00it looks like it is picking up HTML pages in dependency checks
09:16Fossigood i didn't start of with a clean deps today :/
09:16ttmrichterThat's a bit embarrassing having the main web site down and camped.
09:16ttmrichterWhere by "embarrassing" I mean "infuriating".
09:16Fossiit's only the providers page
09:17Fossiso, they are the good guys
09:17ttmrichterSo, find out where these guys are and for a round-trip airline ticket I'll commit an untraceable assassination. :)
09:17kephale00lol
09:17Fossibasically without them the domain would be up for registration right now
09:17devndomains are taken care of
09:17Fossiand that would get snaged in a minute :)
09:18devnFYI
09:18ttmrichterI think they're in Portugal.
09:18ttmrichterI'd love to take a trip to Portugal in springtime. :D
09:19chouseryay. That was a lot less painful than I feared.
09:20devnchouser: lol yeah, a little scary
09:21chouserI didn't realize it was the original registrar's page.
09:21devnchouser: yeah i thought a squatter had snagged it
09:22ttmrichterAh, if it's not a squatter that's fine.
09:22ttmrichterI thought it was a squatter.
09:22ttmrichterDamn! No trip to Portugal. :(
09:22kephale00fine is a relative term here… : P
09:24dnolenttmrichter: I actually meant like papers - where readability and convention is more important. Libraries not necessarily the best place. I see now that Clojure source follows good Lisp style.
09:26ttmrichterReading papers isn't helpful if I have to read real-world code -- mine and others -- day in and day out while working.
09:26ttmrichterSyntax by convention isn't, to my mind, a viable approach to making things work out.
09:26ttmrichterI have similar issues with real-world languages, incidentally.
09:27ttmrichterEnglish grammar is a nightmare of wasted, "useless" words like "a" and "the" and half the prepositions.
09:27dnolenttmrichter: heh, papers often have a lot of good real world code.
09:27ttmrichterChinese is far simpler as a grammar.
09:27ttmrichterI submit that Chinese is harder to learn BECAUSE it has fewer structural words.
09:28ttmrichterEven though Chinese is far more regular a language than English could ever hope to be.
09:28TimMcttmrichter: Redundancy plays a big role in readability.
09:28devnchinese is hard. trust me on that. :)
09:28ttmrichterI don't have to trust you on it devn. I'm living the nightmare. ;)
09:28TimMcThat's why we have initial capital letters in our sentences.
09:28ttmrichterA quick "/whois ttmrichter" can explain why I said that, devn. ;)
09:29ttmrichterTimMc: Redundancy and structure signifiers.
09:30ttmrichterWords like the articles have no real useful purpose -- but they announce the beginning of a noun phrase.
09:30ttmrichterIt's obvious we don't need articles, given the huge number of languages that don't have them.
09:31ttmrichterBut they stick around in Indo-European languages because they do serve a signalling purpose. They provide some structure you can hang your thoughts on, basically, while you're trying to comprehend what someone's saying.
09:31TimMcttmrichter: Your /whois was unenlightening.
09:31ttmrichterTimMc: Hmm... It used to have the domain name. You'll have to do a whois on the IP now it seems.
09:31clgvttmrichter: articles carry information in languages like german and french
09:31ttmrichterOne thing I've noticed with my students (Chinese): if they say something (in English or Chinese) that I don't quite catch, they start over right from the beginning.
09:32TimMchah
09:32ttmrichterclgv: In German and French they carry "gender" (which is utterly useless grammatically) and in German they also signal case (which is not so useless, but confusing when mixed with gender).
09:32fliebelisa? instance? extends? How do I tell if a record implements a protocol?
09:33clgvttmrichter: why is information about gender useless?
09:33fliebelclgv: For 'things' that is, like, a tree is female.
09:34ttmrichterGerman: a man is masculine, a woman is feminine, a boy is masculine, a girl is ... neuter? The f...?
09:35ttmrichterGrammatical gender is pointless.
09:35ttmrichterBeing able to identify gender isn't the same thing as grammatical gender.
09:37lucianttmrichter: i disagree
09:37fliebelCan someone *please* explain me what the difference is between all these type-telling functions?
09:38lucianttmrichter: most latin languages have "configurable" redundancy. you can drop things like pronouns if they're obvious
09:38TimMcfliebel: Maybe once clojure.org is back.
09:38ttmrichterlucian: How does this make grammatical gender useful?
09:38fliebelTimMc: What has clojure.org to do with it?
09:38ttmrichterHow does marking a tree as feminine (I think) communicate anything of use whatsoever?
09:38TimMcfliebel: It's down currently, and I wanted to visit the protocols page. :-)
09:39lucianttmrichter: not a tree, but persons
09:39lucianttmrichter: for the tree it's only a little useful
09:42fliebelTimMc: Oh, right… *checks his cache*
09:44ttmrichterlucian: You are confusing grammatical gender and having gender-identifying pronouns.
09:44ttmrichter(Although strictly speaking even the latter are optional.)
09:44lucianttmrichter: no, i'm not. english is very crap at this, which is likely why you don't realise the difference
09:44fliebelhah! Works for me… They mention extends? as the right thing, but then I need to to (extands? record (class obj))
09:45ttmrichterlucian, I am amply familiar both with German and with French.
09:45lucianin most latin languages verbs, adjectives, nouns, pronouns, etc. most signify gender and number
09:45ttmrichterAnd passingly familiar with Chinese the hard way.
09:45lucianttmrichter: right, good
09:45TimMcfliebel: extends? is the one
09:45ttmrichterAnd, despite this familiarity, I still think that grammatical gender is pointless.
09:45lucianttmrichter: french is a bit the odd one out, sadly. there's less optional than in portuguese or romanian
09:46ttmrichterBECAUSE it extends to "things".
09:46lucianttmrichter: it's great for disambiguation
09:46lucianeven for things
09:46ttmrichterWhere you get ridiculous things like feminine trees but masculine windows. (Or was it the other way around?)
09:46lucianwhen i say 'want "this female" and "that male"' while pointing, in romanian it's very likely that whoever is next to me knows exactly what i'm saying
09:47ttmrichterThere's no ambiguity in distinguishing a tree from a window.
09:47ttmrichterWhat, precisely, does grammatical gender add?
09:47lucianttmrichter: redundancy
09:47lucianand very cheaply
09:47ttmrichterYou cut the prospective nouns by 50%.
09:47ttmrichterAnd what happens when you want to talk about a doctor?
09:47lucianactually 66%
09:47ttmrichterIn German a doctor is masculine, if memory serves.
09:48ttmrichterBut the doctor I'm talking about is female.
09:48luciani'm not familiar with german
09:48ttmrichterSuddenly I'm using grammatical masculine and feminine pronouns.
09:48lucianthere's a similar phenomenon in french, yes
09:48ttmrichterThis doesn't help, it confuses.
09:48lucianbut you say 'madame le docteour'
09:49lucianit doesn't confuse natives :)
09:49ttmrichterOf course it doesn't.
09:49lucianbut yes, in this case 'le' doesn't help
09:49lucianbut the 'madame' bit helps
09:49ttmrichterJust like the tonal system in Chinese doesn't confuse the Chinese.
09:49ttmrichterMuch.
09:49lucianand when when you say 'elle', it's clear
09:49lucianbah, the tonal system is dreadful
09:49clgvit's profession nouns that are almost all male except the ones that are historically typical female jobs ;)
09:49nachtalp-ttmrichter: german words for both
09:50nachtalp-has words, even :)
09:50ttmrichterHell, the Chinese aren't confused despite the fact that the third-person pronoun is THE SAME (in spoken Chinese) for he, she and it.
09:50ttmrichterIt's amazing what the human brain can internalize.
09:50lucianttmrichter: because they stuff the redundancy somewhere else
09:50ttmrichterWell, they don't actually. They just repeat a whole lot more context in cases of misunderstanding.
09:51lucianhungarians have the same issue, but they repeat "female" or "male" a lot
09:51lucianttmrichter: EXACTLY
09:51lucianmore redundancy somewhere else
09:51ttmrichterThe Chinese language is, to me, like a Lisp, complete with that pudding-like feel. :)
09:51ttmrichterThere are very few linguistic cues in structure.
09:51ttmrichterWhich makes it hard to learn if you've learnt anything else first.
09:52lucianttmrichter: if lisp were case and font-sensitive, i might agree :)
09:52no_mindif I define a symbol in a namespace dynamically (generated by code), will it be possible to access the defined symbol later from that namespace ?
09:52waxroseLisp is the first language I actually understood.
09:52waxroseScheme to be more accurate.
09:55clgvno_mind: you have to intern it for that purpose ##(doc intern)
09:55sexpbotjava.lang.SecurityException: You tripped the alarm! intern is bad!
09:55clgv$source intern
09:56sexpbotintern is http://is.gd/ILW2Di
09:56waxroseI think most people that are turned off by a Lisp either lack a mathematical background or struggle reading text inside out. :3
09:57clgvwaxrose: yeah the inside-out isn't natural for europeans or americans, since we read from left to right ...
10:00thorwilperhaps too many people make the mistake of expecting to be able to make at least some sense of lisp code, before even reading an explanation of the basics
10:00waxroseThat too
10:01ttmrichterOr, perhaps, but this is probably just crazy talk, not every approach suits every person?
10:02ttmrichterSome people are verging very strongly on stereotypical "Smug Lisp Weenie" talk here. This is something that has been refreshingly absent from the Clojure community in the past. It might be nicest if it stayed that way.
10:02thorwilttmrichter: sure, but often approaches are rejected without understanding. which can be reasonable, regarding investment
10:03ttmrichterThe problem is that this starts to become the assumption followed by the conventional wisdom followed by the perceived truth.
10:03ttmrichterThen we get Eric Naggum.
10:07chouserthorwil: I think that is the key. There are far too many programming langauges for it to be useful to learn them all.
10:07chouserSo you have to reject learning some of them without knowing them well enough to be 100% sure for yourself that they ought to be rejected
10:08thorwilprogramming languages are not pokemons!
10:08chouserAny conversation trying to convince someone to learn a language (or discussion about someone who has chosen not to) really ought to respect this fact.
10:08waxrosechouser, Great book btw... got mine yesterday. :P
10:08chouserwaxrose: ah great, thanks!
10:10waxrosechouser, np :)
10:12ttmrichterthorwil: They're not?!
10:12ttmrichterDamn, I've been doing this wrong!
10:12gtrakclojure, I choose you!
10:12ttmrichters/language/languages/
10:12sexpbot<ttmrichter> has a USB stick with about 35 different languages on it last count.
10:13gtrakimmutable concurrency attack is super effective
10:13ttmrichterchouser: You're the author of which book?
10:13ttmrichterIf it's The Joy of Clojure, I've got that near the top of my reading queue right now.
10:14clgvttmrichter: look up the names on its cover ;)
10:14ttmrichterI choose my languages based on what problem I'm trying to solve.
10:14ttmrichterI wouldn't want to write an embedded control system in Clojure for example. :D
10:15gtrakyea, real-time and GC just don't go well together
10:15thorwilttmrichter: that's what i want to do, too. though it's not easy to even get there, where you really understand the strengths and weaknesses
10:15ttmrichterOK, that was mildly unnerving, sexpbot.
10:16ttmrichterI'm assuming sexpbot is the 'bot that people use here to do Clojure code snippets?
10:16waxroseyar
10:16Raynessexpbot or clojurebot. Either one works.
10:16ttmrichterCover?
10:17RaynesI prefer sexpbot, but I'm biased. ;)
10:17waxroseHow's Meet Clojure doing? :P
10:17Rayneswaxrose: Smoothly.
10:17ttmrichterclgv: Oh, never mind.
10:17ttmrichterI wasn't thinking on the right thread there.
10:17waxrosegreat
10:17ttmrichterAh. Chris Houser.
10:17ttmrichterGot it.
10:17clgv^^
10:18ttmrichterWell, I have that book (e-form) solely on the recommendation of a drooling fanboi. :)
10:18ttmrichterHe basically said it's the best way to learn idiomatic Clojure thinking.
10:18ttmrichterSo I got it sight unseen (something I don't usually do).
10:19waxrosettmrichter, I'm not allowed to fully read it till I finish Practical & Programming Clojure first. :/
10:19ttmrichterNow in my Copious Free Time&trade; I have to explore it.
10:21ttmrichterThere's no "Learn You An Clojure" or something like that?
10:21ttmrichterI thought that's what all the cool kids did these days. :)
10:21TimMcwaxrose: Learning to read programs from the bottom up is also a stumbling block for beginners.
10:21Raynesttmrichter: I'm writing something along those lines.
10:21TimMcI like to joke that lispies pick up a book and immediately read the ending, then work backwards through the plot. :-)
10:22RaynesTimMc: Sounds like something Factor programmers would do.
10:22waxroseTimMc, Good point... and lol @ reading it backwards
10:22clgvttmrichter: I am still not formatting in an idiomatic to simplify reading and understanding for myself ;)
10:23RaynesFactor programmers would work from beginning to end, but read each chapter from end to beginning.
10:23clgvs/idiomatic/idiomatic way/
10:23sexpbot<clgv> ttmrichter: I am still not formatting in an idiomatic way to simplify reading and understanding for myself ;)
10:23ttmrichterOK, Chapter 1 is reading very nicely.
10:24thorwili wonder if that feature is a blessing
10:24thorwils/blessing/curse/
10:24sexpbot<thorwil> i wonder if that feature is a curse
10:24ttmrichterwaxrose: I've got enough experience in picking up languages that I'll just dive into Joy. (That and I've already read Programming. I leave the decision as to which factor is more important as an exercise.;))
10:24RaynesI'm wondering why that feature has been around for around 7 months and everybody is just now noticing it all at once.
10:25ttmrichterRaynes: Fads.
10:25ttmrichterSomeone semi-influential noticed Factor and now it's everybody's toy.
10:25chouserthorwil: I generally precede my s///'s with a space
10:25chouserRaynes: no offense intended. :-)
10:26ttmrichterMe, I looked at Factor and said, "Cool! Someone made a Forth for the 21st century!"
10:26Rayneschouser: That's actually what I told people to do. I'd totally disable it if it really bothered anybody. It isn't a huge deal. I do the same thing for title scraping.
10:26ttmrichterchouser: Your first chapter bodes well for the book.
10:27RaynesIt's one of those things that some people really like and others really hate.
10:27chouserttmrichter: thanks! I hope you enjoy it.
10:27ttmrichterWell, given the drooling fanboism of the guy who recommended it to me (I really respect his opinions on these matters), I rather think I will.
10:27chouserI was pleased to see the printed book takes up no more space on a shelf than Halloway's
10:28chouserWe really didn't want to create a tome, but seemed frequently in danger of it.
10:28ttmrichterI may have to get a hard copy of it actually.
10:28mefestochouser: congrats on the book, just received my copy last friday :)
10:28ttmrichterI'm just switching jobs to a Java shop and it may be time to ... subvert. :D
10:29waxrosettmrichter, I will go crazy if I don't read every available book on the subject even if it's outdated. Maybe I suffer from OCD? :3
10:29ttmrichterwaxrose: You're a programmer. You'd BETTER have OCD!
10:31waxroselol
10:31waxrosehaha
10:32ttmrichterThere's a simple test to see if you've got OCD or not.
10:32ttmrichterJust answer one simple question: does "anal retentive" properly have a hyphen or not?
10:32joodie-
10:32joodie:)
10:33waxroseSorry, I stopped reading after the an...
10:33ttmrichterjoodie: That was the wrong ansewr.
10:33ttmrichters/ansewr/answer/
10:33sexpbot<ttmrichter> joodie: That was the wrong answer.
10:33ttmrichterThe correct answer is "nobody cares!"
10:39ttmrichterI'm a little confused by 1.2.3, chouser. How can "code is data" be difficult to grasp for anybody who's ever used an assembler?
10:39ttmrichterOr Forth, for that matter. :)
10:39TimMcttmrichter: A great diagnostic image for OCD: http://gallery.burrowowl.net/index.php?q=/image/23547.png
10:39ttmrichterIs just going to it proof that you've got it?
10:39TimMcNaw, your reaction is diagnostic.
10:40TimMcBasically, whether or not the image enrages you. :-)
10:41chouserttmrichter: what percentage of our readers have used assembler, do you think?
10:41ttmrichterOK, I'm probably projecting, yeah.
10:41ttmrichterI started with and still fall back to assembler.
10:41TimMcIt's not "code is data" in the same way, though.
10:41ttmrichterI mean Hell, I'm trying to relive my youth so I'm writing a cross-assembler for Interdata 16-bit machines so I can program an emulated one. :D
10:42ttmrichterWell, no, of course it isn't TimMc. It's a higher-level abstraction of what the Von Neumann architecture posits.
10:42waxroseI have yet to have a course on assembler. :/
10:42ttmrichterBut the NOTION of code and data being one and the same shouldn't be alien.
10:43ttmrichterJust some of the implications specific to Lisp's implementation of the concept are going to be weird.
10:43RaynesTimMc: That image is agonizing.
10:43ttmrichterBut the same applies to pretty much any homoiconic language, which includes the Forths and the Prologs.
10:43TimMcRaynes: :-D
10:43ttmrichterThat pencil on the left pisses me off. The rest are fine.
10:43waxroseTimMc, That makes me slightly annoyed. :3
10:44TimMcwaxrose: Same here.
10:44waxrosemostly because of the "2 HB" on some pencils and some with out.
10:45TimMcttmrichter: Are you asserting that assembly/machine code is homoiconic?
10:45ttmrichterNo, but Prolog and Forth are.
10:46waxroseSpeaking of Neumann... I bought Knuth's AoCP vol 4a yesterday... my brain already hurts
10:46chouserI think the brain's tendency to pattern-match without being asked can complicate the understanding of a homoiconic language the first time.
10:47chouserOr perhaps it's weaknesses in English when trying to explain it, I'm not sure.
10:47ttmrichterchouser: Yeah, that could be a problem. It's a problem that's so far in my past now that I can't recall it, probably.
10:47clgvwaxrose: lol. you don't love his assembler? ;) I hate it as well, that he didn't just use mathematical pseudocode ...
10:47ttmrichterI do know that self-modifying machine language hurt my brain when I first hit it, but it probably prepared me for homoiconic languages.
10:48waxroseclgv, lol...He's quite a character to say the least
10:49clgvwaxrose: I still didn't read his books because of it ;)
10:52nickikim reading Interduction to Alorithems and that allready kills me. AoCP is just crazy but if you start reading now you will know a lot about compilerwriting in 2050.
10:52waxroselol
11:01choffsteincemerick: any idea why I might be getting "ava.lang.ClassNotFoundException: com.amazonaws.ClientConfiguration (rummage.clj:9)" when I am trying to compile a project using rummage?
11:13joodiechoffstein: did you do a "lein deps" first?
11:13choffsteinjoodie: yeah, but I can't seem to download the aws-java files. So I just grabbed 1.1.5 from the maven repo and installed it myself
11:13choffsteinwhich worked before
11:13choffsteinand doesn't seem to work now...
11:13joodiehmmmm
11:14choffsteinfor some reason, the internet connection I am on in my office can't pull the aws jars ... but can pull everything else
11:14choffsteinand I don't feel like going home just to pull that jar file
11:19joodiethen I don't know what's going on
11:24kephale00oh yeah
11:25kephale00watch out for lein deps today
11:25kephale00until clojure.org come back lein deps will break things for you
11:26kephale00comes back*
11:27kephale00choffstein: not saying anything, just tagging you so you get a notification if thats part of your irc prog
11:29choffsteinalright. thanks :)
11:36ttmrichterkephale00: Clojure.org is back for me already.
11:36RaynesIt depends on your ISP, of course.
11:37ttmrichterBut it's a sign that things are being returned to normalcy soon.
11:37kephale00yes
11:37kephale00my day is not lost!
11:37kephale00but i am still waiting for it to come back up here
11:37kephale00err… to resolve correctly i should say
11:38TimMcDNS propagation?
11:39kephale00mmm
11:39TimMcFOr me, dig retrieves 75.126.104.177 which gets me to wikispaces.com, but my browser still gets the register.com page.
11:40kephale00presumably there are some DNS caches that need to be refreshed somewhere in the pipeline
11:40waxroseclojure.org is down? Hasn't gone down for me all morning. O_o
11:41Fossithat ip shows the wikispace page for me as well
11:41Fossiand is what i'm getting from dig
11:41Fossibut just clojure.org works again
11:42kephale00bah… my dig still gives me ;; AUTHORITY SECTION:
11:42kephale00clojure.org. 74187 IN NS ns1.expireddomains.register.com.
11:42kephale00clojure.org. 74187 IN NS ns2.expireddomains.register.com.
11:42TimMcAha, my proxy is caching it.
11:42TimMcI proxy most of Firefox's connections through a school server.
11:43TimMckephale00: I wonder if there's a way to request fresh data.
11:45kephale00TimMc: I think I'll just wait it out. I lost enough time regrabbing dependencies from machines that I hadn't tried to do a refresh on.
11:58choffsteinAnyone using sandbar that could answer a flash question for me?
11:59choffsteinNamely, I am trying to use hiccup to build my pages and I want to integrate my flash messages, but flash-get always seems to return nil.
12:04fliebelCan I Type-hint records?
12:05fliebelehm ,protocols
12:08choffsteinI am trying to send a string "comma,separated,values" as part of a query string to my RESTful API. When I post it, however, my API gets it in as "comma%2Cseparated%2Cvalues", which my API can't parse
12:08choffsteinare there any libraries to automatically convert the encoding?
12:10choffsteinAhhh...java URLDecoder
12:10TimMcchoffstein: I see ring.util.codec/url-decode
12:10choffsteinAhhhh....even better :D
12:15dnolenfliebel: you can type-hints fields to a defrecord/type, you can't type hint args to protocol method.
12:16fliebeldnolen: Oh, okay. Weird.
12:18ttmrichterIt is rare for a computing book to require my looking up a non-computing term in a dictionary....
12:19ttmrichterAnd now I want to pun about Haskell programming and Maenadic approaches.
12:19Raynesttmrichter: You haven't seen anything yet. Wait until cemerick's book is out.
12:22ejacksoni'm embarrased to have to ask....
12:22ejacksonbut how do I do this:
12:22ejackson(repeatedly 20 (fn [] nil))
12:22ejacksonlike a sane person
12:23amalloyejackson: (repeat 20 nil)?
12:23ejacksongenius !
12:23ejacksonthank you noble sir
12:24amalloyejackson: see also ##(doc constantly)
12:24sexpbot⟹ "([x]); Returns a function that takes any number of arguments and returns x."
12:24TimMcejackson: clojuredocs.org has a good "related functions" feature: http://clojuredocs.org/clojure_core/clojure.core/repeat
12:24ttmrichterRaynes: What's cemerick's book?
12:24ejacksongroovy
12:25ejacksonThe Kickass of Clojure
12:25Raynesttmrichter: Clojure Programming. While being a walking dictionary, he isn't much for naming things.
12:26amalloyttmrichter: see if you can work in a joke about how dryads make the driest maenad jokes
12:26TeXnomancyat least it's not called Programming Clojure
12:26ejacksonyes, but its within commutation.
12:27ejacksoni'll never keep those straight
12:28ejacksonspeaking of this Raynes.... I had o thought about your title. I know I've used the idea before, but: (meet clojure)
12:29Raynesejackson: Meet Clojure has grown on me significantly.
12:29ejacksonoh oh... so does foot fungus, if unchecked ;)
12:30ejacksonjust kidding, just kidding.
12:30Raynes:>
12:31ttmrichterOK, which is Clojure Programming? Is that the old Pragmatic book?
12:31ejacksonYeah, Stuart Halloways
12:31ttmrichterNo, that's Programming Clojure. My bad.
12:31ejacksoni knew what you meant :)
12:33ttmrichterAnd what is Meet Clojure? Another book? A web site?
12:33ejacksonthat is Raynes' book in production
12:35ejacksongiven that chouser was paid in cookies there are many enthusiastic authors out there... :p
12:35ttmrichterWarts too, ejackson.
12:35ttmrichterAnd cancer.
12:36ejacksonI doubt even a book publisher would pay their authors in warts.
12:37ejacksonnow, the recording industry, well maybe.
12:37fliebel?? When I add a type hint to the arg of a type, it gives me IllegalArgumentException: Can't find matching method: foo, leave off hints for auto match.
12:38ejacksonwrong type ?
12:38fliebelDoing the exact same hint in hte places where it's used, it works fine.
12:39TimMcfliebel: Gist some example code?
12:39fliebelTimMc: I'll distill something.
12:46no_mindis there a way to check if a given symbol exists in a namespace ?
12:47TeXnomancy(doc resolve)
12:47TeXnomancy,(doc resolve)
12:47fliebelTimMc: https://gist.github.com/903973
12:48no_mindTeXnomancy: resolve throws an exception if symbol does not exist. I am looing for a neater way
12:48TeXnomancyns-resolve looks to be safer, though it will throw if the ns doesn't exist.
12:50no_mindTeXnomancy: ns-exists for sure
12:50cemerickchoffstein: the AWS jar isn't on your compilation classpath. It's baffling to me that you continue to have dependency issues there. :-(
12:51choffsteincemerick: it's only when I am at my office. it's crazy.
12:51cemerickttmrichter, Raynes: I think you'll find that our book is going to be mostly lacking in esoterica.
12:51choffsteincemerick: but not when I am at home.
12:51cemerickchoffstein: That is quite the crazy network issue.
12:51choffsteinI know
12:52cemerickBut, it makes me feel a little better that it's isolated.
12:52cemerickchoffstein: maybe your office's network blocks any url with "amazon" in it?
12:52TimMcThat would be nuts.
12:52cemerickbad browsing filters gone amok, etc
12:52choffsteinnah, I'm on AWS right now ;)
12:52ejacksoncemerick: what's the focus/theme/flavour gonna be ?
12:52cemerickoh well :-)
12:53TimMcfliebel: Interesting. I've never worked with reify, but that is odd behavior.
12:53cemerickchoffstein: it'd be interesting to see a tcpdump of you attempting to pull dependencies from the office.
12:53TimMcI verified that it does indeed use reflection there.
12:54fliebelTimMc: Yea, weird, eh?
12:55fliebelMaybe cemerick or ejackson know… https://gist.github.com/903973 < type hint blows
12:55ejacksonfliebel: lemme have a look.... don't hold your breath :)
12:55TimMcClojure doesn't complain when I put ^String in the protocol's definition instead, interestingly -- but it still ends up using reflection.
12:56TimMcfliebel: Hold someone else's. :-P
12:56ejacksondo you have to typehint the protocol definition perhaps ?
12:56ejacksonjust guessing here
12:56TimMcejackson: I tried that.
12:56fliebelTimMc: Yea, the protocol hint just gets ignored.
12:56ejackson:)
12:56cemerickejackson: oriented towards engaged Java devs and those that use popular dynamic languages like Ruby and Python. It's also something of a duplex book; part is purely language-related, part is purely domain-specific.
12:56fliebelPutting the hint on the substring s works.
12:57cemericks/purely/mostly
12:57sexpbot<cemerick> ejackson: oriented towards engaged Java devs and those that use popular dynamic languages like Ruby and Python. It's also something of a duplex book; part is mostly language-related, part is mostly domain-specific.
12:57ejacksoncemerick: that tremendous. It was a double whammy for me coming from the ruby world to have to learn lisp and the java ecosystem in one bite.
12:58cemerickejackson: Yeah, we're hoping to take the sting out of that process a bit, though it's not in the drafts at all yet.
12:58TimMcIndeed. Most Clojure guides I've seen assume a Java background.
12:58TimMcIt makes Clojure seem like an auxiliary language rather than its own thing.
12:59RaynesTimMc: Mine doesn't! :D
12:59TimMcYay!
13:00cemerickTimMc: well, in a lot of ways, it's not. Clojure without the JVM or its libraries (or, those of *some* host) wouldn't be even a tenth as useful or popular.
13:01cemericki.e. go throw together a genius of a language with its own runtime, and see how the crickets sing
13:01TimMcfair
13:01ejacksonits true. coming from ruby where the runtime is a dog, having the JVM is magic.
13:01dnolenfliebel: like I said earlier protocol fns cannot be type hinted.
13:02kephale00speaking of Clojure off of the JVM, has anyone been playing with the CLR version
13:02cemerickThat's why ClojureScript – when it's revisited and fully-baked – will be a revelation.
13:02fliebeldnolen: I know, but you said their implementations cant;right?
13:02fliebel*can, right?
13:03dnolenfliebel: no, you can't type hint defprotocol, nor implementations.
13:03TimMcSo, that does "leave off hints for auto match" mean then?
13:03TimMc*what
13:03dnolenif you need to hint something you need to hint the symbol, or hint in a let binding as usual.
13:04TimMcDoes it mean that type hints interfere with connecting up implementations with specifications?
13:04cemerickkephale00: there are a couple of people on the ML that are using it -- I can't say I've ever seen much chatter about it in the channel.
13:04dnolenTimMc: the type hint stuff is for definterface as far as I can tell.
13:05kephale00aha
13:06no_mindtechnomancy: ns-reolve works but I have another problem. I need to check for a symbol which is the value of a var
13:07TimMcdnolen: I think I understand, thanks.
13:12dnolenTimMc: fliebel: an example, https://gist.github.com/904024
13:13fliebeldnolen: Cool, so when I do a record, it also does this?
13:14dnolenfliebel: if you are implementing an interface yes you can do that. but interfaces are about methods, methods are not first class.
13:14dnolenprotocols create functions.
13:15fliebelright, so unless I need Java interop, no type hints on records
13:32Rayneshttp://www.clojure-conj.org/ Now accepting talk submissions.
13:32Raynescemerick: Quick, convince me to submit a talk before I get stage fright.
13:34cemerickRaynes: do it now so you can beat yourself into a robust public speaker. Life sucks just a little more if one is afraid of / not good at public speaking.
13:34cemerickNot that I'm good at it, just a lot better than I used to be.
13:34Raynescemerick: Me and amalloy were talking about talks a while back. I actually do have one idea that I might propose. The second one will be tricksy.
13:35Raynesamalloy and I* inb4grammarnatzi
13:35amalloynicely done, sir
13:36RaynesI only wish they'd allow for a joint talk with amalloy and I both, that way I could hoist him up on my shoulders and we could talk in unison.
13:36amalloysounds way too creepy for me
13:38cemerickI think there should be an author's roundtable at the start of the conj, so that everyone can throw their rotten fruit at their least favorites in the beginning and get it over with. :-D
13:49ejacksonthis conj sounds better-and-better all the time :)
13:50redingercemerick: Please send that proposal and a list of all the authors I need to get on board. :)
13:50redingerRaynes: You could certainly do a joint talk with amalloy. Up to you if you really need to hoist him up
13:50cemerickredinger: Ha! They're all going to stand in a line, with me in front with a big umbrella. ;-)
13:51amalloyhaha
13:52ejacksonhmmm.... I'll see if I can come up with anything interesting to propose saying
13:52cemerickejackson: will you be making the trip?
13:52ejacksonthat is a function of money :)
13:53ejacksoni maintain my optimism, though, and hope to make it.
13:53cemerickThat'd be stellar. :-)
13:53ejacksonthank you, yes it would be awesome.
13:54cemerickAll of the eurozone Clojure folks should pool in for a netjets (or whatever) booking. Might actually be cheaper than commercial tickets if there's enough people interested.
13:54ejacksonI freaking love it
13:56ejacksoncemerick: do you have Dutch ancestry ?
13:56cemerickejackson: German, Russian, French, Native American
13:58cemerickAlong with some North African if that kooky "heritage" genetic test was worth anything.
13:59ejacksonhmmm...
14:33fliebelcemerick: What is that airplane pooling you proposed? I'd love a java.util.concurrent.AirplanePoolExecutor. http://airplanepoolexecutor.eu/ is still free :)
14:34fliebel(fly! AirplanePoolExecutor conj fliebel)
14:35cemerickfliebel: netjets is the one that comes to mind, though IIRC they're fundamentally U.S.-based.
14:39ejacksoncemerick: no they operate here too
14:39ejacksonbut I don't think I can afford to even ask what they charge
14:40cemerickejackson: A friend of mine whose company used them for a brief period said that it was definitely cheaper than commercial tickets as long as you maximized capacity.
14:41ejacksonWell then ! I shall investigate :)
14:41cemerickIf that actually happens though, I want to be on the tarmac to see lpetit, cgrand, fliebel, and ejackson stepping off the jetway. :-P
14:41fliebelIn that case I love the idea. If I can find out more, I could set up a simple registration/pledge service on http://airplanepoolexecutor.eu/ :P
14:42ejacksonlol - that would be rather magical
14:43ejacksoni suspect fliebel is in for an icy shower.
14:46fliebelejackson: puh, we'll see :)
14:46RaynesI took icy showers for the majority of the summer before last in an attempt to raise my cold tolerance.
14:47ejacksonRaynes: in preparation for .... ?
14:47RaynesWinter?
14:47RaynesNothing in particular.
14:47fliebelAh, some numbers finally… http://answers.yahoo.com/question/index?qid=20071210142517AAkga0Y
14:47ejackson:) I like your stiyle.
14:48fliebelAny europeans with a pilot license? :D
14:48ejacksoncemerick: see what madness you have wrought !
14:50cemerickejackson: gawd, that almost sounds plausible. 6 hrs * $2k / 10 people maybe?
14:51cemerickIt'll probably get nuked by it being functionally two one-way trips (at least as far as the charter company is concerned).
14:53technomancyif we're seeing checksum mismatches downloading a pom from maven central... is that the kind of thing that deserves a bug report?
14:54ejacksoncemerick: ok, I just called NetJets to figure it out. They won't tell me immediately, but are preparing a quote
14:54cemerickejackson: ha, this is great
14:54fliebelejackson: cool!
14:54cemericktechnomancy: yeah, that's no good
14:55ejacksonmy wife's face was a study...
14:55TimMcI totally need to make it to the Conj.
14:56TimMcI'm going to see about taking Amtrak down.
14:58TimMcUh... is the conj free?
14:58ejacksonpish - cemerick will fly you in his jet.
14:59Raynescemerick: As of the 2010 census, the population is listed as 130 here in Eldridge now. :o
14:59TimMcI understand the organizers are "still putting the finishing touches on the logistical details", but it would be nice to know the order of magnitude of the cost of attending.
14:59cemerickRaynes: not a lot for people to stay for, I guess? :-(
15:00ejackson130 !
15:00cemerickTimMc: last year was, what, $200 each?
15:00amalloyTimMc: probably about the same as last year
15:00TimMcMaybe my company will spring for it. :-P
15:01technomancyjust confirmed the checksum mismatch in straight maven. it's (ironically) on bouncycastle
15:01cemericktechnomancy: of all things! :-O
15:02amalloytechnomancy: genius
15:02fliebeloh, dang, documentation… *goes of writing* ejackson, let me know when you get the quote.
15:03ejacksonfliebel: you got it.
15:03fliebelhuh, I got the quote?
15:03amalloyfliebel: american idioms tricking you again, sounds like
15:03TimMcfliebel: No, you'll get it. :-)
15:04amalloy"you got it": "okay, i'll do what you just said"
15:04fliebelI guess so… can;t we do the conj in Europe next time :P
15:04Fossi+1 ;D
15:05raekI need to make it to the conj too
15:05raekin Europe would be nice...
15:05Fossiif it weren't such a pain to organise such a thing :/
15:06fliebelFossi: I never tried it. What is the pain?
15:07RaynesFossi: Wrong.
15:07Raynes(inc fliebel)
15:07sexpbot⟹ 1
15:07amalloyRaynes: only if you think he was +1 ing fliebel, rather than the idea of a euroconj
15:08Raynesraek: Man, Europe would require a passport and all sorts of nasty things, like a really long flight. You aren't worth it.
15:08Fossii totally wouldn't want to +1 fliebel
15:08Raynes(dec euroconj) ; cause I'm selfish
15:08Fossifliebel: mostly getting a location i guess, and then some
15:09Fossilike talks/topics, food, etc pp
15:09RaynesI was almost hoping for a California conj this year. Would have given me an excuse to go to California.
15:10gtrak(inc inc)
15:10sexpbot⟹ 1
15:10ejacksona caliconj
15:11amalloyRaynes: you need excuses? california is great, qed
15:11Fossii've just been to the European Lisp Symposium, which was great, but that's because it was in town :)
15:11TimMcIn Europe, everything is in town.
15:11Fossimore like, literally
15:11Raynesamalloy: I need a significant reason to spend money to travel to California.
15:12TimMcWhere was the last conj held?
15:12amalloycome rob a bank
15:12amalloyTimMc: same location
15:12Fossi:D
15:12TimMcOh right... Rich lives in NC, yeah?
15:12Fossibest reason ever to go anywhere
15:12Fossi"come here, rob a bank"
15:12Fossii can even see it in television ads
15:13amalloyFossi: it worked for vegas. "come here, steal us silly, we're bad gamblers"
15:13Fossidid it?
15:13Fossiamericans must be dumber than i thought on average
15:14Fossiall people i know from vegas are really good gamblers/poker players
15:14cemerickTimMc: Rich lives outside of NYC
15:14TimMcWho lives in NC then!
15:14cemerickMost of Relevance.
15:14TimMcaha
15:18amalloyFossi: i don't think the residents are especially good gamblers; the point is that the casinos have a clear edge
15:19Fossiwell, there are quite some people living in vegas making a living off bad poker players
15:19amalloysure
15:19Fossibut yeah, that's more or less the only game where that's the case
15:19Fossiand there's more money in the others
15:32fliebelCan I put docstuff on records? The docstuff of defrecord does not mention it.
15:33kotarakRecords are classes not Vars.
15:34fliebelkotarak: But they implement IObj
15:34kotarakfliebel: the instances
15:35fliebeltrue
15:36kotarakfliebel: functions now also contain metadata (including the docstrings), but you can't type (doc MyRecord).
15:36kotarakfliebel: maybe some kind of javadoc might emerge sometime...
15:36fliebel:)
15:36fliebelI'll start writing /** doc */ above my record and see what happens.
15:39raekfliebel: you can put docstuff on protocols, though
15:39fliebelraek: I know, but thanks :)
15:48gigamonk`Hmmm, is there a design philosophy that leads 'get' to return nil if its first argument is not a map?
15:48amalloygigamonkey: clojure hates exceptions
15:49gtrakgigamonkey, also it doesn't use {}
15:49amalloy&(get {:a 1} :b) ; same reason as this, i think
15:49sexpbot⟹ nil
15:49gtrakor (), rather, nil is preferred over the empty set
15:50gigamonkeyamalloy: well, there's a distinction one could draw--if one wished--between looking for a key that's not present in a map and looking for a key in something that is not a map.
15:50amalloygigamonkey: fwiw, you can make it return something other than nil if you prefer, though i don't think you can easily distinguish between not-found and not-a-map using just get - ##(get 10 :k "Wait what?")
15:50sexpbot⟹ "Wait what?"
15:51hiredman_gigamonkey: get is not map? if you want to test for the mappiness of a thing, get is not the tool to do it
15:51amalloygigamonkey: feel free to draw that distinction yourself before calling get
15:51hiredman_,(doc map?)
15:51hiredman_,(doc get)
15:51hiredman_clojurebot: ping?
15:52amalloyor, if you want an exception, you could call the "maybe-map-thing" as a function: ##(10 :k)
15:52sexpbotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
15:52gigamonkeyhiredman_: sure. And I can see the convenience of its behavior. On the other hand it makes it harder to catch inadvertant type errors.
15:52amalloy&({:k :v} :k)
15:52sexpbot⟹ :v
15:52hiredman_gigamonkey: then go use scala, please /part the channel on your way out
15:52gigamonkeyE.g. (get :foo {:foo 10}) => nil
15:53amalloygigamonkey: wut. that's not a type error
15:53amalloyis it? maybe it is. i never use get
15:53amalloy&(get :foo {:foo 10})
15:53sexpbot⟹ nil
15:53gigamonkeyamalloy: well, it is if you meant to say (get {:foo 10} :foo)
15:53amalloygigamonkey: i rarely need to actually use get
15:54amalloyi just write ##(:foo {:foo 10})
15:54sexpbot⟹ 10
15:54hiredman_https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L620
15:54gigamonkeyamalloy: well, the same thing happens with (:foo whatever) since it turns into a call got get, presumably.
15:54cemerickhiredman_: in a channel-purging mood, I take it?
15:54amalloygigamonkey: yes, but you won't get the parameters out of order this way
15:54gigamonkeyhiredman_: this isn't about static vs dynamic typing. It's about API design. You can make everything mean *something* bat that's not always the best policy.
15:55gigamonkeys/bat/but/
15:55sexpbot<gigamonkey> hiredman_: this isn't about static vs dynamic typing. It's about API design. You can make everything mean *something* but that's not always the best policy.
15:55amalloywhich is what you objected to in the (get :foo m) case
15:55hiredman_cemerick: I smell common lisp
15:55gigamonkeyheh. Didn't know that would trigger the bot.
15:55cemerickhiredman_: Good enough. This is a polyglot boarding house.
15:56amalloygigamonkey: pop quiz: do you find the execution of your s/foo/bar thing to be a desirable feature or annoying?
15:57fliebelIs this grammatically valid? "Returns a seq of pairs. Every pair is a set of keys whose objects' Rectangles intersect"
15:57gigamonkeyamalloy: seems a little silly to me. But kind of cute.
15:57hiredman_cemerick: common lispers have an annoying habbit of complaining that clojure isn't common lisp
15:58amalloyfliebel: definitely okay grammatically. not sure i follow the actual meaning, specifically "every pair is a set of keys"
15:58cemerickhiredman_: And some people who like python complain that sexprs don't look like python. In neither case is it reason to wave someone away.
15:58fliebelamalloy: I'm open to better explanations. It returns somwthing like [#{:a :b}] which means :a and :b are colliding.
15:58hiredman_cemerick: if that is all they do, and they do it very vocally, I think it is
15:59gigamonkeyhiredman_: and some folks just want to understand the difference. Certainly Lisps other than Common Lisp have a tradition of typechecking arguments dynamically.
15:59gigamonkeyThus my question about whether there was a design philosophy that lead to the (slightly surprising) choice in the 'get' API.
16:00cemerickhiredman_: Well, gigamonkey isn't anywhere near being a troll, or a disturbance. Inviting a /part is just rude.
16:00amalloyfliebel: i'd say "returns a seq of sets. each set contains two objects whose rectangles intersect"
16:00amalloysaying that a pair "is a set" reads confusingly, to me
16:00fliebelamalloy: Not objects, they keys corresponding to the objects.
16:01thorwilfliebel: that "whose" makes me uneasy. how about "Returns a seq of pairs. Every pair is a set of keys belonging to intersecting rectangles (/rectangle objects)"
16:01dnolengigamonkey: get is actually more generic in it's behavior than just applying to maps, it should
16:01dnolenthe docstring should probably updated
16:01dnoleninternally the runtime refers to coll, not map as the first arg.
16:01gigamonkeydnolen: so what else can it fruitfully be applied to?
16:02amalloygigamonkey: anything that implements ILookup
16:02amalloybuiltins include maps, sets, and vectors
16:02dnoleninstance of Map, array, string, objects that implement ILookUp, IPersistentSet
16:02amalloy&(get [1 5 8] 2)
16:02sexpbot⟹ 8
16:03fliebelthorwil: The problem is that there are keys to look up an object and the objects have a Rectangle.
16:04dnolengigamonkey: in your own code if you wish to enforce maps, preconditions are definitely worth looking into, just redefine get.
16:05dnolengigamonkey: define your own get in your own namespace I mean.
16:05gigamonkeyI guess another question I could have asked is: is it considered good or poor form to take advantage of the fact that get (or :keywords as functions) will happily return nil if passed a non-map?
16:05fliebel"Returns a seq of sets. Every set contains two keys of objects that have intersecting Rectangles."
16:06amalloyfliebel: sounds okay to me. it seems a little awkward to be passing around keys to objects instead of the objects themselves, but that's part of your API (though it influences the docs)
16:06gigamonkeyI was looking at some code that walked a tree of maps calling (:type node) as it went. I was wondering what was going to happen when it hit the leaves which were not maps.
16:06gigamonkeySo in this case it was handy, if a bit surprising to me, that it worked that way.
16:07gigamonkeySpeaking of which, could one use :foo as a dispatch function in a multi-method?
16:07fliebelamalloy: Objects "change", keys don't, so only keys are a reliable way to tell which object you're colliding with.
16:07amalloygigamonkey: yes, for sure
16:08amalloygigamonkey: also, you've just made me realize that some code i wrote yesterday could have made use of the get-works-on-non-maps feature
16:08gigamonkeyamalloy: great, I've unleashed a monster! ;-)
16:08amalloyprobably not worth the extra documentation it would need, though
16:09fliebelI always assume everything works on everything unless proven otherwise. I'm still disappointed you can't dissoc a vector.
16:09dnolengigamonkey: seems like fairly reasonable to think that get will always return nil based on what's going on the Java source if not given a type which it can handle. but perhaps something to bring up on the ML and get some more informed opinions.
16:11gigamonkeydnolen: I'd say the docs should at least say what types it accepts as arguments. If it's all types, that's fine but they should say so.
16:12gigamonkey(Is the clojure type system a latice and if so what's at the top?)
16:12dnolengigamonkey: sure, like I said worth bringing up on the ML.
16:12amalloygigamonkey: lattices don't necessarily have a top; that would be a tree
16:12amalloyhowever, it is in fact a tree, and the top is Object, since it's hosted on java
16:13gigamonkeyamalloy: and all primitives are boxed?
16:13amalloygigamonkey: ish
16:13dnolengigamonkey: clojure interface and their relationships are quite slick, tho not well documented beyond Java source.
16:13dnolengigamonkey: 1.3 allows unboxed primitives to flow in and out of functions.
16:14amalloyreal-java has primitives, and clojure can use them, but we're fairly limited in how. 1.3 will improve the situation but it still won't make primitives as first-class
16:15dnolengigamonkey: Clojure version of structs, defrecord/type, can have unboxed primitive fields. you can have unboxed arrays of primitives.
16:15ataggartand unboxed vectors
16:16dnolengigamonkey: 1.3 also ensures that float literals are treated as unboxed double, and integer literals as unboxed long.
17:59gigamonkeyUh, did clojure.org just go down or expire or something?
17:59gigamonkeyI'm getting a big fat register.com ad.
17:59jlalooks fine to me
17:59opqdonut_works for me
18:00opqdonut_Last Updated On:05-Apr-2011 13:09:16 UTC
18:00opqdonut_Expiration Date:03-Apr-2013 14:24:30 UTC
18:00opqdonut_sez whois
18:00gigamonkeyWeird.
18:00kephale00its been down all day
18:00kephale00i still don't have it
18:00kephale00some folks have it cached
18:01amalloygigamonkey: read the mailing list
18:01amalloythere was an issue this morning, dns is propagating
18:01jlanot cached, can do live searches
18:01gigamonkeyamalloy: what mailing list?
18:01kephale00hm
18:02clojurebothmm, maybe my repl is out of wack
18:02kephale00gotcha
18:02amalloy$google clojure google group
18:02sexpbotFirst out of 13300 results is: Clojure | Google Groups
18:02sexpbothttp://groups.google.com/group/clojure
18:02gigamonkeyHeh: "Discussions aren't available right now. We're sorry. Try again shortly."
18:03amalloythat's what happens when you use a startup like google to host your website
18:03amalloyfwiw they load fine for me
18:03amalloy(both the group page and clojure.org)
18:05gigamonkeySo I was going to clojure.org to try and find more information about the implementation of maps in Clojure. Anyone have any good pointers to whre I can read about the actual data structures used?
18:06amalloy$google higher order persistent vector clojure hash
18:06sexpbotFirst out of 253 results is: Clojure - data_structures
18:06sexpbothttp://clojure.org/data_structures
18:06amalloyhmph
18:06amalloygigamonkey: higher order is a blog someone (rich?) runs, with a good description of that topic
18:07technomancygigamonkey: http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/ <= for vectors
18:07technomancyI believe the others are taken from Okasaki?
18:14gigamonkeytechnomancy: yeah, I was hoping for some pointers into what things in particular to read about in Okasaki.
18:14gigamonkeyBut thanks for the link, that's a start.
18:23gigamonkeySo fn? returns false for keywords. Is there a predicate for things that implement IFn?
18:23brehautgigamonkey: ifn?
18:24gigamonkeyTada! Thanks.
18:24amalloybrehaut: too easy
18:24brehautamalloy: im all about the low hanging fruit
18:24seancorfield,(find-doc "ifn")
18:24clojurebot-------------------------
18:24clojurebotclojure.core/ifn?
18:24clojurebot([x])
18:24clojurebot Returns true if x implements IFn. Note that many data structures
18:24clojurebot (e.g. sets and maps) implement IFn
18:25gigamonkeyThough that's a pretty gross name.
18:25gigamonkeyHow about callable?
18:25brehautgigamonkey: because callable is different to IFn
18:25gigamonkeyI don't see it in the index.
18:25amalloygigamonkey: it's a java interface
18:26brehautgigamonkey: callable and runable are java interfaces, ifn is a clojure interface
18:26amalloygigamonkey: still: the power is yours! (def callable? ifn?) ; bam!
18:26seancorfieldit's fairly consistent with many of the other does x implement y function names :)
18:26seancorfield,(doc reversible?)
18:26clojurebot"([coll]); Returns true if coll implements Reversible"
18:27seancorfield,(doc sequential?)
18:27clojurebot"([coll]); Returns true if coll implements Sequential"
18:27gigamonkeyI guess I'm just wishing Clojure were not sitting on top of Java.
18:27seancorfieldetc...
18:27amalloygigamonkey: a misguided desire. it couldn't get nearly as popular that way
18:28gigamonkeyamalloy: sure. But I wrote a book about Common Lisp. I don't care about popular. ;-)
18:28technomancynow /me just wishes the JVM took unix seriously
18:28amalloyfine fine. couldn't have as many useful libraries available either
18:29amalloyit's very handy to just reach out and grab some java
18:30seancorfieldif clojure didn't run on the jvm, i wouldn't be using it (even tho' i like lisp)
18:31brehautseancorfield: probably because rich would still be writing the jit, gc, binary format, build tools, etc :P
18:31seancorfieldi can't use lisp in my day-to-day work - but i can anything that runs on the jvm
18:31seancorfieldi think it's great that we have so many languages targeting the jvm (for all its faults)
18:31seancorfieldi can mix clojure, scala, groovy, jruby, jython, cfml...
18:32devnwe're living in a polyglot world
18:32seancorfieldok, so i'm not actually using all of those... but i have the choice, and i like choice!
18:33devnchoice is great until you have so many of them you become paralyzed
18:33technomancyis jython still active?
18:33devni dont believe so
18:33devnerr i think microsoft killed iron____
18:33devnbut im not sure about jython
18:33jlausually wish that clojure didn't run on jvm. recently been programming python. now missing maven.
18:34technomancya former jython lead came to one of the early seajure meetings
18:34devntechnomancy: does seajure make its meeting available online
18:34brehautthe former jython (Jim Huginin) lead stopped working on jython to work on iron python i believe
18:34seancorfieldjython looks pretty active to me... 2.5.2 released a month ago... django 1.2.0b1 released too
18:34brehautand jython isnt dead
18:35technomancydevn: we don't have presentations, so that wouldn't really work
18:35technomancyunless you mean being able to SSH into the tmux session as it's happening... we could arrange something =)
18:35gigamonkeyDoes clojure have a construct you can use when you want a macro to expand into multiple top-level forms (e.g. multiple defn's or something)
18:35devnim trying to get a meetup group going here in Madison, WI -- we have so many folks to the south in Chicago and ive been doing the meetup group regardless
18:35devntechnomancy: actually... that sounds great.
18:35brehautjython has just always lagged behind cython and has (for some reason) got a lot of py community antipathy, so it gets a lot less attention than it really deserves
18:36brehautgigamonkey: (do (def …) (def …) …)
18:36technomancydevn: well without audio I'm not sure how interesting it would be. crowded coffee shops aren't the best recording/speakerphone environments.
18:36gigamonkeybrehaut: thanks.
18:36kotarakHow can I force a full gc?
18:37gigamonkeyHmmmm. I don't see 'do' in the API table of contents.
18:37devntechnomancy: what if I bankrolled a decent mic or something to help out in that department?
18:37amalloygigamonkey: it's a special form: ##(doc do)
18:37sexpbot⟹ "Special Form: Please see http://clojure.org/special_forms#do&quot;
18:37brehautkotarak: i think you can call System.gc() or something, but it only a hint?
18:38gigamonkeyYup. Just got there.
18:38kotarakIt seems that things are not released, where they should be. But I don't know whether this some gc or not.
18:38amalloygigamonkey: incidentally, aside from the valuable learning experience of doing this yourself once, you don't need to write a macro to expand into a do form yourself
18:38technomancydevn: sorry to backtrack on my claim; heh. I keep pretty busy running the show to add something like that, but you could post to the mailing list and see if someone could help you out there.
18:39devntechnomancy: no worries, i dont blame you -- it would not be easy, but even just looking at the screen sessions would be nice
18:40amalloyhttp://richhickey.github.com/clojure-contrib/test-is-api.html#clojure.contrib.test-is/do-template and https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/macro.clj#L26 both do that for you already
18:40technomancydevn: the code always goes on http://github.com/Seajure in its final form too
18:41gigamonkeyamalloy: actually I was thinking of generating different top-level forms, not looping like those seem to.
18:41gigamonkeyI want to define a defn and maybe a few defmethods.
18:41amalloygigamonkey: ah. for totally different forms, yes
18:43amalloywait, i don't get it. either you're using a macro only once, in which case either you're not saving any typing or you could use anon-macro; or you're defining a macro that expands into various things and then calling it more than once - in that case, macro-do would be useful
18:45gigamonkeyI want, say, (deffoo bar [baz quux]) to expand into a (defn new-bar ...) and a (defmethod something :bar ...) and a (defmethod somethingelse :bar ...)
18:46gigamonkeyOr rather, all those things wrapped in a 'do'
18:47Raynesgigamonkey: You're the Practical Lisp guy, aren't you? :o
18:47gigamonkeyRaynes: yes. Practical Common Lisp, to be absolutely precise.
18:47RaynesPleasure to meet you. <3
18:47gigamonkeyLikewise.
18:48RaynesWelcome to Clojureland.
18:49amalloygigamonkey: that's pure gold. Raynes is always annoyed with people saying lisp when they mean common lisp, and now the tables have turned
18:50Raynesamalloy: I actually thought the book was called Practical Lisp. It's been a long time since I looked at it.
18:50amalloyi know
19:12gigamonkeyHow do I tell a multimethod to use a specific hierarchy?
19:12gigamonkeyAh :hierarchy option
19:15gmaggiorhello. Sorry for newbie question. I'm using clojure on a ubuntu bash terminal, when I press up_arrow, left_arrow ,etc to edit the line strange characters appear. Is there a way to edit the clojure REPL command line?
19:16gigamonkeyWhat's wrong with this: (defmulti foo identity :hierarchy (derive (make-hierarchy) :foo :bar))
19:17gigamonkeyGives me: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IRef (NO_SOURCE_FILE:0)
19:18amalloygmaggior: raw console input doesn't provide such niceties. in the long run you'll be best off installing leiningen or cake, but your path of least resistance is to run rlwrap <whatever command you use for clojure> (apt-get install rlwrap if you don't have it)
19:19amalloygigamonkey: derive doesn't return the hierarchy object afaict
19:19gigamonkeyOkay, so how do I get it?
19:19gigamonkeyIt doesn't modify the hierarchy in place.
19:19amalloy,(doto (make-hierarchy) (derive ::a ::b))
19:19clojurebot{:parents {}, :descendants {}, :ancestors {}}
19:19amalloyhm
19:20gmaggiorThank you very much amalloy
19:21amalloygigamonkey: i lied. it does return the hierarchy
19:21amalloy$source defmulti
19:21sexpbotdefmulti is http://is.gd/wi5uPO
19:22amalloygigamonkey: defmulti is a macro; it isn't calling that code
19:22gigamonkeyAt any rate, this fails too: (defmulti baz identity :hierarchy (make-hierachy))
19:22gigamonkeyAh.
19:22amalloyyou need to pass it a literal symbol, obtained via an earlier make-hierarchy
19:22amalloyi guess
19:23gigamonkeyNo, that's not it.
19:23gmaggioramalloy, rlwrap clojure worked fine!
19:23gigamonkeyWhich I'm glad about because that would be terrible.
19:23amalloygigamonkey: inclined to agree
19:24amalloygigamonkey: i think it wants a map, not bare kv pairs
19:25gigamonkeyjava.lang.Exception: The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value)
19:25amalloyso i see. this is getting silly; i confess i don't define new hierarchies often (ever)
19:26amalloy(defmulti foo class :hierarchy (ref (make-hierarchy)))
19:27amalloyi can understand the design descision that led to requiring that to be a ref, but i don't especially like it
19:29amalloyand it certainly ought to be documented better
19:30amalloygigamonkey: ^, if you missed it. better?
19:31gigamonkeyamalloy: yup, that does the trick.
19:32gigamonkeyThat seems especially goofy since defmulti is a macro. If it needs a ref, why not take care of it itself.
19:32amalloygigamonkey: i suspect it's so that you can see the hierarchy developing yourself, or share it among multiple defmultis
19:32amalloywithout them each discovering their own version of the dependency tree
19:33gigamonkeyI don't understand what you just said but that's probably just me.
19:35amalloygigamonkey: i'm not sure it makes sense for keywords, but consider the hierarchy for java classes. if you have a method defined for, say, 20 different classes, then the first time that multimethod sees a class it's never seen before, it has to try isa? on all the defined dispatch values
19:35amalloywhen it finds a match, it updates the ref to reflect that (or could; i haven't read the source). if you have multiple defmultis all using the same hierarchy, it saves duplicated work to have them all use the same ref
19:37gigamonkeyOkay. So if I say (def h (ref (make-hierarchy))) is there a way for me to modify the hierarchy?
19:38amalloygigamonkey: (alter h derive ::a ::b)
19:39gigamonkey"No transaction running"
19:39amalloy(dosync (alter...))
19:39amalloyi usually use atoms rather than refs :P
19:39amalloy(not that you have a choice here)
19:40amalloybut you can do all your derivings in a functional way, and then just ref the final result, if you never want to change it thereafter
19:40gigamonkeyRight.
19:40amalloy,(-> (make-hierarchy) (derive ::a ::b) (derive ::c String) ref)
19:40clojurebotjava.lang.AssertionError: Assert failed: (instance? clojure.lang.Named parent)
19:40amalloy,(-> (make-hierarchy) (derive ::a ::b) (derive ::c ::a) ref)
19:40clojurebot#<Ref@f6fc62: {:parents {:sandbox/c #{:sandbox/a}, :sandbox/a #{:sandbox/b}}, :ancestors {:sandbox/c #{:sandbox/a :sandbox/b}, :sandbox/a #{:sandbox/b}}, :descendants {:sandbox/a #{:sandbox/c}, :sandbox/b #{:sandbox/a :sandbox/c}}}>
20:39ignacioanyone used lein-axis?
20:46picklesbit of a (probably n00b related) issue: I have three clojure scripts: A, B and C, all three in namespace x. B defines type-b (deftype), C uses type-b, A includes both B and C. I'm getting a "No matching method found" error from the attempted use in C.
20:50tomojyou probably shouldn't have three scripts in the same namespace. not that this answers your question..
20:51picklesmmm
20:52pickleswould you suggest one ns per script?
20:52picklesthey're all part of the same program
20:53tomojyeah, and namespaces should correspond to the filesystem, so (ns foo.bar.baz) should go in src/foo/bar/baz.clj
20:53picklesah, that might have something to do with it
20:53tomojalso, you shouldn't have any "single-segment namespaces", like (ns foo)
20:53picklesone of the files is in a different directory
20:54picklesmmm
20:54tomojwhen you say (use 'foo.bar) or, equivalently in the ns macro, (ns baz.bing (:use foo.bar)), clojure will look for foo/bar.clj on the classpath
20:54tomojif you have other files also in the foo.bar namespace, clojure won't find them, you'd have to load them yourself
20:55picklesmmk
20:55picklesi'll have to change one of the files
20:56picklesthe other is a "config" file which I'll still probably do a load-file with
20:57picklesthx tomoj, i'll have to poke around
20:57picklesand als ortfm
20:57pickles*also rtfm
20:58picklesanother quick question: the "read" function seems to be reading in symbols, whereas the documentation iirc lead me to believe it would read a single character at a time?
20:58pickles*led
21:00technomancypickles: the .read method on certain reader classes can read a char at a time, but the read function reads a single form.
21:00technomancy
21:00hiredman_pickles: read reads in a clojure form
21:00hiredman_,(doc read)
21:00clojurebot"([] [stream] [stream eof-error? eof-value] [stream eof-error? eof-value recursive?]); Reads the next object from stream, which must be an instance of java.io.PushbackReader or some derivee. stream defaults to the current value of *in* ."
21:01hiredman_"Reads the next object from stream"
21:01pickleswonder where I got the impression it read a single character then...
21:01picklesi know the java streams do single chars but I thought i saw that on the clojure read method too
21:01picklesah well
21:01picklesmany thanks all
21:09MiggyXHas anyone managed to get congomongo to build?
21:11amalloyMiggyX: you really need to build it, not just use it?
21:29ephconhey has anybody here messed around with scriptjure?
21:29ephconin particular, I'm trying to figure out a js for loop in scriptjure
21:29ephconhttps://github.com/arohner/scriptjure
21:42testclojurebot: (def x 5)
21:42clojurebotapi examples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples
21:42MigZhmm, any obvious reason why when I set a namespace, clojure can't find any of the libraries (such as clojure-contrib) that it could see before?
21:43amalloyMigZ: from the information given, the only answer certain to be correct is "you did something wrong"
21:44MigZamalloy: http://www.pastie.org/1761391 I didn't know if there was a common stupid thing to do wrong :)
21:45testsexpbot: (def x 5)
21:45amalloyMigZ: duck-streams and str-utils are part of clojure.contrib; your ns decl acts as if you wanted to include four independent libraries
21:46amalloyyou want (:use (c.c d-s s-u) (s.c)
21:46testsexpbot: (println "Hello World")
21:46amalloy&("hello world")
21:46sexpbotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
21:46amalloyoops
21:46amalloy&"hello world"
21:46sexpbot⟹ "hello world"
21:46testahh thanks
21:47test&(defn foo [x] (inc x))
21:47sexpbotjava.lang.SecurityException: You tripped the alarm! def is bad!
21:47test&(range 1)
21:47sexpbot⟹ (0)
21:47amalloyMigZ: i know str-utils is extremely old, and i think duck-streams is similarly but i'm not sure. you probably want to use something newer as well
21:47test&(range)
21:47sexpbotjava.lang.OutOfMemoryError: Java heap space
21:48amalloyclojure.string includes most of the features that ye olde str-utils did
21:49MigZamalloy: Just took it from the clojure book. :) Will look into clojure.string
21:49test&(dorun (cycle '(1)))
21:49sexpbotExecution Timed Out!
21:49MigZWell I've gotten rid of the use errors, now getting 'Unable to resolve symbol: mongo! in this context' - still getting closer ;)
21:50amalloyMigZ: errrr i included an error in my suggested ns decl
21:50amalloythere should not be a paren before s.c
21:51MigZamalloy awesome, that fixed it :)
21:51amalloyjust keepin you on your toes :)
21:52amalloyseriously though it took me a hellishly long time to fully absorb all clojure's namespace subtleties. it's surprisingly complicated
21:52MigZamalloy: hopefully I'll pick it up at some point - I'm hoping to get to grips with clojure. How have you found it? I do a lot of work that needs to be paralelised :)
21:53amalloyMigZ: asking someone in #clojure what they think of clojure is liable to yield predictable results
21:54MigZamalloy: well I wouldn't expect a hugely negative response - but perhaps a fair one of how it fits to their various workloads :)
21:54amalloywell, i'm still stuck with php for my day job
21:55MigZamalloy: ah
21:55amalloyi find a lot of code i try to write is like "arrrrgh this should take two ##@%! lines in clojure"
21:55sexpbotjava.lang.Exception: Unable to resolve symbol: %! in this context
21:55amalloyhaha sorry sexpbot
21:55MigZhah
21:59amalloyin fact here's a good example from today. i had, in php, something like Map<String, List<String>> (really just a bunch of arrays in php, but using java to indicate what the types were)
22:01ataggartamalloy: every day I was saying that. Then I just up and quit my job.
22:01amalloyi wanted to do something with each "pair" of adjacent items in each list. in clojure: ##(let [listmap {:a [4 7 8 9] :b [1 3 8]}] (for [[k v] listmap, [src dst] (partition 2 1 v)] [k src dst]))
22:01sexpbot⟹ ([:a 4 7] [:a 7 8] [:a 8 9] [:b 1 3] [:b 3 8])
22:03amalloyataggart: it's an idea with some appeal, for sure. could probably head just a little south and pal around with amitrathore and ztellman
22:04ataggartheh, I went the other way, north to Vancouver.
22:06tomojamalloy: yes.
22:07amalloytomoj: agreeing with anything in particular?
22:07tomojmy boss who also knows clojure is someone not driven to "arrrrgh" by php, but I can't help it
22:07tomojs/someone/somehow/
22:07amalloytomoj: you can do a surprising number of functional things in php, they're just atrociously verbose
22:08tomojit's a sickening pile of nasty to me
22:08amalloyit's made a little worse because our general manager slash software lead loves php and has a coding style nearly as eccentric as rhickey's
22:08tomoj"eccentric in a good
22:08tomojer. "eccentric" in a good way?
22:09tomoj..presumably not
22:09amalloytomoj: *chuckle* good guess
22:10amalloyif( isset($data[$key]) ) $data[$key]++; else $data[$key] = 1; // but with newlines
22:10amalloyinstead of just @$data[$key]++;
22:12tomojI guess I'm not qualified to hate php
22:12amalloyeh?
22:12tomojI don't know it very well
22:12amalloywe have an open door policy
22:12amalloyanyone can hate with us
22:13tomojthat @ thing is just "ignore errors", right?
22:13amalloyyes
22:13tomojthe fact that that ends up setting the value for the key to 1 is somewhat baffling
22:13amalloytomoj: $var, where nobody has defined var yet, evaluates to 0
22:14amalloyalong with issuing a warning
22:14tomojah
22:15amalloyANYWAY. if you're in a language designed to let you be sloppy, why be sloppy *and* verbose
22:15tomoj:D
22:25amalloytomoj: are you using 5.3? the new closure support is a big help, even if they are tedious to use
22:26tomojyep
22:27tomojthat's the function ($foo) use ($bar) {} stuff?
22:27amalloyyeah
22:28MigZright, now to write this loop code in a functional way... should prove to be interesting ;)
22:28yayitsweiwhat's the best way to get status updates from a long-running process? e.g. (doall (map #(process-keywords-from (days-ago %))) (range 0 30)))
22:28tomoj`array_filter($pub, function ($item) use ($tid) { return $item['tid'] == $tid; });`
22:28tomoj`(filter (comp #{tid} :tid) pub)`
22:29yayitsweiI put a println in the days-ago function, but it does'nt print until after the whole thing runs
22:29tomojarrrrgh
22:30amalloyyayitswei: blurg. doall + map + anonymous function reeks. do you need the results of the map, or are you doing it strictly for side effects?
22:31yayitsweistrictly for side effects
22:31yayitsweithakns for pointing it out btw, would love a better solution
22:31amalloydoseq
22:31amalloy(doseq [d (range 30)] (process-keywords-from d))
22:32yayitsweiand why is that better than doall?
22:32amalloy(a) doall forces the whole sequence to be realized all at once, taking up more memory
22:32amalloywhile doseq throws away intermediate results
22:32yayitsweioh! that's good to know
22:33amalloy(b) (map #(whatever %) coll) is just an ugly way of writing (for [x xs] (whatever x))
22:34amalloydoseq uses the same binding style as for, and gives you the strict, side-effect behavior you want
22:34amalloy(of course, when you just want to call a simple function, (map f coll) is nicer than (for [item coll] (f item)); but if you have to define the function on the fly, for is nicer
22:34amalloy)
22:35MigZif you have a hash key that has a space in it, how do you quote it?
22:36amalloy&(keyword "stupid key with a space")
22:36sexpbot⟹ :stupid key with a space
22:37MigZamalloy: working with some data from MongoDB - it has embedded documents as well as tag names that contain spaces
22:37amalloyyeah, i know
22:37MigZamalloy, I meant my particular case :)
22:38MigZunfortunately when I did the mongodb book, I didn't learn how to use it with clojure lol
22:38amalloyMigZ: i don't understand
22:38amalloyare you saying my suggestion doesn't work for you for some reason?
22:39yayitsweiamalloy: seems to work. much faster, too. but, the println is still getting shown after the whole thing completes
22:39MigZamalloy, I just get Unable to resolve & in this context
22:40MigZbut that's probably something I'm doing elsewhere so checking that nwo...
22:40amalloy&(apply println '(& is my activation trigger))
22:40sexpbot⟹ & is my activation trigger nil
22:40amalloyyayitswei: could be output buffering
22:41MigZcould try using (flush) but that might affect performance
22:41yayitsweishould (flush) help?
22:41yayitsweijust tried that, but it doesn't seem to have an effect
22:42amalloyi'm guessing process-keywords is itself lazy
22:46yayitsweiamalloy: i changed process-keywords to use doseq -- is that lazy?
22:47amalloyit is not
22:53MigZamalloy so if you had a hash called 'test' containing a key called 'Stupid Key', how would you print it? So far everything I've tried has blown up :)
22:54amalloy&(let [k (keyword "Stupid Key") test {k 10}] (k test))
22:54sexpbot⟹ 10
22:55MigZamalloy, hmm is it that hideous because of the stupid space?
22:57amalloylife sucks, and then you die
22:58MigZamalloy yes but I'm hoping it might suck less lol
22:59MigZthe current plan is to convince people here that clojure is nicer and faster than what we're currently using :)
23:04trptcolin_if i want to see if a given thing implementing IPersistentMap is a type / record vs. one of the clojure.lang maps (PersistentArrayMap, PersistentStructMap, PersistentHashMap, etc), am i going to have to go through and type-check?
23:05trptcolin_got something i need to serialize where the reader might not have the deftype/defrecord classes imported...
23:08brehauttrptcolin_: im not quite sure i follow, but map? returns true for a record instance for me
23:08trptcolin_right, me too. i want something that distinguishes records/types from "regular" maps
23:09trptcolin_so i can count on being able to deserialize a map-like thing without worrying about dependencies besides what's in clojure.core
23:09brehauttrptcolin_: ah right my bad
23:12trptcolin_my use case is actually such that i can do (into {} thing-thats-like-a-map) and be done with it either way (it's guaranteed to be small)
23:12brehauttrptcolin_: well a deftype will only be map? => true if it explicitly implements IPersistentMap
23:12trptcolin_i actually am not sure what this thing i have is (record vs. type), but it's definitely mappy
23:14trptcolin_i'm just going to dump it into a hashmap, that'll work
23:14brehaut(type thing) will tell you for certain
23:14trptcolin_yep
23:14trptcolin_well... it'll tell me the class. which may be a record or type :)
23:26no_mindwhat is the best way to return an error from a function. I have a function which returns a map after adding a key/value pair to map but if the key already exists it should return a warning/error indicating key exists.
23:28brehautno_mind: 'best way' is hard to answer in a general sense.
23:29ataggartwho consumes the warning/error? If it;s the caller of the add function, then just find out beforehand
23:29ataggart(if-not (contains? m k) (assoc m k v))