#clojure log - Nov 09 2012

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:00 * Drakeson looking at dylan ...

0:00 twobitsprite: Drakeson: I recommend it... not something I'd use for a large project, but it's a fun language

0:01 Drakeson: They moved away from sexp. ugh! Just looking at their method dispatch, now ...

0:01 twobitsprite: well, it's not a lisp...

0:03 jkkramer: &(doto (java.util.HashMap.) (.put (Integer. -1) :yay) (.put (Long. -1) :java))

0:03 lazybot: ⇒ #<HashMap {-1=:java, -1=:yay}>

0:05 sjl: &[(= {(Integer. -1) :a} {(Long. -1) :a}) (= #{(Integer. -1)} #{(Long. -1)})]

0:05 lazybot: ⇒ [true false]

0:05 sjl: wait so it works sanely for maps but not sets?

0:05 wat

0:06 twobitsprite: any 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?

0:06 sjl: twobitsprite: it's probably using "electric return" like slimv

0:07 twobitsprite: if you press the close paren key do they jump back up?

0:07 twobitsprite: ahh, yes

0:08 Drakeson: twobitsprite: At first pass it seems they have something very similar to defmulti/defmethod. Does it offer more?

0:08 twobitsprite: Drakeson: I'm not familiar enough with clojures defmulti/defmethod to give an educated comparison

0:10 Drakeson: 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

0:10 honestly, I'm pretty much a complete noob to clojure, so take what I say with a grain of salt :)

0:11 Drakeson: Essentially in defmulti you specify what to look at to decide the dispatch, and it can be anything; an arbitrary function of the params.

0:11 twobitsprite: I 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

0:13 Drakeson: 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

0:13 Drakeson: But 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.

0:14 twobitsprite: Drakeson: well, it's type inference, not dynamicly typed

0:15 bbloom: i don't mean to invoke an ~anyone, but is anyone in here versed with the google closure compiler at all?

0:16 * Drakeson has used closure. *shrug*

0:16 twobitsprite: Drakeson: 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

0:16 Drakeson: never used haskell or ocaml?

0:16 bbloom: Drakeson: have you ever tinkered with the java internals? or just the command line interface?

0:17 jkkramer: sjl: I think it might be a bug in the set impl

0:17 Drakeson: bbloom: only command line. and barely at that. don't let me block your question; perhaps someone else knows more.

0:17 sjl: jkkramer: definitely looks like that, since maps work fine

0:18 jkkramer: sjl: yeah, and sets are implemented using maps

0:18 Drakeson: twobitsprite: I am somewhat familiar with haskell.

0:18 sjl: ...

0:18 jkkramer: this line might be the offender https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentSet.java#L58

0:18 sjl: jkkramer: yeah I'm just going to cast this to a long and get on with my life

0:18 bbloom: issue 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

0:19 ultimately, i want to compile a synthetic ast

0:19 which doesn't seem to be straightforward ... lot's of stuff expects files

0:19 jkkramer: sjl: if you're not on clojure-dev I can write up a post there about it

0:19 Drakeson: bbloom: A synthetic AST? Something more lispy maybe? :p

0:20 sjl: jkkramer: 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 :)

0:20 twobitsprite: Drakeson: 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

0:20 muhoo: ah, dylan. back when apple did research.

0:20 bbloom: Drakeson: well, i'm trying to preserve the performance of clojurescript, which means preserve all the javascript level optimizations :-)

0:21 ultimately, 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

0:22 but in the meantime, i just want to bypass the string step of cljs ast -> js ast -> string -> js ast -> final js string

0:22 Drakeson: bbloom: I see. That's very reasonable.

0:23 twobitsprite: in 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

0:25 Drakeson: twobitsprite: 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.

0:26 bbloom: Also, I personally LOVE to see a Clojure/clang backend and [some] Clojure + C++ interoperability.

0:27 bbloom: Drakeson: i think a few people are working on that

0:27 twobitsprite: I 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

0:27 Drakeson: bbloom: yeah, I noticed that.

0:27 ChongLi: what would happen if we let a million clojures bloom?

0:28 each with their own interops and fractured libraries?

0:28 bbloom: twobitsprite: we already have a clojure-in-clojure: clojurescript... it's just half in java and only supports a javascript target :-P

0:28 ChongLi: I guess that'd encourage everyone to write in pure clojure

0:28 twobitsprite: I 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

0:29 Drakeson: twobitsprite: with Clojure it is a bit different, and it is very reasonable to expect it to happen. Unlike PyPy.

0:29 twobitsprite: bbloom: 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

0:29 bbloom: twobitsprite: my goal isn't purity. i'd like the analyzer to be reusable for other use cases: more advanced macros, etc

0:30 twobitsprite: for example, i have a CPS transform: it relies on the clojurescript analyzer

0:30 twobitsprite: Drakeson: what makes pypy less reasonable that "clojurejure"?

0:30 bbloom: it would only work for clojurescript, but it would be nice if i could get it to work for clojure too

0:30 which means that the analyzer needs to be decoupled from javascript

0:30 it *sorta* is already

0:30 but there's lots more work to be done there

0:31 Drakeson: twobitsprite: 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.

0:32 twobitsprite: Drakeson: 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...

0:33 or, even, a clojure-jvm-c-machinecode interaction :)

0:33 (honestly, I don't know what the jvm is implemented it)

0:34 Drakeson: Twobitsprite: 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.

0:35 twobitsprite: Drakeson: 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

0:36 again, 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

0:37 bbloom: twobitsprite: again, self hosting is not my goal :-P

0:37 twobitsprite: bbloom: I didn't say it was :)

0:38 my 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 :)

0:38 s/happen to/happen to like/

0:39 Drakeson: twobitsprite: 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.

0:39 twobitsprite: in 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 :)

0:40 Drakeson: twobitsprite: Pleasant serendipity ;)

0:40 twobitsprite: Drakeson: I could s/clojure/python and s/java/c in your sentence and it would mean the same thing

0:42 Drakeson: 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...

0:42 Drakeson: No 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.

0:44 For 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.

0:44 *matter

0:45 twobitsprite: Drakeson: 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

0:46 in 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...

0:48 jkkramer: sjl: clojure-dev post written, with a proposed fix

0:48 Drakeson: For 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.

0:48 ChongLi: twobitsprite: ?

0:48 GHC is self-hosted, no?

0:50 Haskell is listed as a self-hosted language on wikipedia

0:50 Drakeson: ChongLi: the runtime is written in C, right?

0:50 ChongLi: not sure

0:51 GHC is written in Haskell though

0:51 Drakeson: (and compiling passes through C, IIRC)

0:51 bbloom: it compiles to either C-- or LLVM IR

0:51 ChongLi: GHC can do its own code-gen without going through C

0:51 hiredman: http://en.wikipedia.org/wiki/C--

0:52 Drakeson: ChongLi: yes, but that would not produce optimal native code.

0:52 ChongLi: that doesn't disqualify Haskell from being self-hosted

0:54 twobitsprite: ChongLi: 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

0:54 c

0:55 ChongLi: sure, what's your point?

0:56 twobitsprite: I 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

0:56 Drakeson: ChongLi: 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!

0:57 twobitsprite: in fact, I think pypy and ghc are probably the most successful attempts I know of, and they aren't even all the way there

0:57 ChongLi: GHC is written in Haskell

0:57 that's all that's needed to qualify as a self-hosted language

0:58 Sgeo: Isn't the runtime that GHC-produced programs use written in C?

0:58 twobitsprite: I guess if that's how you define it....

0:58 ChongLi: it is

0:58 twobitsprite: Sgeo: shh... it's self-hosted, dammit! the compiler!!11

0:58 Sgeo: Oh, twobitsprite already said that

0:58 ChongLi: because GHC can compile itself

0:58 twobitsprite: got it

