#clojure log - Aug 14 2012

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

0:00 TimMc: It's not wholly surprising given Erlang's origin as a telecom switch scripting language...

0:00 cemerick: True enough.

0:00 Frozenlock: What is "deps.js"? My console is complaining about this file.

0:01 amalloy: djanatyn: the general idea is to take the input list and, for each item in it: remove that item from the list, and cons it to the front of (permutations the-list-without-x)

0:02 nkoza2: there is something like clojure.inspector/inspect but that refreshes the display when the Var changes?

0:03 amalloy: rather, to each list returned by (permutations the-list-without-x)

0:03 xeqi: Frozenlock: https://github.com/emezeske/lein-cljsbuild/blob/master/example-projects/simple/src-clj/example/views.clj#L8

0:03 muhoo: apparently nrepl-piggieback for cljs requires git master of leiningen. i tried to run it and it i got this: https://www.refheap.com/paste/4329

0:03 what's the secret to running the git master version of lein, but from a project dir (not from the lein dir itself)?

0:04 Raynes: People just really like cljs, given the hell people go through to use it.

0:04 :p

0:04 djanatyn: amalloy: my bad, I forgot to change some names >_>

0:04 amalloy: i figured

0:04 Frozenlock: xeqi: so it won't affect me?

0:05 cemerick: muhoo: have you `lein install`ed from within leiningen-core?

0:06 i.e. https://github.com/technomancy/leiningen#building

0:06 xeqi: Frozenlock: its not fatal, I usually just put the (javascript-tag ...)

0:06 cemerick: Raynes: The promise of it is…promising. :-P

0:07 Frozenlock: xeqi: thanks

0:07 * Raynes needs to get a life.

0:07 * Raynes is kneeling in front of the kitchen table talking to people online on his way to get a drink out of the refrigerator.

0:11 amalloy: djanatyn: if you don't mind a spoiler, a solution is at https://gist.github.com/3346186

0:12 djanatyn: thanks. I'll keep working on it for a bit more :)

0:13 amalloy: and of course if you don't worry about duplicates, the whole remove-once nonsense can be replaced with (remove #{x} coll)

0:14 djanatyn: what is #{}?

0:15 TimMc: &(class #{1 2 3})

0:15 lazybot: ⇒ clojure.lang.PersistentHashSet

0:16 TimMc: djanatyn: It's reader syntax for a set.

0:59 ideally_world: if there a good mode for core.logic?

0:59 s/if/is

0:59 clojurebot: Huh?

1:01 ideally_world: working my way through https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer and the clojure mode doesn't indent so well with the macros in logic???

1:01 lazybot: ideally_world: How could that be wrong?

1:04 JulioBarros: Anyone know how to get compojure / enlive templates to reload when I change the html file?

1:12 brainproxy: JulioBarros: there's the ring-refresh plugin

1:12 err.. let me check the name

1:13 JulioBarros: yep, ring-refresh

1:13 JulioBarros: Thanks. I'll take a look. Does that do the templates too? Or just the classes? Found a post that says a workaround is (use 'my.lib :reload)

1:14 brainproxy: when I change the .clj files in src, the browser refreshes

1:14 JulioBarros: Sweet. Thanks.

1:14 clojurebot: thanks for your suggestion, but as usual it is gender

1:14 brainproxy: I also have `:auto-refresh? true` in the `:ring {...}` map in my project.clj

1:15 lynaghk: ping: dnolen

1:15 brainproxy: can't remember if that's strictly required... been awhile since I put together the settings I've been using across a few projects

1:16 JulioBarros: one thing to note.. depending on what kind of exceptions get thrown as you're dev'ing and breaking stuff, you may need to bounce the process every once in awhile

1:17 that's been my experience anyway

1:17 JulioBarros: brainproxy: thanks, i've found that. Especially when i create and then rename methods.

1:17 But now I'm just trying to create some basic pages.

1:19 brainproxy: one cool thing.. in addition to watching files in src/ it also watches files in resources/

1:19 so if you're using lein-cljsbuild and have it auto-rebuilding into some subdir of resources/

1:19 then you'll get refreshes when you update the client-side stuff also

1:20 JulioBarros: brainproxy: hmm ... weird. Installed it and see it refresh the browser but don't see the changes.

3:06 wingy: if i pass an object to a function and the function only alters this object but do not return anything .. is this function still side effect free?

3:06 it used the data passed in only but it didn't return anything

3:07 is it a pure function?

3:07 mk: no, because it has altered the object

3:08 wingy: oh yeah

3:08 now i recall what it means .. no outside world alterations

3:09 Raynes: wingy: What you described is the definition of a non-pure function.

3:09 mk: Raynes: would you call that a function? Perhaps method?

3:10 Raynes: mk: It's still a function.

3:10 In Clojure anyways.

3:13 mk: wingy: you might think of a function as only giving answers, and "non-pure functions" or methods as things that hammer away at whatever you gave them, or at the program state in general

3:13 wingy: right

3:13 good metaphor

3:13 e

3:13 -e

3:14 Fossi: nope

3:14 not enough cars :>

3:19 mk: wingy: usually you want to avoid working with objects that even have a chance of being modified. If you find yourself wanting to modify an object, you might ask in here if there's a better way to do something (there's almost always a more elegant way)

3:21 wingy: yeah

3:23 mk: Fossi: a clojure function is like a car cus... it runs? :P

3:23 Fossi: :D

3:34 clojure-newcomer: hey guys, I'm using remotes in Noir, and want to use the result from a call outside of the fm/letrem form, any ideas how I can do this ?

3:34 when I log the response as I expected its a callback function

3:34 ro_st: pubsub

3:34 azkesz: Hi, how would one go about loading clojure code from a file atomically:such that if any "compiler" errors then the loading would have no effect on the existing clojure code(in the running repl) ?

3:35 ro_st: clojure-newcomer: https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/

3:36 azkesz: for example if I type 2 lines in repl and the second one errs, the first line still had effect

3:37 ro_st: clojure-newcomer: https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote/blob/master/src-cljs/depr/remotes.cljs, more specifically

3:37 clojure-newcomer: ro_st: just looking through code now

3:37 ro_st: ahhh, thats what I was gonna ask you next :-)

3:37 just looking now

3:38 azkesz: looks like encapsulating them inside a dosync block would do the trick

3:38 ro_st: i put that out yesterday. it isn't working quite yet. will spend more time on it today. but that's what you'd do, pretty much

3:39 azkesz: actually, encapsulating the lines into one block (by just parens) would do the trick :D

3:39 clojure-newcomer: ro_st: are you just leveraging noir fetch for remotes ?

3:40 ro_st: no, shoreleave-remotes, which is the same, but with csrf protection built in

3:41 you don't need to use that, though, if you don't want to. the pubsub works independently

3:42 clojure-newcomer: ro_st: I think it will break me if I switch frameworks right now :-) though this looks interesting, and from the sounds of it more secure

3:42 ro_st: what are you using?

3:42 fetch, and what else?

3:42 clojure-newcomer: ro_st: how do you solve the problem of accessing your callbacks outside of any local forms etc ?

3:42 ro_st: fetch and cljs-binding

3:43 ro_st: you mean accessing the data that the remote brings back?

3:43 clojure-newcomer: ro_st: I want to bind the result of a callback to an element in an html page

3:43 ro_st: yes

3:45 azkesz: ,*clojure-version*

3:45 clojurebot: {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}

3:45 azkesz: &*clojure-version*

3:45 lazybot: ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}

3:50 clgv: clojure-newcomer: I didnt understand your proplem with remotes in noir completely due to the lack of (minimal) example code - but I don't think you have to throw away noir ;)

3:52 clojure-newcomer: clgv: I'll post a little paste bin example if it helps

4:00 no need to paste bin it, thanks ro_st

4:17 clj_newb_298: is there anyway to embed a browser in a clojure/java app?

4:17 by a browser, I'm refering to something like webkit

4:18 ro_st: i think the answer is yes. the question is, how :-)

4:21 clj_newb_298: ro_st: :-)

4:21 is $disease curable? yes. how? we're still working on it

4:22 i'm half tempted to use clojure + qt jambi + qt webkit

4:22 * ro_st is reminded of the dark old days when i used the IE ActiveX Control in .net

4:23 AustinYun: you know, i kind of like the idea of prefixing vars with a char, but php just poisons everything

4:24 ro_st: no. noooooo. NO.

4:25 *sedatives*

4:25 clj_newb_298: AustinYun: I acutally find that helpful too

4:25 to know whether it's something that is an argumen tinto the function

4:26 or a global function

4:26 I thikn the theory is that for the cost of 1 character

4:26 magopian: clj_newb_298: i find prefixing to be just evil and useless

4:26 clj_newb_298: I can locally know whether a var is a local or a global

4:26 w/o having to scan the entire function

4:26 magopian: if you need a prefix, maybe you need a better name for your var ;)

4:26 Chousuke: if scanning the entire function is too much work, it's too big :P

4:26 AustinYun: ruby does it for instance/class vars

4:26 magopian: Chousuke: +1 ;)

4:27 ro_st: mark-occurence highlighting

4:27 boom

