#clojure log - Dec 06 2012

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

0:07 devth: no way to partially apply a fn's args in any order but left-to-right without wrapping it in your own fn, correct?

0:10 Raynes: devth: Sounds like you want a flip function. I think useful might have one.

0:10 devth: Raynes: cool, i'll take a look.

0:11 Raynes: I might be wrong.

0:11 We at least considered putting it in there.

0:11 devth: no luck with ack.

0:11 but yeah, i could see a lib doing this. was curious I was missing anything in core.

0:12 Raynes: devth: (defn flip [f] #(apply f (reverse %&)))

0:12 That's a simple version. amalloy_ has a complex version that does shit I don't even understand.

0:13 devth: nice. so that's what %& is for

0:13 jonasen: I'm trying to wrap my head around core.logic's constrained logic vars, but I can't get even the simplest constraint to work: https://www.refheap.com/paste/7336

0:13 I'm probably doing something silly..

0:47 ohpauleez: tpope: Thanks looking into the issues - much appreciated

1:02 elephantTechno: yo. I'm extremely new to clojure and I have a problem : using lein to compile then run a program is extremely slow (several seconds) which is inappropriate for someone who has a very vague notion of clojure's syntax. How can I 1) run the main function of a program using the REPL 2) running a specific function using the REPL ? Teach me how to use the REPL ! thanks.

1:11 nightfly_: Say your projects is "cows" and you're using the lein app templete to run main would just me (cows.core/-main)

1:12 Any arbitary function can be called just how you would in your code

1:24 technomancy: elephantTechno: if you don't have editor integration figured out yet it's easy enough to just paste into the repl

1:24 but eventually you'll want to have it set up so you can send stuff straight from your editor with a single command

1:32 elephantTechno: thank you techomancy. I'm using sublime text (again I'm quite new to it, i previously used text mate). But for now i'll just use the repl from a separate terminal.

3:12 Raynes: ibdknox: Why didn't you put my tomorrow night theme in there? It's the only theme I care to use.

3:27 josteink: elephantTechno: you may want to look into "drip"

3:27 elephantTechno: unless you are running windows, because AFAIK drip does not work on windows ;)

3:27 https://github.com/flatland/drip

4:34 dsevilla: guys, do you know of any list of core.logic resources?

4:34 from documentation to learning projects to projects that just use it

4:34 presentations, videos, etc.

4:40 fredyr: dsevilla: http://blip.tv/clojure/dan-friedman-and-william-byrd-minikanren-5936333

4:40 sorry, missed that ur looking for a list of resources

4:43 dsevilla: fredyr: thanks, I think there's no such compilation, so maybe I'll start it

4:44 I'm very interested in it. I think core.logic is not used as much as it could be used for many things

4:44 fredyr: sure thats a good idea

4:45 the resources i keep seeing is reasoned schemer and will byrds thesis

4:46 dsevilla: fredyr: yes, this is where to start, I think, but there are some good presentations too, and some applications of it that worth taking a look at

4:46 for instance, there's an implementation of the 99 logic problems in core.logic

4:46 fredyr: oh

4:47 let me know when you've compiled the links that you've got so far

4:47 dsevilla: fredyr: OK :)

4:48 fredyr: damn I cannot find the 99 problems in core.logic, but I have them somewhere

4:48 that's why the compilation :)

4:49 fredyr: :D

4:53 Raynes: I got 99 problems but core.logic ain't one.

4:59 dsevilla: Raynes: hahaha, you know, it was 99 logic problems IN core.logic :)

6:21 tdfjadlfjasdfa

6:22 Raynes: ihuhgb

6:22 dsevilla: ups, sorry

6:22 my gnome-shell went nuts

6:22 Raynes: :p

6:34 berdario: Hello, does someone use ritz-nrepl here?

6:59 gosh, I'm starting to get really discouraged right now

6:59 llasram: berdario: I know people do use it. hugod himself is on here frequently

6:59 berdario: aside from my issue, there's this one: https://github.com/pallet/ritz/issues/58 and I can't find documentation on the lein plugin :/

7:00 llasram: what do you use for debugging? (I don't really care about ritz-nrepl, I just want something that worksa)

7:00 llasram: I'm not sure where you are in the world, but it's before 7am EST and 4am PST, which means a big chunk of Clojure users are asleep right now

7:00 berdario: I'm UTC+1

7:01 cemerick: It's interesting that Europe generally isn't on irc.

7:01 Here, anyway.

7:01 Interesting that that fellow says that nrepl.el is "unusable".

7:01 llasram: There are people from Europe, but things do seem most active during EST-PST core hours

7:01 cemerick: American slackers.

7:01 berdario: eh, I was awake until 3.30 UTC, btw... but I got tired, and I hoped that I would find someone else now :)

7:02 cemerick: what do you use for debugging?

7:02 cemerick: berdario: I do all my Clojure-ing in Eclipse + Counterclockwise.

7:02 berdario: cemerick: no CLI, then?

7:02 cshell: cemerick: How's the debugging support in that?

7:03 llasram: berdario: And I use Emacs but I have to confess I've never been a big fan of debuggers for managed languages. Just never gotten it into my workflow

7:03 cemerick: berdario: You mean, a REPL in the shell? Hardly ever.

7:03 cshell: cemerick: Do you use the REPL in CCW?

7:03 cemerick: I use lein from the command line, obviously; though Laurent is working on making that less necessary.

7:03 cshell: ccw benefits from the eclipse debugger, which is quite good

7:04 cshell: I built the REPL in ccw. ;-)

7:04 berdario: llasram: I use emacs as well, can I ask you what is the current debugger that you have installed?

7:04 (emacs 24 btw)

7:04 cshell: cemerick: Awesome, I'm just finishing up the lein 2 dependency management integration into the IDEA leiningen plugin

7:04 llasram: berdario: For Clojure? Mental reflection and (prn) calls

7:05 cemerick: Ah-ha! Just last night, talios was asking about the status of La Clojure.

7:05 cshell: cemerick: I eventually want to get the clojure support to be as good as the java support in IDEA

7:05 cemerick: It's seemed dead on and off for a while.

7:05 berdario: llasram: is that a joke answer?

7:05 cshell: cemerick: yeah, those guys are very sporadic - I am going to start contributing to it though after I get the leiningen support complete

7:06 berdario: I mean, I can't find any "mental reflection" thing for clojure

7:06 cshell: berdario: I haven't used the IDEA debugger, but Relevance and cemerick support counter clockwise, so I'd give that a try first

7:07 berdario: you said that you're not a fan of debuggers, but yet... you said you "use emacs", hence I inferred that you had an emacs debugger installed (even if you seldom use it)

7:07 cshell: yes, but I'd prefer something minimal

7:07 llasram: berdario: Ohhh, I'm sorry for the confusion. I meant I use Emacs for Clojure development, but don't use a debugger

7:07 berdario: cshell: not for the sake of it, but just because I just want something to help me understand the code and step up and down the stack

7:08 llasram: ok, thanks anyhow :)

7:08 cshell: cshell: that's what the eclipse debugger should do - it should let you move up and down the stack