0:59 Sgeo: How about most Common Lisp implementations?

0:59 SBCL, Clozure CL, I don't remember the rest

0:59 Drakeson: Point 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.

0:59 Raynes: Haskell is llvmified

1:00 shachaf: I don't think people care about performance compromise all that much in a compiler.

1:00 twobitsprite: I 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 :)

1:00 ChongLi: Drakeson: I disagree

1:01 shachaf: Anywya, the C RTS I use is totally not written in C! Not self-hosted!

1:01 Drakeson: ChongLi: then what is the point of self-hosting?

1:01 ChongLi: that's a silly idea

1:02 shachaf: There's no "point" to it.

1:02 The GHC people happen to like Haskell, so they wrote their compiler in it.

1:02 ChongLi: and it does demonstrate the use of Haskell

1:03 I just think it's silly to believe one language can totally surpass another

1:03 or other such notions

1:03 twobitsprite: also, isn't GHC actually, largely written in some almost-subset of haskell?

1:03 ChongLi: languages are tools

1:03 shachaf: ChongLi: So are people who argue about languages!

1:03 ChongLi: haha

1:03 twobitsprite: burn... :P

1:04 Drakeson: I 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?

1:04 shachaf: twobitsprite: If anything it'd be written in a superset, wouldn't it?

1:04 Drakeson: Compilers aren't a static thing.

1:04 Well, GHC isn't, at least.

1:04 What's the point of porting any program?

1:04 ChongLi: in the case of GHC, it's to take advantage of new language features in the compiler itself

1:05 twobitsprite: shachaf: 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

1:05 shachaf: (GHC wasn't ported, anyway, was it?)

1:05 Hmm, no, GHC was originally in Lazy ML.

1:05 But that's basically Haskell. :-)

1:05 twobitsprite: ... with a different syntax

1:05 shachaf: If anything, you'd have to be crazy to write a compiler in C.

1:06 twobitsprite: anyways... 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

1:07 ChongLi: and usually your first "bootstrap" compiler is just a quick and dirty one to compile the real compiler for the first time

1:07 twobitsprite: with that said... it's past my bed time... g'night :)

1:07 jyu: hello how to use midje in vim, it says the midje is not found actually it is in the project.clj

1:07 ChongLi: and then you use that real compiler to compile itself in a much cleaner, more optimized way

1:07 shachaf: GHC wasn't the first Haskell compiler.

1:07 Drakeson: shachaf: C is often easier than ASM, and has better portability. Good for starting/bootstraping etc.

1:08 shachaf: Drakeson: Well, sure. But C is still way too low-level for most interesting things you'd want to do in a compiler.

1:08 twobitsprite: (erlang was bootstrapped in prolog :P)

1:08 (or was it datalog?)

1:09 talentd: prolog

1:09 it's self hosted these days tho

1:09 ChongLi: I think another "point" of self-hosting your language is to make an argument for using that language

1:09 Drakeson: shachaf: yes, so if you have other languages on your platform then C doesn't make sense anymore.

1:09 ChongLi: but it's a rather specious one

1:09 shachaf: My platform is, like, an abstract graph reduction machine, man.

1:10 You have to do extra work to get C running on it.

1:10 ChongLi: Drakeson: C still makes sense if you need what it offers

1:10 talentd: i think the best reason for self hosted languages is that it leads to better tools generally

1:11 shachaf: GHC's code is kind of scary.

1:11 Drakeson: talentd: that is essentially the purity argument.

1:11 shachaf: I have the feeling some of it hasn't been updated in 20 years...

1:12 tomoj: is there a non-awkward way to do multiline docs for a def?

1:12 ChongLi: shachaf: that's where SPJ sings the praises of the type system

1:12 he can start hacking on that old code and the type errors are his safety net

1:12 Drakeson: ChongLi: I would pick haskell over C for writing a new compiler at any moment.

1:13 ChongLi: yeah

1:13 shachaf: ChongLi: I think some of the code predates Monad. :-)

1:13 Drakeson: In other words, I don't know what C offers for developing a compiler, that a higher level language does not offer.

1:13 ChongLi: Haskell is really nice for writing parsers and such

1:14 shachaf: And a compiler is basically just a parser, right?

1:14 Drakeson: tomoj: I would love to know if there is.

1:15 ChongLi: a parser is a part of a compiler

1:15 Drakeson: shachaf: no, but many other things are also easier in a high level language when you are not hard-pressed for performance.

1:15 shachaf: The most important part!

1:16 Once you've got an AST you're basically done.

1:16 ChongLi: yeah I suppose you're right

1:17 tomoj: I guess it's only slightly awkward - the first line is just a little too far to the right

1:17 not as bad as multiline docs nested in a datomic schema

1:23 ChongLi: sometimes I wonder what it'd be like if lisp machine OSes became the norm instead of unix

1:30 bbloom: shachaf: that's not even close to right....

1:31 the closurescript compiler defers completely to jvm clojure's reader

1:31 the parsing part is trivial

1:31 ChongLi: I think shachaf was being sarcastic

1:31 it's hard to tell on the internet

1:31 bbloom: the source code analysis and target code generation part are far more complex

1:31 * bbloom must be tired

1:32 SegFaultAX: Suppose 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.

1:32 shachaf: Sorry, bbloom.

1:33 bbloom: SegFaultAX: can you provide an example?

1:34 ivan: is there some rhyme to to Associative not being IAssociative?

1:34 not being called that, I mean

1:35 bbloom: ivan: i think it's just evolutionary. it's somewhat unfortunate that there are java interfaces instead of closure protocols for many key bits

1:35 ivan: I see, thanks

1:36 ChongLi: SegFaultAX: something like this?

