#clojure log - Apr 03 2014

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

0:07 sm0ke: ,(prn 'foo)

0:07 clojurebot: foo\n

0:07 sm0ke: ##(prn 'foo)

0:07 hmm being lazy?

0:14 noprompt: please stop the :use.

0:14 no more :use.

0:15 rootex: noprompt: not even in the repl?

0:15 sm0ke: ,{:use :use}

0:15 clojurebot: {:use :use}

0:15 sm0ke: :)

0:15 noprompt: rootex: that's fine. but i don't even do that. bad habits die hard. typing two letters isn't hard.

0:15 (:require [this.thing :as t])

0:15 t/x

0:16 but mostly i'm ranting about ns :use.

0:16 sm0ke: oh that use, yep i also dont use :use

0:16 noprompt: in library code.

0:16 sm0ke: (:require [abc.efgh :refer :all]) can be used un place f :use

0:16 right?

0:16 TravisD: noprompt: I agree that it's not very clear, but is there another reason?

0:17 (like, it can be difficult to know where functions are defined. Is that the only issue?)

0:17 noprompt: TravisD: because when i'm trying to read code, you know, to understand it, i have no clue where functions, etc. are coming from.

0:18 TravisD: that's the issue I mentioned :) No others?

0:18 sm0ke: noprompt: cant you do `where-are-you ?

0:18 noprompt: no that's about it.

0:18 sm0ke: ,`inc

0:18 clojurebot: clojure.core/inc

0:19 noprompt: i basically have to end up cloning the library, greping, nrepl-jumping, or some other form of sluthery.

0:20 sm0ke: hurm

0:20 noprompt: but hey it's cool. whatever bro, if that's your style.

0:20 sm0ke: sounds complicated

0:20 noprompt: sm0ke: well github search aint much beter.

0:21 sm0ke: moreover, does it matters if the library is using :use because it surely isnt propogated to your code

0:22 noprompt: sm0ke: context: i'm trying to READ the fucking code.

0:22 iow i'm trying to UNDERSTAND something.

0:22 sm0ke: oh ok got it

0:22 noprompt: lol

0:22 TravisD: noprompt: I wasn't saying it's okay to :use. I was just curious about the reasoning

0:22 sm0ke: yea me too

0:23 normally i dont READ code on github if really want to understand

0:23 i open up ide and jump to functions

0:23 but its ok bro, if its your style

0:24 noprompt: basically imho, if you're going to release a library for public consumption use :require :as because someday someone's gonna want to understand the code. if you have buckets of :use and a lot of namespaces it's basically like telling the would be reader of the code to go fuck themselves.

0:25 i mean it's pretty much like ruby's require 'lol' <= who knows what's in there?!

0:25 sm0ke: noprompt: If its so badly written chances are you will not work with it

0:25 noprompt: don't matter yo, cuz, it's so much easier to type :use than :require :as.

0:26 sm0ke: yea man pont noted.

0:26 its bad to use ;)

0:27 noprompt: the worst is that people do this in their READMEs which teaches new comers bad habits.

0:28 i mean even for internal projects it's a bad idea because YOU may have to come back someday and read that code.

0:28 tmciver: I've heard it said here many times: only use :use with :only.

0:28 noprompt: tmciver: and that's fine.

0:29 rootex: sm0ke: you use a IDE for Clojure?

0:29 sm0ke: rootex: i consider vim + fireplace as an ide

0:30 or whatever you want to call it, but it lets me jump onto runtime definitions

0:30 noprompt: sm0ke: did you mess with timl?

0:31 sm0ke: yep its nice

0:31 noprompt: hell if i hadn't invested all this time into evil-mode with emacs i might be jumping out a window over timl.

0:31 sm0ke: tpope has created a monster

0:32 :) jumping ships is never good man

0:34 otoh i am feeling a lot of lost souls using evil in emacs would come back to vim once timl gets well documented and has a few plugins written in it

0:35 sjl has written a plugin in timl https://github.com/sjl/tslime2.vim/blob/master/plugin/tslime.tim

0:35 noprompt: yeah...

0:36 i dunno. i'm pretty happy with me setup right now.

0:36 syntax highlighting is better in vim i'll say that though.

0:38 sm0ke: yea, i think that smart people will make better use of notepad than a snob with his fancy ides

0:38 also there is much more in emacs than vim for clojure

0:39 noprompt: hahaha

0:39 that's awesome.

0:39 sm0ke: isnt that true?

0:40 that isnt debatable emas is powered by elisp, which not to mention blows viml out of the waters

0:41 n_b: PHP practically blows viml out of the water ;)

0:41 I'm interested to see whether the NeoVim fork goes anywhere

0:41 noprompt: whoa hersey bro.

0:42 sm0ke: yep neovim is much anticipated

0:43 but i am not very sure about it. Can they deliver what moolenar has done for over 10 years

0:45 that too in 3 months? afa the funding goes

0:47 ruzu: what's the point of neovim again? some hipsters don't think the source is pretty, i guess?

0:47 seems more like self-pomotion bs

0:47 sm0ke: ruzu: :) dont burn it man

0:48 there are some sensible objectives, cant ignore that

0:49 yea but the source isnt pretty part was the first objective :D hahaha

0:52 hmm future looks scary for timl in neovim, timl -> viml -> lua -> luajit bytecode

0:59 TravisD: I kind of want emacs to have some nicer GUI features, like smooth scrolling, et

0:59 etc

1:00 noprompt: TravisD: https://github.com/noprompt/matilde/blob/master/emacs.d/init.el#L29-L31

1:01 TravisD: whoops! https://github.com/noprompt/matilde/blob/master/emacs.d/init.el#L25-L31

1:02 TravisD: noprompt: I have similar settings. I wish it didn't scroll one line at a time

1:02 it's a very small thing

1:06 Guest50112: I'm trying to test a namesapce containing an atom and this is what I'm getting

1:06 ERROR in (search-user-test-true) (core.clj:2108) expected: (= [] (search-user "username")) actual: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.util.concurrent.Future at clojure.core$deref_future.invoke (core.clj:2108)

1:06 can anyone help?

1:07 seancorfield: The exception says your variable isn't defined to have a value when it is used...

1:08 hiredman: Guest50112: you are derefing the contents of a var with no value

1:08 ,(def x)

1:08 clojurebot: #'sandbox/x

1:08 hiredman: ,x

1:08 clojurebot: #<Unbound Unbound: #'sandbox/x>

1:08 hiredman: ,@x

1:08 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.util.concurrent.Future>

1:09 sm0ke: hmm weird error

1:10 it assumes x to be a future, can only fututres be @

1:10 Guest50112: but at the start of the namesapce I've initilized the atom as (def search-details (atom {:search-term "" :count ""}))

1:11 sm0ke: Guest50112: can you show the test as a gist/paste?

1:11 seancorfield: maybe that's not what your code is trying to deref?

1:12 hiredman: or the code that is running is not what you think the code is

1:12 sm0ke: :D

1:12 hiredman: (unsaved file, stale repl state, etc)

