#clojure log - May 04 2013

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

1:27 tomoj: ambrosebs: btw, ##(:tag (meta #'*out*))

1:27 lazybot: ⇒ java.io.Writer

1:28 ambrosebs: tomoj: whoops.

1:28 tomoj: sorry *out* :)

1:29 tomoj: I realised I was trying to get to .write, and I needed to pass a tagged ^chars as a first argument to resolve the method.

1:39 muhoo: is cljx the current state of the art until feature expressions get implmented? or is lein-cljsbuild crossovers recommended instead?

2:06 * si14 what's up with the new CLJS? Can't make it work: java.lang.IllegalArgumentException: No implementation of method: :-compile of protocol: #'cljs.closure/Compilable found for class: cljsbuild.compiler.SourcePaths

2:10 muhoo: ugh, on another note: https://www.refheap.com/paste/14193

2:10 thanks, jdbc, for telling me there's a syntax error, but not showing the actual (generated, i guess) syntax that has the error in it.

4:06 wow, finally got an sql insert working with jdbc/postgres/clojure. unbelievable.

4:07 jdbs sure hates the inet datatype in postgres though :-(

4:27 avishai: hi

4:28 i'm trying to use doseq to iterate over a vector of functions

4:28 e.g. (doseq [m [function1 function2 ....]]

4:29 then inside i do (:name (meta m))

4:29 and i get nothing

4:29 so i guess when doseq binds it doesn't copy metadata?

4:30 or do i need (var m) ?

4:34 pyr: hi guys, is there any reducer based sort implementation to look at anywhere ?

4:49 fold seems to be a candidate

4:56 noidi: avishai, when you create a function using defn, the metadata is attached to the var and not the function object

4:56 ,(meta +)

4:56 clojurebot: nil

4:56 noidi: ,(meta #'+)

4:56 clojurebot: {:arglists ([] [x] [x y] [x y & more]), :ns #<Namespace clojure.core>, :name +, :column 1, :added "1.2", ...}

5:29 thm_prover: when building a gui in clojure

5:29 what are the tradeoffs vs using eclipse vs netbeans gui elements?

5:34 is there anyway to use netbeans components from within clojure?

10:56 learner_: Hello fellow Clojurians. I have a quick question, hope you guys can help. I am running a loop on a number of combinations (loop runs for 24hours), and for every run it updates an atom (which is tracking the run count). I executed the program using lein run. Now in the middle of the process, would it be possible to get the run count without killing the program? Any hints, help is much appreciated. cheers

10:57 bbloom: learner_: is the atom in a var? or in a local variable?

10:58 axle_512: learner_: I believe that if you run the expensive looping code as a future from the repl, you can then use the repl to display the value of the atom whenever you want.

11:04 learner_: bbloom: atom is a variable (global level)

11:05 axle_512: I see what you mean, but unfortunately the loop is running now (triggred using lein run) and breaking it a bit of pain!

11:07 axle_512: learner_: I've never tried this, but it _might_ work for you. https://github.com/djpowell/liverepl

11:08 learner_: If you could somehow attach a repl to your running JVM, then you may be able to inspect variable, etc.

11:08 learner_: axle_512: Good resource. I will give a try. Thanks for your time mate.

11:09 tomoj: wow

11:10 axle_512: learner_: no problem, hope it works for you.

11:10 tomoj: no deps at all required for liverepl?

11:10 that is pretty impressive

11:10 Okasu: learner_: Can you report back your experience with liverepl, please?

11:11 learner_: Okasu: Will do definitely

11:11 Okasu: Thanks, it'll be interesting.

11:12 axle_512: I don't know for sure, but I have a hunch the liverepl uses java's attach api

11:13 there's a similar "groovy" tool that connects to a running java (or JVM) process, called "crash". http://www.crashub.org/ http://www.infoq.com/news/2012/06/crash-shell-1

11:13 crash definitely uses the java attach api.

11:18 ok, I think I confirmed that liverepl is using the attach api (com.sun.tools.attach) here https://github.com/djpowell/liverepl/blob/master/liverepl-agent/src/net/djpowell/liverepl/client/Main.java

11:31 learner: axle_512: Your guess is correct live REPL using java attach API ref https://groups.google.com/forum/?fromgroups=#!topic/clojure/2Oh-XRXp1Qg

11:32 axle_512: learner: ah, very cool!

12:00 learner: How come nobody is discussing anything? is everybody using private chat?

12:01 axle_512: learner: I guess its quiet because it's the weekend?

12:02 learner: axle_512: Oops. I forgot that for a minute! Sorry

12:03 axle_512: learner: Honestly I'd think weekend chat would be quite active, really. Not sure why it's so quiet.

12:03 learner: any luck with the live repl?

12:03 learner: axle_512: I see

12:04 axle_512: Didn't try yet mate. Just preparing for a PROD release (sorry, it's a trouble for all Londoners). Will try sometime tomorrow

12:07 axle_512: I am off now. I will come back to update you about liverepl. Meanwhile enjoy your time

12:07 axle_512: learner: thanks, you too

12:07 learner: axle_512: Cheers

12:35 nkoza: why this destructuring works: (let [{:keys [x z]} '(:x 3 :z 9)] [x z]) ;=> [3 9] ... but this doesnt? (let [{:keys [x z]} [:x 3 :z 9]] [x z]) ;=> [nil nil]

12:39 ok, I got it, the vector is associative, nevermind :)

13:16 ppppaul: any of you smart people have experience with mapping?

13:16 hyPiRion: mapping?

13:16 ,(map inc (range 10)) ; you mean?

13:16 clojurebot: (1 2 3 4 5 ...)

13:16 hyPiRion: or from one domain to another?

13:17 TimMc: Or GIS?

13:17 ejackson: it requires only 4 colours - so I'm told ;)

13:18 ppppaul: GIS

13:18 i'm trying to convert coords and i'm really lost

13:18 TimMc: ejackson: Unfortunately, not true for real geography.

13:18 ppppaul: i have NAD27 data for canada, and i want to convert that to lat/lon

13:18 i found some converters in JS, but they were a mess

13:22 * ppppaul should have taken more geography courses in school

13:25 nkoza: there is some kind of let that you can use inside a thread macro? I mean, something like (-> 3 (mylet myvar (+ myvar 4))) ;=> 7 , where mylet expands to (let [myvar 3] ....)

13:29 ppppaul: (when-let

13:29 (if-let

13:29 gdev: (out-let

13:29 ppppaul: ,(doc out-let)

13:29 clojurebot: I don't understand.

13:29 TimMc: ejackson: https://en.wikipedia.org/wiki/Enclave_and_exclave

13:29 gdev: must've only been in contrib then

13:30 ppppaul: nkoza, that looks hard to understand

13:31 gdev: nkoza:) still having a hard time seeing why it couldn't just be a function

13:31 ppppaul: are you going to keep threading the let?

13:31 nkoza: I want to thread a let

13:32 gdev: ,(doc thread-let)

13:32 clojurebot: No entiendo

13:32 ppppaul: make it a fn

13:33 nkoza: (-> 3 (mylet x (/ (+ 1 x) x) str) will expand to (str (let [x 3] (/ (+ 1 x) x))

13:34 I see a mylet macro is possible to do, but I want to know if there is something equivalent in the standard lib

13:34 ppppaul: not that i know of

13:34 gdev: me neither

13:35 hyPiRion: ,(as-> x 3 (/ (+ 1 x) x) (str x)) ;?

13:35 clojurebot: #<Exception java.lang.Exception: Unsupported binding form: 3>

13:35 hyPiRion: ,(as-> 3 x (/ (+ 1 x) x) (str x)) ;?

13:35 clojurebot: "4/3"

13:35 ppppaul: oh wow

13:35 that is new

13:35 TimMc: gfredericks: Proposal: rename `if` to `iff`.

13:36 ppppaul: needs more f's

13:36 why iff?

13:36 gdev: if and only if

13:36 ppppaul: i know that

13:36 gdev: ppppaul:) k, can never be too sure

13:37 ppppaul: i forget the meaning though..

13:37 been a while since school

13:37 gdev: $google iff

13:37 lazybot: [International Flavors and Fragrances] http://www.iff.com/

13:38 gdev: lol nope

13:38 $google logical iff

13:38 lazybot: [If and only if - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/If_and_only_if

13:43 gdev: TimMc:) is that to say that in Clojure "if" statements are more constrained than a normal logical if?

13:45 hyPiRion: ,(if true (print "foo") (print "foo"));?

13:45 clojurebot: foo

13:46 hyPiRion: If and only if true is truthy, print "foo".

13:46 Doesn't make sense, as I read it

13:47 gdev: the truth table for that statement is just all ones

13:50 hyPiRion:) point taken though

13:51 hyPiRion: yeah, replace true with x or something

13:52 gdev: ,(let [x true] (if x (print "false") (print "false")))

13:52 clojurebot: false

13:58 TimMc: gdev: Yeah, here I am, just knowing some basic logic... how am I to know that (if foo? a b) won't sometimes eval a even if foo? is false.

14:03 Chousuke: iff doesn't work like that does it

14:04 iff x y means that y is only true if x is true and x is only true if y is true.

14:04 gdev: ,(= *)

14:04 clojurebot: true

14:05 axle_512: ,(inc chousuke)

14:05 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: chousuke in this context, compiling:(NO_SOURCE_PATH:0:0)>

14:05 Chousuke: :P

14:05 gdev: (inc Chousuke)

14:05 lazybot: ⇒ 2

14:05 axle_512: thanks gdev

14:06 Chousuke: gdev: that behaviour of = is to enable eg. (apply = somevector) for checking if all elements are equal

14:07 gdev: Chousuke:) I know I was just printing true to agree with your statement aboot iff

14:07 Chousuke: heh

14:07 ,(=)

14:07 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ->

14:08 Chousuke: hm, it might make sense for that to return true as well :P

14:15 gdev: Chousuke:) = will only return a result if and only if it has an argument passed to it

14:16 Chousuke:) see Swearjure for more crazy forms like that

14:18 TimMc: If I were godking of Clojure, more of these basic functions would have nullary and unary base cases defined.

14:19 hyPiRion: ,(-> = =)

14:19 clojurebot: true

14:22 gdev: ,(#(`[~@%&] 1) 1 true 3 4)

14:22 clojurebot: true

14:23 xeqi: are there any guides for how clojure's class generation works?

14:24 gdev: xeqi:) they're compiled at different times based on what form you use

14:25 hyPiRion: ,((-> [+ *] #(*)) 1 true)

14:25 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: �# in this context, compiling:(NO_SOURCE_PATH:0:0)>

14:26 hyPiRion: ,((-> [+ *] #(*)) 1 true)

14:26 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>

14:26 hyPiRion: boo, right

14:26 ,((-> [+ *] #(-> *)) 1 true)

14:26 clojurebot: true

14:27 xeqi: heh, I suppose I was thinking about :aot class generation, but I do need to better collect my thoughts

14:28 gdev: ,(let [^ = _ 1] (-> ( ^ _^)))

14:28 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

14:28 gdev: ,(let [^ = _ 1] (-> ( ^ _ ^ ) ) )

14:28 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

14:29 gfredericks: gdev: I don't think ^ is a valid symbol

14:29 gdev: ,(let [^ - _ 1] (-> ( - _ - ) ) )

14:30 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

14:30 hyPiRion: ^ never is

14:30 ,\^

14:30 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

14:30 hyPiRion: ,1

14:30 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

14:31 gdev: ,(let [- = _ 1] (-> ( - _ - ) ) )

14:31 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

14:31 gfredericks: can anybody explain why on earth this commit does anything? https://github.com/clojure/java.jdbc/commit/d7e77cce67e6b07bf7a4ad20385b58960fd6bbe0

14:34 gdev: gfredericks:) looks like its just an aesthetical change for clarity, since the word connection gets tossed around in DB libs, this makes it clear where this one is coming from

14:35 gfredericks: in the context of the project it was the entirety of a patch release

14:35 so it must mean something to somebody

14:35 gdev: gfredericks:) does the "connection" in [:keys [connection factory connection-uri] refer to the sql.connection or a java.jdbc.connection?

14:36 gfredericks: seancorfield describes it as "a small but critical flaw"

14:37 gdev: gfredericks:) that's what leads me to believe it might have been some sort of shadowing or clobbering or something like that

14:37 gfredericks: the commit message mentions macros, which suggests that somehow the typehint could be compiled in another namespace and get interpreted differently

14:38 but that would be a surprising possibility I think

15:51 gdev: is there a way to reload dependencies in the repl? i'm in emacs i updated my project.clj file and I don't want to shut down nrepl and restart it

15:54 gfredericks: I believe not.

15:54 I don't think the classpath is mutable that way

15:54 gdev: mkay, thanks

15:54 ShawnMcCool: how long did it take you to start seeing things clearly when working with clojure?

15:55 n_b: gdev: There's pomegranate https://github.com/cemerick/pomegranate

15:55 it's apparently not great, but it does exist. YMMV

15:56 ShawnMcCool: i'm having to really spend a lot of time looking at my code to make sure that there's the appropriate number of parens and really even to understand it. i'm new to lispy style parens and i'm just curious. at some point in time do you develop the eye to just 'see' the code as i might see java or c#?

15:56 gfredericks: ShawnMcCool: you can definitely expect that yes

15:56 n_b: ShawnMcCool: Ignore the parens, look at indendation. And get Paredit/some sort of structural editor

15:56 gfredericks: I don't remember how long that took for me. I think I was comfortable for a while before I was confident (which came after a couple years)

15:57 hyPiRion: It didn't take that long for me

15:57 n_b: It took me about ~1.5mo to ignore the syntax, 4clojure helped learn many idioms

15:57 IRC taught me even more, and continues to show me new stuff every day

15:58 gfredericks: (inc #clojure)

15:58 lazybot: ⇒ 2

15:58 ShawnMcCool: thanks everyone, appreciate the feedback

15:58 n_b: What books have you read, if any?

15:59 gdev: n_b:) thanks, pomegranate was exactly what I was looking for

15:59 ShawnMcCool: i'm working on Clojure Programming by Chas Emerick

15:59 it's a very big departure for me

15:59 n_b: That's the best for beginners. I read that, played with Clojure heavily for a month, then read JoC

15:59 hyPiRion: Good choice at least.

15:59 gdev: ShawnMcCool:) what's your native language(s)

16:00 ShawnMcCool: I'm most familiar with C#, Python, and PHP these days

16:00 occupationally

16:00 gfredericks: it's a proven fact that nobody has ever learned clojure and regretted it

16:01 ShawnMcCool: I'm finding it very compelling.

16:01 i'm at a snack bar and my old lady and my frites are ready. better get home. but thanks very much for the feedback. I'll be back.

16:01 akhudek: gfredericks: except that one guy on hacker news who is upset it is not CL

16:02 n_b: akhudek: and posts in every thread about Clojure not being a proper lisp?

16:02 akhudek: yes

16:03 n_b: my roommate and I call him Clojure's mchurch

16:03 gdev: my only regret is I'm the only one in my shop that took the red pill, everyone else is still in java land...it's so lonely =(

16:03 n_b: I regret learning clojure because I now loathe working on older Ruby code

16:03 Pupnik: I wonder... if you wanted to script Unity with Clojure... would you be better using Clojure on mono or Clojurescript!?

16:03 gdev: then there are those who tried to take the purple pill, scala, but choked on it and threw it up

16:04 n_b: My problem with Scala is that the community seems split between people who want a slightly nicer Java, and those who want Perl8

16:04 Jambato: what is perl 7?

16:05 gdev: $google perl7

16:05 lazybot: [Perl 7 | Ovid [blogs.perl.org]] http://blogs.perl.org/users/ovid/2013/02/perl-7.html

16:06 Jambato: I thought it was a joke

16:07 oh wait

16:07 it is

16:07 n_b: which part?

16:08 Jambato: the paerl 7 part

16:10 n_b: I actually believe that was a serious consideration, the Perl release cycle has been rather convoluted

16:16 gdev: ugh, database programming on sunny saturday afternoon. clojure...not even once

16:28 tdd database application, what could go wrong?

16:29 lazybot:) fortune

16:35 shadow_prince: someone can write macros with body like (first arg)? can't get trought it

16:36 gdev: $google trought

16:36 lazybot: [trought - Traducción al español – Linguee] http://www.linguee.es/ingles-espanol/traduccion/trought.html

16:37 gfredericks: it takes a lot of self control to at least google something before asking a question here

16:38 shadow_prince: I google three guides, but can't write this

16:38 gfredericks: shadow_prince: I don't think your question was very clear. (defmacro foo [arg] (first arg)) is a valid macro.

16:40 shadow_prince: Thanks, I shall read about quoting in lisp /o

16:40 * gfredericks just found out about M-- C-x C-e

16:48 * gfredericks really should have read the nrepl.el docs in detail a long long time ago

16:49 gdev: gfredericks:) ermahgerd that meta dash dash is nice

16:52 amalloy: gfredericks: why M--? as far as i can tell that's calling it with a prefix-arg of -1, right? it looks like it doesn't care what the prefix arg is, so C-u would be the traditional way to do that

16:52 gdev: okay, i did M-- c-x c-e on (print (range)) is that bad?

16:52 amalloy: gdev: no, as long as you have infinite RAM you should be okay

16:52 gdev: amalloy:) how do I make it stop???

16:52 lazybot: gdev: How could that be wrong?

16:53 amalloy: try C-g, like anything else in emacs

16:53 if not that, i dunno, shut off emacs or the computer

16:55 gdev: crisis averted

16:58 i was wondering if it would do elipsing for infinite sets, the answer is nein

16:58 amalloy: if you set *print-length* it would

17:01 gdev: this is one of those i should've had emacs running in daemon mode

17:06 gfredericks: amalloy: I don't know enough about emacs to know that C-u did that

17:06 C-u is much easier

17:07 this is why I announce to #clojure whenever I think I know something

17:07 amalloy: haha

17:07 (inc gfredericks)

17:07 lazybot: ⇒ 21

17:07 * gfredericks takes a drink to celebrate

17:08 gfredericks: when I saw the number 21 the first thing I thought of was mentioning it was a semiprime. The second thing was that it's the american drinking age.

17:50 msull92: Would anyone like to give me some feedback on my newish library? https://github.com/msull92/wiggle

17:52 amalloy: msull92: it looks like a version of hiccup that is painful to use and much less performant

17:52 and the README is belligerent for no particular reason

17:54 msull92: Thank you

17:54 learner: axle_512: Okasu: bbloom: liverepl is working well guys. Thanks for all your help

17:54 amalloy: seriously though, if this is the kind of interface you want, msull92, check out hiccup. you'll probably like it

17:57 msull92: I did see hiccup, but I wanted I was attempting to teach myself more about Clojure by making my own library

17:58 justin_smith: looks like the entire library consists of one four line function

18:00 (apply str (for [chunk content] chunk)) = (doall (apply str content)) yes?

18:00 Bronsa: no need for the doall

18:01 justin_smith: ok, so (apply str (for [chunk content] chunk)) = (apply str content)

18:01 I have seen str turn my lazy seqs into "lazy seq blah", but maybe apply takes care of that

18:02 Bronsa: ,(str (take 3 (range)))

18:02 clojurebot: "clojure.lang.LazySeq@7480"

18:02 Bronsa: ,(apply str (take 3 (range)))

18:02 clojurebot: "012"

18:03 justin_smith: anyway, beyond the fact that so much was shoved into one line of code, that is all there is I see to comment on

18:03 Bronsa: ,(str (list* (take 3 (range))))

18:03 clojurebot: "(0 1 2)"

18:06 justin_smith: so yeah that second for is a noop

19:03 lynaghk: dnolen: ping

19:05 amalloy: justin_smith: it occurs to me that in a functional language, every function is a no-op: perhaps we ought to call (for [x xs] x) an identity instead?

19:05 justin_smith: that would be better stated, yes

19:05 arrdem: amalloy: how so a no-op? without a decent optimizer computation will still be performed.

19:06 amalloy: identity certainly

19:06 justin_smith: I was the one who called it a no-op

19:06 but I meant identity operation

19:07 arrdem: justin_smith: ok cool

19:07 amalloy: arrdem: it's all just philosophical faffery, really

19:10 * arrdem marvels at fattery for a minute

19:10 arrdem: frick I can't spell

19:11 justin_smith: fattery is when you are very bad at flattery

19:11 arrdem: amalloy: understood I'm just being nitpicky about ops due to writing a compiler ATM

19:11 justin_smith: well played sir

19:15 justin_smith: I am trying to remember, which core function is basically #(filter nil? %)

19:16 shadow_prince: understanding lisp features blow my mind. again

19:16 time to sleep

19:17 justin_smith: sorry, I meant #(remove nil? %)

19:17 shadow_prince: where-not nil?

19:18 oh, nope

19:18 justin_smith: I think you mean when-not - and not quite

19:19 no big deal, I can do a remove nil, I was vaguely remembering another function that basically did that though

19:21 dnolen: lynaghk: pong

19:41 lynaghk: dnolen: ping ping!

19:41 man, have too many emacsen going on

19:41 dnolen: lynaghk: hey

19:41 lynaghk: dnolen: this is a shot in the dark, but I just tried the latest cljs build and it looks like key destructuring of JavaScript objects is broken in adv. compilation

19:42 thought I'd ask you if you had any ideas

19:42 (i.e., if I implement ILookup on js object and then destructure)

19:42 the object itself has the correct property names, so my guess is that cljs is generating non-string-based accessors from the destructuring form and those are getting optimized away

19:43 dnolen: lynaghk: hrm, are implement ILookup on js objects by extending to default?

19:43 lynaghk: dnolen: https://github.com/lynaghk/todoFRP/blob/master/todo/angular-cljs/src/cljs/todo/util.cljs#L89

19:45 dnolen: lynaghk: that really should be default, but yeah I may have screwed things up.

19:45 lynaghk: dnolen: why default vs object?

19:46 dnolen: lynaghk: oh hmm, I didn't think there was an object case, only default

19:47 lynaghk: dnolen: this just came up a few hours ago, so I haven't had time to put together a minimal case to look at all of the generated code and figure it out

19:47 dnolen: I just thought I'd run it by you in case it was something obvious

19:48 dnolen: lynaghk: nope I messed things up when I was optimizing code size things

19:48 lynaghk: fixing now and will push to master, add tests and ping clojure-dev for another CLJS release

19:48 lynaghk: dnolen: thanks!

19:49 dnolen: I'm going to be in your neighborhood in August for Hacker School---I'll have to get you a drink

19:50 dnolen: lynaghk: I heard! will be fun!

19:50 tomoj: is angular in there as a non-FRP baseline? :P

19:50 lynaghk: dnolen: yeah, I'm really looking forward to this summer. We're finishing up some client work this month and I'm taking a sabbatical to explore a lot of fun stuff

19:50 dnolen: lynaghk: awesome

19:51 lynaghk: tomoj: I'm not sure how all of this FRP stuff will turn out in the long run, but for now Angular.js is pretty much the best framework I've used, ClojureScript or JavaScript

19:58 tomoj: lynaghk: that's probably true of me too (angular is probably the best I've used). but that doesn't make it functional

20:19 dnolen: lynaghk: try master

20:21 lynaghk: email sent out to clojure-dev

20:33 tomoj: "All notions of value are about being able to directly perceive something and compare it to something else"

20:33 what does "directly" mean here?

20:33 (that's from The Value of Values)

20:34 gfredericks: no hidden state?

20:34 or hidden identity material

20:34 justin_smith: would an indirect perception be a speculation? (one speculates)

20:37 tomoj: "There can't be any operational interface over a value that tries to encapsulate what it means"

20:37 same point?

20:37 i.e. operational interface <=> direct perception impossible?

20:38 gfredericks: ok, so what's "hidden"..

20:38 justin_smith: does <=> mean xor?

20:38 tomoj: I mean iff

20:39 justin_smith: operational interface would imply direct perception is what I would take out of those to lemmas together

20:40 tomoj: huh?

20:41 I think when I heard "directly perceive" the first time, I took it to mean basically "if you have a reference to a value, you can print a complete representation of its meaning, now"

20:41 where "directly" mostly corresponds to "now"

20:41 justin_smith: if a) one cannot use the concept of a value without direct perception, and b) there is no operational interface to encapsulation then c) operational interface implies direct perception

20:42 (assuming encapsulation is the absence of direct perception)

20:42 gfredericks: actually I never know what rich hickey is talking about

20:43 dnolen: look like some Clojure async is brewing - http://github.com/relevance/clojure/compare/master...core-futures

20:43 arkh: is there a way to find out what a given Class implements / inherits from?

20:44 dnolen: arkh: at the REPL?

20:44 arkh: e.g. creating a connection in datomic returns a datomic.peer.LocalConnection, but I'm wondering what things it implements

20:44 dnolen: yes

20:44 dnolen: ,(supers (class []))

20:44 clojurebot: #{clojure.lang.Sequential java.util.List clojure.lang.Counted java.io.Serializable java.lang.Iterable ...}

20:44 dnolen: ,(bases (class []))

20:44 clojurebot: (clojure.lang.APersistentVector clojure.lang.IObj clojure.lang.IEditableCollection)

20:45 arkh: dnolen: awesome - thank you

20:49 and the async stuff looks nice

20:51 n_b: ,(doc bases)

20:51 clojurebot: "([c]); Returns the immediate superclass and direct interfaces of c, if any"

20:52 tomoj: what the heck is core_async?

20:53 dnolen: tomoj: looks like Scala / C# style async support

20:56 tomoj: oh, I found the tests. nice

20:58 bit worried whether it will be possible to get deterministic semantics on top of that foundation, but SSA is better than nothing :)

