#clojure log - Nov 24 2012

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

0:04 tomoj: not that I think there's a better way

0:10 antares_: yedi: CDS does mention laziness but this particular fact can be left out of the Collections/Sequences guide

0:11 we will cover it in the Laziness guide which is supposed to be "advanced"

0:12 lynaghk`: Does anyone have any strong arguments for or against namespacing keywords? E.g., :com.keminglabs.c2po.stat/density vs :stat/density vs. :density?

0:13 dnolen: lynaghk`: I generally don't like it unless it's necessary to avoid clashes.

0:13 lynaghk`: This is for the system I described at the Conj. Fully namespaced would be a no brainer if it were a totally automated system, but I anticipate quite a lot of off-the-cuff REPL usage.

0:13 ambrosebs: sheesh, I guess I should have expected the whole anti-contrib, but it's such a buzzkill.

0:14 lynaghk`: dnolen: yeah, that's my gut feeling as well, but I'm leaning towards the informal namespaces just so that you're reminded where the values are actually coming from

0:15 since things like groupers and stats are effectively acting as "middleware" between the raw data and the finished plot geometry.

0:19 dnolen: ambrosebs: FWIW, I really think Typed Clojure belongs in contrib.

0:21 lynaghk`: I think :stat/density is kinda cool. fully namespacing is tedious unless there's a really strong value proposition.

0:21 lynaghk`: dnolen: sold. Thanks for the feedback.

0:27 ambrosebs: dnolen: it was made for contrib. I thought it was obvious why.

0:27 oh well.

0:27 brainproxy: ambrosebs: i look forward to learning more and putting the typed clojure stuff to good use, in time

0:27 dnolen: ambrosebs: you don't need to convince me :) I think it'll be a goto tool for many folks in the near future.

0:28 ambrosebs: :)

0:28 brainproxy: having had my head in this monads stuff for the past several weeks has given me better appreciation of reasoning about code in terms of types

0:28 ambrosebs: brainproxy: hello target audience.

0:28 brainproxy: :)

0:28 ambrosebs: have you played with Frege at all?

0:29 ambrosebs: never heard of it

0:29 brainproxy: ambrosebs: https://github.com/Frege/frege

0:29 it's basically an implementation of the haskell spec on the jvm

0:29 not really a port in the sense that someone sat down and ported ghc over to java

0:30 but a haskell work-a-like

0:30 ambrosebs: interesting

0:32 brainproxy: i'm reading a book on haskell, when I get up to speed, I hope to start spending some time in Frege; i think it would be interesting if one could get clj and frege working together, i.e. without AOT compilation

0:33 dnolen: it's cool to hear that you got Typed Clojure working w/ CLJS - it'd be fun to show a slide or something about that at TechMesh

0:33 antares_: what about including projects to contrib when they mature and get some adoption?

0:34 many newcomers see core.* as "the right way to do Clojure" and when they hit frequent changes or semi-complete libraries, they assume that's how all Clojure is

0:35 that's how ecosystems such as Apache or Eclipse work, things graduate from incubation

0:36 ambrosebs: have *any* contrib libraries reached 1.0?

0:36 antares_: Ruby, Python, Scala work the same way, things get into core only after they really have proven themselves

0:36 dnolen: antares_: sometimes it's worthwhile to symbolically invest in the future - in anycase you've already expressed your opinions quite poorly - might as well leave the topic alone.

0:36 antares_: ambrosebs: no and that's why we get into trouble from time to time, e.g. data.json 0.2 story

0:37 I think most of core.* should not be core.* at all

0:37 so that's not an argument for me

0:37 hughfdjackson: if it helps; i, as a newbie, assumed that things under the core. namespace were golden

0:37 ambrosebs: dnolen: when's TechMesh?

0:37 antares_: hughfdjackson: yeah, being under github.com/clojure already makes people expect certain degree of maturity

0:37 dnolen: ambrosebs: Dec 4 & 5

0:38 hughfdjackson: core namesepace just means "golden" idea

0:38 ambrosebs: dnolen: I'll get something cool together for you.

0:38 dnolen: ambrosebs: SWEET

0:39 antares_: dnolen: not to newcomers

0:39 to them it means "golden, done, ready to be used"

0:39 and it's just not going to change

0:39 hughfdjackson: :D well, while understandable, that's not the first thing that pops to mind

0:40 antares_: a number of core.* projects is at 0.0.1, with breaking API changes in sight (according to github log). That's just very counter-intuitive.

0:41 ambrosebs: dnolen: I was playing around with changing ana/specials to stop macroexpansion. Seems a bit hacky, and I think I'll fall back to typed "wrapper" macros

0:42 Wasn't ana/specials :dynamic at some point?

0:42 dnolen: ambrosebs: why do you need to prevent macroexpansion in CLJS?

0:43 ambrosebs: my motivating example was deftype, if I could catch deftype expansion at (deftype A ISeq (-first ...) ....) then I could probably type check it more easily than the (set! cljs$....) calls it expands to

0:44 but perhaps that's not really a sound idea.

0:45 dnolen: ambrosebs: well I don't really see a problem with making specials dynamic if that helps you out.

0:46 ambrosebs: dnolen: I don't know if it's a dumb idea to mess with the specials.

0:46 dnolen: It was always something that I loved to experiment with

0:49 dnolen: ambrosebs: I do see what you mean - what the deftype macro exands to is a bit implementation specific.

0:49 expands

0:49 ambrosebs: dnolen: ...but you better handle the AST creation correctly..

0:50 It seems fraught with danger. eg. scoping, macros, var resolution

0:51 dnolen: ambrosebs: you mean it seems tricky even if you get the unexpanded form?

0:53 ambrosebs: dnolen: maybe not. It seems like a backdoor with some unknown implications that I haven't thought of.

0:53 dnolen: ambrosebs: well let me know if it seems useful to you - tho can't you just alter-var-root too?

0:54 ambrosebs: dnolen: yes, that's exactly what I'm doing.

0:55 dnolen: ambrosebs: I definitely think there's real benefit to not providing typed versions of deftype etc

0:56 ambrosebs: agreed.

0:56 things like `for`, `doseq` and similar will need similar treatment.

0:57 That would be a pretty cool +1 on Typed Racket if we can get that right.

0:57 dnolen: ambrosebs: huh - why would need early access to those?

0:57 seangrove: dnolen: It looks like doseq is doing much better now, map was probably the culprit

0:57 dnolen: seangrove: cool - yeah that jumped out me immediately.

0:58 seangrove: There're still some leaks, but they're much smaller and I'll look into them in the morning

0:58 Thanks, and sorry for such a pedestrian mistake

0:58 ambrosebs: Usually if there's a weird macroexpansion that includes anonymous functions, Typed Clojure isn't good enough.

0:58 .. to infer the types.

0:58 seangrove: Reporting tools in cljs are quite primitive though, makes tracking things down difficult

0:59 ambrosebs: I'll have to double check those definitions though... they seemed problematic from a glance.

0:59 dnolen: seangrove: hah, not a pedestrian mistake - everyone gets majorly burned by laziness now and then.

0:59 ambrosebs: but why not try to attack the root of the problem - inference?

1:00 ambrosebs: dnolen: sight, you're right. :-) *opens 100 page PhD*

1:00 dnolen: ambrosebs: I'm very curious as to what missing in core.logic for you to use it for this step?

1:01 ambrosebs: dnolen: Me too. There are several existing extensions to local type inference that are candidates for inclusion.

1:01 dnolen: seangrove: yep everyone is feeling the pain. like I said source mapping is incredibly close now.

1:02 ambrosebs: especially now that we have constriants - this seems pretty doable

1:02 ambrosebs: dnolen: I might try and convert the type var inference to core.logic.

1:02 It should reveal the major issues. eg. subtyping

1:09 seangrove: dnolen: We've moved all our frontend dev to cljs, and it's been great, so no worries

1:09 dnolen: seangrove: very cool!

1:09 seangrove: Rough edges, but it's critical to our infrastructure, and wonderful to work with

1:09 Hoping to be able to give back in some way soon

1:22 dnolen: ambrosebs: I'm a type noob. So is the problem w/ subtyping is that it cane make inference undecideable?

1:23 ambrosebs: dnolen: Unification based inference seems contrary to subtyping.