4:27 clj_newb_298: hmm; I'm going to pretend I won this argument, and go back to working on webkit inside of java

4:27 AustinYun: lol

4:27 hoeck: clj_newb_298: javafx has a WebView (webkit) component

4:27 AustinYun: there was no argument!

4:27 Chousuke: AustinYun: those are more difficult to distinguish since they might come from who knows where

4:27 ro_st: it's not one character. it's one character per usage. it's that one character * the number of times you use local vars * the number of local vars in your program

4:28 Chousuke: but local variables don't appear from outside the file you're working in

4:28 hoeck: clj_newb_298: http://docs.oracle.com/javafx/2/api/javafx/scene/web/WebView.html

4:28 ro_st: anyway. solving problems is more important :-)

4:28 AustinYun: i have nothing important to contribute so i quibble over syntax

4:28 ro_st: haha

4:29 clj_newb_298: hoeck: is webEngine a webkit instance or a javafx's own web viewer?

4:30 Chousuke: syntax is sort of important though. If clojure didn't have its lispy syntax goodness, it would be rather awkward to have syntactic abstraction :P

4:30 some languages do it, but it's just not very pretty

4:30 clj_newb_298: you don't need clojure's syntax

4:30 check out forth/factor

4:30 hoeck: clj_newb_298: its using webkit under the hood

4:30 Chousuke: forth is another language that does it okay.

4:30 clj_newb_298: it's like clojure, except instead of '(' ')' you have ' ' and ' '

4:30 AustinYun: cat!

4:31 Chousuke: mostly because the syntax is simple enough.

4:31 AustinYun: http://www.cat-language.com/

4:31 clj_newb_298: dumbass question: is there a way I can lein install swt?

4:31 or do I have to install eclipse?

4:31 hoeck: hoeck: the api is roughly the same as the other webkit GUI components: loadDocument, executeScript, plus a way to invoke js and get js objects

4:32 clj_newb_298: hoeck: noted

4:32 hoeck: clj_newb_298: there is also a small clojure jfx lib to get started with jfx: https://bitbucket.org/splendid/jfx

4:33 clj_newb_298: hoeck: interesting; I didn't know javafx was this easy to use

4:33 i thought it was a mess since javafx always wnated to b emain thread

4:34 hoeck: clj_newb_298: there are some limitations when developing on the repl, like you have to restart if if you close the main jfx window

4:51 CmdrDats: does anybody know of something that can give me a function level dependency graph for a namespace (or set of namespaces)? if that makes sense?

5:02 clgv: is there now a core function to access the last element of a vector efficiently or do I have to use count+nth, still?

5:03 now = clojure 1.4.0 ;)

5:04 the-kenny: ,(doc peek)

5:04 clojurebot: "([coll]); For a list or queue, same as first, for a vector, same as, but much more efficient than, last. If the collection is empty, returns nil."

5:09 clgv: oh right.

5:10 just the word "peek" doesnt fit semantics here. gotta rename it

5:16 AustinYun: why is peek more efficient than last?

5:17 clgv: AustinYun: because last traverses the whole sequential that menas O(n)

5:17 *means

5:24 nbeloglazov: &(let [v (vec (range 100000))] (time (last v)))

5:24 lazybot: ⇒ "Elapsed time: 266.224982 msecs" 99999

5:24 nbeloglazov: &(let [v (vec (range 100000))] (time (peek v)))

5:25 lazybot: ⇒ "Elapsed time: 210.643355 msecs" 99999

5:25 nbeloglazov: &(let [v (vec (range 1000000))] (time (last v)))

5:25 lazybot: ⇒ "Elapsed time: 275.935026 msecs" 999999

5:25 nbeloglazov: &(let [v (vec (range 1000000))] (time (peek v)))

5:25 lazybot: ⇒ "Elapsed time: 232.886027 msecs" 999999

5:35 Bahman_Mourning: Is it possible to start Jetty to serve only through SSL?

6:13 clgv: Bahman_Mourning: if you are using ring: http://practice.kokonino.net/posts/ring-with-ssl-only

6:14 * talios just released a patch release of clojure-maven-plugin - http://www.theoryinpractice.net/post/29401387595/clojure-maven-plugin-1-3-12

6:15 Bahman_Mourning: clgv: Excellent. Thanks.

6:16 clgv: Bahman_Mourning: thats a hack but someone should certainly create something like an :ssl-only option.

6:17 nbeloglazov: Does counterclockwise allow to import lein projects? Or I need to create pom file and import maven project?

6:17 clgv: nbeloglazov: yes it does since 0.9.0

6:17 ejackson: nbeloglazov, it does

6:17 nbeloglazov: cool, thanks

6:18 Bahman_Mourning: clgv: Yes. Actually I was searching all the on Internet to find a natural solution like :ssl-only.

6:18 clgv: it's pretty awesome handling leiningen now. before you always had to adjust classpaths manually on dependency changes ...

6:18 nbeloglazov: just import and "Configure -> Convert to Leiningen project"

6:19 nbeloglazov: clgv: thank, I'll try

6:21 clgv: nbeloglazov: if you start from scratch just create a leiningen project directly

6:40 nbeloglazov: clgv: can't import lein project. First I need to import project to workspace somehow and then convert it to leiningen. But I can't import project because eclipse doesn't know what it is.

6:40 ejackson: nbeloglazov there is a way to do this, 1 moment

6:41 clgv: nbeloglazov: I don't know if creating a Leiningen project overwrites the project.clj if present. Hence, try the safe way. Create a normal Clojure project in the folder of the project. then convert it to leiningen project

6:41 ejackson: in the docs: http://code.google.com/p/counterclockwise/wiki/Documentation#Install_Counterclockwise_plugin

6:42 check out the section "f you want to use a non-Eclipse project you grabbed from Git/BitBucket, etc."

6:42 I did that just last week to get it going

6:42 clgv: ejackson: that lists what I just said ;)

6:45 nbeloglazov: thanks guys, it worked

6:45 clgv: well, if it is a version controlled project with no current changes you could just test if creating a leiningen project directly works. if not just reset to HEAD

6:46 nbeloglazov: Would be nice if counterclockwise guys added lein to eclipse import section

6:48 clgv: nbeloglazov: what section? I think creating a leiningen project in eclipse just should care not to overwrite an existing project.clj - that would be sufficient. maybe it does that already

6:49 nbeloglazov: cclgv: I mean "File -> Import..."

6:50 clgv: nbeloglazov: ah right. create an issue therefore, if there is none, please.

6:51 nbeloglazov: http://code.google.com/p/counterclockwise/issues/list

6:51 nbeloglazov: clgv: sure

6:53 ejackson: clgv: aaaah, but it was written by French Guys, therefor is better :P

6:55 clgv: ejackson: I thought there is a "French German friendship" one often hears about on related  anniversaries ;)

6:57 ejackson: this is the first I've heard of the French having any friends !

6:57 hyPiRion: :o

7:17 clgv: lol

7:21 michaelr525: hello

7:21 augustl: what's a good way to turn three vectors into one? [1], [2, 3], [4] => [1, 2, 3, 4]

7:22 joegallo: ,(concat [1] [2 3] [4])

7:22 clojurebot: (1 2 3 4)

7:22 joegallo: if the result must be a vector, you can