20:59 I guess you get deterministic semantics as long as you always only care about 'what' and never 'when'

21:02 ..so you can't use any?

21:11 justin_smith: ssa?

21:11 clojurebot: ssa is http://wingolog.org/archives/2011/07/12/static-single-assignment-for-functional-programmers

21:12 justin_smith: (inc clojurebot)

21:12 lazybot: ⇒ 22

21:17 tomoj: so an INotify is not a value, why?

21:18 because -attend is an operational interface?

21:18 (alternatively, is an INotify a value?)

21:24 justin_smith: that is interesting, and trying to work it out makes me realize I didn't actually understand what you were saying earlier

21:25 tomoj: I guess if the f! and the executor don't make it operational, then I have no clue what "operational" means

21:25 but what if you pretend the interface is then, instead of -attend?

21:25 then-call I mean

21:25 still an executor but..

21:39 justin_smith: has anyone implemented a tail-call function/macro that would error like recur if not in the tail position, and implement general tail recursion?

21:39 ie. n functions that each call one of the others from a tail position

21:40 *implement general optimization of tail calls

21:42 Apage43: a trampoline generator?

21:44 gfredericks: it is really weird to read "The phrase was coined by X in 1975..." and then think, "ah yes, X, he's keynoting at the conference this summer."

21:45 justin_smith: Apage43: I guess so?