1:25 maxthoursie: ,(clojure.math.combinatorics/selections '[b w] 3)

1:25 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.math.combinatorics>

1:25 maxthoursie: $(clojure.math.combinatorics/selections '[b w] 3)

1:26 can I use deps somehow?

1:42 amalloy: not in clojurebot or lazybot, no

1:43 TravisD: Are there tools for doing literate clojure programming?

1:45 beamso: literate?

1:45 TravisD: beamso: Literate programming is where you mix prose and code in a single document

1:46 beamso: sometimes there are tools that will produce nice PDFs of the files or run all the code and produce outputs

1:46 amalloy: there was a guy on the mailing list who was always going on about literate programming. is he still around?

1:46 TravisD: beamso: http://en.wikipedia.org/wiki/Literate_programming

1:46 I really like the idea, but I never manage to write the prose clearly enough to be of any use

1:47 beamso: have you seen https://github.com/gdeer81/marginalia before?

1:47 TravisD: and that makes me sad :(

1:47 I saw it after a quick google search, but wasn't sure if was the de facto standard

1:48 beamso: Ah, but that is pretty much exactly what I was looking for

1:51 amalloy: TravisD: there's no de facto standard: i don't know of anyone who seriously tries to write literate clojure. if they did, i guess they would probably use marginalia

1:51 TravisD: amalloy: Cool, thanks. Out of curiosity, what's your opinion of literate programming?

1:51 amalloy: i think it's a lovely ideal

1:52 i've never tried to become very well informed on it, but my impression is that nobody ever does a good job of it

1:53 TravisD: yeah, that sounds about right :)

1:54 alew: seems like literate code would be really awesome if it was released alongside research papers

1:54 TravisD: alew: That's one of the main reasons I wanted to start writing literate clojure

1:55 amalloy: every so often i read a well-written blog post, with code embedded in it, and they say "aha, gotcha! this was literate programming!"

1:55 but i don't really see why it's any better than writing a blog post and also some code

1:56 alew: TravisD: are you writing a dissertation?

1:56 TravisD: alew: yep :S

1:56 amalloy: like, how important is it *really* that you have a codebase that you can run generate-blog-post.sh on

1:57 TravisD: amalloy: the only advantage I can think of beyond the writing experience is that you get some guarantee that the code and results stay consistent

1:58 alew: amalloy: Well it might be cool to say that all your programmers are also authors and you're going to release a book simultaneously with the product :P

2:01 TravisD: what's the topic for your dissertation?

2:02 TravisD: alew: the title is "Gradient Methods for Reinforcement Learning"

2:03 I'm looking at a few different problems that can roughly be characterized by that title :)

2:03 alew: TravisD: I was just reading up on Reinforcement Learning recently as I had the thought that it must be pretty much how the first organisms evolved

2:05 TravisD: alew: ah, cool :) I'm not sure how much of a role it plays in evolution, but I think it's one of the mechanisms that animals have for learning motor skills and things. I have no psychology or biology background whatsoever, though

2:06 alew: if you want to talk more about it, perhaps we should move to private messages. This is getting pretty off topic

3:14 wagjo: Good morning (ugt) everyone

3:31 knight_: hi, How can I change my str encoding from utf-8 to gb2312 ? #(info (new String (.getBytes "测试") "GBK") %)) doesn't woks.

3:36 priyanka_: hey!!!! I am new to Clojure and need to test my web application.... can anyone tell me how to test the following html page rendering method : (defn login [& [pass]] (layout/render "login.html" {:user-pass-mismatch (vali/on-error :mismatch first)}))

3:50 vijaykiran: priyanka_: can't you use selenium ?

3:50 or https://github.com/semperos/clj-webdriver rather

3:51 priyanka_: can such functions be tested using clojure.test?

3:51 vijaykiran_ can such functions be tested using clojure.test?

3:52 vijaykiran: priyanka_: what do you want to test ?

3:52 priyanka_: This one

3:52 (defn login [& [pass]] (layout/render "login.html" {:user-pass-mismatch (vali/on-error :mismatch first)}))

3:54 vijaykiran: priyanka_: yeah, you said that already - what I meant what's the behaviour do you want to test ?

3:56 priyanka_: I'm using noir validations on the html page. How will I test this function if there's a password mismatch? As in, on password mismatch :user-pass-mismatch has a value "Password does not match"

3:56 and the html page displays that error

3:57 vijaykiran: priyanka_: I guess you should prefer using clj-webdriver to test what the output is in the browser

4:31 wunki: when you have a function which returns a boolean, is it OK to wrap a `when-let` in `boolean`. E.g `(boolean (when-let ...)`

4:33 instead of OK, I meant to say, idiomatic

4:33 cmdrdats: wunki: why would you need that?

4:34 beamso: wouldn't the idiomatic version be (if (predicate?) () ())

4:34 ?

4:34 ssqq_: How to make run a clojure script file more faster instead of use 'lein run'.

4:34 wunki: cmdrdats: because my function needs to return a bool, not a bool or nil

4:36 ssqq_: just a matter of opinion, but I find (if (predicate?) (...) false) ugly

4:38 ssqq_: one way is to use drip: https://github.com/flatland/drip

4:38 beamso: just a matter of opinion, but I find (if (predicate?) (...) false) ugly

4:38 beamso: i get that, but you asked for idiomatic

4:38 idiomatic need not be what looks good to you

4:39 ssqq_: wunki: thanks

4:40 wunki: beamso: yes, that's why I was asking, could well be the "uglier" version is the idiomatic way

4:49 clgv: wunki: nil is falsey, so just use when-let without the "boolean" except you really really really need a boolean, which you seldom do

4:50 wunki: and yes, (when (pred? ...) val) is idiomatic and NOT (if (pred? ...) val false)

4:50 ,(macroexpand-1 '(when (pred? x) y))

4:50 clojurebot: (if (pred? x) (do y))

4:51 clgv: that's what the when macro expands to ;)

4:52 ssqq_: Someone tell me that use repl with require or include 'script file' to make run faster.

4:53 wunki: clgv: thanks for the explanation. I wanted a boolean because my function name is `valid-credentials?`

4:53 clgv: implying a boolean is always returned

4:55 clgv: wunki: I wouldnt be so strict about that semantic associated with "?" since most of the time in clojure code there is no difference if you really get a boolean or something truthy/falsey

4:56 wunki: if it makes your code much more complicated it's probably not worth the effort

4:56 wunki: clgv: ok, I spend too much time in Haskell lately I guess

4:57 clgv: thanks for the insights

5:08 lgs32a: is there a clojurescript minor mode?

5:08 i only care for hl

5:08 (emacs)

5:09 donbonifacio: I'm feeling the urge to learn clojure

5:09 clgv: donbonifacio: then do not hesitate :)

5:14 lgs32a: cemerick: how much work do you think it would be to write piggieback so that it provides the clojurescript nrepl on a different port - so that I can fire up a second cider-jack-in for cljs?

5:16 ssqq_: Have Vim 7.4 support Clojure syntax highlight?

5:28 dioms: h

5:56 cemerick: lgs32a: Just connect to the same server; it'll be a totally different session. You can have N REPLs going at a time, each one can be either Clojure or ClojureScript.

5:58 lgs32a: cemerick: that is awesome. I will try that now

6:09 ssqq_: Have Java 8 support Tail recursion?

6:32 lgs32a: if I have multiple nrepls, what command do I use to tell cider which nrepl to use with a buffer (for e.g. c-c etc.)?

6:37 CookedGryphon: lgs32a: you can cycle through them with C-c M-r

6:38 lgs32a: CookedGryphon: thank you

7:06 tpope: bbloom: yeah not my circus, not my monkeys

7:19 harshita: hello i have found exception in clojure java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.util.concurrent.Future plz some one tell me why this exception is occured

7:21 wagjo: harshita: you have an unbound var somewhere. Most likely you have declared a var and forgot to define it later.

7:21 harshita: and most likely you were trying to dereference this var with @, which causes this casting to future exception

7:28 guns: grrr... Is there a way to delete a SNAPSHOT release on clojars? I Ctrl-C my deploy once I realized I was uploading a SNAPSHOT

7:30 clgv: guns: why? you can easily overwrite it with another snapshot or release something stable

7:31 guns: clgv: I tried that, but clojars says it's messed up

7:31 https://clojars.org/slamhound/versions/1.5.5-SNAPSHOT

7:34 clgv: guns: should work, see the following url there are 2 snapshots for 1.3.0 http://clojars.org/repo/slamhound/slamhound/1.3.0-SNAPSHOT/

7:35 and a release for 1.3.0 as well

7:35 http://clojars.org/repo/slamhound/slamhound/1.3.0/

7:36 guns: clgv: I see, thanks for the link. I'll just assume the page is cached or something

7:38 or actually, all the SNAPSHOT pages look like that

8:10 mskoud: hi

8:59 using map to generate a string from a list of maps, but the maps also has a value which must be summed. Hvo can i do this?

9:00 dnolen_: mskoud: sounds like you want reduce

9:01 AeroNotix: ,(macroexpand-1 '(ns lol))

9:01 clojurebot: (do (clojure.core/in-ns (quote lol)) (clojure.core/with-loading-context (clojure.core/refer (quote clojure.core))) (if (.equals (quote lol) (quote clojure.core)) nil (do (clojure.core/dosync (clojure.core/commute (clojure.core/deref (var clojure.core/*loaded-libs*)) clojure.core/conj (quote lol))) nil)))

9:01 AeroNotix: what's the need for the (if (.equals 'lol) 'clojure.core) here?

9:02 surely that could be removed and if peopole did that then it's Their Fault.

9:02 gfredericks: well it does happen once

9:02 AeroNotix: is (ns clojure.core) evaluated twice, somehow"?

9:02 mskoud: (map #(% :name) [{:name "a" :price 3} {:name "b" :price 5}]) : => ("a" "b") , would like to get 8 returned as well... without iterating again.

9:02 gfredericks: I just mean that the check is true at the top of src/main/clojure/clojure/core.clj

9:03 AeroNotix: mskoud: you want a reduce

9:03 gfredericks: with tjuxt

9:03 which doesn't exist

9:03 (reduce (tjuxt conj +) [[] 0] maps)

9:03 mskoud: ok. seperate the 2 issues and dot think about that i have to "iterate" again?

9:04 gfredericks: mskoud: you don't have to iterate again with reduce

9:05 AeroNotix: ,(doc tjuxt)

9:05 clojurebot: Gabh mo leithscéal?

9:05 AeroNotix: ,(doc 'tjuxt)

9:05 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol>

9:05 AeroNotix: WELL FINE

9:05 gfredericks: AeroNotix: I just said it doesn't exist

9:05 AeroNotix: oh didn't read that bit

9:05 what would tjuxt do?

9:06 ahh I think I understand

9:06 gfredericks: yeah my reduce doesn't make complete sense though

9:06 ,(->> maps (juxt :name :price) (reduce (tjuxt conj +) [[] 0]))

9:06 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: tjuxt in this context, compiling:(NO_SOURCE_PATH:0:0)>

9:06 gfredericks: that would be how you'd have to do it

9:07 ,(defn tjuxt [& fns] (fn [& tuples] (apply mapv #(apply %1 %&) fns tuples)))

9:07 clojurebot: #'sandbox/tjuxt

9:07 gfredericks: I think that's it

9:07 ,((tjuxt + *) [3 4] [4 5])

9:07 clojurebot: [7 20]

9:08 gfredericks: ,((tjuxt + *) [3 4] [4 5] [6 7])

9:08 clojurebot: [13 140]

9:08 mskoud: ok, thanks!

9:08 gfredericks: ,(def maps [{:name "a" :price 3} {:name "b" :price 5}])

9:08 clojurebot: #'sandbox/maps

9:08 gfredericks: ,(->> maps (juxt :name :price) (reduce (tjuxt conj +) [[] 0]))

9:08 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$juxt$fn__4213>

9:08 gfredericks: oh right

9:09 mmitchell: Anyone every seen this as a result of leiningen attempting to fetch dependencies? "java.util.zip.ZipException: invalid CEN header"

9:09 gfredericks: ,(->> maps (map (juxt :name :price)) (reduce (tjuxt conj +) [[] 0]))

9:09 clojurebot: [["a" "b"] 8]

9:10 gfredericks: emacs: I want to setup some alternate keybindings for cider, but doing it in a clojure-mode-hook doesn't work: https://github.com/fredericksgary/dotfiles/blob/master/.emacs.d/init.el.symlink#L189-191

9:11 I think it just silently fails to execute the rest of the function

9:14 ned-: /join #golang

9:14 gfredericks: ned-: hi welcome to #golang

9:14 ned-: why thank you sir!

9:15 caffeine pills do not work anymore ugh

9:15 gfredericks: please make sure to run all your comments through gofmt before sending them to the channel

9:15 ned-: gfredericks: lol.

9:15 bodie_: lol

9:15 ned-: gfredericks: ive ran into that same cider issue whent rying to rebind, im busy now but ping me in a few hours and ill try to help ya out

9:18 gfredericks: I love that tests for testing tools inevitably have to test that a test can fail and name things with english reassurances

9:18 clojure.test.check.clojure-test-test/this-is-supposed-to-fail

9:43 reiddraper: https://github.com/fredericksgary/test.check/commit/b6b24585a65807ab03b76e04727d230725181bed

9:43 the simpler test currently passes, but the more complex one fails (due to not implemented yet)

9:43 this is the same code I had two days ago, I just didn't have it on github yet

9:47 I feel like it should be rather simpler than this

9:51 a3gis: hey! would someone have a good talk to advise for a clojure beginner? I am actually new to any lisp family language

9:51 (I watched the serie by Brian Will already)

10:04 Guest84448: Hi, I'm using (clj-time.coerce/to-sql-date (new java.util.Date)) to insert date into postgresql and the inserted date is 2014-04-03. But when I'm trying to retrieve it from the DB, the date returned is 2014-04-02. How can I resolve this issue?

10:05 antonv: Guest84448: maybe it is timezone related somehow

10:08 gfredericks: a coworker was using test.check to test that dates roundtripped through the db the other day; the db type was a postgres timestamp without timezone

10:09 turned out there was one hour a year that didn't roundtrip

10:09 using the "with timezone" type fixed it

10:13 ambrosebs: gfredericks: badass

10:15 clgv: gfredericks: witching hour? :P

10:17 gfredericks: I believe it was the point when daylight savings time jumps back an hour, making that hour ambiguous since it happens twice

10:24 TimMc: NICE.

10:25 jcromartie: SWEET

10:26 mdrogalis: That's hella awesome, gfredericks

10:27 gfredericks: the funny part is that we were already using test.check in the project, but when I was thinking about testing db-timestamp-roundtripping I couldn't think of any reason to use test.check and figured a couple hardcoded examples would be sufficient

10:27 coworker used test.check anywas

10:29 reiddraper: gfredericks: very cool

10:30 jcromartie: sorry I actually missed the cool thing, gfredericks: what was that?

10:30 ambrosebs: http://clojure-log.n01se.net/#10:08

10:30 gfredericks: jcromartie: http://clojure-log.n01se.net/#10:08

10:35 TimMc: gfredericks: Shoulda been using https://en.wikipedia.org/wiki/International_Atomic_Time

10:37 gfredericks: POSIX time can be ambiguous around leap seconds.

10:38 * llasram frequently wishes Unix epoch time had been defined to be kind-of-TAI instead of kind-of-UTC

10:38 TimMc: although I guess TAI isn't defined before 1971

10:39 llasram: TimMc: Yeah, but the current definition of UTC wasn't specified until 1972

10:39 Unix epoch time was originally defined in terms of GMT

10:39 and was only later reconned to UTC-except-for-before-1972-where-we-fake-it

10:41 TimMc: Point.

10:43 pjstadig: humans shouldn't be allowed to mark the passage of time, and I'll just leave it at that

10:45 gfredericks: "TAI as a time scale is a weighted average of the time kept by over 200 atomic clocks in over 50 national laboratories worldwide."

10:45 TimMc: and adjusted to sea level, I believe

10:45 gfredericks: which is rising

10:45 locks: lol

10:45 gfredericks: hey that's interesting are we going to keep updating elevation stats as the sea level rises?

10:46 pjstadig: https://twitter.com/pjstadig/status/401349780359483393

10:46 locks: "Mount Fuji is the current tallest peak, standing at 102m" - Wikipedia, 2056

10:46 pjstadig: https://twitter.com/tef/status/410797003489427456

10:47 jcromartie: #FiveWordTechHorrors is always good

10:47 pjstadig: https://twitter.com/pjstadig/status/441646573806968832

10:48 i'm done

10:48 oh one more https://twitter.com/pjstadig/status/450406019525787648

10:48 mdrogalis: Mic drop

10:49 pjstadig: now i'm going to turn in my computer and become an orchard farmer

10:49 mdrogalis: Sometimes I want to do something like that.

10:50 locks: do it

10:50 "oh, let me just code a little calendar to help with the cro-D'OH"

10:50 clojurebot: Excuse me?

10:50 mdrogalis: Seriously though. Doesn't it occassionally drive anyone else nuts that you generally have to be creative every single day?

10:51 locks: mdrogalis: my code is pretty uncreative, so idk

10:51 mdrogalis: locks: Maybe that's the answer.

10:51 jcromartie: mdrogalis: being a programmer is existential torment

10:52 mdrogalis: jcromartie: Yup, that's it. Time to quit and head west to be farmer. IRC told me to.

10:52 jcromartie: "The http://en.wikiquote.org/wiki/Programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand http://en.wikiquote.org/wiki/Conceptual_structure...."

10:53 WTF is that OS X or Adium or wikiquote.org doing that?

10:53 locks: probably wikiquote

10:53 jcromartie: "The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures...."

10:53 locks: right-click hijacking is ugh

10:53 mdrogalis: Yuuuup

10:53 locks: jcromartie: that's so masturbatory

10:53 jcromartie: and yet, we build CRUD apps to track inventory

10:53 yes it is

10:54 locks: but it's true

10:54 clgv: right-click jacking is the DRM of around 2000 ;) :P

10:54 locks: yyeeaahh…

10:54 jcromartie: there's cognitive dissonance in the capability and the possibility that the *idea* of programming offers, and the reality of what needs to get done

10:56 mdrogalis: I came to #clojure to sober everyone up about our CRUD lives :P

10:58 jcromartie: thanks mdrogalis

10:59 mdrogalis: You're welcome everyone.


11:02 mskoud: Seems like pr-str can print stuf that read-string cannot read, getting a RuntimeException Map literal must contain an even number of forms.

11:04 lgs32a: nrepl question:

11:04 I have two nrepls running, one for clj and one for cljs

11:05 the files belong to the same project

11:05 how can I make sure that cider interacts with the correct repls in the specific buffers

11:05 gfredericks: multiple repls w/ cider has always confused the crap out of me

11:05 I mostly avoid doing that

11:06 lgs32a: this won't help

11:06 I want clj and cljs repls simultaneously

11:06 gfredericks: at worst you can have a shell buffer open with a traditional `lein repl` running there

11:06 lgs32a: i don't want that

11:06 gfredericks: but I do think cider is supposed to support this, I just know none of the details

11:07 sritchie_: I think you do C-c M-r to switch -

11:07 but I don't know how to tie each repl to a buffer

11:07 lgs32a: sritchie_: this results in changing the nrepl for the entire project

11:07 mikerod: So, I'm working with nrepl.el in emacs. I accidentally cause an infinite loop on the nrepl server. I kill the server at this point, but when I am in emacs it won't respond, as if it is still stuck in the loop. Is there any good way to get Emacs to get out of this?

11:07 I know I can just force-kill Emacs

11:07 sritchie_: lgs32a: yeah, I don't know how to tie each one to a specific buffer, I just sort of stick to clojure or clojurescript mode

11:07 mikerod: which is my current approach :)

11:07 sritchie_: mikerod: C-c C-c

11:08 kills the current running thread

11:08 mikerod: sritchie_: oh cool

11:08 gfredericks: emacs always responds promptly when I kill the jvm

11:08 mikerod: I figured there was something, I guess I didn't search for it hard enough

11:08 gfredericks: interesting

11:08 gfredericks: I'm using cider though

11:08 lgs32a: honestly, I find this is terrible

11:08 mikerod: gfredericks: I need to, I tried to update and got a bunch of errors, so I abandoned it. I need to take a look at that again.

11:09 gfredericks: mikerod: you gotta make sure nrepl.el isn't around anymore

11:09 mikerod: gfredericks: I thought I did, but perhaps I failed at that part. :)

11:09 lgs32a: what are my alternatives? vim won't be supported much better, lighttable is too early

11:09 mikerod: I'll dig into again since I'd like to stay up to date with the cider versions

11:09 clojurebot: Huh?

11:10 gfredericks: lgs32a: learn elisp and read the cider source code?

11:10 lgs32a: Yeah I did read it

11:10 gfredericks: what did you find out?

11:11 lgs32a: It's a mess

11:12 gfredericks: I guess there's just no good way to do clojure development. You should use another language.

11:12 stain: what's the best way to do content negotiation in a tiny Clojure REST app? I've found various bits and pieces around the Githubs. Ideally the way I want to do it is to just thread in a handler that converts the JSON to other formats.. I might just write that from scratch if there isn't anything.

11:13 gfredericks: stain: does liberator do that?

11:13 stain: sorry, I've used Compojure so far

11:13 perhaps, but it seemed a bit "taking over".. so not sure if it really is liberating!

11:13 it has the functionality, but I guess I woul dhave to restructure everything.. or can I use compjure with liberator?

11:14 sritchie_: stain: you can use compojure w/ liberator

11:14 stain: just use an ANY route

11:14 and liberator'll take over the route

11:15 stain: OK.. because now I have it like https://github.com/stain/scufl2-info/blob/master/src/scufl2_info/run.clj#L85 defines a compojure context, which I then just write in at the main app https://github.com/stain/scufl2-info/blob/master/src/scufl2_info/handler.clj#L13

11:16 so would I let Liberator just take over at the top level?

11:16 it seems to me I would have to replicate every endpoint per every format

11:18 I'll give it a go

11:18 two random voices on the internet mentioning the same project.. so it can't be too bad. Also it does the Vary header for me, so that's a plus!

11:19 what about exception handling..? I want to be able to throw an exception 4 levels in, say because a parameter passed in is not a non-negative Integer - and give an appropriate HTTP error code rather than a 500. Anything exist for that, or should I make like a NotFoundException etc?

11:20 .. and catch it with another middleware

11:27 clgv: ,(apropos "exception")

11:27 clojurebot: ()

11:27 clgv: ,(apropos "info")

11:27 clojurebot: (ex-info)

11:27 clgv: ,(doc ex-info)

11:27 clojurebot: "([msg map] [msg map cause]); Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data."

11:28 clgv: stain: you can use that ^^

11:29 gfredericks: stain: if you stick a :bad-request key in the map, or similar, you can catch it easily in a middleware with github.com/fredericksgary/catch-data

11:32 asthasr: Hey guys! Random question time. If I want to have non-blocking queueing of I/O (i.e., a file writing queue) but want to wait on all of them to complete before moving on to another step, what's the standard way to do that?

11:33 My initial attempt used agents, but somehow that ended up leaking memory all over the place, and trying to use shutdown-agents to force everything to resolve just caused my program to hang... :-\

11:33 coventry: lgs32a: To get around the "which repl should the code go to" I run the cljs and clj repls in separate emacsen, and use one for cljs, one for clj. Still a bit clumsy, but it mostly works.

11:34 asthasr: Should I do something like put promises in an atom, constantly appending to it with all of the promises, and then just loop over it asking for the values?

11:34 (this seems a little gross, because it's a side-effect I'm after, i.e. file IO, not the value)

11:37 coventry: asthasr: How does the waiting thread know that all the file writing is done, if it can be queued up from multiple threads?

11:38 stuartsierra: asthasr: core.async could be one tool for that

11:40 asthasr: coventry: True.

11:40 stuartsierra: Thanks.

11:42 coventry: I was actually curious about how you addressed that issue in your earlier implementations, because it would effect the answer.

11:43 asthasr: coventry: I didn't think about it. My agent approach was very naive, and I didn't address the issue.

11:43 coventry: Previously I'd just been doing the file IO in the loop, my attempt was to make it non-blocking

11:44 (this is the first time I'd used agents, and I've applied pmap a couple of other places, my naivete is because pmap is so nicely transparent I guess I was thinking of the IO issue too simply)

11:44 stuartsierra: Is there a good tutorial on core.async?

11:45 abaker: question on clojure best practices -- have an API that returns a list of things (via a network resource), is it idiomatic to provide only a lazy version of that list, a regular eager list, perhaps both and let the user pick?

11:45 asthasr: coventry: My biggest issues are, if the writing is async, it still has to be atomic (i.e. one line at a time), like a logger stream; and all of the writes have to happen.

11:46 abaker: I'm not an expert, but I would think the best would be lazy only. After all, can't the user simply call doall on the LazySeq to get a realized list?

11:47 coventry: asthasr: Oh, OK. A core.async channel is a good way to ensure that.

11:48 asthasr: that is to say, maintaining one version seems superior for your purposes, and calling (doall (get-expensive-resources)) is not much of a burden for the consumer

11:48 coventry: Cool. Is there a good article on them?

11:49 coventry: And is there a good way to say "Okay, main thread, now you wait until all those channels are done with their writing."

11:49 coventry: This is pretty good. The video for the talk must be out there somewhere by now. https://github.com/halgari/clojure-conj-2013-core.async-examples

11:50 stuartsierra: That video should be on the Clojure TV channel on YouTube.

11:50 abaker: asthasr: thanks, that does seem like the natural way ahead

11:51 tbaldridge: coventry asthasr: video for that code https://www.youtube.com/watch?v=enwIIGzhahw

11:52 asthasr: tbaldridge: thanks

12:06 lgs32a: gfredericks: coventry: sritchie_: I wrote this to allow you to associate any open nrepl connection directly with a buffer https://www.refheap.com/71069

12:06 (instead of having to change the global connection)

12:09 gfredericks: lgs32a: sweet! thanks

12:10 (inc lgs32a)

12:11 stain: clgv / gfredericks: great, an Exception with a map was basically what I would make!

12:12 gfredericks: stain: yeah, clojure's built-in is great for throwing but still clunky for catching

12:12 rasmusto: does make-parents destroy directories if they already exist?

12:16 rootex: is the use of exceptions a normal/frequent thing in Clojure?

12:16 gfredericks: much more frequent than the Either monad

12:18 * rootex googles either monad

12:18 mdrogalis: I still don't *get* monads.

12:18 Maybe it's just me.

12:19 rasmusto: ~Maybe

12:19 clojurebot: Pardon?

12:19 tbaldridge: mdrogalis: they're a nice abstraction....of something that rarely needs to be abstracted, imo.

12:20 mdrogalis: tbaldridge: I guess therein lies the problem.

12:20 hiredman: I know I've seen people complaining about compilation errors involving clojure.core.cache/through in here before, does anyone know what the resolution to that is?

12:20 mdrogalis: I should just suck it up and learn Haskell.

12:20 arrdem: mdrogalis: take me with you :P

12:21 technomancy: learning monads in a dynamic language is like learning FP in ruby

12:21 theoretically possible

12:21 arrdem: mdrogalis: I got frustrated trying to type foldr (Data.Map String Int) [Int] :P

12:21 tbaldridge: mdrogalis: I try that every once in awhile...and then I come to my senses after reading "Learn you a Haskell" for about 1 hour

12:21 gfredericks: (inc technomancy)

12:21 tbaldridge: The syntax is just too much for me I guess.

12:21 Bronsa: hiredman: IIRC you might have the last version of core.memoize and an older version of core.cache in the classpath

12:21 rasmusto: you're supposed to switch to some other book when LYAH stops making sense

12:22 hiredman: Bronsa: nuts

12:22 arrdem: LYAH is terrible :c

12:22 hiredman: technomancy: does deps :tree show plugin deps too?

12:22 rasmusto: arrdem: got a counter-pick?

12:22 mdrogalis: Heh

12:22 gfredericks: I enjoyed LYAH I think

12:22 tbaldridge: arrdem: I find the text in LYAH to be fine, the problem is I don't understand why I need ++ vs <- vs whatever other wacky syntax they devised.

12:23 technomancy: hiredman: no; no simple way to do that currently unfortunately

12:23 Bronsa: hiredman: yeah, if you're using core.memoize in a plugin, you cannot use the last version as lein has an older version of core.cache in its classpath because of stencil

12:23 tbaldridge: that's really it....I find the Haskell syntax too complex

12:23 arrdem: rasmusto: TBH I don't... I read LYAH and didn't get a lot out of it.. I have "Haskell the craft of functional programming" and some datastructures in Haskell books on my shelf... and bitemyapp 20 minutes south of me on call.

12:23 gfredericks: tbaldridge: fixity!

12:23 technomancy: Bronsa: I think the stencil thing was fixed on master; let me check

12:24 arrdem: Bronsa: got a minute to comment on GSoC stuff?

12:24 seancorfield: dnolen_: what is the best IRC channel to ask questions about Om?

12:24 rasmusto: arrdem: kk

12:24 Bronsa: technomancy: on master yes

12:24 hiredman: Bronsa: the only plugin I have loaded right now is eastwood

12:24 dnolen_: seancorfield: #clojurescript probably, but answer questions here too

12:24 "but I answer"

12:24 Bronsa: arrdem: I don't really have much time but tell me

12:24 mdrogalis: tbaldridge: How do you feel about Erlang, then?

12:25 technomancy: hiredman: well lookit that... someone added support for lein deps :plugin-tree

12:25 thanks, whoever did that

12:25 tbaldridge: much the same, but at least they know their syntax is bizarre. And Elixir fixes most of that.

12:25 pjstadig: technomancy: haha! open source FTW

12:25 Bronsa: hiredman: .. yeah. t.a.j requires the last core.cache, stencil from lein pulls an older core.cache

12:25 technomancy: ah, it was hyPiRion. should have known. ==)

12:26 oops

12:26 hyPiRion: ?

12:26 technomancy: the thing that confused me the most with ocaml was the precedence rules, which erlang doesn't really have problems with

12:26 hiredman: Bronsa: ah, so the new eastman doesn't work with older versions of lein?

12:26 technomancy: they're a lot less operator-happy

12:26 arrdem: Bronsa: Daniel Gomez commented on my proposal saying that there's interest from Rich in doing a lightweight clojure atop the existing compiler rather than atop your toolchain. I'm not such a fan but was wondering if you had compelling reason to move away from the existing compiler I could cite in a response.

12:26 technomancy: hyPiRion: the `lein deps :plugin-tree` feature

12:27 hiredman: Bronsa: or the reverse, the newest eastwood works with older versions of lein

12:27 seancorfield: 'k, I'll join #clojurescript then for a more focused discussion :)

12:27 hyPiRion: oh yeah, I think someone added an issue, and it was really straightforward to do

12:27 tbaldridge: arrdem: I was there for that meeting, it was a bit simpler than that. Rich said that most of the stuff has already been implemented before and reverted. Namely static vars and lazy vars.

12:27 gfredericks: hyPiRion: you must be wrong; technomancy said it was difficult

12:28 Bronsa: hiredman: you should ask Andy Fingerhut for that, but I think eastwood no longers uses :eval-in-leiningen to avoid that issue

12:28 gfredericks: perhaps you accidentally implemented something else

12:28 tbaldridge: arrdem: all you need to do is enable that code again, add compiler switches to turn them on and off, fix how things are handled with maven, and boom! you're done.

12:28 Bronsa: arrdem: err, it's written in java? :/

12:28 arrdem: Bronsa: that was my reaction :P

12:28 technomancy: gfredericks: hehe; I meant no way to do it without hacking lein

12:29 Bronsa: arrdem: also it's a closed system with no support for passes etc

12:29 pjstadig: is someone going to fix transitive AOT as a GSoC project, because I'd pay money for that

12:29 tbaldridge: arrdem: Rich's opinion was that this code could be done in a matter of a few weeks of work. Opposed to a matter of at least a year based on another compiler.

12:29 technomancy: arrdem: good way to keep people from submitting patches tho

12:29 Bronsa: arrdem: but I can see why Rich would want the Lean stuff to be done on the current compiler

12:29 tbaldridge: arrdem: a compiler that doesn't have 100% parity with the existing compiler, (no offense to Bronsa).

12:30 arrdem: pjstadig: shoulda written a project idea up GSoC apps are closed already

12:31 tbaldridge: I mean long term I think we need CinC, but if we can get what we want in a fraction of the time with existing compiler should we wait?

12:31 arrdem: tbaldridge: I mean if it's Rich's oppinion that upgrading the existing compiler is that trivial I'm happy to add a "code monkey the existing compiler before working on Bronsa's infrastructure" clause.

12:32 Bronsa: tbaldridge: right, support for that stuff is mostly already there in the Compiler, but I tested it a bit and it has a bunch of bugs

12:32 mdrogalis: What exactly are we talking about? I read up and still don't follow.

12:32 tbaldridge: yeah, perhaps that's a good route as well, that way the lean stuff can get into 1.7 and yet we can still do cool CinC stuff

12:33 arrdem: besides, it'll be an exercise for me in the existing compiler, which isn't a bad thing.

12:33 mdrogalis: https://www.google-melange.com/gsoc/proposal/review/student/google/gsoc2014/arrdem/5629499534213120

12:33 mdrogalis: and CinC at large

12:33 Bronsa: arrdem: I completely understand why it might be preferable to add support for that in Compiler.java first and in part agree. There's no way CinC is going to become "official" anytime soon

12:34 mdrogalis: arrdem: Ah, okay. Thanks

12:34 rootex: what would be the benefits of CinC besides not writting Java for the compiler anymore?

12:34 tbaldridge: Bronsa: yeah, although getting CLJS switched over will be a major step. I've been pushing hard to get that project approved.

12:34 mdrogalis: Was thinking the same thing, rootex.

12:34 arrdem: rootex: adding support for passes..

12:35 rootex: bringing cljs and clj onto one compiler in the long term...

12:35 rootex: potentially enabling cljc and other instanity on a common toolchain...

12:35 mdrogalis: arrdem: You mean additional compiler passes?

12:35 tbaldridge: mdrogalis: there are no passes currently. The sexprs get analzyed and that AST is compile directly to bytecode

12:35 arrdem: rootex: core.typed hooks into the compiler... the list goes on and on

12:36 Bronsa: tbaldridge: sure, even not considering the benefits of having one unified infrastructure, it will be definitely easier to integrate t.a in the official compiler for cljs and will provide really useful testing before we can think of making a move for clojure

12:36 arrdem: actually, since yesterday core.typed uses tools.analyzer.jvm :P

12:36 rootex: arrdem: thanks

12:36 arrdem: mdrogalis: that is to say it punts on "real" compilation and analysis to the JIT.

12:36 mdrogalis: tbaldridge: Oh, huh. I didn't know that.

12:37 arrdem: Bronsa: right. since yesterday. which is awesome! congrats!

12:37 mdrogalis: Interesting.

12:37 tbaldridge: nice! And core.async is switched over in a branch. I haven't tried to switch over core.async CLJS yet.

12:38 Bronsa: so if 1.7 gets feature expressions, writing clj/cljs tools based on tools.analyzer will become so much easier

12:41 arrdem: meh... I'm with Kevin here... platform specialization at read time feels dirty to me.

12:42 Bronsa: arrdem: it's not just platform specialization though. take tools.reader as an example

12:42 tools.reader and tools.reader.edn are almost the same code

12:42 ambrosebs: arrdem: FWIW It seems both projects are equally valuable. The tool.analyzer one is probably better suited for the 3 month timeframe of GSoC.

12:43 probably worth investigating whether extending Compiler.java really is just a few weeks work.

12:43 Bronsa: but I had to do a lot of manual copy-pasting simply because tools.reader.edn doesn't support a bunch of read-macros

12:44 asthasr: Re the haskell discussion earlier, I haven't gotten far in it yet but so far "The Haskell Road to Programming, Maths, and Logic" is pretty good

12:44 arrdem: ambrosebs: I'd agree with that... I have a spare week or two in my proposed schedule, so part of me was thinking about a rewrite to try and do the Compiler.java mucking about first, at the cost of letting the t.a work slip possibly.

12:44 asthasr: very textbooky, with exercises, which is good for me

12:44 Bronsa: with feture expressions or something like that I could just write the code one time, prefix #-edn the clj specific read-macros and load that code in the two different namespaces with 'edn in *features*

12:46 gfredericks: does autocompletion work with cider yet?

12:46 arrdem: gfredericks: sorta...

12:46 gfredericks: ac-nrepl is ported to cider and worked last time I loaded it

12:47 gfredericks: by just loading 'ac-nrepl' via marmalade?

12:48 arrdem: $google ac-nrepl github

12:48 gfredericks: more or less

12:48 ~botsmack

12:48 https://github.com/clojure-emacs/ac-nrepl

12:48 gfredericks: rightright

12:48 trying that now

12:55 ambrosebs: arrdem: It would probably be safest to choose to dedicate the entire time to either Compiler.java or tools.analyzer. This seems to be what Daniel is suggesting.

12:56 arrdem: ambrosebs: yep... after this conversation I think I'll reply and stick with tools.analyzer

12:56 ambrosebs: arrdem: for the safe of morale if anything

12:56 *sake

12:57 or go for the internship ;)

12:59 hlship: In Leiningen, is there a way to include a dependency w/o its transitive dependencies?

12:59 pjstadig: hlship: you can specify exclusions

13:00 technomancy: :exclusions :* would be interesting

13:00 pjstadig: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L48

13:00 technomancy: but currently not supported

13:01 Bronsa: ah btw tbaldridge I never had the chance to thank you for the talk you gave at clojure/west, I saw it and it was really good

13:01 hlship: Just switching from log4j to logback and it comes with a bunch of optional dependencies

13:01 lein deps

13:01 ambrosebs: tbaldridge: here here!

13:01 hlship: (woops, wrong window)

13:02 Guest77325: http://www.marketglory.com/strategygame/galahad1st for online gamers, if you didn't already, use this link to register on MerketGlory: a free2play financial strategy game where virtual currency can be converted into real money. It starts out slow but in time you can turn a good profit that is if you have the necessary patience to grow a little bit every day :P

13:02 arrdem: lawl @ spambot

13:03 pjstadig: who would have ever guessed that Guest77325 could possibly be a spammer?

13:04 tbaldridge: Bronsa, ambrosebs: thanks!

13:04 ambrosebs: tbaldridge: so I beat you to integrating tools.analyzer?

13:04 tbaldridge: ambrosebs: nah....I did my work a few months ago :-P

13:05 ambrosebs: tbaldridge: ah didn't realise it was in master

13:05 tbaldridge: I haven't published it yet though since I haven't figured out how I want to port over the CLJS macro

13:05 and no, it's in a branch

13:05 ambrosebs: unified analyser plz

13:05 tbaldridge: I may end up shipping the JVM side before I port the JS side. Simply because any work I do will have to get re-done once Bronsa does his GSoC stuff

13:06 what I need for the JS side is tools.analyzers.js

13:06 ambrosebs: that would be handy

13:11 tjd: i'm organizing my "external state" with stu sierra's components library ... and i'm thinking of making a "config" componenet on which all other components depend. not sure if this is a stupid idea or not. any thoughts?

13:12 stuartsierra: tjd: not stupid.

13:12 tjd: i'll take that as an authoritative answer :)

13:12 tbaldridge: a new age dawns for Microsoft?!?!? http://roslyn.codeplex.com/

13:12 mdrogalis: tjd: I do it, it works great.

13:12 stuartsierra: If getting the configuration requires calling an extra service like zookeeper then it would be very useful.

13:13 jcromartie: everybody keeps saying they are having success with stu's component library

13:13 stuartsierra: If your configuration is just data, like something you read from a file, then it might not be necessary to have a component for it.

13:13 tjd: so i've got (defrecord Database [config] ...) instead of (defrecord Database [host port username password dbname] ...)

13:14 stuartsierra: it's a file right now, but i am anticipating having to fetch it from an external resource in production

13:14 i feel like making it a component buys me that extensibility, for not a whole lot of upfront work

13:15 stuartsierra: That sounds reasonable.

13:15 tjd: thanks for that library, btw :)

13:15 stuartsierra: You're welcome.

13:16 tjd: i learned about it from your talk at clojure/west. i really appreciated how you talked about the tradeoffs at the end.

13:17 stuartsierra: I certainly don't want to claim that it's perfect. And there are some scenarios it deliberately doesn't try to handle

13:18 otfrom: what are people using for charting in clojurescript & om? c2 seems to overlap a fair bit with om. Anyone have examples?

13:19 danneu: I have a forum built with datomic. Each post has a {:post/topic <TopicRef>} attribute. And right now to show a topic, I naively (-> (:topic/_post topic) (sort-by :post/uid) (paginate 10)). Is there a faster way to do this now that some topics have a huge number of posts?

13:21 stuartsierra: danneu: you can use the index APIs to iterate over posts lazily, instead of loading them all at once

13:22 But you can only read them in the natural sort order

13:29 danneu: stuartsierra: would datomic ever support ordered sets on a has_many attribute? is that something people have ever asked about?

13:30 stuartsierra: danneu: storing ordered collections is certainly a question that comes up. I'm not aware of any specific plans

13:34 danneu: stuartsierra: cool, thanks

13:35 gfredericks: arrdem: how do I start ac-nrepl manuall?

13:36 arrdem: gfredericks: er... you M-x cider-jack-in RET and then M-x ac-nrepl-setup I think.

13:36 gfredericks: it's been a while.

13:38 * gfredericks hrms

13:39 arrdem: it's been a while and ac-nrepl was never too ahem tractable.

13:39 it either worked or didn't and I never manage to bludgeon it into submission.

13:47 ucb: what's the best/most idiomatic way of doing a conditional (.method Object) call in a (doto...) block?

13:48 justin_smith: ucb: you could use cond-> but once you have conditionals you may just want to make a let block binding the object and returning the object

13:48 ucb: hrm, yeah

13:48 TimMc: ucb: I think you don't.

13:49 gfredericks: TimMc: I used cond-> inside a doto once; should I be ashamed of myself?

13:49 ucb: TimMc: I'm all ears as to what's best here. I have a flag ala :config-the-thing? and I'd like the equivalent to (if do-the-thing? (.theThing Object) Object)

13:50 justin_smith: ,(doto "hi" (cond-> string? (println :OK)))

13:50 clojurebot: hi :OK\n"hi"

13:50 TimMc: Yes, but not necessarily for that.

13:50 ucb: err, s/do-/config-/

13:57 justin_smith: ,(cond-> :not-string string? println) ;what did I do wrong here?

13:57 clojurebot: :not-string\n

13:57 ohcibi: hi, I'm having an NPE with this function: https://gist.github.com/ohcibi/9959348 it happens in line 5.. does anybody has an idea what could cause this? I tried around setting all params to nil with the expression in line 5, but the NPE wont happen on the repl then

13:58 justin_smith: from reading the doc string that should not have printed

13:58 ,(doc cond->)

13:58 clojurebot: "([expr & clauses]); Takes an expression and a set of test/form pairs. Threads expr (via ->) through each form for which the corresponding test expression is true. Note that, unlike cond branching, cond-> threading does not short circuit after the first true test expression."

13:59 justin_smith: ohcibi: probably the npe is happening on the call to <=

14:00 ohcibi: justin_smith: hm, good point.. thanks

14:00 justin_smith: keyword as fn / = will not trigger an npe, ever

14:01 but if (:weight input) or (:token ...) return nil, that would make <= thrown an npe

14:01 stuartsierra: justin_smith: cond-> does not pass the threaded value to the test expression

14:01 justin_smith: ahh, that would explain it, thanks

14:02 stuartsierra: Is there a place to report a spambot that sent me a private message?

14:02 TimMc: ,(= (reify Object (equals [_ _] (throw (NullPointerException. "Oh yeah?")))) 5)

14:02 clojurebot: #<NullPointerException java.lang.NullPointerException: Oh yeah?>

14:02 TimMc: justin_smith: ^

14:03 justin_smith: TimMc: fair enough, got me on a technicality

14:03 TimMc: That's my job.

14:04 a3gis: yop! I've got a quick question: in the expression (f (+ 3 4)) where f is a macro, why is (+ 3 4) passed as a list and not evaluated first? Doesn't it behave like a function call?

14:04 TimMc: It's also a plausible scenario if you have a data structure checking for equality by parts.

14:04 gfredericks: clojurebot: TimMc is a DSL for getting you on a technicality

14:04 clojurebot: Alles klar

14:04 bbloom: gfredericks: sounds like a high-concept talk-idea for TimMc in the making

14:04 justin_smith: ~TimMc

14:04 clojurebot: TimMc is a DSL for getting you on a technicality

14:04 TimMc: a3gis: Because that's what macros are for!

14:04 Bronsa: stuartsierra: try #freenode

14:05 a3gis: TimMc: haha I know but I would expect it to evaluate (+ 3 4) unless I do (f '(+ 3 4)) if it behaves like a function call

14:05 TimMc: a3gis: Macros take in code and spit out other code. The later is what is evaluated.

14:05 *latter

14:06 gfredericks: bbloom: I'm a DSL for high-concept talk ideas

14:07 a3gis: TimMc: ok, but my point is that in the case of a function call, arguments are evaluated. So does the compiler somehow differentiate between a function call and a macro call and in the latter case does not evaluate the arguments (= quoted)?

14:07 bbloom: clojurebot: gfredricks is a DSL for seeding clojurebot with high-concept talk ideas

14:07 clojurebot: Ack. Ack.

14:07 bbloom: d'oh typo

14:07 ToxicFrog: a3gis: yes.

14:07 bbloom: clojurebot: gfredericks is a DSL for seeding clojurebot with high-concept talk ideas

14:07 clojurebot: Ok.

14:07 bbloom: clojurebot: forget gfredricks

14:07 clojurebot: Gabh mo leithscéal?

14:07 ToxicFrog: a3gis: macros are executed as part of compilation and are passed the code being compiled, not the result of executing that code.

14:07 justin_smith: a3gis: yes, that is exactly why macros exist, otherwise things like fn and let and def would be very very ugly

14:07 gfredericks: clojurebot: bblum is a DSL for seeding clojurebot with fun facts about slightly mutated people

14:07 clojurebot: 'Sea, mhuise.

14:07 TimMc: a3gis: Yes, the compiler knows that f is a macro as it is compiling that expression.

14:07 bbloom: :-)

14:08 ToxicFrog: a3gis: otherwise they would be heavily restricted - you would not, for example, be able to pass something "invalid" to a macro and have it generate valid code from it, which mostly defeats the purpose.

14:08 gfredericks: bbloom: that was how my name was spelled on the clojure 1.6 contributors slide at clojurewest

14:09 bbloom: gfredericks: i'll pretend like i wasn't too busy reveling in the presence of my own name to notice, such that i can blame that slide for my typo

14:09 a3gis: ok, that makes things clearer, thanks! (and sorry if the answer was obvious, I just started looking at lisp-family languages)

14:09 gfredericks: bbloom: my revelry is that I wrote ->

14:10 bbloom: gfredericks: are you saying that invented that macro?

14:10 ToxicFrog: gfredericks: wait, seriously?

14:10 justin_smith: a3gis: the easiest way to understand it may be to consider that macros are for creating syntax, and if the args were evaluated you wouldn't really be able to do anything with macros

14:10 gfredericks: well I thought I did

14:10 git blame is now telling me different

14:10 TimMc: http://dev.clojure.org/jira/browse/CLJ-1121

14:11 gfredericks: I'll try github's git blame

14:11 a3gis: justin_smith: yep; I mean I understand what macros are for, I just thought that the compiler wasn't making a distinction between function-calls and macros

14:11 gfredericks: oh right

14:11 justin_smith: gfredericks: github git blame often credits the one who did the merge rather than the author of the thing merged

14:11 gfredericks: I just didn't write the title line

14:11 a3gis: justin_smith: but since macros need to be excecuted at compile time it makes sense

14:11 gfredericks: this finds it: git blame src/clj/clojure/core.clj | grep -A10 'defmacro ->'

14:12 hiredman: I wrote a macro early on with clojure called |> and I thought it was really clever, until I found out about -> and ->>

14:12 ToxicFrog: hiredman: oh thank god it's not just me~

14:12 TimMc: a3gis: There are languages where you can have different evaluation strategies with macros.

14:12 ToxicFrog: Although I wrote |> in Scala.

14:13 rasmusto: 86bfa996 src/clj/clojure/core.clj 1552 (Gary Fredericks 2012-12-06 20:20:02 -0600

14:13 TimMc: a3gis: Check out fexprs, I think?

14:13 bbloom: you can tell git-blame --before or --follow or a few other things to trace changes back past attribution-overriding events

14:14 a3gis: TimMc: cool, thanks!

14:14 justin_smith: bbloom: cool

14:14 TimMc: Mind you I don't understand fexprs, so I can't help you understand them. :-P

14:14 a3gis: TimMc: also, is it common in a clojure project to define your own macros? or only when you need a DSL for some reason?

14:14 ToxicFrog: Anyways, gfredericks, [-> ->> some-> some->>] all own. Thank you.

14:14 bbloom: a3gis: not nearly as common as it would be in common lisp

14:14 TimMc: It's relatively rare.

14:14 gfredericks: ToxicFrog: I just rewrote them :P

14:15 bbloom: a3gis: i'd expect a project with a few dozen public API functions to have 0 to 3 macros

14:15 gfredericks: I can't claim anything actually cool, just that git-blame thinks I'm cool

14:15 a3gis: right, that's pretty rare indeed

14:15 justin_smith: a3gis: in my opinion macros are mostly for the rankest beginners who want to know how the language works, and the people implementing language features, those in between should usually avoid them

14:15 ToxicFrog: Aah

14:20 a3gis: justin_smith: ok! one last thing: any advice for a beginner in lisp family languages?

14:21 justin_smith: maybe visualize your program in terms of the flow of data from source to destination and the new versions created in between? I am sure the rest of the channel has better advice

14:21 clojurebot: Excuse me?

14:21 marcuscreo: I don’t think that’s how most lispers think of macro, justin_smith

14:21 justin_smith: marcuscreo: yeah, I did mark it very much as my opinion :)

14:21 marcuscreo: true!

14:21 ;-)

14:21 technomancy: a3gis: when in doubt, macroexpand

14:22 well, that and don't write macros

14:22 gfredericks: don't *write* macros, expand them!

14:22 arrdem: I think yall could back off on the "macros are evil" tack and point out that the don't generally do anything _good_ instead...

14:22 alandipert: write macros, they're awesome! you'll know you've written too many when your program stops doing anything

14:23 a3gis: haha ok, noted.

14:23 technomancy: arrdem: well he's specifically asking for beginners

14:23 bbloom: a3gis: if you're learning, write LOTS of macros... just don't ship them to people in libraries :-)

14:23 gfredericks: always do the *right* thing and never do the *wrong* thing

14:23 bbloom: a3gis: in fact, implement a simple lisp with macros

14:23 tbaldridge: (inc bbloom)

14:23 bbloom: a3gis: there is no better way to learn

14:23 technomancy: IMO the homoiconicity stuff is overrated compared to the mental shift of splitting out the pure parts of a program from the imperative shell.

14:24 syntax is superficial in comparison

14:24 tbaldridge: and besides writing macros will get you used to syntax quote which is useful in so many places.

14:24 michaniskin: just… wow. this conversation is preposterous

14:24 a3gis: technomancy: what's the big selling point of clojure if not homoiconicity then?

14:24 michaniskin: macros are a thing. accept it

14:24 bbloom: technomancy: maybe, but you can get that same mental shift from other languages

14:24 gfredericks: a3gis: immutable data structures

14:24 a3gis: technomancy: you can do the whole functional/imperative separation in scala for example

14:24 bbloom: technomancy: or rather other families of languages

14:24 technomancy: a3gis: well, *bad* syntax is a big impediment

14:25 bbloom: technomancy: homoiconic is not unique to lisp, but it's much easier to learn there

14:25 technomancy: good syntax just works

14:25 joelt: scala uses a ton of syntax.

14:25 gfredericks: Scala is a DSL for making new syntax

14:25 tbaldridge: When we write applications we want them to be extensible. I want my compiler to be the same. I'm just sad that Lisp doesn't go far enough (e.g. I can't extend the VM semantics)

14:25 justin_smith: gfredericks is a DSL for describing things as DSLs

14:25 seangrove: technomancy: In fact, I wish there were stronger ways of marking pure-from-impure functions

14:26 gfredericks: if you can't describe something as a DSL you're not trying hard enough

14:26 technomancy: seangrove: totally

14:26 * justin_smith commissions gfredericks to describe his lunch.

14:26 bbloom: tbaldridge: contribute to eclj! fork that bad boy and start adding the "precision jit" :-)

14:26 technomancy: seangrove: after Option, I'd say isolating Unit is the most useful thing HM gets you

14:27 gfredericks: justin_smith's lunch is a DSL for getting strawberry preserves all over your sleeve

14:27 tbaldridge: bbloom: It's on my list...

14:27 coventry: What is Option/Unit/HM?

14:27 bbloom: tbaldridge: i'm probably going to explore tools.emitter a bit before attempting jit. my code-gen skills suck generally

14:28 gfredericks: bbloom: hey this interesting

14:28 technomancy: coventry: HM is the hindley-milner type system; Option is a way of ensuring functions that may return None are handled correctly; Unit is the return type of a side effect.

14:29 tbaldridge: bbloom: nah, just emit clojure and run core/eval on it

14:29 bbloom: that'll get you most of the way there.

14:29 coventry: technomancy: Ah, thanks.

14:29 bbloom: tbaldridge: haha that's not a bad idea... would work for js too

14:29 a3gis: erm and on the whole functional programming side of things, do you guys have an opinion on clojure versus haskell?

14:29 bbloom: tbaldridge: i actually already do that in order to accomplish deftype

14:29 tbaldridge: bbloom: I noticed that last night

14:30 bbloom: tbaldridge: but sadly defprotocol doesn't work b/c it assumes a mutable method cache on the Function object... which my symbolic Fn record type doesn't have

14:31 tbaldridge: a3gis: .....that's like going to MoveOn.org and asking if people have an opinion on Obama vs Romney

14:31 joelt: a3gis: opinion of what kind? if you are interested in Haskell, check out Elm language, I thought it was more approachable, even though its very similar.

14:31 ToxicFrog: a3gis: I find Haskell more ideologically appealing but I actually get work done in Clojure.

14:32 coventry: Yeah, I think Clojure is more pragmatic.

14:32 joelt: a3gis: yeah i was going to say Clojure seems more practical than Haskell.

14:32 tbaldridge: a3gis: bbloom has a really balanced view about Haskell.....

14:32 :-P

14:32 bbloom: :-P

14:32 arrdem: lolz

14:32 amalloy: technomancy: calling Unit the return-type of a side effect doesn't seem right to me. it's a type inhabited by only one value; some side-effecting functions return Unit for lack of anything better to do, but stuff like read-data-from-file is a side effect whose return type is String (or whatever)

14:32 arrdem: famously balanced.

14:33 a3gis: tbaldridge: haha fair enough, I was just wondering because my uni is teaching haskell to freshers as an introduction to functional programming

14:33 bbloom: as much as i rag on haskell, i've learned a lot from it

14:33 ToxicFrog: Yeah, that's kind of my attitude

14:33 technomancy: amalloy: true; maybe "the side effect of writes" is better

14:33 ToxicFrog: Using Haskell has taught me a lot and given me more mental tools

14:33 bbloom: i view it as more of a wildly successful thought experiment than a language intended for use

14:34 ToxicFrog: But I don't actually do anything with it other than learn new things

14:34 I then take those things and apply them to the languages I do actual work in

14:35 joelt: a3gis: Haskell is "spooky" in that when you get the compiler to accept your program it runs correctly the first time, not something I'd say in any other language.

14:35 bbloom: joelt: yeah, that's not true... at all

14:35 can we please kill that trope?

14:35 joelt: bbloom: I know I'm not the first to say it though.

14:35 hiredman: bbloom: but it is an increasingly popular meme

14:36 Averell: It's still closer to half-true than with other languages

14:36 hiredman: bbloom: that is like the 4th or 5th time I've seen someone say it this week

14:36 joelt: I know first hand so I can't retract that statement.

14:36 justin_smith: similarly, natural language is remarkable because if you can manage to construct a grammatical sentence you can be sure the statement is true

14:36 bbloom: you have to run your haskell compiler as many times (or more!) as i have to evaluate forms in my repl before you get a successful compile or i get a sane output....

14:36 pjstadig: FACT: if your code type checks it has no bugs

14:36 tbaldridge: I suggest we give more time to another meme: "If that's the case then we should write every OS in Haskell. Then we'd never have a system fault again."

14:37 rasmusto: justin_smith: this statement is false

14:37 bbloom: rasmusto: that's his point...

14:37 * justin_smith explodes.

14:37 ToxicFrog: I will say that Haskell and Scala both have a higher rate of working on the first run than any other languages I've used. Clojure with core.typed is probably #3.

14:37 technomancy: it's as silly to say that happens all the time as it is to say that it never happens

14:37 michaniskin: FACT: in Haskell you don't need tests, because the compiler is enough!

14:37 tbaldridge: That's because you're already debugged them.

14:37 * bodie_ gathers the pieces of justin_smith and arranges them on the shelf in order of size.

14:37 rasmusto: bbloom: i'm just connecting dots slowly today

14:37 joelt: of course its a false statement, but its also the experience you get with haskell.

14:37 bbloom: ToxicFrog: yeah, what tbaldridge said echos what i was saying

14:38 bodie_: I get the sense that Haskell is less about programming and more about program definition.

14:38 hiredman: you can tell if you are in an echo chamber if suddenly as from nowhere the same thing is everywhere

14:38 bbloom: ToxicFrog: mandatory static typing just means that you debug your programs before they run, rather than after they've run... frankly, i rather run them and SEE the bug than get an abstract description of a hypothetical bug

14:38 bodie_: if you can flawlessly define your program, Haskell will do the rest for you. :P

14:38 yoheydere: (new java.lang.ProcessBuilder "python")

14:38 Is that syntax correct?

14:38 bbloom: bodie_: generally: most bugs are in the spec

14:39 Averell: that is the worst argument against strong typing i ever heard :)

14:39 joelt: Averell: hear hear.

14:39 arrdem: .... are we getting invaded by #haskell today?

14:39 wtf

14:39 technomancy: strong typing isn't a thing anyone actually argues against

14:39 bodie_: there's always Typed Clojure

14:39 hiredman: ,(macroexpand '(Foo. "bar"))

14:39 clojurebot: (new Foo "bar")

14:39 pjstadig: technomancy: sigh

14:39 bodie_: most of the time, what you need is not a flawless program definition, but a good definition of what you want your program to actually do

14:39 yoheydere: Because I get "No matching ctor for class java.lang.ProcessBuilder blah blah".

14:39 bodie_: in my opinion

14:39 bbloom: Averell: i'm not arguing against strong typing, i'm arguing in favor of delayed verification

14:40 technomancy: ,(+ 12 "hello") ; hello strong types

14:40 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>

14:40 bodie_: lol

14:40 bbloom: frankly, core.typed is too little too late. a next gen dynamic language should come with a modern type system baked in, not as an after thought

14:40 hiredman: yoheydere: the processbuilder construct takes either a list of strings, or a java vararg of strings (which means it takes an array of strings)

14:40 a3gis: ok I think I got the general feeling about haskell on this chan xD

14:40 bodie_: see, you shouldn't have tried to add 12 and "hello" ;)

14:40 yoheydere: hiredman: I see, thanks.

14:40 tbaldridge: This is when I link this video

14:40 Averell: fine, i was lax with my terminology. seeing the crash at runtime is still worse.

14:40 tbaldridge: https://www.destroyallsoftware.com/talks/useing-youre-types-good

14:41 bbloom: Averell: compile time is just run time for the compiler

14:41 exceptions aren't crashes...

14:41 arrdem: tbaldridge: oh gods...

14:41 bodie_: clearly technomancy's program definition was poor

14:42 Clojure lets that be your responsibility

14:42 Haskell doesn't

14:42 ToxicFrog: bbloom: in general I would much rather see the potential bug at compile time, because seeing it at runtime is not, generally, reliable. The bugs that make me swear at dynamic typing aren't the ones where it dies instantly with an obvious stack trace, it's the one where it fails one time in a thousand when it hits a rarely-used codepath that your tests missed.

14:42 bodie_: there's a good argument for each, respectively

14:42 ToxicFrog: But which would trivial fail typechecking.

14:42 *trivially.

14:43 Averell: i don't think that you rather have runtime failures is one of the good ones.

14:43 bodie_: again, if your tests missed it, Clojure would say that's your problem, not the compiler's

14:43 ToxicFrog: < tbaldridge> That's because you're already debugged them. -- Yes. I am saying that I like debugging my code before it actually runs.

14:43 bbloom: ToxicFrog: so run a type checker as part of your test suite....

14:44 gtrak: tbaldridge: genius!

14:44 bbloom: ToxicFrog: i'd rather not be interrupted by the global type checker while i'm solving a local problem. i don't care if the bug is caught at compile or run time, i care that they are NOT caught during unrelated-development-time. as long as they are caught at before-deploy-time i'm happy

14:44 ToxicFrog: bbloom: with scala and haskell, I get that for free at compile time. With Clojure, I get it with core.typed. But not all dynamically typed languages have useful static type checkers.

14:45 a3gis: tbaldridge: hahaha gary bernhardt is always a lot of fun

14:45 bbloom: ToxicFrog: consider javascript.... you can pick what type system you want

14:45 ToxicFrog: jshint is essentially a bag of ad-hoc type systems

14:46 or you can pick Google Closure compiler

14:46 which has a real type system

14:46 the problem isn't static vs dynamic, the problem is cultural

14:46 ToxicFrog: I'm not sure why you assumed I'm using javascript.

14:46 bbloom: is there a *default* and automatically available type checker

14:46 i didn't assume that, i said "consider"

14:46 bodie_: javascript is the ultimate sloppy dynamic language, just a good example :P

14:46 joelt: bodie_: ++

14:46 bbloom: jshint catches lots of dumb bugs

14:47 if js was a better designed language, jshint could catch more bugs

14:47 ToxicFrog: Yes, and so does core.typed. Neither are available for, for example, Lua.

14:47 bbloom: https://github.com/philips/lualint

14:47 bodie_: i wonder what language that is written in

14:47 lua... interesting

14:47 bbloom: lol that was just a random result

14:47 not saying that's any good

14:47 arrdem: core.typed catches dumb bugs.. when you can explain the types of what you are doing to it.

14:47 pjstadig: i'm just glad that static type systems catch all kinds of bugs like buffer overflows, and sql injection, divide by zero errors and stuff

14:48 arrdem: pjstadig: I mean.. that's all stuff that you could do with a real userspace dataflow analysis like the Broadway compiler..

14:48 gtrak: implements NonSQLInjectable

14:48 bodie_: sql injection isn't a bug, it's a feature

14:48 :P

14:48 bbloom: pjstadig: there are type systems for catching those sorts of bugs! for example, microsoft has a c++ verifier for driver code: http://msdn.microsoft.com/en-us/library/windows/hardware/hh454825(v=vs.85).aspx

14:48 arrdem: pjstadig: and you can totally do taint analysis with Haskell's types, it's just awkward :P

14:49 pjstadig: well good

14:49 then it's an easy sell

14:49 bbloom: ToxicFrog: my point is that i favor optional, pluggable, modular type systems that *do not influence semantics* and live in the term language, not a separate type language

14:49 arrdem: bodie_: quiet in the peanut gallery, string formats are never a legitimate technique for code generation

14:49 bodie_: you can do a lot of things awkwardly in haskell

14:49 technomancy: ur/web has a type system that prevents internal links from 404ing

14:49 pjstadig: obviously there are no downsides, and only upsides

14:49 bbloom: technomancy: haha that's kinda awesome

14:49 arrdem: pjstadig: lulz...

14:50 bodie_: I get the sense that Haskell is all about right implementation while clojure is all about right action

14:50 gtrak: arrdem: sarcastic or have you not seen the cljs compiler?

14:51 bodie_: the drawback there is that "right implementation" is a really broad subject which requires you leave no stone unturned

14:51 while right action is only as complex as it needs to be

14:51 arrdem: gtrak: I can imagine the CLJS compiler, and I still hold that opinion firmly.

14:51 bbloom: gtrak: that's by far the worst part of the cljs compiler :-P

14:51 gtrak: sadly we depend on gclosure & they don't have a stable AST

14:52 gtrak: well, someone's gotta be doing the concatenation, might as well be us.

14:52 arrdem: gtrak: that isn't to say I'm clean of the sin of string code generation, but acknowledge your sins for what they are :P

14:52 especially when I come sailing by with the sqlmap/sqldump lulz boat

14:53 danstone: Sooo.... immutant, anybody using it? - tried spinning up connecting to my instance (fresh out the box) immediately gotten an error with core.cache/memoize deps... :S

14:53 arrdem: http://securityreactions.tumblr.com/post/81592960057/this-is-our-production-network-so-be-careful

14:55 gtrak: bbloom: yea.. I followed that rabbit hole myself trying to implement a feature in austin, tell me about it :-)

14:56 dnolen_: bbloom: gtrak: still not convinced that generating a proper JS AST has any real value beyond pointless NIH over the person years poured into Closure

14:56 gtrak: was trying to reload a browser repl on refresh with compiled cljs state, got stuck on a crazy gclosure stacktrace.

14:56 might settle for just clearing out the compiler state on refresh

14:57 couldn't figure out how to just take that as input and generate the right stuff to run it through the optimizer.

14:57 bbloom: dnolen_: agreed. you already know my position, but i'll reiterate for onlookers

14:58 creating a proper JS AST is only a good idea if we do all the optimizations on the CLJ side and have no need to optimize the outputted JS

14:58 tcrawley-away: danstone: come see us in #immutant and we'll see about getting you fixed up

14:58 bbloom: would be nice to have the JS AST as data so that the emitter can be functionally pure, but that's one of those "ew it feels icky" things that doesn't actually matter for a successful compiler

14:58 dnolen_: case in point Uglify is a total joke compared to Closure on Closure optimized source http://gist.github.com/swannodette/9939192

15:00 gtrak: have you look at my CLJS analyzer/compiler tutorial - it ends w/ putting the source through Closure optimization

15:00 gtrak: though I don't see why you want that in a REPL context really

15:01 (but maybe I missed something)

15:02 gtrak: dnolen_: I'll take a look, I was reverse engineering the closure/build function.

15:03 in a repl context, it would effectively provide the same state at the start that running a polling cljsbuild would give, though maybe I could just hack that in instead.

15:04 dnolen_: gtrak: closure/build is a bad place to start for anything do w/ the REPL

15:04 gtrak: https://github.com/swannodette/hello-cljsc/blob/master/src/hello_cljsc/core.clj#L317

15:05 gtrak: yea, I get what you're saying, but here's why I looked there :-): https://github.com/cemerick/austin/blob/master/src/clj/cemerick/austin.clj#L327

15:05 hit my head on it for about 6 hours, learned a lot :-)

15:05 so I was trying to concatenate the :compiled-cljs stored in analysis state with that repl bootstrap snippet.

15:12 ran into issues with dependency ordering, so i found the relevant functions, ran into an issue with a closure prelude, fixed that, then hit a weird exception in closure itself.

15:14 looked a lot like this one: https://github.com/emezeske/lein-cljsbuild/issues/155 java.lang.NullPointerException: Compiler.java:945 com.google.javascript.jscomp.Compiler.newTracer

15:22 doky: hello does anybody know how to swap list ? to update it when i remove/add item ?

15:23 gtrak: doky: huh?

15:23 brunov: (def t (f t))?

15:24 doky: gtrak: is it possible ? or only define new ?

15:24 gtrak: doky: you mean like a state-change?

15:24 coventry: doky: Do you understand about persistant data structures?

15:24 doky: gtrak: yes

15:24 arrdem: coventry: we just set! everything, right?

15:25 gtrak: try to express it as a lazy seq, first, then if you really need it, an atom or something.

15:25 doky: gtrak: ah ok thanks i will try it

15:26 gtrak: doky: maybe helpful ##(take 10 (iterate inc 0)))

15:26 ,(take 10 (iterate inc 0)))

15:26 clojurebot: (0 1 2 3 4 ...)

15:27 gtrak: ,(reductions + (range 10))

15:27 clojurebot: (0 1 3 6 10 ...)

15:28 doky: gtrak: i have list of user and need to decide who isnt/is in list when i get new data

15:28 gtrak: doky: sounds like a great use-case for filter

15:28 doky: gtrak: maybe it will works with drop to remove then ? or maybe filter ?

15:29 gtrak: as you wrote

15:29 gtrak: ,(filter even? (range 10))

15:29 clojurebot: (0 2 4 6 8)

15:29 gtrak: ,(remove even? (range 10))

15:29 clojurebot: (1 3 5 7 9)

15:30 doky: gtrak: hmm ... i will think how to check two lists with it

15:46 CapitalSigma: hello all

15:48 what's the proper way to map a java method over a list of objects? i was expecting "(map (fn [x] (.toUpperCase java.lang.String x)) ["some" "strings" "here"])" but that isn't working

15:48 jcromartie: ,(.toUpperCase "x")

15:48 clojurebot: "X"

15:48 jcromartie: ,(map #(.toUpperCase %) ["some" "strings"])

15:48 clojurebot: ("SOME" "STRINGS")

15:50 CapitalSigma: ah, okay. so i don't need to specify the type? if i had two different types of objects that both implement a .toUpperCase method, will clojure call the appropriate one on each?

15:50 jcromartie: and #(foo %) is just a shorthand for (fn [x] (foo x))

15:50 CapitalSigma: yes, it will

15:50 CapitalSigma: i.e. is clojure duck typed in some sense

15:50 interesting, thanks

15:50 jcromartie: reflection and some type hints

15:51 for instance, if you were to go in your REPL and say:

15:51 (set! *warn-on-reflection* true)

15:51 and then compile:

15:51 (fn [x] (.toUpperCase x))

15:51 you would see that reflection is needed to resolve .toUpperCase

15:51 but, if you defined:

15:52 (fn [^String x] (.toUpperCase x)) then Clojure will compile the function and treat the Clojure local x as an object of class String

15:52 and it will resolve to String.toUpperCase

15:52 you mostly don't have to worry about this

15:53 CapitalSigma: ah, okay. yeah i can't imagine that i would be disturbed by it -- i'm just very recently looking in to clojure and i'm curious

15:54 jcromartie: ,(let [f (fn [x] (.toUpperCase x))] (time (count (doall (map f (repeat 10000 "hello"))))))

15:54 clojurebot: "Elapsed time: 139.511392 msecs"\n10000

15:54 jcromartie: ,(let [f (fn [^String x] (.toUpperCase x))] (time (count (doall (map f (repeat 10000 "hello"))))))

15:54 clojurebot: "Elapsed time: 9.302624 msecs"\n10000

15:54 CapitalSigma: wow, that's a pretty big difference

15:54 jcromartie: but try to only worry about it if you notice that your interop code is slow :)

15:55 it's doing a silly thing 10K times

15:55 CapitalSigma: makes sense. that's good to know

16:10 tuft: just read that steve yegge software political spectrum essay. funny but also strangely satisfying to see clojure in the "conservative" category

16:10 jcromartie: clojure is all over the chart

16:10 gtrak: tuft: I like a lot of stuff he writes, but that one was really weird.

16:10 lemonodor: “A news feed of Clojure GitHub repos being talked about on Twitter”: https://twitter.com/github_clj

16:11 jcromartie: you can import a library and have a subset of your code be extremely conservative

16:11 tuft: jcromartie: yeah it was the difficulty in classification that was the satisfying part i think

16:11 jcromartie: while other parts throw caution entirely to the wind

16:11 http://content.worldcarfans.co/2013/7/30/big/1270233903587876992.jpg

16:11 gtrak: didn't have any zing value like the kindgom of nouns or the 'all class members are now public' essays.

16:11 tuft: gtrak: yeah -- he made it sound like clojure was a front for haskell or something, heh

16:12 gtrak: just forced and bizarre

16:12 technomancy: tuft: there's some backstory to that which he didn't refer to in the post

16:13 cbp: gtrak: I thought he had gone completely insane after that post :-P

16:13 technomancy: tuft: https://groups.google.com/forum/#!topic/seajure/GLqhj_2915A

16:13 "I tend to blog when I get upset enough about something, so left unchecked

16:13 I will most likely produce a volcanic rant about how Clojure is deliberately

16:13 trying to fend away potential new users with a shotgun and a mean glare."

16:13 oops

16:14 gtrak: the yes-lang stuff?

16:14 technomancy: yeah

16:14 gtrak: haha

16:14 I loved that

16:14 technomancy: I mean, this was the thread that led up to that

16:14 gtrak: clearly we should remove all lines on the road for fear of them 'limiting' us.

16:15 well, I'd be ok with getting rid of stoplights, actually.

16:15 at least in some cases :-)

16:15 mdrogalis: Just looked up Steve Yegge to find something and ran across this: "Clojure is strongly conservative, with a core overriding bias towards protecting programmers from mistakes."

16:15 I.. Don't agree with that at all.

16:15 The second part I mean

16:16 technomancy: mdrogalis: yeah, he's just got a bone to pick

16:16 coventry: Mistakes arising from state management, maybe...

16:16 mdrogalis: technomancy: I was actually digging for the Seajure post you were telling me about. :P

16:17 gtrak: thing is, clojure doesn't actually prevent you from doing anything.

16:17 technomancy: mdrogalis: get some popcorn too while you're at it

16:17 gtrak: he's talking about batshit stuff like for loops

16:17 gtrak: it just makes certain favored things much easier to do, but EVERYTHING is easier than in java.

16:18 mdrogalis: I think I found it, given that Rich posted

16:18 technomancy: he's also talking about the community more than the language

16:18 michaniskin: and macros are money in the bank

16:18 mdrogalis: https://groups.google.com/forum/#!msg/seajure/GLqhj_2915A/E0crn6zHLi0J

16:18 gtrak: like.. immutability needs to be idiomatic and easy, and it normally isn't.

16:18 clojure fixes that, but we can still write to java fields.

16:18 technomancy: like, you can write an imperative for macro, and people will make fun of you. and he's saying that's bad.

16:18 gtrak: if it's sufficiently clever and horrible, I'd applaud it again :-)

16:19 brehaut: lols about a language ‘protecting programmers from mistakes’ without AR static types and also including nil

16:19 mdrogalis: technomancy: God. lol "How do we make you more upset?"

16:20 People are just egging him on

16:20 technomancy: the problem is he's conflating clojure's policy of saying no to ptaches with the clojure community's policy of rejecting bad ideas

16:20 gtrak: 'Whenever I've blogged like that in the past it has been *incredibly* effective. People pay attention and get to work fixing whatever I ranted about.'

16:21 it's been 3 years already..

16:21 mdrogalis: I feel like I'm watching a movie as I read this.

16:23 gtrak: well, debugger tooling sounds like a good thing, we're still working on that.

16:23 but we need it less b/c of immutability ;-)

16:23 mdrogalis: So what I don't get, technomancy, is why he got upset in the first place? Did someone PO him and he just went crazy?

16:23 technomancy: actually it kind of sounds like he half meant to write this post: http://sealedabstract.com/rants/conduct-unbecoming-of-a-hacker/ but then got distracted with some other things and wrote something completely preposterous instead

16:23 mdrogalis: Or is he always like this?

16:24 Hahah

16:24 technomancy: all the stuff that actually makes sense that he's talking about is covered in the post above, but none of the crazy parts

16:24 mdrogalis: he was very reasonable when we were talking in person

16:25 (which is exactly the opposite of how you're supposed to do it; the optimal way is to say all your crazy inflammatory shit in person and be very reasonable and level in posts which are public record forever)

16:25 lemonodor: i read “"How do we make you more upset?” as someone hoping that yegge would give more details about his criticisms because they expected them to be worthwhile, not egging on.

16:25 brehaut: technomancy: he seems to be afflicted with being able to type exactly as fast as he can think

16:25 technomancy: #lifehacks

16:25 lemonodor: i met erik naggum in person. he was very friendly.

16:25 technomancy: hehe

16:26 lemonodor: lots of smiles.

16:26 mdrogalis: lemonodor: I'm an instrigator - my perspective :)

16:26 Instigator*

16:26 brehaut: is that an aligator that goes left and right ?

16:27 wait that would be an instagator

16:29 mdrogalis: *Skips to part where Rich replies*

16:30 technomancy: mdrogalis: there's more lulz in the HN thread too

16:30 jcromartie: (inc mdrogalis)

16:30 mdrogalis: Work day - shot

16:30 technomancy: I vaguely recall that going further off the deep end

16:31 therik: hello

16:32 mdrogalis: Well that was mildly entertaining.

16:40 a3gis: erm why isn't defn a macro?

16:40 gtrak: it is

16:40 tbaldridge: a3gis: it is

16:41 justin_smith: ,,(:macro (meta #'defn))

16:41 gtrak: a3gis: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L318

16:41 clojurebot: true

16:41 gtrak: defmacro is later ;-)

16:41 mdrogalis: Don't tell Steve Yegge that.

16:42 gtrak: true.. he'd want a forward declaration there too. stupid single-pass compilers

16:42 that make code readable

16:42 justin_smith: ,(map first (filter (comp :macro meta second) (ns-publics 'clojure.core)))

16:42 clojurebot: (when-first cond->> gen-class while import ...)

16:43 justin_smith: a3gis: in a repl the above will list all macros in clojure.core

16:43 a3gis: justin_smith: (macroexpand (defn hello [x] (* 2 x))) returns #'user/hello though?

16:44 gtrak: a3gis: quote it

16:44 justin_smith: a3gis: quote it

16:44 jynx

16:44 ,(macroexpand '(defn hello [x] (* 2 x)))

16:44 clojurebot: (def hello (clojure.core/fn ([x] (* 2 x))))

16:44 a3gis: oh right; great thanks!

16:44 mdrogalis: ,(doc when-first)

16:44 clojurebot: "([bindings & body]); bindings => x xs Roughly the same as (when (seq xs) (let [x (first xs)] body)) but xs is evaluated only once"

16:45 a3gis: an argument to macroexpand should always be quoted justin_smith?

16:45 justin_smith: a3gis: as far as I know? I wonder about the exceptions

16:46 a3gis: justin_smith: k; I don't really get when something should be quoted or not. I mean, I do get that quoted avoids evaluation, but as I asked earlier if you have (f (+ 3 4)) where f is a macro I would also expect the argument to be quoted

16:46 sritchie: a3gis: macroexpand isn't a macro

16:47 gtrak: a3gis: you have to understand what actually happens underneath

16:47 reader reads it into data, eval evals it, macroexpansion happens at that point.

16:47 coventry: You might not want to quote the input to macroexpand if you're testing some code-generation function.

16:47 gtrak: codegen emits jvm bytecode, object is instantiated, that's what you get as a return value.

16:48 quoted just means, don't eval it.

16:48 a3gis: oh right, ok

16:49 gtrak: macros see it as the same data structures that the reader emits

16:49 and it happens at a different time than a function call, that's the 'compile-time'.

16:50 you can grab the function value of a macro and call it yourself as a function if you're really curious ;-)

16:50 there are some extra args in the front, but it can just take data.

16:51 here we go :-)

16:52 ,(@#'defmacro nil nil nil)

16:52 clojurebot: (do (clojure.core/defn nil) (. (var nil) (setMacro)) (var nil))

16:53 blake__: &(reduce max (map count '( #{} #{:1} #{:1 :2} #{:1 :2 :3})))

16:53 a3gis: gtrak: right; I find it a bit confusing to have parts of your code which is executed in a different phase but I guess I will get used to it :p

16:53 blake__: ,(reduce max (map count '( #{} #{:1} #{:1 :2} #{:1 :2 :3})))

16:53 clojurebot: 3

16:54 doky: i'm trying to find out how to use filter function, can anybody help me with this small example ? https://www.refheap.com/71178

16:54 blake__: Hey, if I have the above situation, but I want the set the with three elements rather than just the number itself...Do I have to filter that or is there a better way?

16:55 rasmusto: you can use (set ["viktor" "jana"])

16:55 blake__: Set! I was gonna say "into #{}"...

16:55 doky: rasmusto: thank you :)

16:56 justin_smith: doky: maybe you want remove rather than filter there

16:56 rasmusto: doky: you can also use a set directly as a predicate

16:56 justin_smith: because u should be empty

16:56 rasmusto: ,(remove #{"a" "b"} ["a" "c" "b" "d"])

16:56 clojurebot: ("c" "d")

16:57 justin_smith: doky: oh, never mind, reading failure

16:57 a3gis: gtrak: mmh mind to explain what "@#'" means here?

16:57 bbloom: technomancy: aw man, i missed the steve yeggie rant. i didn't get a chance to link to https://en.wikipedia.org/wiki/Steve_Yegge#Server-side_JavaScript and mention how i know ppl that i really respect who worked with him at google and wrote him off as a crazy person

16:57 gtrak: steve yegge would be proud

16:57 clojurebot: Excuse me?

16:57 justin_smith: though remove would eliminate the need to use not

16:57 doky: rasmusto: yes i really want to do it thanks

16:57 justin_smith: no problem

16:58 gtrak: a3gis: #' means the var, @ derefs it to get the function, lemme see if it works with out that.

16:58 ah yea, deref isn't needed

16:58 a3gis: gtrak: so that's a special form?

16:58 gtrak: yea

16:58 #' is a reader macro

16:59 and so is @, but you could also use (deref ..) and (var ..)

16:59 technomancy: bbloom: I love how that was seen as really forward-thinking and visionary by a lot of people

16:59 gtrak: a3gis: while we're on the subject, reader macros work at read-time

16:59 before compile-time even

16:59 ,(read-string "@a")

16:59 clojurebot: (clojure.core/deref a)

16:59 a3gis: gtrak: I was actually googling that

17:00 coventry: What's the selling point for server-side js, anyway? Just that you can have the same language on client and server?

17:00 bbloom: technomancy: i think he's proof that if you write A LOT and try to avoid saying anything too stupid, then people will find SOMETHING to agree with you about

17:00 technomancy: it's like politics, you just tell everybody what they want to hear & they'll ignore all the stuff they don't care about

17:00 blake__: coventry: Yeah, pretty much. You can share libraries and what-not.

17:01 gtrak: coventry: we can get our lean-runtime with cljs on nashorn :-)

17:01 not sure if that's actually leaner yet

17:01 technomancy: bbloom: his posts about emacs are actually really good

17:02 bbloom: technomancy: you're proving my point :-P

17:02 technomancy: sure =)

17:06 justin_smith: coventry: it means that one guy can do client and server sides of a small app, in terms of workplace flow it can boost productivity

17:07 and reduce the need for an design that isn't duct tape and string :)

17:07 a3gis: gtrak: erm so with a reader macro you could potentially parse json into maps or something like that?

17:07 gtrak: a3gis: yea, cljs has one that does the opposite

17:08 coventry: justin_smith: Because it cuts down on communication costs? I guess that makes sense.

17:08 gtrak: a3gis: http://dev.clojure.org/jira/browse/CLJS-717

17:08 justin_smith: coventry: and the inefficiencies that can come with collaboration

17:08 gtrak: a3gis: 'tagged literals' are just a special, extensible reader macro

17:09 a3gis: gtrak: wait so you could literally embed anything inside a clojure program (like xml literals in scala) with the appropriate read macro?!

17:09 gtrak: hrm.. I think it still has to be valid clojure data

17:09 a3gis: oh ok

17:10 gtrak: because that just gets passed into a function at read-time, and the reader has to understand how to parse it

17:10 justin_smith: a3gis: it would confuse emacs, thus it would not fly

17:10 :)

17:10 a3gis: justin_smith: as long as it doesn't confuse vim...

17:10 tuft: how does one set up read macros, btw? i was trying to use some datomic # literals the other day and couldn't figure it out...

17:10 gtrak: ie, you can't specify what's a token or not, just how to deal with the data.

17:11 a3gis: gtrak: right that makes sense

17:12 gtrak: tuft: http://clojure.org/reader#The Reader--Tagged Literals

17:13 sritchie: a3gis: that's how it is in common lisp, btw

17:13 you can embed, like, XML or Python directly, and have the reader macro parse it into valid data

17:13 a3gis: sritchie: clojure is the first lisp-family language I am learning though

17:13 sritchie: but if you can do that kind of thing it's really cool :o

17:14 gtrak: slightly terrifying :-)

17:14 I balk enough at DSL's as it is

17:14 sritchie: :)

17:14 a3gis: haha well I didn't say you should actually use it but it's nice to have that power

17:16 gtrak: you can get it here, just not inline in the source

17:16 or use your own reader :-)

17:17 tuft: gtrak: thanks

17:17 gtrak: or just embed python, we're on the jvm

17:32 lemonodor: bbloom: when i was at google, i didn’t work with yegge but he created some really useful tools and his posts (“we don’t get platforms”) etc. were pretty right on

17:32 bbloom: lemonodor: i'm not saying he's of no value, he's written some things i quite like

17:35 blake__: Aha!

17:35 ,(last (sort-by count '( #{} #{:1} #{:1 :2} #{:1 :2 :3})))

17:35 clojurebot: #{:1 :2 :3}

17:36 amalloy: blake__: ##(doc max-key)

17:36 Raynes: lazybot still seems to be having trouble talking

17:36 ,(doc max-key)

17:36 clojurebot: "([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."

17:36 Raynes: $kill

17:36 * Raynes bobs lazybot

17:36 Raynes: bops*

17:37 $kill

17:37 plz

17:37 lazybot: KILL IT WITH FIRE!

17:37 Raynes: Thnx

17:37 * bbloom can't tell if plz is an actual command or not

17:38 Raynes: It isn't.

17:38 blake__: amalloy: That doesn't look like the same to me. I guess could map count and then use it?

17:38 amalloy: &(max-key count #{} #{:1} #{:1 :2} #{:1 :2 :3})

17:38 lazybot: ⇒ #{:1 :3 :2}

17:39 blake__: So...clearly it is. =P

17:40 Oh, okay. Literacy problem.

17:40 justin_smith: blake__: you would need to use apply if all of the things are in a list

17:40 gtrak: I have never used that function

17:41 looks useful though :-)

17:41 reminds me of the github based clojure.core heatmap I want to write.

17:41 blake__: Wait, my real example is giving me a different result.

17:42 amalloy: blake__: you probably made the mistake justin_smith just warned about

17:42 blake__: the apply?

17:42 amalloy: indeed

17:42 bbloom: &(max-key count [#{} #{:1} #{:1 :2} #{:1 :2 :3}])

17:42 lazybot: ⇒ [#{} #{:1} #{:1 :2} #{:1 :3 :2}]

17:42 bbloom: &(apply max-key count [#{} #{:1} #{:1 :2} #{:1 :2 :3}])

17:42 lazybot: ⇒ #{:1 :3 :2}

17:44 blake__: OK, that works. WTF was I getting before? *puzzles*

17:44 Everything? %^P

17:46 Oh...okay, so without the apply, I have just one item of everything, which is returned.

17:48 justin_smith: right

17:49 nesting levels, the hurdle that trips every learner at least 100 times

17:49 blake__: Hey...only 87 times to go...

17:51 gtrak: get used to it, it's lisp after all

17:51 TravisD: ooh, get used to what? I just joined

17:51 gtrak: traversing levels of nestedness :-)

17:52 with your mind!

17:52 justin_smith: and errors caused by anticipating the wrong level of nestedness

17:52 TravisD: is nestedness really a lisp thing?

17:52 blake__: I'm getting there.

17:52 gtrak: maybe just the uniformity of the nesting

17:52 blake__: lists of lists

17:52 justin_smith: TravisD: in another language it would be method not found / type errors

17:53 gtrak: makes it look like a bowl of macaroni

17:53 instead of OO spaghetti

17:53 TravisD: justin_smith: I wasn't here for the earlier conversation. Not sure what errors are being discussed

17:53 justin_smith: for dinner I will have ravioli, stuffed with ravioli, stuffed with ravioli, stuffed with nil

17:53 ahh, just generic "too many / few levels of sequence expected"

17:53 gtrak: you can't unsee it: http://images.pictureshunt.com/pics/m/macaroni-5853.jpg

17:53 pjstadig: mmmm ... spaghetti O's

17:54 TravisD: gtrak: Heh. All those little delicious parens

17:57 brehaut: adding ‘cat throws up on the carpet’ to list of things that take me out of the coding zone

17:59 yedi: in om: i have a block of text (with new lines, other spaces). I also have a map with a mapping from index of a word in the text=> to color. I want each word in the block of text to have a background color according to the word=>color mapping

18:00 i was going to create a function that returned a span wrapping the word with the proper color applied. and then map that function to the text split on whitespace

18:00 however when rednering this, all the whitespace would get removed

18:00 is there a better way to accomplish this and preserve white space

18:01 justin_smith: yedi: convert white spaces to html entities representing white space as appropriate?

18:02 coventry: Try (apply str (interpose " " spans))

18:02 amalloy: coventry: never (apply str (interpose anything)) - it's just clojure.string/join

18:02 coventry: Oh, I guess str isn't appropriate anyway.

18:03 Thanks, had forgotten about join.

18:03 yedi: justin_smith coventry amalloy: here's some starting code: https://gist.github.com/yedi/9963775

18:04 gtrak: staring at the macaroni makes me both uncomfortable and excited.

18:04 yedi: my main issue is that i have to get rid of the whitespace in order for the indexes to be correct. (since the indexes are only for words)

18:04 gtrak: uncomfortable because of the disorganization, excited because of the possibilities.

18:05 yedi: it'd be cool if i could split on whitespace but still retain the whitespace info. and then call the word-span fn on just words (while preserving the index correctly), and render the whitespace normally

18:05 not sure if any of that made sense

18:08 amalloy: yedi: i mean, there's partition-by

18:08 blake__: yedi: Don't you retain the whitespace info by virtue of still having the original immutable string around?

18:08 justin_smith: ,(partition-by #{\space \tab \newline} "this is a string\nwhatever")

18:08 clojurebot: ((\t \h \i \s) (\space) (\i \s) (\space \space) (\a) ...)

18:08 justin_smith: that could help?

18:08 coventry: (do (require '[clojure.string :as s]) (s/split "foo bar baz" #"\b"))

18:08 ,(do (require '[clojure.string :as s]) (s/split "foo bar baz" #"\b"))

18:08 clojurebot: ["" "foo" " " "bar" " " ...]

18:09 coventry: That's going to break on punctuation, though.

18:09 doky: is it possible to to extract from set of maps -> list of values for key (for example :name) ?

18:10 without to do it through sequence ?

18:10 justin_smith: (map :name #{{:name "a"} {:name "b"}}) ; don't know if you mean set of maps literally

18:10 ,(map :name #{{:name "a"} {:name "b"}}) ; don't know if you mean set of maps literally

18:10 clojurebot: ("b" "a")

18:10 yedi: thanks for the help guys, partition-by looks promising as well splitting on \b

18:11 justin_smith: if you can make native string/regex stuff work, that will perform better

18:11 doky: justin_smith: woow thanks :)

18:14 justin_smith: doky: yeah, clojure is good at that kind of stuff

18:14 doky: justin_smith: yes it is but im not as good as i should :)

18:15 justin_smith: i think that sometimes it os really hard to construct this stuff

18:16 gtrak: doky: you just gotta memorize clojure.core, 4clojure will help with muscle-memory.

18:16 AimHere: Well the clojure cheatsheet is my go-to clojure reference

18:16 For those bits I never quite memorize

18:17 doky: gtrak: AimHere thanks i will try it :)

18:35 yedi: gawd i just love the repl

18:36 justin_smith: yedi: indeed, I think large numbers of small rewarding tasks is pretty much the perfect structure for acquiring a skill

18:37 (or solving specific problems for that matter)

18:39 brehaut: with Om, how do you make render output two sibling nodes without wrapping them in some container element?

18:40 seangrove: brehaut: You'll need to wrap them

18:40 brehaut: seangrove: well, thats a bit pants then

18:40 Guest88442: hello, learning clojure right now, what does ^ mean? i.e. ^HtmlPage

18:40 seangrove: It is what it is

18:40 brehaut: Guest53104: metadata

18:40 Guest88442: Metadata>

18:40 ?

18:41 brehaut: Guest53104: it associates the metadata {:tag HtmlPage} with the following form. 

18:41 justin_smith: specifically in that case, it is a type hint, telling the compiler what type a binding should have

18:41 or maybe not?

18:41 brehaut: justin_smith: s/should/probably/

18:42 justin_smith: ahh, right

18:42 Guest88442: What exactly can metadata be used for?

18:42 justin_smith: to prevent type reflection

18:42 to allow unboxing

18:42 brehaut: Guest53104: anything you like. the compiler uses it for abunch of things like doctypes, type hints

18:42 justin_smith: to mark forms as macros

18:42 brehaut: Guest53104: its also used for contracts (pre and post conditions)

18:43 technomancy: to track who you're calling on the phone, for evil NSA usage

18:43 justin_smith: add documentation strings

18:43 etc.

18:43 ,(meta #'meta) ; you can use meta to see metadata

18:43 clojurebot: {:ns #<Namespace clojure.core>, :name meta, :added "1.0", :file "clojure/core.clj", :static true, ...}

18:43 justin_smith: (meta #'meta) is so meta

18:44 brehaut: seangrove: does om replace the contents of the root completely, or append to the bottom of it?

18:44 seangrove: What's your use case?

18:44 brehaut: seangrove: i have a section that represents a root, and i want to add a header to it (its a static header)

18:45 seangrove: if i can just slap it straight into my markup thats fine

18:51 blake__: I moved working code from my REPL to my clj and am getting errors... Where's a good place to look to figure them out? (It doesn't appear to be a definition issue.)

18:53 justin_smith: what kind of errors?

18:54 blake__: "Key must be integer".

18:54 So I'm thinking something's being interpreted as a value passed to a vector.

18:54 justin_smith: yeah, sounds like a vector ended up in the calling position somewhere

18:54 or some number was nil

18:55 blake__: ooh...nil...maybe it's a definition in my REPL =not= in my clj...

18:55 (wish I could see what's actually happening when it's called...)

18:57 technomancy: you could try tools.trace

18:58 blake__: technomancy: thanks!

18:59 justin_smith: cool

19:02 a3gis: hello again; I was trying to write a macro to sum up a list: (defmacro sum [x] (concat '(+) x)) works for (sum (1 2 3)) but not for (sum (range 10)) (since range is not evaluated). I changed it to (defmacro sum [x] (concat '(+) (eval x))), which now works for ranges but not for list literals. Any idea on how to make it work on both? (I know I should use reduce for that kind of thing; just playing with macros)

19:02 tolstoy: Is there a way, in EBNF (or ABNF) (instaparser) to describe that two things must be present, but they can be in any order?

19:03 (Or three, or four, or five things.)

19:03 justin_smith: a3gis: why not use [1 2 3] or '(1 2 3) - other than the fact that in this case the fact that it is a macro is useless

19:03 a3gis: justin_smith: right that works; thanks!

19:07 cbp: tolstoy: if you want a permutation then I don't think so (without enumerating all possible permutations). If you just want a combination you can use or?

19:08 tolstoy: cbp: Alas. (Though understandable.) I'm kinda using it to "validate" some docs.

19:32 tpope: is leiningen 2.3.2+ uptake high enough that I can drop support for repl port files other than .nrepl-port yet?

19:36 technomancy: tpope: maybe? https://www.refheap.com/71269

19:36 tpope: I would say as long as the error message is good, go for it

19:37 tpope: that log file is just under one day's worth of traffic fwiw

19:37 not a very representative sample, but whatever

19:38 xeqi: one days of logs, presumably greping the user agent string used to download deps

19:38 technomancy: 1.7?

19:38 technomancy: xeqi: zero hits for Leiningen/1

19:38 xeqi: !

19:39 hurray

19:39 technomancy: but I think that's because it's reported differently

19:39 I mean, 1.x didn't use aether

19:39 xeqi: hmm, thats right. it's a different string entirely

19:44 tpope: technomancy: hmm yeah maybe indeed. I assume that doesn't even factor in existing installs

19:45 technomancy: tpope: not sure I follow

19:45 tpope: technomancy: I mean those logs are just the number of installs happening, not a survey of what's already installed on people's machines

19:45 unless I'm missing something

19:46 technomancy: tpope: sorry, that's the nginx log from clojars.org

19:46 so each hit is a separate lib or maven-metadata.xml file being fetched

19:46 not downloads of lein itself

19:46 tpope: oh!

19:47 yedi: in om: does anyone know why this line: (dom/h2 #js {:color "red"} "No View hooked Up") isn't giving me an h2 element with color="red" set?

19:47 it's also seeming impossible to get style to work right

19:48 amalloy: yedi: i don't think color is a legal attribute for hN?

19:48 yedi: (d/h2 #js {:style {:color "red"}} "No View Hooked Up") => style="cnt:1px;arr::color,red;cljs$lang$protocol_mask$partition1$:8196px;cljs$lang$protocol_mask$partition0$:16123663px;"

19:48 amalloy: like, it's supposed to be style="color:red" or something?

19:49 `szx: yedi: shouldn't that be #js {:style #js {:color "red"}} ?

19:49 amalloy: and #js can't magically know you want that map collapsed into a string

19:50 yedi: oo lemme try

19:50 amalloy: #js {:style "color:red"}

19:50 but i guess maybe d/h2 does that

19:50 yedi: amalloy: i tried using string at first, but i get an error from an om protocol saying the style attr expects a map

19:50 seangrove: `szx: Yes, you're right. it must be a #js obj

19:50 pandeiro: is it possible to connect cider to a drawbridge (nrepl over http) connection?

19:51 technomancy: pandeiro: sadly no

19:51 someone needs to write an adapter

19:51 pandeiro: technomancy: :headless works fine for my use case; i was just wondering

19:51 yedi: `szx: thanks, that did the trick!

19:52 technomancy: headless?

19:52 huh... I wonder how hard it would be to write an nrepl brige

19:52 pandeiro: technomancy: i am running a server locally so i will just start it up with `lein repl :headless ...` rather than `lein run`

19:53 malyn: technomancy: I wrote one, but it's kind of a mess and I haven't wanted to share it yet...

19:53 lein-catapult FTW! ;)

19:54 technomancy: malyn: cool!

19:54 pandeiro: what is lein catapult?

19:54 malyn: I'll try and get it cleaned up in the next couple of days. I used it this morning and had forgotten about the shocking number of println's in there...

19:55 technomancy: pandeiro: I don't see how drawbridge comes into play for that though

19:55 you can :connect without http

19:56 malyn: pandeiro: It's what I called my Leiningen plugin that lets you go from TCP/IP nREPL to Drawbridge. You know, maybe you're cozied up to your (vim-)fireplace and can't quite make it to the Drawbridge... well, here's a catapult then!

19:56 pandeiro: technomancy: so i have a server that groups together several APIs that are useful for my day-to-day workflow: since i am starting it on xinit, i thought why not let it be my go-to REPL as well

19:56 technomancy: pandeiro: huh, cool

19:57 definitely simpler to fall back to socket nrepl for that though

19:57 yedi: justin_smith blake__ amalloy coventry: wrt to my earlier question, this is what I came up with: https://gist.github.com/yedi/59f934b4f83ac396741c

19:57 thanks for all the help

19:57 pandeiro: technomancy: that's what i will do; i was just curious if drawbridge was an option

19:58 (i need the repl integrated into emacs to be useful; so, no)

20:02 tpope: adds up to just under 80% fwiw. enough to make me want to kick this down the road a bit

20:20 blake__: Does "expect" have any elaborations, like, "expect (this or that)"?

20:21 ToxicFrog: ,(doc expect)

20:21 clojurebot: Huh?

20:22 coventry: Do you mean this? http://clojuredocs.org/clojure_contrib/clojure.contrib.mock/expect

20:22 blake__: good question...I've got "require expectations"....lesseee

20:23 "expectations 2.0.6"

20:23 coventry: Oh, this http://jayfields.com/expectations/

20:23 blake__: Maybe that's a little toooo minimalistic.

20:24 stain: gfredericks: clgv: Thanks for the tip earlier.. my ex-info-status works like a charm: https://gist.github.com/stain/8aa635304664473054bc

20:25 I did initially feel a functional itch as I used exception handling for handling exceptions rather than some (or ) magic

21:06 gfredericks: stain: aw man another failed sell for catch-data

21:06 maybe I wasn't meant to be a library salesman after all

21:07 stain: how would it look with that..

21:07 your example is too complete!

21:08 gfredericks: (catch-data :status {:as data, :ex e} (assoc data :body (.getMessage e)))

21:08 I think

21:08 the conditional is implicit in the `:status` predicate

21:08 also technically I did the merge backwards compared to yours

21:09 stain: yeah, it's important to not do the merge backwards, otherwise you can't override the :body

21:09 as I'm sure there will be someone trying to do a 404 with a picture somewhere

21:09 gfredericks: ah ha

21:10 holo: In https://github.com/clojure/tools.namespace/ reads "If the reloaded namespace contains defmulti, you must also reload all of the associated defmethod expressions." I don't get this. aren't all defmethods defined in the same namespace as defmulti anyway?

21:11 gfredericks: holo: when the defmulti gets redefined it lacks all the other defmethods

21:12 amalloy: holo: no, defmethods typically are written in namespaces different from the one defining a defmulti

21:13 this has the effect of mutating the defmulti, so in one sense that's "in the same namespace", but you have to re-eval the defmethod, which is in a different namespace, to get the same effect again

21:13 gfredericks: I thought s/he meant something different by "defined in"

21:15 holo: gfredericks, you're answer is also right for my question because I didn't know multimethods internals

21:16 (map inc [gfredericks amalloy])

21:16 ,(map inc [gfredericks amalloy])

21:16 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: gfredericks in this context, compiling:(NO_SOURCE_PATH:0:0)>

21:16 holo: :D

21:16 stain: gfredericks: hhmm.. now I tried with our thing, and it broke everything! :( I want my money back!

21:16 your

21:16 brehaut: inc is not a function, its a lazybot command

21:17 gfredericks: stain: read the fine print

21:17 holo: oh yes, i remember

21:24 stain: gfredericks: it was Ring silently not telling me in the browser that I had screwed up the [:require] syntax - you're in!

21:25 gfredericks: PHEW

21:28 tuft: is anyone using immutant? i'm pretty burned on containers, but it does seem convenient

21:29 miseria: "no mendigues jamas calor y abrigo, la lastima nunca llega hasta tu puerta y el afecto prestado es un castigo" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival*

21:43 arrdem: do we have a standard implementation of floor and ceiling that people turn to? I hate to do weirdness with inc and dec...

21:43 jcromartie: Math

21:43 arrdem: more stuff that was lost in contrib.math T_T

21:44 yeah Math/floor and Math/ceil

21:44 suggestions for a testing engine besides core.test?

21:45 jcromartie: people like midje

21:45 coventry: What's wrong with clojure.test?

21:45 arrdem: coventry: just making sure it hasn't morphed into a pile of glowing radioactive waste since last I spun it up :P

21:45 jcromartie: clojure.test is rock solid

21:47 amalloy: clojure.test does very little, and is good at what it does. midje does a lot

21:48 i haven't used midje, so i won't state anything authoritatively, but i hear a lot more people debugging or complaining about midje in here than i hear about how awesome midje is

21:48 jcromartie: I had problems with midje

21:48 I had to abandon it

21:58 alew: tuft: there is the #immutant channel you might want to check out

22:00 * gfredericks is having trouble writing the gen/for macro

22:00 holo: I had to port a lib from midje to clojure.test recently. clojure.test feels like having too many parens when compared to midje, and not very direct to describe tests

22:00 jcromartie: holo: but why did you have to port it?

22:01 holo: jcromartie i wanted portable tests between clojure/clojurescript, and clojurescript.test/clojure.test was the obvious answer

22:04 jcromartie, sorry, I didn't mean "port", but "change to" :)

22:04 jcromartie: sure

22:04 I know what you meant

22:06 ToBeReplaced: arrdem: clojure.math.numeric-tower

22:12 holo: jcromartie, there's some midje like syntax for cljs included in purnam.test, but I wasn't brave enough to try it

22:23 _Bravado: Does anyone know a good tutorial on getting a browser connected clojurescript repl up and running? I managed to get cemerick's austin working before but am having no luck with a fresh copy

22:29 xeqi: _Bravado: I've been using the om-start template to start new projects with all that setup already

22:29 _Bravado: thanks

22:39 seangrove: xeqi: om-start or mies-om?

22:46 xeqi: seangrove: om-start, but mainly for things like https://github.com/magomimmo/om-start-template/blob/master/src/leiningen/new/om_start/profiles.clj

22:46 auto setup of austin and injections to make it easier for dev time

23:03 arrdem: ,(doc defrecord)

23:03 clojurebot: "([name [& fields] & opts+specs]); (defrecord name [fields*] options* specs*) Currently there are no options. Each spec consists of a protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args*] body)* Dynamically generates compiled bytecode for class with the given name, in a package with the same name as the current namespace, the given f...

23:35 chare: So trying to understand how to make something like reddit with clojure. How does reddit or hacker news do comment pagination, how do they pull out from the database the first page of comments and the comment's replies, but do so without pulling out a potentially gigantic amount

23:36 beamso: the comment is probably linked to a parent comment plus a parent thread

23:36 so you could do a limit and an order by in the sql query

23:36 _Bravado: in short, granularity. The question is too vague to really take on though

23:37 sm0ke: chare: every sensible database has pagination buitin

23:37 chare: beamso: limit on the top level comments only or what?

23:38 beamso: limit in general i'm guessing

23:38 reddit gives you 200 comments by default

23:38 chare: so how do you know that ahead of time when dealing with a comment that has a deep tree of replies

23:38 beamso: but _Bravado is right in that i've answered it too simplistically

23:39 chare: if one comment has a deep tree of repiles that counts towards the 200 limit right? but you won't know it until you pull the entire comment's tree before looking at the next top level comment

23:40 and how would that sql query look like?

23:40 sm0ke: just select * from comments limit 1000 ?

23:41 and have refrences of parent in each comment

23:41 let the ui take care of tree view?

23:41 chare: so that doesn't grab the replies of those 1000 comments

23:42 _Bravado: it's not a single query, i think you should look up sql to understandn why it doesn't grab 1000 comments

23:42 sm0ke: may be if you dont care

23:42 chare: _Bravado I don't understand

23:43 _Bravado: your questions seem to be more about how SQL queries work

23:43 sm0ke: yea, if you really are so strict about how many replies, you can have order in replies i.e. comment -> 0 reply -> 1 reply of reply -> 2 and so on

23:44 then fetch by orders and limit

23:44 would no longer be a single query though

Logging service provided by n01se.net