7:23 ,(into [] '(1 2 3))

7:23 clojurebot: [1 2 3]

7:23 noidi: or ,(vec (concat [1] [2 3] [4]))

7:23 ,(vec (concat [1] [2 3] [4]))

7:23 clojurebot: [1 2 3 4]

7:23 joegallo: yes, that too

7:23 augustl: ah, it doesn't actually have to be a vector

7:24 hyPiRion: You can do concat by a reduce into

7:24 ,(reduce into [1] [[2 3] [4]])

7:24 clojurebot: [1 2 3 4]

7:25 hyPiRion: ,(reduce into [] [[1] [2 3] [4]])

7:25 clojurebot: [1 2 3 4]

7:29 michaelr525: hyPiRion: cool

7:30 clgv: well thats O(n) runtime - I wonder if they will implement the more advanced vectors that can be concatenated more efficient

7:31 hyPiRion: clgv: It really depends on your use case though

7:32 michaelr525: clgv: what are more advanced vectors?

7:33 hyPiRion: If you want to append some elements and need a vector/constant lookup, then "reduce into" would probably be faster than "vec (concat"

7:33 If you just need a seq of elements you process, then concat is better

7:35 If you could combine some sort of difference list and vectors, then concatenation would be blazingly fast

7:35 Though unbounded variables is still a hassle in Clojure :(

7:36 clgv: phil baghwell (from scala) presented this http://infoscience.epfl.ch/record/169879/files/RMTrees.pdf - vector with concatenation in O(log N)

7:37 hyPiRion: clgv: I don't have the time to look it up now, but are there any performance downsides to those vectors?

7:38 It certainly looks interesting though.

7:39 clgv: hyPiRion: I guess that the constant for the other operations increase

7:39 hyPiRion: so asymptotically none ;)

7:41 hyPiRion: Looked at the summary, seems like there are no reason to not use this.

7:42 This would be awesome for a data structure for strings though.

7:42 clgv: hyPiRion: I think if you do not need concatenation, plain clojure vectors will be faster in total due to the increased constants

7:43 so this would be the decision criterion which one to use

7:43 hyPiRion: clgv: It really depends on the performance loss

7:44 If there's no noticeable difference, you could switch over.

7:46 Man, I've fallen in love with all these immutable data structures.

7:51 ludston: Okeydokeyblokey's. IDE's. What doesn't emacs have by default?

7:52 I have paredit, and I tried auto-complete but the suggestions it gave kept being annoyingly useless so I dropped it

7:53 Is there something else essential that I'm missing out on?

7:57 hyPiRion: ludston: nrepl?

7:58 ludston: hyPiRion: Never heard of it. Back in 10

8:01 hyPiRion: Meh, my response was a bit slow - What you probably want is nrepl and ac-nrepl: https://github.com/purcell/ac-nrepl

8:02 You should get context-aware results by using that.

8:04 ludston: hyPiRion: Thanks a load, I'll give it a go.

8:48 hinjuzqiG: hi

9:13 jsabeaudry: Potentially silly question here: does having a watch on an atom prevent it from getting garbage collected?

9:14 gfredericks: I doubt it

9:15 &(let [watched-atom #(let [a (atom %)] (add-watch a :foo identity) a)] (dorun (repeatedly 10000000 #(watched-atom 4))))

9:15 lazybot: ⇒ nil

9:21 gfredericks: nothing important should have a reference to the atom

9:22 hyPiRion: The atom has a ref to the watcher, and not vice versa

9:22 reference*

9:31 TimMc: hyPiRion: For strings, have you looked at ropes?

9:31 There's a Java impl out there.

9:33 hyPiRion: TimMc: I've heard about them, but not used them. Aren't they basically immutable binary trees?

9:39 TimMc: hyPiRion: Yes, but the leaves are themselves strings.

9:40 Basically every operation is O(log N)

9:44 gfredericks: what ought I to use for basic date-math? (just parsing and subtracting)

9:44 hyPiRion: clj-time

9:45 https://github.com/KirinDave/clj-time

9:45 wmealing_1: -ah, that is the official one

9:45 so many forks..

9:47 gfredericks: corfield's isn't the official?

9:48 xeqi: https://clojars.org/clj-time

9:48 gfredericks: does lein2 allow specifying alternate namespaces for use by `lein run` and `lein repl`? (for that matter does lein1?)

9:48 hyPiRion: gfredericks: I believe that's the one on clojars, as the "official" is kind of abandoned.

9:48 xeqi: looks like seancorfield's is

9:49 gfredericks: hyPiRion: in what sense does cljars claim it is official?

9:51 xeqi: gfredericks: `lein run -m namespace`

9:52 hyPiRion: gfredericks: I meant that corfield's is the one on clojars

9:52 xeqi: I don't think the repl command does

9:54 nbeloglazov: gfredericks: also you can specify function to be called: lein run -m namespace/your-fn

9:55 gfredericks: xeqi: okay thanks

9:57 cshell: What's the rule for using the literal [] sequence for a vector versus using the vector function?

9:58 Wild_Cat: cshell: if you can use the [] form, do it. Otherwise, use the vector function.

9:58 cshell: that's what I thought but then I read something about only using the [] form if it contained literals, not functioncalls or vars

9:59 gtrak: where does it say that?

10:01 gfredericks: that's an interesting distinction because when talking about the difference between (list ...) and '(...) that's quite important

10:02 cshell: yeah, i can't find it right now - I think it was a google groups discussion that cemerick was a part of a while ago

10:03 cemerick: cshell: You can put anything in [].

10:03 gfredericks: cemerick: you're flip-flopping from your previous alleged opinion!

10:03 * gfredericks votes for cemerick's opponent

10:03 cemerick: You can put anything in any literal, but you might get an error if you have duplicate values in a set literal or duplicate keys in a map literal.

10:04 gfredericks: Do you know what my opinion is? ;-)

10:04 cshell: No, I think cemerick was answering someone's question which was similar to mine

10:04 TimMc: cshell: You're thinking of Common Lisp, I think.

10:04 cshell: yes, that was it

10:04 cemerick: I never said anything about vectors, though.

10:04 cshell: it was on set literals

10:04 TimMc: &#{3 (+ 1 2)}

10:04 lazybot: java.lang.IllegalArgumentException: Duplicate key: 3

10:05 TimMc: &(hash-set 3 (+ 1 2))

10:05 lazybot: java.lang.IllegalArgumentException: Duplicate key: 3

10:05 TimMc: Seems awfully silly to me, but that's how it is currently.

10:05 cshell: here's the post http://bit.ly/R00OBa

10:05 gtrak: eh, what's the big deal?

10:06 cemerick: We talk about this on the podcast, actually.

10:06 hyPiRion: TimMc: You can wrap it with either distinct or into

10:06 cshell: I was just confused because there was some discussion in the thread which I took to imply that literals () [], etc were not to contain literals

10:06 so, that's why I was asking in here :)

10:07 hyPiRion: ,[(into #{} [1 1 1]} (apply hash-set (distinct [1 1 1]))]

10:07 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: }>

10:07 hyPiRion: ,[(into #{} [1 1 1]) (apply hash-set (distinct [1 1 1]))]

10:07 clojurebot: [#{1} #{1}]

10:07 TimMc: gtrak: Well, if your set literal is combining values that are known at compile time and at runtime, you could get a surprise -- sometimes.

10:08 cemerick: cshell: That's a bit like saying, "don't try to read from a path, because the file you think is there might not be"

10:08 gtrak: ah, yea, I'm reading through that thread

10:08 the potential of a set collision causing an exception seems troublesome

10:08 cshell: lol

10:09 gtrak: because it doesn't happen ALL the time

10:09 cshell: I'm glad to hear that I can use the [] forms, as that's all I've been using

10:09 jsabeaudry: gfredericks, hyPiRion : thanks!

10:09 xeqi: &{1 2 1 3}

10:09 lazybot: java.lang.IllegalArgumentException: Duplicate key: 1

10:10 cshell: thanks guys

10:12 gtrak: turns out hashset has the same problem

10:12 ,(hash-set 1 2 2)

10:12 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: 2>

10:12 gtrak: you have to use into

10:13 hyPiRion: or, eventually, conj

10:13 gtrak: reduce

10:13 hyPiRion: ,(conj #{} 1 2 2)

10:13 clojurebot: #{1 2}

10:14 gtrak: ,(set [1 2 2])

10:14 clojurebot: #{1 2}

10:19 hyPiRion: Hm, so set and conj seems to be the most succinct versions out there.

10:20 TimMc: conj would seem to be the best way to combine compile-time and runtime values into a set.

10:20 &(conj #{1 2 3} (+ 1 2))

10:20 lazybot: ⇒ #{1 2 3}

10:21 magopian: is there a way to get the version of a REPL, from within the REPL ?

10:22 trying to find out what's the version of the light table playground i'm using, and the version on tryclojure, and on 4clojure ;)

10:22 xeqi: &*clojure-version*

10:22 lazybot: ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}

10:24 TimMc: 4clojure gives you one bit of information per test, so you'll have to run tests using things like (:major *clojure-version*).

10:27 xeqi: or just check the source https://github.com/4clojure/4clojure/blob/develop/project.clj

10:29 gtrak: gosh, that literal issue seems really needlessly heinous

10:43 magopian: thanks xeqi ;) (a bit late ;)

10:43 and thanks TimMc ;)

10:46 cemerick: <spam>Mostly Lazy episode 6 with chouser is here: http://mostlylazy.com</spam>

10:46 foxdonut: hehe

10:49 magopian: i can't really understand the "import" mecanism in clojure

10:49 i'm using the light table playground (which is awesome ;)

10:49 and trying to use

10:49 clojure.contrib.core.dissoc-in

10:49 but it just won't

10:49 same in tryclojure

10:52 i'm trying either (use 'clojure.contrib.core)

10:52 either (clojure.contrib.core/dissoc-in

10:52 Bronsa: magopian: clojure.contrib is not part of clojure

10:52 TimMc: magopian: clojure.contrib.$FOO isn't on the classpath, so you can't import it.

10:52 Bronsa: and it also got deprecated since clojure 1.3

10:52 magopian: oh

10:53 double "oh" :)

10:53 that explains it :)

10:53 so if i need dissoc-in, i either add the jar to the classpath, or copy the code

10:54 Bronsa: http://clojure.github.com/clojure/ here you can see the namespaces included in clojure

10:54 magopian: thanks Bronsa ;)

10:54 Bronsa: magopian: actually, dissoc-in got included in clojure.core.incubator

10:54 https://github.com/clojure/core.incubator

10:55 magopian: nice ;)

10:55 TimMc: magopian: You'd probably be happy with just a combination of update-in and dissoc.

10:55 magopian: TimMc: you're right !

10:55 genius !

10:56 foxdonut: (inc TimMc)

10:56 lazybot: ⇒ 12

10:56 TimMc: Heh, that praise belongs to whoever I heard it from in this channel.

10:56 magopian: eh ;)

10:56 foxdonut: collectively, this channel is genius, for sure.

10:57 magopian: for sure.

10:57 alexyakushev: Wow, didn't know one could do that

