#clojure log - Jan 14 2013

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

0:05 yedi: does prismatic use clojurescript?

1:21 scottj: yedi: I think it did at one time. I haven't heard that they switched.

1:22 tomoj: hmm https://www.refheap.com/paste/7e814e3265c6fd0c5e4bfed8a

1:22 guess there are bugs for not-found

1:24 is there already something that serves up html for a browser repl?

1:25 I still have a static html file served by apache and a bit of cljs that looks at the url fragment for a repl port and clojure.browser.repl/connect's

1:49 frozenlock: Is there something like `bean', but that isn't read-only?

1:52 bbloom: frozenlock: what would that look like? transients?

1:52 maybe you should write 'frozenlock/bean! because i like the idea of a function named "bean!"

1:52 sounds exciting

1:52 technomancy: :dependencies [[mister/bean "1.0.0"]]

1:53 amalloy: frozenlock: if it's a mutable object with mutable fields, and not a clojure "value" (ie immutable), then it sounds like you just want...a java object

1:53 bbloom: technomancy: i can't tell if you're joking, or that's a project on github

1:54 frozenlock: yeah, what amalloy said

1:54 amalloy: so, i'd say this function is identity

1:54 technomancy: bbloom: only in my dreams

1:54 possibly clojure.reflect/reflect

1:55 frozenlock: amalloy: it is a java object. I would just like the ability to set the fields by a less tedious way than .setSomeFieldsMethod

1:55 (merge! (bean java-object) {:some-field value}) would be magic :)

1:56 p_l: well, for java beans, making a macro would be easy

1:59 amalloy: careful. if you make it a macro, that would work, but (let [field :some-field] (merge! ... {field value})) wouldn't

1:59 tomoj: will closure optimize out keyword strings?

1:59 in a simple test, it seems not..

2:02 p_l: amalloy: dunno about how Clojure does with macros (I'm mainly lurking here, the chances to use clojure tend to die fast), but it's definitely doable in CL

2:02 brainproxy: bbloom: been enjoying the silver searcher (and emacs integration for it) all day, thanks again for the tip last night!!

2:03 tomoj: https://www.refheap.com/paste/a3345210b33f944c2b606fe0c

2:03 heh

2:04 https://www.refheap.com/paste/3f95ec12ac297e0dc6e1c0996

2:04 amalloy: p_l: baloney. you can't use macros to make that work in cl either, because merge! can't make compile-time use of the runtime value :some-field of the field binding

2:04 bbloom: brainproxy: np. enjoy!

2:04 tomoj: whoa

2:04 holy crap

2:04 wtf is that?

2:04 p_l: amalloy: oh, you can - by checking whether you have literal or variable, and generating apropriate code that would dispatch later

2:05 tomoj: I guess closure said, "hey look, a bunch of strings, I'll combine them to save on quotation marks"

2:05 (that's the advance compiled output of (def frob [:frob :frob :frob :frob ...])

2:05 p_l: amalloy: might require a compiler macro for the literal optimization, though

2:05 bbloom: tomoj: heh.

2:06 tomoj: probably also saves on the string intern table at runtime

2:06 amalloy: sure, if you're willing to have your macro behave like a function. but the presumption here was that the (.setFoo) operators were only possible at compile-time

2:06 tomoj: but in this case, there's obviously a better way :)

2:06 bbloom: tomoj: but seems like an overoptimization to me... sometimes i wonder about google closure

2:07 tomoj: in my experience with "real" javascript apps, advanced compilation is practically useless when coupled with gzip. i guess it's only really useful when you have a *huge* stdlib that you want removed as dead code

2:07 p_l: bbloom: optimizing for JS is just like optimizing for computer, except the "cpu" is batshit insane ;)

2:07 bbloom: p_l: that resonates with me.

2:08 ibdknox: bbloom: the inlining and such is nice

2:08 bbloom: ibdknox: for sure. it was a *brilliant* move to build cljs on gclosure

2:08 p_l: I once heard some rumours of google V8 guys saying "we're getting to limits of how far you can compile and optimize JS while being useful"

2:09 bbloom: ibdknox: however, it would be nice to eventually get all those optimizations into the compiler itself so they can 1) use clojure-specific knowledge and 2) be shared between host platforms

2:09 ibdknox: and 3) decouple from jvm

2:11 ibdknox: bbloom: I would *love* for that to happen :)

2:11 all of LT runs unoptimized

2:11 tomoj: would it make sense to 'intern' keywords in the cljs compiler?

2:11 bbloom: ibdknox: i guess it must in order to support eval

2:11 ibdknox: for a number of reasons

2:11 bbloom: yep

2:12 bbloom: ibdknox: part of the problem is that the symbol mapping for minification lives in the jvm. it isn't shared with the browser

2:12 ibdknox: bbloom: it's still wonderfully fast in v8 - such an amazing piece of technology

2:13 bbloom: ibdknox: the guy who did his cljs-in-cljs is talking about it at clojure/west. hopefully we can push that stuff forward.

2:14 ibdknox: bbloom: yeah, after seeing the list of talks, I'm regretting my decision not to go lol

2:14 looks like some really neat stuff

2:14 I've been following that work pretty closely

2:15 waiting for the moment I can start using it :)

2:15 bbloom: ibdknox: the closure compiler is ~90k lines of java... i've considered just for fun porting it one compiler pass at a time... i bet it would be significantly smaller in clj

2:15 sadly, i have real work to do :-)

2:15 ibdknox: haha

2:15 I bet you don't need most of it, to be honest

2:15 bbloom: ibdknox: no you really don't

2:16 and some of the stuff is just absurdly verbose

2:16 there are 3000+ line files that could probably be replaced by 5+ line macros

2:16 in fact, i bet they were written by vim macros :-)

2:16 ibdknox: lol

2:19 bbloom: ibdknox: to be fair, it's pretty damn well written java

2:20 ibdknox: as much as they get paid, I'd hope so ;)

2:21 bbloom: ibdknox: so when is the next big "wow" release/video?

2:24 ibdknox: bbloom: end of jan/beginning of feb :)

2:24 bbloom: ibdknox: i'll keep an eye out for it

2:24 ibdknox: looots of goodness coming

2:25 bbloom: ibdknox: recently read your article about component-entity-system. good stuff

2:26 ibdknox: I need to write the follow up lol

2:26 bbloom: my ui stuff has a similar system that is tuned for trees rather than a flat set of game entities

2:28 ibdknox: LT is just one big data structure, it's similarly flat though

2:28 bbloom: all in one giant atom? heh

2:28 i have two atoms: model & view

2:30 ibdknox: bbloom: I had it in one giant atom, but there were too many listeners and any one change caused immense amount of freshness checking. It's not an atom of atoms

2:31 bbloom: ibdknox: so what is it now?

2:31 ibdknox: err it's *now* an atom of atoms

2:32 bbloom: ah

2:32 ibdknox: that seems to be plenty fast enough at this point

2:32 bbloom: what's the branch factor on that? ie how many atoms?

2:32 and what determines if something gets an atom?

2:32 ibdknox: every "object" in LT is an atom

2:32 so it can be hundreds

2:33 bbloom: what is the granularity of an "object"? a window? a little floating bubble? a line of code? a character?

2:33 ibdknox: an editor is the rough granularity

2:34 each tab is an object, the bar of tabs are objects

2:34 bbloom: and editors are those little bubbles arranged on a "table"?

2:34 clj-newb-234: is there a clojure builtin for checking if arg1 is a prefix of arg2, where arg1/arg2 are both lists

2:35 ibdknox: bbloom: I moved away from that "table" stuff a bit in the latest LTs, but yeah that's correct

2:35 bbloom: clj-newb-234: maybe somebody can do better than this:

2:35 ,(every? (partial apply =) (map vector [1 2 3] [1 2]))

2:35 clojurebot: true

2:36 clj-newb-234: bbloom: interesting use of every?

2:36 I was thinking of something like (defn prefix [a b] (= (take (count a) b) a))

2:36 ibdknox: (= arg1 (take (count arg1) arg2))

2:36 bbloom: clj-newb-234: heh, that's probably better

2:36 in fact, that's definitely better

2:37 i don't recall smoking anything....

2:37 clj-newb-234: why is it better? is there some weird case iinvolving laziness hwere one is more efficient than the other ?

2:37 bbloom: *scratches head*

2:37 oh no, what ibdknox is saying isn't right

2:38 clj-newb-234: in fact, I think your approach is O(1) space, whereas mine is O(n) space

2:38 bbloom: you'd need to know which list is longer

2:38 ibdknox: ah true

2:38 clj-newb-234: I need only check if the first is a prefix of the second

2:38 bbloom: i wasn't smoking anything, i just FORGOT why i decided to use map vector lol

2:38 clj-newb-234: ah, in that case, go with ibdknox's

2:39 hmmm but let me think about the space...

2:39 i don't think that it will hold on to the heads of the sequences, so it shouldn't take more space

2:39 amalloy: bbloom: nonsense

2:39 it has to count one of them

2:40 oh, i think i may not have understood the context

2:40 bbloom: amalloy: i was just answering a different question that i apparently made up myself

2:40 amalloy: mine figures out if either seq is a prefix of the other

2:40 which is different than testing if A is a prefix of B

2:40 in summary: programming is hard

2:41 ibdknox: I'm fairly certain mine is probably smaller

2:41 space-wise

2:41 amalloy: useful has a prefix-of?, which is built on top of remove-prefix

2:41 clj-newb-234: is "take" lazy ?

2:41 amalloy: https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L244

2:42 bbloom: ibdknox: programming still hard: your approach would allocate less total memory, but both approaches use the same amount of space in terms of big-O

2:42 clj-newb-234: what is "useful" a library or a irc user?

2:42 Raynes: It's a library IRC user.

2:42 bbloom: ibdknox: that is, unless, = isn't smart and holds on to the prefix of the list... which it very well might do since equiv is a memberfunction

2:42 ibdknox: bbloom: yeah

2:43 devn: clj-newb-234: take is lazy

2:43 bbloom: ibdknox: so the answer really depends on whether or not the JVM is smart enough to let the garbage collector clean up the `this` object that equiv was called on

2:43 devn: ,(class (take 4 (range 10)))

2:43 clojurebot: clojure.lang.LazySeq

2:43 ibdknox: well if you're doing this over something huge where any of this would matter, there's a better solution

2:43 bbloom: right, programming is hard, that's what i said :-)

2:43 clj-newb-234: nah, these lists come from string.splitting "/" of pathnames

2:43 ibdknox: bbloom: hehe

2:44 clj-newb-234: list lenghts are expected to be < 10

2:44 ibdknox: why not just check the string prefixes?

2:44 bbloom: hm wow, that thought had never occurred to me before: object oriented programming inhibits garbage collection

2:44 clj-newb-234: the gui code for the tree structure stores each level separately

2:45 (i.e. think those little + signs you click, and the next level of the tree expands out)

2:45 bbloom: i guess anything that makes extra references inhibits garbage collection... and `this` is the biggest implicit bag of extra references ever

2:45 ibdknox: anything that hides state does

2:46 devn: like atoms?

2:46 clj-newb-234: dumb question: is there a way to make #({ ... }) to somehow work? instead of having to write (fn [x] { ... } ) ?

2:46 i.e. I want an anonymous function that returns map

2:46 but I can't use #({ ... }) since that evals the map

2:46 bbloom: clj-newb-234: use ->

2:46 ,(-> #{1 2 3}

2:46 ,(-> #{1 2 3})

2:46 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

2:46 #{1 2 3}

2:46 clj-newb-234: wtf, isn't -> for threading

2:46 ibdknox: lol

2:46 bbloom: clj-newb-234: yeah, but with only 1 argument, it has nothing to thread! :-)

2:46 ibdknox: it's a golfing trick

2:47 clj-newb-234: (#(-> {1 2 3}))

2:47 ,(#(-> {1 2 3}))

2:47 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>

2:47 clj-newb-234: ,(#(-> {1 2 3 5}))

2:47 clojurebot: {1 2, 3 5}

2:47 bbloom: ,(map #(-> [:foo %]) (range 3))

2:47 clojurebot: ([:foo 0] [:foo 1] [:foo 2])

2:47 clj-newb-234: this is disguisting, but I like it

2:47 amalloy: don't use -> for that, even if trying to golf

2:47 devn: lol

2:47 amalloy: just use 'do, which is what it's for

2:47 clj-newb-234: amalloy: why not? it's cute

2:47 devn: disgusting is right

2:47 amalloy: because it's cute is exactly why :P

2:48 devn: (inc amalloy)

2:48 lazybot: ⇒ 40

2:48 clj-newb-234: well, I like it; and I hate future-self, so I'm going ot use it :-)

2:48 ibdknox: ,(map #(do [:foo %]) [1 2 3 4])

2:48 amalloy: if it makes you go "lol i can't believe this works", don't write it

2:48 clojurebot: ([:foo 1] [:foo 2] [:foo 3] [:foo 4])

2:48 devn: clj-newb-234: go forth and shoot thineself in thine foot

2:48 bbloom: amalloy: i actually like it because its nice to add trace statements.... just insert a dbg before or after

2:48 #(-> %) becomes #(-> dbg % dbg)

2:49 clj-newb-234: bbloom: I like.

2:49 devn: (#(-> {1 2 3 4}))

2:49 ,(#(-> {1 2 3 4}))

2:49 clj-newb-234: #clojure <-- where you ask silly questions and get insightful answers.

2:49 clojurebot: {1 2, 3 4}

2:49 * devn pukes blood

2:50 devn: i just killed chat

2:50 good night all!

2:50 clj-newb-234: I'm goign to spend the rest of the night thinking of all the evil uses of -> I can think of.

2:51 bbloom: but i'm a trace statement mad man.

2:53 clj-newb-234: for some weird reason; I find replacing "map" with "for" tends to make my code more readable

2:53 bbloom: clj-newb-234: i find that's only true when you have multiple levels of maps and mapcats

2:54 clj-newb-234: bbloom: actually, it's I tend to write (map (giant complicated expression) lst)

2:54 and (for [x lst] multi-line-expr) looks much better

2:54 bbloom: clj-newb-234: so the primary difference between 'for and (->> map mapcat ...

2:54 clj-newb-234: is that 'for requires you have names

2:55 clj-newb-234: I like names too.

2:55 bbloom: clj-newb-234: where as map, filter, mapcat, etc would allow you to use functions without naming their arguments

2:55 clj-newb-234: yeah, a lot of the time a name can make the code more clear

2:55 but sometimes the name would just be silly like you have numbers, then numbers-without-fives, followed by numbers-without-fives-times-two

2:55 so you either use short names like n

2:56 or you write numbers* or numbers'

2:56 or numbers''

2:56 or numbers''''''''''

2:56 alternatively, you can just avoid naming things that are intermediate values that wouldn't be beneficial to name

2:56 clj-newb-234: damn, I just realized that (-> x a b c d e f) looks infinitely better than (f (e (d (c (b (a x))))))

2:56 ro_st: or keep using the same name

2:56 clj-newb-234: even with colored parehntheises

2:57 ro_st: let [a … a … a …]

2:57 bbloom: ro_st: yeah, i hate that

2:57 ro_st: i use it when it's clear that it'd otherwise be as you described

2:58 epitron: clj-newb-234: what about x.a.b.c.d.e.f :)

3:02 clj-newb-234: epitron: a, b, c, d, e, f are functions, not java members :-)

3:03 epitron: clj-newb-234: sure.. i'm just sayin... OOP style is nicer

3:03 clj-newb-234: nah, I like forth style

3:03 -> reminds me of forth like things

3:03 epitron: load up that stack!

3:04 clj-newb-234: if someone merely ficgured out he perfect way to merge clojure, mathematica, apl, and forth, I'd be happy

3:06 snowylike: why would you want APL?

3:06 clj-newb-234: actually, I forgot one: I want: clojure + mathematica + apl + forth + perl

3:07 with such a system, I bet one can solve the halting problem in < 100 LOC

3:08 bbloom: clj-newb-234: you'd love https://github.com/brandonbloom/factjor

3:08 * bbloom continues his shameless self-promotion

3:09 clj-newb-234: I like.

3:09 ro_st: bbloom: your talk got a '4' vote from me :-)

3:09 bbloom: ro_st: nice. thanks :-)

3:09 ro_st: i'm going to try to release DomScript ahead of clojure/west

3:10 clj-newb-234: bbloom: is it just one core? src/factjor/core.clj ?

3:10 i like how that you've implemented the basic factor words

3:10 the only thing you'r emissing is hte factor ui :-)

3:12 I think the name can be better

3:12 factjor doesn't seem as naturalc as fajctor

3:13 bbloom: i kinda regret not calling factjure

3:13 because i keep spelling it that way

3:13 tomoj: I think you'd have to convince lein to let you?

3:14 Raynes: bbloom: I'd really prefer to not put js in your names.

3:14 How would you feel if I started calling you Brajndon Bljoom?

3:15 bbloom: Raynes: heh, sorry. you got a better name? my goal was maximum confusion :-)

3:16 Raynes: could have also gone wih Catjure

3:16 or Clocat

3:16 clj-newb-234: for maximal confusion, you should call it "go"

3:16 bbloom: Clotor ?

3:16 tomoj: clo* bothers me more than *jure

3:16 clj-newb-234: I like clocat

3:16 bbloom: factjor was the best that had when i was ready to type `lein new` and i was to lazy to change it

3:16 :-)

3:17 tomoj: I've been considering writing a shell script for attempting to rename a lein project

3:18 bbloom: tomoj: surely it should be `lein rename`

3:18 tomoj: ah, I suppose

3:18 bbloom: i'd install the shit out of that

3:20 Raynes: tomoj, bbloom: I wrote a program to do something similar in Haskell.

3:20 tomoj, bbloom: Mine works for the specific case of adding a prefix to a namespace and setting up dirs and what not.

3:20 https://github.com/Raynes/prefixify

3:21 Bask in the purely functional glory

3:22 clj-newb-234: isn't "lein rename" just "sed" ?

3:22 like "sed/factjor/clocat/g" **/*.clj

3:22 tomoj: I used sed, but it doesn't rename files

3:23 bbloom: Raynes: yeah, tomoj's needs the package prefixing too

3:27 tomoj: are there extant demos of crate's bindings?

3:28 https://github.com/fluentsoftware/cljs-binding/blob/master/examples/crate/src-cljs/sample.cljs I don't understand

3:30 bbloom: Raynes: your prefixify project is from ~2 months ago. do you still write a lot of haskell?

3:53 scottj: bbloom: just reading your clojure/west abstract, is domscript already released?

3:53 bbloom: scottj: not yet, i plan to release it ahead of clojure/west

3:53 probably in the next two weeks, but no promises because i'm kinda busy moving from seattle to nyc

3:53 scottj: bbloom: have you posted any pastes of example usage?

3:54 bbloom: scottj: here's an example: https://www.refheap.com/paste/8519

3:54 scottj: bbloom: thanks

3:54 bbloom: scottj: that might not actually be perfectly right since i never evaluated that particular bit of code

3:55 in short, that little program creates some elements, clones one, attaches stuff to the dom, etc

3:55 should give you the feel of it

3:55 it feels a lot like jquery, only with much much more powerful chaining

3:56 echo-area: What package management change is leiningen waiting for?

4:03 tomoj: ";;" looks awfully like "::" :D

4:12 bbloom: scottj: looking for something in particular?

4:15 scottj: bbloom: nope, just curious. looking forward to seeing the release and your talk.

4:15 bbloom: thx :-) me too, i'm excited

4:16 Raynes: bbloom: I've never written a 'lot' of Haskell.

4:16 bbloom: If you look, I wrote like 23435234 Haskell things in like 3 weeks there.

4:16 bbloom: I wrote at least 3 libraries while at the conj alone, and that was before I had to take my mother to the hospital!

4:16 * Sgeo is becoming interested in Smalltalk

4:17 Raynes: I was actually making jokes with people about how I was writing Haskell at a Clojure confernece.

4:17 conference*

4:17 bbloom: Raynes: ah ok. just flirting with it for the sake of learning?

4:17 Raynes: Sgeo: You're interested in anything that you can write programs in.

4:17 bbloom: Sgeo: what exactly do you do? are you a student/researcher? you seem to jump around between languages a lot :-P

4:17 Sgeo: It's like Racket and Smalltalk are on opposite ends of a spectrum. Racket's a nice language with an environment that irks me, Smalltalk's a nice environment with a language that irks me

4:17 Raynes: bbloom: Well, Haskell was my first language. Back then I just never internalized monads, applicative functors, ect. I used it some more mostly for those things, but also because I like Haskell.

4:17 bbloom: I'd use it more, but I don't often have a reason to.

4:17 scottj: Sgeo: how come? (big fan of Smalltalk, used it quite a bit a decade ago)

4:18 Sgeo: bbloom, just graduated from a sucky school

4:18 bbloom: Raynes: heh. odd. how did that come to be your first language?

4:18 Raynes: bbloom: Prefixify was actually an excuse to use Haskell at work, but I semi-annoyed my boss because I spent time on it. :p

4:18 Sgeo: scottj, no macros is a big one. Single-dispatch OO. A tendency to add methods to other people's classes, and no namespacing mechanisms for these added methods

4:18 Raynes: bbloom: http://codebassradio.net/2011/11/29/runtime-expectations-episode-13-hot-clojure-conj/ Listen to my interview here. Pretty sure I explained it there.

4:19 I had such sexy hair at that conference.

4:19 scottj: Sgeo: yeah definitely, my irc is lagging bad so my how come was actually to you being interested in it :)

4:19 Sgeo: Oh. The environment and IDE

4:19 A fix-and continue, modify while it runs, that sort of thing is really interesting to me

4:19 scottj: Sgeo: I like whisker browser, not sure if it loads in recent squeak

4:20 * Sgeo has been using Pharo

4:21 bbloom: Raynes: i'll listen to that in a little while if i remember

4:21 Raynes: Damn it.

4:22 I lost my github commit streak.

4:22 Didn't commit anything this weekend.

4:22 Shame.

4:22 bbloom: Raynes: i think it works via pushes

4:22 Raynes: so just rebase some commits and change the dates

4:22 scottj: Sgeo: mathmorphs and nebraska (kansas?) are really cool smalltalk things too

4:22 bbloom: game the system

4:23 scottj: Sgeo: blocky is a CL game programming environment that's partly inspired by morphic also, in case you didn't know

4:28 Sgeo: Hmm. But it's CL, which I also categorize as "good environment but not so nice language"

4:46 echo-area: Sgeo: Is Clojure in the same category?

4:46 In your categorization

4:47 Sgeo: Actually, it leans much more towards better language, worse environment

4:48 Although there are some nice things about the environment. Can always grab a Java library

4:48 echo-area: Hmm. How do you define "better" and "worse"? I'm not flaming here, I just want to know your point

4:48 Sgeo: And it's popular enough to have a decent sized ecosystem

4:48 Well, there are certain things I tend to look for. Resumable exceptions, first-class continuations, TCO

4:49 Ease of modifying a running program

4:49 A nice IDE doesn't hurt, but Visual Studio for example feels too ... "large" to be considered nice

4:49 ^^all that I classify as "environment"

4:50 echo-area: Oh. Is TCO really possible on JVM? And what's missing in CL?

4:51 Sgeo: TCO is missing from CL, but my main problems with CL are language rather than environment

4:51 And TCO is possible, but might hurt Java interop

4:51 Any TCO code can be converted into code that doesn't use tail calls, I think

4:51 tomoj: it's too bad 'descendant' means 'proper descendant' — 'non-ancestors' for 'improper descendant'? :(

4:52 p_l: TCO is quite common in CL, though

4:52 and is possible in JVM for functions that call themselves (by replacing call with a branch)

4:53 Sgeo: TCO has uses beyond self-recursion

4:57 echo-area: What is a generated TCO?

4:58 Sgeo: ?

4:59 p_l: Sgeo: I *love* CL:DISASSEMBLE, btw :D

5:00 Sgeo: p_l, wouldn't the usefulness of that be highly dependent on the implementation?

5:00 p_l: Sgeo: so far it has been pretty useful to me - the only two cases with problems were ABCL and CCL

5:00 s/CCL/ECL/

5:01 and it tends to show much better just what your optimization or changes do

5:14 clgv: where do I find the generated API for clojure's contrib lib? I think there was a github hosted site

5:15 ah ok found what I was looking for

5:48 augustl: I'm building a clojure system where there's one http server that serves as the back-end of a web app, and another clojure system that is a central API that the web app (and others) will talk to

5:49 my question is, should I use HTTP to talk to the central API, or are there any alternatives I should check out?

5:49 the central API is completely internal, so some sort of JVM only library is OK

5:49 cmdrdats: augustl: why not use queues?

5:49 augustl: as you might have guessed, I'm new to the JVM ;)

5:50 cmdrdats: good question :)

5:50 ejackson: augustl, cmdrdats: yeah, I was gonna suggest the same. Rabbit or whatever.

5:50 ro_st: (inc rabbitmq)

5:50 lazybot: ⇒ 1

5:51 augustl: cmdrdats: since the front-end HTTP stuff is written with ring/compojure/etc, does it make sense to have an async call to put something on a request queue, and then immediately block for a response from a response queue?

5:51 anyone, not just cmdrdats ;)

5:51 ro_st: you'd only queue work that doesn't have to happen in the same response

5:51 otherwise you'd just do a normal blocking api call

5:51 augustl: the request the front-end makes to the central API is stuff like "give me the data for the entity with this ID"

5:52 ro_st: yeah that'd be blocking

5:52 stuff required to render a page

5:52 augustl: yeah

5:52 ro_st: we do outbound email and pdf gen with a queue though

5:53 augustl: I can't think of any call I'll make to the central API where I don't want a response back

5:53 ro_st: may i ask why the separation?

5:53 augustl: so, does it make sense to use queues for RPC?

5:53 cmdrdats: augustl: yes, queues make sense for RPC

5:53 ro_st: (not saying it's bad, just curious about your particular case)

5:54 cmdrdats: :)

5:54 augustl: ro_st: so that a multitude of systems can talk to the central API. The web front-end will have its own API, with user authentication etc. Then there'll be an admin app with full access to everything in the central API

5:54 ro_st: how, cmdrdats?

5:54 cmdrdats: one nice thing is that you can enforce a kind of SLA, so you can gracefully fail on timeouts

5:54 augustl: so the central API is essentially the database in the system

5:54 ro_st: augustl: ok, so it's a scalability and a separation of concerns thing

5:55 augustl: separation of concerns for now :)

5:55 cmdrdats: yay :)

5:55 cmdrdats: ro_st: it also means that other components that could use the api's, even in different languages

5:55 ro_st: yeah

5:56 cmdrdats: how would async queues work with rpc, eg, fetching data for a page render?

5:56 augustl: so i guess the message I put in the request queue needs to have some kind of request ID, so I can consume only an item with that id from the response queue?

5:57 this seems to be explained here http://www.rabbitmq.com/tutorials/tutorial-six-python.html

5:57 cmdrdats: ro_st, augustl: you register a temp queue, send the message off and wait for response to the temp queue

5:57 xificurC: hi, if anyone has the nerves to answer stupid questions, here goes one: I just managed to get clojure and leiningen working on this laptop running win7. I downloaded a sample project from the compojure git, which uses a function named html5. It works just ok but of course I'd like to see what it does in the repl. So i start emacs, open the project.clj and do M-x nrepl-jack-in and copy the code, but it throws an exception. What am

5:57 ro_st: and you'd do this because you want the actual work on a separate machine?

5:58 augustl: cmdrdats, ro_st: this seems to be a lot of work, almost more than just doing HTTP

5:58 cmdrdats: https://github.com/Yuppiechef/simple-rabbit/blob/master/src/simple_rabbit/mq.clj#L106

5:58 augustl: I think what I'm after is some sort of generic RPC system where I don't have to manage the transport. If I use HTTP, I have to manually figure out connection pooling, etc

5:59 cmdrdats: augustl: it's not really that much work - queues are very cheap

6:00 augustl: here's an example https://github.com/Yuppiechef/simple-rabbit/blob/master/src/simple_rabbit/example.clj

6:00 except that you'd want to use rpc-blocking instead of just rpc

6:00 augustl: checking out both now, thanks

6:00 cmdrdats: rpc runs a function upon receiving the result, rpc-blocking blocks the current thread until timeout or result and returns

6:01 ro_st: neat

6:01 storm-project provides distributed rpc

6:01 integrates like rpc, but uses the whole topology to compute

6:02 cmdrdats: that's just multiple machines listening on the same queue?

6:02 ro_st: "just", lol

6:02 http://storm-project.net/

6:02 cmdrdats: well, ye :P just fire up a bunch of machines configured to connect to the same server - done?

6:02 augustl: cmdrdats: so the rpc function will handle multiple requests for the same key properly, etc?

6:02 ro_st: http://www.infoq.com/presentations/Zolodeck

6:02 cmdrdats: yes

6:02 augustl: i.e. 5 concurrent requests to get a user by ID 5 or whatever

6:03 cmdrdats: because each request sends a respond_to key to the server

6:03 so the server knows which temp queue to respond to for any given request

6:03 augustl: what's the benefit of doing this instead of using HTTP?

6:04 ro_st: retry semantics, presumably

6:04 augustl: that's not important in my case, a timeout is more than good enough

6:05 cmdrdats: one thing is that only rabbitmq has to be up for it to work

6:05 if your consumer is dying, another machine can transparently pick up the workload

6:05 augustl: good point, that's nice

6:05 and kinf of obvious.. You don't care where the work is done

6:05 cmdrdats: ye :)

6:06 augustl: and presumably rabbit is up all the time, while the API goes down for restarts and whatever

6:06 cmdrdats: yep

6:06 so you can spin up a failover machine, restart your main production machine safely

6:06 augustl: and temp queues aren't expensive or anything?

6:06 cmdrdats: no, they're quite efficient]

6:06 Anderkent|away: queues are cheap unless you're getting into millions

6:07 augustl: cmdrdats: and have multiple machines, just by, well, adding multiple machines :)

6:07 cmdrdats: augustl: heh, ye, exactly

6:07 Anderkant: thanks - I'm not sure where the falloff point was for using temp queues

6:07 Anderkent*

6:08 augustl: Anderkent: so in my case, that would be millions of concurrent requests?

6:08 clojurebot: No entiendo

6:08 Anderkent: augustl: i'd expect other stuff to give out first

6:08 connections are more expensive than queues

6:08 augustl: I see

6:09 Anderkent: assuming empty queue of course, if you put megabytes of data into a queue and don't consume it you will have problems

6:09 cmdrdats: augustl: that's true - you can generally use a single connection for an app, and build multiple channels within the connection

6:09 pretty darn efficient

6:09 augustl: that's what I'm thinking

6:10 built another system with a similar structure (central internal API), using HTTP. Haven't load tested a lot yet, but I have a feeling opening a TCP connection for every operation is gonna suck

6:12 cmdrdats: augustl: you should be able to provide a queueing layer over your other system too?

6:13 HTTP vs queuing isn't an exclusive choice :P

6:14 p_l: just a honest plea: think whether you really need HTTP :P

6:14 cmdrdats: I think HTTP would be applicable if you want to provide external services

6:15 having 3rd party people jump onto your rabbitmq bus feels like a minefield

6:16 p_l: or if your API is "document" oriented (let's say, "noun oriented"), not "verb oriented" (actions etc)

6:19 Raynes: bbloom: That's cheating.

6:20 p_l: a "verb" api ... doesn't fit HTTP

6:20 (unless you're "tunnelling" over it)

6:20 augustl: cmdrdats: the other system has a public API, so that's why it's HTTP

6:20 what you said ;)

6:21 it's also used internally though, could always provide queues for internal use

6:22 hopefully we'll need to do that soon, for some scaling reason or whatever :)

6:22 been wanting to decouple my bussiness logic from HTTP status codes anyway..

6:26 so, how do you choose an MQ? :)

6:26 p_l: augustl: depends what you need to do...

6:26 that is, what kind of flows you need

6:27 you might be satisified with just 0MQ doing a bit more than sockets :D

6:28 augustl: well, right now my only requirement is that it's a small amount of work to do RPC through it in clojure

6:29 cmdrdats: augustl: just write your code against a handful of abstraction functions so that you can flip out the actual queue implementation at any time

6:29 augustl: protocols

6:29 om nom :)

6:29 cmdrdats: ok, protocols if you like :P

6:35 iamdrw: does anybody know why library's code from :require is located below the code that'll be using it? in cljs

6:37 so I have goog.require('lib') before goof.provide('lib')

7:22 Raynes: How do people get anything done at all with cracked.com existing?

7:24 Hodapp: Raynes: I totally read all about this on some article... I think it was "10 Ways the Internet is Fucking Up Your Ability to Get Anything Done"

7:25 Raynes: That's a joke, isn't it?

7:25 Yeah, that's a joke.

7:25 * Raynes chuckles

7:25 Hodapp: Dude, it's Cracked. Do you really think they DON'T have an article by almost that exact title?

8:05 xificurC: If I have a project.clj open with listed dependecies, shouldnt the deps automatically load in nrepl when I do nrepl-jack-in?

8:06 ro_st: yup

8:08 xificurC: ro_st: I have hiccup "1.0.2" listed as a dependency, however when I try a simple (html foo) I get an exception

8:08 ro_st: have you required it?

8:08 iamdrw: you have to load them via (:use ..) or (:require ..) in the ns statement

8:08 ro_st: (use 'hiccup.core)

8:09 iamdrw: or (use 'hiccup.core)

8:10 bpr: xificurC: the project.clj only ensures the dependencies are downloaded. To use them in code you have to require or use as ro_st and iamdrw have suggested

8:10 xificurC: thanks guys :)

8:11 can you also recommend something worth reading and up to date regarding compojure/hiccup?

8:11 iamdrw: u r welcome

8:11 silasdavis: I'm using monger and I'm getting at Clojure Compiler: java.lang.RuntimeException: No such var: cheshire.generate/add-encoder, compiling:(clojurewerkz/support/json.clj:79)

8:12 my project.clj has [cheshire "5.0.1"] dependency

8:13 I'm requiring monger.json in referenced module

8:13 The referencing goes server > handler > routes.home > message > monger.json

8:14 where those named things are modules

8:14 but it complains in server and handler

8:14 could someone enlighten me on where I might need to require things?

8:16 the docs don't say I have to do anything other than reference cheshire: http://clojuremongodb.info/articles/getting_started.html#cheshire_or_clojuredatajson

8:19 Looking at line 79 of https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj can anyone tell me why the var cheshire.generate/add-encoder would be undefined?

8:20 given that the require 'cheshire.generate above must have worked...

8:28 ciphergoth: So putting stars around my variable doesn't make it dynamic, but if I have ^:dynamic defined on it, should I put stars around it anyway to adhere to convention?

8:30 babilen: ciphergoth: http://dev.clojure.org/display/design/Library+Coding+Standards → "Use *earmuffs* only for things intended for rebinding. Don't use a special notation for constants; everything is assumed a constant unless specified otherwise."

8:30 ciphergoth: aces!"

8:31 will read whole coding standards article - thank you!

8:31 babilen: ciphergoth: yw :)

8:35 ciphergoth: So should a function that calls dosync use the bang! ?

8:41 silasdavis: Does (catch Throwable t false) prevent further execution?

8:42 I should be more specific doesn (try (blah) (catch Throwable t false)) prevent later statements from being executed in a module

9:01 labria: hey

10:07 juxovec: how can I parse XML in clojure (must be lazy, file is approx 100 MB)

10:09 algernon: juxovec: data.xml may be what you want

10:09 Anderkent: clojure.xml might be lazy ( I think it uses SAX on the backend ), try it

10:10 juxovec: thx

11:03 xificurC: if I wanted to write the simplest of the web pages containing only text and hyperlinks, no fancy design or scripts or login or shoutboxes, what do I need?

11:03 yogthos: xificurC: http://www.luminusweb.net/ is an easy way to get rolling

11:04 xificurC: the base app is completely barebones and you can just add your pages in as needed

11:06 xificurC: yogthos: thanks, finally something that seems to have some documentation for starters as well (I hope) :) I will check it out, thanks

11:06 yogthos: xificurC: yeah I'm trying to keep it beginner friendly, if anything's missing give me a ping and I'll add it :)

11:07 muhoo: silasdavis: iirc, everything inside the try stops, and it's an implicit do

11:07 ,(doc try)

11:07 clojurebot: Huh?

11:07 muhoo: fuuuuuu

11:07 &&(doc try)

11:07 lazybot: java.lang.RuntimeException: Unable to resolve symbol: & in this context

11:08 muhoo: &(doc try)

11:08 lazybot: ⇒ ------------------------- try (try expr* catch-clause* finally-clause?) Special Form catch-clause => (catch classname name expr*) finally-clause => (finally expr*) Catches and handles Java exceptions. Please see http://clojure.org/special_forms#try nil

11:09 xificurC: thanks yogthos

11:10 dont tell me to ping you because you might get a dozen of noob questions coming up tomorrow :p

11:10 yogthos: xificurC: haha, let's say some constructive feedback will be welcome :)

11:11 xificurC: yogthos: sounds much better :)

11:11 yogthos: hehe

11:11 muhoo: ibdknox: nm, you asked about catch. sorry

11:11 silasdavis: sorry

11:12 ibdknox: no, not you. gah, can't read or type today. sorry

11:34 dnolen: stuartsierra: any chance of adding Nada Amin to the Clojure org & core.logic repo to make collaboration easier? or is there someone else I should ping?

11:34 stuartsierra: not my call

11:34 email clojure-dev

11:34 dnolen: stuartsierra: ok, already did

11:35 stuartsierra: I'll ping Stu H., but nothing else I can do.

11:35 dnolen: stuartsierra: it's a bit annoying that project leads can't do this themselves.

11:35 ohpauleez: dnolen: That's mostly Andy now

11:35 I can email him off list, if you like

11:35 dnolen: ohpauleez: so Andy has access to the team memberships on GitHub?

11:35 ohpauleez: that would be sweet. I've already requested it twice.

11:36 silasdavis: yogthos: has luminus changed to not include a server.clj?

11:37 yogthos: silasdavis: yeah I moved to using ring instead

11:37 silasdavis: I added repl.clj for running from a repl without using lein

11:38 silasdavis: can I just copy that and delete server or are there any other changes?

11:38 yogthos: silasdavis: somebody was asking about the change on my blog, check the last comment I made there http://yogthos.net/blog/35

11:38 silasdavis: ta

11:38 yogthos: silasdavis: there's a couple of small changes

11:40 weavejester: ping

11:40 weavejester: yogthos: Yep?

11:40 yogthos: weavejester: what's your thoughts on something like this? https://www.refheap.com/paste/8616

11:41 weavejester: or is there a part of ring I'm ignorant of as usual :P

11:41 weavejester: err compojure :)

11:43 weavejester: yogthos: Hm, I don't really like the syntax...

11:44 (def foo (GET "/" [] …)) vs. (defroute foo GET "/" [] …)

11:44 yogthos: yeah essentially

11:44 I one set of parens less :)

11:45 michaelr525: hello

11:45 yogthos: hi?

11:45 weavejester: TBH I'm not even sure I like the "defroutes" form in Compojure currently...

11:45 yogthos: the nice thing about it is that it groups the routes together in one spot

11:46 so you can always trace where all the entry points are

11:49 ohpauleez: dnolen: done.

11:51 yogthos: weavejester: what were you thinking for defroutes alternativeS?

11:51 weavejester: yogthos: Just (def foo (routes …))

11:52 dnolen: ohpauleez: done as in done, or email sent? :)

11:52 ohpauleez: email sent

11:52 haha

11:53 yogthos: weavejester: ah that might not be bad, but I do like it being explicit

11:53 and afk

11:54 dnolen: ohpauleez: thanks!

11:54 weavejester: yogthos: Hm? That is more explicit...

11:54 ohpauleez: np

11:54 totally welcome dnolen

11:57 bpr: weavejester, yogthos|away: i had a use case where the (routes ...) form was necessary (as opposed to (defroutes ...) because I had to delay the definition of the routes until the rest of the system was available.

11:59 weavejester: bpr: Why did you have to do that?

12:03 bpr: I set it up so that the sub-components of the system were initialized based on the environment vars. Once that initialization was ready I invoked the function that defined the routes... basically dependency injection

12:03 lol. i coulda said all that in 2 words :-p

12:11 silasdavis: can anyone tell me why I get "CompilerException java.lang.RuntimeException: No such var: cheshire.generate/add-encoder, compiling:(clojurewerkz/support/json.clj:79) " when compiling this monger-requiring module: https://www.refheap.com/paste/8617?

12:12 I've moved the code from a different project structure and I think I'm missing something about how dependencies are handled

12:12 hiredman: .win 15

12:12 silasdavis: I have [cheshire "5.0.1"] in my project.clj

12:15 dakrone: silasdavis: does 5.0.1 show up in your deps when you do a `lein deps :tree`?

12:15 silasdavis: dakrone: yes

12:16 dakrone: silasdavis: hmm.. seems like something the clojurewerkz [sic] guys should look into

12:16 the function is there in the cheshire code :)

12:16 silasdavis: oh really you think it's not me..

12:16 yes it is

12:16 dakrone: silasdavis: not sure without seeing all the code

12:17 silasdavis: here is the block:

12:17 https://www.refheap.com/paste/8618

12:18 I'm assuming the way that works is that if the first try succeeds in requiring cheshire.generate then the second try runs the add-encoder bit

12:18 I've tried this in one of my own modules and it seems to work

12:19 dakrone: yea, sounds like something weird in their library

12:23 technomancy: weavejester: what do you think about future compojure handler/site or handler/api middlewares binding *read-eval* false?

12:24 weavejester: technomancy: Chas mentioned that as well. It might be a good idea to add some kind of middleware to do it, then add it to the standard set.

12:26 technomancy: any plans for a backwards-incompatible 2.0 yet? =)

12:27 though I suppose you could make a pretty good case for this fixing a bug in clojure itself

12:29 it's one thing to bind *read-eval* to true by default and one thing to have it be a secret undocumented feature, but doing both is absolutely nuts

12:31 mae: how does one apply varargs to a native java function, the correct way, i have tried (into-array) but i get null pointer exceptions

12:35 matthavener: is there something written about *read-eval* in clojure documentation? i read some docs, but i don't understand why the reader would ever need to (eval ..) in the first place

12:35 ska`: Is anyone familiar with the impl of the new reducers? I'd like to understand why in line 110 "this" is used, whereas the other implementing definitions use "coll".