1:24 Hopefully the constraints help.

1:24 The last time I played with core.logic inference was before cKanren extensions, so I haven't had a chance to test it.

1:25 dnolen: ambrosebs: and by that you mean, that w/ subtyping you have a set of types that might be applicable?

1:25 and that seems weird to solve w/ unification?

1:25 ambrosebs: dnolen: yea exactly.

1:25 I don't know if it's impossible, but it's definitely weird.

1:26 dnolen: ambrosebs: gotcha, I'm willing to work out CLP(Set) if that will help you. much simpler than efficient CLP(FD) from what I can tell.

1:27 jondavidjohn: So... I'm trying to get my clojure on... and I've got this function... http://pastie.org/5426354

1:27 dnolen: (inset q {:dog :cat :bird}) stuff like that

1:27 ambrosebs: ^

1:27 ambrosebs: interesting. The other problem is that you can't get the known subtypes in general of a given Java class.

1:27 jondavidjohn: Needing someone to drop some clojure knowledge on me, tell me if I'm writing horrid code

1:28 not sure why I'm getting this exception when I try to (assoc! ...) on a transient.

1:28 dnolen: ambrosebs: yeah but there's nothing you can do about that period right?

1:28 ambrosebs: yep.

1:29 It seems like you'd need a constraint that can only be run in "one direction" that runs a `subtype?` predicate

1:29 So you might know how a known set of types in advanced.

1:30 dnolen: what do you mean by "one direction" in this case?

1:30 ambrosebs: #(subtype? % My-Type) kind of thing

1:31 dnolen: ambrosebs: by one direction you just mean "doesn't run backwards" ?

1:31 ambrosebs: basically.

1:32 dnolen: yes constraints in general aren't about running forwards or backwards.

1:32 ambrosebs: ok, got it.

1:33 dnolen: a subtype predicate could be written with predc like I showed at the Conj.

1:33 ambrosebs: was that where you added a defmethod on the fly?

1:33 dnolen: well that just for fun - but the point was that any predicate can be converted in to a constraint

1:33 in your case that's not enough tho

1:34 I assume you'll want to operate on sets

1:34 #{Nil Seqable}

1:34 ambrosebs: right