7:09 berdario: cshell: do you know somebody here who worked with the clojurescript sources? (I know I'll have to wait some hours for people to wake up, but still...)

7:09 cemerick: berdario: If you're aiming to use a debugger to aid your understanding of Clojure code, etc., I'd suggest that that's unlikely to be of much help.

7:10 berdario: cemerick: I have a static function in a clojure module/packages (sorry, my terminology is quite confused)... but apparently it's shipped in a different file

7:10 cemerick: how can I understand where it's coming from, without a debugger?

7:11 cemerick: you mean, you are trying to determine from where a Clojure namespace is being loaded?

7:12 berdario: I'm in the .clj file that defines this namespace, but it's requiring things from somewhere else, and I assume some of these things are compiled .jars

7:13 cemerick: so, yes... I'm trying to determine from where they're loaded

7:13 llasram: &((juxt :file :line) (meta #'require))

7:13 lazybot: ⇒ ["clojure/core.clj" 5319]

7:13 cemerick: Right, there's that, and also:

7:13 ,(clojure.java.io/resource "clojure/core.clj")

7:13 clojurebot: nil

7:13 cemerick: oh jeez

7:14 &(clojure.java.io/resource "clojure/core.clj")

7:14 lazybot: ⇒ nil

7:14 llasram: Silly bots

7:14 Don't remember where they came from

7:14 cemerick: berdario: the bots have that blacklisted, but you can use a call like the above to determine where a particular file is being loaded from within the classpath

7:15 cshell: berdario: there are a lot of people that know cljs in here - if you search the clojure log file at http://clojure-log.n01se.net you can find particulars

7:16 Foxboron: cemerick, you one of the guys that wrote Clojure Programming?

7:17 cemerick: Foxboron: yes

7:18 Foxboron: cemerick, love the book ^^

7:19 cemerick: Foxboron: Glad you're enjoying it. :-) If you think it's worthwhile, please do leave your review @ http://amzn.to/clojurebook ;-)

7:20 Foxboron: I do miss small tasks or something along those lines, but thats rather a minor flaw in my opinion.

7:20 cemerick, will do when i have read through it all.

7:20 cemerick: small tasks?

7:21 berdario: llasram, cemerick thanks... clojure.java.io/resource seems to always return nil, but meta says that what I'm looking for is at line 277

7:21 cemerick: berdario: how are you calling `resource`?

7:22 cshell: Does anyone use Clojure as a Python/Ruby scripting replacement?

7:22 berdario: (clojure.java.io/resource "closure/-compile") or (clojure.java.io/resource "closure") or (clojure.java.io/resource "-compile")

7:22 cshell: or scripting replacement in general?

7:23 Foxboron: cemerick, like at the end of a chapter you add a little page with possible tasks to further understaing the chapter. Things to code etc.

7:23 berdario: btw, now I have the namespace and the line number... but still I have to find out what's the exact file

7:23 cemerick: berdario: resource needs a path, e.g. "clojure/core.clj" if you want to see where the clojure.core ns was loaded from, etc.

7:23 It doesn't know anything about functions

7:23 Foxboron: ah, homework :-)

7:23 berdario: cemerick: ah, I did (require '[cljs.closure :as closure])

7:24 cemerick: then, "cljs/closure.clj"

7:24 berdario: so, "closure" is no good, but "cljs/closure" is what I'm looking for

7:24 ?

7:24 ok, thanks

7:24 cemerick: but, that's just over here: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj

7:24 berdario: (ah, I forgot the .clj)

7:24 cemerick: yes, I'm into closure.clj

7:24 but some things are missing

7:25 Foxboron: cemerick, yeah if you wanna call it that :)

7:25 berdario: ok, it's a jar file: clojurescript-0.0-1534.jar

7:26 afk: (I'll have a slice of pizza)

7:27 cshell: Is let considered imperative as it affects program state?

7:47 fredyr: cshell: no i wouldn't say it does

7:48 cshell: Does haskell have a let concept?

7:50 squidz: after Ive created an executable clojure script with lein uberjar, can anybody tell me how I can pipe from the linux shell?. My script takes a file and outputs a line. I want to read in a directory of files and spit the output into a single file.

7:50 berdario: ok, I realized that the .jar file wasn't really relevant (it was probably brought in by leiningen... but the contents are the exact same .clj files that I'm reading)

7:51 cemerick: squidz: just read from *in*

7:51 berdario: and that -compile is indeed in the same closure.clj... I assumed that the protocol was defined there, but the implementation was done in java

7:51 fredyr: cshell: i believe haskell does have a let construct yeah

7:51 squidz: cemerick: How? im not experienced in working with scripts in the shell

7:51 berdario: fredyr: is has bot a "let" and a "where"

7:52 s/is has bot/it has both/

7:52 cshell: fredyr: Interesting, it(wikipedia) says imperative programming allows for mutation of programming state and that in FP there is no manipulation of state (in theory i realize) but rather a chaining of functions together

7:52 squidz: my script works fine, it is just running the function on multiple files and outputting their results into a new single file

7:53 ambrosebs: A Practical Optional Type System for Clojure - Final version https://github.com/downloads/frenchy64/papers/ambrose-honours.pdf

7:53 cshell: it seems when I use let i'm affecting the state of the program as I'm affecting what's in scope

7:53 fredyr: it's really not the issue of program state

7:54 but mutating between states

7:54 let is creating a local binding in your lexical scope

7:54 clojurebot: c'est bon!

7:54 fredyr: that binding never mutates in any way

7:55 cshell: ah, okay, thanks fredyr :)

7:55 fredyr: np

7:55 i'd recommend you to look into some resources about functional programming

7:55 cemerick: ambrosebs: Congratulations! :-D

7:56 ambrosebs: cemerick: woo!

7:56 squidz: cemerick: do you know what i mean?

7:57 cemerick: squidz: not particularly? Your script has a -main, you have access to the command-line args. If you want to read from stdin, *in* is what you want.

7:58 ambrosebs: No news yet on moves, etc? We're all waiting to see you more regularly. ;-)

7:59 squidz: cemerick: yes, i have no problem running my script in the command line with one argument my problem is more bash related. I'm not sure how to do something like a map in bash where i apply my clojure script to a list of files in bash

8:00 cemerick: Ah. Don't ask me about bash. :-)

8:01 ambrosebs: cemerick: I will finish my honours degree around June.

8:01 And hopefully publish at least one paper by then

8:01 That much is certain :P

8:15 berdario: squidz: have you solved it yet? I think it may be better to do it from clojure side... but maybe, what you want can simply be accomplished by "ls | xargs -n1 yourcljapp > outputfile"

8:16 squidz: berdario: I havent solved it yet let me try your option out

8:19 berdario: its running, ill tell you if it worked as soon as its done

8:23 hm still running, i think it might be stuck

8:24 alright, i may just do it in clojure. I though doing it in the shell would be easier

8:33 berdario: squidz: uhm, it should work though... have you tried on a subset of the files?

8:34 ls foo* | xargs -n1 app

8:34 lazybot: dev lib media mnt proc srv tmp var

8:35 berdario: but if it's launching a new clojure for each file, I guess that may partly explain the slowness of it

8:39 squidz: berdario: it's okay, i may have been using the wrong approach, I have to rethink what i'm doing. I'm not sure I even need to run my clojure programm multiple times then

8:57 echo-area: Is there simpler ways to use a dynamically bound value inside an anonymous function, besides finding it via `get-thread-bindings'?

8:58 *a simpler way

8:58 llasram: echo-area: As in, have the function preserve the bindings active at the time it is defined, vs use the bindings active when called?

8:59 echo-area: llasram: I want to use the dynamic value.

8:59 How to evaluate something here?

8:59 How to invoke clojurebot?

8:59 llasram: &(println "example")

8:59 lazybot: ⇒ example nil

9:00 echo-area: Oh, thanks

9:00 &(do (def *v* 7) (binding [*v* 7] (map (fn [x] (list* *v* [x])) [*v*])))

9:00 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

9:00 echo-area: Hmm

9:00 &(def ^:dynamic *v* 7)

9:00 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

9:01 llasram: Heh, yeah. Sandbox

9:01 Raptum: &(ns test.foo) (def bar "baz")

9:01 lazybot: java.lang.SecurityException: You tripped the alarm! class clojure.lang.Compiler is bad!

9:02 echo-area: You see, the result of the above binding form is ((nil 7))

9:02 llasram: So the issue is that you want to get the bound value of *v*, but seq laziness means that by the time your fn is run, you may be back outside of the lexical scope of the `binding` call?

9:02 echo-area: Yes

9:02 Oh I see

9:02 Raptum: &(let [foo "bar"] (print foo))

9:02 lazybot: ⇒ barnil

9:02 Raptum: ah ok good

9:02 echo-area: llasram: Thank for the remind

9:02 llasram: Oh, np :-)

9:02 echo-area: I see why

9:03 llasram: If you want to let the seq stay lazy and not eval inside the `binding`

9:03 you can use `bound-fn`/`bound-fn*`

9:04 Or you can decide dynamic vars are bad news and stay away from them :-)

9:06 echo-area: llasram: I was not aware of the laziness (again :(), but I can't stay away from dynamic vars. I can create a solution now, thank you

10:03 squidz: after learning the fundamentals of clojure by reading clojure in action, what can I go to next to learn more about building APIs/Libraries with clojure? I guess it should be more from an abstract level than the technical level of learning the language mechanics

10:05 ohpauleez: squidz: Read through the source of Ring, Leiningen, and ClojureScript. Pickup and read Joy of Clojure,

10:05 nDuff: Hmm. You've actually fond In Action to be a good intro to fundamentals?

10:05 * nDuff is... a little surprised; didn't have that experience at all.

10:06 nDuff: squidz: ...anyhow -- Clojure Programming is a fair mix of practice (including a lot of coverage of the ecosystem) and theory, where's Joy of Clojure is still the best thing available on theory/rationale.

10:06 squidz: really why not?

10:07 what was wrong with clojure in action for you?

10:07 nDuff: squidz: Practice is useless to me unless I grok the theory first, and Clojure In Action taught no theory.

10:08 ...and it was really very limited on ecosystem coverage on the practice side, too, if compared to Clojure Programming (which, granted, is a much newer book)

10:08 squidz: ah okay. Yeah the practical side of it was useful I guess to get up to speed with the very basics, but now i'm wanting to learn more higher level stuff with clojure

10:11 nDuff: I dont really want to spend too much time figuring out the technicalities of how a library works or syntax that I already know/can easily figure out later. I want to learn how to design with clojure. Which book goes more in that direction?

10:12 nDuff: JoC

10:13 squidz: okay thanks! Ill look into it.

10:27 rkz: sqlkorma is another really good codebase to look at

10:28 nDuff: Ugh.

10:28 ...as something that's supposed to be giving an idea of good API design? Please, please no.

10:28 korma is horrible -- chock full of macros and consequently difficult to compose.

10:29 rkz: I needed to make some changes and found it quite easy to figure out where/how to do it

10:30 nDuff: rkz: I'm not saying it's hard to read or change, but that most of it isn't amenable to use with HOFs

10:30 squidz: I took a look at korma because the library looked useful. But I so far have stayed away from writing macros. I'm sure the time will come when it will be the perfect solution, but until then I will try to avoid them

10:31 rkz: that might be true, I haven't used it in anger, just to introspect a db rather than using it for reading or writing

10:31 what do you use for db access? jdbc direct?

10:32 nDuff: Built my own, more composeable layer on top of clojure.java.jdbc

10:34 * nDuff wouldn't hold that up as a pinnacle of good API design either, if only because it was only written to his own use cases. Writing good database layers is hard.

11:05 marcellu`: I'm trying to use clojure.java.shell/sh to create a function to execute any command as a different user like 'sudo -u test-user mkdir test-dir'. But it seems like sh only takes named argument pairs? https://www.refheap.com/paste/7342 that's what I have right now. Do I basically need a macro to make this work?

11:10 llasram: marcellu`: Outside of Clojure, this approach is problematic. Why can't you just allow the system `sudo` configuration to pertain, allowing the user your program runs as to use `sudo` w/o a password for the relevant commands if desired?

11:13 marcellu`: llasram: I'm specifically trying to allow multiple users to execute arbitrary command on the system

11:19 llasram: marcellu`: As a general rule, feeding a password to a program means there's a better approach. In this case, you can configure `sudo` to allow all users in a group to run arbitrary commands as root w/ no password

11:20 Then your program can just run `sudo` without worrying about feeding a password in

11:20 marcellu`: Gotcha, makes sense, thanks!

11:29 brainproxy: what caching/proxy servers do you like to put in front of your ring/jetty based apps -- varnish, nginx, other? if one goes the immutant route, is there a java-based solution that can be baked into the stack?

11:34 jcrossley3: brainproxy: for immutant, mod_cluster is recommended. or on openshift, haproxy is used.

11:37 brainproxy: i should clarify that on OS, haproxy is configured for you when you create a "scaled" app. there's nothing further you need to configure for load-balanced web requests.

11:37 brainproxy: jcrossley3: os looks cool, but I need a localized option

11:38 will admit, I really haven't experimented w/ immutant yet, though have been reading about it

11:39 dimovich: hey guys, I'm using enlive to fetch a web page with charset=windows-1251, but I get mangled output... due to wrong charset...

11:39 how can I fix this?

11:39 jcrossley3: brainproxy: i would remiss if i didn't point you to this: https://openshift.redhat.com/community/blogs/announcing-openshift-enterprise-paas-from-redhat (but it's brand new and i know bupkis about it) :)

11:39 be*

11:40 brainproxy: jcrossley3: it's got to run under Windows :-/

11:40 but thanks, bookmarked, and good to know about

11:40 jcrossley3: brainproxy: :)

11:52 dimovich: (how to load html from a string as opposed to html-resource which loads from a url)?

11:52 (with enlive that is...)

12:13 qerub: dimovich: Maybe you can wrap the string with StringReader?

12:14 dimovich: yeah... found the solution here https://groups.google.com/forum/?fromgroups=#!searchin/enlive-clj/string/enlive-clj/x4UT745nWU0/JQ3RqDk6U9UJ

12:15 (-> string java.io.StringReader html-resource)

12:15 :)

12:15 (-> string java.io.StringReader. html-resource)

12:51 pandeiro: is there a way to turn a set of characters into a regular expression?

12:57 sahadev: hello, is this the right place for a clojure newbie to ask for code review? I am currently working through Project Euler problems, while I am learning clojure. I managed to finish a few problems, but the program I came up with for a problem leaves me quite unsatisfied. I would like to know how my code can be improved.

12:57 madsy: sahadev: This place is as good as any :-)

12:58 sahadev: madsy: thanks. the program is at https://gist.github.com/4226416, if you care to look at.

12:58 madsy: sahadev: If you give us a pastebin link, I'm sure someone will take a look sooner or later

12:58 I'm not proficient enough in the language to be of service I'm afraid

12:59 sahadev: madsy: no worries. if you do feel like looking at it, and comment, i welcome it.

13:01 madsy: sahadev: Looks good to me.

13:01 Except your month-firsts can probably be done without recursion :)

13:03 sahadev: madsy: do you mean not using loop/recur?

13:03 madsy: yep

13:05 hyPiRion: looks like you could utilize reductions or something

13:35 borkdude: can I ask a stupid question? OO applications usually refer to something as the "domain model", classes with a lot of associations with other classes…. is this total bullshit? In most Clojure apps I've seen the data that is used is persisted mostly directly into the database?

13:40 llasram: sahadev: I have two main suggestions: (a) Leverage sequences and sequence operations. A reduction over a lazy sequence will generally result in more readable code than manual loop/recur

13:41 jgerman: is there a clojure idiomatic way to handle configurations (such as db connections) or is just using java Properties the common method?

13:41 borkdude: jgerman some apps use maps (leiningen), others use property files

13:41 sahadev: llasram: thanks for the suggestion. what's the second one?

13:41 llasram: Trying to think how to phrase it :-)

13:42 technomancy: property files are not idiomatic for pure clojure applications

13:42 jgerman: cool, I'll look there for ideas, thanks

13:42 borkdude: clojure isn't pure

13:42 :P

13:43 technomancy: jgerman: I recommend https://github.com/sonian/carica

13:43 unless you are trying to hide the fact that it's implemented in clojure, you should use clojure for your config files