12:35 jeremyheiler: mae, do you have a stack trace to show us?

12:35 technomancy: matthavener: it's a secret feature; IIRC the only documentation for it is the docstring on *read-eval* itself

12:36 matthavener: it looks like clojuredocs.org has an example though

12:36 http://clojuredocs.org/clojure_core/clojure.core/*read-eval*

12:36 mae: @jeremyheiler sure but its a bit complicated what i'm trying to do, i'm trying to generate classes for voltdb procedures

12:36 dnolen: ska`: looks like a naming inconsistency, `this` doesn't mean anything special.

12:36 mae: @jeremyheiler give me some time, i was just wondering if anyone had any experience with native vararg functions and maybe alittle snippet example

12:37 TimMc: technomancy: I have a patch on JIRA for documenting it in read and read-string, but...

12:38 technomancy: TimMc: keep up the good fight

12:38 ska`: @dnolen: ain't "this" the first argument when calling e.g. coll-reduce but using "coll" creates a closure in this case?

12:38 matthavener: what is #= ? don't see it in the clojure cheatsheet

12:38 TimMc: technomancy: It has been screened, so I guess that's progress.

12:39 technomancy: matthavener: <whisper>because it's secret</whisper>

12:39 TimMc: is it? I can't tell any more.

12:39 TimMc: Well, it wasn't rejected, so it must be a *good* change, right?