1:34 dnolen: (inset t #{Nil Seqable}) or something like that

1:34 (!=set t 'Nil) => t will now represent #{Seqable}

1:35 ambrosebs: oh cool

1:35 dnolen: (unionset newt somet othert), (diffset ...) etc

1:37 ambrosebs: yes that sounds very promising.

1:42 dnolen: ambrosebs: if you come up with an example(s) that you want to infer and provide the hooks - I'd be willing to take a closer look and see if I can at least sketch out what would be required.

1:42 tomoj: could typed clojure be used to do something like auto-derived typeclass implementations?

1:43 ambrosebs: dnolen: ok I'll send you an email for the morning.

1:43 dnolen: ambrosebs: cool

1:43 ambrosebs: tomoj: do you mean like protocol inheritance?

1:48 tomoj: I guess, yeah

1:49 ambrosebs: I don't know exactly what you mean, as in a default implementation? Why couldn't it be done with macros?

1:55 tomoj: I don't really know what I mean, either. it just looks like haskell magic

1:57 ambrosebs: tomoj: I don't know what's possible by building on top of Typed Clojure, but so far it has been about understand existing Clojure idioms.

1:57 It's basically a framework to build cooler stuff on.

2:00 jondavidjohn: Any help on this? http://pastie.org/5426354

2:01 tomoj: I guess I'm thinking just of typeclasses in general

2:01 jondavidjohn: the problem is this line `(assoc! _cards _current c)`, I'm pretty sure, I think I have a mis-understanding of transients

2:04 tomoj: typecheck the entire code and generate all the necessary multimethods? :(

2:05 ambrosebs: Ah. Haskell uses global type inference, Typed Clojure uses local type inference. So whole program analysis is not as powerful.

2:06 You basically have to be very explicit about what derives what beforehand.

2:07 tomoj: that seems maybe OK

2:08 ambrosebs: That's sorta how Clojure works anyway.

2:08 tomoj: I guess you don't need multimethods, inside (with-typeclasses ...) you could just generate the necessary function if it isn't around already

2:10 ambrosebs: to be clear: I'm talking about protocols. An implementation of type-classes using Typed Clojure would probably look that that, yes.

2:10 tomoj: ah, yeah

2:11 ambrosebs: Something very interesting is dispatching on the last argument of a type-class method.

2:11 tomoj: right

2:11 ambrosebs: I haven't investigated that, but it's come up several times.

2:43 yedi: has prismatic released any libraries yet?

5:53 abp: Raynes: Can I (ab)use refheaps code by reimplementing it as a showcase of some libs, in approximately 500 years?

5:56 strczprstskrzkrk: Chousuke, you think I'm insane right?

8:32 tgoossens: how common it put :test metadata in a funciton?

8:32 i mean. is it done a lot?

8:32 gfredericks: tgoossens: I've nearly never seen it

8:32 tgoossens: i just bumped into metadata for the first time

8:33 is it correct to interpret

8:33 metadata

8:33 as java @ tags. But now

8:33 antares_: tgoossens: :test metadata may be helpful in a REPL session, metadata in general is used quite often, e.g. to group clojure.test tests

8:33 tgoossens: can be passed on, read, used by other code

8:33 (and more)

8:33 antares_: tgoossens: yes, Java annotations often serve the same purpose

8:33 tgoossens: ok

8:33 erwagasore: I am doing koans but I have been stack for a while on the following please help

8:34 "Iteration can be used for repetition"

8:34 (= (repeat 100 :foo)

8:34 (take 100 (iterate repeat :foo))))

8:34 antares_: erwagasore: can you please link to the koan you need help with on github?

8:34 gfredericks: (iterate repeat :foo) could probably be (repeat :foo)

8:34 tgoossens: gfredericks: how do you write code? Do you write a testbench for every function. Or do you use repl and then put that into (comment.. ) or something else

8:34 gfredericks: but that doesn't illustrate the use of iterate

8:35 tgoossens: still exploring different styles

8:35 gfredericks: tgoossens: I write tests with clojure.test

8:35 so they go in a different file

8:35 tgoossens: i played around with (expect ..) from jayc

8:35 erwagasore: (= (repeat 100 :foo) (take 100 (iterate __ :foo)))

8:35 tgoossens: i like it so far

8:35 ,(= (repeat 100 :foo) (take 100 (iterate __ :foo)))

8:35 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: __ in this context, compiling:(NO_SOURCE_PATH:0)>

8:36 tgoossens: oops

8:36 gfredericks: erwagasore: identity should wwork there

8:36 you want a function that takes an item in the sequence and returns the next item

8:36 you could also use (constantly :foo)

8:36 tgoossens: gfredericks: yesterday someone here told me about https://github.com/clojure/clojure/blob/master/src/clj/clojure/zip.clj

8:36 where rich, put his repl stuff in a comment

8:36 still finding it a bit strange

8:37 (at the bottom)

8:37 gfredericks: oh I've seen that a lot

8:37 I expect it's an emaxy thing

8:37 because in emacs you can eval arbitrary bits of code

8:37 so putting them in the comment means they're generally harmless, but easy to ask emacs to eval if you want to

8:38 also the comment macro as opposed to ;; line comments means you keep the syntax highlighting and paredit features

8:38 tgoossens: yeah. but they do not test anything automatically. so

8:38 gfredericks: correct

8:38 tgoossens: if your lib is getting big this is probably just not a good idea

8:38 gfredericks: rich isn't a huge TDD fanatic

8:38 erwagasore: gfredericks what do u mean by identity?

8:38 gfredericks: erwagasore: ##(identity :foo)

8:38 lazybot: ⇒ :foo

8:38 erwagasore: I am kind of new to clojure.

8:38 tgoossens: erwagasore

8:38 cool

8:38 gfredericks: be back in 15 min

8:38 tgoossens: me too

8:38 i'll give you a video where everything will be explained

8:39 erwagasore: thanks.

8:39 tgoossens: probably a must if you are getting into clojure for the first time:

8:39 erwagasore: Cant wait.

8:39 tgoossens: In this video rich hickey (creator of clojure) will explain his ideas and opinions on how we program today.

8:39 and will try to define

8:39 identity

8:39 state, value

8:39 in a meaningful manner

8:39 very inspiring

8:39 http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

8:40 how long have you been playing around?

8:40 erwagasore: A month.

8:40 tgoossens: me two months now

8:40 i began by watching a lot of these talks

8:40 i'll give you some more

8:40 http://www.infoq.com/presentations/An-Introduction-to-Clojure-Time-Model

8:41 http://www.infoq.com/presentations/Simple-Made-Easy

8:41 erwagasore: Great.

8:41 tgoossens: if you watch these 3

8:41 you'll already have a pretty strong idea of what ideology of clojure is all about

8:42 what experience do you have by now?

8:42 (in other languages)

8:42 (and paradigms)

8:42 erwagasore: I have been using Python for 3 years

8:42 So I am kind of experienced there.

8:42 tgoossens: for me, it was java

8:43 erwagasore: How long have you been in Java land?

8:43 tgoossens: prepare for something completely different and exciting!

8:43 erwagasore: Sweeet.

8:43 tgoossens: how did you bump into clojure?

8:43 erwagasore: Where I use emacs, so.

8:44 tgoossens: i mean. where did you hear about clojure

8:45 erwagasore: You cannot avoid LISP, from there I have had an interest in their syntax, eventhough many hate the paranthesis

8:45 It didn't both then discovered Clojure.

8:45 tgoossens: cool

8:46 clojure has some extra syntax so that parantheses are now much simpler to understand

8:46 but you'll find that out very soon

8:46 mpenet: Does nyone know if autodoc can generate doc for cljs? Is there any alternative if it's not the case, as I suspect?

8:48 tgoossens: erwagasore: enjoy your exploration! feel free to hang around at the irc, you'll learn a lot from other people

8:48 erwagasore: Sure. Thanks for your support tgoossens

8:48 tgoossens: now back to studying :D

8:49 antares_: erwagasore: and if you are looking for doc guides, see http://clojure-doc.org. If you find something missing there, let me know, we are always looking to make it better for beginners.

8:51 gfredericks: okay sorta back

8:52 Foxboron: BTW, Chrome users, yesterday i learned something awsome. If you use Chrome, type ClojureDocs then tab.

8:52 gfredericks: erwagasore: you still confused about the identity function?

8:52 Foxboron: HOLY CRAP

8:52 Foxboron: I KNOW

8:53 Bergle_1: hangon its not april 1st.

8:53 Foxboron: Truth

8:54 also works on docs.python.org etc

8:54 Bergle_1: so where do you type this ?

8:54 Foxboron: Chrome, in the adressbar.

8:54 antares_: Bergle_1: in the address bar

8:54 Foxboron: Clojuredocs then tab.

8:54 Bergle_1: does nothing

8:54 * Bergle_1 is on windows 7 64 bit.

8:55 Foxboron: needs to point at clojuredocs.org

8:55 antares_: Foxboron: try visiting clojuredocs.org and search something there

8:55 Bergle_1: what needs to point at ?

8:55 gfredericks: just for fun I searched for `inc`; I still don't understand why it's so hard to get that right.

8:55 Foxboron: haha, type "clojuredocs.org" in the adressbar, then push tab instead of enter :P

8:56 antares_, yes. and?

8:56 Bergle_1: it still does nothing odd or different.

8:56 antares_: Foxboron: I believe it discovers search forms as you browse

8:56 maybe there is a threshold of how many times you need to use a search form it for Chrome to learn about it

8:56 Foxboron: possibly, i was still amazed when i discovered it :)

8:56 antares_: or it may be markup-driven

8:57 Bergle_1: Key thing, have to have visited ClojureDocs before

8:57 Foxboron: prolly looks for the search urlvar

8:57 antares_: Foxboron: I discovered it via youtube and github, but yeah, it is a very nice feature for docs

8:57 Foxboron: also Vimium, never really used it before yesterday :3

8:58 http://support.google.com/chrome/bin/answer.py?hl=en&answer=95655

8:58 antares_: Bergle_1: what it does is it prefixes the address bar with Searching ClojureDocs: and then when you enter a query and hit Enter, it sends you directly to ClojureDocs search results

8:58 Bergle_1: yeah it works now.

8:58 but i had to visit clojuredocs.org first.

8:58 at least once.

8:58 * Bergle_1 does 99% of his web stuff in firefox...

8:59 Bergle_1: chrome exists for me for google stuffs and checkvist.

9:02 Foxboron: Just shared the tip as it seems not many people really knows about them ^^

9:13 Guest96956: hello wat is the equivalent of (cons 4 5) in clojure cons in lisp creates a list cons in clojure requires to have a collection. IS there anything equivalent for this

9:14 borkdude: Guest96956 no

9:15 Guest96956 clojure doesn't have cons cells

9:15 Guest96956: borkdude: why is that , do you know why cons doesn't work as in lisp

9:15 borkdude: Guest96956 it's avoided on purpose I think, just a matter of design

9:16 Guest96956: borkdude: okay

9:17 antares_: Guest96956: there is a function called cons, though, just no cons cells: http://clojuredocs.org/clojure_core/clojure.core/cons

9:18 borkdude: ah yes, that sometimes confuses people

9:18 tufflax: Guest96956, but also check out http://clojuredocs.org/clojure_core/clojure.core/conj

9:19 borkdude: just remember: cons always adds to the front of a collection, conj adds whatever is natural for a collection to add an item (lists on the head, vectors on their ends)

9:20 Guest96956: but none of them would take two object and returns a cell

9:20 Bergle_1: hangon cons does whats natural for a collection as well. afaik.

9:20 conj is just cons with param diff order.

9:21 tufflax: Bergle_1, not really

9:21 antares_: Guest96956: if you need "a cell", use a pair: [1 2]

9:21 tufflax: cons always returns a seq I think

9:21 ,(cons 2 [1])

9:21 clojurebot: (2 1)

9:22 tufflax: ,(conj [1] 2)

9:22 clojurebot: [1 2]

9:25 Bergle_1: ok i got my wires crossed ;) tah.

9:26 Guest96956: is there a rcurry in clojure

9:26 or equivalent

9:26 * Guest96956 bordatoue

9:27 Guest96956: when i use a partial fn i want the evaluation from right hand side

9:33 antares_: Guest30953: maybe https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/fn.clj#L3 is what you are looking for?

9:34 bordatoue: anything equivalent to rcurry in clojure

10:16 Guest3464: i'm having problems with reading in parameters with ring. I'm getting a key must be integer error. Here's my code, can somebody see what's wrong? I dont see it. http://cljbin.com/paste/50b0e3d9e4b0dbc711a99f51

10:19 wink: Guest3464: could you try to import compojure.handler as something other than "handler"?

10:20 Guest3464: wink: nothing changed

10:21 wink: Guest3464: hm, sorry, looked like a namespace/import problem to me, I'm probably wrong though

10:22 Guest3464: wink: oh wait, after I restarted the server it seems to run. Not sure if it was the namespace though

10:23 andrewmcveigh: Guest3464: I find that error usually means that you're trying to call a vector ##([1 2 3] :k)

10:23 lazybot: java.lang.IllegalArgumentException: Key must be integer

10:41 tgoossens: where can i find what is new in clojure 1.5 ?

10:44 nvm

10:49 Drakeson: Is there a clojure repl (or just a clojure function) that can print the documentation for a java class?

10:51 antares_: Drakeson: http://clojuredocs.org/clojure_core/clojure.java.javadoc/javadoc

10:51 Drakeson: oops, not that one, hold on

10:53 Drakeson; actually, (javadoc 1) and (javadoc obj) is exactly what you need

10:53 just give it an object and if it is a JDK class instance, it should open a link with the docs in the browser

11:59 kevin2895: I am getting an error when running "lein check" on my app: Exception in thread "main" clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: Unsupported character: \\-

12:00 But I can't figure out where it comes from... the stack trace only shows lines from internal clojure code

12:02 antares_: kevin2895: do you have \* somewhere in your code?

12:02 like \t?

12:02 there is probably either an extra \ or you are using an escape sequence JVM does not support

12:03 kevin2895: antares_: Why would lein check show an error like this that never comes up when my app is compiled or run?