10:57 (inc TimMc)

10:57 lazybot: ⇒ 13

10:57 gfredericks: (inc TimMc) ;; TimMc is default for practicing with inc

10:57 lazybot: ⇒ 14

10:58 mattmoss: (map inc [1 2 TimMc 4])

10:58 ,(map inc [1 2 TimMc 4])

10:58 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: TimMc in this context, compiling:(NO_SOURCE_PATH:0)>

10:59 mattmoss: I phale.

11:00 TimMc: "(inc" is undoubtedly hardcoded as a command prefix.

11:00 (inc foxdonut) ;; with leading space

11:00 magopian: TimMc: mmm actually, it would be a combination of get, update-in and dissoc, right?

11:00 gfredericks: I remember adding a patch that allowed putting comments afterwards

11:03 TimMc: &(update-in [0 [1 [2 {:a 1 :b 3}]]] [1 1 1] dissoc :a) ;; magopian

11:03 lazybot: ⇒ [0 [1 [2 {:b 3}]]]

11:03 magopian: TimMc: but it only works for a map (the dissoc)

11:03 while dissoc-in works for a collection, right?

11:04 (the key being the index)

11:05 nvm, i got it wrong, dissoc-in also works for maps only

11:05 mmm i'll have to find another solution to solve problem 112 on 4clojure ;)

11:08 casion: can you see other user's solutions on 4clojure?

11:08 nbeloglazov: &(doc dissoc-in)

11:08 lazybot: java.lang.RuntimeException: Unable to resolve var: dissoc-in in this context

11:08 nbeloglazov: ,(doc dissoc-in)

11:08 clojurebot: It's greek to me.

11:09 nbeloglazov: ,(doc assoc-in)

11:09 clojurebot: "([m [k & ks] v]); Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created."

11:09 nbeloglazov: Does dissoc-in exist?

11:09 &cd dissoc-in

11:09 lazybot: java.lang.RuntimeException: Unable to resolve symbol: cd in this context

11:10 Bronsa: http://clojure.github.com/core.incubator/clojure.core.incubator-api.html#clojure.core.incubator/dissoc-in nbeloglazov