12:40 matthavener: that's too bad

12:40 dnolen: ska`: no, it `this` has no special meaning ever

12:40 technomancy: matthavener: it just means you can sneak arbitrary evals into calls to the reader

12:40 jeremyheiler: mae, ok. you definitely should just be able to pass it in as an array.

12:40 technomancy: if that sounds crazy it's because it is =)

12:41 matthavener: yeah, at least "EvalReader" is aptly named

12:41 dnolen: ska`: it's just convention to write `this`, they could have (and probably should have) written `coll` instead - the code would do the same thing.

12:41 matthavener: someone should rename it "ReaderComplectedWithEval" :P

12:41 nDuff: mae: I do have experience, and it's always worked with into-array for me. Just a moment, and I'll find a snippet.

12:42 mae: @nDuff thanks i've done it before but i'm headdesking right now with trying to get voltdb to make these clojure-procedures work

12:42 TimMc: matthavener: It also doesn't work quite the way you'd think:

12:42 user=> (read-string "#=(class (+ 1 2))") ;;= clojure.lang.PersistentList

12:42 matthavener: TimMc: yeah I tried passing #= to my repl but i guess its a read-string only thing?

12:43 nDuff: mae: ...so, a typical use, in this case with an empty arg list: (.invoke getter instance (into-array Object []))