12:06 antares_: kevin2895: can you post the entire stack trace?

12:06 kevin2895: it may be something in lein check implementation

12:06 yes

12:06 (.replace \- \_)

12:07 there is double escaping going on, I assume

12:10 kevin2895: antares_: https://gist.github.com/4140537

12:10 That is the stack trace

12:10 antares_: ok, it does not reveal the offender

12:11 kevin2895: is this codebase something you can share on github, by any chance?

12:11 kevin2895: antares_: unfortunately no, it is a large codebase that is not open source

12:12 antares_: kevin2895: ok. What OS do you use?

12:12 I am trying to reproduce this on any one of my 30+ repos.

12:12 kevin2895: windows right now, but the same error happens on mac

12:20 antares_: kevin2895: I suggest that you file an issue with Leiningen and ask on the mailing list

12:21 something causes double-escaping, leiningen.check does use \-

12:21 but \- is a valid character, \\- is not

12:29 ambrosebs: I'm getting my honours dissertation back tomorrow for corrections. If anyone is sitting on some more corrections, please send them my way!

12:29 I've already uploaded the latest version.

12:32 jacobsen: ambrosebs: I'd be interested in taking a look - what is the URL?

12:33 ambrosebs: cool http://cloud.github.com/downloads/frenchy64/papers/paper.pdf

12:35 jacobsen: thanks - some friends and I were discussing your conj talk yesterday here in chicago, and looked at the slides. My friend was curious about how close to Haskel type classes your clj type system got. I'm sure your thesis will out. Thanks again!

12:37 abp: Wow. Installing the Eclipse Color Theme plugin takes forever..

12:37 ambrosebs: jacobsen: No type classes, I strictly do not introduce new structures or idioms. Very cool and often requested future work though.

12:37 jacobsen: ambrosebs: cool, thanks

12:44 brainproxy: ambrosebs: what's the best way to get started w/ Typed Clojure?

12:45 i guess I should just read your paper :D

12:45 ambrosebs: brainproxy: See the end of the introduction chapter.

12:45 Unfortunately it's probably the best way atm.

12:45 Or my conj slides.

12:45 brainproxy: cool, thanks

12:46 ambrosebs: NB: TC currently requires clojure 1.5.0-beta1

12:47 brainproxy: i implemented an optional "return type checker" in my fork of protocol-monads, but it's really primitive and I didn't reference your work, just gave it my best guess

12:47 ambrosebs: yes I saw that. Seemed pretty cool for what it offered.

12:48 brainproxy: what's the story on clojure 1.5, is it due to come out of beta soon, or is it still going to be awhile?

12:49 ambrosebs: not sure myself.

12:49 dnolen: brainproxy: I'd expect soon-ish

12:49 PudgePacket|LSD: o/

12:49 brainproxy: \o

12:50 PudgePacket|LSD: oh shit

12:50 wrong irc

12:54 brainproxy: dnolen: nice, looking forward to it

12:57 muhoo: is that a half-cheer? or hailing a cab?

12:58 o/ <--- taaxiiii!

13:12 squidz: whats the preferred way to do ajax with clojure? right now I have a basic site with Ring and Hiccup. ?

13:15 abp: squidz: You could try rpc using https://github.com/shoreleave/shoreleave-remote-ring on ClojureScript.

13:16 squidz: abp: thanks ill look into it

13:17 is the noir version pretty standard?

13:24 ambrosebs: dnolen: working on a little Typed CLJS example, basically #(if % (%) false) with type [(U nil boolean) -> boolean].

13:24 Will finish tomorrow or the day after :)

13:24 whoops [(U nil [boolean -> boolean]) -> boolean]

13:26 was hoping to get a protocol example but it took more work than I expected to port the basics.

13:41 octagon: is there a reason why in clojurescript Function has not been extended to satisfy the IWithMeta protocol?

13:42 does that cause problems somehow?

13:44 dnolen: octagon: that's fixed in master

13:45 octagon: dnolen: awesome thanks!

13:47 dnolen: how would you recommend i add clojurescript as a dependency to my leiningen project so as to get a current version?

13:48 dnolen: octagon: lein-cljsbuild currently dictates a version, hopefully it can stop doing that and you can just specify the version need in the future.

13:49 octagon: dnolen: i'm not using lein-cljsbuild actually, i'm calling the compiler from within my own plugin

13:49 dnolen: octagon: then you can get the version in the usual way

13:49 octagon: i'm currently specifying [org.clojure/clojurescript "0.0-1450"], but i am not sure how to find which versions are available

13:50 dnolen: octagon: if you want to use master - clone into your repo and add the src directories to your classpath

13:50 octagon: dnolen: if i do that then my jar that i distribute on clojars will contain the cljs compiler, yes?

13:51 if so would that cause problems if someone depends on lein-cljsbuild, for example, in their project, too?

13:51 dnolen: octagon: probably - so just wait for the next release.

13:51 octagon: lein-cljsbuild is a plugin - not a direct depedency so I'm not sure if that's problem.

13:52 https://oss.sonatype.org/index.html#nexus-search;quick~clojurescript

13:52 octagon: dnolen: cool thanks. i think i'll work with master in dev and wait for the next release to push the new stuff

13:53 dnolen: awesome, i didn't know about that, that's exactly what i needed

14:19 tgoossens: is the use of monads in clojure not more difficult because it is dynamically typed?

14:25 antares_: tgoossens: static vs dynamic typing makes no difference for monads

14:29 tgoossens: antares_:just wondering. It has only been a few hours i first read and heard about monads :p

14:37 gfredericks: well I can imagine having a harder time debugging monads without the compiler barking about specific type mismatches

14:37 antares_: gfredericks: that's not specific to monads, though

14:38 gfredericks: not that the type mismatches in haskell are easy to understand; but it's at least something concrete compared to however a similar runtime error would manifest itself in clojure

14:38 antares_: sure but you said "makes no difference"

14:38 and he was asking about difficulty

14:38 antares_: well, ok, fair enough

14:38 borkdude: of course it makes a difference

14:38 but in clojure you usually can avoid monads ;)

14:39 abp: Hm, can I reduce with recur or something like that?

14:39 gfredericks: abp: instead of with reduce?

14:40 abp: gfredericks: Yes. I just don't know how to flatten my structures, probably.

14:44 gfredericks: abp: I think that question could do with some example data :)

14:45 abp: gfredericks: Uhm, yea, but that's what makes me hesitate to ask. It's a dependency graph and making up an example would need some work.

14:47 gfredericks: my only thought without anything more concrete is that there's a 20% chance mapcat will do what you want?

14:47 but I really can't say

14:48 * gfredericks stops being around

14:48 abp: gfredericks: I think I'll try to get a working loop/recur-version, often reduce sits in complex loop/recurs and smiles at me.

14:49 gfredericks: Thanks so far.

15:04 firesofmay: Hey can anyone tell me, are ring middlewares similar to mediawiki extensions? extending the functionality of the site. In a way. Am I correct here?

15:05 weavejester: firesofmay: Yes… But they extend the functionality of the whole app. They're not like widgets you can add to a page.

15:05 firesofmay: More formally, they're functions that change a handler into another handler.

15:06 firesofmay: weavejester, okay.

15:07 borkdude: firesofmay if you're familiar with the filter or pipe pattern in OO, it's kind of like that I guess

15:07 firesofmay: weavejester, so mediawiki extensions are widgets? I thought they extend the functionality of the website in itself. No?

15:07 borkdude, okay.

15:08 tmciver: borkdude: I might say it's more similar to the Decorator pattern, yes?

15:09 weavejester: firesofmay: I have no idea what mediawikis extensions are, aside from the obvious :)

15:09 firesofmay: weavejester, :) cool

15:09 borkdude: tmciver that might be a better analogy

15:09 yedi: match is super cool

15:11 borkdude: tmciver maybe those patterns are essentially the same thing, now that I'm thinking about it?

15:13 tmciver: borkdude: perhaps, I'm more familiar with decorator than pipe. I think Filter and Decorator are similar.

15:13 * tmciver checks GoF

15:14 tmciver: That explains it: no filter or pipe pattern in GoF.

15:15 borkdude: tmciver http://stackoverflow.com/a/747975/6264