11:10 `fogus: Is there a dedicated CCW IRC channel?

11:18 alexyakushev: Is there a short way to check if value implements IFn? I tried `fn?` but it returns false on keywords, for example

11:19 I am aware of `(instance? clojure.lang.IFn x)` but maybe there is some cleaner solution

11:21 nbeloglazov: &(ifn? :hello)

11:21 lazybot: ⇒ true

11:21 magopian: casion: yes, once you solve the problem, you can see other's solutions if you follow them

11:22 casion: magopian: what about before you solve them?

11:22 magopian: casion: i personnally follow each of the few that solved all the problems, this way i'm sure to have a global overview ;)

11:22 casion: in that case, no

11:22 nbeloglazov: alexyakushev: you can use ifn?

11:22 casion: :|

11:22 magopian: that would ruin all the fun, wouldn't it? :)

11:23 casion: magopian: not really

11:23 TimMc: &(map (juxt ifn? fn?) [:hello identity])

11:23 lazybot: ⇒ ([true false] [true true])

11:28 magopian: casion: well, no point in trying to solve the problem, if you can see the solutions from the start

11:29 casion: magopian: the point, for me, would be in many cases I don't even understand the problem

11:29 and seeing the solution would make it much more clear… and thusly I learn a new concept

11:32 juhu_chapa: Hi all! Is there a way to reduce "completely" a list of booleans i.e. (reduce and [true false true])

11:32 S11001001: ,(doc every?) ; juhu_chapa

11:32 clojurebot: "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."

11:33 S11001001: ,(doc some) ; juhu_chapa

11:33 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

11:33 juhu_chapa: S11001001: beautiful! ...thank you.

11:33 Bronsa: cemerick: ping

11:34 magopian: casion: try something else then, like rosettacode

11:37 cemerick: Bronsa: hallo

11:37 Bronsa: cemerick: hi, the second link on "Discrete topics" for the 6 mostly lazy podcast is broken

11:38 cemerick: so it is, thanks

11:38 Bronsa: you're welcome :)

12:34 djpowell: weavejester: Have

12:34 grr

12:36 weavejester: have you pushed the 1.1.2 release of the ring wrapper project to clojars? I can only see the bits

12:36 clojurebot: It's Turing complete |is| <reply>Turing completeness is the Godwin's Law of language arguments

12:45 technomancy: from the podcast: "some two-word functions don't have dashes in them" <- aren't those all inherited from CL?

12:45 djpowell: ooh what podcast?

12:46 technomancy: http://mostlylazy.com/2012/08/14/episode-6-chris-houser-clojure-surveys-getting-the-little-things-right-in-languages-yegge-rama-clojurescript-repls/

12:46 djpowell: I guess dosync isn't

12:49 technomancy: true

12:56 TimMc: c-d-r

12:56 brainproxy: how to do let destructuring inside syntax quoted parts of defmacro?

12:56 technomancy: TimMc: hah

12:57 elisp actually has detailed rules about whether you should use a -p suffix to indicate a predicate vs just p

12:58 arrdem: doesn't Clojure scrap the -p convention?

12:58 technomancy: yes, thank goodness

12:58 because it's not 1980

12:58 * technomancy even uses ? for predicates in elisp

12:58 * technomancy hums a few lines of "Rebel, Rebel"

12:58 cemerick: technomancy: I think the bigger thing is that, there largely hasn't been a discussion about all those "little things".

12:58 TimMc: (def zero?p [x] (identical? zero? x))

12:58 *defn, whatever

12:59 technomancy: cemerick: yeah, but it's more cathartic to just blame CL

12:59 drewr: anyone know what gaz jones tweeter is?

12:59 cemerick: g-d CL

12:59 technomancy: you're right :-D

12:59 technomancy: for instance, the fact that the word "some" implies plurality but clojure.core/some doesn't return a collection

13:00 seqr: noob question: How to create a set of sets, or a nested set, without using a set literal? e.g. I want to end up with #{#{:a :b}} but (set #{:a :b}) just gives me #{a b} back.

13:00 TimMc: seqr: set creates a set from a collection

13:01 &(conj #{} #{:a :b}) is certainly one way

13:01 lazybot: ⇒ #{#{:a :b}}

13:01 TimMc: You can also ask for a specific kind of set: ##(hash-set #{:a :b})

13:01 lazybot: ⇒ #{#{:a :b}}

13:01 raek_: seqr: (set [#{:a :b}]) or (hash-set #{:a :b})

13:02 brainproxy: nvm, figured out the desctructuring thing..

13:03 seqr: raek_: Thanks!

13:04 TimMc: Ah, ok, that explains it, thanks.

13:05 mk: is the use of map entries discouraged?

13:06 gtrak: mk in what sense?

13:06 ,(first {:a 1 :b 2})

13:06 clojurebot: [:a 1]

13:07 TimMc: &(find {:a 1 :b 2 :c 3} :b)

13:07 lazybot: ⇒ [:b 2]

13:07 mk: gtrak: in any sense. Seemed that it was preferable to use seqs on keys and values when doing map

13:07 TimMc: mk: It's common to see Clojure code that walks a map and destructures the entries.

13:07 gtrak: mapmap?

13:08 http://tech.puredanger.com/2010/09/24/meet-my-little-friend-mapmap/

13:08 mk: I guess I'm mostly thinking of map, and generating new values based on old

13:08 TimMc: &(for [[k v] {:a 1 :b 2 :c 3}] (format "%s -> %s" k v))

13:08 lazybot: ⇒ (":a -> 1" ":c -> 3" ":b -> 2")

13:09 gtrak: mk: I think it's fine as long as you know it's a seq view on the map, and you're not relying on order

13:10 mk: gtrak: the idea is to... for example, {:a "one", :b "five"} becomes (:a 3, :b 4) via length

13:11 gtrak: mk: yea, read the mapmap post

13:11 TimMc: The mapmap in the blog post isn't quite perfect for what you want.

13:12 abev: i want to try eg clojure.json lib in repl how to go about it?

13:12 gtrak: sure it is, there's a [vf s] arity

13:12 (mapmap count m)

13:14 mk: right, it zipmaps. Seems like it should be using map enties, though

13:14 gtrak: it is... when you do map on it, it turns it into a seq

13:14 TimMc: gtrak: Not quite. (mapmap key (comp count val) m)

13:15 gtrak: err huh?

13:15 arrdem: ,(cons #{} 1)

13:15 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

13:15 arrdem: ,(cons 1 #{})

13:15 clojurebot: (1)

13:16 gtrak: TimMc: ah, you're right

13:16 mk: TimMc is right, when using the value-arity, it passes the whole map entry. I don't think that's a big deal, just redefine "mapmap"

13:18 I guess the map does use map entries, though, so that's good

13:19 gtrak: you shouldn't have to rely on the fact that it's a map-entry in implementation

13:19 mk: I guess I was looking at the zipmap variant?

13:20 gtrak: yeah, list, vector, map entry, same thing. I'm just wondering about performance for mapping over huge maps

13:21 gtrak: dunno, you'd have to profile it

13:22 TimMc's 'for comprehension' does a single iteration, though

13:23 i think 'into {}' can be faster than zipmap

13:24 for some reason zipmap doesn't use transients

13:24 looks like there's a bug reported for it

13:28 mk, take a look at https://github.com/flatland/useful/blob/develop/src/useful/map.clj#L46

13:33 mk: gtrak: thanks

13:33 and a much clearer name than mapmap

13:34 gtrak: yea, np, I finally remembered where I saw it

13:35 it uses a map-entry constructor presumably to avoid the extra allocations

14:02 casion: would someone kindly give me some assistance with http://www.4clojure.com/problem/112, I've been working on it for about 6 hours and I'm not even close

14:03 S11001001: @google google

14:03 jweiss: i remember seeing some lib or functionality where you can "remember" a group of requires in a ns declaration and re-use them. anyone know what that was?

14:04 mk: casion: what do you have so far?

14:07 casion: mk: best I've managed is maintaining the nested structure and replacing everything with 1s

14:07 I'm trying to find that code now, it was incredibly bad anyway

14:08 arrdem: casion: were you using recursion? what is your basic case?

14:10 casion: https://www.refheap.com/paste/4346

14:10 that was the monstrosity

14:10 scriptor: should it be (fn replze [data] …) ?

14:10 *replaze

14:10 casion: uh

14:10 yes

14:11 I have no idea how I ended up pasting (fn instead of (defn replaze

14:11 * casion sigh

14:13 casion: https://www.refheap.com/paste/4347

14:13 the correct incorrect code ^

14:21 arrdem: casion: one idea I'm having is that if you flatten the nested list structure, you can figure out how many atoms you need to add up. look at the last case where the "correct" answer drops two levels of lists once it hits the sum cap.

14:30 casion: arrdem: ah

14:30 well, I can find how deep to go now, albeit inefficentll

14:32 arrdem: casion: just notice that for these test cases you are always walking the same list or decending, there is no test case where you have to go down and come back up.

14:42 casion: arrdem: well, you've given me an excellent idea at least, now I need to figure out how to do it

14:42 thank you

14:42 arrdem: no problem, best of luck

14:50 dgrnbrg: Where does eclipse's CCW put the logs when the repl fails to start? Or where can I see the log of the repl start?

14:51 eggsby: hmm, does the 'time' macro not work when you package into a jarfile?

14:54 dgrnbrg: eggsby: it should work fine

14:54 amalloy: eggsby: that sounds like nonsense

14:54 dgrnbrg: Now, i've found the log file, but I see that CCW is using lein 1. I have my lein2 binary called lein2--is there a way to tell CCW to use that instead?

14:56 fenton: What is a good data structure if i want to have a sorted list of name value pairs?

14:56 dgrnbrg: fenton: treemap?

14:56 erm, sorted-map?

14:57 fenton: dgrnbrg: ok I have a look at those...thx.

14:57 dgrnbrg: ,(doc sorted-map)

14:57 clojurebot: "([& keyvals]); keyval => key val Returns a new sorted map with supplied mappings."

14:57 dgrnbrg: ,(doc sorted-map-by)

14:57 clojurebot: "([comparator & keyvals]); keyval => key val Returns a new sorted map with supplied mappings, using the supplied comparator."

14:57 dgrnbrg: they force uniqueness in the keys, of course

14:58 fenton: dgrnbrg: yeah, i'd want that, thats excellent.

14:58 dgrnbrg: if you just need uniqueness by element, use sorted-set and write your own comparator

14:58 fenton: dgrnbrg: sorry, super newbie, let me chew on the first part :)

14:59 hiredman: /win 15

15:12 arrdem: ,(dec arrdem)

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

15:22 mk: (inc arrdem)

15:22 lazybot: ⇒ 1

15:24 arrdem: hum....

15:24 yeah I though we had a karma system

15:29 mk: not a very good one. Increment rep systems are usually used by regulars, and for rewarding humor or agreement

15:34 it would be more useful if the bot counted up "thanks"

15:35 scriptor: could get a sense of that by parsing the logs

15:36 TimMc: Also it sometimes forgets people's karma. :-)

15:37 mk: I just had a look at e.g. http://clojure-log.n01se.net/date/2012-06-21.html, 37 occurences of thanks, and the vast majority of the directed ones make sense. 4 instances of (inc, and they all seem... not so useful

15:38 I don't want to parse the docs myself, the bot effectively does that realtime

15:38 TimMc: mk: Oh, you should just whip up a discourse analysis engine and build a better karmabot!

15:38 amalloy: or write a lazybot plugin

15:39 mk: thanks in advance! here's a thanks to get your bot started on

15:39 arrdem: amalloy: I see what you did there...

15:40 TimMc: (oh, huh... I know the person that wrote this dissertation!)

15:40 mk: TimMc: the so-called "discourse analysis engine" it would consist of inc (filter inchannel stuffbeforecolon-orcomma) ... if rest contains "thanks" or "thank you" etc.

15:40 arrdem: link? my to-read list is still of finite length..

15:40 TimMc: mk: No, you'll have to pick out who is being thanked.

15:41 mk: amalloy: I'm sure the false-positives/negatives would be no worse than what already occurs, see my use of inc above :)

15:41 TimMc: mk: That will require determining who has been engaged in conversation with whom, based on semantic similarity, sentiment analysis, timing analysis, classification into broadcast vs. directed messages...

15:42 mk: TimMc: thanks. Because this message is directed at you, and contains the term "thank you" etc., you are incremented

15:42 amalloy: TimMc: ugh, no thanks. that sounds like too much trouble

15:42 scriptor: mk: so what about

15:42 thanks, mk

15:43 TimMc: thanks

15:43 ^ scriptor

15:43 or just a bare "thanks", when it is clear that none of the other active chatters is engaged in the same conversation.

15:43 mk: scriptor: the filter will miss a few. Simply go through the logs and grep thanks. See which ones are caught and which ones aren't

15:44 arrdem: you should be able to piece together simple conversations from timestamps and mentions, which would allow you to determine the target of a simple "thanks" message

15:44 scriptor: mk: I still think finding anything with a thanks and getting all nicks from that line would get most of them

15:44 mk: scriptor: that's exactly what I'm saying

15:44 scriptor: the issue would be recognizing nicks...hmm

15:44 arrdem: so if amalloy and I were going back and forth for a while then I say thanks with no qualifier the history disambiguates

15:44 scriptor: the issue would be recognizing nicks…hmm

15:44 argh

15:45 arrdem: but scriptor is probably right

15:45 scriptor: mk: I thought you were only counting <nick>: <message including "thanks">

15:45 my bad

15:45 mk: scriptor: you just check the stuff before the : or comma, and do (isinchannel ...)

15:45 arrdem: logins/logouts should also be in the logs... so you could have a set of people in chan as of that message

15:46 scriptor: mk: I meant when the nick isn't before the colon

15:46 as in "thanks mk!"

15:46 TimMc: Some people use @this to address people, no doubt thinking that Twitter is the One True Conversational Medium.

15:46 scriptor: @TimMc #thanks

15:47 TimMc: (dec scriptor) ;; :-P

15:47 lazybot: ⇒ -1

15:47 metellus: @someone makes sense even in a twitterless world

15:47 mk: scriptor: it just makes it easier to parse. I've scanned some logs and there just aren't that many cases of "thanks [...] targetnick", unless the nick comes at the very end

15:47 aperiodic: hey man, i was using @someone on IRC before twitter even existed

15:47 TimMc: It makes sense in blog comments.

15:47 metellus: [the following is directed] @ someone: blah blah blah

15:47 scriptor: mk: ah, sounds good

15:48 I was wondering how many irc newbies ask questions on here who aren't familiar with autocompleting nicks

15:49 mk: the other thing is it encourages people to be polite

15:49 metellus: plus, everyone gets points at the end of November!

15:50 nDuff: mk: I'm not sure that encouraging the kind of politeness that involves a lower s/n ratio is beneficial (as opposed to the kind of politeness wherein folks describe their questions, and their answers, as clearly and succinctly as possible)

15:50 mk: another thing to count is directed "ooooh"s

15:50 scriptor: what would be the dec equivalent?

15:51 mk: nDuff: it increases s/n since gratitude is signal, not noise

15:51 arrdem: scriptor: absolutely increasing rep?

15:52 metellus: I've never seen someone use dec in here except the two tests today

15:52 mk: scriptor: there wouldn't be one. People don't usually dec each other when speaking in this context

15:53 scriptor: heh, true, thinking of fun cases for it I guess

15:53 arrdem: I mean... even if I said something really boneheadedly wrong I can't imagine getting dec'd in this setting. perrhapse rudeness?

15:54 mk: scriptor: some other ones (for different reps that might not be worth counting) are "heh", "yeah,", "haha", ":)" etc.

15:56 arrdem: I'm pretty sure that my single rep modification is a dec for saying something disagreeable (but entirely right, in my view) about values or subtyping

15:57 scriptor: if you want, you can do (/ thanksgiven charstyped)

15:59 scriptor: is there an established rationale for why comp applies its function right-to-left?

15:59 I was thinking it had something to do with what the un-comped version would look like

15:59 mk: scriptor: recursion?

15:59 scriptor: (comp a b) => (a (b …)) so visually it has the same order

16:00 joly: I believe it has to do with the mathmatical definition of composition; math did it that way first

16:00 scriptor: ah

16:01 mk: scriptor: direct that and it should count as an inc

16:02 scriptor: another thing I can't believe I didn't remember, (f . g) ~ f(g())

16:02 mk: ah :)

16:04 mk: I suppose that maybe the best place for that sort of thing is in the irc client itself, rather than a bot

16:09 TimMc: (inc scriptor) ;; because I feel bad just leaving that dec there

16:09 lazybot: ⇒ 0

16:09 scriptor: TimMc: thanks

16:12 TimMc: haha

16:22 mononofu: Compiling jukebox.core Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Symbol

16:22 when trying to use leiningen to compile a hello world clojure file

16:22 is there a proper compiler around too?

16:22 arrdem: a) code? b) that is the compiler

16:23 mononofu: well, problem was that :main wasn't set correctly in the project file

16:23 but I was wondering if there is a compiler with actual error handling around

16:24 for the record, randomly throwing exceptions without referencing what went wrong is not error handling

16:25 TimMc: mononofu: This sounds like an issue arising with leiningen's reading of the config file. Nothing to do with the Clojure compiler.

16:25 S11001001: mononofu: repl has option to ask for last trace; C-c C-l in slime also provides trace on failure

16:26 mononofu: I already fixed this error, that's not the problem

16:26 Raynes: And furthermore, if you actually read those traces, they can sometimes have some useful info such as the file and line number where the error occurred.

16:26 TimMc: mononofu: Lein isn't a compiler, it's a build/dev tool.

16:27 mononofu: Raynes: that's my problem, I never have line numbers in there

16:27 Raynes: You have a strange problem.

16:27 mononofu: http://pastebin.com/KjTe7h1A

16:28 error message for incorrect :use statement

16:28 that's not a very good error message

16:28 mmitchell: anyone using s3-wagon? I just upgrade from lein 1.x to 2.x, and can't get authentication to work :/

16:29 ... currently trying the :creds :env approach

16:29 emezeske: mononofu: It looks like a perfectly good error message, the only bad part is no line number.

16:29 mononofu: Out of curiousity, what kind of :use led to that?

16:29 Raynes: I'm top tired for these shenanigans.

16:30 too, even

16:30 llasram: mononofu: For the record, I completely agree. I love Clojure, but think the error-reporting paradigm is less than optimally helpful

16:30 mononofu: omitting the () around :use

16:31 S11001001: When the error messages are good, we won't need human programmers anymore.

16:31 llasram: mononofu: It helps a bit to think about the fact that it's all just code all the way down, and you have a uniform interface whether the error results from something encountered by the compiler, a standard library macro, your own macro, your own run-time initializer code, or even your own run-time code

16:31 emezeske: mononofu: Right, so the error told you that you were passing a symbol (:use) where you should have passed a seq (the ()). So that's very direct and clear. The lack of a line number is definitely miserable.

16:31 mononofu: emezeske: yeah, my main issue is the lack of a line number

16:32 Raynes: emezeske: It looks like it might be because of how the code was evaluated. There is a NO_SOURCE_FILE thing in there.

16:32 emezeske: mononofu: I fully agree that's miserable.

16:32 technomancy: it also doesn't mention ns or use anywhere in the stack trace, which is bad

16:32 load_libs is the closest it comes

16:32 emezeske: technomancy: Yeah, that would have been almost as good as a line number

16:32 technomancy: so it relies on knowledge of the compilers internals

16:33 llasram: technomancy: It actually does mention 'ns', but it's def non-obvious

16:33 emezeske: Raynes: Yeah, I don't know what that's all about.

16:33 hiredman: technomancy: compiler internals?

16:33 technomancy: llasram: where?

16:33 llasram: clojure.core$ns$fn__4796.invoke(core.clj:5130) -- doesn't exactly jump out at one

16:33 emezeske: llasram: Oh, you're right!

16:33 llasram: Oh, even clojure.core$ns.doInvoke(core.clj:5130)

16:33 technomancy: hiredman: err-not the compiler, but clojure.core in general

16:33 llasram: Still, same complaint

16:34 technomancy: llasram: ah, totally missed it. that's something that could actually be made clearer in clj-stacktrace rather than an inherent problem in the data itself

16:38 AWizzArd: http://www.virtual-strategy.com/2012/08/14/oracle-releases-new-java-updates-java-se-7-update-6-javafx-22-and-javafx-scene-builder-10

16:43 mmitchell: technomancy: hey there. I'm trying to upgrade our lein plugins from leiningen 1 to 2.x. We use the s3wagon plugin, but for the life of me I can't get auth to work, any tips/ideas?

16:43 I thought :env would be the simplest test, but no go

16:46 technomancy: mmitchell: what did you try?

16:47 kenneth: hey if i do (pprint conf) i get a class not found exception (clojure 1.4) -- what gives?

16:48 ,(pprint [:hello :world])

16:48 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pprint in this context, compiling:(NO_SOURCE_PATH:0)>

16:48 S11001001: kenneth: it's not in core

16:48 arrdem: clojure.pprint

16:48 kenneth: tried clojure.pprint too, same error

16:48 S11001001: ,(require 'clojure.pprint)

16:48 clojurebot: nil

16:48 kenneth: ah right

16:49 S11001001: ,(clojure.pprint/pprint [:hi :there])

16:49 clojurebot: [:hi :there]

16:50 kenneth: wait, that didn't work either… i added (:require clojure.pprint) to my (ns) and i get the same error when trying to do (clojure.pprint …)

16:51 mmitchell: technomancy: I added the s3wagon plugin to my project, then added two private s3 repositories. I setup my .lein/credentials.clj, then tried "lein deps" and lots of 403s

16:51 metellus: kenneth: you need to do (clojure.pprint/pprint …)

16:51 mmitchell: i also attempted to run my crednetials.clj file through gpg, but it (gpg) keeps telling me i didn't specify a username, not sure what to do there?

16:52 technomancy: mmitchell: is it gpg 2?

16:52 clojurebot: I don't understand.

16:52 mmitchell: technomancy: let me check

16:52 kenneth: oh right i get it! :)

16:53 mmitchell: technomancy: no, it's 1.4.12

16:53 metellus: kenneth: you're calling the pprint function in the clojure.pprint namespace

16:53 mmitchell: installing 2 now though

16:53 technomancy: mmitchell: cool; could you paste the error so I can update the docs?

16:53 mmitchell: also, what did you try for :env?

16:54 mmitchell: technomancy: sure will paste error in a min... for :env, I just exported my aws keyId/secret to LEIN_USERNAME and LEIN_PASSPHRASE

16:56 technomancy: mmitchell: aye, that sounds like a bug. can you try exporting DEBUG=y before doing deploy to see if it's reading the credentials correctly?

16:56 mmitchell: technomancy: sure thing

17:01 technomancy: here is the gpg 1.x output: https://gist.github.com/3352990

17:03 technomancy: maybe i'm doing something wrong, hmm. gpg2 does the same thing, to be clear... i've never used gpg so this could definitely be me

17:03 arrdem: besides binding it to a local name, is there a good way to initialize an object and then invoke a bunch of dot methods which return garbage?

17:04 amalloy: &(doc doto)

17:04 lazybot: ⇒ "Macro ([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"

17:04 arrdem: thanks amalloy

17:06 technomancy: mmitchell: oh, do you have your own key generated yet

17:06 ?

17:06 I literally just added this to the tutorial a day or two ago

17:06 mmitchell: technomancy: ha, no. I actually just figured that out! Generating one now :)

17:06 technomancy: https://github.com/technomancy/leiningen/commit/50e14e06e6371e816777e52f7f8f98b9937f5111

17:07 either way, a better message is needed

17:08 mmitchell: technomancy: cool, i'll read through that

17:09 technomancy: so, in my credendtials.clj file, can I use System/getenv for my aws keys?

17:10 I have them setup in my env as AWSSecretKey and AWSAccessKeyId

17:10 technomancy: if it's encrypted it's probably fine to just put them in the file

17:12 mmitchell: technomancy: ok, i'll try that

17:13 technomancy: oh another thing... lein help deploying shows an example using backticks, like ```clj is this needed?