12:44 clgv: ,(read-string "#=(System/exit 0)")

12:44 clojurebot: #<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>

12:44 clgv: good bot

12:44 technomancy: ~botsnack

12:44 clojurebot: Thanks, but I prefer chocolate

12:44 clgv: ~chocolate

12:44 clojurebot: Huh?

12:44 clgv: lol

12:44 technomancy: ingrate

12:45 Anderkent: clgv: but that would only give you ClassNotFoundException System :)

12:45 TimMc: Why?

12:45 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

12:45 clgv: Anderkent: not really. try it in your own repl

12:45 Anderkent: I did

12:45 and thats what i got

12:45 TimMc: ,(System/currentTimeMillis)

12:45 clojurebot: 1358184667428

12:46 clgv: Anderkent: you have a strange repl then^^

12:46 Anderkent: but with (read-string "#=(java.lang.System/exit 0)") it stopped responding and even ctrl-c doesnt work :D

12:46 lein repl

12:46 mae: @nDuff right on readingu p on .invoke, i was using .methodName before

12:46 TimMc: matthavener: (+ 1 #=(+ 2 3)) ;;= 6

12:46 nDuff: mae: "invoke" is the name of the method I was calling.

12:46 mae: oh nm

12:46 lol

12:47 just realized

12:47 technomancy: mae: just a heads up that IRC isn't Twitter =)

12:47 nDuff: mae: Have a standalone reproducer for the issue you're seeing?

12:47 S11001001: technomancy: we should get lambdabot in here

12:47 mae: technomancy: no problem, i have a habit of short messages, blame flowdock for that ; )

12:47 TimMc: S11001001: Does it yell at people for @ing?

12:47 S11001001: TimMc: it'll say "Unknown command, try @list"

12:47 TimMc: haha

12:47 technomancy: nice

12:48 S11001001: you know, unless your nick happens to be "type" or "pl" or something

12:48 TimMc: brb, setting up for a long troll

12:48 mae: technomancy: were you referring to the @ tag? :)

12:49 TimMc: Well, "troll" isn't quite right. Meh.

12:49 ska`: @dnolen: I understand, that "this" has no special meaning, it just happens to be the name of the first argument in that function. However, "coll" is the name of the argument to #'reducer and thus, the difference here is, whether the first argument of the function of the protocol is used or the argument of the surrounding function. Or am I misunderstanding something?

12:52 patchwork: Hey all, I am having an issue with clojure.data.json. I see the function names were updated, but this is suddenly breaking my app. How could a new version have been included in my project without me changing any dependencies?

12:52 This is madness!

12:52 S11001001: patchwork: how did you depend on it?

12:53 technomancy: patchwork: could be a transitive version range: http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html

12:53 S11001001: patchwork: well, in general, you can spec deps in an unstable way, and if any of your deps do so, you inherit that instability

12:53 patchwork: I have no snapshots, if that's what you mean

12:53 technomancy: but yeah, it's madness. if you're depending on a project that specifies a version range you should report it as a bug.

12:53 patchwork: In fact, it is not being included anywhere explicitly

12:54 ska`: @patchwork IIRC 0.2.0 introduced a breaking change, but 0.2.1 restored the old API

12:54 patchwork: Wow, really?

12:54 technomancy: yeah, that was a real face-palm

12:54 patchwork: Still unsure how it could change out from under me

12:54 Cool, thanks guys

12:54 technomancy: patchwork: read the link I posted

12:55 patchwork: Ah, not using ranged versions either

12:55 technomancy: patchwork: you're not directly using ranged versions, but you probably are indirectly

12:55 Anderkent: patchwork: but if you depend on a library that does, that might break your build

12:55 patchwork: Oh man!

12:55 wow

12:56 That is terrible

12:56 Anderkent: yep, they're kinda evil

12:56 technomancy: someone should write a bot that goes through all clojure projects on github and yells at people if they use version ranges

12:56 anyone looking for a project?

12:56 Anderkent: haha, sounds good, I'll add it to my todo list

12:57 patchwork: That could actually be a good solution

12:57 if people are not being informed in some other way

12:57 Anderkent: I suppose rather than crawling github I'd crawl clojars

12:57 technomancy: Anderkent: true

12:57 you should just steal that code from clojuresphere actually

13:01 Anderkent: I don't see a crawler there, on the first look. I think lein-outdated might be more help

13:01 anyway

13:02 progo: I'm translating some hrefs in HTML using enlive's at. I'm passing it a function but that function isn't within my dynamic binding scope. Should I write a closure instead? https://www.refheap.com/paste/8619

13:02 technomancy: Anderkent: actually I think it just tells you how to rsync over the entire pile of poms?

13:03 Anderkent: oh right, I didn't read the readme :)

13:03 mae: nDuff: I am still trying to isolate the issue more, but here is the gist:

13:04 nDuff: https://www.refheap.com/paste/8620

13:07 something probably more to do with the way voltdb reflects on the procedure class

13:07 been climbing through their source code on github

13:08 silasdavis: dakrone: oh you are cheshire!

13:08 dakrone: silasdavis: yes

13:09 * technomancy watches as dakrone smiles widely and disappears

13:09 silasdavis: well thanks... it seems that lib-noir pulls in cheshire 4.0.0

13:09 when you explicitly require 5.0.1 that disappears from lein deps :tree

13:09 but could that be causing the issue with add-encoder?

13:09 dakrone: yea, that could be, sounds like it should explicitly require the 5.0.1 version

13:13 silasdavis: so even though I explicitly require 5.0.1 it will still get 4.0.0?

13:15 Anderkent|away: technomancy: is it only open ended version ranges that should be nuked, or any? How about hard dependencies [1.0]?

13:15 silasdavis: hm, not still doesn't work when I remove that

13:15 technomancy: Anderkent|away: IMO those are harmful too

13:15 dakrone: silasdavis: if you explicitly specify 5.0.1 it should be using that

13:16 silasdavis: if it's not, something weird is going on with lein

13:25 yogthos: silasdavis: I could also update lib-noir to the latest cheshire

13:36 mae: nDuff: the exception is originating from this line: https://github.com/VoltDB/voltdb/blob/voltdb-

13:36 lol

13:36 man i hate java, thanks be to clojure for making java not suck