13:44 jgerman: I'm definitely not hiding it, I'll check into that as well, thanks for the guidance, trying to get clojure into our organization

13:44 borkdude: technomancy looking good, that lib

13:45 technomancy does leiningen use it too, or just map reading from a file there?

13:45 technomancy: borkdude: disclaimer: I wrote the first version of it, but I don't know if any of my code survives in recent versions =)

13:46 borkdude: Leiningen uses load-file since it needs more than just a raw map

13:46 borkdude: jgerman for property file approach: https://github.com/trptcolin/versioneer/blob/master/src/trptcolin/versioneer/core.clj <- example

13:47 jgerman: swesome, glad I dropped in and asked

13:47 technomancy: jgerman: there is also environ which uses environment variables, but I prefer files

13:47 borkdude: technomancy jgerman the example in versioneer uses both

13:47 jgerman: files definitely are the way to go for us

13:47 borkdude: or can handle both

13:48 technomancy: borkdude: that's not application config though; it's just taking advantage of the fact that Leiningen emits a .properties file for compatibility with Maven

13:48 llasram: sahadev: Hmm. Yeah, actually, I'd say just sequences :-). Like with `month-first-days` you get a sequence of the day ordinal of the first of each month in a year. If you extended that to be a sequence over the entire time range, you could just count those sundays and be done

13:49 borkdude: technomancy true, but the idea is almost the same: get-version reads the version from an env var or from the properties file

13:50 sahadev: llasram: sounds good. i will play with that approach.

13:50 llasram: sahadev: But there's some other implications here. Like you have count-sundays, which counts sundays over a specific range. If you just had a sunday? function, you could just say (count (map sunday? days)).

13:52 sahadev: days would be the sequence of all days numbered sequentially for whole time range?

13:52 borkdude: technomancy just some ingredients to get jgerman started, not that's it currently functions as config

13:52 technomancy: sure; it's an option

13:52 it's just that limiting yourself to strings can be constricting

13:53 llasram: sahadev: Something like that. I'm getting at more of a philosophical point. Your code is broken into functions mostly at steps in a linear process instead of at boundaries of re-composable functionality

13:53 borkdude: technomancy you mean, just one level deep? yes, thats the nature of property files and env vars

13:53 technomancy: borkdude: yeah, plus you have to have special handling for things like "false" -> false

13:53 and numbers

13:54 borkdude: technomancy true

13:55 llasram: sahadev: For comparison, here's the solution I wrote when I when I was doing the Euler things: https://gist.github.com/4227022

13:58 sahadev: llasram: thanks for your time. i see some new functions (constantly and juxt). i'll look them up.

13:58 borkdude: juxt is always the answer

14:15 pjstadig: ~juxt

14:15 clojurebot: juxt is a little hard to grok but it's the best thing ever

14:39 gfredericks: postgres compatible clojure library for db migrations?

14:40 technomancy: gfredericks: https://github.com/heroku/buildkits/blob/master/src/buildkits/db/migrate.clj

14:43 llasram: *brain explodes*

14:43 So slick

14:43 technomancy: it doesn't handle downward migrations

14:43 llasram: Eh, who needs 'em

14:43 technomancy: but in my experience those never work anyway since they never get tested

14:44 the main problem is that you don't get syntax highlighting on the SQL, which is horrible

14:52 kaoD_: is there any way to print strings escaping characters? e.g. with "\x01" I don't want to print the ASCII char 1, but "\x01" (or \u0001, I don't really care)

14:52 just like what happens when console.logging objects

14:52 woops

14:53 wrong channel sorry haha

15:05 hyPiRion: ,(str (char 1))

15:05 clojurebot: ""

15:06 hyPiRion: ,(.replaceAll (str "foo " (char 1) " bar") "\\p{C}" "?")

15:06 clojurebot: "foo ? bar"

15:09 hyPiRion: Some hack with re-matcher and re-find, and you should be up there.

15:10 gfredericks: are there any good lein plugins for deploying executable jars to servers?

15:11 seangrove: Feels like I'll be shaving some yaks today, want to get on the new release of cljs and get browser repl working

15:12 technomancy: gfredericks: I recall someone using `lein deploy` on uberjars, which is a bit weird but technically feasible

15:13 err--not using `lein deploy` directly, but maybe writing a plugin that used the same underlying mechanism?

15:13 gfredericks: ah hm.

15:13 okay.

15:13 tmarble: technomancy: what does the lein search result with annotation :classifier "sources" mean?

15:13 gfredericks: maybe bash/ruby then :) thanks

15:14 technomancy: gfredericks: `lein do test, tar && s3cmd put target/whatevs.tar s3://whatevs/`

15:14 gfredericks: technomancy: do plugins have to exist in their own project?

15:14 technomancy: tmarble: java libraries typically ship source code in a separate jar file, so IDEs typically pull these in for browsing

15:14 gfredericks: it looks like just adding a src/leiningen/foo.clj doesn't give me a foo task

15:15 technomancy: gfredericks: yeah, it's possible to piggyback on an existing project but way better to do a proper plugin

15:15 tmarble: technomancy: cool, thx

15:15 gfredericks: what's the best approach for project-specific ops code?

15:15 technomancy: gfredericks: pallet?

15:15 * gfredericks hmms

15:16 gfredericks: so when you say it's possible to piggyback, why might it be that foo didn't show up as a task?

15:16 technomancy: gfredericks: it's very hard to come up with a legitimate use case for code that needs to run in Leiningen's process but wouldn't benefit from being reusable in other projects

15:16 gfredericks: I have a (ns leiningen.foo) (defn foo [] ...)

15:16 technomancy: gfredericks: src/ isn't on Leiningen's classpath

15:16 you have to add a .lein-classpath file to your project

15:17 gfredericks: anything else have to be included in there?

15:17 technomancy: echo "tasks" > .lein-classpath

15:17 lazybot: "tasks" > .lein-classpath

15:17 technomancy: thanks lazybot

15:17 gfredericks: technomancy: we're starting a high-profile pilot use of clojure here, and I'm trying to make it low-hassle

15:17 Raynes: Hahaha

15:17 amalloy: ^ score

15:17 gfredericks: writing plugins just to get a jar running on a server seems a bit much at this point

15:18 s/plugins/separate plugin projects/

15:18 technomancy: gfredericks: yeah I mean I guess the use case is "I don't have time to do it properly" in which case go for it =)

15:18 gfredericks: w00p

15:18 thanks for the tips

15:18 technomancy: it does strike me as weird that there's no scp plugin

15:19 Raynes: technomancy: Sure there is. It's called (conch.sh/with-programs [scp] (scp args))

15:19 technomancy: I recommend uploading a tarball or uberjar to s3 as the last step of your CI process

15:19 Raynes: oh snap

15:19 except I said plugin

15:19 gfredericks: S3 is again rather heavyweight

15:19 Raynes: Put that in (ns leiningen.scp) then, asshole.

15:19 ;)

15:19 technomancy: gfredericks: really?

15:20 Raynes: I already have a pretty good way of deploying apps; thanks =D

15:20 gfredericks: well we're not using it otherwise

15:20 technomancy: oh, so you'd have to hook up billing and stuff like that

15:20 gfredericks: well not quite that far

15:21 just auth/config stuff

15:21 technomancy: weird; I didn't think it was possible to write nontrivial clojure apps that didn't already have an AWS account

15:21 seangrove: Is there an easy way from lein to print out a list of dependencies? I'd like to know what version of clojurescript I'm using

15:21 lein deps doesn't output anything

15:21 technomancy: seangrove: `lein deps :tree` will do it

15:21 seangrove: technomancy: Ah, great, thank you

15:26 hyPiRion: ,(let [s (apply str (map char (range 0 0xA0)))] (clojure.string/replace s #"\p{C}" #(format "\\\\x%02x" (int (first %)))))

15:26 clojurebot: "\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\x7f\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\\x88\\x89\\x8a\\x8b\\x8c\\x8d\\x8e\\x8f\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\\x98\\x99\\x9a\\...

15:27 hyPiRion: huh, learning something every day I suppose.

15:30 qubit[01]: lein ring server, ring is not a task, what do I use to install ring ?

15:30 seangrove: Damn, I was really hoping this bug was fixed in cljs 1513

15:31 In a cljsbuild project, if I edit main.cljs, the app will load in the browser fine. If I edit any other cljs file in the project, it'll auto-rebuild it, but the js produced is broken, and I get 'Uncaught Error: Namespace "goog.debug.Error" already declared.'

15:32 If I touch main.cljs, it'll be rebuilt, and load properly

15:36 bbloom: seangrove: can you put together a minimal project to reproduce that?

15:36 seangrove: I'll see if I can, yes

15:37 bbloom: seems like that message comes from multiple calls to goog.provide

15:40 seangrove: bbloom: Yeah, I thought it was this problem https://github.com/unnali/cljs-sscce

15:40 But I think that's been fixed in cljs 1513

15:41 I also often get Java heap space errors on compilation if I've been auto-compiling for too long, in case that's not a known issue

15:41 Not a big deal, and no easily repo'able, but just mentioning it in case someone else comes across it as well

15:42 DhilipSiva: Hi anybody there ?

15:42 scriptor: yes

15:42 bbloom: SSCCE? Short, Self Contained, Correct (Compilable), Example

15:42 absurd acronym.

15:42 DhilipSiva: Hi, I am new to clojure

15:43 seangrove: Heh, I didn't make it, I just helped test the fix for it

15:43 DhilipSiva: How do I setup a dev-env on windows7?

15:43 can you guys point me to any good resource?

15:44 bbloom: ~lein

15:44 clojurebot: lein is not clojure

15:44 bbloom: ~leiningen

15:44 clojurebot: http://github.com/technomancy/leiningen

15:45 bbloom: DhilipSiva: use leiningen ^^ it has windows instructions

15:47 seangrove: so you're saying that cljs-sscce project was is fixed?

15:47 seangrove: bbloom: Yes, I believe that specific problem was fixed by dnolen a week or two ago

15:48 I actually thought that was the problem I'm having, but I don't think so

15:48 I think I have an idea of how to repro it though, will test

15:50 qubit[01]: for json encoding/decoding, is this a good library ?

15:50 https://github.com/dakrone/cheshire

15:51 bbloom: qubit[01]: I think that's the most popular one, yes

15:52 dakrone: qubit[01]: yes? but I might be biased

15:53 Raynes: qubit[01]: The best.

15:54 bbloom: seangrove: https://github.com/clojure/clojurescript/commit/79bc1a9b91699ea0c2745ab5a048aba6375d3303 is that the fix you're thinking of?

15:54 seangrove: http://dev.clojure.org/jira/browse/CLJS-282

15:55 seangrove: I think so, yes

15:56 Has that patch been released, or is it post 0.0-1513?

15:57 bbloom: seangrove: I alway use the master branch, so i have no idea what is in what release

15:57 qubit[01]: how can I start a repl that will pick up my compojure project changes without redeploying ?

15:57 bbloom: seangrove: https://github.com/clojure/clojurescript/commits/r1513

15:57 seangrove: Ok, I'd like to try that after I see if I can repo this bug

15:57 Or maybe I should switch to master and see if it's fixed there

15:57 bbloom: seems like not

15:57 master occasionally breaks, but is fixed very quickly

15:58 seangrove: Well, I'm feeling a little bit boxed in with the current version, so I'm happy to give it a try and see if I can learn more about the inanards

15:59 Presumably, I can check it out to a directory, and use :resource-paths in my lein-2 project.clj?

16:00 is there a function in cljs I can use to get its current version?

16:01 cljs.core.__version or something

16:01 I'd like to be able to tell whether or not project.cljs is picking the appropriate clojurescript version up

16:01 bbloom: seangrove: https://github.com/emezeske/lein-cljsbuild/wiki/Using-a-Git-Checkout-of-the-ClojureScript-Compiler

16:02 seangrove: Wow, awesome, thanks!

16:02 gfredericks: what does it take to be able to run the -main method in a namespace using `lein -m foo.bar`?

16:02 I'm getting a classnotfound foo.bar

16:02 sorry `lein run -m foo.bar`

16:04 I bet the ns being compileable is an important first step

16:09 seangrove: heh, sounds like it could be

16:10 Ah, damn. Seems like the bug is still there on master

16:10 Will try to put together a repro case later

16:11 hiredman: gfredericks: it depends

16:11 lein actually does a number of fall backs and bad error handling

16:12 it will try to load the namespace and run the -main function, and if it cannot find that it will try the class and the static main method

16:16 seangrove: cljs repl is at least working on master with piggieback, so made some progress there

16:18 bbloom: seangrove: hm.. .that's this piggieback thing about?

16:18 seangrove: I think it's broken with the version of clojurescript that cljsbuild 0.2.9 depends on

16:20 bbloom: what's it for exactly?

16:21 qubit[01]: is there a cleaner way to get elements out of a map than this (:title (:glossary body))

16:21 seangrove: Nice way of connecting the browser to nrepl, so the browser is the evaluation env

16:23 I've been running into more and more situations where the cycle of update-file, cljsbuild-recompile, touch main.cljs, cljsbuild-recompile, browser-refresh, test change is too slow (even though it's only ~6-7s)

16:23 So I figured getting the repl back would help alleviate that a bit

16:23 bbloom: seangrove: that fix dnolen made seems to read and re-analyze every file :-/

16:24 seems to eliminate HALF of the benefit of an incremental build

16:24 we need to do some serious work on improving the compiler infrastructure for tool usage

16:24 seangrove: Yeah, definitely some rough edges

16:25 Hopefully I'll be able to contribute some more help beyond just testing soon

16:30 brehaut: huh. core.logic is over two years old

16:36 gfredericks: what's the next paradigm after logic?

16:36 gotta stay current.

16:37 technomancy: it's going to wrap back around to assembly

16:37 bbloom: gfredericks: i've been exploring concatonative :-)

16:37 gfredericks: qubit[01]: there is get-in

16:37 bbloom: www.factorcode.org

16:38 side effects go from left to right, so it's sorta like technomancy said: wrapping back around to assembly

16:38 :-)

