#clojure logs

2012-11-09

00:00twobitspriteDrakeson: I recommend it... not something I'd use for a large project, but it's a fun language
00:01DrakesonThey moved away from sexp. ugh! Just looking at their method dispatch, now ...
00:01twobitspritewell, it's not a lisp...
00:03jkkramer&(doto (java.util.HashMap.) (.put (Integer. -1) :yay) (.put (Long. -1) :java))
00:03lazybot⇒ #<HashMap {-1=:java, -1=:yay}>
00:05sjl&[(= {(Integer. -1) :a} {(Long. -1) :a}) (= #{(Integer. -1)} #{(Long. -1)})]
00:05lazybot⇒ [true false]
00:05sjlwait so it works sanely for maps but not sets?
00:05sjlwat
00:06twobitspriteany reason why vimclojure moves the close-parens to a line below the cursor after hitting enter? or is it just me? Isn't listp formatting supposed to just stack all the close-parens on the last expr?
00:06sjltwobitsprite: it's probably using "electric return" like slimv
00:07sjltwobitsprite: if you press the close paren key do they jump back up?
00:07twobitspriteahh, yes
00:08Drakesontwobitsprite: At first pass it seems they have something very similar to defmulti/defmethod. Does it offer more?
00:08twobitspriteDrakeson: I'm not familiar enough with clojures defmulti/defmethod to give an educated comparison
00:10twobitspriteDrakeson: in fact, I'm not sure how close the analogy is to the (object :method) thing you at ChongLi were talking about... I was just reminded of dylan reading what you all were saying. I do think dylan has a cool dispatch system though and I think it's definitely something worth looking in to wrt clojure
00:10twobitspritehonestly, I'm pretty much a complete noob to clojure, so take what I say with a grain of salt :)
00:11DrakesonEssentially in defmulti you specify what to look at to decide the dispatch, and it can be anything; an arbitrary function of the params.
00:11twobitspriteI suspect the big difference would be the type-specialization dylan uses... but it's also a statically typed inference system, whereas clojure is dynamically typed with, essentially, a weak type-class system
00:13twobitspriteDrakeson: ahh... dylan's dispatch is based on which method has the most specific type signature... although I believe there is a way to extend the dispatch system in a similarly arbitrary way
00:13DrakesonBut as I understand, in dylan the methods of a `type' do not need to be specified until runtime. So it doesn't seem to be "too strong" typing, either.
00:14twobitspriteDrakeson: well, it's type inference, not dynamicly typed
00:15bbloomi don't mean to invoke an ~anyone, but is anyone in here versed with the google closure compiler at all?
00:16twobitspriteDrakeson: so the types of a method are specified at compile time, but don't have to be explicit; they can be left out and the compiler determines the types by looking at how the arguments are used in the function body
00:16twobitspriteDrakeson: never used haskell or ocaml?
00:16bbloomDrakeson: have you ever tinkered with the java internals? or just the command line interface?
00:17jkkramersjl: I think it might be a bug in the set impl
00:17Drakesonbbloom: only command line. and barely at that. don't let me block your question; perhaps someone else knows more.
00:17sjljkkramer: definitely looks like that, since maps work fine
00:18jkkramersjl: yeah, and sets are implemented using maps
00:18Drakesontwobitsprite: I am somewhat familiar with haskell.
00:18sjl...
00:18jkkramerthis line might be the offender https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentSet.java#L58
00:18sjljkkramer: yeah I'm just going to cast this to a long and get on with my life
00:18bbloomissue is that i don't have much of a question yet :-P just looking around .. it's a big java OOP hairball as expected :-) reasonably well written code, just lots of it
00:19bbloomultimately, i want to compile a synthetic ast
00:19bbloomwhich doesn't seem to be straightforward ... lot's of stuff expects files
00:19jkkramersjl: if you're not on clojure-dev I can write up a post there about it
00:19Drakesonbbloom: A synthetic AST? Something more lispy maybe? :p
00:20sjljkkramer: I don't remember which lists I'm subscribed to any more. But I don't have the time/inclination to do it, so feel free :)
00:20twobitspriteDrakeson: dylan is similar to haskell in that types are set at compile time, even if you didn't speciy it in the code... they're derived ("inferred") by looking at the types of the functions you pass them to in your function... except that dylan uses a "weak" type system, where less "specific" types can be dynamically cast in to more "specific" types
00:20muhooah, dylan. back when apple did research.
00:20bbloomDrakeson: well, i'm trying to preserve the performance of clojurescript, which means preserve all the javascript level optimizations :-)
00:21bbloomultimately, i'd love to have a richer clojure compiler that can have lots of clojure specific optimizations for all sorts of different backends, not just javascript
00:22bbloombut in the meantime, i just want to bypass the string step of cljs ast -> js ast -> string -> js ast -> final js string
00:22Drakesonbbloom: I see. That's very reasonable.
00:23twobitspritein a way, from what I've learned so far, clojure's "type" system seems to be somewhere between haskell and dylan... haskell provides type classes, which seem to be similar to clojure's abstractions, but dylan is "weaker" in it's type system, which seems to be comparable to clojure's.... but again, I'm a clojure noob, so I may be wrong
00:25Drakesontwobitsprite: IMHO Clojure's type system still has some bits and pieces that are not finalized. When it is finalized it is probably able to produce code exactly equivalent to java (when you absolutely need to, of course), and will be able to host itself.
00:26Drakesonbbloom: Also, I personally LOVE to see a Clojure/clang backend and [some] Clojure + C++ interoperability.
00:27bbloomDrakeson: i think a few people are working on that
00:27twobitspriteI have seen some stuff about trying to do a clojure-in-clojure... it's a noble effort, but my experience is that those sort of projects rarely catch any real steam... python has been working on pypy for years, haskell (GHC) still has a lot of C... same with Ocaml
00:27Drakesonbbloom: yeah, I noticed that.
00:27ChongLiwhat would happen if we let a million clojures bloom?
00:28ChongLieach with their own interops and fractured libraries?
00:28bbloomtwobitsprite: we already have a clojure-in-clojure: clojurescript... it's just half in java and only supports a javascript target :-P
00:28ChongLiI guess that'd encourage everyone to write in pure clojure
00:28twobitspriteI think ultimately people don't really care about the philosophical purity of the implementation... once they have a working implementation, they just use that, and keep patching it up as needed... the community usually fragments in to the relatively few purists working on it, and everyone else just whistles dixie and uses the "impure" implementation
00:29Drakesontwobitsprite: with Clojure it is a bit different, and it is very reasonable to expect it to happen. Unlike PyPy.
00:29twobitspritebbloom: that's what I mean... If it's like any of the other "self-hosting purity" projects it'll stay that way for a long time... not to jynx it, but having been involved in a number of language communities, that's been my experience
00:29bbloomtwobitsprite: my goal isn't purity. i'd like the analyzer to be reusable for other use cases: more advanced macros, etc
00:30bbloomtwobitsprite: for example, i have a CPS transform: it relies on the clojurescript analyzer
00:30twobitspriteDrakeson: what makes pypy less reasonable that "clojurejure"?
00:30bbloomit would only work for clojurescript, but it would be nice if i could get it to work for clojure too
00:30bbloomwhich means that the analyzer needs to be decoupled from javascript
00:30bbloomit *sorta* is already
00:30bbloombut there's lots more work to be done there
00:31Drakesontwobitsprite: the way host and guest programming languages interact. In case of clojure it is clojure-java interaction. in python it is python-c interation. They are very different in python's case.
00:32twobitspriteDrakeson: well, if you really want to get in to it, python is a python-c-machinecode interaction, and clojure is a clojure-jvm-machinecode interaction...
00:33twobitspriteor, even, a clojure-jvm-c-machinecode interaction :)
00:33twobitsprite(honestly, I don't know what the jvm is implemented it)
00:34DrakesonTwobitsprite: My argument is valid as long as clojure is hosted on JVM. If you want to ditch JVM (implemented in C++ mostly), then yes, it will be in the same situation as python.
00:35twobitspriteDrakeson: I just don't see how that saves your point... you're stilling talking about a compiler written in it's own language targeting some (virtual) machine code
00:36twobitspriteagain, far be it from me to discourage it... I'm just saying my experience is that most users of the langauge simply don't care, and they'll happily continue to use the non-self-hosting platform while a diminishing segment of the community works on making it self-hosting
00:37bbloomtwobitsprite: again, self hosting is not my goal :-P
00:37twobitspritebbloom: I didn't say it was :)
00:38twobitspritemy goal is to write a killer game, and I'd like to use a concurrent, portable language to do it, and I happen to lispy syntax :)
00:38twobitsprites/happen to/happen to like/
00:39Drakesontwobitsprite: Well, you can go berserk and expose all of java in clojure (or just enough of it that the current clojure source code) uses, replace the java in the source code with that, and get the exact same compiler that you now have. The challenge is how to expose as little non-lispy java as possible without any compromise in performance. This is a lot easier to do than doing the same in python->c case.
00:39twobitspritein fact, I originally started drafting up boilerplate/template code in python, but decided I needed something with better SMP/clustering support, looked in to erlang, decided the syntax sucked, and found clojure :)
00:40Drakesontwobitsprite: Pleasant serendipity ;)
00:40twobitspriteDrakeson: I could s/clojure/python and s/java/c in your sentence and it would mean the same thing
00:42twobitspriteDrakeson: I mean, I'm not saying it's that *difficult*. I'm just saying, past a certain point of diminishing marginal utility, most people just don't give a flying flip, and you'll end up with 1 or 2 people working to take it further...
00:42DrakesonNo you couldn't in practice. There is relatively little of the necessary java left unexposed, where as python exposes very little of C. So both cases are probably equally possible, but one is far more likely (and easier) than the other.
00:44DrakesonFor clojure it might matters to people who are worried about clojure's performance. Perhaps only as an example showing them it is possible to get the same performance. But yeah, it is certainly not a high priority objective.
00:44Drakeson*matter
00:45twobitspriteDrakeson: ok, then let's look at haskell... it exposes quite a bit of C... you can call C functions without any C wrapper code... yet it's still not self hosting
00:46twobitspritein fact, python is a poor comparison because it has it's own bytecode interpreter... it doesn't compile down to someone else's byte code... if we wanted to continue the python analogy, it's easy. Just write a compiler which targets the python vm in python. That's simple...
00:48jkkramersjl: clojure-dev post written, with a proposed fix
00:48DrakesonFor haskell it is probably because no one cares enough. Haskell's performance is not bad ;) And migrating from C to Haskell is too much grunt work probably. Migrating from java to clojure can be made a lot simpler.
00:48ChongLitwobitsprite: ?
00:48ChongLiGHC is self-hosted, no?
00:50ChongLiHaskell is listed as a self-hosted language on wikipedia
00:50DrakesonChongLi: the runtime is written in C, right?
00:50ChongLinot sure
00:51ChongLiGHC is written in Haskell though
00:51Drakeson(and compiling passes through C, IIRC)
00:51bbloomit compiles to either C-- or LLVM IR
00:51ChongLiGHC can do its own code-gen without going through C
00:51hiredmanhttp://en.wikipedia.org/wiki/C--
00:52DrakesonChongLi: yes, but that would not produce optimal native code.
00:52ChongLithat doesn't disqualify Haskell from being self-hosted
00:54twobitspriteChongLi: it compiles to c-- (an intermediate langauge which is mostly abandonded excpect for the haskell implementation) which compiles to C, then invokes a c compiler... and yes, I believe large parts of the run-time are still x
00:54twobitspritec
00:55ChongLisure, what's your point?
00:56twobitspriteI don't think I really have much of a point, I'm just discussing :) ... I guess I'm just saying I don't think many efforts in various langauges to be fully self-hosting have been completely successful... and honestly, I'm not sure I really see the point of it in most cases
00:56DrakesonChongLi: Strictly speaking, yes. But with regards to the objective of getting rid of the host language (their's being C--) they are not there yet. A slow self-hosted beside a fast not-fully-self-hosted-path is a bit like cheating!
00:57twobitspritein fact, I think pypy and ghc are probably the most successful attempts I know of, and they aren't even all the way there
00:57ChongLiGHC is written in Haskell
00:57ChongLithat's all that's needed to qualify as a self-hosted language
00:58SgeoIsn't the runtime that GHC-produced programs use written in C?
00:58twobitspriteI guess if that's how you define it....
00:58ChongLiit is
00:58twobitspriteSgeo: shh... it's self-hosted, dammit! the compiler!!11
00:58SgeoOh, twobitsprite already said that
00:58ChongLibecause GHC can compile itself
00:58twobitspritegot it
00:59SgeoHow about most Common Lisp implementations?
00:59SgeoSBCL, Clozure CL, I don't remember the rest
00:59DrakesonPoint of self hosting, other than purity (a moot objective IMO), is *demonstrating* that a language can totally surpass another (often C) without any performance compromise is the whole point. It is a proof of concept objective after all.
00:59RaynesHaskell is llvmified
01:00shachafI don't think people care about performance compromise all that much in a compiler.
01:00twobitspriteI do think I recall reading something about a self-hosting cl implementation... and I mean, it was completely self-hosting, written in cl, run-time in cl, and it bootstrapped itself with no OS... I believe they were able to run the CL port of emacs on it :)
01:00ChongLiDrakeson: I disagree
01:01shachafAnywya, the C RTS I use is totally not written in C! Not self-hosted!
01:01DrakesonChongLi: then what is the point of self-hosting?
01:01ChongLithat's a silly idea
01:02shachafThere's no "point" to it.
01:02shachafThe GHC people happen to like Haskell, so they wrote their compiler in it.
01:02ChongLiand it does demonstrate the use of Haskell
01:03ChongLiI just think it's silly to believe one language can totally surpass another
01:03ChongLior other such notions
01:03twobitspritealso, isn't GHC actually, largely written in some almost-subset of haskell?
01:03ChongLilanguages are tools
01:03shachafChongLi: So are people who argue about languages!
01:03ChongLihaha
01:03twobitspriteburn... :P
01:04DrakesonI mean, what is the point of porting a compiler and make it self hosted after the it is written in another host, other than purity and a proof-of-concept show of the language?
01:04shachaftwobitsprite: If anything it'd be written in a superset, wouldn't it?
01:04shachafDrakeson: Compilers aren't a static thing.
01:04shachafWell, GHC isn't, at least.
01:04shachafWhat's the point of porting any program?
01:04ChongLiin the case of GHC, it's to take advantage of new language features in the compiler itself
01:05twobitspriteshachaf: well... synatically I think it's a subset, and I believe it has some things which aren't in haskell proper... I'm not positive, it's been a while since I've looked in to it
01:05shachaf(GHC wasn't ported, anyway, was it?)
01:05shachafHmm, no, GHC was originally in Lazy ML.
01:05shachafBut that's basically Haskell. :-)
01:05twobitsprite... with a different syntax
01:05shachafIf anything, you'd have to be crazy to write a compiler in C.
01:06twobitspriteanyways... personally I don't really care if a language is self-hosted... I built gcc with gcc with gcc once, it was fun, I'm over it :P
01:07ChongLiand usually your first "bootstrap" compiler is just a quick and dirty one to compile the real compiler for the first time
01:07twobitspritewith that said... it's past my bed time... g'night :)
01:07jyuhello how to use midje in vim, it says the midje is not found actually it is in the project.clj
01:07ChongLiand then you use that real compiler to compile itself in a much cleaner, more optimized way
01:07shachafGHC wasn't the first Haskell compiler.
01:07Drakesonshachaf: C is often easier than ASM, and has better portability. Good for starting/bootstraping etc.
01:08shachafDrakeson: Well, sure. But C is still way too low-level for most interesting things you'd want to do in a compiler.
01:08twobitsprite(erlang was bootstrapped in prolog :P)
01:08twobitsprite(or was it datalog?)
01:09talentdprolog
01:09talentdit's self hosted these days tho
01:09ChongLiI think another "point" of self-hosting your language is to make an argument for using that language
01:09Drakesonshachaf: yes, so if you have other languages on your platform then C doesn't make sense anymore.
01:09ChongLibut it's a rather specious one
01:09shachafMy platform is, like, an abstract graph reduction machine, man.
01:10shachafYou have to do extra work to get C running on it.
01:10ChongLiDrakeson: C still makes sense if you need what it offers
01:10talentdi think the best reason for self hosted languages is that it leads to better tools generally
01:11shachafGHC's code is kind of scary.
01:11Drakesontalentd: that is essentially the purity argument.
01:11shachafI have the feeling some of it hasn't been updated in 20 years...
01:12tomojis there a non-awkward way to do multiline docs for a def?
01:12ChongLishachaf: that's where SPJ sings the praises of the type system
01:12ChongLihe can start hacking on that old code and the type errors are his safety net
01:12DrakesonChongLi: I would pick haskell over C for writing a new compiler at any moment.
01:13ChongLiyeah
01:13shachafChongLi: I think some of the code predates Monad. :-)
01:13DrakesonIn other words, I don't know what C offers for developing a compiler, that a higher level language does not offer.
01:13ChongLiHaskell is really nice for writing parsers and such
01:14shachafAnd a compiler is basically just a parser, right?
01:14Drakesontomoj: I would love to know if there is.
01:15ChongLia parser is a part of a compiler
01:15Drakesonshachaf: no, but many other things are also easier in a high level language when you are not hard-pressed for performance.
01:15shachafThe most important part!
01:16shachafOnce you've got an AST you're basically done.
01:16ChongLiyeah I suppose you're right
01:17tomojI guess it's only slightly awkward - the first line is just a little too far to the right
01:17tomojnot as bad as multiline docs nested in a datomic schema
01:23ChongLisometimes I wonder what it'd be like if lisp machine OSes became the norm instead of unix
01:30bbloomshachaf: that's not even close to right....
01:31bbloomthe closurescript compiler defers completely to jvm clojure's reader
01:31bbloomthe parsing part is trivial
01:31ChongLiI think shachaf was being sarcastic
01:31ChongLiit's hard to tell on the internet
01:31bbloomthe source code analysis and target code generation part are far more complex
01:32SegFaultAXSuppose I have a list of n elements. I want to apply a function which will return some portion from the start of the list of arbitrary length. I want to drop that length of the list and reapply the function over and over until I've consumed the list.
01:32shachafSorry, bbloom.
01:33bbloomSegFaultAX: can you provide an example?
01:34ivanis there some rhyme to to Associative not being IAssociative?
01:34ivannot being called that, I mean
01:35bbloomivan: i think it's just evolutionary. it's somewhat unfortunate that there are java interfaces instead of closure protocols for many key bits
01:35ivanI see, thanks
01:36ChongLiSegFaultAX: something like this?
01:36ChongLi,(map #(* % %) (take 5 (range 10)))
01:36clojurebot(0 1 4 9 16)
01:36ChongLior
01:36SegFaultAX3 line paste incoming:
01:36SegFaultAX(defn take-interval-by [pred n coll]
01:36SegFaultAX (let [size (count (take-while #(apply pred %) (partition n 1 coll)))]
01:36SegFaultAX (take (dec (+ size n)) coll)))
01:37SegFaultAXImagine using that with say (take-interval-by #(= %2 (inc %1)) 2 [1 2 3 5 6 7])
01:37SegFaultAXIt would consume until the first non-sequentially increasing number if found and return that subsequence, eg (1 2 3)
01:38SegFaultAXThe next iteration would be the exact same thing, but with (drop (count prev-result) coll), eg (5 6 7)
01:39SegFaultAXThe trick here is the amount that's dropped is variable. It's dependent on the length of the previous result.
01:40SegFaultAXbbloom: Does that make it more clear or less clear?
01:40SgeoWhy can't I create code that contains arbitrary objects>
01:41SegFaultAXChongLi: Uh, what?
01:41bbloomSegFaultAX: have you seen partition-by ?
01:41SegFaultAXbbloom: Of course.
01:41ChongLiSegFaultAX: disregard what I said
01:41SegFaultAXbbloom: This clearly is not that.
01:41ChongLiI didn't understand your original question
01:42ChongLiwhat about using something like Haskell's subsequences function?
01:42ChongLiit lazily returns all subsequences
01:42bbloomSegFaultAX: i'm still not sure what you're asking for.... maybe it would be easiest to just write it out with loop and recur?
01:43ChongLithen you can filter that lazy sequence
01:43SegFaultAXbbloom: I have already. Well, actually with a lazy seq.
01:43SegFaultAXI was wondering if there was a nicer way to do it.
01:43bbloomSegFaultAX: well in that case, paste that code to ref heap
01:43SegFaultAXChongLi: I definitely don't want all subsequences.
01:43ChongLithat's not the point
01:44SegFaultAXChongLi: I want specific subsequences based on some predicate that loosely defines an interval.
01:44ChongLithat's where filter comes in
01:44ChongLiyou filter a lazy seq
01:45SegFaultAXChongLi: Not what I'm looking for.
01:45SegFaultAXChongLi: The overhead is pointless in this case.
01:45ChongLioh
01:45ChongLiyou didn't say anything about overhead
01:45ChongLiI thought you just wanted a simple implementation
01:46SegFaultAXChongLi: That's over the top wasteful, though.
01:46ChongLiit depends really
01:46SegFaultAXChongLi: Not it doesn't. I'd have to generate every subsequence to guarantee I find the longest intervals.
01:47SegFaultAXChongLi: Whereas this implementation guarantees it. It's just ugly making it build a list of all intervals once the interval function is defined.
01:47ChongLiI thought they had all started from the beginning?
01:47bbloomSegFaultAX: post your working code to refheap
01:48ChongLiso you can stop at the first invalid subsequence
01:48SegFaultAXChongLi: I want all intervals, though.
01:48ChongLihmm, I guess I still don't understand your problem
01:50SegFaultAXbbloom: Sec.
01:50wingyChongLi: from china?
01:50ChongLino
01:51ChongLiI'm not even chinese
01:51ChongLijust a movie character :)
01:51wingylol
01:51wingyyou fooled me!
01:55SegFaultAXbbloom: https://www.refheap.com/paste/6498
01:56SegFaultAXbbloom: Those should be using s, not coll. But you get the idea.
01:56ibdknoxAnyone make it to rich's talk tonight at QCon? I couldn't make it unfortunately
01:57ibdknoxcurious what he talked about
01:58SegFaultAXPretty good chance it was about reducers, datomic, and/or values are awesome. :)
01:59wingyibdknox: very good release of LT! finally i can work with my project using it
01:59wingyim curious if you are coding it alone
02:00ibdknoxCurrently, yes
02:00bbloomSegFaultAX: you're looking for shorter code? or more efficient? or what?
02:00wingyimpressive
02:00ibdknoxMy co-founder has been doing most everything else so I can focus on building it
02:00SegFaultAXbbloom: More idiomatic, perhaps?
02:01bbloom*shrug* if it works, it's probably fine :-P
02:02bbloombbloom: but you walk the lazy collection several times
02:02bbloomevaluating pred each time a whole bunch
02:02bbloomer SegFaultAX: haha shouldn't bbloom: myself :-P
02:02bbloomif you need it to be more efficient, just write it out long hand recursively with the lazy-seq
02:02bbloomit will probably be roughtly the same amount of code
02:04tomoj(def wrap-map (partial partial map))
02:05tomoj(def wrap-rmap (partial r/map))
02:05tomoj(def wrap-seq-fn (partial partial partial)) ?
02:08SegFaultAXbbloom: What do you mean I walk the seq multiple times?
02:08SegFaultAXtake-while + take + drop I guess.
02:08bbloomSegFaultAX:
02:08bbloomyeah
02:09bbloomSegFaultAX: really tho, i wouldn't worry about it
02:09bbloomSegFaultAX: if that function proves slow or broken, deal with it then :-)
02:14SegFaultAXbbloom: You're probably right. Thanks for your input!
02:14SgeoIsn't avoiding walking it multiple times the point of the laziness?
02:14bbloomSegFaultAX: if I was more awake, i'd take a crack at improving it right now, but i'm trying to use my few remaining brain cycles today to debug some advance-compiled javascript... which is a nightmare
02:14SgeoWhat's the function in question
02:15SgeoOh, I see
02:44tomojsuppose #'foo is stateful, is there a simpler form of (fn [x] ((foo) x)) ?
02:51AimHereThat seems pretty simple to me. It can be sugared into #((foo) %)
02:51AimHereSaves you a few keystrokes
03:05dbushenkohi all!
03:05dbushenkoI've noticed that the Noir framework has not been updated for 4 mounths. Even pull requests are still hanging with no response
03:06dbushenkois Noir still supported?
03:06dbushenkoor may be abandoned?
03:09wingydbushenko: don't think it's a very popular one for web apps .. not like express for node.js .. i find using compojure/ring far better than having an extra layer on top of it
03:09wingycompojure/ring/hiccup
03:09wingyno magic
03:10dbushenkowingy: Noir automates some tasks and looks a bit more high-level comparing to compojure
03:10dbushenkobut the question is whether Noir is still supported :-)
03:10wingythe question should be is Noir mainstream .. something that is mainstream won't be dropped
03:11wingyrather than something just hanging around
03:12wingysomething that is mainstream will also get better constantly (features, bug fixes, docs etc)
03:12dbushenkoI'm not interested whether Noir is mainstream or not. I don't care :-) I just wanna it supported
03:26mudgewhen using gen-class and extending a class, how to call the super constructor?
03:29mpenet,(meta (persistent! (transient (with-meta {:a 0 :b 1} {:foo :bar}))))
03:29clojurebotnil
03:29mpenetthis looks like a bug, or is this expected?
03:31Raynesdbushenko: Chris is busy with Light Table.
03:31RaynesI lack sufficient motivation to really get anything done.
03:31RaynesI've been meaning to go through the pull requests.
03:31RaynesWill as soon as I get a chance.
03:35tomoj&(with-meta (transient {:a 0 :b 1}) {:foo :bar})
03:35lazybotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap$TransientArrayMap cannot be cast to clojure.lang.IObj
03:35mpenetok
03:36mpenetI think I rememer reading somewhere on the ML it would be patched (a long time ago)
03:36mpenetremember*
03:44dbushenkoRaynes: that's sad... I really like Noir
03:44dbushenkoand I think, lots of people do
03:45dbushenkoRaynes: how do you think, will you or Chris support Noir, or would it be better to switch to pure Compojure?
03:47foodooI guess Chris is currently pretty busy with Light Table
03:47dbushenkoyes, he is. but what about Noir? I mean, will anyone spend some time on Noir or just put all the forces on Light Table?
03:48muhoodbushenko: raynes is the guy currently holding the reins of noir, and he just said he's not actively doing much with it
03:49dbushenkoOMG... I've seen that! I want to know about the future of Noir
03:49muhoothe future is what you make it. you could always fork it and start maintaining it. it's on github.
03:50foodooor sending in patches to people with commit priviledges
03:50muhooi did some work on it, and eventually realized it'd be easier to just use compojure instead.
03:50dbushenkofoodoo: there are a couple of pull requests that are hanging for months
03:51dbushenkomuhoo: probably, you are right
03:51dbushenkobut thats really sad since Noir is great!
03:52muhoowell, it's great if you're coming from django or rails, until you get proficient enough where it gets in your way.
03:52dbushenkomuhoo: what do you mean?
03:52muhooit uses atoms to store state, not very functional.
03:53muhooi loved it, but after integrating friend with it and trying to do some work with forms on it, i kind of got frustrated with it.
03:53muhooit also uses macros heavily, which don't compose so well.
03:53jyui wonder why use cupp to write the view rather than template engine
03:55dbushenkomuhoo: compojure doesn't have those problems?
03:55muhoohasn't as far as i've seen, no.
03:56dbushenkoso how about routing? it looks like compojure has not so convinient mechanism for routes definition
03:56muhooit's pretty simple. noir puts some sugar around it, but ultimately it's all compojure doing the routing, even in noir.
03:57dbushenkoyep, I know. but how do you deal with it? do you define all routes in one file?
03:57muhoobeen a few months since i dealt with noir tho, so this is from my imperfect memory.
03:57mpenetdbushenko: routes are just values you can import, compose etc
03:58dbushenkocan you give me an example? I had difficulties with routes while trying to make the app more modular
03:58mpenetthere are examples on compojure wiki I think
03:59mpenethttps://github.com/weavejester/compojure/wiki/Nesting-routes
03:59wingya suggestion: deprecate noir if its not prioritized .. would make the clojure community stronger when people see what is mainstream
03:59muhoodbushenko: https://github.com/clojurebook/ClojureProgramming/blob/master/ch16-web-leiningen/src/com/clojurebook/url_shortener.clj
04:00muhoodbushenko: also https://github.com/clojurebook/ClojureProgramming/blob/master/ch16-web-repl-interactions.clj
04:00wingylike Steve Jobs deprecating all the mediocre products to keep focus on only those who matter
04:01dbushenkomuhoo: looks like you are ritht
04:01dbushenkomuhoo: I think, I have to check it out. May be I will not miss Noir so much :-)
04:03muhoodbushenko: have fun :-) also, i can recommend clojurebook.com, the compojure/ring section was clear to me (coming from django/rails/php/etc background)
04:10tomojwhy doesn't oauth-clj's consumer return a ring response :(
04:57Raynesmuhoo: I'll never understand why people think Noir's route definitions are more 'convenient' than Compojure's. :\
04:58sunkencityrylehcompojure rocks!
04:59sunkencityrylehespecially if you add back the old functionality where you can send a list of hiccup data and have Renderable render hiccup
05:09clgv"fns taking primitives support only 4 or fewer args," that's kinda arbitrary. the only reason for this is that there are a lot of primitive interfaces in the source with 4 args already, right?
05:14tomojlooks like it's 3^n - 1 ?
05:15tomojer
05:15tomoj3^(n+1) - 1
05:15tomojif n is the number of args
05:15ejacksonclgv: yeah the combitorics got em
05:15abpHi, I'm trying to use c2 with a recent version of clojurescript. Does that work for someone here? I always get "Uncaught TypeError: Cannot read property 'nodeName' of null" in the console on page load.
05:15ejacksoncombinatorics
05:15tomojso for 5 args, 729 interfaces?
05:15tomoj728
05:15clgvejackson: wouldnt be a problem if the interfaces could be generated with clojure ;)
05:15ejacksonclgv: too bad we're not a lisp
05:16ejacksonwhat are the types: long, double and ?
05:16tomojobject
05:17ejacksonok, so then then for 5 its 3^5 possibilities right ?
05:17ejacksonwhat about the return type ?
05:17tomojthere are also 3 return type possibilities, and they can't all be objects
05:18tomojso 3^(n+1) - 1
05:18ejacksonyeah, then I agree
05:18ejacksonthat's a lot
05:20abpOk, found the problem, don't follow bad practices from tutorials. Calling c2's bind! from top-level as shown in c2-demos / todoMVC doesn't work (anymore?). Call it from windows onload instead.
05:20abp*window onload
06:19maleghastibdknox: Do you have a moment for a Korma-related query..?
06:20RaynesI doubt it, since it is 3:18AM where he lives.
06:20muhooRaynes: and it's 6:18AM where you are?
06:21Raynes5:19AM
06:21muhoodamn
06:21maleghastRaynes: Oh bugger… Thanks, I will try him later...
06:21otfromRaynes is hardcore
06:21RaynesI should probably sleep at some point.
06:21muhoosleep is for old people :-)
06:22muhoonite
06:25maleghastAnyone else know how to tell JDBC driver for MySQL to NULL zero value DateTime fields, through Korma?
06:25maleghast(I've tried using a plain JDBC connection, can paste here if you want / need to see it; it works in the REPL but not in my app / prototype)
06:27Anderkentthat would probably help. I find myself using korma simply as a lisp-y sql, the more advanecd features (entities / select with etc.) seem unreliable.
06:30maleghastAnderkent: http://pastebin.com/vM3k4fRc
06:32maleghastAnderkent: Like I said that works in the REPL (lein repl) but not when I run my server...
06:33AnderkentDo you have multiple db declarations in your app code? My only guess would be that as korma uses the last declaration by default you're accidentally overriding the settings somewhere
06:33maleghastI have tried it with the less complex definition commented out and also completely removed from the code.
06:36maleghastWhat I get are complaints about being unable to make a connection to the underlying database, and yet the definition in that paste works fine in the REPL
06:37maleghastmore to the point it fixes the JDBC error I was having based on trying to return a row that included a DateTime field with a value of 0000-00-00 00:00:00
06:39Anderkentand it only does that if you specify this particular subname?
06:39maleghastYeah, if I connect like this: (defdb db (mysql {:db "vivastreet_gb" :user "root" :password "password" :host "192.168.192.138" :port "3306"}))
06:39maleghastit works fine until it encounters a row with an invalid DateTime value
06:39Anderkentright, try specifying both host and the subname
06:40Anderkenthm no actually nvm
06:40Anderkentwell... you can try it anyway :P
06:40maleghastI will, hang on :-)
06:41Anderkentkorma by default sets host to localhost, so it could be jdbc doesnt like when you give it host=localhost but subname=tcp://192....
06:42maleghastWell, unfortunately that does not work, but it was a good idea :-) Thanks
06:45Anderkentyou might want to do (get-connection db) and print it out from your app, see if there's something obviously wrong/different to when you do it from repl
06:47maleghastAnderkent: I will try that, but at the moment when I run "lein ring server" (I'm writing a Compojure app) the server does not start if I use the more complicated db connection method.
06:47maleghastI will try it from the REPL though and see if I can "spot the difference"
06:48maleghast(between the two connection methods)
06:48Anderkentput the printout in your server initialization code, before you try to actually use the connections, so you can see it even if the server fails to start
06:48Anderkentif that's possible :P
06:49maleghastAnderkent: I am not certain, I will check...
06:55AnderkentAnyone used drift for migrations? Can't seem to make it work with timestamp-versioned migrations.
06:57maleghastAnderkent: I fixed it! I just removed "tcp:" from the sub name declaration and it works!
06:57maleghastThanks for your help anyway
07:00Anderkentglad you fixed it :)
07:25AnderkentAnyone know how to make korma handle UUIDs?
07:36Anderkentnvm, apparently jdbc is smart enough that you can just give it a java.util.UUID and it figures stuff out.
07:59AnderkentBetter way to do https://gist.github.com/4045544 ? Basically I want to get an UUID no matter if I have a string or already have a UUID.
08:03abpIs there a better way to do this: ,(-> [] (conj 1) (into [2 3 4]) (conj 5))
08:03abpIs there a better way to do this: &(-> [] (conj 1) (into [2 3 4]) (conj 5))
08:03abpHum, how can I get the bots to work? :)
08:04Anderkent,(-> [] (conj 1) (into [2 3 4]) (conj 5))
08:04clojurebot[1 2 3 4 5]
08:05Anderkentneed to start with ,/&
08:05abpAnderkent: Oh ok, thanks.
08:07AnderkentIf i get it right you want to add a prefix and a suffix to a given vector?
08:11abpAnderkent: yes
08:11abpAnderkent: but given sequence, not necessarily vector
08:17Anderkentdoesn't help that cons and conj take args in different order, so you can't thread it nicely...
08:17Anderkent,(cons 1 (conj [2 3 4] 5))
08:17clojurebot(1 2 3 4 5)
08:59ChironHi, how access a static class nested in another non-static class ?
09:04nDuffChiron: in terms of naming? OuterClass$NestedClass; if that isn't it, you'll need to be a little more specific re: the question.
09:04Chironyes, i need the path to it
09:17Chironhere, https://github.com/nathanmarz/storm-contrib/blob/master/storm-kafka/src/jvm/storm/kafka/KafkaConfig.java how to access StaticHosts ?
09:19Anderkentoh god clojure is non-breaking-space-sensitive TT
09:20Anderkentgood luck solving "CompilerException java.lang.RuntimeException: Unable to resolve symbol:    in this context, compiling:(NO_SOURCE_PATH:1)"
09:21Chironimport 'storm.kafka.KafkaConfig$StaticHosts)
09:21ChironClassNotFoundException storm.kafka.KafkaConfig$StaticHosts java.net.URLClassLoader$1.run (URLClassLoader.java:202)
09:22Chironnvm
09:26jakubHDoes anybody know a way to tell lein repl to load classes from a directory? (something like lein repl —claspath ./target/classes or running lein repl and than st. like (add-to-classpath "./target/classes")
09:26jakubH(I want to experiment with a java project using repl)
09:31Anderkent,add-classpath
09:31clojurebot#<core$add_classpath clojure.core$add_classpath@50984625>
09:31Anderkent,(doc add-classpath)
09:31clojurebot"([url]); DEPRECATED Adds the url (String or URL object) to the classpath per URLClassLoader.addURL"
09:33Anderkentwell, it's deprecated but it should do for experimentation... In general you just want to give :java-source-paths to lein
09:33AnderkentjakubH: https://github.com/technomancy/leiningen/blob/master/doc/MIXED_PROJECTS.md
09:34jakubHAnderkent: thanks but it is java-only project, I have/want no project.clj
09:35jakubHhtough I guess that creating project.clj may be the easiest way after all...
09:35xeqijakubH: lein isn't designed for that use case, you could try manually invoking java with the right classpath
09:35andrewmcveigh|wojakubH: If you java project is using maven, you could use the clojure-maven plugin to get a repl running.
09:36jakubHthanks, I will look into the clojure-maven thing
09:39AnderkentjakubH: sorry, I misunderstood. Indeed clojure-maven-plugin or the zi plugin are what you want to use
09:41jakubHthanks a lot, guys!
10:09AnderkentIs there a multiple-bindings if-let? I.e. if all bindings are true, do 'then', otherwise do 'else'.
10:14dsppif ^String is a type hint, what's something like #^ZMQ$Socket
10:14dsppnot sure what the hash signifies, can't find anything on it
10:16andrewmcveigh|wodspp: type hints (and metadata generally I think) used to start with #^
10:16steveo`Anderkent: I don't think so but I've found myself wanting that too.
10:19mdainesI have a lein/repl issue. If I paste my code into the repl it works, but calling (require '[abd.core]) fails on a Java method.
10:19dsppah andrewmcveigh|wo, so its old / deprecated syntax?
10:19mdainesI'm using DataInputStream, so this works:
10:20mdaines(defn one-byte [data] (.readByte data))
10:20gtrakmdaines: you can't require a java method?
10:20mdainesbut this does not:
10:20mdaines(defn two-bytes [data] ((juxt .readByte .readByte) data))
10:20gtrakjava methods don't implement IFn, use memfn or anon functions to wrap them
10:20mdainesDo I need to require it specifically? I thought importing the class was enough.
10:20andrewmcveigh|wodspp: I think so. I don't know of anything it's used for now.
10:21gtrakmdaines: yes, I think that part's right. The problem is clear from your use of methods
10:22mdainesgtrak: Cool, thanks. I was going to try that approach next. I just didn't get why it worked one way and not the other.
10:22Anderkentmdaines: your second example should not work in a REPL either
10:22gtrakmdaines: java interop is like special forms, they don't eval like normal function calls
10:22Anderkenti'd expect 'unable to resolve symbol'
10:22mdainesAnderkent: It does.
10:23mdainesIt lulled me into a sense of comfort because it wasn't complaining at all
10:23gtraktoo much comfort!!
10:23Anderkent(defn two-strings [data] ((juxt .toString .toString) data)) does not work for me
10:23Anderkentmagic.
10:26clgvAnderkent: because it's a java method - they are not first class functions like clojure's
10:26Anderkentwell yes, that's what i expected
10:26Anderkentbut mdaines claims his two-bytes works in his repl, so there's some magic there :)
10:27mdainesHmm, it isn't working now. I thought I had it last night.
10:28Anderkent:) Happens to the best of us.
10:28Anderkentmaybe you did (juxt one-byte one-byte) ?
10:28mdainesI've got other methods invoking java methods in a function, but it must be something about juxt that I wasn't doing before.
10:28gtrakSomeone must have pushed an update since then :-)
10:30mdainesOK, I'm getting my head around it now. I'm looking at all the other cases where it was working, and the calls were different. Things like (let [n (.readInt data)] or (clojure.string/join "." (repeatedly 4 #(.readByte data)))
10:31TimMcYep, it's in the call position.
10:35mdainesThe clojuredocs.org entry for memfn could be better. Jay Fields' blog has better examples.
10:36Anderkent,(doc memfn)
10:36clojurebot"([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."
10:36Anderkentsounds clear enough to me, but oh well :P
10:37gtrakflatland useful has a type-hinted one I think
10:37mdainesOn a different note, is there a simple way to get back a variable name? e.g., I have (def STATUS_SUCCESS (byte 1)) ... is there way way to get "STATUS_SUCCESS" without creating a explicit mapping?
10:38gtrakkeywords
10:39mdainesAnderkent: I think what wasn't clear to me from the doc was whether I needed to indicate argument parameters. Now that I have it working, the doc makes sense to me.
10:39Kototamahi, stdout is not displayed in the nrepl buffer when using compojure, any idea how to fix that?
10:40gtrakKototama: stdout is stdout, clojure progs use the *out* var, which gets bound to your buffer.
10:40gtrak(println) will do the right thing. System.out.println won't
10:40KototamaI use (prn or pprint
10:41Kototamait does not work, it used to work with swank
10:41gtrakhmm... then something else is wrong and my argument's irrelevant :-). It should be going through that var, though.
10:43Kototamathis makes debugging hard :-)
10:44Kototamamaybe it's a problem with the multiple thread, like this http://osdir.com/ml/clojure/2011-07/msg01422.html ?
10:46gtraknot obvious to me from glancing at the nrepl source where the *out* gets set
10:47Kototamaah it works if I use the log function defined in the thread
10:47Kototamabut I used to work without in swank
10:47Kototama-I+it
10:51jweissis there a way to replace a multimethod dispatch in a way that calls the old behavior? or do we basically have to copy/paste
10:52nDuff"old behavior"?
10:52TimMcjweiss: You want to chain an override?
10:53jweissnot exactly sure what that means but i think so
10:54jweisseg definte a new print-method for IDeref (assuming there is one already in core) that calls teh old behavior and then adds something new
10:55TimMcjweiss: http://clojuredocs.org/clojure_core/clojure.core/get-method perhaps?
10:55TimMc(let [old (get-method ...)] (remove-method ...) (defmethod ...))
10:56jweissTimMc: ah great thanks
10:57TimMcI'm not sure what happens if that gets eval'd twice. :-)
11:03alexnixonis there a nice way of passing a map of args to a function expecting named params?
11:03alexnixonlike this but more idiomatic:
11:03alexnixon,(let [f (fn [& {:keys [foo bar]}] foo)] (apply f (flatten (seq {:foo 1})))))
11:03clojurebot1
11:03TimMc~mapply
11:03clojurebotYou could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
11:03TimMcalexnixon: You really don't want to use flatten.
11:04TimMc~flatten
11:04clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
11:04alexnixonTimMc: thanks
11:05TimMcI don't know why the Clojure lib guidelines promote named args; it's a real pain to use.
11:05alexnixonthat's what I'm finding :-/
11:06jweisshow do i get lazybot to print the source of a core fn
11:12Anderkent,(source defn)
11:12clojurebotSource not found
11:12Anderkenthm :P
11:12Anderkent,(source prn)
11:12clojurebotSource not found
11:13Anderkentdon't know :P
11:13metellus,(doc source)
11:13clojurebot"([n]); Prints the source code for the given symbol, if it can find it. This requires that the symbol resolve to a Var defined in a namespace for which the .clj is in the classpath. Example: (source filter)"
11:14Anderkentdo (entity-fields) work in Korma at all? Doesn't seem to have any effect.
11:27goracio,(doc defn)
11:27clojurebot"([name doc-string? attr-map? [params*] prepost-map? ...] [name doc-string? attr-map? ([params*] prepost-map? body) + ...]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata. prepost-map defines a map with optional keys :pre and :post that contain collections of pre or post conditions."
11:28goracioyou need macroexpand i guess
11:28goracioto look at the code
11:45clgvalexnixon: checkout https://github.com/guv/clojure.options
11:53alexnixonclgv: thanks for that
11:53clgvalexnixon: report back if you have problems using it^^
11:57alexnixonit's unfortunate that a third-party library is needed to make a core language feature palatable
11:59hiredmanit is difficult to see what that library brings over destructuring
12:00clgvhiredman: transitive option documentation
12:00alexnixonand it helps cut down boilerplate when passing options around
12:01clgvhiredman: ah yes, and the easy ability to pass on options - otherwise the transitive option documentation would make no sense ;)
12:01hiredmanif you say so
12:01alexnixonclgv: and what if you don't want transitive option documentation (say you're creating an API and don't want to leak implementation details through your docstring)?
12:02clgvalexnixon: well then you shouldnt pass on the optionmap. since then someone my change an internal option
12:03clgvalexnixon: I use that library a lot.
12:03amalloy~def defn
12:12TimMcooooolllldd
12:13amalloystill perfectly adequate for defn though :P
12:13amalloy$source defn
12:13lazybotdefn is http://is.gd/lcpCpj
12:14TimMc(inc lazybot)
12:14lazybot⇒ 7
12:14TimMclazybot: You will never escape the karmic cycle!
12:14TimMcyou are doomed to be rebooted over and over again
12:50jweissi'm a little confused that i see self-calls in core fn's like range. obviously that can't possibly consume stack, but i don't see it explained anywhere in the doc how that can be possible.
12:50jweissi would have expected to see recur instead
12:50clgvjweiss: range is lazy
12:51clgvjweiss: the lazy-seq macro defers execution of the recursive call until the next element of the seq is needed thus it wont blow the stack
12:51clgvthat's it in short ;)
12:52jweissclgv: hm, i don't really understand how. if i do (range MAXSTACK+1) at the repl, it still calls range too many times, doesn't it?
12:53jweissi guess the lazy-seq macro effectively un-recursive's it?
12:53clgvjweiss: no. a lazy-seq does not calculate anything if you dont access the element
12:53amalloyjweiss: (range 10000) returns immediately, and its return value (a lazy seq) effectively holds a function that *you* can call to find out the next element
12:54clgvand if you access elements thats iterative, so one element at a time is calculated
12:54amalloysince range uses your stack instead of growing its own deeper and deeper, there is no overflow
12:55jweissok, i think that makes sense. thanks
13:16TimMcjweiss: I found reading LazySeq.java to be enlightening.
13:16jweissTimMc: ok i'll take a look, i think i've looked at it before. when trying to write a fn to return only the already-realized part of a sequence.
13:17jweissnever did figure out how to handle that for a ChunkedCons
13:21xcliteIf I'm performing threaded tasks with side effects (downloading files) and want to print to STDERR for any exceptions thrown, what's the best way to synchronize the output? I.e. I want to stick the errors or calls to println in some queue and have them printed sequentially instead of interleaved
13:21xcliteam I looking for agents?
13:21clgvxclite: yeah. use an agent
13:22xcliteclgv, thanks, just wanted to make sure that was the best path.
13:23clgvjweiss: clojure 1.4 helps you with `realized?`
13:24jweissclgv: yeah, doesn't work on some types though, like Cons, ChunkedCons
13:24clgvjweiss: cons are always realized, no?
13:25jweissalthough i guess a pure Cons isn't lazy
13:25jweissit's the lazy-seq's chained together with Cons
13:25jweissi still couldn't figure out how to do it with what range returns
13:25jweissi am not sure how ChunkedCons works
13:26jweissis each Cons cell a chunk? or is a chunk a bunch of Cons cells?
13:26mudgehow do I use :exposes in gen-class? so if I use it like this: :exposes {CAT_DATA {:get CAT_DATA :set CAT_DATA}} then how do I call it my class?
13:26clgvjweiss: it should work with range. but range is not lazy on one number but on whole chunks of 32 numbers
13:27jweissclgv: so it is chunks Cons'd together
13:27clgvjweiss: yeah range builds one chunk at a time
13:28uvtcIs there a "deprecated" Clojure features list anywhere?
13:29uvtcMaybe better to ask: are there *any* features of Clojure which are deprecated? :)
13:30mudgeAnybody here used :exposes in gen-class before?
13:31gtrakuvtc: don't use structs
13:32uvtcgtrak: right. defstruct.
13:32gtrakauto-promoting math
13:32uvtcI thought there might be a list or doc somewhere re. deprecated features.
13:32gtraknot deprecated, broken that one
13:32uvtcHm. "best practices" that.
13:33gtrak:use
13:33uvtcgtrak: Yeah, that's kinda' why I ask. Was just reading that ML thread.
13:35uvtcAh. I see `:deprecated ...` in metadata in core.clj in some places. Ok.
13:51TimMc,(for [[s v] (ns-publics 'clojure.core) :when (:deprecated (meta v))] s)
13:51clojurebot(add-classpath replicate agent-errors clear-agent-errors)
13:51TimMc,(doc replicate)
13:51clojurebot"([n x]); DEPRECATED: Use 'repeat' instead. Returns a lazy seq of n xs."
13:53TimMc,(for [[s v] (ns-publics 'clojure.core) :when (when-let [d (:doc (meta v))] (re-find #"(?i:deprecated)" d))] s)
13:53clojurebot(add-classpath replicate agent-errors clear-agent-errors)
13:54amalloyTimMc: what's the : in (?i:deprecated) for?
14:08ToBeReplacedwith clj-http, my post request maps have :body #<StringEntity org.apache.http.entity.StringEntity@1a50fd75>, which is causing them to fail in ring handlers >> cannot open as InputStream... has anyone seen before?
14:08ToBeReplacedi'm wondering if it might be a side effect of using clj-http-fake
14:09the-kennyToBeReplaced: I think we had that in our product too. Sometimes you get an InputStream, sometimes this Stringy-Thing, somestimes nil
14:09the-kennyWe have a custom middleware to handle that
14:10uvtcamalloy: case-insensitive but using a non-capturing group, I think.
14:16ToBeReplacedthe-kenny: so you just wrap the client requests with something that calls getContent on the body?
14:20the-kennyToBeReplaced: Yup, just dispatch on (class (:body foo)) or so.
14:21Cubic,(reduce #(assoc %1 %2 []) [:key :otherkey] {})
14:21clojurebot[:key :otherkey]
14:21CubicI'm confused. Shouldn't this be {:key [] :otherkey []}?
14:22S11001001Cubic: you've got the last 2 args backwards
14:22amalloythose both look pretty nonsense, Cubic
14:23S11001001,(doc repeat)
14:23clojurebot"([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs."
14:24S11001001&(doc repeat)
14:24lazybot⇒ ------------------------- clojure.core/repeat ([x] [n x]) Returns a lazy (infinite!, or length n if supplied) sequence of xs. nil
14:24S11001001,(zipmap [:key :otherkey] (repeat [])) ;moreover
14:24clojurebot{:otherkey [], :key []}
14:25S11001001Cubic: HOFs, reduce, loop/recur
14:25CubicOhhh... the val is before the collection if it's given... that's... intuitive I guess?
14:25S11001001Cubic: it's the very well established standard
14:26S11001001Cubic: reduce of 3 args is actually a left fold, for which you specify the function, then the initial value, then the sequence
14:31TimMc,(for [[s v] (ns-publics 'clojure.core) :when (when-let [d (:doc (meta v))] (re-find #"(?i)deprecated" d))] s)
14:31clojurebot(add-classpath replicate agent-errors clear-agent-errors)
14:32TimMcamalloy: (?i:X) affects match flags just for the span of the group; (?i) changes the flag for the rest of the expression.
14:32amalloyaha
14:32TimMcI prefer the latter, but the former is what I happened to use.
14:32ToBeReplacedthe-kenny: confirmed that it only occurs with clj-http-fake >> wrap-input-coercion is what does the encoding to the different entities, and it is eventually decoded in the request function, but clj-http-fake intercepts it before the decoding
14:32uvtcTimMc: Ah, thanks.
14:32amalloyi would have preferred the former had i known it existed
14:34TimMcThe More You Know! ===☆
14:51gfrederickshaha regexes two problems hahahaha
14:59seancorfieldnrepl Q: if i have an active nrepl connection in emacs and need to force it to reload, what's the easiest way? doing nrepl-jack-in again creates a new *nrepl*<2> window...
15:00hiredmanseancorfield: https://github.com/kingtim/nrepl.el/issues/141
15:01hiredmanmy emacs session is at *nrepl*<24>
15:01abphell-o
15:08augustlwhy would "lein run" work but "lein uberjar" and then java -jar the.jar say "Error: Could not find or load main class oiiku_closure_builder_server.server"
15:09augustlwhere oiiku_closure_builder_server.server is what I specified for :main in project.clj
15:09augustljust noticed (ns fofofo (:gen-class)) in the leiningen docs, that seems to have worked
15:16seancorfieldthanx hiredman ...
15:16seancorfieldi still had problems getting it to notice a new namespace i'd added and had to kill all the nrepl buffers and re-jack-in...
15:17hiredmanseancorfield: there is some kind of issue, if you manually copy and paste the ns form for the new ns in to the repl it should work fine
15:17hiredmanit is just some kind of issue with loading a new ns or something
15:19hiredmannot sure if there is an open issue for that, or if it is related the existing open ns issues
15:19hiredmanjust something I have noticed
15:21xcliteAccording to the docs, *err* defaults to System/err which should output to STDERR. However, (.println *err* "Hello") is going to STDOUT. I haven't rebound *err*. Are there any gotchas for printing to *err*?
15:22TimMcxclite: It could be that the REPL you are using is combining them.
15:23xcliteTimMc, I figured it would be hard to isolate in the REPL so I'm running from the command line, redirecting STDOUT to a file and leaving STDERR on the line
15:24xcliteTimMc, well you still had the right idea - I wasn't actually in a REPL, but lein new intercepts the output
15:24xcliteTimMc, lein run I mean. Running from the Jar produced the expected split.
15:40TimMcI seem to remember some recent change to how lein handles output...
15:41augustlany recommendations to argv parsers for clojure or java that handles operands? Like --port 4224 /path/to/some/file
15:41augustlwhere the path isn't an option to a specific "key"
15:41augustlalso known as operands in the posix world
15:42TimMcaugustl: clojopts, I think
15:42TimMchttps://github.com/amalloy/clojopts/
15:43augustlTimMc: hmm, the docs doesn't seem to mention anything like operands
15:44TimMcaugustl: "Any non-option arguments will be supplied under the key :clojopts/more."
16:15gfredericksisn't there a contrib lib for that?
16:18TimMcclojopts uses GNU GetOpt, so it's about as standards-compliant as can be.
16:19CubicIs "equals-p" a good name for (fn [x] (partial = x))?
16:20CubicThat is, is there some idiomatic name for a function that returns a predicate?
16:21gfrederickshow about =¿
16:22gfredericksI suggest functions returning predicates end in ¿
16:23S11001001,(doc every-pred)
16:23clojurebot"([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns true if all of its composing predicates return a logical true value against all of its arguments, else it returns false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical false result against the original predicates."
16:23scriptorCubic: why not just use (partial = x) without the wrapper fn?
16:23AimHereCubic - wouldn't 'partial?' be a good name
16:23Cubicscriptor: Because I don't like it when there's too much going on in a single line.
16:23AimHerescriptor, maybe he needs to pass that function on, such as if he was using it in the filter function
16:23S11001001AimHere: not really
16:24Cubicscriptor: Also, it's something I need rather regularly
16:24scriptorah, got it
16:24gfrederickswait #{x} is the idiom for that
16:24gfredericksnot that I like that idiom very much
16:24gfredericksbut I'm obligated to mention it
16:24Cubicqfredericks: That's incredibly ugly.
16:25bbloom*shrug* i use that idiot relatively regularly, it works nicely
16:26hiredman~rimshot
16:26clojurebotBadum, *tish*
16:27qfredericksCubic: like visually? is (hash-set x) prettier?
16:27bbloom*sigh* idiom
16:27bbloomtyping, it's hard for some of us :-P
16:27bbloomi blame the cajun sauce on my fingers
16:32jamiiIs anyone familiar with nrepl internals? Seems cemerick is not about.
16:32hiredman~anyone
16:32clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
16:32jamiiclojurebot: good point
16:32clojurebotthe point of moby dick is "be yourself"
16:32hiredman~botsnack
16:33clojurebotThanks! Can I have chocolate next time
16:33bbloomdeep.
16:34jamiiI'm playing around with a multi-user nrepl client. If another user sends something to be evaled, I want the result to be sent to all the users. What happens if an nrepl client gets a message from the server that wasn't triggered by a client message?
16:34jamiiShould I just put a random id on the message and hope for the best?
16:37hiredmanjamii: I think the best approach to something like that might be some kind of broadcast middleware, instead of have a special purpose client
16:38jamiihiredman: I'm writing a broadcast middleware. I'm just not sure what id/session I should put on the broadcast messages, since they aren't a reply to the clients message.
16:38jamiihiredman: I guess I should look at nrepl.el and see what it expects
16:41TimMcCubic: #(= x %) is shorter. :-)
16:41bosiehttps://gist.github.com/4048426 why would this happen in vimclojure?
16:42hiredman~map
16:42clojurebotmap and the other sequence functions used to be lazy, but with the advent of chunked sequences, may or may not be lazy, consult your local ouija board
16:42hiredman~map
16:42clojurebotmap is lazy
16:42hiredman~lazy
16:42clojurebotlazy is hard
16:42bosiehiredman: good point, thanks
16:57sisciacemerick is here ?
16:58Raynescemerick is not .
16:58sisciathanks...
16:59sisciaI am the only one who don't get the idea behind friend of cemerick ?
17:00ToBeReplacedhow do you mean? as in, you don't understand what it does, or you don't understand what it's trying to do?
17:01sisciaboth...
17:02ToBeReplaceddo you have specific questions about it? i have it pretty fresh in my mind
17:02sisciawhy should I use it ?
17:03scriptoras in, you're looking for a use case?
17:03sisciaHow can be integrated with something like https://github.com/siscia/noir-auth-app
17:03siscia?
17:03sisciaI just don't getting what it is doing...
17:04ToBeReplacedi'm not familiar with that project... friend tries to provide an abstraction level for securing ring apps, and it has a couple of sample implementations
17:05siscialets suppose I am trying to make a web app and I need to authenticate user, where friend comes to play ?
17:05ToBeReplacedthe goal is to establish a common way of thinking about authentication... the way that you establish your particular workflow(s) is up to you; friend does however include some example workflows and helper functions to get you on your way
17:07ToBeReplacedso in that case, you might use the ring authenticate handler around your existing handler, and pass it a workflow that meets your needs
17:08sisciahumm... ok...
17:08ToBeReplaceda well documented example is "interactive-workflow" >> a tutorial is here: https://github.com/ddellacosta/friend-interactive-form-tutorial
17:09sisciaThanks I am gonna read it right now...
17:19hughfdjacksonwhat's the most painful day to day part of working on large clojure code-bases?
17:20hughfdjacksoni've heard stu halloway refer to 'refactoring data more often than functions' (i believe that's what was said)
17:20hiredmanthat is an interesting question, to which I have no immediate answer
17:21hughfdjackson:D interesting one for me too
17:21hiredmana lot of clojure libraries are not very good (immature?) I almost always end needing to write it in house or use whatever java library directly
17:22daniel__Can anyone see why my server does not close connections here? https://gist.github.com/4048691
17:22hiredmanhard to say, I feel very at home with clojure, so I am sure I am biased
17:22daniel__I'm running it in the repl and it works fine until i kill it with ctrl+c and try to start it again...(Address already in use)
17:22hughfdjacksonare we talking for within the realm of 'standard lib' (manipulating functions/maps/sets/vectors generically), or in the realm of domain-specific support?
17:23hiredmanwrappers around java stuff
17:23daniel__im expecting the finally to get fired and to close the context/socket
17:23hiredmanwe have an inhouse jdbc library now that patches issues with clojure.java.jdbc now, although java.jdbc is generally ok
17:23daniel__oh wait, im not calling comm/close as a function for a start
17:24technomancyhiredman: are you going to bite the bullet and write that intermediate sql representation thing?
17:24hiredmana while ago, maybe a year ago? we did a survey of option parsing libraries written in clojure but all were wanting and we rolled our own
17:24hiredmantechnomancy: :/
17:24jamiiOpening 3 lein repls uses >3GB memory for me. Is that normal? Is there any way to cut it down or do I need just buy a new laptop?
17:25nDuffjamii: resident, or virtual size?
17:25nDuffjamii: for virtual size, that's completely normal. For resident size, not at all.
17:26hughfdjacksonhiredman: what about in terms of refactoring code?
17:26hiredmantechnomancy: I looked a little bit at grabbing the sql ast from derby's parser, but I have not had time to actually write any code
17:26hughfdjacksonor touching code that's been worked on before?
17:26hiredmanhttp://www.infoq.com/presentations/Stop-Refactoring
17:26jamiinDuff: 6 java processes, each with virtual size ~1.8GB and resident 300MB-700MB
17:26jamiinDuff: each repl is just requiring
17:26jamiioops
17:27technomancyjamii: lein trampoline repl will do better if memory consumption is a problem
17:27jamiinDuff: each repl is just requiring nrepl and opening a connection
17:27hughfdjacksonhiredman: that title's pretty striking ;)
17:27hiredmanhughfdjackson: no worries really, having tests can help with that, but not having them doesn't really stop me either
17:27jamiitechnomancy: thanks :)
17:28hiredmanhughfdjackson: "refactoring" is often done with little purpose and just ends up cutting off other possible avenues of execution
17:29hiredmana lot of DRY driven refactoring is really bad about entangling the execution paths of multiple bits of code without providing a simple way to unentangle them
17:29jamiitechnomancy: yep, much more manageable now. new laptop averted :)
17:30gfrederickshiredman: those are interesting statements; I don't imagine you have any pointers to any elaborations of that point?
17:30gfredericksoh wait
17:30gfredericksyou already shared one :D
17:30gfredericksnevermind me
17:31hiredmanif you have commonents A and B and they both do c, so you hoist c out in to C, and directly linke A and B to C, now the execution of A and B both pass through C and you cannot change C without worrying about A and B
17:31hiredmanthe solution to that sort of thing is often higher order, pass in C as an argument to A and B, and if B needs a slightly different C you pass in a slightly different C
17:32hiredmanpeople generally don't do that, they just make a C, and link to it directly from A and B
17:32hughfdjacksondependency injection by any other name would smell as sweet
17:32hiredmangfredericks: I forget if that talk mentions that problem
17:33ToBeReplacedhiredman: isn't that the sort of thing that *bindings* let you dodge in clojure?
17:33gfrederickswell it's at least called "Stop Refactoring" which isn't an argument I've heard even at that high-level yet
17:40hughfdjacksonhiredman: watching that :) cheeres
17:40hughfdjackson*cheers
17:40jkkramer_hiredman: technomancy: there's https://github.com/jkk/honeysql - but it's more of a dsv than an ast. It's working well for me as the target for a higher level lib that deals with relationships and such
17:40jkkramer_hiredman: are you more interested in a sql ast specifically?
17:44hughfdjacksonhiredman: through the first part of this talk, it seems to me that a lot of it has to do with dependencies within a system..
17:44hughfdjacksonlike you said A and B depending on C causes tight coupling
17:45hughfdjacksonis that problem slightly mitigated in fp by its 'pick and choose small lego blocks' nature?
17:46hughfdjackson:p i tried hard to not make that a leading question, and failed utterly
17:46mattishi, is there a function in Clojure equal to Scalas map?
17:47mattissorry, had a typo that fscked my map example
17:57bbloommattis: http://clojure.org/cheatsheet
17:58mattisbbloom: me like :D
18:09bbloomdnolen: ping
18:12dnolenbbloom: pong
18:12bbloomdnolen: so i took a crack at the JS AST
18:12bbloomdnolen: results are promising
18:13bbloomhttps://github.com/brandonbloom/clojurescript/tree/js-ast
18:13bbloomsee compiler.clj and js.clj
18:13bbloomvery early cut at this
18:15dnolenbbloom: that's pretty cool, will definitely take a closer look, does it actually work?
18:16bbloomdnolen: it successfully compiles all the cljs in core and runs SOME of the tests in advanced mode. i have a small advanced mode bug somewhere that is melting my brain
18:16bbloomdnolen: i also had a short thread with some of the google closure tools folks here: https://groups.google.com/forum/?fromgroups=#!topic/closure-compiler-discuss/OEwLWkw4Kug
18:17bbloomdnolen: seems like GWT does exactly what i'd need to do
18:18bbloomdnolen: GWT has it's own AST (seemingly shared with Dart's compiler too) which it translates to the Closure AST. if we wanted, we could do a ast-as-data clojure map thinggie and further insulate clojure from closure (soo many clo-names!)
18:18bbloomdnolen: also, see how they do the source map stuff in http://code.google.com/p/google-web-toolkit/source/browse/trunk/dev/core/src/com/google/gwt/dev/js/ClosureJsAstTranslator.java?r=10778
18:19bblooman applySourceInfo type thing could be trivially added to the code in my fork, which would get us those "free" source maps we talked about
18:19dnolenbbloom: all pretty interesting stuff, you should put your note somewhere public (Confluence) where more people can see and follow along.
18:19dnolenbbloom: so does it see much slower? 50% 20%?
18:19dnolenseem
18:20bbloomdnolen: was planning on publishing some notes; let me run a quick speed test
18:21bbloomdnolen: note that this is the "slower before it gets faster" phase
18:21dnolenbbloom: yes that's understood ;)
18:25bbloomdnolen: heh, much slower. on my machine (compile-root "src/cljs/cljs") takes about 8 seconds, but with the js-ast extra step, it takes about 22
18:26bbloomdnolen: but the new code output is neatly pretty printed ;-) haha
18:27dnolenbbloom: gotta run, but that's great investigation. put the notes up somewhere and I'll look over everything more closely.
19:31hughfdjacksonhiredman: the first half of that was quite interesting
19:31hughfdjackson;) the extended metaphors towards the end got a bit .. extended
19:40jayunit100hmm …. how can i access "this" inside of gen-class ? -- do i need a state field - :(
19:53hiredmanhughfdjackson: yeah
19:53hiredmanhttp://www.infoq.com/presentations/Decisions-Decisions is better
19:53jayunit100ah looks like the way you access the local object in gen-class is similar to the python implementation
19:53jayunit100"this" is sent as the first arg.
19:58jayunit100holy shit ! Code completion in the new counterclockwise is working !
20:01hughfdjacksonhiredman: if only i wasn't on 4G over the weekend, running out of bandwidth :(
20:04milanjhuh, is there a valid howto for setting emacs/slime/clojure
20:04amalloy~swank
20:04clojurebotswank is trust the readme and the readme only. all others will lead you astray.
20:05milanjyeah, I'm already there
20:05amalloythough i understand these days nrepl is what the cool kids are doing
20:05milanjguess so, there is deprecated on swank-clojure page
20:06milanjdamn
20:06bbloomamalloy: that reminds me...
20:06bbloomtpope: i stumbled across this https://github.com/cemerick/piggieback
20:06bbloom:-)
20:06amalloyswank still works fine, if you're already comfortable with slime
20:07milanjI'am, that's why I want to use it
20:07milanjbut I can't make this shit working though
20:12ToBeReplaceddoes the :or path of a map destructure always get evaluated?
20:12ToBeReplaced,((fn [& {:keys [x] :or {x (do (println "here") 1)}}] x) :x 0)
20:12clojurebothere
20:12clojurebot0
20:18muhooToBeReplaced: looks like it does
20:46muhoowow, i've been away from clojure for so long now, i've forgotten like everything :-(
20:46muhoogotta make a point to do some clojure programming, or exercises, or reading, at least once a week, lest my brain atrophy.
21:33FrozenlockIs there a function to make collections from multiple maps with identical keys? I something like [{:text "asdad" :value "123"} {:text "asdad" :value "123"}{:text "asdad" :value "123"}] and I would like to spit it in a csv file. ["text" "asdas" "asdas" "asdas"] ["value" "123" "123" "123"]
21:34brehautmerge-with ?
21:34brehautdoesnt quite do what you want though
21:39FrozenlockBut it's near. (merge-with conj maps) or somehting like that.
21:40brehaut,(map (fn [[k v]] (apply vector (name k) v)) (apply merge-with (fn [a b] (conj (if (vector? a) a [a]) b)) [{:text "asdad" :value "123"} {:text "asdad" :value "123"}{:text "asdad" :value "123"}]))
21:40clojurebot(["text" "asdad" "asdad" "asdad"] ["value" "123" "123" "123"])
21:40brehautthats truely horrible though
21:41FrozenlockOrders of magnitude more appropriate for my needs than the incanter.core/to-dataset I was using :)
21:41FrozenlockThanks
21:43brehautadding to the front of a vector is pretty nasty
21:44brehautif you were to switch to creating lists in the merge-with and then use list* in place of (apply vector …)
21:44brehautit would be less abhorent
21:44brehaut,(map (fn [[k v]] (list* (name k) v)) (apply merge-with (fn [a b] (conj (if (list? a) a (list a)) b)) [{:text "asdad" :value "123"} {:text "asdad" :value "123"}{:text "asdad" :value "123"}]))
21:44clojurebot(("text" "asdad" "asdad" "asdad") ("value" "123" "123" "123"))
21:45amalloy&(let [ms [{:text "asdad" :value "123"} {:text "asdad" :value "123"}{:text "asdad" :value "123"}], ks (distinct (mapcat keys ms))] (cons (map name ks) (for [m ms] (map m ks)))
21:45lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
21:46amalloy&(let [ms [{:text "asdad" :value "123"} {:text "asdad" :value "123"}{:text "asdad" :value "123"}], ks (distinct (mapcat keys ms))] (for [k ks] (cons (name k) (map k ms))))
21:46lazybot⇒ (("text" "asdad" "asdad" "asdad") ("value" "123" "123" "123"))
21:47brehautah nice
21:47Frozenlockamalloy: I'm impressed and scared at the same time :)
21:47brehauttheres much less to be scared of in amalloy's solution
21:48amalloyyeah, most of it is just typing in the data
21:49csleehello
21:50csleeclojure vs clisp, which one do you recommend?
21:51amalloydid you notice the sign on the door when you came in?
21:52csleeyes
21:53bbloomcslee: if you're looking for a debate, you (hopefully) won't find it here. if you're interested in learning a lisp and aren't sure where to start, then we can talk about that
21:54csleeOh sorry
21:55bbloomno worries; we just try to have productive and novel conversations in here :-)
22:20clj_newb_2345what is the best way to read/write _records_ in clojure?
22:21bbloomclj_newb_2345: pr-str and read-string ?
22:22bbloomor any pr and read function
22:22clj_newb_2345on _records_ ?
22:22clj_newb_2345that is too amazing
22:23holohi
22:23bbloomclj_newb_2345: yes :-) having custom datatypes with default implementations of print and read is extremely convenient
22:25clj_newb_2345bbloom: a simple test shows you're correct
22:25clj_newb_2345other langauges have conditioned me to assume taht things are broken by default
22:25clj_newb_2345*cough C++ cough*
22:26bbloomclj_newb_2345: well it's actually an extremely difficult problem in the face of mutability... consider cyclical references
22:26bbloomclj_newb_2345: that's why deftype doesn't provide read or print implementations
22:27bbloomclj_newb_2345: but you can extend the print protocol yourself! and you can install a data literal reader too
22:32tomojhmm https://www.refheap.com/paste/eb42756782a616e37b65b8524
22:33tomojI feel like there's got to be a better way to do that
22:33bbloomtomoj: loop and recur :-)
22:34amalloytomoj: useful has a (possibly over-general) version of that, called glue
22:36amalloyi think yours comes to (glue into [] #(< (count %1) 40) (constantly false) coll)
22:36tomojoh yeah
22:36amalloyi guess that lambda needs to be (fn [a _] (< (count a) 40))
22:38tomojwhat about reducers? :)
22:38muhooweird, in nrepl 0.1.5, the *nrepl* buffer is empty, and the one with the actual repl in it is *nrepl<2>*
22:42amalloyi dunno, for reducers i think you can't do much better than your general approach
22:43amalloyjust write a (batch 40) function that returns a new reducer
22:44amalloyalthough, not sure how you can do that since you need to control the initial value
22:50muhooah, nm, pilot error.
23:24twobitspritewhy can I not get lein to work? I had 2.0-preview, and I would get "wrong number of arguments to install task"... I remove ~/bin/lein and ~/.lein and tried reinstalling, same error...
23:24twobitspritejust now I rebuilt my homedir from scratch, downloaded lein 1.7.1, tried lein install, same error!
23:26amalloyum, what command are you running that generates an error? hard for anyone to help without that
23:30twobitspriteany of them
23:30twobitsprite"lein install <anything>" "lein repl"
23:30amalloywell `lein install <anything>` is wrong, because that task takes no arguments
23:33twobitspritehttp://paste.lisp.org/display/133624
23:34amalloywelp, looks broken to me. ask in #leiningen, probably
23:39amalloycouldn't hurt to rm -rf ~/.m2 first
23:45clj_newb_2345_is there a builtin to take a list of elements, and split it into before/after a given elem? i.e. (split '(2 3 4 1 6 7) 1) = (2 3 4) 1 (6 7)
23:48ChongLi,(split-at 1 '(2 3 4 1 6 7))
23:48clojurebot[(2) (3 4 1 6 7)]
23:48ChongLierr
23:48ChongLithat's not what you want
23:48shachafDo you also want the list on the left to be reversed? :-)
23:48clj_newb_2345_lol
23:48clj_newb_2345_close enough :-)
23:49ChongLia zipper
23:49clj_newb_2345_is find-first (of clojure.contrib.seq-utils) not in mainline het?
23:49clj_newb_2345_wait wait that is not what I want
23:49clj_newb_2345_I don't have the index
23:49clj_newb_2345_I need to find the index first
23:49ChongLiyeah
23:49clj_newb_2345_maybe I hould used a better example
23:49clj_newb_2345_i.e. '(a b c d e f g) 'c => (a b) (c) (d e f g)
23:50clj_newb_2345_ah, I got it
23:50clj_newb_2345_via first, filter, and keep-indexed
23:52tomoj(fn [x coll] (let [[before more] (split-with (complement #{x}) coll)] [before (list (first more)) (rest more)])) :/
23:53metellus,(partition-by #(= 1 %) '(2 3 4 1 6 7))
23:53clojurebot((2 3 4) (1) (6 7))
23:53ChongLi,(split-with #(not= % 1) '(2 3 4 1 6 7))
23:53clojurebot[(2 3 4) (1 6 7)]
23:53ChongLianother one
23:53metellusthat doesn't isolate the 1
23:54ChongLiah good point
23:54ChongLiyours puts the 1 in a singleton list though
23:54metellusyeah
23:54ChongLiso we still don't have exactly what he wants hehe
23:55metellusmine matches his abcdefg example
23:56metellus...and now I see that he left the channel 5 minutes ago
23:56ChongLithat's cause he changed the requirements!
23:56ChongLiah damnit
23:56ChongLiyeah I redirect joins/parts and all that other crap to another window
23:56ChongLisometimes it comes back to bite me like this
23:57ChongLierr no he's still here
23:58ChongLithat was a different client