13:38 yogthos: mae: indeed, all of a sudden jvm is a viable platform :P

13:39 gfredericks: wow; (->> coll (cycle) (drop n) (take (count coll))) is 3 times slower than (seq (into (vec (drop n coll)) (vec (take n coll))))

13:39 mae: yogthos: yeppers ; )

13:40 nDuff: mae: Am I missing something, then? I don't see anything that looks like an issue with varargs.

13:42 mae: nDuff: nope i never claimed that there was a problem with varargs, was just one of the many possible culprits, thanks for your help

13:42 silasdavis: I'm trying to build a simple test case for my cheshire add-encoder problem

13:42 how can I get joda time in my class path so I can use (:import [org.joda.time DateTime DateTimeZone ReadableInstant])?

13:44 yogthos: dakrone: there's not breaking api changes in cheshire 5 from 4 right?

13:44 dakrone: yogthos: from 5 to 4 I think it would be breaking, from 4 to 5 it wouldn't be...

13:44 ie, if you were expecting 5.x, 4 wouldn't work, if you were expecting 4.x, 5 will work fine

13:45 yogthos: dakrone: yeah that's what I meant ;) I'm going to bump lib-noir to the latest

13:46 dakrone: yogthos: you can bump it, an NS is deprecated though, so it would be good to eventually move to the non-deprecated one

13:47 yogthos: dakrone: what's NS again?

13:47 dakrone: namespace

13:47 yogthos: cheshire.custom is deprecated in 5.x

13:47 yogthos: ah yeah I can update not to use it

13:47 if we are :)

13:48 what's the new one to use?

13:48 core?

13:48 clojurebot: core is what you put in a namespace when you can't think of a better way to avoid single-segment namespaces.

13:48 dakrone: yogthos: if you are using add-encoder, use cheshire.generate now, otherwise everything should be in core

13:48 technomancy: ~botsnack

13:48 clojurebot: Thanks, but I prefer chocolate

13:48 yogthos: ok cool

13:49 dakrone: yogthos: https://github.com/dakrone/cheshire#custom-encoders

13:49 yogthos: and https://github.com/dakrone/cheshire#note-cheshirecustom-has-been-deprecated-in-version-500

13:49 tomoj: clojurebot: api is what you put in a namespace when you can't think of a better way to avoid single-segment namespaces

13:49 clojurebot: Ok.

13:49 yogthos: cool thanks, yeah only thing lib-noir does is encode json response with it

13:51 dnolen: nice, http://clojurescript.net

13:52 yogthos: weavejester: still around?

13:52 gfredericks: dnolen: man someone asked at my talk about cljs-in-cljs and I was like "well I'd be surprised if there were anything in the next few months..."

13:52 weavejester: yogthos: Yep

13:52 * gfredericks was very wrong

13:53 yogthos: weavejester: so about the whole route defining, I think there's some value in having syntax which indicates what's happening

13:53 * muhoo waits for cljs-in-cljs-in-cljs

13:54 yogthos: weavejester: like you can just use (def ...) for it, but then things don't jump out at you as easily when reading code

13:54 weavejester: yogthos: But surely (def foo (bar …)) is more descriptive than (defbar foo …)

13:54 technomancy: weavejester: I agree; defroutes is the one thing about compojure that still feels iffy

13:54 weavejester: The former tells you exactly what it does

13:54 The latter is very opaque

13:54 yogthos: that's true

13:55 technomancy: (not that you have to use it)

13:55 yogthos: the advantage is that you document the intent with the second one

13:55 technomancy: huh?

13:55 yogthos: hmm how to explain :)

13:56 technomancy: the only advantage of defroutes is that it saves one level of nesting, so it makes it easier to fit things in 80 columns

13:56 weavejester: I'm not sure I agree. (def foo (bar …)) is a better indicator of intent - that you want to define a new var

13:56 technomancy: yogthos was actually proposing a "defroute"

13:56 yogthos: hmm I see the other side of it too though

13:56 weavejester: technomancy: i.e. (defroute foo GET "/" [] …) => (def foo (GET "/" [] …))

13:56 muhoo: wait, isn't that a noir thing?

13:57 yogthos: if you keep to one standard syntax it's easier to tell exactly what it's doing

13:57 technomancy: weavejester: huh; I see

13:57 I disagree; introducing new syntax obscures what's actually going on

13:58 yogthos: technomancy: I agree with that

13:58 jweiss: if 2 threads try to update the value of 2 different keys in a map in a ref, does that cause a collision and retry?

13:58 weavejester: I'm generally not a huge fan of macros that define things

13:58 technomancy: unless it's something that can't be implemented in terms of a function obviously

13:59 muhoo: the way that noir did route definition via macros made them very difficult to compose and work with

13:59 nDuff: jweiss: The STM subsystem doesn't know that much about the datastructures behind it.

13:59 technomancy: muhoo: true, but wasn't that largely because it didn't use vars at all?

13:59 IMO this is more a matter of taste than an actual technical problem

14:00 nDuff: jweiss: ...if the STM subsystem could DWIM, alter and commute wouldn't be two different things. :)

14:00 jweiss: nDuff: so if i use one huge ref, even if my threads are not trying to update same place inside it at the same time, then it would potentially get a lot of conflicts?

14:00 muhoo: ah, it was defpage not defroute.

14:00 yogthos: weavejester: I definitely appreciate the transparency argument

14:01 nDuff: jweiss: Yes. That said, there will always be at least one thing succeeding, so it might be worth verifying that you actually have a problem before redesigning to work around it.

14:01 jweiss: i am not really clear on what commute is supposed to be for. the docs for refs seems to assume i already know what it does.

14:02 weavejester: jweiss: It's for applying functions where the order doesn't affect the result.

14:02 muhoo: technomancy: IIRC, defpage was a macro that wrapped around compojure's defroute. it made stuff like this necessary: https://github.com/kenrestivo/crudite/blob/master/src/crudite/core.clj

14:02 weavejester: jweiss: e.g. if one thread adds 2 to a counter, and another thread adds 1 to a counter

14:02 technomancy: muhoo: yikes

14:02 weavejester: jweiss: Whichever thread goes first, the same result occurs.

14:02 muhoo: still gotta rewrite that to use pure compojure. eventually.

14:03 jweiss: weavejester: ah that helps, thanks. i think most of my transactions would be commute, then

14:03 since they are updating different values in the same map, i don't care which one gets updated first.

14:04 weavejester: jweiss: It effectively does the same thing as alter, but it's more efficient, because it doesn't have to coordinate order.

14:04 jweiss: So long as you're sure that two threads won't update the same value

14:05 But usually it's for things like counters

14:05 (commute counter inc)

14:05 jweiss: in my case, it's a test harness where multiple threads are running different tests and updating a map of results. two threads won't be running the same test. so should be fine.

14:05 weavejester: jweiss: Ah, I see. That should be okay, then.

14:06 TimMc: Nice, that's a use of commute I hadn't considered.

14:06 jweiss: Now go learn about ##(doc ensure)! :-D

14:06 lazybot: ⇒ ------------------------- clojure.core/ensure ([ref]) Must be called in a transaction. Protects the ref from modification by other transactions. Returns the in-transaction-value of ref. Allows for more concurrency than (ref-set ref @ref) nil

14:10 jweiss: TimMc: I'm not sure what that is for either, seems like i wouldn't need it for what i'm doing.

14:11 TimMc: Yeah, I doubt you'd need it.

14:11 nDuff: jweiss: in that kind of use case, basically all your work will be inside the test itself.

14:11 TimMc: It's actually pretty important to know about, though.

14:11 nDuff: jweiss: ...so, as long as the update at the end of the test is in its own transaction, it's not an issue if that gets retried.

14:12 TimMc: If writing to ref B depends on the value of ref A, and you aren't writing to A, you need to call (ensure A).

14:12 nDuff: jweiss: ...it's if you tried to put the test itself in the transaction that things would be ugly.

14:12 TimMc: That prevents some other transaction from sneakily changing A out from under you.

14:13 jweiss: nDuff: right, the test results would be fine that way. i had also considered putting the trace in there too (which would be quite verbose and frequent updates), but i think that might be a bad idea. especially if i have watchers on the ref. i don't want the watcher just doing a no-op because a function got traced.

14:13 silasdavis: is there a way to clean a leiningen project?

14:13 TimMc: silasdavis: lein clean

14:13 silasdavis: I'm getting errors that don't happen when I copy most of the code into a fresh project

14:14 TimMc: lein 1 or 2?

14:14 silasdavis: ... that's 2 hours I'm never getting back

14:15 TimMc: thanks

14:15 2 - it worked

14:17 calis_: are there any blogging systems written in clojure?

14:20 zodiak: calis_, not that I am aware of.. but it sounds like a good learning project ;)

14:21 dnolen: calis_: there's a Jekyll like thing

14:21 ohpauleez: and I've seen some blog-like examples for Compojure and the now defunct Noir

14:21 but no formal project

14:22 tuor: I'm trying to get started with clojure and korma, but I'm getting a CannotAcquireResourceException (see https://www.refheap.com/paste/8622 ). Any ideas?

14:22 calis_: Yeah, I think there are static page generators, but no commenting systems

14:24 thorwil: calis_: i'm *slowly* writing a blogging platform which will include a commenting system. not there, yet

14:27 zodiak: tuor, that's not a korma error, but rather a c3p0 error that korma relies on for resource pools

14:30 tuor: Thanks zodiak. Where should I look to solve the c3p0 error?

14:31 jcrossley3: tuor: i might first try ruling out problems with the odbc driver. maybe try h2?

14:32 zodiak: tuor, sadly, the way I sorted that error when I had it was to jump down to an earlier c3p0 zip

14:32 I think I tried 0.9.0. .. something or other (it was a pet project/sandbox/dev tinker)

14:33 tuor: jcrossley3, I don't understand reference to "h2". The odbc driver works with a straight connection, but might it not work with c3p0?

14:34 zodiak, I will try a different c3p0 version, then. Thanks!

14:34 zodiak: jcrossley3, long time no see ;)

14:34 hiredman: tuor: c3p0 can be kind of touchy, it may need tuning

14:35 tuor: hiredman, that's good to know. I just assumed korma would take care of setting up c3p0.

14:36 technomancy: tuor: the fact that Korma thinks it can take care of setting up c3p0 is one of my biggest annoyances with it.

14:37 jcrossley3: technomancy: thankfully, i think alexbaranosky is addressing that

14:37 technomancy: jcrossley3: cool

14:37 tuor: technomancy, is there something else you recommend? I am dealing with a legacy read-only database, and I like the idea of composable queries.

14:37 technomancy: tuor: there is no good solution for SQL databases right now in Clojure to the best of my knowledge

14:38 clojure.java.jdbc makes fewer mistakes merely by virtue of being lower-level

14:38 but it's still misguided in a number of disappointing ways

14:38 TimMc: technomancy: Hey, have you had occasion to figure out how to manage transactions explicitly in c.j.jdbc?

14:39 specifically for SQLite

14:39 tuor: technomancy, ok. Well, I was using straight SQL before, so I can continue on that road.

14:39 technomancy: TimMc: no, I think SQLite on the JVM is a lost cause

14:39 TimMc: D-:

14:39 technomancy: I couldn't get it working anyway

14:40 TimMc: I have a project that uses SQLite. :-/

14:40 technomancy: we are in the process of moving clojars off SQL entirely

14:40 TimMc: Oh right, you're using Lucene.

14:40 brehaut: one of my friends has managed to get SQLite going with clojure + korma. it works, but it keeps running into horrific slowdowns for him

14:41 technomancy: TimMc: actually more of a mix of Lucene and in-memory atoms now

14:41 amalloy: technomancy: you just unveiled some kind of github aws pair-programming thing, didn't you? what are the advantages over just tmuxing into a colleague's computer?

14:41 technomancy: tuor: the most promising thing I've seen in this area is this https://github.com/jkk/honeysql but it's not ready yet

14:42 amalloy: NAT, key management, and user creation/trust mostly.

14:42 tuor: Thanks for the help, technomancy.

14:42 technomancy: plus you don't have to interrupt the pairing session if you (for instance) move your laptop to a different network or hibernate it

14:43 amalloy: but if you already have a server set up for it and you typically collaborate with the same users then there's no much benefit

14:44 amalloy: but also: the fact that you can implement it in ~400 LOC of clojure =D

14:46 TimMc: technomancy: In my case, I mainly read all the data out of the DB, munge it in memory, then spit it back out into a different DB.

14:47 technomancy: TimMc: you might not hit the same problems I was hitting then. but I'd still never recommend sqlite when there are h2 and derby

14:47 * nDuff eyes technomancy warily

14:47 * nDuff has been burned by h2 one hecuvalot worse than he ever has by sqlite

14:48 technomancy: nDuff: have you used the xerial JDBC adapter?

14:48 nDuff: (unclean shutdown / data loss issues, mostly)

14:48 ...no, that I haven't.

14:48 technomancy: ok, that's specifically the part that is horrible