15:17 iosica: hey guys a quick question about vars and symbols

15:17 say s is a symbol for a var to a fn

15:17 how do I get execute that function?

15:18 borkdude: (s)

15:18 or (s args) if it has args

15:18 iosica: s (`identity)

15:18 how do I execute s now?

15:18 borkdude: ,(let [s (fn [x] (inc x))] (s 1))

15:18 clojurebot: 2

15:19 Scriptor: what are you trying to set s in that?

15:19 the identity function?

15:19 iosica: I'm sending s over the wire

15:19 on the other side I have the symbol for the function

15:20 borkdude: (defn my-fun [s] (s)) ;; like this?

15:21 iosica: not exactly, thinking for a good example

15:22 (s) appears to be the right way but on the other side s returns nil

15:22 this is how I got it to work

15:22 ((clojure.lang.RT/var (namespace s) (name s)))

15:22 but this is too weird

15:24 identity function is just an example

15:25 borkdude: sorry, gtg

15:26 iosica: this is how I got it to work in java

15:26 public final class GenericMapFn extends MapFn<Object, Object> {

15:26 private final Symbol fnSymbol;

15:26 private transient IFn fn;

15:26 public GenericMapFn(Symbol fnSymbol) {

15:26 this.fnSymbol = fnSymbol;

15:26 }

15:26 @Override

15:26 public void initialize() {

15:26 fn = RT.var(fnSymbol.getNamespace(), fnSymbol.getName());

15:26 }

15:26 @Override

15:26 public Object map(Object input) {

15:26 return fn.invoke(input);

15:27 }

15:27 Scriptor: ,pastebin

15:27 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pastebin in this context, compiling:(NO_SOURCE_PATH:0)>

15:28 iosica: https://gist.github.com/4141292

15:28 Scriptor: gah, anyway, it'd help to use something like https://www.refheap.com/paste for code snippets like that

15:28 :)

15:28 iosica: created a gist

15:28 sorry still new to irc

15:28 yedi: in core.logic, why can't constrains be any predicate function that returns a boolean?

15:33 MahNiggard: Chousuke suomalainen, miks sä et rakasta mua enää

15:34 Mä olen kissa jolla on pyörät, sun rakkaukseni on pakko olla minun, homo.

15:34 Scriptor: ops?

15:40 brainproxy: what are my options if I essentially want defrecord, but I need to override clojure.lang.IHashEq

16:36 xeqi: is there a library for interacting with http://jejacks0n.github.com/mercury/ ?

17:06 Frozenlock: &(class (make-array Byte/TYPE 0))

17:06 lazybot: ⇒ [B

17:07 Frozenlock: Is there a class I could use that matches everything made with 'make-array' or 'into-array'?

17:08 seangrove: dnolen: Are there any instructions on using a custom-compiled goog-closure.jar with lein-cljsbuild? I can't seem to find any, and there are a \

17:08 ... a few bugs with the version included in the current lein-cljsbuild

17:11 lynaghk: ping: hugod

17:18 replaca: bn m ji]'l;;i~y6~ugggt576v7mbnbn b c,c,c,c

17:18 =

17:23 zerokarmaleft: i'm wrapping a macro that calls defn in a let/doseq and no vars appear to be getting bound: https://gist.github.com/4141616

17:23 is there something i'm missing?

17:28 bbloom: i really wish cljs had eval :-/

17:59 seangrove: The Closure library is pretty gnarled in a few places... good code, but not particularly well documented from a high-level point of view

18:31 Ploiq: seangrove, give me a library that isn't, and I give you a Finn that doesn't eat reindeer

18:45 zii-prime: question: would there be any run-time disadvantage to changing the implementation so as to auto-require clojure.set when you say clojure.set/intersection and it doesn't resolve?

18:45 bbloom: zii-prime: yes, this has been discussed before… let me find you the details

18:46 zii-prime: http://dev.clojure.org/jira/browse/CLJ-461 see Rich's comment at the bottom

18:47 cgag: Anyone know the state of clojure for android? I think last I heard it was useable but had a really large startup time, but that was quite a while ago

18:48 zii-prime: bbloom: but... calling a function in a module can have arbitrary side-effects. How is loading so dangerous?

18:49 bbloom: zii-prime: most clojure code avoids side effects, documenting them when they exist. implicit loading would cause the transitive closure of dependencies to be implicitly loading… which can have a wide variety of global state side effects

18:50 zii-prime: violates http://en.wikipedia.org/wiki/Principle_of_least_astonishment

18:50 zii-prime: plus, if you already have a qualified symbol, ie clojure.set/intersection, it's trivially to (require clojure.set)

18:51 zii-prime: bbloom: this is only true when using good code, and, using good code, loading namespaces won't do anything evil. / yes, true; it's also trivial to say BufferedImage bi = new BufferedImage(BufferedImage.SOMETHING_I_FORGOT); in java

18:52 wingy: i finally get why rick hickey is not that fond of testing

18:52 bbloom: zii-prime: this sort of thing is already a problem in java. there was a guy in here a week or two ago who was getting a strange error that made no sense. we tracked it down to a little static initializer that was attempting to log something, but he didn't have a logger configure

18:53 zii-prime: clojure is trying to avoid exacerbating problems like that

18:53 wingy: i don't think "not fond of testing" is the right way to describe it…. more like not fond of TDD

18:55 Urthwhyte: Is there someplace I can read about his thoughts on that?

18:56 bbloom: Urthwhyte: http://www.codequarterly.com/2011/rich-hickey/

18:56 Urthwhyte: search "TDD"

18:56 wingy: bbloom: if i may .. i think that FP reflects the nature's way of thinking .. that we are living in a big digital system that someone (God as a super programmer?) created .. and this world seems quite bug free .. we don't freeze all of the sudden .. the best way to create the bug free digital system is to simulate this universe .. i don't think God is running the code for this world through a test suite .. everything is just live

18:56 Urthwhyte: bbloom: cheers!

18:56 wingy: just some thoughts i have recently :)

18:57 bottom line .. i deleted all my tests .. everything is live .. they work if they work .. if they don't i correct them in the test production

18:57 zii-prime: bbloom: are people really bad enough to do nasty things in namespaces as they load but good enough to explicitly point out all side effects?

18:58 bbloom: zii-prime: it's not a matter of good or bad, it's the matter of the top level operations in a module being inherently side effectual. def, for example, mutates the global collection of vars

18:59 zii-prime: bbloom: and... that needs to occur at predictable times? That's like the antithesis of "laziness is a good idea".

19:00 bbloom: zii-prime: laziness introduces significant complexity. for example, it doesn't play well with dynamic bindings. after many languages have included and studied laziness, clojure made the decision that it was worth the cost/benefit trade off

19:00 zii-prime: the default is to not add features. the benefits to auto namespace loading are small. you can easily work around the lack of such a feature. adding it adds complexity

19:01 zii-prime: the trade off is either A) not well understood or B) deemed not worthwhile. in either case, features don't get added to clojure to minimize complexity

19:02 zii-prime: and with laziness in particular, side effects are a huuuge problem

19:02 zii-prime: bbloom: i could see that, but i really don't see the complexity. like, are defs overwriting other defs normally?

19:02 bbloom: zii-prime: module loading is side-effectualy. lazy module loading seems like a bad idea to me on those grounds

19:03 zii-prime: not usually, but lots of people (set! *warn-on-reflection* true) and other compile time configuration

19:04 zii-prime: bbloom: =/

19:04 bbloom: zii-prime: ?

19:05 zii-prime: bbloom: at least there's some reason for the way it is =/

19:05 Urthwhyte: bbloom: that was a great read, thanks for the link

19:05 zii-prime: bbloom: still don't like it, tho

19:07 bbloom: zii-prime: personally, i really like it. i quite enjoy having all of the dependencies for a file listed at top. as somebody who has written *a lot* of ruby code that has ZERO require statements and auto code loading, i can tell you that it's convenient now and nightmarish when you want to refactor

19:08 zii-prime: bbloom: that sounds extreme . elaborate?

19:08 bbloom: zii-prime: Rails automatically requires modules by overloading Kernel.const_missing

19:09 zii-prime: if you have a User class and another file tries to reference User, it will convert that to the string "user.rb" and then start searching auto_load_path until it finds "modules/user.rb" and then require that

19:11 zii-prime: so much badness happens, it's absurd… one time, I tried I had a thing called UserBucket and all was fine. Then I moved some totally unrelated code and that UserBucket thing stopped working. turns out I was causing the load order of my AWS S3 library to be delayed a tad, so it got put on the auto require path later, there was already a UserBucket type or it was even generating XXXXBucket constants programatically.

19:11 zii-prime: it was insane. took me HOURS to debug

19:11 zii-prime: and then additional hours to manually re-arrange the load order to fix it

19:12 zii-prime: laziness and side effects just don't play nice. it's a law of the universe as far as i'm concerned

19:12 zii-prime: minus an explicit dependency graph. which, it turns out, we have: at the top of each file in the ns form :-)

19:19 zii-prime: new question: would merging false and nil (getting rid of false) be desirable, and what are the obstacles to doing it? I'd think "yes" and "interfacing with false-using code, confusion".

19:19 tos9: what would be the benefit

19:20 Urthwhyte: nil and false are semantically different

19:22 zii-prime: benefit: never have to worry about whether you want to do (if object ...) or (if (nil? object) ...) and such confusions. It's even worse in javascript.

19:23 tomoj: never have to worry about it until you need it

19:23 zii-prime: it's so easy to have a bug where you do (if object ...) but meant (if (nil? object) ...), and it breaks flow having to think about it

19:24 Urthwhyte: Say you had a voting application

19:24 tomoj: if you only have false, (= __ ({0 false} 1))

19:25 Urthwhyte: {:option1 nil :option2 false :option3 true} is different than {:option1 false :option2 false :option3 true}

19:26 zii-prime: so if you want to do a trilean, do an enum (clojure version: keyword)

19:26 Urthwhyte: I also imagine there are JVM related reasons for not doing so

19:27 zii-prime: no. there are not.

19:27 tomoj: (if :false true) :/

19:28 I think I'd just end up creating something an awful lot like nil on my own

19:29 except it would be truthy

19:29 Urthwhyte: I can't understand the rationale behind removing something with extremely low impact on cognitive load

19:29 zii-prime: well, yes. you could rephrase this as "make false truthy"

19:29 bbloom: zii-prime: many predecessor lisps has studied the false / nil / '() distinctions deeply

19:30 zii-prime: search the web for "nil punning"

19:31 zii-prime: bbloom: yes, i've read all about that . common lisp actually does a combination of this and making nil act as a seq. which it kinda does in clojure.

19:31 tomoj: so you want to leave nil, but (true? (if false true)) ?

19:32 bbloom: zii-prime: clojure provides the seq function, which will convert empty sequences to nil; this forces you to opt into nil punning

19:32 zii-prime: true, false, nil, and '() all being different things… on purpose

19:33 zii-prime: bbloom: right. yes. but what is the purpose aside from interoperability? tomoj: yes

19:33 bbloom: zii-prime: interoperability has practically zero to do with it. in fact, it doesn't even interop well….

19:33 ,Boolean/FALSE

19:33 clojurebot: false

19:34 bbloom: ,(= false Boolean/FALSE)

19:34 clojurebot: true

19:34 bbloom: ,(Boolean. "false")

19:34 clojurebot: false

19:34 bbloom: ,(= false (Boolean. "false"))

19:34 clojurebot: true

19:34 bbloom: hmmm...

19:34 seems slightly better than i recall :-)

19:35 oh, duh, i meant:

19:35 zii-prime: ,(identical? Boolean/FALSE (Boolean. "false"))

19:35 clojurebot: false

19:35 tomoj: &(false? (Boolean. false))

19:35 lazybot: ⇒ false

19:35 bbloom: ,(if Boolean/FALSE :t :f)

19:35 clojurebot: :f

19:35 bbloom: vs:

19:35 ,(if (Boolean. "false") :t :f)

19:35 clojurebot: :t

19:35 bbloom: yeah, that was it :-P

19:35 zii-prime: oh thank goodness

19:36 bbloom: thanks tomoj

19:36 anyway, interop isn't the reason...

19:36 zii-prime: bbloom: interoperability with java code using true and false objects, i meant

19:37 bbloom: zii-prime: well, they are convenient for that purpose, but nil, false, and '() really are DIFFERENT THINGS. being able to tell them apart is important

19:39 zii-prime: bbloom: yes. they are different. and they should exist. but why should false be falsy?

19:39 bbloom: zii-prime: …. because it's FALSE

19:39 zii-prime: isn't that practically the definition of "falsy"?

19:39 tomoj: why should false be nilly?

19:39 bbloom: lol

19:39 this conversation really isn't productive at all....

19:40 zii-prime: are you trying to learn? or are you trying to influence clojure to change? or are you just trying to entertain yourself?

19:40 zii-prime: bbloom: (defmacro if [test a b] `(if (nil? test) a b))