21:48 akhudek: gfredericks: who are you talking about?

21:49 gfredericks: Mr. Sussman

21:49 1975 was 45 years before I was born

21:50 s4muel: ...you're from the future?

21:50 gfredericks: well I will be

21:51 tieTYT: sup guys

21:54 justin_smith: from the future, and admits it in the one place people are most likely to know how to use cancel-future? thems some gonads

21:54 dnolen: justin_smith: https://github.com/cjfrisz/clojure-tco

21:55 justin_smith: dnolen: cool!

21:57 looks in-progress and currently fairly limited though

21:57 it figures that that would be a huge infrastructural change to the language, it may be easier to just try to hack something up with trampoline

21:58 we have a code base that really loves small functions as abstractions, and our call stacks get rediculous, to the point where it may start to be a problem soon

21:58 (if not already performance wise)

22:00 dnolen: justin_smith: in what language?

22:00 justin_smith: clojure!

22:00 our heap usage is kind of crazy

22:01 tieTYT: how would I get rid of the dry violation here, ideally without involving a (let): (if (= "<Unset>" (config destination-button :text)) (:shortcut.dir filechooser-props) (config destination-button :text))

22:01 justin_smith: a bit part of that, I am speculating, is call stack with the nested environments waiting to return

22:01 * Apage43 is in the middle of an ugly bignum party