1:36 ,(map #(* % %) (take 5 (range 10)))

1:36 clojurebot: (0 1 4 9 16)

1:36 ChongLi: or

1:36 SegFaultAX: 3 line paste incoming:

1:36 (defn take-interval-by [pred n coll]

1:36 (let [size (count (take-while #(apply pred %) (partition n 1 coll)))]

1:36 (take (dec (+ size n)) coll)))

1:37 Imagine using that with say (take-interval-by #(= %2 (inc %1)) 2 [1 2 3 5 6 7])

1:37 It would consume until the first non-sequentially increasing number if found and return that subsequence, eg (1 2 3)

1:38 The next iteration would be the exact same thing, but with (drop (count prev-result) coll), eg (5 6 7)

1:39 The trick here is the amount that's dropped is variable. It's dependent on the length of the previous result.

1:40 bbloom: Does that make it more clear or less clear?

1:40 Sgeo: Why can't I create code that contains arbitrary objects>

1:41 SegFaultAX: ChongLi: Uh, what?

1:41 bbloom: SegFaultAX: have you seen partition-by ?

1:41 SegFaultAX: bbloom: Of course.

1:41 ChongLi: SegFaultAX: disregard what I said

1:41 SegFaultAX: bbloom: This clearly is not that.

1:41 ChongLi: I didn't understand your original question

1:42 what about using something like Haskell's subsequences function?

1:42 it lazily returns all subsequences

1:42 bbloom: SegFaultAX: i'm still not sure what you're asking for.... maybe it would be easiest to just write it out with loop and recur?

1:43 ChongLi: then you can filter that lazy sequence

1:43 SegFaultAX: bbloom: I have already. Well, actually with a lazy seq.

1:43 I was wondering if there was a nicer way to do it.

1:43 bbloom: SegFaultAX: well in that case, paste that code to ref heap

1:43 SegFaultAX: ChongLi: I definitely don't want all subsequences.

1:43 ChongLi: that's not the point

1:44 SegFaultAX: ChongLi: I want specific subsequences based on some predicate that loosely defines an interval.

1:44 ChongLi: that's where filter comes in

1:44 you filter a lazy seq

1:45 SegFaultAX: ChongLi: Not what I'm looking for.

1:45 ChongLi: The overhead is pointless in this case.

1:45 ChongLi: oh

1:45 you didn't say anything about overhead

1:45 I thought you just wanted a simple implementation

1:46 SegFaultAX: ChongLi: That's over the top wasteful, though.

1:46 ChongLi: it depends really

1:46 SegFaultAX: ChongLi: Not it doesn't. I'd have to generate every subsequence to guarantee I find the longest intervals.

1:47 ChongLi: Whereas this implementation guarantees it. It's just ugly making it build a list of all intervals once the interval function is defined.

1:47 ChongLi: I thought they had all started from the beginning?

1:47 bbloom: SegFaultAX: post your working code to refheap

1:48 ChongLi: so you can stop at the first invalid subsequence

1:48 SegFaultAX: ChongLi: I want all intervals, though.

1:48 ChongLi: hmm, I guess I still don't understand your problem

1:50 SegFaultAX: bbloom: Sec.

1:50 wingy: ChongLi: from china?

1:50 ChongLi: no

1:51 I'm not even chinese

1:51 just a movie character :)

1:51 wingy: lol

1:51 you fooled me!

1:55 SegFaultAX: bbloom: https://www.refheap.com/paste/6498

1:56 bbloom: Those should be using s, not coll. But you get the idea.

1:56 ibdknox: Anyone make it to rich's talk tonight at QCon? I couldn't make it unfortunately

1:57 curious what he talked about

1:58 SegFaultAX: Pretty good chance it was about reducers, datomic, and/or values are awesome. :)

1:59 wingy: ibdknox: very good release of LT! finally i can work with my project using it

1:59 im curious if you are coding it alone

2:00 ibdknox: Currently, yes

2:00 bbloom: SegFaultAX: you're looking for shorter code? or more efficient? or what?

2:00 wingy: impressive

2:00 ibdknox: My co-founder has been doing most everything else so I can focus on building it

2:00 SegFaultAX: bbloom: More idiomatic, perhaps?

2:01 bbloom: *shrug* if it works, it's probably fine :-P

2:02 bbloom: but you walk the lazy collection several times

2:02 evaluating pred each time a whole bunch

2:02 er SegFaultAX: haha shouldn't bbloom: myself :-P

2:02 * bbloom is definitely tired

2:02 bbloom: if you need it to be more efficient, just write it out long hand recursively with the lazy-seq

2:02 it will probably be roughtly the same amount of code

2:04 tomoj: (def wrap-map (partial partial map))

2:05 (def wrap-rmap (partial r/map))

2:05 (def wrap-seq-fn (partial partial partial)) ?

2:08 SegFaultAX: bbloom: What do you mean I walk the seq multiple times?

2:08 take-while + take + drop I guess.

2:08 bbloom: SegFaultAX:

2:08 yeah

2:09 SegFaultAX: really tho, i wouldn't worry about it

2:09 SegFaultAX: if that function proves slow or broken, deal with it then :-)

2:14 SegFaultAX: bbloom: You're probably right. Thanks for your input!

2:14 Sgeo: Isn't avoiding walking it multiple times the point of the laziness?

2:14 bbloom: SegFaultAX: 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

2:14 Sgeo: What's the function in question

2:15 Oh, I see

2:44 tomoj: suppose #'foo is stateful, is there a simpler form of (fn [x] ((foo) x)) ?

2:51 AimHere: That seems pretty simple to me. It can be sugared into #((foo) %)

2:51 Saves you a few keystrokes

3:05 dbushenko: hi all!

3:05 I've noticed that the Noir framework has not been updated for 4 mounths. Even pull requests are still hanging with no response

3:06 is Noir still supported?

3:06 or may be abandoned?

3:09 wingy: dbushenko: 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

3:09 compojure/ring/hiccup

3:09 no magic

3:10 dbushenko: wingy: Noir automates some tasks and looks a bit more high-level comparing to compojure

3:10 but the question is whether Noir is still supported :-)

3:10 wingy: the question should be is Noir mainstream .. something that is mainstream won't be dropped

3:11 rather than something just hanging around

3:12 something that is mainstream will also get better constantly (features, bug fixes, docs etc)

3:12 dbushenko: I'm not interested whether Noir is mainstream or not. I don't care :-) I just wanna it supported

3:26 mudge: when using gen-class and extending a class, how to call the super constructor?

3:29 mpenet: ,(meta (persistent! (transient (with-meta {:a 0 :b 1} {:foo :bar}))))

3:29 clojurebot: nil

3:29 mpenet: this looks like a bug, or is this expected?

3:31 Raynes: dbushenko: Chris is busy with Light Table.

3:31 I lack sufficient motivation to really get anything done.

3:31 I've been meaning to go through the pull requests.

3:31 Will as soon as I get a chance.

3:35 tomoj: &(with-meta (transient {:a 0 :b 1}) {:foo :bar})

3:35 lazybot: java.lang.ClassCastException: clojure.lang.PersistentArrayMap$TransientArrayMap cannot be cast to clojure.lang.IObj

3:35 * mpenet is sad

3:35 mpenet: ok

3:36 I think I rememer reading somewhere on the ML it would be patched (a long time ago)

3:36 remember*

3:44 dbushenko: Raynes: that's sad... I really like Noir

3:44 and I think, lots of people do

3:45 Raynes: how do you think, will you or Chris support Noir, or would it be better to switch to pure Compojure?

3:47 foodoo: I guess Chris is currently pretty busy with Light Table

3:47 dbushenko: yes, he is. but what about Noir? I mean, will anyone spend some time on Noir or just put all the forces on Light Table?

3:48 muhoo: dbushenko: raynes is the guy currently holding the reins of noir, and he just said he's not actively doing much with it

3:49 dbushenko: OMG... I've seen that! I want to know about the future of Noir

3:49 muhoo: the future is what you make it. you could always fork it and start maintaining it. it's on github.

3:50 foodoo: or sending in patches to people with commit priviledges

3:50 muhoo: i did some work on it, and eventually realized it'd be easier to just use compojure instead.

3:50 dbushenko: foodoo: there are a couple of pull requests that are hanging for months

3:51 muhoo: probably, you are right

3:51 but thats really sad since Noir is great!

3:52 muhoo: well, it's great if you're coming from django or rails, until you get proficient enough where it gets in your way.

3:52 dbushenko: muhoo: what do you mean?

3:52 muhoo: it uses atoms to store state, not very functional.

3:53 i 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.

3:53 it also uses macros heavily, which don't compose so well.

3:53 jyu: i wonder why use cupp to write the view rather than template engine

3:55 dbushenko: muhoo: compojure doesn't have those problems?

3:55 muhoo: hasn't as far as i've seen, no.

3:56 dbushenko: so how about routing? it looks like compojure has not so convinient mechanism for routes definition

3:56 muhoo: it's pretty simple. noir puts some sugar around it, but ultimately it's all compojure doing the routing, even in noir.

3:57 dbushenko: yep, I know. but how do you deal with it? do you define all routes in one file?

3:57 muhoo: been a few months since i dealt with noir tho, so this is from my imperfect memory.

3:57 mpenet: dbushenko: routes are just values you can import, compose etc

3:58 dbushenko: can you give me an example? I had difficulties with routes while trying to make the app more modular

3:58 mpenet: there are examples on compojure wiki I think

3:59 https://github.com/weavejester/compojure/wiki/Nesting-routes

3:59 wingy: a suggestion: deprecate noir if its not prioritized .. would make the clojure community stronger when people see what is mainstream

3:59 muhoo: dbushenko: https://github.com/clojurebook/ClojureProgramming/blob/master/ch16-web-leiningen/src/com/clojurebook/url_shortener.clj