17:13 hiredman: markdown syntax

17:14 technomancy: mmitchell: it's for HTML rendering via github

17:14 mmitchell: ahh ok! :)

17:14 technomancy: we ship the same source text as online help

17:14 not worth the trouble to strip it out even though it looks a bit odd

17:14 maybe we should; I dunno

17:15 mmitchell: no biggie, that makes sense

17:15 rats, when I start up "lein deps" I immediately see https://gist.github.com/3353090

17:17 technomancy: the invocation it's doing is gpg --batch --decrypt ~/.lein/credentials.clj.gpg

17:17 just by shelling out

17:17 so you can use that to debug

17:17 mmitchell: ok cool

17:17 technomancy: though I'm more concerned that :env isn't working

17:18 with :gpg there are more moving parts, with :env it should just work

17:20 mmitchell: technomancy: oh i think it's because i have gpg (v 1) installed, but used the gpg3 executable to create the key. I'll uninstall gpg and alias gpg to gpg2

17:20 err, i mean gpg2

17:21 technomancy: is there existing ring middleware to try/catch, check accepts headers, and return either json or HTML error messages as appropriate?

17:25 mmitchell: technomancy: ok, the "gpg --batch --decrypt ~/.lein/credentials.clj.gpg" command works now. But "lein deps" just hangs