16:38 gotta run

16:39 gfredericks: qubit[01]: also (-> body :glossary :title)

16:39 hiredman: is logic not the ultimate paradigm? are we not just mucking around in other paradigms due to the impedance mismatch of turing machines vs. logic?

16:40 mthvedt: logic isn't deep enough… i do all my programming in zermelo-frankel set theory

16:41 gfredericks: with or without choice?

16:41 mthvedt: i'm having a hard time deciding

16:41 gfredericks: ~rimshot

16:41 clojurebot: Badum, *tish*

16:42 hiredman: mthvedt: well you are doing it wrong, you should be using category theory

16:42 brehaut: we need a dependantly typed logic monad

16:42 jkkramer: I want core.dwim

16:43 mthvedt: i prefer the category of category theories… implemented over zf sets of course

16:43 hiredman: http://en.wikipedia.org/wiki/Abstract_nonsense comedy gold

16:45 technomancy: «Note that referring to an argument as "abstract nonsense" is not supposed to be a derogatory expression, and is actually often a compliment regarding the sophistication of the argument.»

16:45 hiredman: so good

16:46 brehaut: oh man diagram chasing. im having flashbacks to post grad

16:55 AWizzArd: Best way to group elements of a seq into n-tuples? Example 1: (tuple 2 [1 2 3 4 5 6 7 8]) ==> ((1 2) (2 3) (3 4) (4 5) (5 6) (6 7) (7 8)). Another one: (tuple 3 [1 2 3 4 5 6 7 8]) ==> ((1 2 3) (2 3 4) (3 4 5) (4 5 6) (5 6 7) (6 7 8))

16:56 brehaut: ,(partition tuple 2 [1 2 3 4 5 6 7 8]) ; may want partition-all depending on remainders

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

16:56 brehaut: ,(partition 2 [1 2 3 4 5 6 7 8])

16:56 clojurebot: ((1 2) (3 4) (5 6) (7 8))

16:57 brehaut: blast. and i still missed the step

16:57 AWizzArd: Yes, currently I work with partition and nthrest.