14:48 sqlite from not-the-JVM is fine

14:48 nDuff: Ahh.

14:48 That I can believe.

14:49 hiredman: derby is very nice

14:51 SegFaultAX: Is derby something like sqlite3?

14:51 technomancy: yeah, but it's a pure-java implementation

14:51 SegFaultAX: Oh, that's kinda neat!

14:51 Is it reasonably stable?

14:51 hiredman: I imagine derby predates sqlite? not sure

14:52 http://db.apache.org/derby/

14:52 SegFaultAX: hiredman: Looking at it now.

14:52 jweiss: is it better to declare a record with just fields it will always have, or include even optional fields. or better to assoc in optional fields later?

14:53 hiredman: the in memory datomic transactor seems to embed h2, but I am not very familiar with that

14:58 jcrossley3: SegFaultAX: h2 is reasonably stable, but often you need to tweak its defaults, so your connection string ends up with a lot of config, e.g. MVCC=TRUE;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE

14:59 SegFaultAX: jcrossley3: What is h2? Is that a derby distribution or something?

14:59 mae: what does the @ prefix do/

15:00 hiredman: I get a postgres vs. mysql vibe from h2 vs. derby

15:00 amalloy: ,'@x

15:00 clojurebot: (clojure.core/deref x)

15:00 jcrossley3: SegFaultAX: different projects, similar goals (java rdbms)

15:01 technomancy: hiredman: which is which?

15:01 hiredman: technomancy: in order above

15:01 but I have never used h2 for anything ever

15:02 SegFaultAX: So h2 is significantly better in most respects?

15:02 technomancy: hiredman: but you said derby is actually nice

15:02 hiredman: sure

15:02 it is, and it works ok

15:02 I have no experience with h2

15:03 it is just sort of a general vibe

15:04 mae: another question: with :state in gen-class, can i declare multiple fields?

15:04 i.e. multiple member fields

15:04 ebaxt: I'm struggling to add a defmethod without restarting the repl, is that not possible?

15:05 pbostrom: fwiw, I worked on a pretty heavyweight Java app a few years ago that was configured to use derby by default, I always thought it worked pretty well

15:07 hiredman: love core.logic? all about list comprehensions? wonder if you should use a list monad? trying embedding a sql database today!

15:08 ebaxt: Never mind, I forgot to (var dispatch-fn)

15:10 TylerE: Is it possible to get the la clojure plugin for intellij to do "intelligent" code formating by default, e.g. aligning the test clauses in a cond

15:10 I know that emacs+slime can do that sort of thing, but I'm pretty used to intellij these days

15:13 SegFaultAX: What does the , in ,'@x do? Is that a comment?

15:13 mae: SegFaultAX: dereferencing

15:13 SegFaultAX: mae: That's @

15:13 mae: lol

15:13 nm then

15:24 llasram: SegFaultAX: Looks kind of like someone trying to CL-style unquoting

15:24 SegFaultAX: llasram: That's what I assumed.

15:27 jonasen: cemerick: My first nrepl middleware: https://github.com/jonase/nrepl-transcript :)

15:27 yogthos: hiredman: technomancy: question for you guys :) I've got support for a whole bunch of dbs in luminus, would it be better to trim that to some recommended ones

15:28 for example, between sqlite, derby, and h2, is there one that's generally preferred and recommended over the others

15:28 cemerick: jonasen: Nice :-)

15:29 jonasen: Did you find the architecture, APIs, etc reasonable to work with?

15:29 jonasen: cemerick: Yes. It was pretty easy.

15:30 hiredman: yogthos: I definitely think using sqlite from the jvm is silly

15:31 yogthos: hiredman: I always use postgres myself, so I have very passing familiarity with the embedded dbs

15:31 jonasen: cemerick: but it's not a particularly complicated middleware either

15:31 cemerick: sure

15:31 yogthos: hiredman: I'm leaning towards just including h2 or derby, but not really sure which one's better :)

15:32 cemerick: jonasen: you're capturing stuff off of the transport though, which is the significant departure from e.g. the ring model

15:32 technomancy: yogthos: maybe nDuff and jcrossley3 could share their experiences

15:33 cemerick: jcrossley3, tcrawley: BTW, pipes look pretty slick :-)

15:33 nDuff: Not sure I want to go into the details, but I've had plenty of issues with H2 stores being corrupted on unclean shutdown.

15:34 tcrawley: cemerick: thanks! I see it as a work-in-progress, but it has potential

15:34 jonasen: cemerick: is that wrong?

15:34 yogthos: nDuff: that sounds like a bad thing :P

15:34 nDuff: I'd look into Derby pretty closely if I wanted a JVM-native embedded database right now.

15:34 cemerick: jonasen: insofar as you want to be capturing output as well as input, no

15:34 yogthos: nDuff: so sounds like derby would be the winner, and I should probably just cut h2 and sqlite from the list

15:34 nDuff: SQLite is my goto for that niche in the general case, but I haven't used it from the JVM, so warnings about the quality about the JDBC driver are apropos

15:35 cemerick: jonasen: If you only cared about e.g. :code, then you wouldn't have to touch the transport

15:35 nDuff: s/quality about the/quality of the/

15:35 yogthos: nDuff: I haven't found any issues using sqlite with jdbc, but there seems to be a negative cloud around it here :P

15:35 cemerick: tcrawley: how is data going from stage to stage between nodes? pr/read, java serialization, or other?

15:35 yogthos: granted I haven't done anything interesting with it beyond just seeing that it works

15:36 tcrawley: cemerick: it's using pr/read, yeah. in the docs there's a paragraph about making sure your data is serializable in that fashion

15:36 jonasen: cemerick: ok

15:36 UberNerdGirl: jamii: :P

15:36 cemerick: tcrawley: sorry, I only got far enough to know where to file it mentally for later :-/

15:37 tcrawley: cemerick: no worries, I wasn't saying RTFM :)

15:37 jcrossley3: yogthos: i would never use sqlite for anything other than colocated, single-user access. i've not used derby, though i've heard good things about it. i like h2 because its in-memory store is xa-compatible which i need for testing. i probably wouldn't use any of the three in a production app. :)

15:37 technomancy: yogthos: feel free to peruse the clojars issue tracker if you want background on that particular trail of tears

15:37 UberNerdGirl: jamii: hello stranger :P

15:37 yogthos: technomancy: haha

15:37 jonasen: cemerick: next, I'll make a datomic backend so you can query your repl history :)

15:38 cemerick: jonasen: you should talk to kovas; that's his bag w/ session

15:38 yogthos: jcrossley3: so sounds like cutting sqlite and leaving h2/derby is probably reasonable then?

15:39 jcrossley3: yogthos: yes

15:39 jonasen: cemerick: I've worked with kovas on session lately.. that's where I got the idea from.

15:39 cemerick: ah-ha, nm then :-D

15:47 TimMc: Hmm, I should check how hard it would be to use Derby from Python. :-P

16:00 CoverSlide: isn't hsqldb kind of the new derby?

16:01 or h2?

16:05 jcrossley3: CoverSlide: h2 was a rewrite of Hypersonic, which was renamed HSQLDB, and also has a version 2. hope that helps. :)

16:06 CoverSlide: yeah i know

16:06 oh they mentioned h2

16:07 sorry just reading the previous conversation

16:08 Bronsa: http://i.imgur.com/GNLQ4.png is this expected behaviour?

16:09 TimMc: Looks a bug,

16:10 amalloy: posting a screenshot of text into irc? no, not expected behavior

16:10 TimMc: Why'd you post it as a screenshot?

16:10 heh

16:10 Bronsa: because i don't want to flood

16:10 and I'm too lazy to use a nopaste.

16:10 amalloy: imgur looks like ten times as much work as gist or refheap

16:10 but whatever

16:10 TimMc: You have a special app for screenshots?

16:10 Bronsa: i have a command line command, yes

16:11 bbloom: Bronsa: but now we can't copy paste into our repl to verify

16:11 Bronsa: fair enough

16:11 TimMc: amalloy: Luckily, I have an ascii-art image renderer in Lynx, and if I align it *just* right...

16:11 (I wish.)

16:12 Bronsa: http://sprunge.us/JYcB

16:12 clojurebot: dakrone maintains clj-http

16:13 amalloy: anyway, i imagine the ^:const causes the compiler to replace the bar symbol with a vector that has compile-time metadata, rather than runtime metadata

16:13 but this is an area i always get wrong, so take that with a grain of salt

16:14 Bronsa: no, it seems like metadata gets simply ignored

16:14 https://github.com/Bronsa/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6784-L6785

16:14 bbloom: Bronsa: only when :const ? what about if :dynamic ?

16:14 Bronsa: it might as well be expected behaviour

16:15 bbloom: doesn't seem like that should be expected

16:16 amalloy: Bronsa: your link doesn't support your assertion at all as far as i can tell

16:19 Bronsa: amalloy: it goes through analyzeSeq that finds out the first element is QUOTE

16:19 parsing the expression as a ConstantExpr

16:19 that AFAIK ignores metadata

16:19 amalloy: so? (quote ^:foo []) can have metadata

16:20 &(meta (quote ^:foo [1 2 3]))

16:20 lazybot: ⇒ {:foo true}

16:20 Bronsa: i see

16:33 oh wait

16:33 the metadata is there

16:33 user=> (meta (.getRawRoot #'foo))

16:33 {:foo true}

16:33 TimMc: whaat

16:37 Bronsa: weird

16:37 http://sprunge.us/SUFf

16:47 iamedu: Hi! sorry to bother... I am a programmer... who is very interested in functional programming, in particular clojure... I'm reading a book to learn, but I thing in order to truly learn I think I need a little guidance, and maybe a project.. so I'd like to know.. if there's anyone here that could give me a project and perhaps advice... Thank you very much!

16:47 brehaut: iamedu: 4clojure.com

16:48 not a project per se

16:48 devn: iamedu: Use the REPL a lot. It's a fast feedback loop.

16:48 brehaut: but you'll learn heaps

16:49 iamedu: Interesting I'll give it a try!

16:49 nDuff: ...an environment which makes the REPL easy-to-use is worthwhile also.

16:50 iamedu: nDuff: what do you recommend/

16:50 ?

16:50 nDuff: If you're looking for a playground/sandbox beyond 4clojure, there's Light Table; if you're willing to invest in climbing a learning curve, emacs+nrepl.el is the gold standard.

16:50 (Personally, I use Emacs Live)

16:51 iamedu: Thanks, I think I should learn emacs anyway

16:52 amalloy: i wouldn't recommend light table yet, really. last i heard about it was someone trying to learn clojure getting tripped by some bug in the current pre-alpha

16:52 brehaut: iamedu: thats like learning to pilot a space shuttle to go get milk from the shop

16:52 amalloy: just use any kind of repl. tryclojure is super-easy to use

16:52 brehaut: (iamedu the emacs bit)

16:53 TimMc: brehaut: I wonder how the learning curves compare.

16:54 brehaut: haha

16:54 mae: hi, to create a voltdb procedure i need to create a declared field which is non-private via gen-class, is this possible? here is the line of code responsible in voltdb for populating sql query information, basically i need some fields to show up in the java reflection api.

16:55 https://github.com/VoltDB/voltdb/blob/voltdb-

16:55 iamedu: ok.. so small steps I think I'll start with tryclojure and 4clojure for now...

16:55 TimMc: mae: Wow, that looks like a complete pain.

16:56 mae: TimMc: yep, i'm like this | | close from patching voltdb for an 'alternate' way of providing the info

16:56 TimMc: Oh god, it's even calling setAccessible.

16:57 mae: i was hoping some gen-class wizard in here

16:57 could provide me with some magic spells

16:57 or in lisp-speak spels

16:57 http://www.lisperati.com/casting.html

16:57 brehaut: pretty sure magic spells are a scheme thing

16:58 TimMc: gen-class is a big pile of undocumented features.

16:58 mae: lol sorry forget the lisperati reference, lets focus on the gen-class

16:58 @TimMc ahh ok so i should read the source for the eh?

16:58 lol

16:58 TimMc: mae: This may be one of those times.

16:58 mae: kk

16:59 llasram: mae: I'm fairly certain you can't make non-private members with `gen-class`

16:59 TimMc: At least while you wait and see if anyone in the channel happens to know.

16:59 llasram: mae: It's been a few months since I went spelunking through it to try to understand everything that could be done

16:59 mae: but I'm still pretty confident on that one

17:00 mae: i knew there had to be a good reason no one has any examples of this on the net


17:01 llasram: Oh right, the `state` member will be public

17:01 TimMc: mae: As a fallback, you can write a .java file and put it on your project's java-source-path(s).

17:02 mae: indeed

17:02 i was thinking i could inherit from VoltProcedure in a .java

17:02 and somehow create a shim

17:02 but that seems like it might not work

17:03 llasram: i tried using state already, it still didn't seem to show up to the voltdb's compiler

17:04 llasram: And even if it did work, it would be a hideous, hideous hack

17:04 yogthos: mae: there's a good overview of gen-class on this guy's blog http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html

17:04 mae: llasram: see https://www.refheap.com/paste/8632

17:06 llasram: Ok, so wouldn't be all that hideous, if did work

17:09 gfredericks: I love how the README for clojure.core.cache says to look at the autogenerated API documentation for more details, and it's virtually blank

17:28 I'm having an awful time trying to figure out how to use core.cache to do something similar to memoize

17:29 hiredman: immutable caches are weird

17:30 Apage43: gfredericks: I just used core.memoize

17:30 hiredman: gfredericks: you make whatever and stick it in an atom

17:30 Apage43: https://github.com/clojure/core.memoize

17:30 hiredman: I think sticking it in an atom is what core.memoize does

17:31 gfredericks: Apage43: maybe my problem was not realizing that was a separate thing

17:31 Apage43: hiredman: thanks :)

17:32 Apage43: also hiredman is correct about the atom-sticking https://github.com/clojure/core.memoize/blob/master/src/main/clojure/clojure/core/memoize.clj#L125

17:34 arohner: I'm trying to used typed-clojure, and I'm getting exceptions in the analyzer

17:34 tomoj: bbloom: what is dispatch-map for?

17:34 arohner: foo already refers to: #'the.ns/foo in namespace: user

17:34 tomoj: oh, I didn't notice the blog post yet

17:34 arohner: seems like the analyzer has a problem with (:require [foo :refer (bar)]). Is that a known issue?

17:35 loganlinn: There isn't a Compojure equivalent of Rails' `rake routes`, is there?

17:35 nDuff: loganlinn: What does that do?

17:35 loganlinn: outputs all registered routes

17:35 on command line

17:36 brehaut: loganlinn: i dont think you could feasibly do that in compojure. routes just builds a handler function; they are opaque

17:36 loganlinn: nDuff: http://guides.rubyonrails.org/routing.html#inspecting-and-testing-routes

17:36 weavejester: We probably need something more restrictive, but also more transparent than Compojure.

17:36 nDuff: loganlinn: I ask principally to make the point that you were underspecifying.

17:36 s/ask/asked.

17:37 technomancy: loganlinn: it's usually pretty easy to see all the routes just by hitting "navigate-to-source" on your app

17:37 you can jump around to all the nested definitions easily if your editor is set up for it

17:37 nDuff: loganlinn: ...many of us come from route-enabled web frameworks other than rails.

17:38 loganlinn: yeah, im not really a rails user anyway, I was just curious because I thought it was useful when building a rest api

17:38 especially when things are nested within contexts

17:46 technomancy: weavejester: compojure.core/routes could certainly attach metadata to the handler function it generates

17:46 problem is you can't look deeper into nested handlers

17:46 well you could with a macro that would walk the body, but that's sketchy

17:47 hiredman: sounds like you need executable maps

17:47 weavejester: technomancy: Yeah, those were my thoughts too. You might quickly come across instances where it doesn't work.

17:47 hiredman: ZING!

17:47 technomancy: hiredman: you mean like cljs source maps?

17:47 weavejester: My thought it to make a more restrictive library that routes off a data structure.

17:48 Sometimes you might need to drop back down to Compojure

17:49 But a lot of the time a static routing map would do

17:49 yogthos: making the common case easy is always good :)