19:40 Urthwhyte: Well, the entire conversation is predicated on a fundamental disagreement about whether false is different than nil

19:40 tomoj: the idea would be that (if x ..) only checks to see if x is nil, and predicates return true or nil, I guess?

19:41 zii-prime: bbloom: learn, really. either i learn to express why false shouldn't be falsy, or i learn that it should be. and i am confufrustrated!

19:41 bbloom: also, it will determine whether i code with false myself

19:42 bbloom: zii-prime: idiomatic clojure code uses false

19:42 zii-prime: I suggest you continue on using it and then once you have more experience working with both false and nil as separate entities, i suspect the benefits will be clear

19:42 zii-prime: bbloom: strictly following idioms means stagnation

19:42 bbloom: zii-prime: you're unlikely to be convinced in irc of this

19:42 tomoj: not really clear to me :(

19:43 bbloom: zii-prime: yes, lisps were strictly following the nil punning idiom, so clojure moved on from that :-P

19:43 tomoj: saves you from typing (if (true? bool) ..) but no big deal

19:43 zii-prime: bbloom: they are separate; i'm not questioning that! false is useful. but should it be FALSY??

19:43 lazybot: zii-prime: Definitely not.

19:43 bbloom: lol lazybot.

19:43 zii-prime: lazybot: whyyy

19:44 bbloom: zii-prime: lazybot is a bot...

19:44 zii-prime: bbloom: whyyy

19:44 tomoj: (get m k) can still return nil if not found

19:45 zii-prime: tomoj: i started out by saying that false should be gotten rid of. that was stupid. i'm trying to talk about its falsyness

19:45 tomoj: yeah

19:45 (if (true? (get m k)) ...) would work fine

19:46 (if (get m k)) tells you whether the key is not in m or nil in m

19:46 zii-prime: no, it doesn't

19:46 it tells you if the key is not in m, or is nil in m, or is false in m

19:46 holo: hi

19:46 zii-prime: i'm proposing it telling you if the key is not in m, or is nil in m

19:46 tomoj: I'm talking about your proposal

19:47 zii-prime: bbloom: like, it sounds like arguments for false being falsy (that is, (= :f (if false :t :f)) ) are pretty similar to arguments for '() being falsy or even "" being falsy

19:47 tomoj: ohskay

19:48 tomoj: keep seems sort of a concession

19:48 metellus: zii-prime: so are you suggesting that (if false a b) should return a?

19:48 tomoj: this one spot in clojure.core weirdly has the semantics you want :)

19:48 zii-prime: metellus: yes, similar to (if '() a b) returns a

19:50 holo: i have a cyclic dependency exception [ /app/server ]->/app/db->/app/models/user->/app/views/user->[ /app/server ]. i'm sure /app/server is not requiring /app/db as it was before. i already cleaned everything with lein clean. shouldn't i do some manual cleansing?

19:50 bbloom: zii-prime: if anything, nil shouldn't be falsy… it's just too damn convenient not to be

19:50 zii-prime: it's a matter of what people expect and what doesn't complicate it too much

19:51 zii-prime: this is something that is never gonna change in clojure. it would break EVERYBODY. so i propose that you can go study this with a toy lisp, and publish your findings :-)

19:51 tomoj: I think I'm tentatively convinced, nilliness > falsiness. but, what bbloom said, and I don't care much

19:54 zii-prime: honestly, this is in my list of "things that *really* aren't important"