16:57 metellus: ,(partition 2 1 '(1 2 3 4))

16:57 AWizzArd: With partition-all

16:57 clojurebot: ((1 2) (2 3) (3 4))

16:57 brehaut: ,(partition 2 1 [1 2 3 4 5 6 7 8])

16:57 clojurebot: ((1 2) (2 3) (3 4) (4 5) (5 6) ...)

16:59 AWizzArd: Okay, the step is a good idea.

17:00 Hmm no, the step also doesn’t help.

17:00 brehaut: occasionally i like to do (map … s (rest s)) for 2-tuple things where theres an obvious operation to perform on the tuple

17:01 amalloy: AWizzArd: (partition n 1 coll) does what you asked for

17:01 AWizzArd: ,(partition 3 1 [1 2 3 4 5 6 7 8])

17:01 clojurebot: ((1 2 3) (2 3 4) (3 4 5) (4 5 6) (5 6 7) ...)

17:02 AWizzArd: Excellent.

17:02 I missed that.

17:04 gphilipp: hi

17:05 Raptum: what is the opposite of `dec`?

17:05 Bronsa: inc

17:06 Raptum: *brain-fart* thanks

17:06 Raynes: Hahaha

17:06 qubit[01]: gfredericks, cool thx

17:07 gfredericks: woah

17:07 (sql-only (select foos (where {:name "Bob"})))

17:08 that works fine

17:08 meanwhile

17:08 (->> {:name "Bob"} where (select foos) sql-only)

17:08 gives a compiler exception

17:08 (wrong number of args passed to where)

17:08 why on earth are they not equivalent?

17:09 amalloy: &(clojure.tools.macro/mexpand-all '(->> {:name "Bob"} where (select foos) sql-only))

17:09 lazybot: ⇒ (sql-only (select foos (where {:name "Bob"})))

17:09 * nDuff is pretty sure he's already given his rant about korma, macros and composability as many times as it's welcome here.

17:09 amalloy: i'll go out on a limb and say they're equivalent

17:11 gfredericks: amalloy: so no other guesses about the behavior I'm seeing?

17:12 ivaraasen: nDuff: what would you suggest using instead of korma?

17:12 brehaut: gfredericks: a subatomic php partical radiating out from a near by start up passed through your computer at macro expansion time

17:12 Bronsa:

17:13 technomancy: ivaraasen: I think it's pretty clear that the correct abstractions don't exist yet

17:13 amalloy: gfredericks: i suspect that you are incorrectly placing the blame on the difference between these two expressions, when it's in fact somewhere else :P

17:13 technomancy: so you can either use the wrong abstractions or no abstractions

17:14 hiredman: or build a sql parser and emitter around a clojure datastructure representation of sql

17:14 gfredericks: huh; I get the same issue when calling macroexpand-all on the expression

17:15 technomancy: hiredman has the correct answer as usual, if you can pull it off =)

17:15 hiredman: first someone needs to write and maintain a parsing library for clojure

17:15 technomancy: =(

17:16 hiredman: which is apparently impossible

17:16 amalloy: hah

17:16 brehaut: :'(

17:17 technomancy: how important is the parser though? seems like the compiler is the main problem.

17:17 that is, I don't see a bidirectional requirement for practical purposes

17:18 hiredman: *shrug* I dunno

17:18 Raptum: oh yeah, what is the function that takes an arg and replicates it into a sequence consisting of `n` replications of the other argument

17:18 amalloy: $findfn 5 'a '[a a a a a]

17:18 Raptum: mucho gracias

17:18 lazybot: []

17:18 macdonag: Hi - I have a quick question. I can use -> to thread a value through a series of functions: e.g. (-> 5 inc inc) = 7. Is there a way to do the same thing, but by providing a seq of functions? E.g. (def l (inc inc)) (list-thread l) = 7?

17:19 gfredericks: macdonag: you could reduce over the sequence

17:19 or pass it to apply comp first

17:19 amalloy: wait, really? what did i do wrong there? should be repeat and replicate

17:19 Raynes: ????

17:19 Raynes: amalloy: You did it backwards.

17:19 $findfn '[a a a a a] 5 'a

17:19 amalloy: no way

17:19 lazybot: []

17:20 metellus: $findfn 5 'a '(a a a a a)

17:20 pjstadig: lazybot can't run programs backwards? tsk. tsk.

17:20 lazybot: []

17:20 ToxicFrog: $findfn '(a a a a a) 5 'a

17:20 lazybot: []

17:20 Raynes: *shrug*

17:20 amalloy: $findfn 7 8

17:20 macdonag: gfredericks: Hmmm, I'll look into that - thanks for the tip.

17:20 Raynes: $help findfn

17:20 lazybot: Raynes: Finds the clojure fns which, given your input, produce your output.

17:21 [clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc']

17:21 Raynes: Ugh, thanks lazybitch.

17:21 amalloy: &(repeat 5 'a)

17:21 lazybot: ⇒ (a a a a a)

17:21 gfredericks: amalloy: I'm starting to think the ->> ends up expanding contained macros differently

17:21 amalloy: gfredericks: nope

17:21 Raptum: amalloy: tyvm

17:21 ToxicFrog: &(doc findfn)

17:21 lazybot: java.lang.RuntimeException: Unable to resolve var: findfn in this context

17:21 technomancy: gfredericks: should be easy to prove

17:22 ToxicFrog: dammit lazybot

17:22 brehaut: ToxicFrog: findfn isnt a function; its a magical lazybot command

17:22 ToxicFrog: $findfn [5 'a] '(a a a a a)

17:22 technomancy: begs the question as to why there's a difference

17:22 ToxicFrog: ^

17:22 lazybot: []

17:23 pjstadig: technomancy: ITYM "raises the question"

17:23 technomancy: oops

17:23 dang it

17:23 pjstadig: english is hard

17:23 brehaut: i spend ages reading http://twitter.com/yourinamerica last night. so good

17:23 Raynes: amalloy: http://findfn.herokuapp.com/ doesn't work here either. :\

17:23 technomancy: pjstadig: nice job beating joegallo to the punch on that one

17:23 Raynes: I don't know what is going on dude.

17:23 brehaut: s/spend/spent/

17:23 Raptum: >your in america<

17:24 Raynes: ur

17:24 ur in america

17:24 joegallo: heh

17:24 technomancy: brehaut: I wish he favourited the best replies like stealthmountain does

17:24 brehaut: that would be great

17:24 gfredericks: amalloy: yeah I think so. Because sql-only is a macro

17:25 it gets passed (clojure.core/->> (clojure.core/->> {:name "Bob"} (where)) (select foos))

17:25 technomancy: https://twitter.com/andersen_xo/status/270724516290895872

17:25 gfredericks: instead of (select foos (where {:name "Bob"}))

17:25 brehaut: technomancy: thats strongly worded!

17:25 ivaraasen: technomancy: nice one

17:26 amalloy: ah, yes indeed. if more macros inside get in the way those two won't be equivalent

17:26 technomancy: I like this one since it uses "whom" properly: https://twitter.com/_therealjuke/status/254800487784804352

17:26 gfredericks: phew I'm not crazy

17:26 joegallo: whomever is one word

17:26 a swing and a miss

17:27 brehaut: technomancy, joegallo: gold

17:27 amalloy: so is whoever, but who ever is fine too

17:27 joegallo: nope, you only get full credit for "whomever", it's in the grading rubric.

17:28 :D

17:28 gfredericks: so should that be a bug?

17:28 I'm not sure that the docs would cause me to expect that mismatch

17:28 brehaut: joegallo: please never follow me on twitter or read my blog

17:29 amalloy: or listen to him in irc

17:29 brehaut: oh yeah. add me to your ignore list

17:29 pjstadig: brehaut: i think you mean "you're"

17:29 amalloy: a bug in what, gfredericks?

17:29 ivaraasen: isn't whom considered somewhat formal or archaic?

17:30 gfredericks: amalloy: in ->>

17:30 pjstadig: it's considered the objective form of who

17:30 brehaut: pjstadig: how do you rage quit this things‽

17:30 joegallo: brehaut: i'm a nice guy, this is all jk jk

17:30 amalloy: indeed, it has a different meaning than who, and is considered archaic or formal because people think english is hard

17:30 gfredericks: amalloy: because it could be implemented differently so as to be less surprising, right?

17:31 joegallo: ivaraasen: yeah, it's got a specific meaning, and that meaning is great, but if you really speak that way, most people think you sound funny.

17:31 amalloy: that's true, gfredericks. maybe not so crazy after all to file it as a bug

17:31 * gfredericks tries to figure out if -> has an analogous issue

17:32 amalloy: of course

17:32 joegallo: for instance, consider "where are you coming from?" -- ot

17:32 oops.

17:32 matthavener: is there a clojure function that does some kind of recursive merge of two maps? like (some-fn {:a 1 :b {:c 2} } {:b {:d 3}}) -> {:a 1 :b {:c 2 :d 3}}

17:32 joegallo: it's very normal english. but there are people who hate it, as you're ending a sentence with a preposition and all.

17:33 technomancy: joegallo: "from whence are you coming" is obviously superior

17:33 joegallo: but "from where are you coming?", i mean, nobody talks like that!

17:33 whence includes the from.

17:33 technomancy: oh dear

17:33 ivaraasen: joegallo: yeah, the preposition rule is quite funny

17:33 joegallo: i think you mean "whence comest thou?"

17:33 amalloy: whence come ye, matey?

17:33 joegallo: LOL

17:34 gfredericks: amalloy: okay, I'll report it this evening

17:35 amalloy: i wonder if @ShakespeareanPirate is available

17:35 Apage43: matthavener: (defn recursive-merge [& maps] (apply merge-with recursive-merge maps))

17:36 (recursive-merge {:a 1 :b {:c 2 :f {:a 1}}} {:b {:f {:b 2} :d 3}}) => {:a 1, :b {:d 3, :c 2, :f {:b 2, :a 1}}}

17:38 matthavener: Apage43: wow, awesome

17:38 for some reason i didn't think calling merge-with recursive would work..

17:40 nightfly_: Which thread will a watcher on a ref likely be called in, the thread where the watch was set or the thread that altered the ref?

17:42 My intuition says where altered, but not sure if I'm right.

17:42 Apage43: the thread doing the altering, most probably

17:47 amalloy: the docs say the watch function is called synchronously

17:47 ie, on the thread doing the changing

17:50 jballanc: ugh...I feel like an idiot, but I'm not remembering keys destructuring

17:51 (defn full-name [{:keys [first-name last-name] :as name-parts}] ...

17:51 I want name-parts to only contain the "first-name" and "last-name" key/value pairs

17:51 but if I pass a map with more than that, the entire map is bound to "name-parts"

17:51 I thought there was a way to do this?

17:53 amalloy: no

17:55 jballanc: ah well...

18:13 seangrove: Wow, it's a different world when you have a nicely working nrepl for cljs

18:13 With source maps, this could be crazy nice

18:14 ohpauleez: seangrove: Via piggieback?

18:15 seangrove: Yeah

18:15 Really warming up to it

18:16 tpope: ohpauleez: belated cheers

18:17 ohpauleez: :)

18:17 tpope: ohpauleez: try running :!lein check

18:17 you know I actually saw you at last month's portland clojure meetup

18:19 ohpauleez: tpope: No way! How did I not put that together? You're definitely on my list of "People I need to meet in person"

18:19 tpope: The hard exec ala ! works

18:19 tpope: I was visiting a friend who wanted to go

18:20 so I started reading the Clojure Book on the plane

18:20 ohpauleez: Ahh, crazy. I was just about to ask if you were still in town

18:20 Well, welcome to the community!

18:20 tpope: :)

18:21 ohpauleez: I was in the middle of finishing the nREPL support for VimClojure - so your plugin has been a HUGE save for me. Thank you

18:22 tpope: cool

18:22 I don't know what's going on with this :make thing

18:22 all I do is literally :set makeprg=lein

18:22 and it works for me

18:22 ohpauleez: yeah, neither do I. I poked at it for a bit

18:23 cemerick: seangrove: now if we can get the ritz completion middleware standardized upon, with a corresponding impl for cljs...

18:24 seangrove: Ah, yes, that would be very nice indeed

18:25 tpope: ohpauleez: anything weird in the mix like drip?

18:26 ohpauleez: tpope: it is, but even with the short-circuit it still does the same thing

18:26 tpope: short circuit?

18:26 technomancy: cemerick: what do you think about bret-victor-style live-tracing as an nrepl middleware?

18:26 hiredman: need compiler hooks

18:26 clojurebot: your response: "Hooks that can be temporary would definitely be neat, but at some point I wonder if the additional complexity is just overwhelming. It can already be bewildering to try and sort through the differences between profiles, hooks, and middlewares as it is. If there's demand for this we can pursue it, but let's not rush into it for completeness sake.

18:27 ohpauleez: tpope: LEIN_JAVA_CMD= $HOME/bin/lein

18:27 hiredman: clojurebot: shut it

18:27 clojurebot: Huh?

18:27 tpope: ohpauleez: just found https://github.com/flatland/drip/issues/46

18:27 ohpauleez: ahh

18:27 cemerick: hiredman: well, you wouldn't be able to trace intrinsics, but other stuff can be instrumented without a problem, no?

18:28 technomancy: guzheng or some such

18:28 cemerick: technomancy: in general, I think it's a totally reasonable vector

18:29 technomancy: just need to agree upon a representation and way to specify input values

18:29 cemerick: the bret-victor-style visualization may or may not be the right target w.r.t. modeling the data involved, but sure

18:30 technomancy: oh yeah; I don't necessarily mean fancy graphics; just showing values for locals

18:30 ohpauleez: tpope: after I kill all drip JVMs, the short-circuit works - thanks. I'll update the ticket

18:30 qubit[01]: silly question, to set add key/value in my map, should I use assoc , or update-in ?

18:30 cemerick: I'm still not sold on the whole pervasive-tracing thing

18:31 But I know some people are, so...whack away :-)

18:31 technomancy: I'm thinking of something you could toggle on a per-defn basis

18:31 parameters and return value alone would be easy to do with alter-var-root

18:31 let locals would be hard

18:32 cemerick: If you've got sources, you could macro yourself out of that hole

18:32 technomancy: quite true

18:33 ieure: Huh, there's no (atom?) predicate in Clojure?

18:33 Is there a predicate to tell if something is dereffable?

18:33 Other than I guess (instance? IDeref blah)

18:33 technomancy: partial instance? IDeref etc

18:33 amalloy: (partial instance? clojure.lang.IDeref)

18:33 ieure: Pretty whack

18:33 bbloom: i agreed, there's no boolean? predicate either

18:34 those all belong in core, if for no other reason than the cljs class/protocol names are slightly different

18:34 technomancy: better to have too few built-in predicates than too many

18:34 tgoossens: I've always had difficulties with seeing "robust" & "dynamic language" together. Is it correct to say that in clojure this is not really an issue because you don't invent a new type every time you want to represent somthing (in contrast to java where you would create a new class)

18:34 technomancy: but oh wait, we already have a list? predicate

18:35 cemerick: "X is slightly different in ClojureScript", for some nontrivial value of X :-P

18:35 technomancy: tgoossens: partly that and partly the fact that most dynamic languages don't make referential transparency easy/possible

18:35 bbloom: cemerick: I'm slowly trying to close the gap :-)

18:35 cemerick: bbloom: much appreciated

18:35 bbloom: technomancy: I understand the desire to have too-few, but you think atom?, boolean?, and a few others are too many?

18:35 cemerick: bbloom: where are you working these days?

18:35 technomancy: tgoossens: and most dynamic languages run on homegrown runtimes

18:36 tgoossens: technomancy: what do you mean exactly with "referential transparency " ?

18:36 technomancy: bbloom: no, I think boolean? makes sense, but list? is terrible

18:36 tgoossens: seq?

18:36 clojurebot: seq is What

18:37 bbloom: technomancy: yeaaaah, list? is interesting....

18:37 technomancy: tgoossens: referential transparency is a property of functions that will always return the same value given the same arguments

18:37 bbloom: technomancy: especially because Sequential is an emtpy marker interface…

18:37 tgoossens: oh ok in that sense

18:37 technomancy: bbloom: seq? doesn't mean sequential

18:38 bbloom: i know

18:38 technomancy: tgoossens: if you haven't read Out of the Tarpit yet I highly recommend it

18:38 tgoossens: i added it to my "to read" list :)

18:38 qubit[01]: is there anything builtin that will iterate over a list running a function on each element in parallel ?

18:38 bbloom: technomancy: referential transparency is a property of *expressions*, of which functions are a subset :-)

18:38 technomancy: oh snap

18:38 SegFaultAX: qubit[01]: Like pmap?

18:39 tgoossens: so you mean that

18:39 technomancy: bbloom: I'm going to go with the "I was assuming the context of lambda calculus" excuse where everything is a function

18:39 tgoossens: in for example python

18:39 bbloom: technomancy: ok, you win :-)

18:39 tgoossens: you are never quite sure what it is going to return

18:39 isn't that also true for clojure then?

18:39 qubit[01]: SegFaultAX, yes thats it :)

18:40 technomancy: tgoossens: it's relatively easy to tell when a clojure function is referentially transparent

18:40 SegFaultAX: qubit[01]: Make sure pmap is actually warranted before using it. You have been warned. :)

18:40 technomancy: tgoossens: and it's much easier to quarantine everything that's not into a handful of namespaces

18:41 qubit[01]: SegFaultAX, oh ? Its slow , or ?

18:41 bbloom: tpope: so vim-foreplay is a v1 attempt at a more complete repl thing?

18:41 SegFaultAX: qubit[01]: Well the synchronization overhead can make it a lot worse for trivial operations on small datasets.

18:42 ,(time (do (map (partial + 1) (range 10000)) nil))

18:42 clojurebot: "Elapsed time: 0.067383 msecs"

18:42 SegFaultAX: ,(time (do (pmap (partial + 1) (range 10000)) nil))

18:42 clojurebot: #<SecurityException java.lang.SecurityException: no threads please>

18:42 SegFaultAX: Oh, boo.

18:42 amalloy: ,(send (agent 1) inc)

18:42 clojurebot: #<Agent@3f74b62e: 1>

18:42 SegFaultAX: Anyway, run that in a repl and you'll see what I mean.

18:42 qubit[01]: ok

18:42 amalloy: SegFaultAX: i doubt he'll see any such thing, since those both return in zero time

18:43 qubit[01]: wow

18:43 SegFaultAX: amalloy: Not on mine they don't.

18:43 qubit[01]: "Elapsed time: 0.045447 msecs" / "Elapsed time: 1.207862 msecs"

18:43 SegFaultAX: amalloy: pmap takes considerably longer.

18:43 amalloy: well. my point is they don't perform any additions

18:43 SegFaultAX: Oh, right.

18:43 brehaut: SegFaultAX: did you really mean to time the creation of an unrealized sequence?