17:25 technomancy: so it was a 1.x problem?

17:25 gpg1?

17:26 does lein deploy work?

17:26 mmitchell: technomancy: yeah i finally got gpg2 to generate my key and encrypt/decrypt my crednetials.clj file

17:26 technomancy: deps hangs, but i'll see what happens with deploy

17:27 hmm, hanging too

17:29 Cr8: technomancy: I've seen HTML exception traces before, but nothing that checks accepts headers or returns JSON

17:29 technomancy: Cr8: well shucks

17:29 don't tell me I have to write it myself =)

17:29 I wonder if that should ship with ring or compojure?

17:29 drat, the weaving jester is absent

17:30 doesn't seem right for compojure

17:32 seems like there isn't a coherent story around accepts headers in general

17:33 mmitchell: technomancy: I can't get :gpg or :env to work. For :env, should my $LEIN_USERNAME be my aws access key id, and $LEIN_PASSPHRASE be the aws secret key? (sorry for pestering)

17:34 technomancy: mmitchell: that's right

17:34 mmitchell: dang, ok. Anything i can do for debugging :env?

17:35 technomancy: mmitchell: sorry, I need to relocate briefly. I think you'd have to open a repl on leiningen itself to debug that

17:35 steffi_s: how do i hook up functions to single keypresses in clojure when writing a commandline program? I tried my own loop, but it seems to be buffered somehow and reacts only line by line..

17:35 mmitchell: technomancy: no problem, i'll keep trying

17:35 technomancy: thanks!

17:36 TimMc: steffi_s: What are you currently using to read?