19:55 it just... makes me feel bad inside every time i have to think about the fact that we're using two falsy values? and it's confufrustrating =(

19:56 tomoj: false is the only falsey value which can be a datomic value

19:57 zii-prime: and when i use if, and not if nil?, to ask if something is nil when i know it won't be false

19:57 tomoj: I guess that might seem to make a lot of sense given the names :)

19:57 zii-prime: datomic?

19:59 tomoj: datomic?

19:59 tomoj: a db, try google

19:59 (fn has-attr? [db e attr] (not (false? ((d/entity db e) attr)))) :/

20:00 er

20:00 (fn has-attr? [db e attr] (not (nil? ((d/entity db e) attr))))

20:01 oh that's silly ofc

20:01 since [?e ?attr _] already does that

20:07 zii-prime: bbloom: yeah, trying to get other people to do it certainly won't work; so... what are the technical problems with doing it within a particular piece of code (such as: a library)? i can think of "when other code passes me false, sometimes it means falsy and sometimes it means false"

20:33 nightfly_: Is there an easy equilivent-to/way-to-run `lein test` available from with a repl spawned by lein?

20:42 iosica: guys I've tried several things but still can't make this work

20:42 I have a func in a test.namespace

20:42 (defn interesting-fn [] nil)

20:43 I have the name of the func and the name of namespace as 2 strings

20:43 "test.namespace" and "interesting-fn" how do I obtain the var

20:43 so I can execute this function?

20:44 tomoj: &((resolve (symbol "clojure.core" "+")) 1 2 3)

20:44 lazybot: java.lang.SecurityException: You tripped the alarm! resolve is bad!

20:45 iosica: resolve, intersting

20:45 thx let me try this

20:47 nice, why is resolve bad?

20:47 jblomo: lynaghk: got a minute for c2 questions?

21:00 \xDE\xAD\xC0\xDE: whats the ability called in clojure that lets me (defn foo ([x] x) ([x y] (+ x y)))

21:01 multiple arity functions?

21:01 Bergle_1: that seems like a decen tname for it.

21:02 not ssure its the common name for it..

21:02 book ive got calls it 'creating a function with variable arity'

21:16 holo: Bergle_1, isn't & args also variable arity? . in the other case, different expressions are called for different arities

21:57 tomoj: I want a leiningen option that will turn on warnings on any unrecognized options in project.clj

21:58 then if I forget it's :jvm-opts, I'll know before I start cranking on a bunch of data and have to start over

21:59 bbloom: tomoj: maybe head on over to #leiningen and tell them that? :-)

22:00 tomoj: I'll just comment on my :{jvm,java}-opts issue

22:04 a new keyboard is on the way, but right now when I need to C-u I type M-x universal-argument (I bound <Multi_key> <p> to "u" but that doesn't work with control)

22:04 so every time I have to manually fix paredit's wreckage, I really notice

22:05 not all that rare..

22:22 should LazySeq implement IDeref?

22:22 if so, should other ISeqs? should nil?

22:29 bbloom: tomoj: no

22:30 tomoj: deref is used when you you have an explicit separation between an identity and a value

22:30 tomoj: lazyseqs are values, they just happen to have delayed execution semantics

22:32 wingy: do you put the arg list after or under the fn name

22:32 ?

22:36 tomoj: bbloom: indeed

22:36 begging the question

22:37 is a (promise) a value?

22:38 bbloom: tomoj: i would think not

22:38 tomoj: it has state

22:38 tomoj: realized or not?

22:38 bbloom: and success/failure

22:39 tomoj: seq'ing a lazy-seq can throw an exception as well

22:39 realized or not.. :/

22:39 bbloom: but if a lazy seq fails, it's a bug

22:40 gfredericks: how does seq'ing a realized lazy-seq throw an exception?

22:40 bbloom: if a promise fails, you can come up with a retry policy

22:40 tomoj: that's OK

22:40 that promise itself is permanently failed

22:40 you just have a different promise which catches its exception

22:40 you might do the same with lazy seqs, no?

22:41 if you don't call realized?, then a promise seems to have very good value semantics

22:42 bbloom: tomoj: the distinction is that a promise offers you an interface

22:42 tomoj: where as a lazy seq is an optimization really

22:43 the interface you're offered is one of a sequence

22:43 tomoj: yeah

22:43 bbloom: you could say ok well a default sequence is just always realized

22:43 and i'd argue that might even be a useful thing to do

22:44 promises exist as a way to OPT IN to identity semantics for a computation

22:44 values are nice to work with, identities are slightly more problematic

22:44 so you should only use an identity, which requires dereferencing, when you need the semantics of one

22:44 tomoj: yes

22:44 bbloom: again, different things on purpose :-)

22:45 tomoj: the problem is if you turn the arrows the other way around, you can't just have seq hide the IDeref anymore

22:45 by "turn the arrows" I mean e.g. use something like cljque

22:46 bbloom: reactive programming is still an open research area :-)

22:46 if you look at .net's Rx, you'll see issues of state creeping in

22:46 in particular, IDisposable

22:46 tomoj: yep

22:46 bbloom: the value of values and all that

22:47 tomoj: IObservable is already terrible

22:49 IDisposable is like C-c C-c

22:49 or could be, I think

22:49 seangrove: Anyone using Datomic at all? I'm using it for a side-projet, and it keeps getting killed on the server

22:52 tomoj: anyone?

22:52 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

22:53 tomoj: I mean, what, it just dies with no output?

22:53 the free transactor?

22:53 seangrove: Yeah, free transactor - I asked that way because I haven't seen anyone using it in here

22:54 tomoj: so you start it up, it prints nothing, and dies?

22:54 seangrove: It runs for awhile, but under a tiny bit of load, dies with: bin/transactor: line 31: 18060 Killed java -server $XMX $XMS $JAVA_ARGS $DATOMIC_JAVA_OPTS clojure.main --main datomic.launcher "$@"

22:54 tomoj: ah

22:54 odd..

22:54 you aren't running out of memory? :)

22:54 seangrove: Haha, presumably, I'm re-tweaking the vps now to test that hypo :)

22:54 tomoj: hmm

22:55 seangrove: Let me run it again with some more memory and test it

22:55 Really not sure of the expected environment for datomic to run properly

22:55 tomoj: does that message rule out datomic killing itself?

22:55 I know the transactor dies if it has a lot of trouble performing a transaction

22:56 hughfdjackson: :D so, the almost inevitable follow up Q to 'what should be the first clojure book i read?'

22:56 what should the second one (after 'programming clojure') be?

22:58 seangrove: tomoj: Seems like it's doing better with more memory. Suppose I expected warning in the log file or something...

22:58 tomoj: the weird thing about cljque is that you can have non-local errors - you pass out a promise and anyone can fail it. if that API is not public, or is wrapped in a similar way as LazySeq/delay, I think some problems go away

22:58 seangrove: dunno.. check the Xmx?

22:59 disposal is still weird

22:59 yxz97: Good Evening

23:00 seangrove: tomoj: cljque does look pretty interesting

23:01 yxz97: Hi I wanna ask a silly questions guys..

23:03 gfredericks: well by all means just sit there and deliberate about whether or not you're going to ask it

23:03 lynaghk: jblomo: you still around?

23:05 yxz97: my question is not technical

23:05 I'm wondering is there is any market for developers wanting to learn clojure..

23:07 Foxboron: I doubt it would work in the long run.

23:07 yxz97: I mean, learning a new programming language is not cheap, and we deserve very well paid jobs when we do our jobs, many people I know they just do what they do by the money, which is great, we have families, goals, etc, but also some of us just do not blend, at least so quick by the market..

23:07 Foxboron: Like, it would be better learning away concepts about functional programming or LISP in general.

23:07 yxz97, is there a marked for devs wanting to learn JavaScript? Java? C#? Python? etc?

23:08 ( actually dont know so asking :P)

23:09 yxz97: Well, not sure if I use the word market for you to understand but for me is like when there are very clear needs in the market for Java enterprise developers for example or JavaScript front end developers...

23:09 you know what I mean?

23:09 tomoj: going to have some trouble finding freelance jobs or jobs at old and/or inflexible companies I think

23:10 Foxboron: yxz97, ah. THen i missunderstod your use of the word :)