17:50 technomancy: weavejester: I dunno; that sounds a bit like the situation with scheme macros where now you have to understand two separate systems because the simpler one isn't powerful enough.

17:50 weavejester: technomancy: Well, there is that...

17:50 technomancy: maybe there would be benefits to it, but just being able to programmatically list all routes doesn't seem compelling enough to introduce a new top-level concept

17:51 weavejester: Maybe if you make your web apps small enough, it doesn't really matter.

17:51 technomancy: s/benefits/more benefits/

17:51 I'm a strong believer in the power of M-.

17:51 brehaut: technomancy: the bigger benefit is that you'd be able to implement route reversal (ie, given a route name, and some args, produce the url to get there)

17:52 technomancy: brehaut: hm; maybe so

17:52 by "a route name" you really mean a handler?

17:52 brehaut: although im not sure that is a benefit yet. its certainly something that people with django experience expect

17:52 technomancy: or a defroutes var?

17:52 brehaut: technomancy: yeah either a handler or a literal name

17:52 loganlinn: when routes are nested, maybe said metadata could be modified to include the new prefix? just an idea. but you're right, I don't think there's a strong enough use-case other than transparency/debugging

17:52 weavejester: Route reversal is really only useful if you want to change your URLs as far as I can see.

17:52 hiredman: and according to the w3c, cool urls never change

17:53 weavejester: loganlinn: The nested route would need to gather up the metadata of its children.

17:54 technomancy: the context macro might complicate it further too

17:54 brehaut: weavejester: django users like it because it handles 'include'ing apps routes within a master route and not making the app hardcode the path

17:54 technomancy: I need to start using that

17:54 yogthos: I'm still of the opinion that dsl with good naming allows thinking in terms of the problem domain better :)

17:55 brehaut: weavejester: however, the value of django's apps is marginal

17:55 i <3 'context

17:55 yogthos: even in clojure core we see a lot of that, for example all defn is (fn [params* ] exprs*))

17:55 err (def name (fn [params* ] exprs*))

17:56 it's a small difference, but important in my opinion

17:57 weavejester: I think context could be faster in some cases...

17:57 Certainly in the case where there are zero parameters

17:58 Although I'd need to check hotspot doesn't already optimise it.

17:58 technomancy: measure twice; cut once

17:58 brehaut: yogthos: im weary of things that improve the easy case in exchange for making the hard case harder though

17:58 yogthos: brehaut: it's always a balance :)

17:58 tmciver: weavejester: speaking of context, is one supposed to use hiccup.middleware/wrap-base-url when creating a war via 'lein ring uberwar'? I ran into this problem yesterday and using that middleware was the solution I found.

17:59 weavejester: tmciver: If you're using Hiccup then it's useful when deploying to a subdirectory.

18:02 tmciver: weavejester: isn't using context necessary if the app is not at the server root?

18:03 weavejester: tmciver: What do you mean? context the macro? :context the keyword?

18:05 tmciver: I'm not actually sure. :/ This is the first time I've deployed a clojure web app to an app server. The problem I had initially was that links on pages were with respect to localhost:8080 rather than localhost:8080/my-app

18:06 Usign wrap-base-url solved the problem. Should I be doing something more sensible?

18:07 weavejester: tmciver: No, wrap-base-url is a good solution if you're using Hiccup and expect to deploy to a subpath. That's what it's for.

18:07 tmciver: But if you're using some other system you need to use another solution; links don't automatically change.

18:07 yogthos: this sort of thing is precisely the motivation for luminus :)

18:08 tmciver: weavejester: my feeling is that the behavior that wrap-base-url provides is the typical, desired behavior, no?

18:08 Do most people deploy to the server root? I.e., it's the only app on the server?

18:10 I expect to have several clojure web apps running within the same instance of tomcat, in which case they'll all need this behavior.

18:10 weavejester: tmciver: It depends how you're deploying it. Servlet containers like Tomcat or Jetty tend to have a URL scheme like example.com/app

18:11 tmciver: weavejester: Yes, where app is the name of the war, correct?

18:11 weavejester: Yep

18:11 yogthos: tmciver: so each app will have a :context key in the request in that scenario

18:11 weavejester: But if you're say, deploying your app as a standalone app behind nginx, you might have your app running on app.example.com

18:12 tmciver: weavejester: Initially, I was able to navigate to the start page of my app but all the links did not include the 'app' part and so they failed.

18:12 weavejester: Cloud deployments, such as to Heroku and AWS beanstalk, also tend to take a app.example.com approach.

18:12 yogthos: the real path to the app is :context + :uri

18:12 weavejester: yogthos: No!

18:12 yogthos: The :uri is *always* the URI

18:13 yogthos: weavejester: well if you're on a standalone your context is null right

18:13 weavejester: yogthos: (str (:context request) (:path-info request)) == (:uri request)

18:13 yogthos: weavejester: ah ok

18:14 weavejester: tmciver: Links don't automatically change to adhere to the context unless you use something to change them.

18:15 tmciver: weavejester: something like use wrap-base-url.

18:16 I guess this is what I'm really trying to figure out. It seems to me that you would *always* need to use wrap-base-url.

18:16 yogthos: I guess wrap-base-url is hiccup specific right?

18:16 so if you used something like enlive it would have to provide its own wrapper right?

18:17 weavejester: Yes, wrap-base-url is Hiccup specific, and useful if you're deploying to Tomcat or something that uses subpaths

18:17 That way you don't have to write your own function to generate the right URLs.

18:17 But you don't need it if you're deploying to a subdomain, for instance.

18:17 tmciver: weavejester: OK, true.

18:18 yogthos: oh yeah is there any cleaner way to handle context from ajax aside from hidden fields on the page?

18:18 weavejester: yogthos: In what way? You can store the data as a variable in Javascript.

18:19 yogthos: weavejester: contexts really do introduce a lot of gotchas

18:19 tmciver: weavejester: so if one does not use hiccup and wishes to use tomcat (with subpaths), then they'd have to write their own wrap-base-url like middleware?

18:20 weavejester: tmciver: Right

18:20 tmciver: For instance, you could write some middleware to add the context to a binding

18:21 (defn wrap-context [handler] (fn [request] (binding [*context* (:context request)] (handler request)))

18:21 And then you could write your URLs as (str *context* "/normal/path")

18:21 tmciver: weavejester: I seem to recall reading yesterday that mmcgrana wanted to 'try out' the :context, :path-info stuff before putting it into ring-proper?

18:22 weavejester: tmciver: That was years ago, and it's been tried out in Compojure and lein-ring.

18:22 Ring 1.2.0 will have :context and :path-info support. It seems a tried-and-tested idea by now. Mark agrees, btw.

18:23 tmciver: weavejester: then will a wrap-base-url middleware also be a part of ring 1.2.0? Seems it should be.

18:24 weavejester: tmciver: No, because that's Hiccup-specific.

18:24 bbloom: tomoj: dispatch-map is for when you want multimethod-like behavior, but don't want top level defmethod statements

18:24 weavejester: It might be an idea to add middleware to set a *context* binding, but I'm not certain that's necessary yet.

18:25 bbloom: tomoj: you can, for example, walk some data structure and compose a dispatch-map

18:26 tmciver: weavejester: it's hiccup-specific because of the use of *base-url* in hiccup.util/with-base-url?

18:26 bbloom: tomoj: so it's useful anytime you want pluggable dispatch in a dsl type environment

18:28 sundbp: hi. i'm a bit confused about dynamic vars. example: (binding [*foo* [1 2 3]] (map (fn [x] (prn *foo*)) [1 2 3])) -> prints 1, 1, 1. How come the *foo* in the anonymous function does not inherit the *foo* binding it's defined within?

18:28 weavejester: tmciver: Yes. I mean, Ring could have some middleware that sets a *context* macro, but as far as I'm aware, no other templating system handles this.

18:28 hiredman: ~map

18:28 clojurebot: map is *LAZY*

18:28 sundbp: sorry, i started with: (def ^:dynamic *foo* 1)

18:28 amalloy: hah

18:29 weavejester: I mean *context* binding (s/macro/binding/)

18:29 dnolen: sundbp: laziness and binding don't really work well together.

18:29 amalloy: sundbp: hiredman's point is that map instantly returns a lazyseq, without evaluating the function at all. then the binding pops, and then your repl realizes the seq in order to print it; at that time, there is no binding

18:29 dnolen: sundbp: you want a (doall ...) around that map.

18:29 sundbp: dnolen: right - so i need to (doall) got it

18:29 dnolen: ah - there you said it. thanks

18:30 dnolen: works as expected - thanks!

18:30 hiredman: dnolen: didn't you have some example code using core.logic for parsing?

18:31 tmciver: weavejester: OK, I think I'm getting it. Seems like this is pretty yucky when deploying to an app server like tomcat (if you're not using hiccup).

18:31 weavejester: tmciver: Well, it's not as if it requires more than four or five lines of code to fix.

18:33 tmciver: And all frameworks have the same problem. You need to wrap your URLs in something to get the right context path.

18:33 tmciver: weavejester: but as you said above, in the general case you'd have to have your own wrap-context handler and make sure you used that context when writing all your urls.

18:34 weavejester: tmciver: Yes, but that's no different to any other system. You need some way of determining whether to rewrite a URL or not. In Ruby on Rails, for instance, I believe you need to use the "url_for" function.

18:35 MVC.NET takes the approach of rewriting any URL that begins with a "~/", but that approach has its flaws.

18:35 Hiccup rewrites any URI object to have the right prefix, but leaves raw strings alone.

18:36 At some point you have to have something to denote that you want this URL to change depending on whether you're running from development or production

18:36 Or else make sure development and production have the same root.

18:37 tmciver: weavejester: yes, OK.