17:37 steffi_s: something like (let [c (.read *in*)] [..]

17:39 then i read about jline.Terminal, but cannot find a working clojure example

17:44 TimMc: I'm pretty sure that's all going to be line-at-a-time, unfortunately.

17:46 scriptor: how does clojure know when to expect more code in the repl if all parens aren't matched

17:46 say, if you just enter: (defn foo []

17:46 does the reader return something that lets the repl know to expect more?

17:46 m0smith: steffi_s: Take a look at http://sjl.bitbucket.org/clojure-lanterna/

17:47 It is used by "Caves of Clojure"

17:52 mmitchell: technomancy: OK, when I run "gpg --batch --decrypt ~/.lein/credentials.clj.gpg" I get a passphrase prompt. When I run "lein deps" it hangs... is it waiting for stdin for the passphrase?

17:59 TimMc: scriptor: I think the reader blocks until it has a complete form + a newline.

18:06 alpheus: Testing my install instructions I got the latest copy of lein and it errs after lein self-install;lein repl

18:08 Using https://raw.github.com/technomancy/leiningen/preview/bin/lein

20:55 y3di: is lisp like the only real way of representing functions in a way that can be interpreted anywhere?

20:56 like json can represent any kind of dict like value/object and that can be read by any program with a json parser

20:56 but to function logic isn't really composable in the same way

20:56 except for in lisp

20:57 dnolen: lynaghk: ping

21:00 hyPiRion: y3di: Lisp is basically just lists, so you could convert a lisp-program into a JSON-list if you wanted to.

21:02 TimMc: y3di: Having your surface syntax be very similar to the AST is nice, but it doesn't allow code to magically become portable. :-/

21:47 lynaghk`: dnolen: pong

21:53 dnolen: wowzers http://github.com/cderoove/damp.ekeko/wiki/Example-Ekeko-Queries :)

21:53 lynaghk`: so is that patch ready to apply?

21:54 lynaghk`: dnolen: yes, that branch works on clj and cljs for the specific case I was having

21:54 all clj tests pass (including the ones added in the original patch)

21:55 inlining the bit in val-at-expr feels gross to me, though so if you have any suggestions I'd be happy to reimplement.

21:57 dnolen: lynaghk`: sorry I'm slow, where is the inlining?

21:58 lynaghk`: where you backtrack?

21:58 lynaghk`: dnolen: https://github.com/lynaghk/core.match/blob/issue-52/src/main/clojure/clojure/core/match.clj#L137

21:59 dnolen: lynaghk`: oh that's not part of the patch.

21:59 lynaghk`: I put a commit on top of Jackson's patch for cljs support, which is my use case

21:59 his original patch works fine for clj clojure.

22:00 it just wouldn't apply to the latest master---I just manually applied it and made a commit.

22:00 dnolen: lynaghk`: oh you haven't added yr patch to that ticket?

22:00 lynaghk`: I couldn't figure out how to

22:00 dnolen: lynaghk`: you can't construct a new patch?

22:01 lynaghk`: dnolen: I tried adding it to my comment. I'll add it to the toplevel issue

22:01 dnolen: lynaghk`: k.

22:01 lynaghk`: you want a patch for each commit or a single patch containing both Jackson's stuff plus my own cljs tweaks?

22:01 dnolen: lynaghk`: combined patch please, with commit message about what was done.

22:04 lynaghk`: dnolen: coming right up.

22:05 dnolen: lynaghk`:thx

22:08 lynaghk`: dnolen: added. Available on Github here too: https://github.com/lynaghk/core.match/commit/5738c25f3351444adb7af1074f53f0e519851f12

22:14 dnolen: lynaghk: alpha11 going out.

22:14 lynaghk`: dnolen: awesome, thanks David!

22:15 dnolen: also, is there some trick to building/testing core.match? I always end up having to add clojure to the dependencies so that lein will run the tests.

22:18 aq: hi

22:18 Anyone doing web dev?

22:19 brehaut: ~anyone

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

22:19 brehaut: but yes

22:19 lots of people are doing web dev

22:20 aq: well in genrael

22:20 I got a offer

22:20 ;P

22:20 dnolen: lynaghk: for core.logic & core.match I test w/ mvn test

22:22 lynaghk`: dnolen: okay, thanks. I'll give that a shot next time

22:31 cshell: aq: what's your offer?

22:33 aq: well my cousin is transferring out of her google office in New delhi

22:33 she knows Web advertising and all

22:33 shes been to the uS before

22:33 so yeah

22:34 SHe knows Pay Per click and that stuff

22:34 cshell: so what's the offer?

22:34 aq: well I can show you her

22:34 and maybe she can help with something

22:34 Kowboy: you are trying to get her a job?

22:35 aq: well somewhat

22:35 she may quit google

22:35 or she could stay

22:35 can we talk about it in PM Kowboy ?

22:35 cshell: why isn't she out marketing heself?

22:35 herself?

22:35 aq: eh well not sure why

22:35 Kowboy: not really, just trying to help you get to the point

22:35 aq: well care if I show you her?

22:35 cshell: that makes you sound like a sex spam bot

22:36 aq: wel im not ..

22:36 Kowboy: I'm not in a position to hire anyone

22:36 aq: nothing is lewd..

22:36 * seancorfield gets some popcorn and wonders where this is heading...

22:37 aq: can i show you guys..

22:37 cshell: Why would we need to see her?

22:37 aq: well her skills..

22:37 cshell: you mean show us her resume?

22:37 Kowboy: this isn't going to be a link to goat.se is it?

22:37 aq: well her Linkedin

22:37 and no

22:37 cshell: did goat.se come back? I haven't found it since it was goatse.cx

22:37 Kowboy: sorry, it's been a long time, I think it's goatse.cx

22:38 * seancorfield thinks this is a strange pieces of family pimping...

22:38 aq: so may i show..

22:38 If you guys aren't comfortable then its fine

22:38 cshell: goat.se seems to have apicture of some dude

22:39 Kowboy: aq: I don't want to waste your time. I'm really not interested

22:39 aq: ok

22:39 brehaut: cshell: i cant tell if you are brave or foolish

22:39 cshell: lol

22:40 Kowboy: in the meantime, do you have any questions about Clojure?

22:40 aq: yes

22:40 well

22:40 whats a good oS run it on

22:40 cshell: ?

22:41 Kowboy: any that runs Java

22:41 so, all of them

22:41 aq: oh

22:41 ok

22:41 Kowboy: all the ones that matter, anyway

22:41 aq: thx

22:41 emezeske: aq: Linux is a good OS to run it on.

22:42 aq: Or Mac.

22:42 aq: ok

22:42 What is Mac?

22:42 I never heard of .

22:42 casion: ...

22:42 brehaut: its a type of burger

22:42 aq: ok

22:42 brehaut: three pieces of bread, two meat patties

22:42 uvtc: brehaut: or truck.

22:42 aq: I know Linux

22:42 No Mac

22:42 cshell: you can get it with cheese

22:42 aq: I know Windows

22:42 emezeske: aq: Far fewer people run clojure on Windows, so you are more likely to experience rough edges (in the tooling)

22:42 aq: ok

22:42 casion: aq: where do you live?

22:42 Kowboy: isn't Linux a game where you kick penguins and try to score a field goal?

22:42 aq: Buhutan

22:43 Bhutan

22:43 casion: ah ok

22:43 Kowboy: we should have taken bets on that before he answered

22:43 we would all have been wrong, though

22:43 casion: be nice now, he's been polite and he's learning

22:43 aq: What is Mac

22:43 cshell: his ip is from washington dc

22:44 Kowboy: I'm not being rude, am I?

22:44 * seancorfield wonders how anyone can not have heard of Mac OS...

22:44 cshell: no, aq is trolling

22:44 emezeske: I assume that aq is a troll now

22:44 aq: no

22:44 Jjust kidding :D

22:44 I'll try Linux

22:44 :)

22:44 Ubuntu is hella ugly now with Unity

22:44 emezeske: aq: Welcome to my ignore list! *plonk*

22:44 aq: no

22:44 So how do I get started with clojure ?

22:45 Any good books?

22:45 Kowboy: someone from Bhutan using "hella"? I don't think so. ;-)

22:45 casion: say I have a nested sequence, is there a simple way to drop the rightmost value?

22:45 Kowboy: casion: of the outer sequence?

22:45 seancorfield: aq: i think http://www.clojurebook.com is the best books to get started with

22:45 wkelly: aq is clearly from the internets

22:45 casion: Kowboy: regardless of the depth

22:45 aq: ok

22:46 * seancorfield seems to have a sticky 's' key - don't need no plurals :)

22:46 gfredericks: casion: so you have to be able to identify non-sequences

22:46 uvtc: casion: if you want everything but the last item, it's `butlast`.

22:46 Kowboy: so if the last item is a sequence, traverse it and recur for that sequence

22:46 ?

22:47 by value, you mean non-sequence, ie leaf

22:47 casion: yes

22:47 cpinera: Hi all. Is there a way to specify what lein profile to use with clojure-jack-in?

22:47 brehaut: sounds like a job for butlast and a recursive mapcat

22:47 Kowboy: seems like it would be a simple recursive function

22:47 casion: my clojure terminology is still garbage

22:47 Kowboy: that's ok

22:48 so is mine ;-{

22:49 casion: I thought there maybe some way to do it without explicit recursion

22:49 xeqi: cpinera: no, I've had to run swank seperately and M-x slime-connect to it

22:49 Kowboy: casion: why? the recursive way is the simplest and cleanest way in any functional language

22:50 cpinera: xeqi: That's what I was afraid of. Well, as long as it works. Thanks!

22:50 casion: Kowboy: mostly curiosity...

22:50 Kowboy: you want a function that does the recursion for you?

22:50 gfredericks: much more efficient if they're all vectors than seqs

22:50 brehaut: i think its roughly (fn bl [x] (if (sequential? x) (mapcat bl (butlast x)) x)) ?

22:50 (untested)

22:51 casion: everytime I've figured out something with explicit recursion, I inevitably find there's a way to do it without

22:52 so when I end up on something I _think_ requires explicit recursion, I've been in the habit of looking for another solution as a learning exercise

22:52 Kowboy: yeah, but there's the "clever" way and the straight forward way. I almost always prefer the latter.

22:52 are you talking about recur?

22:53 casion: any explicit recursion, either a recursive call or recur

22:54 gfredericks: casion: what should it do with [[2 3] []]?

22:54 Kowboy: ooh, nice edge case!

22:54 or [[2 3] [5]]

22:56 gfredericks: https://www.refheap.com/paste/4358

22:56 assuming we don't care about that edge case I think ^ that works

22:56 casion: gfredericks: It could return [[23]] or [2], either would work

22:56 gfredericks: at least according to how I misunderstood the problem

22:56 casion: well in that case I have no idea what we're talking about anymore

22:56 * gfredericks goes back to work

22:56 casion: er [[2 3]]

22:56 missed a space

22:57 gfredericks: I maintain my previous statement

22:57 uvtc: Anyone know of a fancier pretty-printer than clojure.pprint/pprint? If I hand `pprint` a big nested data structure, it just prints it out to me in one line...

22:57 gfredericks: uvtc: because it's small?

22:57 (i.e., its on one line)

22:57 uvtc: My data structure is being printed on one line. Ex.

22:58 {:a 1 :b 2 :c [1 2 {:aa 11 :bb [44 55 66]}] :d "hello"}

22:58 I'd expect that to be printed out on multiple lines, to make its structure more clear to the eye...

22:58 * gfredericks has thought that before too

23:02 uvtc: How long does it usually take until your membership to the clojure dev ML is no longer "pending"?

23:02 gfredericks: that took a few days for me I think :/

23:02 I can't even remember how it became unpended

23:02 maybe by yelping in IRC

23:03 uvtc: Some unpenderbot I suppose...

23:03 gfredericks: ~unpend uvtc

23:03 clojurebot: Cool story bro.

23:03 amalloy: uvtc: it adds newlines when it needs them to fit within its desired width

23:05 uvtc: gfredericks: we must refuse to be tempted to use Clojurebot for our own gain. With great power, ...

23:05 metellus: ~responsibility

23:05 clojurebot: I don't understand.

23:06 gfredericks: how do you specify a full reply to clojurebot?

23:06 uvtc: amalloy: thanks! I see that when push comes to shove, pprint breaks lines like pretzel sticks. :)

23:07 Clojurebot: how does one program clojurebot?

23:07 * uvtc bets he won't tell.

23:08 uvtc: or she.

23:08 * gfredericks is browsing the clojurebot source

23:10 amalloy: gfredericks: i think you need <reply> to be enclosed by whitespace

23:11 gfredericks: clojurebot: responsibility is <reply> what's that?

23:11 clojurebot: I don't understand.

23:12 gfredericks: ~botsmack

23:12 clojurebot: Owww!

23:12 uvtc: ~botfight

23:12 clojurebot: botfight is http://raek.se/botfight.html

23:13 gfredericks: ~responsibility is <reply> what's that?

23:13 clojurebot: Titim gan ?ir? ort.

23:13 gfredericks: ~responsibility

23:13 clojurebot: Huh?

23:13 uvtc: Huh?

23:14 * aperiodic vaguely recalls pipes around is ('|is|') when teaching clojurebot things

23:14 gfredericks: clojurebot: pipes |are| for use like this

23:14 clojurebot: Ack. Ack.

23:14 uvtc: I've seen |is| used with "forget".

23:14 gfredericks: ~pipes

23:14 clojurebot: pipes are for use like this

23:15 xeqi: clojurebot: responsibility is <reply> what's that?

23:15 clojurebot: Excuse me?

23:15 xeqi: blah

23:15 uvtc: ~responsibility is <reply> With great power comes something something.

23:15 clojurebot: Ik begrijp

23:15 uvtc: ~responsibility

23:15 clojurebot: With great power comes something something.

23:15 gfredericks: wat

23:16 cshell: responsibility

23:16 how do you make it so it responds to normal questions?

23:16 uvtc: That,

23:16 ...I don't know.

23:16 gfredericks: I don't think it will pick up on arbitrary conversation

23:16 cshell: Should I use recursion?

23:16 amalloy: gfredericks: he can't parse if you put a ? in the answer

23:17 gfredericks: amalloy: ah HA

23:17 uvtc: clojurebot: forget responsibility |is| With great power comes something something.

23:17 clojurebot: I forgot that responsibility is With great power comes something something.

23:17 gfredericks: clojurebot: responsibility is <reply> what's that

23:17 clojurebot: In Ordnung

23:17 cshell: Once someone came in here and said, "I have a problem with recursion" and clojurebot said, "using recursion leaves you with two problems"

23:17 uvtc: ~recursion

23:17 clojurebot: Cool story bro.

23:17 xeqi: ~regex

23:17 clojurebot: Sometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems.

23:17 gfredericks: cshell: I think it occasionally replies to thinks but only at random

23:18 cshell: ah

23:18 regex

23:18 :)

23:18 muhoo: hey, credit jwz for that

23:19 cshell: How do I use regex?

23:19 I have a problem with regex

23:19 yeah, must be random

23:20 amalloy: regex?

23:20 clojurebot: Sometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems.

23:20 gfredericks: oh also that one-word-question thing

23:20 gfredericks?

23:20 cshell: responsibility?

23:20 clojurebot: what's that

23:21 metellus: ~responsibility

23:21 uvtc: wat?

23:21 clojurebot: With great power comes something something.

23:21 For Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888

23:21 amalloy: amalloy?

23:21 clojurebot: amalloy is <amalloy> just use juxt, it'll be great

23:21 uvtc: Oh, I thought I told it to forget that.

23:21 cshell: cshell?

23:22 gfredericks: clojurebot: cshell is <reply> I don't know anything about cshell.

23:22 clojurebot: In Ordnung

23:22 cshell: lol, thanks gfredericks :)

23:22 clojurebot: RickInGA: Thanks; the queue is empty now, though I'm sure it'll fill up at ClojureWest again.

23:22 cshell: cshell?

23:22 clojurebot: I don't know anything about cshell.

23:24 cshell: What triggered the RickInGA response?

23:25 uvtc: clojurebot is a riddle, wrapped in an enigma, then dipped in secret sauce.

Logging service provided by n01se.net