23:10 yxz97: I have to say I'm from Costa Rica, and most of the jobs are just Java, C#, or PHP the most updated languages .. there are some in C, C++, Power Builder, etc...

23:10 No problem :)

23:10 Foxboron: then i think your chances are slim :P

23:11 bbloom: yxz97: along the axis of "hiring for a language X skill", i'd argue there are three buckets: 1) we're hiring X developers. 2) we're hiring developers, but can't afford to have somebody learn X on the job and 3) we're hiring developers

23:11 clojure is not a language for companies in bucket 2

23:13 yxz97: I think the way goes to learn Scala..

23:13 I could be wrong, but for instance, I saw a free course given by standford university to learn Scala and why they did not do it for Clojure?

23:13 Scala is used by Twitter (before Ruby..)

23:14 Any know bug project using Clojure?

23:14 s/bug/big

23:15 tufflax: yxz97, about the Stanford course: I don't know, but don't read too much into it

23:15 bbloom: yxz97: big projects using clojure is a question for google. you'll find plenty of companies using it

23:16 yxz97: Yeah that guys pursue given free lessons for different technolgies which are most demanded currently by the market .. as iPhone IOS development .. :S

23:16 bbloom: yeah you are right...

23:16 bbloom: yxz97: universities live in markets, but aren't as beholden to market forces as you might imagine

23:16 jblomo: lynaghk: back :)

23:17 bbloom: yxz97: maybe somebody at that university just happened to like scala

23:17 yxz97: like tufflax said, don't read too much into it

23:17 spaceships: bbloom: i believe the guy who wrote scala is teaching it

23:17 bbloom: mystery solved.

23:17 :-P

23:17 yxz97: Yeah I remember yes he was the teacher!

23:17 :P

23:18 lynaghk: jblomo: I'm cooking at the moment, but if you have any C2 questions, shoot = )

23:19 yxz97: ok, I been programming imperative code quit some time, java, php, ... and I wanted to learn another way of thinking, but at the same time make profit on it!

23:19 lynaghk: jblomo: Thanks for the histogram layout, by the way. I have been working mostly on C2PO for the past few weeks, so I've left C2 idle, unfortunately.

23:19 jblomo: lynaghk: excellent. I think I've got it working now

23:19 bbloom: yxz97: learning functional programming will make you a better java/php developer which you can make a profit from

23:19 jblomo: I don't know why I needed the :forced-uupdate? true for unify

23:20 yxz97: bbloom: why better programmer?

23:21 jblomo: lynaghk: np regarding histogram, it was nice to learn. what's the long term plan for c2 vs c2po?

23:21 bbloom: yxz97: again, this is a better question for google

23:22 yxz97: http://www.cse.chalmers.se/~rjmh/Papers/whyfp.html

23:22 tomoj: mapM :: (a -> Deref b) -> Seq a -> Deref (Seq b). that's mapcat where f returns lazy seqs, if you make seq a synonym of deref. but asynchronous seqs are also Traversable, they just have Defer instead of Deref — and on the jvm Defers are also Derefs, so they can play as Seq there too. if you theoretically made seq a synonym for deref in clojure.core (not really ready to say I'm proposing that..), the same code would work on all of them

23:22 (on the jvm). if you parameterize by execution policy, the same code will (I think) work for e.g. an asynchronous mapcat, and maybe for asynchronous reducers

23:22 wow that was a lot

23:23 lynaghk: jblomo: c2po is a grammar of graphics built on top of c2 (and several other rendering outputs---e.g., canvas/bitmap) in addition to C2's DOM-based rendering.

23:24 bbloom: i keep seeng jblomo and my brain is parsing it as my handle bbloom :-/

23:24 yxz97: I just read this page past hour: http://www.paulgraham.com/avg.html talks about functional programming and our mind focused ... nice article ;)

23:26 yedi: if you can rebind the same variable multiple times in a let block

23:26 lynaghk: jblomo: It's still an open question where full-on layouts (e.g., treemaps) fit into both C2's low-level mapping and C2PO's grammar. My gut instinct is to put it as a third transform after groupings and stats.

23:26 yedi: couldn't you feasibly write mutable code that way

23:27 bbloom: yedi: no. bindings are lexical:

23:27 lynaghk: jblomo: which is the approach that D3 takes. The layouts (like your histogram) transform the raw dataset into something that can be then directly mapped to the DOM.

23:27 bbloom: ,(let [x 1] (let [x 2] x) x)

23:27 clojurebot: 1

23:27 lynaghk: jblomo: are you coming up for Clojure/west in March, by the way?

23:28 bbloom: yedi: it's effectively "single static assignment"

23:28 jblomo: lynaghk: OK, sounds good. I want to make sure I'm learning something that's not already deprecated :)

23:29 lynaghk: clojure/west is not in the cards, still can't justify trip since job is not using it yet

23:29 portland?

23:29 yedi: ,(let [x 2, y 3, x (+ x y), y (+ x y)] [x y])

23:29 clojurebot: [5 8]

23:29 lynaghk: jblomo: nah, definitely not. C2PO fills a separate space than C2. To be honest, I don't really like thinking of C2 as a thing---really you're just learning Clojure + the DOM/CSS.

23:29 jblomo: maybe i can submit a talk

23:29 lynaghk: jblomo: yep. Magical land of beer + food carts + coffee + bouldering.

23:30 jblomo: just saying. = )

23:30 jblomo: well, c2 wraps up bind!, unify. seems like those should go together

23:31 and... uh.. coffee hiccup.. forget what you called it :)

23:31 octagon: hi, if i define two protocols, IFoo and IBar, and both have a method -doit, how would clojure know to call the correct one?

23:31 lynaghk: jblomo: singult. Yeah, C2's bind macro uses all of that under the hood.

23:31 jblomo: lynaghk: ah yea, my main question: why do i need force-update? true for unify?

23:32 does that force a recursive comparison?

23:32 yedi: bbloom: it's like you can write imperative code inside the let block

23:32 bbloom: yedi: not really. consider conditional execution: if and loop

23:32 lynaghk: jblomo: you would only use that if your mapping fn is a closure---i.e. it encloses some piece of mutable state that is not part of the data you're passing to unify

23:33 jblomo: by default unify is lazy, and will only touch DOM nodes for which the corresponding data has changed.

23:34 jblomo: ahhh, looks at the data

23:34 yedi: bbloom: ah

23:37 lynaghk: jblomo: yeah. D3 has the same semantics, but as far as I know there so no way to force updating of nodes. If you're wary of that option you should just merge all of the mutable state into the seq that is passed in as "data". Typically for us this is the dimension "is-selected-item?"

23:38 jblomo: yea, the mapping needs access to the whole dataset, not one item at a time

23:39 i was thinking of passing it as (unify [[data]] ...) seemed ugly though

23:39 [[@data]] i guess

23:40 lynaghk: jblomo: can you talk about your specific data set?

23:42 seangrove: lynaghk: C2 is awesome, thank you for it

23:42 lynaghk: seangrove: thanks!

23:43 seangrove: I never get any github issues about it, so I've never been sure if no one uses it or if it just works =P

23:43 jblomo: let me get the code cleaned up and i'll share

23:43 seangrove: i'm interested to know what you've used it for

23:49 abp: lynaghk: I built a data-bound table with C2. Was a litttle incovenient to have to render a row per unify because I got multiple header and separator rows, so I needed to include those in my data.

23:51 lynaghk: abp: I don't know when you used it, but a month or two ago the "bind!" macro landed and you can put bindings directly within hiccup

23:51 jblomo: does anyone have a better way of cljs debugging than calling cljs.core.str() on the object you'd like to inspect?

23:51 lynaghk: abp: e.g. (bind! [:table [:thead ...] [:tbody (unify dataset-1 row-template-fn-1)]])

23:52 jblomo: (:use-macros [c2.utils :only [pp]]) brings in a macro that prn-strs your object and prints to the console

23:52 jblomo: but all-in-all the cljs debugging/profiling situation is pretty poor at the moment.

23:53 jblomo: then i use c2.util.pp(blah)?

23:54 lynaghk: jblomo: yeah

23:54 er, (pp blah)

23:59 abp: Damned router, stays connected the whole night, while no one uses it and as soon as I use the net, it collapses. :x

Logging service provided by n01se.net