18:38 weavejester: I guess you have to know way ahead of time if the app is going to be rooted at a sub-path; to change the app to be rooted at a sub-path after writing it assuming it wouldn't be would be a real pain.

18:39 weavejester: I wouldn't say it was hugely difficult to change it

18:54 arohner: is analyze.core supposed to handle (:require '[foo.core :refer (bar])? It's failing hard for me

19:00 * TimMc chucks an extra right paren at arohner

19:00 arohner: TimMc: ha, thanks, but that's not my problem

19:01 the analyzer is breaking when seeing (bar) in the ns to be analyzed

19:01 TimMc: No problem, paredit gives these to me for free.

19:01 arohner: as if it's not resolving in the correct ns

19:02 amalloy: arohner: that's not a valid ns clause

19:02 the ' there makes the whole thing a mess

19:03 arohner: fine. (:require [foo.core :refer (bar)])

19:03 analyze still has a problem with that :-p

19:04 looks like Compiler$analyze calls resolve(), which calls resolveIn(currentNS()...)

19:05 and I don't see a place where analyze.core binds *ns*

19:08 hiredman: arohner: becuase it is hard to find an environment where it is not bound

19:08 all the repls bind it

19:09 arohner: hiredman: yes, but the problem is that when trying to analyze 'the.ns, it's calling resolveIn('user) rather than resolveIn('the.ns)

19:09 because currentNS wasn't rebound

19:09 or rather, *ns*

19:09 hiredman: I doubt that

19:10 arohner: fine. I have a working repro that disagrees with you

19:11 wei_: what's a good way to include scala classes compiled with sbt in clojure?

19:12 amalloy: hiredman: analzye is probably rolling its own compilation based on churning through files and read/eval each form. ie, there's probably no repl setting *ns*. but, i imagine it would have many more errors than just arohner's, if it had forgotten to set that itself

19:12 technomancy: wei_: get it into a maven repo

19:12 arohner: I will have a gist in a minute

19:15 wei_: technomancy: since it's a proprietary library, it should be a local rep. can you vouch for the localrepo plugin? https://github.com/kumarshantanu/lein-localrepo

19:16 technomancy: wei_: yeah, that'd work fine. another alternative is an HTTPS repo or private S3 bucket

19:16 those are better for teams but a bit more work

19:16 wei_: i see, thanks

19:16 technomancy: I strongly recommend just OSSing all your libraries; saves a lot of time =)

19:17 wei_: tell that to my contractee :)

19:17 technomancy: sure; is he on IRC? =)

19:17 wei_: i would love that as well, since you guys would be able to review my code

19:18 technomancy: not the scala bits, sorry =P

19:19 wei_: i may invite him on shortly. i was hired to potentially introduce clojure to the team.. so wish me luck!

19:19 technomancy: cool!

19:19 you can also significantly reduce your GitHub bill by OSSing all your libs

19:20 arohner: https://gist.github.com/4534779

19:20 wei_: oh yeah, definitely

19:20 technomancy: (this has been protips with technomancy; tune in next time to hear technomancy telling you not to bother with a database and just stick with in-memory atoms)

19:21 wei_: no plug for datomic?

19:21 technomancy: that'd be a bit of a double standard, innit?

19:21 "all your libs should be OSS, except the ones you pull in for this proprietary DB thingy"

19:25 wei_: for end-to-end testing purposes, I'd like to trigger javascript events using clojurescript and check for changes on the backend using clojure. is this possible?

19:31 bbloom: wei_: it's possible, but it probably isn't easy

19:35 wei_: seems possible to me as well, but I'm not sure where to start. cemerick: I heard you have done some work on this. is that online somewhere?

19:39 bbloom: cemerick: who are you talking to?

19:39 oh he left

19:50 frozenlock: Someone once gave me a link to a video explaining defmethod, deftype, defprotocol... The first examples were about smaps of shapes (triangle, square, circle). Unfortunately I formatted and lost the link. Anybody has it available? I would really appreciate :)

19:50 bbloom: frozenlock: don't have a link, but have you tried the keyword phrase "solving the expression problem with clojure" ? i think that might have been it

19:53 frozenlock: Hmm that gives me a talk by chouser. Not what I was looking for, but I'll gladly watch it, thanks :)

20:13 hadronzoo: How can one discover the protocols implemented by a given Clojure data type, like a PersistentList?

20:15 TimMc: Oh, awesome! Clojars exposes an rsync daemon.

20:21 brainproxy: tyyyyyyy6

20:22 bbloom: i forget how much it sucks working with java types that don't have sane string representations

20:43 frozenlock: I found the video I was searching, if anyone is interested :http://vimeo.com/53223938 (polymorphism in clojure)

20:46 #clojure really is quiet for a weekday. Is there a special holiday I should know about?

20:46 technomancy: I'm assuming everyone's busy testing the Leiningen release candidate

20:47 frozenlock: technomancy: Of course, silly me.

20:47 cemerick: wei_: yes, I've done some work in that direction, but nothing to publicize yet

20:47 TimMc: aka Leiningen Release Candidate Testing Day, a mandatory federal holiday

20:47 (in all countries)

21:02 djwonk: technomancy: I would be testing but I don't want to REPLicate what other people are doing

21:07 mthvedt: given a symbol 'bar and some namespace foo.core, is there a clojure function that yields 'foo.core/bar

21:11 dmac: mthvedt: the symbol function will do that

21:11 amalloy: well, sorta

21:11 devn: 中国人的需求Clojure的书籍阅读。

21:12 amalloy: absurdly, the two-arity body of symbol requires both arguments to be strings - it won't take symbols

21:13 bbloom: amalloy: that drives me nuts, especially considering ##(symbol 'foo) works fine

21:13 lazybot: ⇒ foo

21:14 mthvedt: thanks

21:31 therealadam: so I wanted to play with algo.monads, but I can't figure out how one gets a repl with that library loaded

21:31 is the easiest way to create a one-off lein project and add a dep?

21:31 amalloy: yes

21:32 to do anything with clojure, step 1 is a lein project (step 0 being to identify what you want to do)

21:33 frozenlock: Isn't there something written by cemerick to load libraries on-the-fly? (In case one doesn't want to one-off lein project)

21:33 amalloy: yes, pomegranate does a reasonable job of it. but i really can't imagine having such an aversion to creating a few files on disk

21:34 therealadam: amalloy: cool. so how do I figure out the way to specify a contrib library as a dep?

21:34 I cloned the algo.monad repo and....can't figure out how it builds

21:34 amalloy: don't build it

21:34 (or clone it)

21:34 therealadam: yeah :)

21:35 amalloy: $latest org.clojure/algo.monads

21:35 lazybot: No project by this name exists on clojars.

21:35 amalloy: ugh

21:35 technomancy: therealadam: heya

21:35 therealadam: technomancy: eyah

21:35 technomancy: no one's written up some good tooling around doing that via pomegranate yet, so you should probably just do `lein new scratch`

21:36 amalloy: therealadam: your project.clj wants to include [org.clojure/algo.monads "0.1.2"] probably

21:36 i'm off though, so if that doesn't work then bug someone else

21:37 therealadam: yeah, looks like maven can't find that dep

21:38 thanks amalloy_!

21:38 frozenlock: therealadam: Maven or Lein?

21:39 Once you have added a dependency in your project file, you should save it and call 'lein deps' on the shell. This will download the jar.

21:40 (unless the new Leiningen does something magical)

21:40 * frozenlock looks at technomancy

21:40 therealadam: top of stack race is a maven stack frame

21:42 frozenlock: org.clojure/algo.monads doesn't show up in my clojars search... perhaps you could try [org.clojars.mccraigmccraig/algo.monads "0.1.3-SNAPSHOT"] ?

21:42 First time getting a REPL up and running is a bitch :)

21:43 jgerman: is there an option to leiningen to get it to give more verbose output? I saw a reference to a DEBUG env variable but not what it's supposed to be set to

21:44 therealadam: awesome, that worked

21:44 thanks frozenlock

21:44 frozenlock: np :)

21:44 therealadam: technomancy: also, thanks for leiningen. as you may be aware, it is orders of magnitude less rage-inducing than sbt.

21:44 frozenlock: therealadam: btw, what are you using as a repl interface?

21:46 I would have rage quitted the first time I tried clojure weren't it for Leiningen.

21:46 Well I did, but I came back the next day :p

21:46 therealadam: `lein repl` or `lein vimclojure :repl true`

21:46 frozenlock: Oh, Vim user...

21:47 * frozenlock M-x emacs-machine-gun

21:49 * therealadam haters gonna hate

21:49 frozenlock: Yeah.. I'm not really honest with myself on this anyway, I've never tried Vim.

21:50 therealadam: it's a thing

21:52 darrickw: Hey, I've run into an odd problem with Clojure initialization (I think) from a JRuby app, wondering if anyone here might be able to help.

21:55 I googled it and someone said they solved it by " calling clojure.main once before using clojure.lang.Compiler.load(commands)." but that makes no sense to me...

21:55 It's at https://groups.google.com/forum/?fromgroups=#!topic/datomic/walERveqEuo

22:00 bpr: what branch does nrepl.el want to receive pull-requests on?

22:01 brehaut: darrickw: i was under the impression that you want to use clojure.lang.RT (https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java)

22:02 darrickw: probably RT.var and RT.invoke

22:03 technomancy: therealadam: glad it's working for you =)

22:03 darrickw: brehaut: I'm doing the following 2 lines:

22:03 String str = "(ns g (:require mcfly.graph))";

22:03 Compiler.load(new StringReader(str));

22:04 brehaut: darrickw: you are trying to muck about with the compiler directly, rather than using the runtime

22:04 technomancy: therealadam: if you haven't sunk much time into vimclojure yet I'd recommend taking a look at the foreplay lib

22:04 supposedly a lot more solid repl interaction for vim

22:05 therealadam: I've heard good things. Right now vimclojure is fine for tinkering, but I'm going to try foreplay if I find the need to tear that part of my config down.

22:05 brehaut: darrickw: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L331-L333

22:06 darrickw: there are (turns out) functions on RT for loading scripts etc

22:06 darrickw: and to compile files

22:07 darrickw: I am using RT.var everywhere, but how do I get it to 'require my namespace?

22:09 hiredman: RT.var("clojure.core", "require").invoke(Symbol.intern(null, "my.ns")); or something

22:09 brehaut: (.invoke (clojure.lang.RT/var "clojure.core" "require") (.invoke (clojure.lang.RT/var "clojure.core" "symbol") "clojure.set"))

22:09 oh. hiredman has a smarter way to get a symbol

22:09 darrickw: oh yeah, that *does* make sense... :)

22:09 hiredman: meh

22:09 I like brehaut's

22:10 having a symbol creating method in RT would be nice

22:10 brehaut: darrickw: you can obviously grab hold of symbol and require as class statics

22:10 darrickw: I'm going to give this a try right now...

22:11 brehaut: there was a nice mini presentation somewhere by rhickey that showed how they do this with the datomic API

22:11 if only datomic were OSS

22:11 egghead: ya brehaut

22:11 http://skillsmatter.com/podcast/scala/impromptu-rich-hickey-lightning-talk

22:11 brehaut: thats the one, thanks egghead

22:11 darrickw: That's what I was going off of, but I don't recall him going into great detail...

22:13 Ok, thanks, that worked!

22:15 oh, interesting, he's doing "private static final Var EVERYTHING = RT.var(...)"

22:22 frozenlock: Is it possible to have multiple client connected to the same repl?

23:07 tomoj: if a paper says "requires rank 2 polymorphism" or "requires rank 3 polymorphism", should one pretty much give up hope porting the ideas to clojure? :(

23:09 echo-area: Is `iterate' supposed to turn an iteration with side-effect into a side-effect free one?

23:10 To turn an imperative iteration into a functional one, I mean

23:11 TimMc: frozenlock: I believe nrepl is designed to support that...

23:11 More commonly, you run a REPL under screen or tmux. :-)

23:14 echo-area: Not exactly, no.

23:16 echo-area: That's one way you can use it, though.

23:17 I usually think of imperative loops as having multiple state variables, and iterate isn't quite as convenient under those circumstances.

23:18 echo-area: What do you do in such circumstances?

23:21 TimMc: loop/recur

23:23 Recall that iterate gives you a series of intermediate values -- it doesn't have any notion of when to stop.

23:23 If you know that you're going to iterate a set numbre of times, that's al well and good. Otherwise, you'll need take-while or whatever it's called.

23:32 DigitalJack: I just realized there is going to be a clojure conference where I live! (clojure/west) That is awesome!

23:38 echo-area: TimMc: Writing in this context functionally makes the function itself longer and harder to understand

23:39 So maybe I should not commit to functional style everywhere

23:39 Always choose the one simpler is the idea.

23:39 TimMc: If you have multiple state variables, loop/recur is pretty nice.

23:39 It's imperative style, but you can embed it in a functional context.

23:41 echo-area: Yeah. Restricting to functional style here only makes it a bit complex

Logging service provided by n01se.net