22:01 tieTYT: I don't like how (config destination-button :text) is copied twice

22:01 justin_smith: if-let?

22:02 tieTYT: justin_smith: can you show me how to use it that way?

22:02 dnolen: justin_smith: well Clojure is filled w/ small functions itself and people don't complain too much if they have realistic expectations ...

22:02 tieTYT: (=) returns true or false, so I don't know how to use if-let like this

22:02 justin_smith: I could be on the wrong track

22:03 it is not just that there are lots of small functions, but that they call each other deeply (core clojure tends to use its primitives frequently, not build a high stack and keep building on the top ones)

22:06 dnolen: justin_smith: I would use a profiler like YourKit to figure out what's going on

22:07 justin_smith: yeah

22:07 tieTYT: maybe some prettier version of this? (-> (config destination-button :text) (#(if-not (= % "<Unset>") % (:shortcut.dir filechooser-props))))

22:11 redline6`: I'm getting a FileNotFoundException trying to import some cljs from another cljs file. Can anyone tell me what I'm doing wrong? https://github.com/redline6561/cljs-6502/blob/master/src/cljs/addressing.cljs

22:14 tomoj: (extend-protocol IEquiv Promise (-equiv [o other] (and (instance? Promise other) (= @o @other))))

22:14 (pretend it's some weird hybrid of clj cljs)

22:14 what is wrong with this?

22:14 other than that it might surprise the programmer

22:16 muhoo: what's the convention for naming functions that cal functions that call functions that eventually have side effects? should they all have bangs in them, or only the one at the end of the chain?

22:17 tieTYT: justin_smith: i don't think that's the same logic, but I could be wrong

22:17 tomoj: one bang per nesting level :P

22:17 tieTYT: justin_smith: oh nm, i see it now

22:17 muhoo: in other words, if foo calls baz which call quuz, and only quux actually hits the db, should they be foo! baz! quuz! or just foo, baz quux! ?

22:18 tomoj: hard to say there's actually a convention

22:18 consider alter/commute

22:18 deliver

22:19 muhoo: tomoj: i'm not familiar with that convention

22:20 tomoj: I mean that even clojure core itself has some missing bangs

22:20 unless there's some more subtle convention I just don't see..

22:21 muhoo: oh, wow, good point. alter should totally be alter! in that system

22:21 justin_smith: maybe since alter only works in dosync?

22:22 on the other hand, dosync should definitely be dosync! by that convention

22:22 muhoo: i dislike bangs, my code is alarming! enough! without! them! but i'm trying to do the right thing.

22:22 justin_smith: maybe do* implies *!

22:24 hyPiRion: justin_smith: no

22:24 dosync by itself doesn't mutate anything

22:24 ,(dosync (+ 1 2))

22:24 clojurebot: 3

22:26 hyPiRion: consider set! and other functions ending with a bang as mutation without the need of perfoming such action within a transaction

22:27 tomoj: justin_smith: aha!

22:28 maybe that's it

22:28 and deliver sort of isn't mutating anything

22:28 since you can only do it once

22:29 Apage43: Mhm, promises are considered to have only one value, just one that may not yet be accessible

22:31 tomoj: uh, wat. I realized a while back that lazy seqs are IPending

22:31 but I didn't realize that this means the state of a lazy seq leaks out through realized?

22:31 so a promise isn't any less of a value than the rest of a lazy seq?

22:31 assuming a suitable interface..?

22:34 bbloom: dunno if you remember arguing that realized? makes promises less than values - got any other arguments?

22:39 muhoo: ,(-> 1 ((partial str 3 2)))

22:39 clojurebot: "321"

22:40 muhoo: a hack for dealing with a chain of -> when you need only one of the functions in the chain to accept the arg at the end

22:41 xeqi: &(-> 1 (->> (str 3 2)))

22:41 lazybot: ⇒ "321"

22:43 justin_smith: muhoo: yeah, I do that quite a bit, I pick ->> or -> based on which case is more common in the code, then use double parens and anon fns to match it all up

22:43 gfredericks: &(as-> 1 <> (str 3 2 <>))

22:43 lazybot: java.lang.RuntimeException: Unable to resolve symbol: as-> in this context

22:43 gfredericks: ,(as-> 1 <> (str 3 2 <>))

22:43 clojurebot: "321"

22:46 justin_smith: gfredericks: is as-> clojure 1.5?

22:48 muhoo: really?

22:49 fantastic! that's like swiss-arrows, integrated into clj core, thanks gfredericks

22:50 seancorfield: SegFaultAX: yes, ppl do still use CFML (although in decreasing numbers these days) and i'm giving three talks at a 300 attendee CFML conference in MN in two weeks! :)

22:50 s4muel: So. Hi all. I am very new to Clojure. I come from a background of... well, curiosity, and system admin / Ruby / Python, etc. When I learned Ruby someone smarter than me said 'you can get a lot done if you master the Array and Hash APIs' -- they were right. So I am curious, what constructs or 'features' of Clojure in particular are the equivalent, e.g. 'get to know "foo" really well, and you'll have a lot of power in your

22:50 hands'? I realize this is a broad and somewhat loaded question, but any insight is appreciated.

22:51 muhoo: wasn't linode hacked recently, and peple discovered they use CFML still?

22:51 gfredericks: justin_smith: yes

22:51 muhoo: you're welcome :)

22:52 muhoo: s4muel: maps

22:52 seancorfield: gfredericks: java.jdbc patch was indeed due to macro expansion problem reported by a user where the expansion could cause Connection to be referenced 'bare' in another ns which (obviously) had not imported java.sql.Connection... i was surprised too but i've had a few equally weird things happen with macros so i just qualified the type hint name

22:52 next time you see gdev you can tell them more detail :)

22:53 tomoj: gfredericks: nice. how about %? too confusing?

22:53 justin_smith: s4muel: I would say {:key "value"} map conventions, and the various ways of building and using anonymous functions

22:53 muhoo: s4muel: maps seem to be the center of clojure to me. i also am a linux sysadmin by training/temperament who is attempting to make the transition from ops to developer

22:53 justin_smith: s4muel: http://clojure.org/cheatsheet <- the stuff on this page is a very usable subset of the language.

22:53 gfredericks: seancorfield: so macros and typehints don't go well together?

22:53 tomoj: oh that's a nice suggestion; now I'm torn

22:54 seancorfield: muhoo: adobe coldfusion had a security flaw - but some folks use a free open source cfml engine which does not have that flaw

22:54 a jboss community project called railo, out of switzerland

22:54 s4muel: thank you muhoo, justin_smith :)

22:55 seancorfield: gfredericks: apparently with-connection expands to a bare reference to Connection which causes problems

22:55 tomoj: gfredericks: yeah, the consistency with #() seems both good and bad..

22:55 seancorfield: i've seen that happen with macros that call private functions and the expansion can fail because it expands to code that isn't accessible

22:55 gfredericks: seancorfield: I can't think of how that wouldn't cause problems almost all the time rather than weird edge cases

22:56 yeah that phenomenon I'm well familiar with

22:56 seancorfield: gfredericks: I guess none of my test cases, and none of my production code(!), uses java.jdbc in such a way as to expand with-connection in the same way the bug reporter hit?

22:57 gfredericks: I would think that you couldn't even use with-connection unless you had happened to import Connection for some odd reason

22:57 seancorfield: but, yes, I would have expected to trip over it myself... but didn't :(

22:57 gfredericks: which would be 99% of uses

22:57 so I'm clearly missing something. languages are difficult :(

22:58 seancorfield: yeah, when the error was reported i was like "duh! that's an obvious mistake" but then i couldn't figure out why i hadn't found it in testing etc :(

22:58 gfredericks: seancorfield: unrelated question -- does the new API have anything for setting statement options? ForwardOnly and that sort of thing?

22:58 I _think_ that's the only feature we're still using a patched version for

22:59 seancorfield: you set that on... what? a PreparedStatement?

22:59 gfredericks: I think so

22:59 seancorfield: a ResultSet?

22:59 gfredericks: no the statement

22:59 seancorfield: i remember seeing the option described somewhere...

22:59 let me have a look in the source

23:00 * gfredericks fumbles around for the patch he's using

23:01 gfredericks: ooh

23:02 I think I misremembered what our issue was

23:02 I think java.jdbc already supported this

23:02 it was korma that made things awkward

23:02 so I added a dynamic var (always the best solution) in java.jdbc to allow reaching around korma

23:02 https://github.com/fredericksgary/java.jdbc/commit/3a8ba77d82777a755eeae31c552bfc4ab5f1d6b8

23:03 seancorfield: the new query API still supports a PreparedStatement being passed in

23:03 gfredericks: probably not the sort of thing that really belongs in java.jdbc

23:03 seancorfield: although it's no longer properly documented ... i'll have to fix that (and add a atest for it!0

23:05 ah, you were using the *dynamic-var* and binding to get around how korma called prepare-statement? yeah, definitely not something java.jdbc should support

23:05 that's a "bug" in korma if it doesn't let you pass thru stuff

23:06 gfredericks: the bugfix was not using korma the next time we had to make that decision :)

23:06 discovered honeysql and wished I'd been using that all along. Though I saw java.jdbc now has something similar?

23:07 seancorfield: honeysql is much more sophisticated and should be compatible with java.jdbc

23:07 gfredericks: I couldn't tell at a glance if you were attempting to render honeysql unnecessary

23:08 seancorfield: i chatted with the honeysql author at clojure/conj and we agreed to maintain compatibility

23:08 no, java.jdbc.sql is meant to be a very slim convenience

23:08 the docs even recommend honeysql :)

23:08 gfredericks: okay, good to know. I'll continue being a fan of the combination

23:09 thanks for pushing the project forward

23:10 (inc seancorfield)

23:10 lazybot: ⇒ 4

23:10 seancorfield: or maybe i only mentioned it on the mailing list that honeysql is recommended if you need more than java.jdbc.sql provides? i'm sure i mentioned it _somewhere_ semi-official :)

23:10 thanx... it definitely needs more work and i've been so swamped lately at world singles

23:11 we're just about to tranistion to using the new api ...

23:12 getting dark... i need to go feed kitties... back in a while

23:29 lazybot: seancorfield is Catman!

23:44 arrdem: (inc lazybot)

23:44 lazybot: ⇒ 19

23:45 arrdem: &(print "(inc lazybot)")

23:45 lazybot: ⇒ (inc lazybot)nil

23:46 metellus: ,(print "&(inc lazybot)")

23:46 clojurebot: &(inc lazybot)

23:47 metellus: ,(print "(inc lazybot)")

23:47 clojurebot: (inc lazybot)

23:47 arrdem: metellus: the bots ignore each other

23:47 metellus: I tried to do a trans-bot quine once :p

23:48 metellus: that's probably for the best

23:48 even one bot in a channel of programmers is asking for trouble

23:49 arrdem: heh I run the bot for my local 2600 chan and have almost gotten rooted through it a few times :/

23:50 TimMc: arrdem: hyPiRion once got one going. That's why lazybot ignores clojurebot now. :-P

23:50 arrdem: TimMc: haha not surprised at all...

23:50 uvtc: About how far along is ClojureC? Anyone taken it out for a spin?

23:51 (re: https://news.ycombinator.com/item?id=5656603 )

23:51 pppaul: what be clojureC?

23:51 uvtc: Ahoy!

23:52 pppaul: Clojure->C compiler

23:52 pppaul: i C

23:52 arrdem: pppaul: i c wut u did ther

23:52 pppaul: si

23:52 uvtc: Avast, on the high C's!

23:53 arrdem: yo dawg I heard you like cc so I threw some clojure around cc so you can cc while you cc

23:53 pppaul: clojure to C sounds hard

23:53 uvtc: The README says it's still experimental. Has a number of tests.

23:53 This would be https://github.com/schani/clojurec .

Logging service provided by n01se.net