4:00 dbushenko: also https://github.com/clojurebook/ClojureProgramming/blob/master/ch16-web-repl-interactions.clj

4:00 wingy: like Steve Jobs deprecating all the mediocre products to keep focus on only those who matter

4:01 dbushenko: muhoo: looks like you are ritht

4:01 muhoo: I think, I have to check it out. May be I will not miss Noir so much :-)

4:03 muhoo: dbushenko: have fun :-) also, i can recommend clojurebook.com, the compojure/ring section was clear to me (coming from django/rails/php/etc background)

4:10 tomoj: why doesn't oauth-clj's consumer return a ring response :(

4:57 Raynes: muhoo: I'll never understand why people think Noir's route definitions are more 'convenient' than Compojure's. :\

4:58 sunkencityryleh: compojure rocks!

4:59 especially if you add back the old functionality where you can send a list of hiccup data and have Renderable render hiccup

5:09 clgv: "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?

5:14 tomoj: looks like it's 3^n - 1 ?

5:15 er

5:15 3^(n+1) - 1

5:15 if n is the number of args

5:15 ejackson: clgv: yeah the combitorics got em

5:15 abp: Hi, 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.

5:15 ejackson: combinatorics

5:15 tomoj: so for 5 args, 729 interfaces?

5:15 728

5:15 clgv: ejackson: wouldnt be a problem if the interfaces could be generated with clojure ;)

5:15 ejackson: clgv: too bad we're not a lisp

5:16 what are the types: long, double and ?

5:16 tomoj: object

5:17 ejackson: ok, so then then for 5 its 3^5 possibilities right ?

5:17 what about the return type ?

5:17 tomoj: there are also 3 return type possibilities, and they can't all be objects

5:18 so 3^(n+1) - 1

5:18 ejackson: yeah, then I agree

5:18 that's a lot

5:20 abp: Ok, 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.

5:20 *window onload

6:19 maleghast: ibdknox: Do you have a moment for a Korma-related query..?

6:20 Raynes: I doubt it, since it is 3:18AM where he lives.

6:20 muhoo: Raynes: and it's 6:18AM where you are?

6:21 Raynes: 5:19AM

6:21 muhoo: damn

6:21 maleghast: Raynes: Oh bugger… Thanks, I will try him later...

6:21 otfrom: Raynes is hardcore

6:21 Raynes: I should probably sleep at some point.

6:21 muhoo: sleep is for old people :-)

6:22 * muhoo is old, goes to sleep at 3:18am

6:22 muhoo: nite

6:25 maleghast: Anyone else know how to tell JDBC driver for MySQL to NULL zero value DateTime fields, through Korma?

6:25 (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)

6:27 Anderkent: that would probably help. I find myself using korma simply as a lisp-y sql, the more advanecd features (entities / select with etc.) seem unreliable.

6:30 maleghast: Anderkent: http://pastebin.com/vM3k4fRc

6:32 Anderkent: Like I said that works in the REPL (lein repl) but not when I run my server...

6:33 Anderkent: Do 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

6:33 maleghast: I have tried it with the less complex definition commented out and also completely removed from the code.

6:36 What 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

6:37 more 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

6:39 Anderkent: and it only does that if you specify this particular subname?

6:39 maleghast: Yeah, if I connect like this: (defdb db (mysql {:db "vivastreet_gb" :user "root" :password "password" :host "192.168.192.138" :port "3306"}))

6:39 it works fine until it encounters a row with an invalid DateTime value

6:39 Anderkent: right, try specifying both host and the subname

6:40 hm no actually nvm

6:40 well... you can try it anyway :P

6:40 maleghast: I will, hang on :-)

6:41 Anderkent: korma by default sets host to localhost, so it could be jdbc doesnt like when you give it host=localhost but subname=tcp://192....

6:42 maleghast: Well, unfortunately that does not work, but it was a good idea :-) Thanks

6:45 Anderkent: you 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

6:47 maleghast: Anderkent: 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.

6:47 I will try it from the REPL though and see if I can "spot the difference"

6:48 (between the two connection methods)

6:48 Anderkent: put 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

6:48 if that's possible :P

6:49 maleghast: Anderkent: I am not certain, I will check...

6:55 Anderkent: Anyone used drift for migrations? Can't seem to make it work with timestamp-versioned migrations.

6:57 maleghast: Anderkent: I fixed it! I just removed "tcp:" from the sub name declaration and it works!

6:57 Thanks for your help anyway

7:00 Anderkent: glad you fixed it :)

7:25 Anyone know how to make korma handle UUIDs?

7:36 nvm, apparently jdbc is smart enough that you can just give it a java.util.UUID and it figures stuff out.

7:59 Better 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.

8:03 abp: Is there a better way to do this: ,(-> [] (conj 1) (into [2 3 4]) (conj 5))

8:03 Is there a better way to do this: &(-> [] (conj 1) (into [2 3 4]) (conj 5))

8:03 Hum, how can I get the bots to work? :)

8:04 Anderkent: ,(-> [] (conj 1) (into [2 3 4]) (conj 5))

8:04 clojurebot: [1 2 3 4 5]

8:05 Anderkent: need to start with ,/&

8:05 abp: Anderkent: Oh ok, thanks.

8:07 Anderkent: If i get it right you want to add a prefix and a suffix to a given vector?

8:11 abp: Anderkent: yes

8:11 Anderkent: but given sequence, not necessarily vector

8:17 Anderkent: doesn't help that cons and conj take args in different order, so you can't thread it nicely...

8:17 ,(cons 1 (conj [2 3 4] 5))

8:17 clojurebot: (1 2 3 4 5)

8:59 Chiron: Hi, how access a static class nested in another non-static class ?

9:04 nDuff: Chiron: in terms of naming? OuterClass$NestedClass; if that isn't it, you'll need to be a little more specific re: the question.

9:04 Chiron: yes, i need the path to it

9:17 here, https://github.com/nathanmarz/storm-contrib/blob/master/storm-kafka/src/jvm/storm/kafka/KafkaConfig.java how to access StaticHosts ?

9:19 Anderkent: oh god clojure is non-breaking-space-sensitive TT

9:20 good luck solving "CompilerException java.lang.RuntimeException: Unable to resolve symbol:    in this context, compiling:(NO_SOURCE_PATH:1)"

9:21 Chiron: import 'storm.kafka.KafkaConfig$StaticHosts)

9:21 ClassNotFoundException storm.kafka.KafkaConfig$StaticHosts java.net.URLClassLoader$1.run (URLClassLoader.java:202)

9:22 nvm

9:26 jakubH: Does 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")

9:26 (I want to experiment with a java project using repl)

9:31 Anderkent: ,add-classpath

9:31 clojurebot: #<core$add_classpath clojure.core$add_classpath@50984625>

9:31 Anderkent: ,(doc add-classpath)

9:31 clojurebot: "([url]); DEPRECATED Adds the url (String or URL object) to the classpath per URLClassLoader.addURL"

9:33 Anderkent: well, it's deprecated but it should do for experimentation... In general you just want to give :java-source-paths to lein

9:33 jakubH: https://github.com/technomancy/leiningen/blob/master/doc/MIXED_PROJECTS.md

9:34 jakubH: Anderkent: thanks but it is java-only project, I have/want no project.clj

9:35 htough I guess that creating project.clj may be the easiest way after all...

9:35 xeqi: jakubH: lein isn't designed for that use case, you could try manually invoking java with the right classpath

9:35 andrewmcveigh|wo: jakubH: If you java project is using maven, you could use the clojure-maven plugin to get a repl running.

9:36 jakubH: thanks, I will look into the clojure-maven thing

9:39 Anderkent: jakubH: sorry, I misunderstood. Indeed clojure-maven-plugin or the zi plugin are what you want to use

9:41 jakubH: thanks a lot, guys!

