#clojure logs

2010-11-16

00:05tonylis the :once value in the metadata map used only for delaying the results?
00:05tonylor what is it used for
00:09KirinDaveHow does one define a method with a void return type using gen-interface?
00:10tonylI think only 1.3 lets you specify a return type
00:10KirinDaveFor gen-interface?
00:10KirinDaveThat's definitely not true.
00:10tonylIn general
00:10tonylI am not sure about gen-interface
00:12danlarkin1.2 (at least, and probably earlier versions) of gen-class let you have a void return value
00:12danlarkinI have no experience with gen-interface though, sorry :(
00:13KirinDavedanlarkin: How do you express it?
00:13KirinDavegen-class's format is very similar to gen-interface
00:13danlarkinKirinDave: https://github.com/danlarkin/subrosa/blob/master/src/subrosa/observable.clj#L9
00:14danlarkinKirinDave: that is, a vector of 3-vectors: method name, vector of arg types and return type
00:15KirinDavehaha, it's just "void"
00:15tomojwonder why not aleph?
00:15KirinDaveTHAT IS TOO SIMPLE FOR ME TO HAVE GUESSED ;)
00:15danlarkinKirinDave: it's in the documentation :)
00:16KirinDavedanlarkin: Ahh, it is; albeit obliquely
00:16KirinDave"In all subsequent sections taking types, the primitive types can be
00:16KirinDave referred to by their Java names (int, float etc)"
00:16KirinDavedanlarkin: Thank you
00:16danlarkinKirinDave: it did take me a few minutes of reading to find it
00:17danlarkintomoj: a few reasons, but /mostly/ because when I started this code there was no aleph
00:17tomojah
00:17quizmei got something like GC memory overhead limit exceeded. how do you increase the memory limit?
00:19tomojdo you think you really should need to? maybe you are holding the head somewhere?
00:19tomojoh, guess that means you have excessive churn?
00:20danlarkinthe default JVM heap size isn't very large, you almost always need to increase it for serious work
00:20tomojthat happened to me when I was creating many many boxed integers and then adding them up and outputting and then throwing away
00:20danlarkinquizme: java -Xmx2048m ...
00:21quizmedanlarkin thanks. i'm doing "lein repl"
00:21danlarkinquizme: lein respects JAVA_OPTS
00:21quizmeok cool
00:21quizmethnx
00:22KirinDaveAnd :java_opts in the project.clj file.
00:22quizmeawesome dudes thnx
00:22tonylwhat is the difference between java -Xmx... and java -Xms....
00:22danlarkintonyl: max and min heap size, respectively
00:23tonylthanks danlarkin
00:24quizmeexport JAVA_OPTS=-Xmx768m <--- will lein pick that up from env ?
00:24danlarkinquizme: yes
00:24quizmedanlarkin tyu
00:25LauJensenMorning all
00:33quizmeis it possible to do something like preduce on an atom ?
02:06guppyhello
02:46quizmehttp://pastie.org/1301932 <--- is there anything obviously wrong with how i'm updating my atom? It didn't change...
02:46sandGorgonI have a 3'rd party java lib that has a "main" function - I need to invoke that from clojure. How do I do that ?
02:47hiredman you're not using reduce correctly
02:48quizmehiredman hmm
02:49quizmehiredman: it takes 3 arguments (reduce f val coll) isn't that what i'm doing ?
03:08Chousukequizme: I don't think that's a good use of an atom in the first place
03:09Chousukeit's not parallel at least :P
03:11quizmechousuke doesn't pmap parallelize the reduce processes ?
03:12quizmeoh...
03:12quizmei think i get it
03:12quizmei see, thanks....
03:17Chousukethe atom's going to block most of the parallelism anyway.
03:17Chousukeand for pmap to be worth it, the mapped function must be quite expensive
03:19Chousukeand it's not usually a good idea to def lazy seqs, unless you want to keep them in memory forever :)
03:20Chousukeyou'll probably get more performance if you use a transient.
03:20Chousuke(without any atoms)
03:21Chousukethough if your data structure is nested, then it becomes somewhat tricky.
04:36esjhello eujurians (and Raynes, who sleeps not)
04:53raekgreetings from the realm of smörgåsbord and IKEA
04:57esjraek: :)
05:35LauJensensmörgås means 'butter goose' in danish :P
05:39LauJensen@ raek
05:39raekin swedish too, for some reason
05:40raekbut it still is the word for "sandwich"
05:40LauJensenhehe, swedish sets new standards for silly :)
05:42esjLauJensen: not sure on that one - a having "butter goose" as the default for a sandwich sounds pretty awesome where I'm standing
05:43AWizzArdHow can I go from a symbol to class? (foo 'String) ==> java.lang.String (<-- this is a class)
05:44AWizzArdresolve?
05:44LauJensenesj: Im just telling you the Rules. Our languages stem from our Germanic Roots, Denmark is closets to the roots, more clear and easier to reason about. Norwegian is a little more distorted, but still understandable, especially in writing. Swedish is terrible distorted (I think because of alchohol abuse), so that its difficult to understand. If we go even further north we have Suomi, which is just.. gone
05:44AWizzArdOr is there something better?
05:45imadeLauJensen, what's your take on Estonian, it sounds very similar to Finnish
05:45LauJensenimade: I dont know enough about it
05:45esjLauJensen: ROTFL. I'll have to teach you some Zulu when we meet. The grammar and syntax are such as to make the each sentance rhyme. Now that is awesome.
05:48LauJensenesj: Sounds like a cool challenge, would really take hard work. To learn swedish simply takes a couple of beers
05:49esjI have a problem, previously discussed, where a sufficient quantity of beer allows me to understand and speak German fluently, on the basis that if I just slur in Dutch I figure I'll be fine...
05:50xkblol
07:12AWizzArdWho has an idea to improve this?
07:12AWizzArd,(loop [list [10 20 30 40 50], result []] (if (< (count list) 2) result (recur (rest list) (conj result (take 2 list)))))
07:12clojurebot[(10 20) (20 30) (30 40) (40 50)]
07:12Tordmor,(doc partition)
07:12clojurebot"([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a ...
07:13Tordmor,(let [lst [10 20 30 40 50]] (partition 2 lst 1))
07:13clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
07:13LauJensen&(vec (partition 2 1 (range 10 50 10)))
07:13sexpbot⟹ [(10 20) (20 30) (30 40)]
07:15LauJensenAWizzArd: Did you catch that buddy ?
07:19AWizzArdAh, partition takes another arg
07:19AWizzArdgood, thanks
07:19LauJensen4 in in total, padding is nice as well
07:19LauJensen&(partition 2 2 [0] [1 2 3])
07:19sexpbot⟹ ((1 2) (3 0))
07:20AWizzArdnice improvements, I missed those, thx
07:21LauJensennp
08:33cemerickstuartsierra: ping
08:40sharat87Hello, is it ok to use a function with side effects in a call to map?
08:40sharat87I mean, it will be called on the sequence in order right?
08:41noidimap is lazy, so you'd better use doseq for side effects
08:41sharat87oh ok thanks
08:55sharat87is there a better way to turn a keyword into a string (without the :) than (.substring (str :hella) 1)
08:55LauJensen&(name :hello)
08:55sexpbot⟹ "hello"
08:55sharat87ah neat, thanks :)
08:55LauJensen&(subs (str :hello) 1)
08:55sexpbot⟹ "hello"
08:56sharat87where are these functions I don't find it in the data structures page?
08:56LauJensenBoth are better, prefer the first
08:56sharat87ok
08:56LauJensensharat87: try the cheat sheet
08:56RaynesWhere did subs come from?
08:56Raynes&(doc subs)
08:56sexpbot⟹ "([s start] [s start end]); Returns the substring of s beginning at start inclusive, and ending at end (defaults to length of string), exclusive."
08:56sharat87yeah, there too, the keywords section only has keyword and keyword?
08:57LauJensenoh
08:57chouserRaynes: subs is one of those unexpectedly old ones
08:58sharat87LauJensen: heh, a Ctrl-F reveals the name function in Other/Misc :)
08:58chouser&(meta #'subs)
08:58sexpbot⟹ {:ns #<Namespace clojure.core>, :name subs, :file "clojure/core.clj", :line 3940, :arglists ([s start] [s start end]), :added "1.0", :doc "Returns the substring of s beginning at start inclusive, and ending\n at end (defaults to length of string), exclusive.", :tag java.lang.String}
08:58chouser&(:added (meta #'subs)
08:58sexpbotjava.lang.Exception: EOF while reading
08:58chouser&(:added (meta #'subs))
08:58sexpbot⟹ "1.0"
08:58ChousukeI'm pretty sure subs was there before the first public release :P
08:58chouseryep
08:58RaynesI don't think anybody knows about it.
08:59cemericksubs is substituting a type hint for a fn call :-P
08:59chouserIt's included in one of Rich's early presentations, comparing a Python example to an equivalent Clojure example
09:00LauJensenchouser: ah, he put it in there to win the spelling corrector test? :)
09:00cemerickTrying to make things look less hosty, I guess?
09:00chouserI think you're both right. :-)
09:00stuartsierraI think it even predates the (.method obj. ..) sintax
09:00stuartsierra*syntax
09:01cemerickRaynes: Dude, subs couldn't *exist* w/o .substring :-P
09:01LauJensensubs is actually the first building block of clojure, even precedes functions themselves
09:01LauJensen:)
09:01cemerickha :-)
09:01Raynescemerick: You have a thing about backends, don't you?
09:01chouser(.method obj) is now so clearly better, it's hard to believe people weren't sure at first
09:02Raynescemerick: Just like project.clj, it's shorter and does everything that I need at the moment, so why would I ever want to use .substring? ;P
09:02cemerickRaynes: I'm an ass about making sure people don't forget the stature of the giants we sit upon.
09:02chouserRaynes: because if you know about .substring, finding .split is a natural progression
09:02chouserRaynes: if you only know about subs, good luck finding .split or clojure.string/split
09:02cemerickRaynes: The project.clj thing is totally orthogonal, far more meta, and not worth getting into. :-)
09:03Rayneschouser: I'm sure I would have managed.
09:03Raynesjava.lang.String is not too far away.
09:03Rayneschouser: Nonetheless, shouldn't subs be in clojure.string?
09:03chouserI mean, I'm exaggerating, but there's a point there.
09:04chouserRaynes: if anywhere, yeah. But is it worth a breaking change to move it?
09:04cemerickchouser: I got your back, man. Exaggerate and hyperbolize away.
09:04Rayneschouser: Sure it is. There can't be more than 3 people using it in practice.
09:05Raynesclojure.string should really be called clojure.redundancy though.
09:06stuartsierrahey
09:08Raynes$seen mmarczyk
09:08sexpbotI have never seen mmarczyk.
09:09RaynesI haven't seen ol' Michal in quite a while.
09:09LauJensen:(
09:09RaynesHe must be lurking. He's definitely around, since he watched clojail yesterday.
09:45fliebelmorning
09:46LauJensenMorning :)
09:49fliebelAre there any (>= Clojure 50%) companies in Europe?
09:51AWizzArdfliebel: do you mean 50% or 0%?
09:51AWizzArdAny sounds like: (< 0% Clojure)
09:51fliebelAWizzArd: Well, at least anything where some serious Clojure work is happening :)
09:54dakronefliebel: Forward was one of the conj sponsors, they're out of London I think
09:55fliebeldakrone: I'm googling for them :)
09:55dakronefliebel: forward.co.uk
10:23AWizzArdfliebel: yes, some companies use Clojure seriously.
10:24fliebelAWizzArd: I'd love to know about a few more.
10:52jkdufairhow can i use slime to send an expression to the REPL, copying and eval-ing it in the REPL itself?
10:53jkdufairi'm giving a presentation demo-ing clojure
10:56bhenryjkdufair: i feel like i've seen it in presentations but don't know how to do it myself. if you can't find it make a keyboard macro for C-k C-y C-c-z C-y
10:56bhenryyou'd do that from the beginning of the form you want to send to the repl
10:56jkdufairyeah, it's not very useful outside of presentations
11:10trybeingarunHey guys
11:11tonylhello
11:11trybeingarun(read-line) is not working in emacs. Any fix available?
11:11tonylsorry, not an emacs guy
11:11trybeingarunFyn :)
11:12trybeingarun@tonyl: what editor are you using btw?
11:13trybeingarunnot trying to start an editor war btw ;)
11:14tonyli don't car about those wars
11:15tonylI use vim, but run clojure with a bash script
11:15trybeingarunme neither. Whatever works fine for the job :)
11:15trybeingarunnice...
11:17cemerickpuredanger: Got your back on the ccw keybindings. :-) FYI, Laurent will hopefully have an RC that includes the new REPL stuff this week.
11:18puredangercemerick: cool, thx
11:18trybeingarunI am new to functional programming and clojure too. Can anybody suggest a good reading material (other than Practical clojure and Programming Clojure books) ?
11:18puredangercemerick: does that mean just that you agree with me or that you're actually changing it? :)
11:18cemerickpuredanger: what prompted you to bounce back and forth? I thought you had settled in with emacs, at least for a little while?
11:19puredangercemerick: I've been doing more design work where I want to see a lot of stuff at once and I find Eclipse much easier to do that in
11:19cemerickpuredanger: I'm all for changing it, but it's Laurent's sandbox. If he says it's a go, and it's just a matter of adding a condition to delegate off to your usual action for text editing in those contexts, then I'll make sure it's in the RC.
11:20cemerickIf we don't have the current editing scope handy already, then it may be added to the backlog.
11:21puredangercemerick: the thing that I find really disorienting about it is the difference in behavior with alt-left (left by word) and alt-shift-left (expand selection to entire string, instead of left by word expanding selection)
11:21tonyltrybeingarun: for me to understand clojure clojure.org helped me out. functional programming helped me just to go along and program some mini programs
11:21tonyli haven't read any books just coding and reading blog posts
11:21pdktrybeingarun
11:21pdklook into on lisp/ansi common lisp
11:22pdkgoogle sicp and look into haskell and ML (say SML or o'caml) as well
11:22trybeingarunIsn't there appreciable difference between common lisp and clojure?
11:23AWizzArdIs there a test to check if an object is either a Boolean or a primitive boolean?
11:23pdktrue but the book can still be helpful for getting a feel for lisp on the whole and it spends some time covering things like what you can do with macros
11:23trybeingarunI mean, would not immutability make significant difference?
11:23AWizzArdother than (or (true? x) (false? x))
11:23pdk(doc boolean?_
11:23clojurebotEOF while reading
11:23pdk(doc boolean?)
11:23clojurebotPardon?
11:23pdkhm
11:24pdk,(. Integer java_class)
11:24clojurebotjava.lang.NoSuchFieldException: java_class
11:24cemerickpuredanger: Absolutely, yes. It's fundamentally just an impl detail, as the arrangement makes perfect sense in actual code.
11:24pdk,(. Integer value_type)
11:24clojurebotjava.lang.NoSuchFieldException: value_type
11:25pdkblast
11:25trybeingarunI have the following books with me. Can anybody order in increasing degree of importance/difficulty?
11:25AWizzArdInteger/TYPE exists
11:25AWizzArdAlso Boolean/TYPE
11:25cemerickI'll have to scrounge up one of those paredit screencasts to see how the other side does things.
11:25pdk,(. Integer TYPE)
11:25clojurebotint
11:25pdkhm
11:25AWizzArd,(instance? Boolean/TYPE (Boolean. true))
11:25clojurebotfalse
11:25tonylInteger/TYPE
11:25trybeingarun1. Practical Clojure 2. Programming Clojure 3. Practical Common Lisp 4.On lisp 5. PAIP 6. SCIP
11:26pdk,(. Integer getClass)
11:26clojurebotjava.lang.NoSuchFieldException: getClass
11:26tonyli would say on lisp first then anything else would make sense, if you are new to lisp of course
11:26pdkon lisp makes sense after you've learned the basic stuff
11:26pdkpractical clojure is a little sparse
11:27pdkthough if you already know java and skimmed through some other lisp tutorials it could be helpful
11:27pdk,(. (new Integer) getClass)
11:27trybeingarunAlso, I have heard great things about SICP. But the fact that it is being recommended heavily by universities itself makes me a bit anxious.
11:27clojurebotjava.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer
11:27trybeingarunWill it be too theoritical??
11:28trybeingarunI know java.
11:28pdkit's probably the first thing people will name if you say you want to learn scheme
11:29pdki don't see any big reason to worry but if you want to be sure maybe do practical clojure to learn the basic concepts like what a form is, funargs etc
11:30trybeingarunWhat are you guys using clojure for? I am looking at it just for fun (I mean doing some pet projects)
11:31puredangertrybeingarun: large data integration w/ semantic web tech
11:31tonylme too
11:31tonyli am learning some game theory with it too
11:32tonyland a have a project in the future for a web app
11:32trybeingarunhow easy/difficult is it to adapt to pure clojure (FP) mindset.
11:33trybeingarunOf course, it is kind of a stupid question because it cant be quantified
11:33puredangertrybeingarun: anyone that thinks about programming seriously should read SICP imho, regardless of what lang you use. But I'm not sure it's the best way to dabble in FP.
11:33trybeingarunbut, more particularly, any pain/pleasure points?
11:33trybeingarunThen I will surely read SICP
11:34puredangertrybeingarun: you might have fun using Clojure Koans https://github.com/functional-koans/clojure-koans
11:34trybeingarunfor(int i = 0; i < blah; i++) {printf ("This has been my life so far");}
11:35tonyltrybeingerun: for me there was a learning curve (new to fp, lisp, and jave newbee) but it is worth it
11:36tonyli see some problems in a different perspective
11:36pdkyou could also learn more about fp by looking into books/articles etc on fp in general or other fp languages
11:36pdksay haskell or some variety of ML
11:36trybeingaruntonyl: could you please elaborate? What do you value most?
11:36tonylchange that to ##(doseq [x (range 10)] (prn "This is now how I do it"))
11:36sexpbot⟹ "This is now how I do it" "This is now how I do it" "This is now how I do it" "This is now how I do it" "This is now how I do it" "This is now how I do it" "This is now how I do it" "This is now how I do it" "This is now how I do it" "This is now how I do it" nil
11:37pdkchris okasaki also has a good phd thesis out there specifically on data structures in fp
11:37pdklater made into a book you could get somewhere say amazon
11:37tonylpdk: that looks interesting
11:37tonylhttp://www.amazon.com/Purely-Functional-Structures-Chris-Okasaki/dp/0521663504
11:38trybeingarunthere is some effort going on to rewrite SICP in clojure, right. Anybody knows what happened to it?
11:39pdkthe purely functional retrogames article series is also interesting
11:39trybeingarunsexpbot: funny :)
11:39AWizzArd,(integer? 9999999999999)
11:39clojurebotjava.lang.ExceptionInInitializerError
11:39pdkeven if you're not looking at games programming it talks about how to go along doing stuff that you'd think would be prohibitive without imperative programming
11:39tonylthere is a blog that is trying to do that
11:39AWizzArd$(integer? 9999999999999)
11:40tonyl&(integer? 9999999999999)
11:40sexpbotjava.lang.Exception: EvalReader not allowed when *read-eval* is false.
11:40pdkand game coding is usually something where we favor doing things highly imperatively
11:40trybeingaruntonyl: Ya. But in some forum I read the author is not responding to any queries and the effort might have halted. (I hope I am wrong :) )
11:41tonylmaybe, it's been a while since I read those posts
11:41tonylpdk: where is that series? I am trying to learn to do games in FP
11:41trybeingarun@RH: Blip.tv videos are amazing. Did not sleep during any of your talks :P
11:44pdkhttp://prog21.dadgum.com/23.html
11:45pdktonyl
11:45pdkalso trybeingarun
11:45trybeingarunpdk: any particular usecase where FP would do much much better than imperative style?
11:45pdkif you're looking into okasaki's book you could also find his phd thesis for free and see if it looks interesting
11:45pdkthe book pretty much takes the thesis and expands on it
11:45tonylthanks pdk
11:46pdkperformance wise or in terms of being a more appropriate choice
11:46trybeingarunprogramming choice
11:47pdkhm that i couldn't answer 100% off the top of my head though folks are advocating it for any sort of highly concurrent coding
11:47pdkif you read on lisp as well it shows how the lisp style macro system can go surprisingly far
11:48pdkdoing stuff like defining domain specific languages in terms of lisp macros so those mini languages can sit on top of your app
11:48trybeingarunWas trying out Practical Common Lisp.
11:49pdkon lisp can be had for free in pdf or html as well
11:49trybeingarunThe author had developed a primitive unit testing framework in just under 30 lines
11:49trybeingarunammmmazing
11:49pdksame with pcl
11:49trybeingaruncode was beautiful
11:49pdkgood thing too since a hardcover on lisp is still like $140
11:49pdkand who knows why
11:50trybeingarun$140 ??? I am scared
11:50ChousukeI don't remember who it was that said this, but lisp is a language where you can build up the language to suit your problem domain, rather than having to break down your problem into something expressible in the language :)
11:50pdkfor a physical copy trybeingarun
11:50tonyli think that was paul graham
11:50pdkonline it can be had for free legitimately
11:50pdkyeah it's a paul graham book
11:50Chousuketonyl: probably
11:52trybeingarunI just downloaded a copy. Thanks pdf :)
11:52trybeingarunPaul Graham was working on his own language (Arc) right
11:52tonylyeah
11:52trybeingarunanybody following that?
11:52pdki'd be surprised if arc is still going
11:53tonylis there, but there is not much development last time i checked
11:53cemerickpdk: it is, surprisingly.
11:53pdkhm
11:53pdkarclanguage.org has downloads though the site is incredibly sparse
11:53cemerickNevermind, I'm not suprised :-P
11:53trybeingarunA:P
11:53pdkand it has recent forum posts
11:55trybeingarunIs it true that clojure's Regex support is not as good as perl or ruby's (I think I heard Stuart Halloway saying that in some talk (video))
11:55tonylunder it it uses Java's
11:55cemericktrybeingarun: Clojure's regex support is as good as Java's, which is to say, very good.
11:55cemerickNot as good as perl's presumably.
11:56cemerickthey are PCRE's, after all :-)
11:56tonylfound a bug on the java implementation
11:56tonylbut there are workarounds
11:56trybeingaruntonyl: what bug?
11:56pdkfailing that you could just use java regexes anyway :p
11:56tonylumm let me try ig
11:56tonyl*it
11:57tonylwhen you use a [ inside a class group
11:57pdkgod knows there's probably been countless projects to reimplement perl regex syntax as a java class either way
11:57tonyllike this #"[[]"
11:57tonylit throws a matching error
11:58technomancythe literal syntax is nicer in Ruby, but I haven't found anything else problematic with Clojure's
11:58technomancypart from the fact that they're not callable
11:59technomancy*apart
11:59tonylruby's syntax is like perl isnt? using /regexp/
11:59technomancyyeah, more pertinently it supports interpolation and things like /foo/i for case-insensitive
11:59tonylyeah, that is handy
12:00technomancycase-insensitive in Clojure looks pretty silly: #"(?i)foo"
12:00trybeingaruntechnomachy: Dude, how is there a fix for emacs' (read-line) issue? (sorry to take to conversation off topic)
12:00cemericktonyl: that's not a bug?
12:00cemerick&(re-seq #"[\[]" "[")
12:00sexpbot⟹ ("[")
12:00tonyl&(re-matches #"[[]" "what [] up?")
12:00sexpbotjava.util.regex.PatternSyntaxException: Unclosed character class near index 2[[] ^
12:00tonylthe [ is not supposed to be a special char inside the []
12:01cemericktonyl: oh, you mean, a bug re: "perl compatible"
12:01amalloytonyl: this was discussed in #clojure a week or two ago. java's regex engine, although supposedly PCRE, does that wrong
12:01technomancytrybeingarun: I'm not sure; maybe put your input in the buffer where you launched swank?
12:01tonylyeah, that's what I meant
12:02tonylnot only perl, but the only doc http://www.regular-expressions.info/charclass.html
12:02trybeingaruntechnomancy:okay. I will try that
12:02amalloychouser came up with something weird without using \ that i think worked
12:02tonylunless there is a specification that I don't know about, and that always happens :P
12:02amalloy&#"[[[]]" maybe
12:02sexpbotjava.util.regex.PatternSyntaxException: Unclosed character class near index 4[[[]] ^
12:03tonylnow I'm intrigued how he did it
12:03cemericktonyl: to be fair, the javadoc for j.u.Pattern doesn't claim to be perl-compatible *shrug*
12:03tonylyeah, understandable
12:03amalloy&#"[[]]"
12:03sexpbotjava.util.regex.PatternSyntaxException: Unclosed character class near index 3[[]] ^
12:03tonyland easy to workaround \
12:04amalloyfeh
12:04cemerickI'll always miss the named groups in python's impl
12:04fogus_cemerick: until Java7 anyway
12:04cemerickfogus_: oh really?
12:04fogus_I think I read that somewhere
12:05cemerickThat'd be phantabulous.
12:05fogus_cemerick: http://download.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#groupname
12:05tonyl&(let [[a b c] (re-matches #"([-+]?[0-9]+)/([0-9]+)" "22/7")] [a b c])
12:05sexpbot⟹ ["22/7" "22" "7"]
12:06cemerickindeed
12:06tonyldestructuring helps you name the groups
12:06cemerickfogus_: the 6 years were worth the wait! :-P
12:06cemerickMan, matcher destructuring discussed again…
12:09defnhello all
12:09fogus_well, re-matches returns a vector no?
12:09tonylhere's chousers ##(re-find #"[[]]]" "]")
12:09sexpbot⟹ "]"
12:10fogus_,(re-matches #"(\d) (\d) (\d)" "1 2 3")
12:10clojurebot["1 2 3" "1" "2" "3"]
12:10defn##(re-find #"[[]]]" "]")
12:10sexpbot⟹ "]"
12:10defndid sexpbot change again?
12:10defn-> (+ 1 2)
12:10defnguess so...
12:11cemerickfogus_: true, thought I saw re-matcher
12:11fogus_cemerick: did you see my tweet about matcher destructuring? it was sick (in a bad way)
12:12defni saw it. i threw up.
12:13amalloydefn: sexpbot changes a lot, though last i checked -> still worked. weird
12:13amalloybut & is easier to type as a prefix, and ## works anywhere in the message
12:13sexpbotjava.lang.Exception: Unable to resolve symbol: works in this context
12:14cemerickfogus_: Hrm, perhaps.
12:14amalloysexpbot: wtf, i fixed that problem
12:14cemerickI remember seeing matcher destructuring lately somewhere, and being surprised that it was supported at all.
12:14cemerickSide-effecting destructuring?
12:14cemericketc
12:14amalloycemerick: what side effects?
12:15amalloywhen you destructure a matcher it gives you the groups of the most recent find, without starting a new find
12:16fogus_amalloy: But you have to start the find in the first place
12:16defn#((\()))
12:16defn##((\()))
12:16sexpbotjava.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.IFn
12:16amalloyfogus_: certainly. which is why there are no side effects in the destructuring
12:17amalloydefn: it's actually my code
12:17fogus_amalloy: I see what you mean
12:17fogus_http://twitter.com/#!/learnclojure/status/1746438878920704
12:18amalloydefn: the regex for matching ## 'things is pretty awful tbh
12:18sexpbot⟹ things
12:19amalloy(and next time he pulls, it won't match words mid-message in case someone wants to talk about channels with two #s)
12:20defnamalloy: i can show you some code that's worse...
12:20amalloydefn: i wouldn't be surprised, but have you looked at the regex? :P
12:21defnamalloy: https://github.com/defn/walton/blob/master/src/walton/core.clj#L38
12:22defnit was designed to be "fast", and by "fast" i mean "completely incomprehensible"
12:22cemerickamalloy: fair enough, not side-effecting destructuring; rather, side-effectable destructuring :-P
12:22amalloydefn: condp instead of cond would make things a lot more readable
12:23amalloyand personally i'd use a map of {character=>keyword} pairs - surely a hashtable lookup is faster than testing N boolean expressions?
12:24defnamalloy: good point
12:24cemerickoddly enough, the matcher destructuring isn't congruent with re-groups (i.e. doesn't include group 0)
12:24amalloyalso, you test for \\ twice in a row
12:24Chousukeamalloy: depends on the number of boolean expressions I guess.
12:24defnamalloy: yeah im re-reading this code now -- i just left it alone once it was done
12:24fliebelHow can I read json, and return nil if it fails? This raises an exception, while the doc says it dhould retorn nil, if I'm correct. (read-json-from "" true false nil)
12:25fliebel(hi defn)
12:25defn(hi fliebel)
12:26AWizzArdfliebel: you can embed it into a try/catch
12:26fliebelAWizzArd: try is bulky, and the docs say it should be able to return nil if it find an empty string.
12:27trybeingarunAlmost midnight @ India. Bye guys!
12:28joegallodrewr: Maintain radio silence!
12:28drewrjoegallo: yessir
12:29joegallodrewr: Heh, we're having seekaret conversations over here. Ssshhh.
12:34fliebelI found a bug in clojure.contrib.json.
12:36fliebelConsider this bit and then try &|(char −1)|& on the REPL. if we are at the end of a file, we're never going to make it to the if statement. https://github.com/richhickey/clojure-contrib/blob/1e3333335334139669fb1e859fb0c3cb77b968df/src/main/clojure/clojure/contrib/json.clj#L116-121
12:36sexpbotjava.lang.Exception: Unable to resolve symbol: −1 in this context
12:37fliebelhuh...
12:37fogus_cemerick: Yeah, it's messed up (technical term). Creating that little snippet of matcher destructuring convinced me to never do it again.
12:37Raynesfliebel: Use ##(char -1) now, btw.
12:37sexpbotjava.lang.IllegalArgumentException: Value out of range for char: -1
12:37fliebelty
12:39cemerickrhickey: What was the motivation for destructuring of j.u.Matchers?
12:58fliebelWhere do I submit bugs and how do I get this contributors agreement to fix things myself?
12:59arohnerfliebel: the CA is http://clojure.org/contributing
13:07fliebelarohner: Thanks. Do I really need to send this in for… submitting a bug?
13:08arohnerfliebel: I don't think so. I think you only need to for submitting patches
13:08amalloyfliebel: and more power to you if you manage to fix anything. i got my CA in like a month ago, but gave up on changing anything because the instructions are so out-of-date and circular
13:09arohneroh, and bugs go here http://dev.clojure.org/jira/browse/CLJ
13:12fliebelarohner: I thought I red you need to be contributer to be allowed to be on there, but I'm on it right now and everything seems fine.
13:12cemerickfliebel: anyone can submit a bug. The CA is needed only if you're contributing code.
13:13jimdagemhi
13:13cemerickamalloy: I'm guessing the docs haven't been updated to reflect the move to JIRA, but: fix, produce patch, upload?
13:13amalloycemerick: upload to where?
13:14cemerickamalloy: as an attachment to the corresponding JIRA ticket
13:14esjcemerick: your maven Enforcer just slapped me around for my own good :) Time for maven 3.0....
13:15cemerickesj: ?
13:16jimdagemHow do I properly do what I'm trying to do: http://pastebin.com/zsXSbzS6
13:16esjI tried to build core.unify with maven. The build, courtesy of the Enforcer Plugin, told me that my Maven v 2.2.0 was no good. Reading through the poms, I'm deciding it must be your fault :)
13:17cemerickesj: Indeed, v2.2.0 won't do :-)
13:17clojurebot#<RuntimeException java.lang.RuntimeException: org.apache.http.conn.HttpHostConnectException: Connection to https://api.del.icio.us refused>
13:17zmyrgelhmm, I'm trying to assoc new value with my state record but it fails with "String cannot be cast to Associative"
13:18cemerickesj: IIRC, v2.2.0 didn't play well with gpg, used for signing artifacts
13:19amalloyjimdagem: (declare fib) (def fib (memoize (fn [x] ...))) is the hack i use
13:19esjcemerick: cool, I should be on the latest stable anyway. Now I just have to figure out how to make clojure:swank come back.
13:20jimdagemamalloy, sweet!
13:20zmyrgelhere's the code piece causing the error: http://pastebin.com/c38Lq91F
13:20jimdagemclojure is so neato
13:20fliebelMy bug: http://dev.clojure.org/jira/browse/CONTRIB-101
13:21amalloyzmyrgel: your state is being set to a string instead of a map somehow, is what your error message says
13:21amalloyor your move, i guess
13:22fogus_pdlogan: You sir are a glutton for painful twitter conversations. ;-)
13:23amalloyalthough, jimdagem, better still is not to memoize fib at all
13:23zmyrgelhmm, I'll check what gets passed to the function
13:23amalloyjimdagem: http://rosettacode.org/wiki/Fibonacci_sequence#Clojure
13:26zmyrgelha, my previous function returned a string instead of associating it with a state
14:02Phantom_Hoover ([f xs] (reduce (fn [a x] (+ a (f x))) 0 xs)))
14:03Phantom_HooverDoes Clojure pattern match with vectors?
14:03amalloyPhantom_Hoover: not as far as i know, but i'm not sure i understand what your snippet is supposed to do
14:03Phantom_HooverWait, me neither...
14:04chouserheh
14:04amalloywow, a hit and run
14:04esjgrin
14:11pdloganfogus_: I simply unfollowed him. nevermore.
14:32KirinDavetechnomancy: I do not understand octo-inc's utility. Is this trololo time or am I yet again too obtuse for this community? :)
14:32pppaul(defn 2d-map [fn 2d-array]
14:32pppaul (map (fn [row]
14:32pppaul (map fn row))
14:32pppaul 2d-array))
14:32pppaulis something like that in core?
14:33Chousukeno
14:33technomancyKirinDave: oh man we use oinc all the time. it's like the fibbonacci of sonian.
14:33alpheusIs there something like binding that will work across threads?
14:33chouseralpheus: binding in 1.3 :-/
14:33amalloyalpheus: ##(doc bound-fn)?
14:33sexpbot⟹ "Macro ([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."
14:34tonylor def ?
14:34KirinDavetechnomancy: Trololo
14:34technomancychouser: it's not binding though; it's with-redefs, isn't it?
14:34technomancyKirinDave: exactly.
14:34KirinDavetechnomancy: Link to isthereaproblem.com
14:34chouserheh. depends on what you want. all these answers are good.
14:35KirinDavechouser: Didn't you have some rationale for not using :use, or using with with blank :onlys or something?
14:35KirinDavechouser: I think I remember you mentioning this, but I can't remember why. it came up the other day.
14:35fliebelWould it be doable/easy/useful to implement things like agents, refs and atoms over a network, for managing state of multiplayer/-user games/applications?
14:35alpheustonyl: def just changes the root binding, so I don't think that's what I want.
14:36amalloyfliebel: you want the state in a server somewhere, right? if you rely on the clients to keep it, it's easy to cheat
14:36chouseralpheus: with-redefs temporarily changes the root binding, binding in 1.3 automatically passes the dynamic state across 'future' and 'send' calls
14:36chouseralpheus: short of those, see bound-fn
14:37alpheusSo, bound-fn for now, then just call future directly in 1.3?
14:38chouserKirinDave: 'use' has a superset of 'require's fetures, plus a bad default. so using :only [] in 'use' means it behaves sanely to start with, and then you can add/remove options as needed without switching to/from 'require'
14:38fliebelamalloy: I'm thinking of keeping the state on the server, but do (swap) or (send) or whatever sortof RMI style.
14:38chouseralpheus: that should do it.
14:38ossarehtechnomancy: stupid question, why is oinc any different than (+ 8 x) ?
14:38KirinDaveossareh: needs more obfuscation.
14:39hiredmanthe infamous octo-inc
14:39pjstadigo stands for octo
14:39hiredmanwell played
14:40ossarehKirinDave: I'm referring to this: http://twitter.com/#!/technomancy/status/4617786731008000
14:40KirinDaveossareh: So was I
14:40ossarehI'm confused then :)
14:41pjstadigoinc is much cooler than (+ 8 x)
14:41technomancyit's "more functional"
14:41technomancysince it involves more functions.
14:41pjstadigand shorter
14:41tonylwhere is this oinc?
14:41KirinDaveLazier
14:41ossarehtonyl: see the link above
14:41pjstadigand we all know short and incomprehensible is better than long and understandable
14:41chouserhas a bug
14:41fliebeltechnomancy: Hoave you seen my awesome function for generating an infinit lazy seq of ones?
14:42ossarehchouser: followed up in the next tweet
14:42ossarehhttp://twitter.com/#!/technomancy/status/4618155515191296
14:42chouseroh
14:42hiredman,(nth (iterate inc 1) 7)
14:42clojurebot8
14:43fliebelWhat is the difference between base and ancestors?
14:43ossarehtechnomancy, KirinDave: I'm not at the level of foo that I get either the application or the humour behind this :)
14:43KirinDaveWell, I heard that you liked function calls
14:44KirinDaveSo Phil put some function calls in your function calls
14:45amalloyhiredman: i was looking around for your pl macro this morning, but i can't seem to find it
14:46fogus_,(let [oinc (fn [n] (reduce + n (map #(%) (repeat 2r000001000 #(*)))))] [(oinc 8) (oinc 32)])
14:46clojurebot[16 40]
14:48technomancyfogus_: hats off to you sir.
14:48pjstadigholy crap fogus_
14:48amalloyfogus_: #(*) is comical
14:48KirinDaveSo what are people using for date handling these days?
14:48pjstadigyou have a new presentation for the meetup
14:48KirinDaveJust raw-dogging on Joda Time?
14:48ossarehKirinDave: joda
14:49KirinDaveWasn't clj-time gonna start to bite into that?
14:49fogus_There must be a better way to obfuscate the number 8 than 2r000001000
14:49amalloyfogus_: (count "fourteen")?
14:49fogus_oooo, that's pretty cool
14:50KirinDavetechnomancy: You know, there's got to be something amusing you could do with the way clojure handles arglists.
14:50ossarehKirinDave: http://dev.clojure.org/pages/viewpage.action?pageId=950382 <- this is good. clj-time has some very good work in it.
14:50hiredmanclojurebot: transform
14:50clojurebottransform is http://github.com/hiredman/odds-and-ends/blob/8a84e6ddbad9d71f714ba16c3e1239633228a7eb/functional.clj
14:50hiredmanamalloy: somewhere there
14:50amalloyah, thanks
14:50pjstadigchurch numerals?
14:51fogus_pjstadig: need to think of how to fit that into a tweet
14:51fliebelossareh: How do you do those italic messages you just did?
14:51amalloyfliebel: /me whatever
14:52amalloyand how they show up depends on your client. they don't look italic to me
14:53KirinDaveI wonder if you can get an arglist where it does work.
14:56fogus_This is kinda weird: (defn oinc [num] (reduce + num (map #(%) (repeat (inc (count (str (:arglists (meta oinc))))) #(*)))))
14:57amalloyfogus_: that's horrible. but like, horrible-good
14:58ossarehfwiw, all this obfuscated clojure is somewhat like what I'm working with now: imovie.
14:58amalloyfogus_: ##(first (nth (iterate (fn [[a b]] [b (+ a b)]) [0 1]) 6)) maybe?
14:58sexpbot⟹ 8
14:59amalloycause you might as well compute some fibonacci numbers if you're going to add eight
15:00esjKirinDave: clj-time is built around joda AFAIK
15:05fogus_I think I'll just stick with this one: (defn oinc "fourteen" [n] (reduce + n (map #(%) (repeat (.length ((keyword (apply str (map char [100 111 99]))) (meta (var oinc)))) #(*)))))
15:06fogus_140 chars FTW!
15:07chouserCurious George golf
15:07kotarakWhat is this oinc stuff about?
15:08amalloykotarak: there seems to be a competition to come up with the grossest way to write #(+ 8 %)
15:08kotarakoh, ah,
15:08Kjellskiping?
15:08clojurebotPONG!
15:09Kjellski,(indexed (seq "Where are you"))
15:09clojurebotjava.lang.Exception: Unable to resolve symbol: indexed in this context
15:09kotarak,(map-indexed vector "Here")
15:09clojurebot([0 \H] [1 \e] [2 \r] [3 \e])
15:09tonyl&(String/parseInt "3" 10)
15:09sexpbotjava.lang.IllegalArgumentException: No matching method: parseInt
15:09tonylwhat?!
15:09kotarak,(Integer/valueOf "3" 10)
15:10clojurebot3
15:10amalloytonyl: Integer/parseInt
15:11Kjellskikotarak: thanks a lot ^^ was looking at the docs, and they´re unfortunately wrong... http://richhickey.github.com/clojure-contrib/seq-utils-api.html
15:11Kjellskikotarak: Or am I?
15:11amalloyKjellski: neither
15:11kotarakKjellski: The docs are now at clojure.github.com/clojure-contrib
15:11amalloythat function is in clojure.contrib.seq-utils, not in core
15:12amalloy&(require clojure.contrib.seq-utils)
15:12sexpbotjava.lang.ClassNotFoundException: clojure.contrib.seq-utils
15:12amalloy&(require 'clojure.contrib.seq-utils)
15:12sexpbotjava.io.FileNotFoundException: Could not locate clojure/contrib/seq_utils__init.class or clojure/contrib/seq_utils.clj on classpath:
15:12KjellskiWhat a mess, sorry but where do I need to look at if I want to see just the latest docs?
15:12amalloybah
15:12kotarakKjellski: http://clojure.github.com/clojure (resp. ....-contrib)
15:13Kjellskikotarak: Thanks in advance for the next years ^^
15:13tonyl:P
15:13kotarakKjellski: you are welcome >^.^<
15:23tonyl&(reduce + (map #(Integer/valueOf (str %) 10) (remove #(= % \.) (subs (str Math/PI) 0 4)))
15:23sexpbotjava.lang.Exception: EOF while reading
15:23tonyl&(reduce + (map #(Integer/valueOf (str %) 10) (remove #(= % \.) (subs (str Math/PI) 0 4))))
15:23sexpbot⟹ 8
15:26amalloytonyl: #{\.} is the same as #(= % \.)
15:28tonylwow
15:29tonylhow if it is a set ...
15:29tonyl &(reduce + (map #(Integer/valueOf (str %) 10) (remove #{\.} (subs (str Math/PI) 0 4)))
15:29kotarak,(#{\.} \.)
15:29clojurebot\.
15:29tonyloh man
15:29raekwell, a set used as a function will not return true/false, but the-element/nil
15:29kotarak,(#{\.} \a)
15:29clojurebotnil
15:29amalloy&(map #{:a :b :c} [1 2 3 :a 3 :b])
15:29sexpbot⟹ (nil nil nil :a nil :b)
15:30raekbut for truthiness, it's requivalent
15:30tonyli knew that and i can't still wrap my head around the possibilities
15:30tonyl&(reduce + (map #(Integer/valueOf (str %) 10) (remove #{\.} (subs (str Math/PI) 0 4)))
15:30sexpbotjava.lang.Exception: EOF while reading
15:30raek:)
15:30kotarak,(some #{false} [true true false true]) ;:P
15:30clojurebotnil
15:31tonyl&(reduce + (map #(Integer/valueOf (str %) 10) (remove #{\.} (subs (str Math/PI) 0 4))))
15:31sexpbot⟹ 8
15:31amalloytonyl: my favorite example of using objects as functions: ##(filter (comp #{"david"} :first) [{:first "steve" :last "smith"} {:first "david" :last "roberts"}])
15:31sexpbot⟹ ({:first "david", :last "roberts"})
15:31tonylcomposing a set and a keyword
15:32tonylthanks guys, clojure doesn't stop amazing me
15:34KjellskiSomebody with a fresh install of clojurebox arround? Could you try to define a namespace in a file buffer and use C-c C-c to run?
15:37alpheuskotka has a nice write-up on bound-fn: http://kotka.de/blog/2010/05/Did_you_know_IV.html
15:37KjellskiRight now, C-c C-c over (ns foo.bar) leads to "No such namespace: de.kjellski.games.bagels [Thrown class java.lang.Exception]" ...
15:45raekKjellski: does the same thing happen with C-x C-e and C-M-x ?
15:45raek(I don't have clojurebox)
15:45taliosMorning.
15:46Kjellskiraek: Hmmmm, that leads somewhere... it seems to work with C-x C-e when I´m at the end of the whole sexp...
15:48Kjellskiraek: And surprisingly the C-c C-c works there as well....
15:48Kjellskiraek: At least a nice workarround, thanks!
15:49raekKjellski: C-M-x should work "in the middle"
15:50Kjellskiraek: There you go, thanks, it works in the middle as well =)
15:51Kjellskiraek: =( but I was already used to C-c C-c in the last version of ClojureBox...
15:54amalloywell, i guess he left. but emacs does the same thing for C-c C-c, if you haven't already compiled the whole file once with C-c C-k, in my experience
15:57sthuebne_I've just noticed technomancy's and cemerick's tweets regarding version ranges. That reminded me to ask, how the DSL for Lein/Maven/anythng is coming along?
16:00pppaulanyone think that something like this would be useful in contrib?
16:00pppauluser=> (def matrix [[1 2][3 4]])
16:00pppauluser=> (map-2d #(* % 2) matrix)
16:00pppaul((2 4) (6 8))
16:00pppaul((user=> (map-2d #(* %1 %2) matrix matrix)
16:00pppaul((1 4) (9 16))
16:02pppaulor something like a function/macro that is a nested map of n depth?
16:03pppaulor, am i nuts?
16:04LauJensenYou guys know when you do a SELECT statement in the mysql client, you get a really nicely formatted table as the output? Do we have a pretty printer for that in clojure-land ?
16:05pppaulthere is a pprint
16:05pppaulcontrib.pprint and core
16:05LauJensenpppaul: I know, but does it handle resultset-seqs ?
16:06pppaulexample?
16:06clojurebotexamples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples
16:06kotarakLauJensen: you can specify format strings on steroids.
16:06kotarakkind a map-like
16:07kotarak(the function map, not the structure map)
16:07sthuebne_format is voodoo
16:07LauJensenAh right, format might be the ticket. It would have been in CL thats for sure
16:08LauJensenthanks kotarak
16:08LauJensenkotarak: btw, clojureql 1.0.0-beta1 release is now imminent :)
16:08kotarakyou are welcome, my danish friend
16:08kotarakLauJensen: I'm following it.
16:09LauJensenHopefully tomorrow or the day after at the latest
16:10scottjwhat did you guys think of clojurize?
16:11LauJensenscottj: is it a movie that just came out?
16:11sthuebne_LauJensen: BTW: what's the state of affairs regarding DSL for pom/project.clj
16:11sthuebne_=
16:11sthuebne_?
16:11LauJensensthuebne_: read the google group 'project.clj spec'
16:11sthuebne_oh
16:11sthuebne_I wasn't aware of that
16:12stuartsierraThe State of Affairs is: Growling and gnashing of teeth
16:12scottjhttp://anvil.io/2010/10/25/clojurize-the-data-not-the-database.html
16:12sthuebne_LauJensen: thanks for the pointere!
16:12sthuebne_Jesus, I miss my keyboard
16:13LauJensenscottj: its not really interesting to me
16:13LauJensensthuebne_: nps :)
16:13scottjLauJensen: why? it seems very similar to clojureql
16:14LauJensenscottj: Its totally different. Its based on SQL
16:26clizzin1this is a pretty dumb question, but how do i convert a map to a sorted-map?
16:27amalloyclizzin1: ##(into (sorted-map) {1 2. :a 4})
16:27sexpbotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Keyword
16:27amalloybleh whatever. do it like that
16:28clizzin1thanks amalloy!
16:33LauJensenI need the latest artifact for clojure.contrib.sql, where do I find its group/artifact-id ?
16:36taliosLauJensen: that
16:36kotarakorg.clojure.contrib/sql maybe?
16:36taliosthat's mentioned in the pom - https://github.com/clojure/clojure-contrib/blob/master/modules/sql/pom.xml - org.clojure.contrib:sql
16:36LauJensenkotarak: I dont need the name itself as much as I need a method for getting that an other artifact names. hudson isnt being very helpful
16:36LauJensenah right
16:37LauJensenAnd these modules are only available from 1.3.0 right?
16:37taliosI believe so yes.
16:37taliosthe split up was post 1.2
16:42clizzin1if i want to write a custom compare function in clojure for use in sort-by, how do i make it implement java.util.Comparator?
16:43sthuebne_stuartsierra, LauJensen Now, I'm up-to-date. A clash of philosophies.
16:43LauJensensthuebne_: What are we talking about now?
16:43sthuebne_sorry ,-)
16:43sthuebne_project.clj
16:43LauJensenooh :)
16:45sthuebne_What is the goal of a unified DSL for describing builds?
16:47LOPPclizzin all functions are comparators
16:47clojurebotfunctions are maps
16:47sthuebne_the existing build tools, that happen to use similar dialects for build specs, work very different. on purpose I suppose
16:47LOPPthey will fail to work if they don't have 2 arguments
16:48LauJensensthuebne_: Ease of implementing these. Right now consumers of project.clj have to make 1 implementation for each build tool
16:48LauJensenEven simple builds fail to run of all 3 tools, which sucks
16:48sthuebne_I see that.
16:51sthuebne_it seems, that only simple builds are likely to be portable between the three
16:51LauJensenTrue
16:52sthuebne_correct me if I'm wrong, but Lein plugins work very different (on a different level) than Maven plugins.
16:52LauJensenVery differently
16:52taliosI think the goal of a unified DSL for builds is good, but fundamentally flawed.
16:53sthuebne_there might be a chance to align plugin names and to make sure, that plugins exist in both/all three worlds
16:53LauJensensthuebne_: http://stackoverflow.com/questions/3906276/whats-the-difference-between-cake-and-leiningen - See lancepantz reply
16:53sthuebne_that provide the same behaviour
16:53taliossthuebne_: really? you're going to implement EVERY SINGLE MAVEN PLUGIN?
16:53taliosejb? xml paring? osgi?
16:53sthuebne_talios: no!
16:54taliossthuebne_: and thus dies the aim of a cross build that works :(
16:54sthuebne_I was thinking of the opposite - have maven plugins where Leiningen's plugins are unique
16:54sthuebne_but that seems sort of stupid as well
16:55sthuebne_why multiplying efforts
16:55taliostrue, but given anyone can create lein plugins, and people often do ( such as Brian Marrick's midge plugin ) - it'll be an endless game of rinse and repeat
16:55sthuebne_exactly
16:55technomancyI don't really understand the motivation. Do you see people wanting to use make to build clojure because they are opposed to greenspunning?
16:55taliosunless you mean "core" plugins
16:56taliostechnomancy: autoconf for the win :-)
16:56taliosthey don't even use make anymore :)
16:56technomancytalios: I almost said autoconf but didn't want to give anyone the shivers =)
16:57taliosyou're too nice then.
16:58LauJensenI would really love a Clojurish build tool which plugged into the entire Maven world, plugins going back and forth etc
16:59LauJensenI will call it : Mavadvenjure
17:00taliosLauJensen: if it's declaritve only, it could be doable. but the moment you bring in any form of dynamic scripty ness, you lose that two-way round trip. as the DSL builds a model that can't generate itself (only its canonical representation)
17:01sthuebne_I head a brief chat with Jazon van Zyl earlier this year. I was asking him (since pmaven was new to me back then), whether pmaven would provide anything like a "scriptable" build.
17:01talioswhich, when you look at things like the maven-release-plugin which update version numbers, could be an issue.
17:01taliossthuebne_ - my origin clojure-pmaven work had full scriptable ness, to generate the model.
17:02taliosas does the groovy and scala versions
17:02sthuebne_yeah, that's what they do - they generate the model
17:03taliosthat's really all they can do, its also what gradle does
17:03sthuebne_maybe I didn't understand the current implementation of it, but it seemed to me to be really just a different language to describe the model. how would you add dynamics?
17:04LauJensenI hate to leave in the middle of this, but I have to, goodnight everybody
17:04taliosmmm, i see the wiki's not been updated, but in my original code, you could do: (if-not (contains-plugin? main "some.groups:plugin")
17:04talios (add-plugin! main ["some.groups:plugin:1.0" {:configuration {:name "value"}}]))
17:05taliosdynamically adding a dependency, you could dynamically modify/update/add plugins etc.
17:05taliosI guess the core question to ask is.... what kind of dynamic nature do you want.
17:06LOPPI often see #' in the code
17:06LOPPI forgot...when am I supposed to use that
17:07cemerickLOPP: that give you the named var, rather than its value
17:07cemerick&#'+
17:07sexpbot⟹ #'clojure.core/+
17:07cemerick&+
17:07sexpbot⟹ #<core$_PLUS_ clojure.core$_PLUS_@b5f87c>
17:07cemericksame as (var +)
17:07LOPPok but why do you use that
17:07talios'lo cemerick
17:08cemerickLOPP: so you can do things with vars instead of their values :-)
17:08cemericktalios: afternoon :-)
17:08taliosmorning :-) 11:11am here.
17:08sthuebne_talios: grep doesn't find any "add-plugin" on master
17:08cemericktalios: damn! :-P
17:09sthuebne_sorry, I've started it.
17:09taliossthuebne_: sadly when antony ported/rewrote my initially implementation he removed all those dsl things ;(
17:10sthuebne_I was late to the project.clj--spec discussion in the first place
17:10sthuebne_that's a long time indeed
17:11talioswork and the podcast got in the way, along with the realization that it was mostly a futile effort.
17:12sthuebne_from the current perspective it's just a different language to express the very same thing
17:12taliosthat looses the two-way roundtrip nature, and breaks the ecosystem.
17:13sthuebne_realizing that, I was asking myself what the actual point would be, to have a clojure-ish POM
17:14taliosXML is evil didn't you know?
17:15sthuebne_sure, whatever they say
17:17stuartsierratalios: any idea why this fails?
17:17stuartsierrahttp://build.clojure.org/job/clojure-testbuild/8/console
17:17LOPPis there a reason not to use #'x instead of x?
17:18sthuebne_its verbose, OK. but honestly, I can write POMs for fairly complex builds by just using nXML in Emacs and nobody ever exposed me to a build tool, that wouldn't force me to write my builds in one or another language myself
17:18amalloyLOPP: they're different things
17:18Raynes&(macroexpand '#'blah)
17:18sexpbot⟹ (var blah)
17:18amalloy&(#'first first)
17:18sexpbotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$first
17:18amalloy&([#'first first])
17:18sexpbotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: PersistentVector
17:18Raynes&(macroexpand first)
17:18sexpbot⟹ #<core$first clojure.core$first@615dc4>
17:18amalloydamn it. whatever
17:18amalloy&[#'first first]
17:18sexpbot⟹ [#'clojure.core/first #<core$first clojure.core$first@615dc4>]
17:18LOPP&(#'first [1 2])
17:18sexpbot⟹ 1
17:18Raynes#'something is just shorthand for (var something)
17:19LOPPsince #'first works just as well as first, why not always use #'?
17:19amalloyLOPP: #' only works for things that *have* vars
17:19RaynesWhy would you want to do that in the first place?
17:19amalloy(or are vars, if you prefer)
17:20LOPPbecause I have code that uses values
17:20RaynesSince (identity (identity (identity 5))) works as well as 5, why not always do that?
17:20LOPPthen it turned out I had to use #' in various places for it to work properly
17:20LOPPthat got me thinking, why not preemptively use #' everywhere I can
17:20LOPPso far I can see no reason
17:21amalloyLOPP: it's a terrible idea. why not check (foo != null) every time you call a method on foo, just in case it's become null when you weren't looking?
17:21amalloyin both cases, you're better off actually understanding the difference
17:22taliosstuartsierra: hmmm, is clojure.java.io.Coercions a .java or .clj file? if the later my guess is the namespace is turning up later in the build path? If you run mvn with -X and get all the debug output we can see the actual command line we're calling
17:22stuartsierraneither, it's a protocol defined in io.clj
17:23LOPPthe problem is where I use lists of listener functions subscribed to events
17:23LOPPif I change the function the handler of course doesn't
17:23LOPPbut ok
17:23LOPPhere's another question
17:23LOPPwhy is conj '[1 2 3] faster than conj [1 2 3]
17:24LOPPsorry
17:24amalloyLOPP: if you want to change things, my suggestion is to use something with real STM semantics, like an atom, instead of abusing vars
17:24stuartsierratalios: What I don't get is that it works the first time, when it does "mvn clean verify" then fails when it does "mvn deploy"
17:24LOPPthe whole map is in a ref
17:24LOPPbut it's a map of vectors of sets
17:25LOPPno matter
17:25LOPP&(time (dotimes [n 100000] (conj '[1 2 3] 4)))
17:25sexpbot⟹ "Elapsed time: 14.451 msecs" nil
17:25LOPP&(time (dotimes [n 100000] (conj [1 2 3] 4)))
17:25sexpbot⟹ "Elapsed time: 29.008 msecs" nil
17:26LOPPwhy the difference?
17:26amalloyyou want to...what, be able to change the definition of a listener function with a new defn, and have the objects who were tracking those automagically use the new function of the same name?
17:26taliosstuartsierra: right - i see no reference to io.clj being compiled before hand in the deploy step, but it does in the first set. thats.... weird.
17:26amalloyi mean, yes, that's kinda what vars are for, but it seems like a weird thing to want
17:27LOPPdon't worry, I'm just messing around a bit... don't really need the solution right now
17:27RaynesLOPP: Well, it isn't evaluating anything inside of the vector, for one.
17:28RaynesI'm not exactly sure why it would be faster.
17:28LOPPhere's another problem I have a very unelegant solution for: you have a vector of sets and you need to return a vector of sets where all the intersecting sets are combined
17:28taliosstuartsierra: if you configure maven to run with -X we can see if the plugins just not telling the compiler to compile io, or if its clojure itself.
17:28LOPPyeah it's weird...I mean, won't it have to evaluate that eventually?
17:29amalloyall the...intersecting sets are combined? what do you mean by "intersecting" and "combined" here? or give a small-scale example?
17:30_mstI remember something (from the clojure group, probably) about the quoted form allowing the reader to create the vector data structure once up front and reuse it for each call
17:30LOPPsure
17:30_mstwhereas the unquoted variant would create a new vector for every iteration
17:30_mstbut that might be complete rubbish... or I might have dreamt it. I can't find where I read it :)
17:30stuartsierratalios: ok, running now at http://build.clojure.org/job/clojure-testbuild/10/console
17:30LOPP[#{:a :b :c} #{:c :d} #{:e :f}] -> [#{:a :b :c :d} #{:e :f}]
17:31LOPP[#{:a :b} #{:c :d} #{:b :c :e}
17:31LOPP-> [#{:a :b :c :d :e}]
17:31amalloyi see
17:32LOPPI did it but it was ugly as hell
17:32LOPPvery javaish
17:33amalloyoff the top of my head, it looks like you want to use reduce, some, and update-in to do the heavy lifting
17:33stuartsierratalios: Nuts, same failure, no new information.
17:34sthuebne_talios, stuartsierra the order clj-files are compiled is completely different in both steps
17:34stuartsierrayes, I think that has something to do with it
17:34stuartsierrabut in theory it shouldn't matter
17:36stuartsierraclojure.java.shell declares :use on clojure.java.io, so clojure.java.io should get compiled automatically when you try to compile clojure.java.shell
17:36jarpiainLOPP: (conj '[1 2 3] 4) and (conj [1 2 3] 4) generate exactly same bytecode in 1.3
17:37stuartsierrawait a minute
17:38stuartsierra"Exception… at clojure.java.shell__init.<clinit>(Unknown Source)"
17:38taliosstuartsierra: i thought use didn't alter order, but require did
17:38stuartsierratalios: Nothing alters order, but any ns that loads other namespaces will cause them to be compiled when it is compiled.
17:38stuartsierra*BUT*
17:38stuartsierraIn this instance, clojure.java.shell is being loaded from a .class file, not from source.
17:39stuartsierraI don't know why
17:39taliosHrm
17:39LOPPI don't see where I'd use update-in, I have no nesting
17:40amalloyyeah, i'm wrong about that part :P
17:40amalloyi'm writing it now
17:42taliosstuartsierra: weird, in the deploy/release phase, that .class shouldn't yet exist as target/checkout/classes should be where it's looking..... *blink* or is the plugin looking at the wrong place and finding the .class from target/classes ( which would explain it )
17:43LOPPI basically combined each set with other set and compared sizes, if it wasn't the sum of the 2 sets I combined then they intersect. However that only works for 2 individual sets, so I had to do iterations of this and I had to rotate which set I started the iteration with. In the end quite ugly.
17:43stuartsierraThere's something screwy going on with directories, that's for sure.
17:43taliosodd that -X didnt give the debug info I expected
17:44stuartsierraIt's becasue the deployment is being controlled by the Sonatype OSS release parent POM
17:44taliosI'll do some digging when I get home tonight
17:44stuartsierratalios: ok, thanks, appreciate it
17:44sthuebne_talios: it should report the classpath for plugins, shouldn't it?
17:46taliossthuebne_: in this instance its not the classpath of the plugin that's actually the problem, more the directories being configured for it.
17:46taliosI suspect I've hardcoded a target/classes reference
17:46taliosor more "outputdirectory/classes"
17:47sthuebne_but that should work in case of "release:perform" a ka deploy as well
17:48taliosbut in this case, that {outputdir}/classes still has the .class files from the prepare phaze
17:48taliosa work around could be release:prepare clean release:perform
17:49amalloyLOPP: https://gist.github.com/0557059ea1585b322cec
17:49sthuebne_are you shure about that?
17:49amalloynot very elegant, but functional (pun intended)
17:49sthuebne_release:perform forks a new maven process on a different dir
17:49sthuebne_which is target/checkout
17:50sthuebne_so, how could the clojure plugin in that other process get hold of the .class files of the former?
17:51taliosi have NO idea :) the clean step would just proove that. it's possible I'm looking at the wrong var and the one I'm looking at it always "target"
17:53sthuebne_OR does one of the profiles do something fishy with sourceDir/outputDirß
17:55LOPPI'll check it out
17:56LOPPabout 3 times shorther than what I wrote
17:56LOPP:)
17:56LOPPmake that 5
17:57amalloyoh, i didn't include it in the gist, LOPP, but you have to (use 'clojure.set)
17:57taliossthuebne_ - not sure, the log says its all looking at target/checkout/target/* so I'm confused. tho I can't look at it just now work. darn day job ;)
17:58LOPPright...what does clojure.set do anyway?
17:58amalloyintersect, union, that sort of stuff
17:58LOPPall those fns are too complicated
17:58amalloyyou can write your own union with into, but i assume clojure.set does it better
18:00quizmeare the clojure conj videos posted online?
18:01LOPPwhat's old-form arg in if-let?
18:02amalloyLOPP: something deprecated, don't use it
18:03sthuebne_talios: well, my day job is starting in about 7hrs. So I say n8 for now
18:03chouser& (if-let a 5 true)
18:03sexpbotjava.lang.IllegalArgumentException: if-let requires a vector for its binding
18:05mjg123Hello - is "init" a special name for clojure in deftype'd types?
18:05mjg123If I wanted to implement javax.servlet.Servlet#init(ServletConfig), how could I do that?
18:07mjg123I tried: javax.servlet.Servlet (init [this config] ( ... something ... )) - but no init() method is generated in the .class file
18:07amalloy&(if-let a 5 true false)
18:07sexpbotjava.lang.IllegalArgumentException: if-let requires a vector for its binding
18:09bhenrychouser amalloy ???
18:09amalloybhenry: trying to figure out how to use the old form of if-let to tell LOPP what not to do. fortunately (i guess?) it's hard
18:10LOPP:D
18:10LOPPyeah :)
18:10LOPPwell I won't use it
18:13pppaulcan i use cons cells as keys in my hash-map?
18:14pppauli'm trying and they aren't working... i day or so ago i thought i did some tests that showed i could... maybe they were flawed?
18:15pppaulforest
18:15pppaul{(1 0) :grass, (0 0) :tree, (1 1) :grass, (0 1) :grass}
18:16pppaulthat is the hash-map i have, but i have trouble using (get) on it
18:17pppauloh i was using get wrong (arg pos was in wrong order)
18:17dnolen,{[1 0] :grass, [0 0] :tree, [1 1] :grass, [0 1] :grass}
18:17clojurebot{[1 0] :grass, [0 0] :tree, [1 1] :grass, [0 1] :grass}
18:18dnolen,((juxt [1 0] [0 0] [1 1] [0 1]) {[1 0] :grass, [0 0] :tree, [1 1] :grass, [0 1] :grass})
18:18clojurebotjava.lang.IllegalArgumentException: Key must be integer
18:18dnolenoops
18:22pppaulcons cells work
18:22pppauli was using get like this (get :key :map)
18:22LOPPhm amalloy your code for sets doesn't work
18:22LOPP(def sets [#{:a :c :b} #{:d :e} #{:c :e}])
18:23LOPP(#{:a :c :b :e} #{:d :e})
18:23LOPPwhich is wrong result
18:24LOPPI had the same problem, in one pass I only paired the first set with all I could find, but not the others
18:29tonylLOPP do you need to keep the number of sets in the vector? or can it be just one holding all the results?
18:44amalloyLOPP: ah, right. because it's not going back and filtering in old sets that now match
18:44amalloytricky
18:45LOPPyes
18:45LOPPthat's the thing...by combining sets you get new matches
18:46nickikis there a function to write a vector one value per line into a file
18:46amalloyi did something like this in CL in like...april, i think. but there was a guarantee that the final result would be exactly two sets
18:47LOPPone thing you can do is maybe put iterate around it and check for when the sequence stabilizes
18:47amalloyyeah, i was thinking that too. so gross :P
18:48LOPPin any case this is one devilishly complex problem yet it looks so simple, a human can do it easily
18:48amalloyLOPP: a human can do it easily for small numbers of small sets
18:48LOPPthat's true
18:49tonylnickik: something like (doseq [x myvec] (spit myfile (print-str x \newline))
18:49LOPPwell I did the thing with iterate and the seqence doesn't stabilize, the order of sets keep changing even though the sets themselves don't
18:50amalloyhah
18:50tonylLOPP: does it have to keep the number of sets in the vector?
18:50amalloywell, that's easy though
18:50amalloyjust have it operate on a set instead of a vector
18:51tonylor can it output all the items in 1 set as a result
18:51powr-tocdoes anyone know what happened to clojure.contrib.repl-utils/show ?
18:51powr-tocI've just updated to 1.2.0
18:51amalloypowr-toc: i it's in clojure.repl now, i think
18:51powr-tocamalloy, I can't see it in there
18:51amalloyor maybe not? i always lose it too
18:51LOPPbut you want the sets to rotate
18:52LOPPbecause otherwise you might get stuck as in some cases you keep picking same first set as the starting set
18:52LOPPand you might not progress
18:52kjellskiWhat is the right way to look at wethere a seq contains an element or not?
18:52amalloykjellski: ##(doc some)
18:52sexpbot⟹ "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
18:53amalloyLOPP: ? every iteration you'll be removing one element
18:53kjellskiamalloy: ty
18:53powr-tochas show been removed from contrib?
18:53tonyl&(apply union [#{:a :c :b} #{:d :e} #{:c :e}])
18:53sexpbotjava.lang.Exception: Unable to resolve symbol: union in this context
18:54raekpowr-toc: don't think so
18:55powr-tocraek, Then where is it?
18:55tonylit is not in clojure.contrib.repl-utils/show ?
18:55amalloytonyl: ##(use 'clojure.set)
18:55sexpbot⟹ nil
18:55tonyl&(apply union [#{:a :c :b} #{:d :e} #{:c :e}])
18:55sexpbot⟹ #{:a :c :b :d :e}
18:56raek&(clojure.contrib.repl-utils/show Object #"toString")
18:56sexpbotjava.lang.ClassNotFoundException: clojure.contrib.repl-utils
18:56raek&(require 'clojure.contrib.repl-utils)
18:56sexpbotjava.io.FileNotFoundException: Could not locate clojure/contrib/repl_utils__init.class or clojure/contrib/repl_utils.clj on classpath:
18:56tonyl&*clojure-version*
18:56sexpbot⟹ {:major 1, :minor 2, :incremental 0, :qualifier ""}
18:56raekwell, I used it yesterday
18:57amalloyit's around /somewhere/, but it always takes me ages to find it
18:57powr-tocraek: it seems to have vanished for me too :-\
18:57tonyl&(find-doc "^show")
18:57sexpbot⟹ ------------------------- clj-time.format/show-formatters ([] [dt]) Shows how a given DateTime, or by default the current time, would be formatted with each of the available printing formatters. ------------------------- clj-github.gists/show-gist ([auth id file-... http://gist.github.com/702762
18:57powr-tocsurely clojure.repl would be a good place for it
18:57raekpowr-toc: which version?
18:57powr-toc1.2.0
18:58powr-tocof contrib and clojure
18:58tonylit is in my local contrib
18:58Raynesraek: Something weird about sandboxes causes *some* contrib things to simply disappear in the sandbox. It appears to happen across all sandboxes.
18:58powr-toctonyl: is that 1.2.0 though?
18:58tonylyeah
18:59tonylboth clojure and contrib
18:59tonyluser=> (find-doc "^show")
18:59tonyl-------------------------
18:59tonylclojure.contrib.repl-utils/show
19:00raekpowr-toc: works in my 1.2 repl
19:00amalloymaybe you need lein deps to pull in contrib?
19:00powr-tocraek: oh right enough it is in repl-utils
19:01powr-tocfind-doc wasn't showing it... but I guess I hadn't loaded the namespace
19:02tonyl&(require '[clojure.contrib.repl-utils :as repl-utils])
19:02sexpbotjava.io.FileNotFoundException: Could not locate clojure/contrib/repl_utils__init.class or clojure/contrib/repl_utils.clj on classpath:
19:02raekah, yes. find-doc will only look at the loaded vars...
19:13kjellskiI´ve got a seq of vectors and want to compare the second values in these vectors, what´s the most idiomatic way?
19:15amalloycompare them how? i mean, to get out a seq of the second elements you can just (map second seq-of-vectors)
19:16kjellskiamalloy: compare them by =
19:17amalloykjellski: you're not saying what you want to /do/ with the results of the comparison. do you want to group the vectors by second element, for example?
19:18kjellskiI have a sequence like this ([0 \a] [1 \b] ...) and a second one that goes just like this one... now I want to find the position of the elements that are =
19:19kjellskiamalloy: the index is already in the first elements by map-indexed....
19:22raek(map #(= (second %1) (second %2)) seq1 seq2)?
19:23raekah. just read the rest of the text. neverminf.
19:23amalloykjellski: sorry, i still don't understand what you're trying to do
19:23kjellskiamalloy: just a sec, preparing a snipped ^^
19:24kjellskiamalloy: I´m trying to translate this python function into clojure: https://gist.github.com/702785
19:24pppaul&(take 2 {:a 1 :b 2 :c 3 :d 4})
19:24sexpbot⟹ ([:a 1] [:b 2])
19:25pppaulhow do i feed that into another map using assoc, or something else?
19:25amalloyah
19:26kjellskipppaul: ##(into {} (take 2 {:a 1 :b 2 :c 3 :d 4}))
19:26sexpbot⟹ {:a 1, :b 2}
19:26amalloyi think map-indexed is likely just getting in the way, but no matter
19:26kjellskipppaul: where {} is your other map?
19:26pppaulsame map
19:27pppauli want to do some work on a seq, and assoc back into the map
19:27amalloypppaul: why not use update-in?
19:27pppaulcool, i'll look at that
19:27kjellskiamalloy: I´m still trying to find the right way ^^ open for every solution =)
19:28pppauli'm using this site to help me with the hash-map stuff http://clojure.org/data_structures#Data%20Structures-Maps%20%28IPersistentMap%29
19:28pppaulis there a better place i should be looking at?
19:30amalloy&(let [[answer guesses :as data] [[1 2 3] [4 2 1]]] (map = data))
19:30sexpbot⟹ (true true)
19:31amalloy&(let [[answer guesses :as data] [[1 2 3] [4 2 1]]] (apply map = data))
19:31sexpbot⟹ (false true false)
19:31amalloykjellski: enough to get you headed in the right direction, maybe?
19:32kjellskiamalloy: yeah, I hope so... thanks for the start =)
19:55KirinDaveHum
19:56KirinDaveDoes anyone here use clojure w/ flume?
19:56KirinDavePerhaps have a reference to a library? Google is coming up empty
20:28vIkSiTlo all
20:28vIkSiTanyone here use clojure with hadoop?
20:28vIkSiTI'm looking for pointers on libs/docs to get started..
20:31hiredmanvIkSiT: many do, I don't, but most seem to use cascading and cascalog
20:31vIkSiThmm, cascalog I guess would mostly be for querying large datasets.
20:32vIkSiTI'll check out cascading, thanks. Looking for something a bit more low level though.
20:42tomojvIkSiT: I use it, have no pointers
20:42tomojam looking for pointers myself
20:42tomojI must not understand clojure-hadoop
20:44vIkSiTtomoj, hehe, you mean you do use clojure-hadoop?
20:44vIkSiTor you dont? (I can't get it to install using lein, for instance)
20:45vIkSiTand get into dependency hell if i use it manually in lib/, since lein deps cleans out the lib dir each time!
20:46tomojpaste your project.clj?
20:47vIkSiTsec
20:47tomojdid you add stuartsierra's maven repo?
20:48vIkSiThmm
20:48vIkSiTi didnt actually.
20:50vIkSiTtomoj, http://pastebin.com/mMgM2F9d
20:50tomoj:repositories {"stuartsierra-releases" "http://stuartsierra.com/maven2&quot;}
20:50vIkSiThow exactly do I add that maven repo, btw?
20:50vIkSiTwow, I didn't know that format worked in lein.
20:50tomojyou may also need to add [org.apache.hadoop/hadoop-core-with-dependencies "0.18.3"]
20:50tomojnot sure
20:51tomojso far I jar after every change, it's terrible
20:51tomojI'm sure there's a better way with clojure-hadoop
20:51vIkSiThmm.
20:51tomojbut I don't want to be stuck on 0.18.3 either..
20:52vIkSiTgah.
20:52technomancywe ended up ditching hadoop largely because of problems like this
20:53tomojfor what?
20:53technomancyconduit, through a circuitous route
20:53vIkSiTI'm still stuck with this : http://paste.lisp.org/display/116749
20:53technomancygranted if you need HDFS there's not really a good alternative.
20:53technomancybut we have lots of small files that we can't afford to keep anywhere but s3
20:53amrkconduit? i don't think I've heard of that one..
20:54technomancyclojurebot: google clojure conduit
20:54clojurebotFirst, out of 235 results is:
20:54clojurebotStream Processing in Clojure - intensivesystems.net
20:54clojurebothttp://intensivesystems.net/tutorials/stream_proc.html
20:54technomancyclojurebot: botsnack
20:54clojurebotthanks; that was delicious. (nom nom nom)
20:54tomojhmm
20:54vIkSiTtomoj, my project.clj is updated btw. let me refresh that
20:54vIkSiTtomoj, http://paste.lisp.org/display/116749#1 is the project.clj
20:55tomojvIkSiT: still not working?
20:56tomojthere is no clojure-hadoop 1.2.0, is there?
20:57tomoj1.2.0-SNAPSHOT is the latest in the repo
20:57tomojbut not published
20:57tomoj(git repo)
20:57tomojthe latest in his maven repo looks like 1.1.0
20:58vIkSiToh hmm
20:58vIkSiTargh. I didn't notice that, thanks for the pointer tomoj
21:01vIkSiTtomoj, btw, why is that version of hadoop-core-with-deps at 0.18.3?
21:01tomojthat's the one clojure-hadoop is compatible with
21:04vIkSiTah I see.
21:04vIkSiTtomoj, I'm pretty sure hadoop can be used directly from clojure too?
21:04vIkSiTrather than have a bunch of wrappers around it?
21:04vIkSiThas anyone tried that here?)
21:09tomojsee in clojure-hadoop
21:09tomojread the examples in order
21:10tomojwordcount1 just works directly on the hadoop api
21:10tomojwith some helpers
21:12tomojif you want to target a more recent version of hadoop I guess you will have to do it raw too
21:12vIkSiTtrue
21:13vIkSiTtomoj, do you have any public repos of code that works? I've been trying experiments with alexott's clojure-examples/hadoop, but no luck so far..
21:13tomojno, I don't have anything I can publish
21:14tomojdid you already try the examples in clojure-hadoop?
21:15tomojalexott's example looks like it should work
21:16tomojif you jar it up, you can run it like this:
21:17tomoj java -cp "lib/*:com.example.foo-0.1.0-SNAPSHOT.jar" clojure_hadoop.job -job com.example.foo.jobs/bar -input input/foo -output output/bar
21:17tomoj(but there must be a better way)
21:25vIkSiTtomoj, hmm, looks like clojure-hadoop-job might be a different jar altogether
21:26mattmitchelli have a clojure.lang.PersistentStructMap instance, that looks like this: {:count(*) 521845} -- how do i get the value?
21:27hiredmanclojurebot: how can mattmitchell get teh value?
21:27clojurebotTitim gan éirí ort.
21:27mattmitchelli've tried (:count(*) my-struct) but that doesn't do it
21:29hiredman,(*)
21:29clojurebot1
21:29hiredman,(:count 1 {})
21:29clojurebot{}
21:29tomojvIkSiT: huh? clojure_hadoop.job is surely in the clojure-hadoop jar I use
21:30tomoj,(:count(*) "fnord")
21:30clojurebot"fnord"
21:32tomojwhy do you have a struct-map with a "count(*)" field?
21:33mattmitchelltomoj: this is the result from a mysql select
21:33tomojI see
21:33tomojmaybe munge the keys?
21:34mattmitchelltomoj: this seems to work, but awkward: (last (first (seq (first my-struct))))
21:34tomojotherwise you will have to do (def count-* (keyword "count(*)")) (count-* my-struct) or (get my-struct (keyword "count(*")))
21:34hiredmanis it really a keyword?
21:34mattmitchelltomoj: sorry i should've mentioned the struct it wrapped in a list as well
21:35tonylor query with count(*) AS mycount
21:35mattmitchelltomoj: yeah thanks, the helps
21:35dakrone,(get {(keyword "count(*)") 1} (keyword "count(*)"))
21:35clojurebot1
21:35dakroneugh, that's ugly
21:36tonyl${(keyword "count(*)") 343}
21:36tonyl&{(keyword "count(*)") 343}
21:36sexpbot⟹ {:count(*) 343}
21:36tomojdo you create a new struct for every query?
21:37mattmitchelltomoj: it seems to work that way yes, this is using the sql stuff from clojure contrib
21:37tonylyou can change your query a bit and use it like this SELECT COUNT(*) AS mycount FROM mytable;
21:37tomojoh
21:37tomojI'm using the sql stuff from clojure contrib too
21:37tonylooh ok
21:37tomojI hadn't tried counting yet I guess
21:37tonylhaven't used that
21:37jweiss_anyone know why github won't highlight this code? https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj
21:37tomojI despise c.c.sql
21:38hiredmanjweiss_: I think it's too big, the hilighter chokes
21:38jweiss_ah
21:38mattmitchelltonyl: yeah the "count as" is much better thanks
21:39tonylI need a help in speed
21:39tonylin this code: (reduce + (filter even? (take 4e6 (clojure.contrib.lazy-seqs/fibs))))
21:40tonylcan't make it run any faster when it is 4e5 or higher
21:40tonylit gives the result back fast when it is 4e4 or less
21:47tonylfreaking computer froze
21:49tonyl&(reduce + (filter even? (take 4e2 (lazy-seqs/fibs))))
21:49sexpbotjava.lang.Exception: No such namespace: lazy-seqs
21:54tonylcan anybody help me to speed up this snippet
21:54tonyl(reduce + (filter even? (take 4e6 fibs)))
21:55tonylit takes forever (never stops) from 4e5 up
21:56tonylfibs is a fn: (reduce + (filter even? (take 4e6 (fibs))))
22:04tonylIam guessing the overload is in the filtering, it is pretty high numbers
22:05amalloytonyl: unlikely. i think it's just in generating (fibs)
22:05amalloythe four millionth fibonacci number is quite large, which means the jvm is doing a lot of math with BigIntegers to get to it
22:05amalloyand that's a /lot/ slower than ints or longs
22:06tonylyeah i saw a snippet of the fib, those are big numbers
22:09amalloytonyl: (fib n) grows about as fast as (exp 2 n), so it becomes infeasible after a while
22:11tonylI'm trying to figure out how to break down the computation than
22:11tonylI am trying the project euler challenges and I am stuck in number 2 :P
22:11pppauluse the phi equation
22:12tonylthanks pppaul i'll take a look at it
22:13amalloytonyl: also don't bother with filter even. no need to do any division/math, when you know every other fib will be even
22:13pppaul(use 'clojure.contrib.math)
22:13pppaul(def PHI (/ (+ 1 (sqrt 5)) 2))
22:13pppaul(defn fib-double ([n] (/ (- (Math/pow PHI n) (Math/pow (- 1 PHI) n)) (sqrt 5))))
22:13pppaul(defn fib ([n] (round (fib-double n))))
22:14pppaulconvert that to use bigint and bigdec
22:14pppaulcus i don't know if it'll work due to precision problems
22:15tonylamalloy: not every other number in the fibs seq is even, but you might be right about filter
22:15pppaulyou may be able to get fast functions using def-memo
22:16tonylpppaul: is round the only function used from c.c.math?
22:16pppaulyes
22:16pppaulcan be replaced with (int
22:16amalloytonyl: oh, i guess you're right. it must go odd-odd-even-odd-odd-even...
22:16pppauli made it a long long time ago
22:16amalloyso you can take every third
22:17amalloy&(doc take-nth)
22:17sexpbot⟹ "([n coll]); Returns a lazy seq of every nth item in coll."
22:17tonylI am going to look at both options, thanks guys
22:18pppaulsince it's a series, and fibs are based off of the phi functions, there is probably a simple sum function for fibs
22:18pppaulyou could have a constant time fib-sum :)
22:34`jstirrellhi
22:34mattmitchell&(doc seq)
22:34sexpbot⟹ "([coll]); Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable."
22:36`jstirrellHow do you call a function A from function B when function A occurs later in code than function B?
22:36tonylwhat do you mean occurs?
22:36`jstirrelllike it is defined lower in source
22:37tonylyou can declare it before function A
22:37tonyl(declare fnB)
22:37`jstirrellAH! thanks, I knew it was something easy I just forgot the term
22:37tonylnp
22:41pppaul(declare war)
22:42pppaul&(declare war)
22:42sexpbotjava.lang.SecurityException: You tripped the alarm! def is bad!1
22:42pppaul(source declare)
22:42pppaul&(source declare)
22:42sexpbotjava.lang.Exception: Unable to resolve symbol: source in this context
22:42tonyl$source declare
22:42sexpbotdeclare is http://is.gd/hg4Aa
22:42pppaul&(sorce declare)
22:42sexpbotjava.lang.Exception: Unable to resolve symbol: sorce in this context
22:42pppaul&(sauce declare)
22:42sexpbotjava.lang.Exception: Unable to resolve symbol: sauce in this context
22:43pppaul$8ball am i getting it?
22:43sexpbotpppaul: You may rely on it.
22:43pppaul$8ball it it it it it?
22:43sexpbotpppaul: Don't count on it.
22:43rata_hi all
22:43pppaulhi
22:43rata_hi pppaul
22:44pppaul(inc rata_)
22:44sexpbot⟹ 1
22:44rata_:)
22:50rata_slyrus: I agree with you now that fnparse 3.x has better names for its functions... it was just a problem getting used to :require and the h/ thing
23:10mattmitchell&(doc doseq)
23:10sexpbot⟹ "Macro ([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
23:36livingstonso I have this class being given to me: http://repository.aduna-software.org/docs/info.aduna/api/info/aduna/iteration/Iteration.html
23:36livingstonand I'd like to just call seq or iterator-seq on it but it doesn't actually implement iterable, just something almost identical...
23:37livingstonpresumably there's a clever way to use extend to patch it, but I'm having a hard time finding an example.
23:40tonylgot it (reduce + (take-nth 3 (take-while (partial >= 4e6) (fibs))))
23:45amalloylivingston: this isn't "almost iterable", but rather "almost an iterator"
23:46livingstonamalloy: er right, that
23:47livingstonamalloy: right now I just defined sesame-iteration-seq that produces a lazy list - that's probably good enough -- but I was playing around with other protocols tonight
23:55slyrusrata_: ah, good
23:55livingstonyeah I was just looking for a clean example of extending an existing java class with the ISeq protocol.
23:55slyrusyeah, I think joshuachoi made it better with fnparse3
23:59slyrusmy only gripe about fnparse is that it makes my previous parsing attempts for the same task look (in CL) look rather lame
23:59slyruswell, ok, probably not my only gripe, but you get the idea