18:44 amalloy: so the regular map does literally no work at all, and pmap pays for starting up some threads

18:44 SegFaultAX: (time (do (doseq [n (pmap (partial + 1) (range 10000))]) nil))

18:45 qubit[01]: ^

18:45 The outer do becomes useless, but anyway.

18:45 The point is make sure pmap is actually worthwhile in your case.

18:45 qubit[01]: gotcha ;)

18:46 SegFaultAX: amalloy: Good catch, thanks. ;)

18:47 amalloy: Switching back from Python, I have to remember that I get laziness back.

18:47 tpope: bbloom: s/more complete/less finnicky/

18:49 bbloom: tpope: just tried K

18:49 tpope: so happy.

18:49 so very happy.

18:49 tpope: yes

18:49 SegFaultAX: K?

18:49 clojurebot: Thanks! Can I have chocolate next time

18:50 bbloom: vim :help K

18:50 Run a program to lookup the keyword under the cursor.

18:51 tpope: I felt like K and jump to source were essential if I was going to learn this clojure thing

18:51 ohpauleez: bbloom: you never did \lw in vimclojure?

18:51 ivaraasen: I thought bbloom was talking about ketamine

18:51 llasram: ivaraasen: You are not alone

18:51 bbloom: ohpauleez: i had an absurd number of issues with vimclojure, so i just kinda ignored the nailgun and all those other things

18:51 tpope: yeah that's where I was

18:52 took forever to get working, and I was constantly having to babysit it

18:52 bbloom: ohpauleez: i have a large scratch file i use with tmux pastetext

18:52 ivaraasen: llasram: an essential part of every dev kit, relly

18:52 really*

18:52 ohpauleez: bbloom: yes, vimclojure was indeed a beast

18:52 technomancy: I highly recommend the approach of keeping the static stuff separate from the repl interaction functionality

18:52 tpope: technomancy: YES

18:52 I wish VimClojure separated them :/

18:52 bbloom: tpope: so apparently you always search for an 'ns form before evaluating?

18:52 technomancy: the static stuff being coloring, indentation, and paredit

18:53 tpope: if only so I didn't have to explain to people why I depend on the tool I

18:53 'm replacing

18:53 technomancy: tpope: just say "I'm decomplecting" and everyone will understand

18:53 tpope: the static stuff can ship with Vim itself

18:53 bbloom: tpope: there is a vim clojure mailing list and iirc, the author is pretty responsive

18:53 tpope: yeah I never reached out :/

18:53 bbloom: tpope: what technomancy said :-)

18:53 tpope: the stuff I wanted to accomplish basically necessitated starting from scratch anyways

18:54 I googled decomplecting and got a blog post about rails

18:56 bbloom: tpope: http://www.infoq.com/presentations/Simple-Made-Easy

18:56 SegFaultAX: I was just going to ask if he'd seen Simple Made Easy.

18:56 bbloom: tpope: "complect" is discussed in the first few minutes

18:56 tpope: so, i use a scratch file *a lot* when doing REPL development

18:57 there is no 'ns form in there

18:57 tpope: it should fall back to the user ns, no?

18:58 as long as your scratch buffer isn't in the classpath

18:58 actually it sounds like it's in the classpath

18:58 bbloom: tpope: my scratch file is in the root of my project

18:58 scratch.clj, next to project.clj

18:58 tpope: well then it shouldn't be in the classpath

18:58 bbloom: i have scratch.* in my global git ignore

18:58 tpope: :echo foreplay#ns()

18:59 bbloom: tpope: no output

18:59 tpope: err, I don't think I ever gathered what your problem actually is

19:00 bbloom: so i have a src/proj/core.clj file

19:00 in there K works

19:00 in ./scratch.clj i get "nREPL: namespace not found"

19:00 tpope: oh hrmm

19:01 my intent was for it to fall back to user

19:01 yeah, please open a bug, I have to run an errand

19:01 should be a simple fix

19:05 bbloom: tpope: ok #9 opened

19:05 thanks!

19:17 seangrove: Hmm, nrepl gives me a blank nrepl-error-buffer popup everytime I try to auto-complete in a cljs buffer (just force of habit) - how can I suppress it?

19:18 I have nrepl-popup-stacktraces set to nil in my ~/.emacs

19:34 gfredericks: ha; cannot define -> in terms of reduce because it comes first

19:38 amalloy: you run into that problem a lot in clojure.core

19:38 gfredericks: let apparently doesn't have destructuring at line 1500 either

19:39 bbloom: it's also pretty tricky to order things

19:39 sometimes a forward declare may work, sometimes ot

19:39 not*

19:42 amalloy: gfredericks: you should try changing code that's before concat is defined. you can't even use `

19:42 gfredericks: aaaah!

19:43 bbloom: amalloy: odd… seems like macros should be able to use *any* feature, once you have the compiler boostrapped

19:44 amalloy: &'`(inc x)

19:44 lazybot: ⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/inc)) (clojure.core/list (quote clojure.core/x))))

19:44 bbloom: amalloy: i guess cljs has the jvm clojure to bootstrap it

19:45 no sense going back to rewrite the early parts of core

19:45 amalloy: bbloom: i haven't mentioned macros at all so far, so i'm not sure what you're getting at