10:09 Anderkent: Is there a multiple-bindings if-let? I.e. if all bindings are true, do 'then', otherwise do 'else'.

10:14 dspp: if ^String is a type hint, what's something like #^ZMQ$Socket

10:14 not sure what the hash signifies, can't find anything on it

10:16 andrewmcveigh|wo: dspp: type hints (and metadata generally I think) used to start with #^

10:16 steveo`: Anderkent: I don't think so but I've found myself wanting that too.

10:19 mdaines: I 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:19 dspp: ah andrewmcveigh|wo, so its old / deprecated syntax?

10:19 mdaines: I'm using DataInputStream, so this works:

10:20 (defn one-byte [data] (.readByte data))

10:20 gtrak: mdaines: you can't require a java method?

10:20 mdaines: but this does not:

10:20 (defn two-bytes [data] ((juxt .readByte .readByte) data))

10:20 gtrak: java methods don't implement IFn, use memfn or anon functions to wrap them

10:20 mdaines: Do I need to require it specifically? I thought importing the class was enough.

10:20 andrewmcveigh|wo: dspp: I think so. I don't know of anything it's used for now.

10:21 gtrak: mdaines: yes, I think that part's right. The problem is clear from your use of methods

10:22 mdaines: gtrak: 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:22 Anderkent: mdaines: your second example should not work in a REPL either

10:22 gtrak: mdaines: java interop is like special forms, they don't eval like normal function calls

10:22 Anderkent: i'd expect 'unable to resolve symbol'

10:22 mdaines: Anderkent: It does.

10:23 It lulled me into a sense of comfort because it wasn't complaining at all

10:23 gtrak: too much comfort!!

10:23 Anderkent: (defn two-strings [data] ((juxt .toString .toString) data)) does not work for me

10:23 magic.

10:26 clgv: Anderkent: because it's a java method - they are not first class functions like clojure's

10:26 Anderkent: well yes, that's what i expected

10:26 but mdaines claims his two-bytes works in his repl, so there's some magic there :)

10:27 mdaines: Hmm, it isn't working now. I thought I had it last night.

10:28 Anderkent: :) Happens to the best of us.

10:28 maybe you did (juxt one-byte one-byte) ?

10:28 mdaines: I've got other methods invoking java methods in a function, but it must be something about juxt that I wasn't doing before.

10:28 gtrak: Someone must have pushed an update since then :-)

10:30 mdaines: OK, 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:31 TimMc: Yep, it's in the call position.

10:35 mdaines: The clojuredocs.org entry for memfn could be better. Jay Fields' blog has better examples.

10:36 Anderkent: ,(doc memfn)

10:36 clojurebot: "([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:36 Anderkent: sounds clear enough to me, but oh well :P

10:37 gtrak: flatland useful has a type-hinted one I think

10:37 mdaines: On 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:38 gtrak: keywords

10:39 mdaines: Anderkent: 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:39 Kototama: hi, stdout is not displayed in the nrepl buffer when using compojure, any idea how to fix that?

10:40 gtrak: Kototama: stdout is stdout, clojure progs use the *out* var, which gets bound to your buffer.

10:40 (println) will do the right thing. System.out.println won't

10:40 Kototama: I use (prn or pprint

10:41 it does not work, it used to work with swank

10:41 gtrak: hmm... then something else is wrong and my argument's irrelevant :-). It should be going through that var, though.

10:43 Kototama: this makes debugging hard :-)

10:44 maybe it's a problem with the multiple thread, like this http://osdir.com/ml/clojure/2011-07/msg01422.html ?

10:46 gtrak: not obvious to me from glancing at the nrepl source where the *out* gets set

10:47 Kototama: ah it works if I use the log function defined in the thread

10:47 but I used to work without in swank

10:47 -I+it

10:51 jweiss: is 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:52 nDuff: "old behavior"?

10:52 TimMc: jweiss: You want to chain an override?

10:53 jweiss: not exactly sure what that means but i think so

10:54 eg 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:55 TimMc: jweiss: http://clojuredocs.org/clojure_core/clojure.core/get-method perhaps?

10:55 (let [old (get-method ...)] (remove-method ...) (defmethod ...))

10:56 jweiss: TimMc: ah great thanks

10:57 TimMc: I'm not sure what happens if that gets eval'd twice. :-)

11:03 alexnixon: is there a nice way of passing a map of args to a function expecting named params?

11:03 like this but more idiomatic:

11:03 ,(let [f (fn [& {:keys [foo bar]}] foo)] (apply f (flatten (seq {:foo 1})))))

11:03 clojurebot: 1

11:03 TimMc: ~mapply

11:03 clojurebot: You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))

11:03 TimMc: alexnixon: You really don't want to use flatten.

11:04 ~flatten

11:04 clojurebot: flatten 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:04 alexnixon: TimMc: thanks

11:05 TimMc: I don't know why the Clojure lib guidelines promote named args; it's a real pain to use.

11:05 alexnixon: that's what I'm finding :-/

11:06 jweiss: how do i get lazybot to print the source of a core fn

11:12 Anderkent: ,(source defn)

11:12 clojurebot: Source not found

11:12 Anderkent: hm :P

11:12 ,(source prn)

11:12 clojurebot: Source not found

11:13 Anderkent: don't know :P

11:13 metellus: ,(doc source)

11:13 clojurebot: "([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:14 Anderkent: do (entity-fields) work in Korma at all? Doesn't seem to have any effect.

11:27 goracio: ,(doc defn)

11:27 clojurebot: "([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:28 goracio: you need macroexpand i guess

11:28 to look at the code

11:45 clgv: alexnixon: checkout https://github.com/guv/clojure.options

11:53 alexnixon: clgv: thanks for that

11:53 clgv: alexnixon: report back if you have problems using it^^

11:57 alexnixon: it's unfortunate that a third-party library is needed to make a core language feature palatable

11:59 hiredman: it is difficult to see what that library brings over destructuring

12:00 clgv: hiredman: transitive option documentation

12:00 alexnixon: and it helps cut down boilerplate when passing options around

12:01 clgv: hiredman: ah yes, and the easy ability to pass on options - otherwise the transitive option documentation would make no sense ;)

12:01 hiredman: if you say so

12:01 alexnixon: clgv: 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:02 clgv: alexnixon: well then you shouldnt pass on the optionmap. since then someone my change an internal option

12:03 alexnixon: I use that library a lot.

12:03 amalloy: ~def defn

12:12 TimMc: ooooolllldd

12:13 amalloy: still perfectly adequate for defn though :P

12:13 $source defn

12:13 lazybot: defn is http://is.gd/lcpCpj

12:14 TimMc: (inc lazybot)

12:14 lazybot: ⇒ 7

12:14 TimMc: lazybot: You will never escape the karmic cycle!

12:14 you are doomed to be rebooted over and over again

12:50 jweiss: i'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:50 i would have expected to see recur instead

12:50 clgv: jweiss: range is lazy

12:51 jweiss: 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:51 that's it in short ;)

12:52 jweiss: clgv: 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:53 i guess the lazy-seq macro effectively un-recursive's it?

12:53 clgv: jweiss: no. a lazy-seq does not calculate anything if you dont access the element

12:53 amalloy: jweiss: (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:54 clgv: and if you access elements thats iterative, so one element at a time is calculated

12:54 amalloy: since range uses your stack instead of growing its own deeper and deeper, there is no overflow

12:55 jweiss: ok, i think that makes sense. thanks

13:16 TimMc: jweiss: I found reading LazySeq.java to be enlightening.

13:16 jweiss: TimMc: 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:17 never did figure out how to handle that for a ChunkedCons

13:21 xclite: If 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:21 am I looking for agents?

13:21 clgv: xclite: yeah. use an agent

13:22 xclite: clgv, thanks, just wanted to make sure that was the best path.

13:23 clgv: jweiss: clojure 1.4 helps you with `realized?`

13:24 jweiss: clgv: yeah, doesn't work on some types though, like Cons, ChunkedCons

13:24 clgv: jweiss: cons are always realized, no?

13:25 jweiss: although i guess a pure Cons isn't lazy

13:25 it's the lazy-seq's chained together with Cons

13:25 i still couldn't figure out how to do it with what range returns

13:25 i am not sure how ChunkedCons works

13:26 is each Cons cell a chunk? or is a chunk a bunch of Cons cells?

13:26 mudge: how 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:26 clgv: jweiss: it should work with range. but range is not lazy on one number but on whole chunks of 32 numbers

13:27 jweiss: clgv: so it is chunks Cons'd together

13:27 clgv: jweiss: yeah range builds one chunk at a time

13:28 uvtc: Is there a "deprecated" Clojure features list anywhere?

13:29 Maybe better to ask: are there *any* features of Clojure which are deprecated? :)

13:30 mudge: Anybody here used :exposes in gen-class before?

13:31 gtrak: uvtc: don't use structs

13:32 uvtc: gtrak: right. defstruct.

13:32 gtrak: auto-promoting math

13:32 uvtc: I thought there might be a list or doc somewhere re. deprecated features.

13:32 gtrak: not deprecated, broken that one

13:32 uvtc: Hm. "best practices" that.

13:33 gtrak: :use

13:33 uvtc: gtrak: Yeah, that's kinda' why I ask. Was just reading that ML thread.

13:35 Ah. I see `:deprecated ...` in metadata in core.clj in some places. Ok.

13:51 TimMc: ,(for [[s v] (ns-publics 'clojure.core) :when (:deprecated (meta v))] s)

13:51 clojurebot: (add-classpath replicate agent-errors clear-agent-errors)

13:51 TimMc: ,(doc replicate)

13:51 clojurebot: "([n x]); DEPRECATED: Use 'repeat' instead. Returns a lazy seq of n xs."

13:53 TimMc: ,(for [[s v] (ns-publics 'clojure.core) :when (when-let [d (:doc (meta v))] (re-find #"(?i:deprecated)" d))] s)

13:53 clojurebot: (add-classpath replicate agent-errors clear-agent-errors)

13:54 amalloy: TimMc: what's the : in (?i:deprecated) for?

14:08 ToBeReplaced: with 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:08 i'm wondering if it might be a side effect of using clj-http-fake

14:09 the-kenny: ToBeReplaced: I think we had that in our product too. Sometimes you get an InputStream, sometimes this Stringy-Thing, somestimes nil

14:09 We have a custom middleware to handle that

14:10 uvtc: amalloy: case-insensitive but using a non-capturing group, I think.

14:16 ToBeReplaced: the-kenny: so you just wrap the client requests with something that calls getContent on the body?

14:20 the-kenny: ToBeReplaced: Yup, just dispatch on (class (:body foo)) or so.

14:21 Cubic: ,(reduce #(assoc %1 %2 []) [:key :otherkey] {})

14:21 clojurebot: [:key :otherkey]

14:21 Cubic: I'm confused. Shouldn't this be {:key [] :otherkey []}?

14:22 S11001001: Cubic: you've got the last 2 args backwards

14:22 amalloy: those both look pretty nonsense, Cubic

14:23 S11001001: ,(doc repeat)

14:23 clojurebot: "([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs."

14:24 S11001001: &(doc repeat)

14:24 lazybot: ⇒ ------------------------- clojure.core/repeat ([x] [n x]) Returns a lazy (infinite!, or length n if supplied) sequence of xs. nil

14:24 S11001001: ,(zipmap [:key :otherkey] (repeat [])) ;moreover

14:24 clojurebot: {:otherkey [], :key []}

14:25 S11001001: Cubic: HOFs, reduce, loop/recur

14:25 Cubic: Ohhh... the val is before the collection if it's given... that's... intuitive I guess?

14:25 S11001001: Cubic: it's the very well established standard

14:26 Cubic: reduce of 3 args is actually a left fold, for which you specify the function, then the initial value, then the sequence

14:31 TimMc: ,(for [[s v] (ns-publics 'clojure.core) :when (when-let [d (:doc (meta v))] (re-find #"(?i)deprecated" d))] s)

14:31 clojurebot: (add-classpath replicate agent-errors clear-agent-errors)

14:32 TimMc: amalloy: (?i:X) affects match flags just for the span of the group; (?i) changes the flag for the rest of the expression.

14:32 amalloy: aha

14:32 TimMc: I prefer the latter, but the former is what I happened to use.

14:32 ToBeReplaced: the-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:32 uvtc: TimMc: Ah, thanks.

14:32 amalloy: i would have preferred the former had i known it existed

14:34 TimMc: The More You Know! ===☆

14:51 gfredericks: haha regexes two problems hahahaha

14:59 seancorfield: nrepl 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:00 hiredman: seancorfield: https://github.com/kingtim/nrepl.el/issues/141

15:01 my emacs session is at *nrepl*<24>

15:01 abp: hell-o

15:08 augustl: why 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:09 where oiiku_closure_builder_server.server is what I specified for :main in project.clj

15:09 just noticed (ns fofofo (:gen-class)) in the leiningen docs, that seems to have worked

15:16 seancorfield: thanx hiredman ...

15:16 i 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:17 hiredman: seancorfield: 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:17 it is just some kind of issue with loading a new ns or something

15:19 not sure if there is an open issue for that, or if it is related the existing open ns issues

15:19 just something I have noticed

15:21 xclite: According 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:22 TimMc: xclite: It could be that the REPL you are using is combining them.

15:23 xclite: TimMc, 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:24 TimMc, well you still had the right idea - I wasn't actually in a REPL, but lein new intercepts the output

15:24 TimMc, lein run I mean. Running from the Jar produced the expected split.

15:40 TimMc: I seem to remember some recent change to how lein handles output...

15:41 augustl: any recommendations to argv parsers for clojure or java that handles operands? Like --port 4224 /path/to/some/file

15:41 where the path isn't an option to a specific "key"

15:41 also known as operands in the posix world

15:42 TimMc: augustl: clojopts, I think

15:42 https://github.com/amalloy/clojopts/

15:43 augustl: TimMc: hmm, the docs doesn't seem to mention anything like operands

15:44 TimMc: augustl: "Any non-option arguments will be supplied under the key :clojopts/more."

16:15 gfredericks: isn't there a contrib lib for that?

16:18 TimMc: clojopts uses GNU GetOpt, so it's about as standards-compliant as can be.

16:19 Cubic: Is "equals-p" a good name for (fn [x] (partial = x))?

16:20 That is, is there some idiomatic name for a function that returns a predicate?

16:21 gfredericks: how about =¿

16:22 I suggest functions returning predicates end in ¿

16:23 S11001001: ,(doc every-pred)

16:23 clojurebot: "([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:23 scriptor: Cubic: why not just use (partial = x) without the wrapper fn?

16:23 AimHere: Cubic - wouldn't 'partial?' be a good name

16:23 Cubic: scriptor: Because I don't like it when there's too much going on in a single line.

16:23 AimHere: scriptor, maybe he needs to pass that function on, such as if he was using it in the filter function

16:23 S11001001: AimHere: not really

16:24 Cubic: scriptor: Also, it's something I need rather regularly

16:24 scriptor: ah, got it

16:24 gfredericks: wait #{x} is the idiom for that

16:24 not that I like that idiom very much

16:24 but I'm obligated to mention it

16:24 Cubic: qfredericks: That's incredibly ugly.

16:25 bbloom: *shrug* i use that idiot relatively regularly, it works nicely

16:26 hiredman: ~rimshot

16:26 clojurebot: Badum, *tish*

16:27 qfredericks: Cubic: like visually? is (hash-set x) prettier?

16:27 bbloom: *sigh* idiom

16:27 typing, it's hard for some of us :-P

16:27 i blame the cajun sauce on my fingers

16:32 jamii: Is anyone familiar with nrepl internals? Seems cemerick is not about.

16:32 hiredman: ~anyone

16:32 clojurebot: Just 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:32 jamii: clojurebot: good point

16:32 clojurebot: the point of moby dick is "be yourself"

16:32 hiredman: ~botsnack

16:33 clojurebot: Thanks! Can I have chocolate next time

16:33 bbloom: deep.

16:34 jamii: I'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:34 Should I just put a random id on the message and hope for the best?

16:37 hiredman: jamii: I think the best approach to something like that might be some kind of broadcast middleware, instead of have a special purpose client

16:38 jamii: hiredman: 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:38 hiredman: I guess I should look at nrepl.el and see what it expects

16:41 TimMc: Cubic: #(= x %) is shorter. :-)

16:41 bosie: https://gist.github.com/4048426 why would this happen in vimclojure?

16:42 hiredman: ~map

16:42 clojurebot: map 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:42 hiredman: ~map

16:42 clojurebot: map is lazy

16:42 hiredman: ~lazy

16:42 clojurebot: lazy is hard

16:42 bosie: hiredman: good point, thanks

16:57 siscia: cemerick is here ?

16:58 Raynes: cemerick is not .

16:58 siscia: thanks...

16:59 I am the only one who don't get the idea behind friend of cemerick ?

17:00 ToBeReplaced: how do you mean? as in, you don't understand what it does, or you don't understand what it's trying to do?

17:01 siscia: both...

17:02 ToBeReplaced: do you have specific questions about it? i have it pretty fresh in my mind

17:02 siscia: why should I use it ?

17:03 scriptor: as in, you're looking for a use case?

17:03 siscia: How can be integrated with something like https://github.com/siscia/noir-auth-app

17:03 ?

17:03 I just don't getting what it is doing...

17:04 ToBeReplaced: i'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:05 siscia: lets suppose I am trying to make a web app and I need to authenticate user, where friend comes to play ?

17:05 ToBeReplaced: the 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:07 so in that case, you might use the ring authenticate handler around your existing handler, and pass it a workflow that meets your needs

17:08 siscia: humm... ok...

17:08 ToBeReplaced: a well documented example is "interactive-workflow" >> a tutorial is here: https://github.com/ddellacosta/friend-interactive-form-tutorial

17:09 siscia: Thanks I am gonna read it right now...

17:19 hughfdjackson: what's the most painful day to day part of working on large clojure code-bases?

17:20 i've heard stu halloway refer to 'refactoring data more often than functions' (i believe that's what was said)

17:20 hiredman: that is an interesting question, to which I have no immediate answer

17:21 hughfdjackson: :D interesting one for me too

17:21 * hughfdjackson 's had a particularly hard day running up against nasty chunks of OO

17:21 hiredman: a 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:22 daniel__: Can anyone see why my server does not close connections here? https://gist.github.com/4048691

17:22 hiredman: hard to say, I feel very at home with clojure, so I am sure I am biased

17:22 daniel__: 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:22 hughfdjackson: are we talking for within the realm of 'standard lib' (manipulating functions/maps/sets/vectors generically), or in the realm of domain-specific support?

17:23 hiredman: wrappers around java stuff

17:23 daniel__: im expecting the finally to get fired and to close the context/socket

17:23 hiredman: we have an inhouse jdbc library now that patches issues with clojure.java.jdbc now, although java.jdbc is generally ok

17:23 daniel__: oh wait, im not calling comm/close as a function for a start

17:24 technomancy: hiredman: are you going to bite the bullet and write that intermediate sql representation thing?

17:24 hiredman: a 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:24 technomancy: :/

17:24 jamii: Opening 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:25 nDuff: jamii: resident, or virtual size?

17:25 jamii: for virtual size, that's completely normal. For resident size, not at all.

17:26 hughfdjackson: hiredman: what about in terms of refactoring code?

17:26 hiredman: technomancy: 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:26 hughfdjackson: or touching code that's been worked on before?

17:26 hiredman: http://www.infoq.com/presentations/Stop-Refactoring

17:26 jamii: nDuff: 6 java processes, each with virtual size ~1.8GB and resident 300MB-700MB

17:26 nDuff: each repl is just requiring

17:26 oops

17:27 technomancy: jamii: lein trampoline repl will do better if memory consumption is a problem

17:27 jamii: nDuff: each repl is just requiring nrepl and opening a connection

17:27 hughfdjackson: hiredman: that title's pretty striking ;)

17:27 hiredman: hughfdjackson: no worries really, having tests can help with that, but not having them doesn't really stop me either

17:27 jamii: technomancy: thanks :)

17:28 hiredman: hughfdjackson: "refactoring" is often done with little purpose and just ends up cutting off other possible avenues of execution

17:29 a 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:29 jamii: technomancy: yep, much more manageable now. new laptop averted :)

17:30 gfredericks: hiredman: those are interesting statements; I don't imagine you have any pointers to any elaborations of that point?

17:30 oh wait

17:30 you already shared one :D

17:30 nevermind me

17:31 hiredman: if 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:31 the 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:32 people generally don't do that, they just make a C, and link to it directly from A and B

17:32 hughfdjackson: dependency injection by any other name would smell as sweet

17:32 hiredman: gfredericks: I forget if that talk mentions that problem

17:33 ToBeReplaced: hiredman: isn't that the sort of thing that *bindings* let you dodge in clojure?

17:33 gfredericks: well it's at least called "Stop Refactoring" which isn't an argument I've heard even at that high-level yet

17:40 hughfdjackson: hiredman: watching that :) cheeres

17:40 *cheers

17:40 jkkramer_: 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:40 hiredman: are you more interested in a sql ast specifically?

17:44 hughfdjackson: hiredman: 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:44 like you said A and B depending on C causes tight coupling

17:45 is that problem slightly mitigated in fp by its 'pick and choose small lego blocks' nature?

17:46 :p i tried hard to not make that a leading question, and failed utterly

17:46 mattis: hi, is there a function in Clojure equal to Scalas map?

17:47 sorry, had a typo that fscked my map example

17:57 bbloom: mattis: http://clojure.org/cheatsheet

17:58 mattis: bbloom: me like :D

18:09 bbloom: dnolen: ping

18:12 dnolen: bbloom: pong

18:12 bbloom: dnolen: so i took a crack at the JS AST

18:12 dnolen: results are promising

18:13 https://github.com/brandonbloom/clojurescript/tree/js-ast

18:13 see compiler.clj and js.clj

18:13 very early cut at this

18:15 dnolen: bbloom: that's pretty cool, will definitely take a closer look, does it actually work?

18:16 bbloom: dnolen: 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:16 dnolen: 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:17 dnolen: seems like GWT does exactly what i'd need to do

18:18 dnolen: 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:18 dnolen: 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:19 an 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:19 dnolen: bbloom: all pretty interesting stuff, you should put your note somewhere public (Confluence) where more people can see and follow along.

18:19 bbloom: so does it see much slower? 50% 20%?

18:19 seem

18:20 bbloom: dnolen: was planning on publishing some notes; let me run a quick speed test

18:21 dnolen: note that this is the "slower before it gets faster" phase

18:21 dnolen: bbloom: yes that's understood ;)

18:25 bbloom: dnolen: 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:26 dnolen: but the new code output is neatly pretty printed ;-) haha

18:27 dnolen: bbloom: gotta run, but that's great investigation. put the notes up somewhere and I'll look over everything more closely.

19:31 hughfdjackson: hiredman: the first half of that was quite interesting

19:31 ;) the extended metaphors towards the end got a bit .. extended

19:40 jayunit100: hmm …. how can i access "this" inside of gen-class ? -- do i need a state field - :(

19:53 hiredman: hughfdjackson: yeah

19:53 http://www.infoq.com/presentations/Decisions-Decisions is better

19:53 jayunit100: ah looks like the way you access the local object in gen-class is similar to the python implementation

19:53 "this" is sent as the first arg.

19:58 holy shit ! Code completion in the new counterclockwise is working !

20:01 hughfdjackson: hiredman: if only i wasn't on 4G over the weekend, running out of bandwidth :(

20:04 milanj: huh, is there a valid howto for setting emacs/slime/clojure

20:04 amalloy: ~swank

20:04 clojurebot: swank is trust the readme and the readme only. all others will lead you astray.

20:05 milanj: yeah, I'm already there

20:05 amalloy: though i understand these days nrepl is what the cool kids are doing

20:05 milanj: guess so, there is deprecated on swank-clojure page

20:06 damn

20:06 bbloom: amalloy: that reminds me...

20:06 tpope: i stumbled across this https://github.com/cemerick/piggieback

20:06 :-)

20:06 amalloy: swank still works fine, if you're already comfortable with slime

20:07 milanj: I'am, that's why I want to use it

20:07 but I can't make this shit working though

20:12 ToBeReplaced: does the :or path of a map destructure always get evaluated?

20:12 ,((fn [& {:keys [x] :or {x (do (println "here") 1)}}] x) :x 0)

20:12 clojurebot: here

20:12 0

20:18 muhoo: ToBeReplaced: looks like it does

20:46 wow, i've been away from clojure for so long now, i've forgotten like everything :-(

20:46 gotta make a point to do some clojure programming, or exercises, or reading, at least once a week, lest my brain atrophy.

21:33 Frozenlock: Is 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:34 brehaut: merge-with ?

21:34 doesnt quite do what you want though

21:39 Frozenlock: But it's near. (merge-with conj maps) or somehting like that.

21:40 brehaut: ,(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:40 clojurebot: (["text" "asdad" "asdad" "asdad"] ["value" "123" "123" "123"])

21:40 brehaut: thats truely horrible though

21:41 Frozenlock: Orders of magnitude more appropriate for my needs than the incanter.core/to-dataset I was using :)

21:41 Thanks

21:43 brehaut: adding to the front of a vector is pretty nasty

21:44 if you were to switch to creating lists in the merge-with and then use list* in place of (apply vector …)

21:44 it would be less abhorent

21:44 ,(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:44 clojurebot: (("text" "asdad" "asdad" "asdad") ("value" "123" "123" "123"))

21:45 amalloy: &(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:45 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

21:45 * Frozenlock just learned about list*

21:46 amalloy: &(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:46 lazybot: ⇒ (("text" "asdad" "asdad" "asdad") ("value" "123" "123" "123"))

21:47 brehaut: ah nice

21:47 Frozenlock: amalloy: I'm impressed and scared at the same time :)

21:47 brehaut: theres much less to be scared of in amalloy's solution

21:48 amalloy: yeah, most of it is just typing in the data

21:49 cslee: hello

21:50 clojure vs clisp, which one do you recommend?

21:51 amalloy: did you notice the sign on the door when you came in?

21:52 cslee: yes

21:53 bbloom: cslee: 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:54 cslee: Oh sorry

21:55 bbloom: no worries; we just try to have productive and novel conversations in here :-)

22:20 clj_newb_2345: what is the best way to read/write _records_ in clojure?

22:21 bbloom: clj_newb_2345: pr-str and read-string ?

22:22 or any pr and read function

22:22 clj_newb_2345: on _records_ ?

22:22 that is too amazing

22:23 holo: hi

22:23 bbloom: clj_newb_2345: yes :-) having custom datatypes with default implementations of print and read is extremely convenient

22:25 clj_newb_2345: bbloom: a simple test shows you're correct

22:25 other langauges have conditioned me to assume taht things are broken by default

22:25 *cough C++ cough*

22:26 bbloom: clj_newb_2345: well it's actually an extremely difficult problem in the face of mutability... consider cyclical references

22:26 clj_newb_2345: that's why deftype doesn't provide read or print implementations

22:27 clj_newb_2345: but you can extend the print protocol yourself! and you can install a data literal reader too

22:32 tomoj: hmm https://www.refheap.com/paste/eb42756782a616e37b65b8524

22:33 I feel like there's got to be a better way to do that

22:33 bbloom: tomoj: loop and recur :-)

22:34 amalloy: tomoj: useful has a (possibly over-general) version of that, called glue

22:36 i think yours comes to (glue into [] #(< (count %1) 40) (constantly false) coll)

22:36 tomoj: oh yeah

22:36 amalloy: i guess that lambda needs to be (fn [a _] (< (count a) 40))

22:38 tomoj: what about reducers? :)

22:38 muhoo: weird, in nrepl 0.1.5, the *nrepl* buffer is empty, and the one with the actual repl in it is *nrepl<2>*

22:42 amalloy: i dunno, for reducers i think you can't do much better than your general approach

22:43 just write a (batch 40) function that returns a new reducer

22:44 although, not sure how you can do that since you need to control the initial value

22:50 muhoo: ah, nm, pilot error.

23:24 twobitsprite: why 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:24 just now I rebuilt my homedir from scratch, downloaded lein 1.7.1, tried lein install, same error!

23:26 amalloy: um, what command are you running that generates an error? hard for anyone to help without that

23:30 twobitsprite: any of them

23:30 "lein install <anything>" "lein repl"

23:30 amalloy: well `lein install <anything>` is wrong, because that task takes no arguments

23:33 twobitsprite: http://paste.lisp.org/display/133624

23:34 amalloy: welp, looks broken to me. ask in #leiningen, probably

23:39 couldn't hurt to rm -rf ~/.m2 first

23:45 clj_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:48 ChongLi: ,(split-at 1 '(2 3 4 1 6 7))

23:48 clojurebot: [(2) (3 4 1 6 7)]

23:48 ChongLi: err

23:48 that's not what you want

23:48 shachaf: Do you also want the list on the left to be reversed? :-)

23:48 clj_newb_2345_: lol

23:48 close enough :-)

23:49 ChongLi: a zipper

23:49 clj_newb_2345_: is find-first (of clojure.contrib.seq-utils) not in mainline het?

23:49 wait wait that is not what I want

23:49 I don't have the index

23:49 I need to find the index first

23:49 ChongLi: yeah

23:49 clj_newb_2345_: maybe I hould used a better example

23:49 i.e. '(a b c d e f g) 'c => (a b) (c) (d e f g)

23:50 ah, I got it

23:50 via first, filter, and keep-indexed

23:52 tomoj: (fn [x coll] (let [[before more] (split-with (complement #{x}) coll)] [before (list (first more)) (rest more)])) :/

23:53 metellus: ,(partition-by #(= 1 %) '(2 3 4 1 6 7))

23:53 clojurebot: ((2 3 4) (1) (6 7))

23:53 ChongLi: ,(split-with #(not= % 1) '(2 3 4 1 6 7))

23:53 clojurebot: [(2 3 4) (1 6 7)]

23:53 ChongLi: another one

23:53 metellus: that doesn't isolate the 1

23:54 ChongLi: ah good point

23:54 yours puts the 1 in a singleton list though

23:54 metellus: yeah

23:54 ChongLi: so we still don't have exactly what he wants hehe

23:55 metellus: mine matches his abcdefg example

23:56 ...and now I see that he left the channel 5 minutes ago

23:56 ChongLi: that's cause he changed the requirements!

23:56 ah damnit

23:56 yeah I redirect joins/parts and all that other crap to another window

23:56 sometimes it comes back to bite me like this

23:57 err no he's still here

23:58 that was a different client

Logging service provided by n01se.net