19:45 bbloom: ` is pretty rare to be used outside of macros

19:46 but syntax-quote is bootstrapped by line 697, so that's pretty good i'd say

19:47 but the point i'm making is that cond is defined prior to syntax quote, because it is used before concat is defined. it has to be that way because macro expansion happens in the same environment as normal runtime stuff

19:47 in the case of cljs, the macro system is fully bootstrapped by the jvm clojure

19:48 so you can define cond in terms of syntax quote if you wanted

19:48 if the compiler and runtime environments were more easily disconnected (not necessarily by default) in jvm clojure, then an older version of the compiler could be used to macro expand definitions in the newer version, thus enabling you to define cond in terms of syntax quote

19:49 amalloy: does it now make sense what i was getting at?

19:52 hmm, the common lisp hyper spec states "Four different environments relevant to compilation are distinguished: the startup environment, the compilation environment, the evaluation environment, and the run-time environment."

19:54 amalloy: gfredericks: are you trying to write -> as a single-pass thing? https://www.refheap.com/paste/7363

20:03 seangrove: CL is amazing

20:03 Reader macros blew my mind the first time I understood what they did

20:06 Hmm, how can I get clojure to give me an object-literal as a string?

20:06 something like (pr-str (clj->js {:a 10 :b "foo"}))

20:08 Seems like (.stringify js/JSON (clj->js {:a 10 :b "bar"})) is the closest

20:08 bbloom: seangrove: yeah, you can't really provide a default string representation much better than [Object]

20:09 otherwise you get into a complex scenerio of how to print higher order functions, how to deal with circular dependencies, etc

20:09 seangrove: I'm trying to stick an object literal as a data-attr in markup

20:09 bbloom: same reasons defrecord defines a nice readable print output, but deftype gives you a <FooType: af00xaddress87353> thing

20:09 seangrove: use the gclosure json lib

20:09 for better browser support

20:10 goog.json/serialize

20:10 nicer usage appearance too

20:10 (:require [goog.json :as json])

20:10 seangrove: Meh, it's going to come out as a string though

20:10 bbloom: json/serialize

20:11 seangrove: Sometimes, html just drives me crazy

20:11 I'll see if I can just attach the object programmatically instead...

20:11 brehaut: seangrove: thats its primary function

20:11 seangrove: To drive me crazy, or output a string?

20:11 brehaut: drive you crazy

20:11 seangrove: Heh, fair enough

20:12 brehaut: html5: less bananas than earlier html, but now also a javascript standard library‽

20:12 bbloom: http://closure-library.googlecode.com/svn/docs/closure_goog_json_json.js.source.html#line126

20:12 brehaut: or is that library standard?

20:13 bbloom: make use of google closure libraries where available

20:13 same reason you'd make use of java libraries where appropriate

20:13 seangrove: Yeah, this is just me testing things in the repl

20:22 _zach|away: Is it possible to implement core interfaces in Clojure code? e.g. IPersistentSet?

20:23 bbloom: _zach: it's possible, but it's not a priority

20:23 _zach: see cljs

20:24 _zach: Right, there's a heap of protocols at the top of core.

20:25 So is there any reasonable way to do it now? I suppose not?

20:29 gfredericks: amalloy: that paste of -> is essentially what I just did, yeah

20:29 is that how it used to be? any idea why it's recursive?

20:33 holo: hi

20:34 amalloy: i doubt it used to be that way. i didn't grab it from the history or anything

20:34 it's probably recursive because it's shortest/easiest

20:34 gfredericks: righto

20:36 holo: in midje, is there a way to execute code when a test fails?

20:37 Quacktorcalculus: Raynes, sweetie, do you have a code example for me?

21:00 sshack: Are there any libraries for handling user authentication/amangent and maybe administration functionality for web apps?

21:00 I'm thinking in the django/rails theme.

21:01 seangrove: I'm building up a murderous, psychotic rage here

21:01 Something has hijacked M-up in emacs so that it inserts A instead of paredit-splice-sexp-killing-backwards

21:01 Anyone run into this?

21:02 sshack: a murderous psychotic rage when using emacs? Yeah, I have.

21:02 But mostly from it being 2012 and we're still pretending it's 1970. Not from your specific problem.

21:02 llasram: seangrove: It's a terminal input issue

21:03 seangrove: llasram: In the bindings help page I do see it listed under decoding maps

21:05 brehaut: sshack: in general the clojure web stack is too diverse and disperse to have one common solution for what you want. in particular, nobody really defaults to always using a particular datastore or datastore layer and instead chooses tools appropriate to the program in question.

21:05 sshack: Are there any options available?

21:05 brehaut: sshack: in saying all that, the first answer to any authentication question you have is to look at cemerick's friend library

21:05 sshack: https://github.com/cemerick/friend/ i believe

21:06 sshack: I'll have a look.

21:06 * gfredericks re-hears brehaut's answer as "cemerick's friend's library"

21:06 sshack: I don't mean to be snarky, but it does feel a little crufty to have to build your own infrastructure. Though I understand there's good reason for it. at times.

21:07 This'll work with noir?

21:07 brehaut: i have no knowledge of noir sorry

21:08 re:build your own infrustructure, the alternative is to have to deal with someone elses assumptions

21:09 for direct comparison, django's auth system has taken 7 years to be truely extensible, and even then you are still using djangos orm. djangos orm is a dog

21:09 its the intersection and lowest common denominator between relational databases and python objects

21:13 sshack: brehaut: Yeah. I've got such simple requirements, I'm okay with that.

21:13 arm, I'm okay with other peoples assumptions.

21:14 brehaut: from memory you probably want the sandbar stuff to go with friend and presumably noir

21:14 sshack: I shall have a look.

21:17 cemerick: sshack: yes, friend will work with noir, though you'll have to figure out the odd way noir applies middlewares

21:17 I think there's an example project somewhere using noir...

21:17 sshack: Well, I'm not fixed on using noir.

21:17 <- Porting an app from mathematica to clojure.

21:17 brehaut: cemerick: you can now tell him im full of crap and what the real answer is ;)

21:18 sshack: brehaut: It's cool, I had already assumed you were half full of crap. ;-)

21:19 Anyways porting from Mathematica, I'm trying to stay as high level as possible. I'm willing to accept other peoples assumptions for progress.

21:21 brehaut: sshack: if you arent definate on noir, compojure is very nice (and its the underpinning of compojure) and you can still use libnoir

21:21 compojure is (IMO) a more natural fit for web development in clojure because its closer to the ring model

21:21 but what do i know

21:21 sshack: Okay, what was the benefit of noir? Why do people choose that?

21:22 Well, more than I do. Coming from Mathematica.

21:22 brehaut: sshack: i dont know. ive never chosen noir :P

21:22 (sorry chris)

21:23 sshack: Okay. I just picked it as it seemed simple, small, good docs and was written by the same guy as norma which I was going to use for the same reasons.

21:23 brehaut: slightly more seriously, its got a good site that sells it well, and its a little more abstracted

21:23 (than compojure)

21:23 sshack: Yeah, Chris seems to sell things well.

21:23 Ahh, abstracted is good.

21:23 brehaut: is it?

21:24 hiredman: noir is a pain if you ever want to do anything besides noir

21:24 bbloom: tpope: thanks for the fix. i'm noticing that evaluating forms is kinda slow tho :-/

21:24 sshack: hiredman: In what way?

21:24 llasram: seangrove: It took me a while to remember what I'd done to fix it, but I have this in my init.el: https://gist.github.com/4230216

21:24 tpope: bbloom: sounds like you're not connected to nrepl

21:24 holo: sshack, Did you mean: ... by the same guy as korma ... ?

21:25 bbloom: tpope: oh duh, i was connected before, but forgot i closed it

21:25 sshack: brehaut: for me, yes. I'd like to focus on where I can have a convex effect on the outcomes, which means I want to spend as much of my time improving my actual application.

21:25 hiredman: sshack: it does "everything" and if you have something that doesn't fit in with its everything then you end up with a lot of pain trying to get it to work

21:25 sshack: holo: Yes.

21:26 cemerick: sshack: brehaut knows his stuff :-) Noir is opinionatedly stateful. That said, lots of people like it, and lots of people use it.

21:26 sshack: hiredman: Okay, I'll look carefully. But if it does everything I want to do right now, that's okay.

21:26 hiredman: and it has things which I just find distasteful, it launches jetty, turning a "noir app" in to a ring handler you can use with anything else is a pain (or was)

21:26 cemerick: If you grok it faster, then there's not a lot wrong with using it. If it becomes a problem later, it won't be tough to migrate to e.g. compojure given lib-noir

21:26 bbloom: tpope: would be nice to have some feedback on slow operations

21:26 holo: i use noir. i built my own validation library though

21:27 hiredman: the stateful way it builds up the middleware to use

21:27 sshack: Okay, I think the answer is, read the source and decide if I can live with that.

21:28 brehaut: sshack: i would recommend strongly learning at least the basics of Ring no matter what you choose. it will help make everything else clearer

21:28 s/recommend strongly/strongly recommend/

21:28 bbloom: tpope: cp and cpp work nice. is there a "evaluate top level" ?

21:28 other than vapcp

21:29 sshack: Probably a good bet. In the end everything seems to be based off ring, or influenced heavily by it

21:30 Are there any decent howtos on deploying clojure?

21:30 Again, I'm fine with other peoples assumptions. Basic, dumb web/postgres db app.

21:31 holo: sslhack, did you choose your IaaS?

21:31 brehaut: you might want to specify where you want to deploy it?

21:31 heroku? AWS? linux vps?

21:31 sshack: holo/brehaut: VPS moving to bare hw as it grows.

21:32 holo: sshack, sorry i made a typo with your name

21:32 sshack: very, very low transaction website, with a heavy CPU bound component.

21:32 holo: NP.

21:33 brehaut: sshack: i run my clojure webapps with an embeded jetty (i think lein-ring might have a tool for starting that easily) that i proxy-pass through to from a front end nginx server

21:33 cemerick: sshack: you can either just ship source and use `lein run` (same as what is used for heroku deployment), or you can do the .war thing

21:34 brehaut: cemerick: you clojure book has a practical about this right?

21:35 cemerick: yes, though the mix it covers is .war deployment and elastic beanstalk

21:35 heroku clojure support was nowhere near ready at the time

21:35 brehaut: probably wiser than covering ducktape-and-string

21:35 ah true

21:35 gfredericks: "The default language is Java but you can specify JavaScript, ActionScript, XML and SQL too."

21:37 sshack: cemerick: apache can handle the war thing, right?

21:37 cemerick: no

21:37 tpope: bbloom: :%Eval. also :Require does a (require 'ns :reload)

21:37 cemerick: .war files are the unit of deployment for Java servlet containers

21:38 sshack: ahh, so I have to go through some enterprise server thing.

21:38 cemerick: oh, hardly

21:38 it's not 2001 anymore ;-)

21:38 sshack: jetty is a servlet container, for example

21:38 sshack: So I should probably buy your book.

21:38 tpope: bbloom: I've been debating how to convey that java clojure.main is being used rather than a proper repl

21:39 cemerick: or, *can* be; the default ring integration ties into jetty-specific APIs for deploying ring apps, rather than going through the servlet specified APIs, IIRC

21:39 sshack: I have a bridge to sell you as well. :-)

21:39 gfredericks: does anybody know jira text formatting well enough to fix this? http://dev.clojure.org/jira/browse/CLJ-1121

21:39 {{(-> a b c)}} is all borked

21:39 sshack: cemerick: Just fyi, the last time I looked at servlet anything was 1999. I also came down with a wicked flu at the same time and haven't looked back.

21:40 cemerick: sshack: http://www.clojurebook.com if you want a précis, ToC, etc.

21:40 bbloom: tpope: so maybe you want :Reload instead of :Require ? because there is a load-file function too

21:40 cemerick: sshack: you never have to actually touch the servlet bits when you're deploying a ring app in a servlet container

21:40 gfredericks: I don't see anything obvious for inline code in the formatting docs

21:40 sshack: The words "enterprise" or "serve let" send shivers up my spine. Unless I'm uttering them.

21:41 cemerick: sshack: well, then perhaps you should skip the whole business and use a source deployment

21:41 tpope: bbloom: I made :Require pass :reload and :Require! pass :reload-all. seems like how you would want it to work interactively

21:41 bbloom: tpope: oh, i see you also have that

21:41 sshack: cemerick: I'm open to every option.

21:41 bbloom: tpope: seems like it confuses the word "require"

21:42 cemerick: It's certainly more commonplace in the community. Most abhor anything even hinting of enterprisiness as well. :-)

21:42 tpope: bbloom: it does, a little bit, but :Reload would be confusing too, because it can also load for the first time

21:42 bbloom: tpope: i guess it's ok, since you can always just eval (require 'whatever) to get the percise behavior you want

21:43 maybe the docs need a little table of vim expression to clojure expression evaluated

21:43 precise*

21:43 but anyway, what i meant by "top level form" was not the whole file, i meant a def or defn or whatever

21:44 hence vapcp

21:44 tpope: bbloom: oh, :Eval does that if you don't give a range

21:44 bbloom: also cpap would work if it's really a paragraph

21:45 bbloom: tpope: hm right. i wonder if what cpp is now should be cpip

21:45 or something like that

21:46 cp% maybe

21:46 tpope: cp% will work if you're on the parentheses

21:46 bbloom: evaluating top level forms is what i want to do 99% of the time

21:46 tpope: cpab would be the vimmy way to do that

21:46 bbloom: whenever i change a function definition

21:46 tpope: yeah I'll think about that

21:46 bbloom: cpp is nice and easy to type

21:47 tpope: it's not too late to make it the default

21:47 bbloom: it gets my vote :-)

21:48 i didn't know about ab and ib, thanks :-)

21:48 that will be useful for lots of other stuff too!

21:48 tpope: other facet to consider is the parallel to cqq

21:48 ie "start with this but let me edit it"

21:48 jcrossley3: cemerick: abhor? pish-posh ;)

21:48 tpope: I find that to be more useful for innermost form

21:48 bbloom: i just find it very rare that i want to evaluate a single expression without the lexical environment

21:49 tpope: well by edit it, I mean doing stuff like wrapping it in a macroexpand

21:49 cemerick: jcrossley3: ;-)

21:49 bbloom: and, when i do want to do that, it's for debugging and usually will take several tries. in that case, i copy it out to a scratch file as a top level

21:49 cemerick: jcrossley3: there's actually data on this

21:49 bbloom: but i guess the little quasi repl thing might be useful there...

21:49 cemerick: "abhor" perhaps is over-strong

21:50 tpope: that's the idea

21:50 bbloom: i never really considered q: as a sort of vim command scratch pad

21:50 it's an odd parallel with the scratch file in emacs….

21:50 tpope: I didn't either until this plugin :)

21:50 jcrossley3: cemerick: it's a big world. there are all sorts of crazies in it.

21:50 cemerick: jcrossley3: Don't I know it. I pay bills thanks to that world.

21:50 tpope: I haven't beat on it to hard yet

21:51 cemerick: jcrossley3: I think there's something interesting in the positioning of Immutant, though. Whatever 'enterprisey' means or doesn't, I think Immutant has the potential for very, very broad appeal

21:51 bbloom: well in the clojure world, it's very common to use a scratch area

21:51 tpope: like this https://github.com/clojure/clojure/blob/master/src/clj/clojure/zip.clj#L281

21:52 sshack: Are there any tools people are using to build RESTful api's?

21:52 bbloom: even though the q: style quasi repl is a useful scratch area for recent commands, i suspect most people prefer to work with more visual scratch space, like in a comment block

21:52 but in that case, evaluating the top level would be (comment …)

21:52 tpope: bbloom: that's what I was about to point out!

21:52 cemerick: sshack: bishop or liberator

21:52 bbloom: hence i never have blank lines in my functions, so i always use a vim paragraph text object

21:52 sshack: Cool. Will look.

21:53 tpope: bbloom: in practice I mostly use cpp while already at the outermost expression

21:53 bbloom: but also, sometimes i have several statements in a row and evaluate them as a paragraph as a sort of top-level implicit 'do

21:53 tpope: but "mostly" is a pretty empty claim for my limited experience

21:53 amalloy: yuck. don't refer to code that hasn't been touched for 4 1/2 years, and then only by rich himself, as an example of something it's common to do in clojure

21:53 bbloom: yeah, i guess cpp works if you're at the beginning of the form

21:54 but there isn't an obvious way to get to the beginning quickly…. {j or something

21:54 jcrossley3: cemerick: interest and potential, indeed. thanks for the encouragement. ;)

21:55 tpope: 99[( :/

21:56 bbloom: one possibility is making cpp do outermost, but giving a count (1cpp) does nth innermost

21:57 bbloom: hmm that's interesting

21:57 tpope: is there a way to see my evaluation log? ie view the repl session

21:57 tpope: negative

21:57 bbloom: ok, not a high priority

21:58 i really appreciate the effort you're putting into this… huuuge productivity boost for me. my vimscriptfu isn't quite up to the task

21:58 tpope: hey man, I did it for me

21:59 bbloom: +1 for scratching your own itch

21:59 sshack: cemerick: Those two look like nicely built libraries. I'll have to spend some time with them. Thanks for the pointers.

22:01 bbloom: tpope: i notice that nothing is captured from *out* or *err*

22:01 tpope: bbloom: it's echoed. *err* gets error highlighting

22:01 seemed like the right behavior, no?

22:02 bbloom: tpope: (doseq [i (range 10)] (println i)) ;; only prints nil

22:03 oh, i'm running nrepl headless… is it printed to that shell?

22:03 tpope: shouldn't be

22:03 bbloom: :Doc calls (doc ...), which prints

22:04 just tried your example and I got 11 lines

22:04 bbloom: tpope: hmm interesting… if you run `lein repl :headless` it doesn't work

22:05 oh now it does

22:05 wtf? weird...

22:05 tpope: yeah works for me

22:05 bbloom: something is fishy here...

22:05 brehaut: wow, disclojure hasnt tweeted anything in ages, and suddenly its something big

22:06 "Apparently Microsoft is doing something big with clojure. Waiting for lawyer release to hear about it…"

22:07 bbloom: tpope: i'm not sure why it didn't work before… if i see it break again, i'll try to reproduce

22:07 amalloy: reeeeeeally

22:07 bbloom: seems to be workign fine tho

22:08 samflores: tpope, bbloom: tried the same example here and I'm getting just "nil" too

22:08 but I get the 11 lines if i run :Require

22:08 bbloom: damn heisenbugs

22:09 tpope: samflores: is it repeatable?

22:09 I have some stuff you can try

22:09 S11001001: ~stylel

22:09 clojurebot: excusez-moi

22:09 bbloom: brehaut: hmm curious!

22:09 S11001001: ~style

22:09 clojurebot: Man, the living creature, the creating individual, is always more important than any established style or system. -- Bruce Lee

22:09 samflores: yep, tried several times. same thing

22:10 tpope: samflores: :echo foreplay#client().connection.call({"op": "eval", "code": "(doseq [i (range 10)] (println i))"})

22:10 brehaut: bbloom: indeed

22:10 tpope: returns a list of the packets it got back from nrepl

22:10 brehaut: bbloom: absolutely no reliable information at this side, but nevertheless

22:11 bbloom: brehaut: i keep saying it, but the languages guys at msft actually know what they are doing :-)

22:11 amalloy: windows 9: a clojure app?

22:11 bbloom: some people just don't believe me :-)

22:11 brehaut: bbloom: i totally agree

22:11 amalloy: ha

22:11 samflores: tpope: https://gist.github.com/4230438

22:11 bbloom: amalloy: well win 8 is half c++ and half javascript

22:11 tpope: samflores: that looks like nrepl is sending it back...

22:11 samflores: try again, but s/call/process/

22:11 Apage43: I was notificng an issue around this yesterday

22:11 brehaut: bbloom: i imagine their language hallway is pipeline for funneling smart into mainstream languages. Haskell guys invent something, F# guys make it work on .net, C# guys make it accessible

22:11 bbloom: so my bet is CLJ++ and CLJS /s

22:12 brehaut: that's basically how it works lol

22:12 Apage43: it was working if I grouped everything in (print (with-out-str …))

22:12 Could be something to do with how the out packets are buffered

22:12 samflores: tpope: updated the gist

22:12 Apage43: it looked like it tried to chop the last newline off -each- out packet as well, so if you have a bunch of (printlns) that send as sepeate nREPL out packets

22:12 you wont see any of them

22:13 since it chops the newlines off each, and they echo as a single line, and then that doesn't trigger a pause, not being multiline, and then it prints the return value, so you never see the stdout

22:14 so for example, I couldn't get (pprint/print-table) to work in foreplay without manually buffering it

22:14 tpope: samflores: okay, that's it working as expected

22:15 samflores: maybe I have some broken Vim setting

22:15 tpope: possibly

22:15 samflores: reproducible if you start a fresh vim?

22:16 samflores: does stuff like K still work?

22:16 samflores: yep. tried both a fresh vim and a fresh repl

22:16 tpope: K works fine

22:17 tpope: perhaps because it doesn't output the nil at the end

22:17 maybe it's redrawing over itself

22:17 try :echo 1|echo 2|echo 3

22:17 do you get 3 lines?

22:17 samflores: tpope: no, just the nil

22:17 Apage43: this is the issue I described: https://www.refheap.com/paste/7367

22:18 tpope: samflores: the :echo line shouldn't output nil

22:24 samflores: tpope: sorry, I didn't see the :echo command.

22:24 yes, I got 3 lines

22:24 tpope: hrmph

22:25 can you try something that outputs to *err* instead?

22:30 * samflores tpope: same thing - cpp got nil, but :Require gives "(require 'foo.core :reload)

22:30 samflores: print to *err*

22:30 Press ENTER or type command to continue"

22:30 oops

22:30 tpope: one difference of :Require is that it doesn't output the nil at the end :/

22:30 Apage43: (binding [*out* *err*] (println "WHAT\n")) works for me; (binding [*out* *err*] (println "WHAT")) gets me only the nil

22:31 tpope: Apage43: interesting!

22:32 samflores: Apage43, tpope: "\n" dit the trick here too

22:32 tpope: they both work the same for me

22:32 I'm not sure why

22:32 * Apage43 is on OSX

22:32 tpope: obvious option to check is lazyredraw

22:32 but I tried it both ways

22:33 samflores: mine is off

22:33 brehaut: Apage43: out of curiosity, what does a (do (println "WHAT") (flush)) do?

22:33 * Apage43 tried with and without, same result

22:33 samflores: no change turning it on

22:33 Apage43: brehaut: nil

22:34 here's really weird: (do (println "WHAT") (println "HUH") (flush)) is ALSO nil

22:34 (do (println "WHAT") (println "HUH\n") (flush)) is ONLY "HUH"

22:35 (print (with-out-str (println "WHAT") (println "HUH"))) is the whole thing, "WHAT\nHUH"

22:36 tpope: try :echo "1\n"|echo "2\n"|echo "3\n"|echo "nil"

22:36 println sends a single \n, so that's basically equivalent to what we're doing

22:37 whereas adding \n doubles it up

22:37 samflores: got 4 lines (1, 2, 3 and nil)

22:37 Apage43: 1, 2, 3, nil separated by new lines

22:37 basicsensei: hey guys, I want to reify (or change the implementation of) baseLoader which is a static java method in clojure.lang.RT, can I have some sugestions for doing so?

22:38 and if that's possible, does that mean that everything using that method will use the modified version?

22:39 tpope: can you guys try stripping down to a barebones config and see if it's still a problem?

22:39 I'll do the same

22:41 basicsensei: anyone?

22:41 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:42 Apage43: tpope: it looks like you're stripping the newlines off the end of 'out' and 'err' packets here; https://github.com/tpope/vim-foreplay/blob/master/autoload/nrepl/foreplay_connection.vim#L113

22:43 tpope: Apage43: forgot that but rings a bell. I think I was having extra blank lines

22:43 guys I just tried with nothing but pathogen and foreplay

22:43 and it worked

22:43 it's your turn

22:44 bbloom: tpope: i'm about to sit down for a real coding session. i'll let you know how it works out

22:44 i'll try to only use foreplay rather than my old hacky techniques

22:44 tpope: have fun!

22:49 Apage43: tpope: same behavior, not even pathogen, just a bare .vim folder with nothing but pathogen and an empty .vimrc

22:49 (aside from whatever defaults MacVim jam-a-lams in there)

22:49 tpope: okay, what version of macvim?

22:49 I can't imagine that being relevant

22:50 samflores: tpope: pathogen and foreplay = no luck =\

22:50 tpope: (tonight I've been doing everything on linux, but a huge chunck of the development happened on macvim)

22:50 are you in the terminal or gui?

22:50 Apage43: v7.3 (75)

22:50 vim version 7.3.646

22:51 also s/75/65

22:51 fat fingered that

22:51 bbloom: Apage43: heh, i'm on snapshot 61… i guess i'm overdue for an upgrade

22:52 samflores: macvim too, 7.3.646

22:52 basicsensei: there's no way to change the implementation of any method if the object is already instantiated ?

22:52 samflores: tpope: tried both GUI and terminal

22:53 Apage43: basicsensei: nope.

22:53 basicsensei: Apage43: thanks for confirming

22:53 Apage43: That's a JVM thing. You can sort of load a new class over that one's name, but the old instances hanging around are tied to the old one.

22:54 basicsensei: Apage43: I want to change a static method's implementation, is that possible?

22:54 tpope: let me try upgrading my macvim

22:54 basicsensei: Apage43: at runtime I mean

22:55 Apage43: You get really werid behavior w.r.t. that and using (defrecord..) in a REPL, for example, because if you re-run (defrecord) all the old instances are -really- instances of a different class with the same name, and lots of things break

22:55 basicsensei: don't think it is

22:56 basicsensei: Apage43: hmm could that class classloader somehow "change" that static method? in theory

22:56 Apage43: i mean, you could load a new version of that class wholesale

22:57 but there's not a way to -just- override a single method

22:57 you might be able to do some fancy tricks with something like asm to get what you want

22:57 amalloy: basicsensei: no

22:57 basicsensei: Apage43: you mean I could reify that class somehow? before loading it?

22:58 Apage43: i don't understand what you mean

22:58 amalloy: a class that's loaded is loaded, forevermore

22:58 Apage43: that

22:58 you can never get rid of it, at best, you can have two with the same name

22:58 which is just trouble

22:58 basicsensei: oh i see

23:02 tpope: Apage43, samflores: I just installed the latest macvim snapshot, stripped down to basics, and it still worked :/

23:02 I don't get it

23:07 bbloom: upgraded my macvim

23:08 and the font rendering is just subtly different

23:08 driving me slightly insane

23:08 amazing how used to your tools you get

23:08 tpope: Apage43, samflores: ACTUALLY I've been doing cqp rather than cpp this whole time. when I switch to the latter, I get more interesting results

23:10 samflores: did you reproduce the issue?

23:11 basicsensei: alright guys thanks, that was the wrong way anyway, it would've been the same as setting clojure.lang.Compiler.LOADER which is not gonna work for me anyway: i need different classpaths at different points in code execution (ie. 2 different plugins running)

23:11 tpope: looks like it

23:11 bbloom: mmmm this fixes the rendering: :set linespace=3

23:11 much more comfortable :-)

23:13 i have uninstalled programs in rage over smaller font rendering issues :-)

23:13 samflores: tpope: but 'cqp' does no good here

23:13 tpope: I've long since forgotten the original usecase

23:14 samflores: tpope: (doseq [i (range 10)] (println i))

23:14 tpope: yeah I remember that

23:14 but that's an example, not a usecase

23:14 samflores: ah

23:14 tpope: cqp can handle that just fine

23:15 I guess it doesn't matter, because this is definitely a bug

23:20 samflores: okay, I have a pretty good understanding of the problem. it's not getting fixed tonight

23:22 samflores: no problem

23:24 anyway, thanks for the great plugin.

23:53 lynaghk: ping: Raynes ninjudd

23:54 Raynes: Hi.

23:54 lynaghk: I'm trying to use Drip, but I'm not sure what to do to get it to cache some of my Clojure namespaces

23:54 Raynes: Oh, I'm useless with drip.

23:54 Ask amalloy.

23:54 lynaghk: oh, damn. I just assumed you knew all about it = )

23:54 Raynes: But I guess I just did.

23:54 drip is the flatland project I know the least about, in fact!

23:55 amalloy: lynaghk: you really only want to cache totally-static never-ever-changes namespaces

23:55 Raynes: Probably the only one active project I don't have a single commit in. :p

23:55 lynaghk: I have namespace NS and I was hoping that "drip -jar my.jar NS arg1 arg2 arg3" would be fast after repeated invocations

23:55 amalloy: my use case is to use drip to make it viable to have autogenerated documentation call a function from the system to make output

23:56 but right now that's not tenable if each time a chart is mentioned in the docs a JVM needs to startup to draw the chart

23:56 amalloy: lynaghk: have you looked at https://github.com/flatland/drip#pre-initialization ?

23:57 lynaghk: amalloy: yeah, I just came across that but was a bit unclear about what it meant in practice---was hoping to figure it out and then add a concrete example to the Clojure wiki

23:57 amalloy: i think the idea is to set the class to clojure.main and the the args to "-e (require 'my-ns)"

23:57 only formatted correctly, whatever that is

23:58 lynaghk: amalloy: ah, I see. Because drip knows nothing special about Clojure.

23:58 amalloy: so it won't do anything with Clojure namespaces automatically. I need to explicitly tell it to require a ns if I want that namespace to be quickly available

23:59 amalloy: yep

Logging service provided by n01se.net