#clojure log - Oct 25 2011

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

0:00 technomancy: sean_corfield: don't sweat the extra lisp module for now

0:00 sean_corfield: ok, i _do_ have clojure-mode but i expected the starter-kit stuff to provide slime or swank or whatever else i need

0:00 simard: is a "protocol" just a convenient way to do a "defmulti" that dispatches on the class of the object ?

0:01 brehaut: simard: thats a simplification of it

0:01 sean_corfield: i want a repl but don't have clojure-jack-in or slime-connect or swank-whatever-it-was-that-someone-recommended

0:01 simard: brehaut: what are the most striking details I'm forgetting ?

0:01 brehaut: simard: it provides performance and interop benefits in exchange for loosing some flexibility

0:01 technomancy: sean_corfield: if you don't have clojure-jack-in then you must have a really old version of clojure-mode

0:02 simard: brehaut: and apart from that, I was "right on" ?

0:02 sean_corfield: i followed the instructions... *glare* :)

0:02 brehaut: simard: the other major charactistic is that protocols can have multiple methods, and multis are just a single function

0:02 simard: oh..

0:02 technomancy: sean_corfield: you mentioned it's fetching from tromey.com?

0:02 brehaut: simard: go look at reify, it might be enlightening

0:02 technomancy: that would explain being way out of date if you're using that instead of marmalade

0:03 sean_corfield: technomancy: when i started trying to install the starter-kit

0:03 i'm just following your starter-kit instructions

0:03 technomancy: sean_corfield: where was tromey.com mentioned?

0:03 I thought I had removed all that

0:03 sean_corfield: i don't understand any of this emacs crap, which is why i'm following your instructions...

0:03 brehaut: simard: if you have the time and money, joy of clojure has a nice and comprehensive look at both multis and protocols et al

0:04 technomancy: sean_corfield: yeah, I'm just trying to make sure they are accurate

0:04 sean_corfield: contacting tromey.com:80 appeared in the emacs minibuffer when i was trying to install per the instructions

0:04 this is the second time i've gone thru this - it didn't work properly on os x either earlier

0:05 simard: brehaut: maybe hehe :)

0:05 sean_corfield: i'm stunned at how hard it was to get emacs 24 installed on ubuntu...

0:05 technomancy: sean_corfield: even with emacs.naquadah.org?

0:05 brehaut: simard: its a very good book, even if you are familiar with a lot of its topics you'll learn valuable stuff

0:06 sean_corfield: technomancy: damein cassou's ppa for the apt-get install emacs-snapshot

0:06 simard: it seems to enjoy good reviews on amazon

0:06 sean_corfield: i recall seeing emacs.naquadah.org somewhere in my frustrating travels this evening :)

0:06 technomancy: sean_corfield: what starter-kit instructions did you use?

0:07 simard: I already own "Programming Clojure", which is why I hesitate buying a second book on Clojure

0:07 for now

0:07 sean_corfield: https://github.com/technomancy/emacs-starter-kit

0:07 technomancy: the current readme mentions naquadah and not tromey.com, so you must have found something else

0:07 sean_corfield: i followed those instructions exactly

0:08 tromey.com was where it looked on os x

0:08 someone said i had to compile the lines in init.el and that "solved" the problem

0:08 so on os x i *might* have .emacs file which i can remove tomorrow

0:08 right now i'm focused on ubuntu

0:09 so... can i query what version of things i've got in, to help debug this?

0:09 ah, clojure-mode 1.11.2 it says

0:10 technomancy: if you have that version of clojure-mode, then you have M-x clojure-jack-in

0:10 sean_corfield: fwiw, it's definitely using marmalade on my ubuntu netbook

0:11 when i try M-x cloj... it says no match

0:13 technomancy: wow, I have never heard of anything like that

0:13 simard: :)

0:13 technomancy: how are you finding the version?

0:14 sean_corfield: in the packages list buffer it shows the version

0:14 i see clojure-mode there but can't figure out how to enable clojure-ode

0:14 mode

0:14 technomancy: it's supposed to be autoloaded

0:15 there's nothing for you to do

0:15 you can go in and find the file in ~/.emacs.d/elpa/clojure-mode[...]/clojure-mode.el and do M-x eval-buffer

0:15 if you want to bypass the package manager

0:15 sean_corfield: 'k

0:15 technomancy: but I'm totally baffled as to why the autoloads aren't happening

0:16 never seen anything like that.

0:16 sean_corfield: the elpa folder doesn't seem to contain clojure-mode

0:17 nope... starter-kit-lisp-2.0.3 but no clojure-mode

0:17 technomancy: sean_corfield: but the package-list buffer shows it as installed?

0:17 sean_corfield: as far as i understand emacs, yes

0:18 technomancy: well, it's not installed

0:18 maybe try M-x package-install clojure-mode again?

0:19 sean_corfield: so the starter-kit-lisp is installed but clojure-mode isn't??

0:19 lazybot: sean_corfield: Definitely not.

0:19 technomancy: right

0:19 the lisp module of starter kit has stuff that's generic to all lisps

0:19 it doesn't depend on clojure-mode

0:19 sean_corfield: how are folks supposed to know what to install?

0:20 ok, an explicit install of clojure-mode seemed to work... *sigh*

0:20 technomancy: traditionally the readme? =)

0:21 semperos: I still think a "vanilla" Emacs, adding the Marmalade repo and following technomancy's instructions for swank-clojure provides the path of least resistance to getting started with Emacs

0:21 (I've not tried the starter kit myself)

0:21 for Clojure dev, I should say

0:21 technomancy: semperos: that's what I keep trying to tell folks, but everyone else insists on convincing people to use the starter kit =)

0:21 zerokarmaleft: semperos: same here

0:22 sean_corfield: but that information is not gathered in one place, is it?

0:22 semperos: https://github.com/technomancy/swank-clojure

0:22 three bullets

0:22 Install clojure-mode either from Marmalade or from git.

0:22 lein plugin install swank-clojure 1.3.3

0:22 From inside a project, invoke M-x clojure-jack-in

0:22 technomancy: as an overview, this covers it: http://dev.clojure.org/display/doc/Getting+Started+with+Emacs

0:22 possibly in more detail than is warranted, but it does focus on clojure-mode first

0:23 sean_corfield: that page starts out by recommending the starter-kit...

0:23 technomancy: yeah... I didn't write that =\

0:23 sean_corfield: but it does not make it clear what instructions cause what to be installed

0:23 technomancy: also the &#*& comments are useless, but I can't delete them

0:24 mintsoup: It implies, somewhat poorly, that installing clojure-mode is step 2

0:24 sean_corfield: oh i hadn't even gotten to the comments

0:24 now i finally have clojure-mode installed(!) i can do clojure-jack-in

0:24 brehaut: people read comments anywhere in 2011?

0:24 technomancy: comments like that are unavoidable when you prohibit people from editing the wiki.

0:24 sean_corfield: but it couldn't find project.clj

0:24 *sigh*

0:25 mintsoup: you'll want to use https://github.com/technomancy/leiningen to create a project

0:25 zerokarmaleft: good grief, these comments are complicated

0:26 only 20+ or so steps

0:26 sean_corfield: i've got a leiningen project

0:26 i've been using leiningen for ages

0:26 simard: sean_corfield: open a source file for this project before running M-x clojure-jack-in

0:26 semperos: where did you execute clojure-jack-in? what was your active buffer?

0:26 sean_corfield: the only new piece of the puzzle here is ^%$$% emacs

0:26 technomancy: zerokarmaleft: http://www.penny-arcade.com/comic/2003/05/09

0:27 sean_corfield: yeah, yeah, i figured that out now...

0:27 simard: :D

0:27 sean_corfield: i got some error about symbol matching its value in reflection ???? and a buffer full of warnings

0:28 technomancy: give it a minute

0:28 the first time you connect it has to byte-compile a few elisp libs

0:28 sean_corfield: ok, i finally found a buffer called *swank*

0:29 also full of reflection warnings...

0:29 technomancy: sean_corfield: sooooo... where do we fix the docs, then?

0:29 sean_corfield: and it ends with proceed to jack in

0:29 zerokarmaleft: technomancy: heh

0:29 technomancy: probably start with moving the mention of the starter kit to the bottom of the getting started with emacs page?

0:29 sean_corfield: technomancy: hard to say since i've no idea where it stopped working per the instructions

0:30 so at this point i have zero idea whether i have a working repl or not

0:30 technomancy: I think the main problem was there was too much distracting you from clojure-mode

0:31 the repl buffer should be called *slime-repl clojure*

0:32 sean_corfield: the wiki should describe only what is needed to get this running

0:32 mintsoup: technomancy: for me, the instructions that got me up and running the fastest was https://github.com/technomancy/swank-clojure

0:32 sean_corfield: and it should be the single, recommended way to do it

0:33 technomancy: well, it used to be that inf-lisp was much simpler to set up than slime

0:33 sean_corfield: what about lein swank?

0:33 technomancy: but maybe it's not even worth mentioning inf-lisp

0:33 sean_corfield: i ran that in a terminal window so it's happily sitting there

0:34 but none of the instructions i read got me closer to using that...

0:34 technomancy: sean_corfield: that's only necessary if you want your clojure process to outlive your emacs instance

0:34 mintsoup: clojure-jack-in should start lein swank for you

0:34 sean_corfield: that is not explained on the wiki

0:34 the wiki assumes a LOT

0:35 so i'm starting emacs back up

0:35 what small steps should i follow to get a repl running in my project?

0:35 Raynes: I really need to get jack-in working with cake.

0:35 sean_corfield: i've opened my project.clj file...

0:36 M-x clojure-jack-in ...

0:36 Starting swank server...

0:36 zerokarmaleft: profit?

0:36 sean_corfield: ...waiting...

0:37 * michaelr525 is eating a bannana

0:37 sean_corfield: error in process filter: Symbol's value as variable is void: Reflection

0:37 and that seems to kill it

0:38 now what?

0:38 semperos: (given how many issues crop up, I now prefer a completely hands off approach; find someone who does Clojure dev in Emacs and shares their emacs config via Github; clone that puppy, symlink the init file (.emacs) to your home folder and start coding)

0:40 sean_corfield: the instructions at https://github.com/technomancy/swank-clojure are simpler (but don't explain how to install anything from marmalade!) and as we've just seen, clojure-jack-in does not work for me

0:41 technomancy: marmalade was a lot more important when there were three or four elisp files involved

0:41 now that it's only one it's not so terrible to do everything by hand

0:41 sean_corfield: so, how do we debug this failure of clojure-jack-in?

0:42 technomancy: it's possible that output during startup of the process could interfere

0:42 sean_corfield: what's that "error in process filter" about?

0:42 reflection warnings could cause it to fail?

0:42 technomancy: the lein process is supposed to emit valid elisp

0:42 oh!

0:43 it could be a :repl-init key or something

0:43 amalloy: technomancy: i think sean_corfield has warn-on-reflection set to true

0:44 sean_corfield: yes, we always run with that at world singles

0:44 amalloy: in which case Reflection would be the first word of the elisp that emacs doesn't like

0:44 scgilardi: nice one, amalloy

0:44 technomancy: oh I guess you would get that even with bare swank regardless of the project

0:44 sean_corfield: it's why i keep reporting so many reflection warnings on projects :)

0:44 so i set it to false, but now i can't get it to kill the existing swank process...

0:44 *grrrr*

0:44 oh hallelujah!!! Connected!!!!

0:45 i have a REPL! the angels are singing!

0:45 technomancy: ok, that is definitely a flat out bug

0:45 sean_corfield: so i can't use warn-on-reflection???

0:45 lazybot: sean_corfield: How could that be wrong?

0:45 technomancy: adding it to the "Troubleshooting" section of the readme for now

0:45 Raynes: I think the sarcasm in here is getting a little strong. Maybe we should open a window?

0:46 michaelr525: Raynes: a buffer?

0:46 mintsoup: getting emacs to work sometimes feels miraculous

0:46 brehaut: michaelr525: i think you mean a frame

0:47 sean_corfield: Raynes: it's nearly 10pm here... i've been wrestling with emacs for about five hours so far...

0:47 brehaut: the problem, when you get right down with it, is shoggoths

0:47 sean_corfield: the problem is emacs :)

0:48 brehaut: sean_corfield: and all shoggoths, emacs is corpulent, ancient, and hard to tame

0:48 s/and all/ and like all/

0:48 technomancy: and there was one bona-fide bug there at the end

0:48 sean_corfield: so... now i have a repl... where's a nice, simple set of instructions on how to run code from one buffer in the repl...

0:48 Raynes: After using Vim and Sublime Text 2 for a couple of weeks, I appreciate Emacs in ways I can't really describe.

0:49 mintsoup: https://github.com/technomancy/swank-clojure has a listing of commands you can run

0:49 sean_corfield: yeah mintsoup but it's not really clear what each actually means

0:49 Raynes: One thing to keep in mind is that SLIME isn't Emacs. Slime crazy != Emacs crazy. If they're both crazy, it's for different reasons.

0:49 sean_corfield: i'm comparing this whole experience to CCW, btw, which is clarity itself compared to emacs

0:50 brehaut: sean_corfield: C-c C-e evaluates the expression under/behind the insertion point

0:50 mintsoup: well.. when i'm screwing around w/ stuff, i'll do something like C-c C-l to load my current file into the repl

0:50 brehaut: which is a decent place to start

0:51 amalloy: brehaut: that's C-x C-e

0:51 C-c C-e evals the current top-level form

0:51 (as does C-M-x)

0:51 * technomancy runs out of battery

0:51 Raynes: I once compared Hamburger Helper to a well-cooked new york strip steak. I was surprised to find the latter more tasty, but harder to make.

0:51 scgilardi: thanks for all your patient help, phil!

0:52 amalloy: technomancy: unclear whether your computer has run out of battery; or you're going to bed; or you're tired of helping with emacs; or your cybernetics are finally giving out

0:52 i encourage you to not clarify

0:53 sean_corfield: in CCW, you load file into repl and then switch repl namespace, which also moves the cursor to the repl

0:53 scgilardi: bring up clj file you're interested in and verify the cursor is in it, C-c C-k to compile and load it, C-c M-p <ret> to move the repl into its namespace, C-x o (possibly more than once) to move the cursor to the repl window, run functions from that namespace by simple name in the slime repl.

0:54 sean_corfield: seems like in slime you have to do three commands? c-c c-l, c-c m-p and then c-c c-z?

0:54 yeah, i noticed i also have to confirm the namespace change with RET

0:54 amalloy: scgilardi: C-c C-z nicer than C-x o

0:54 sean_corfield: makes it more work than CCW

0:54 scgilardi: yes, didn't know about it. cool.

0:54 Raynes: You could write your own command to do that.

0:54 If you really, really wanted to.

0:55 semperos: you can always set switch buffer to whatever you like, I use C-'

0:57 sean_corfield: in CCW, you can select the form at point and expand it out to enclosing forms and then evaluate that in the repl... what's the paredit / slime equivalent?

0:59 c-h a paredit brings up a lot of commands but doesn't seem to list keyboard shortcuts?

0:59 michaelr525: semperos: using right-Ctrl?

0:59 semperos: michaelr525: left Ctrl (remapped to my caps lock key) plus single-quote

0:59 Raynes: http://www.emacswiki.org/emacs/PareditCheatsheet

1:00 michaelr525: semperos: i use this http://mumble.net/~campbell/emacs/paredit.html

1:00 semperos: michaelr525: that's for paredit, I was just referring to shortening up some of the standard C-x key chords Emacs comes with...

1:00 michaelr525: semperos: your caps lock is your Ctrl?!

1:01 sean_corfield: Raynes: gracias!

1:01 michaelr525: semperos: sorry the link was for sean

1:01 semperos: michaelr525: helps my wrist

1:01 np

1:01 Raynes: That cheatsheet is my lord and savior.

1:01 Amen.

1:02 michaelr525: semperos: so you don

1:02 't use the original left ctrl?

1:02 semperos: I swap the caps and left ctrl keys

1:03 michaelr525: the only awkwardness it ever creates is doing Ctrl-Shift-Tab for going backwards in browser tabs, since it puts all three keys together; otherwise I find it quite nice across apps

1:04 michaelr525: semperos: you have something to map it globally?

1:04 Raynes: michaelr525: Your operating system likely has a way to switch the keys.

1:05 semperos: michaelr525: I use whatever is easiest on a given platform; on Mac and Ubuntu, there are built-in utilities to do that mapping; on Windows I downloaded an app

1:05 michaelr525: semperos: which app?

1:05 * semperos looks for the link, as he no longer is forced to use Windows

1:06 michaelr525: thanks

1:06 semperos: michaelr525: http://www.autohotkey.com/

1:06 from this page of the EmacsWiki: http://www.emacswiki.org/emacs/MovingTheCtrlKey#toc15

1:07 michaelr525: 10x!

1:07 semperos: it lets you do custom key mappings, save them as executables, and even add them to your startup

1:07 amalloy: semperos: fwiw, i made ctl and caps-lock both act like ctrl. if i desperately need to SHOUT, the need to hold down shift is a good deterrent

1:07 semperos: heh

1:08 amalloy: I should quite infrequently online, but the occasional desire to capitalize my SQL commands does strike me :)

1:08 s/I should/I shout

1:09 amalloy: semperos: type lower-case, then C-a C-u M-u? :P

1:09 semperos: you got me there

1:10 michaelr525: the whole concept of remapping the ctrl seems to me amazing, it's like a new world openning up

1:10 ;)

1:10 semperos: amalloy: for any key chord that requires more than two "clusters", I just remember the elisp function name...

1:11 as I don't like looking down at the keyboard if possible

1:11 Raynes: My hands are smarter than I am. I couldn't tell you how to spell anthropomorphism, but my hands sure can.

1:12 amalloy: Raynes: let's see if they're up to onomatopoeia?

1:12 Raynes: $dict onomatopeia

1:12 lazybot: Raynes: noun: common misspelling of onomatopoeia.

1:13 amalloy: (inc lazybot)

1:13 lazybot: ⟹ 0

1:13 Raynes: Close enough.

1:13 michaelr525: bad hands

1:13 jodaro: onomatopaella

1:13 sean_corfield: hmm, so i can c-x c-e to evaluate forms in the repl and the result appears in the minibuffer but *1 isn't bound to those executions... i guess that's what CCW does too...?

1:15 michaelr525: semperos: do you also http://www.emacswiki.org/emacs/SwapControlAltAndCapsLock?

1:16 sean_corfield: i see kill / yank but is there copy / paste equivalent? or do i have to kill / undo (switch buffer to repl) / paste?

1:16 semperos: michaelr525: nope, I just swap caps and left ctrl

1:16 you can "copy" with M-w, instead of killing

1:16 once you've marked a region

1:17 sean_corfield: ah, right...

1:18 devn: jodaro: lol

1:18 "onomatopaella"

1:19 jodaro: it's delicious

1:19 devn: it *sounds* delicious ;)

1:19 sean_corfield: semperos: thanx ... that works exactly how i wanted!

1:20 semperos: sean_corfield: I'm glad at least one small sliver of your Emacs revival tonight has worked just like you wanted it to :)

1:20 sean_corfield: c-m-f c-spc c-m-b m-w c-c c-z c-y

1:21 amalloy: seancorfield: ewww

1:21 C-M-spc

1:22 sean_corfield: which specific part does that replace?

1:22 amalloy: the first three

1:22 jodaro: Raynes: wordnik sent me a bunch of swag in the mail today

1:23 sean_corfield: c-m-spc gives me containing expression ends prematurely

1:23 Raynes: jodaro: Really? They never offered me shit.

1:23 jodaro: Wunderground is sending me swag though.

1:23 jodaro: Raynes: a t-shirt, some stickers, a couple notebooks and some mini sharpies

1:23 oh nice

1:23 amalloy: or replace the whole thing with C-M-x, except you wanted it to appear in the actual repl as *1 i think?

1:23 jodaro: i like wunderground

1:23 they have good weather

1:24 sean_corfield: amalloy: ok, that's more location sensitive than i realized

1:24 Raynes: And an excellent API.

1:27 sean_corfield: m-w seems a weird key combo for "copy"...

1:29 it doesn't seem to be mentioned in the emacs tutorial...

1:49 sploop: Hello. Has anyone in here messed with functional reactive programming (not necessarily in Clojure)?

1:50 zerokarmaleft: sean_corfield: C-w kills a marked region, which is mentioned in the tutorial...given that, M-w makes sense

1:56 sean_corfield: zerokarmaleft: 'k that does make sense, thanx

1:57 it's a lot of new keyboard shortcuts to get used to

2:05 archaic: to transform a 1x800 vector in incanter to a 800x800 matrix is taking much longer than it should, any reason (apply bind-rows (repeat 800 A)) would be really slow?

2:05 scottj: I think you can use cua mode to get normal copy/cut/paste

2:11 sean_corfield: ok, just done a bunch of git stuff from emacs... feeling happier now...

2:12 scottj: yeah, i think i just need to get used to the emacs way (again)

2:14 seancorfield_: i guess i shouldnt be surprised emacs does irc too, right?

2:14 archaic: m-x erc

2:15 ehehehe

2:15 it does

2:15 web browser

2:17 seancorfield_: code in one buffer, a repl in another and irc in a third... i could get used to this... :)

2:19 why is clojure.repl not loaded via clojure-jack-in?

2:20 surprised me why doc threw an exception...

2:23 amalloy: clojurebot: how?

2:23 clojurebot: with style and grace

2:33 seancorfield_: ok, editing, repl, irc, shell... check... my frustrations with emacs are beginning to wash away...

2:38 lobotomy: hey everyone. i started a blog: http://lobotomys.blogspot.com/

2:38 first post is about clojure

2:43 seancorfield_: lobotomy: yay, more clojure! curious as to why you didn't parse the xml to a data structure?

2:46 amalloy: looks more like a reduce than a trampoline, lobotomy

2:54 mtm: seancorfield_: a few handy clojure/emacs bindings I find very useful C-c C-k (compiles the buffer into the REPL, less pain that C-c C-l), M-. (go to definition at point) and M-, (pop back from the definition)

2:56 archaic: its taking 30s to create an 800x800 matrix (of doubles) in incanter from a vector of vectors any ideas how I can improve this?

2:56 iris1: Is it the case that clojure-contrib is still at 1.2? I tried including clojure-contrib 1.3 in my project.clj and lein cannot find it.

2:59 scottj: iris1: contrib is split up into individual packages

3:02 iris1: scottj: I see, thanks! I would like to use clojure.contrib.duck-streams and was wondering what to include in my project.clj file for lein. However, now that I check, it seems that just putting clojure 1.3.0 in there makes duck-streams available. Does that make sense to you? Thank you!

3:07 seancorfield_: iris1: c.c.duck-streams has been deprecated for a while...

3:07 most of what was in that namespace has gone elsewhere tho'

3:11 amalloy: books on new languages should come with a warning: "do not use any of these libraries, they will be deprecated by the time you read this"

3:12 scottj: most books on new languages don't have as many libraries as clojure to cover :)

3:20 iris1: Thank you! I fell for http://richhickey.github.com/clojure-contrib/duck-streams-api.html#clojure.contrib.duck-streams/write-lines, which does not say it's deprecated. :-( Now that you mention it, I found http://dev.clojure.org/display/doc/Clojure+Contrib, which explains about the modularization. :-) Where did write-lines go?

3:20 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/duck-streams-api.html#clojure.contrib.duck-streams/write-lines, and try to stop linking to rich's repo.

3:23 amalloy: haha. dang it, lazybot, you make it sound like duck-streams are okay

3:23 lobotomy: amalloy, looks like reduce? do elaborate

3:24 amalloy: lobotomy: convert the XML file into a sequence of transactions, and then reduce over that accumulating everyone's balance

3:26 or accumulating a map of matching transactions, if you like

3:29 iterating over a sequence of similar sub-objects to build some single larger object is the poster child for reduce

3:29 seancorfield__: ok, i seem to have clojure-mode and a repl etc working on my imac too now

3:29 thank you everyone who helped!

3:31 mindbender1: Good Morning All

3:32 lobotomy: amalloy, wouldn't that require linear space though?

3:33 i mean, i am basically reducing the file as i go, just without using reduce

3:34 amalloy: you're using linear space anyway

3:34 if you're building a result map, it has N entries in it

3:36 if you're worried about the space requirements of creating the seq of transactions, you can do that lazily too

3:36 mindbender1: Why can't I evaluate symbols in a file I loaded with (load "ns/foo") then (in-ns 'ns/foo) and the symbol *bar* defined in ns/foo doesn't print ?

3:37 amalloy: (reduce process-transaction init-state (take-while identity (repeatedly read-single-transaction)))

3:37 michaelr`: what bothers me in emacs' key mapping is that I have to use both hands when I want to do multiple C-P and C-N

3:38 do you also have that problem?

3:42 * thorwil customizes if emacs bindings seem bothersome

3:43 michaelr525: thorwil: how do you c-p, c-n?

3:44 thorwil: michaelr525: those are bound to which commands?

3:44 michaelr525: goto previous, next line

3:45 C-p, C-n

3:45 thorwil: oh. i'm guilty of using cursor keys along with pos1 and end ^_^

3:45 michaelr525: shhh

3:45 someone could hear you

3:46 what's pos1?

3:46 home?

3:46 thorwil: yes, german keyboard here and i forget it's called different

4:01 Blkt: good morning everyone

4:02 michaelr525: hello blkt

4:16 Apage43: j3

4:28 lobotomy: amalloy, hmm, you're right about the simple case, that it's basically just reduce. could be done simplerly

4:28 what about the less trivial case with nested structure etc?

4:34 the example in the joy of clojure obviously isn't just straight up file parsing, unlike my simple example. i'm thinking they meant that more for stuff like actual non-simple parsing

4:34 haven't tried that with reduce, but my gut says trampoline should be more understandable for it than reduce?

5:15 pyr: the clojure wiki takes forever to load from here

5:15 so i'm just gonna ask here: where is expt now that clojure.contrib.math is gone ?

5:19 math.numeric-tower it seems

5:42 konr: Is there a special expression for all whitespace I can use in a regex?

5:44 archaic: \s*

5:44 i guess?

5:45 konr: thanks!

5:46 with a plus, I think

5:46 ,(clojure.contrib.string/split #"\s+" "ok OK")

5:46 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.contrib.string>

5:46 konr: :(

5:52 archaic: \s+ means match 1+, \s* means match 0+

5:53 ,(clojure.string/split "ok OK" #"\s+")

5:53 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string>

5:54 archaic: ,(split "ok OK" #"\s+")

5:54 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: split in this context, compiling:(NO_SOURCE_PATH:0)>

5:55 archaic: ,(require 'clojure.string)

5:55 clojurebot: nil

5:55 archaic: ,(clojure.string/split "ok OK" #"\s+")

5:55 clojurebot: ["ok" "OK"]

6:04 kzar: I wrote a simple noir app that scrapes a log using enlive and returns the data as json to display with jquery data tables. Now it works fine but after a while it runs out of heap space, is enlive's html-resource the right thing to use? http://paste.lisp.org/display/125491

6:06 (For each request I'm using html-resource to fetch and parse the html, then enlive to scrape out the bits I need. Maybe that's a mad way to do it, wasn't sure.)

6:12 broquaint: Doesn't enlive also provide fetching/parsing functions?

6:13 kzar: broquaint: Yea I used html-resource which is a part of enlive to fetch and parse the html, I guess that's my question - is it the right the tool for the job

6:17 clgv: kzar: enlive says it's a templating library so I guess you are missusing it

6:18 kzar: clgv: Well it's used as a scraper for dnolen's tutorial https://github.com/swannodette/enlive-tutorial but maybe you're right, maybe that was just for illustration and using for an actual scraper is mad

6:20 clgv: kzar: well, you use a profiler to find out where all the memory is allocated and leaked

6:20 +can

6:20 maybe you are just holding on to bindings that you actually dont need anymore

6:22 kzar: clgv: I've not used a profiler before for Clojure or Java (never done any Java really), is there one that's simple to use?

6:23 clgv: kzar: you can start with JVisualVM as it ships with the JDK

6:23 there is also Yourkit Java Profiler that has 30-day trial version

6:50 kzar: clgv: So I've got VisualVM running, the heap space used seems to be slowly creeping up even before I run the scrape, that normal?

6:51 clgv: kzar: I dont know any details of your program ;)

6:52 kzar: clgv: It's a very simple noir web app, one view does the scrape displaying the details as json. It seems weird that the used heap creeps up even when I'm not hitting the webserver

6:52 clgv: kzar: I guess starting the servlets needs some memory as well

7:06 archaic: mm..having (comment ...) with forced structure is somewhat annoying.. what if i want to write math equations that arn't 'properly formed' in comments around the code implementing them, is there any way around this?

7:18 morphling: archaic: do you know that ";" starts a line comment, like "//" in c++,java,..?

7:21 archaic: yeah, its not much of an issue but if I have functions written in unicode thats 6-8 lines long i would prefer to just wrap them in (comment. ) etc

7:26 dnolen: archaic: comment is a simple macro, you'll have to be ok with ;

7:33 kzar: dnolen: Do you know if using enlive as a scraper is sensible? (I mean if you're using html-resource to grab big pages a lot should it work?) I wasn't sure if your enlive tutorial just did that to illustrate how to use the library or if it's actually a good choice for scraping

7:33 dnolen: kzar: people have used it for scraping in the past and seemed happy w/ it.

7:39 kzar: dnolen: OK thanks

7:49 Did clojure.contrib.profile move somewhere in 1.3?

7:50 clgv: kzar: you might use the old one. there is a chance it might still work

7:50 kzar: clgv: I get this error "Can't dynamically bind non-dynamic var: clojure.contrib.profile/*profile-data*"

7:50 dnolen: kzar: doesn't look like it was moved over, tho I gotta say, it's not very useful.

7:51 clgv: kzar: you might fix that ^{:dynamic true} on the 'def if you dare to ;)

7:51 kzar: Well what is a good way to figure out what's killing my code? I loaded up VisualVM but it just seemed to give me a graph of how much memory / cpu is being used

7:52 clgv: s/that/that with/

7:52 dnolen: kzar: "killing" what does that mean?

7:53 kzar: dnolen: Well I've been running out of heap space sometimes with this little web-app scraper I wrote using enlive and noir. It just scrapes a log page, renders the logs to json for displaying in jquery datatables

7:53 clgv: kzar: go to the Sampler or Profiler tab and hit the "Memory" button for investigation ;)

7:56 kzar: clgv: Ah right, well I've done that and I can see the usage broken down by class. Apparently char[] and java.lang.Object[] are the biggest culprits but I'm still not sure how that helps me

8:00 dnolen: kzar: you might want to post your enlive code to the enlive ML, it's not hard to accidentally write inefficient enlive, other people might have insights.

8:00 java.lang.Object[] sounds like a persistent data structure growing too large.

8:01 clgv: kzar: oh right, JVisualVM does not have information on which methods allocated that memory

8:01 Yourkit does

8:12 iris1: FTR according to http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go, "clojure.contrib.duck-streams mostly migrated to clojure.java.io"

8:33 kzar: clgv: Thanks I've grabbed that

8:38 dnolen, clgv: So in the end the problem solved itself.. guys that run this log cleared some of the backlog, so instead of 18,000 odd entries there where a few hundred. Ovbious solution now is for me to just take the first 200 results as that's all I need anyway. I had already posted on the mailing list though, will be interesting to see if they can improve on my code http://groups.google.com/group/enlive-clj/browse_t

8:38 hread/thread/5a4b2bd7ae291cab . Thanks for the help

8:50 cemerick: who here has actually used ^:const

8:53 clgv: cemerick: to get it relative - who here has actually used clojure 1.3 ;)

8:56 michaelr525: cemerick: what is ^:const good for?

9:01 llasram: Huh. The 1.3 release notes mention of it leaves me a tad confused. Are the expressions used to `def' new vars *not* usually evaluated at compile time? Is it explicitly about primitive values somehow?

9:05 cemerick: llasram: yeah, the changelog example isn't so great, IMO.

9:07 llasram: Is the actual effect that references to the var are derefed at compile time, and the value returned at compile time is include inline?

9:07 cemerick: llasram, michaelr525: yes: https://gist.github.com/1312660

9:09 llasram: Cool. But obviously enough, haven't used it :-)

9:36 simard: hum is there a way to spit a record to a file and read it back ?

9:37 ie, is there a reader synthax for record objects ?

9:37 cemerick: yes

9:38 just use pr or pr-str on a record

9:42 simard: cemerick: when I read it back, it says "java.lang.Exception: No dispatch macro for: :"

9:44 clgv: simard: clojure 1.3?

9:44 simard: I did a (duck/spit f (pr-str my-record)), then (read-string (slurp f))

9:44 hum no

9:44 1.2

9:44 clgv: thats the problem then ;)

9:44 simard: :)

9:44 ok

9:45 cemerick: simard: right, sorry, 1.3-only.

9:45 raek: simard: also, use clojure.core/spit and the functions in clojure.java.io instead of duck streams

9:45 clgv: you might convert it to a map and write that map. but you'll have to remember on reading that it was your defreecord

9:47 simard: should I get my clojure-1.3 jar from clojars or directly from clojure.org ?

9:48 raek: simard: unless you need to manage the classpath manually, it's probably easier to use one of the de facto build tools (Leiningen or Cake)

9:49 simard: I'm using lein

9:49 raek: just replace [org.clojure/clojure "1.2.1"] with [org.clojure/clojure "1.3.0"] in your project.clj and run lein deps

9:49 simard: so I'm actually using the project.cl

9:49 cemerick: (and hope your other libraries are 1.3-compatible :-)

9:50 simard: I don't rely on that many libs atm, thankfully

10:05 is there a way with defrecord to hook the constructor ? I want to do the following: (defrecord A [b]), (A. 1) => #cpcb.pcb.A{:b 1} but (A. (A. 1)) => #cpcb.pcb.A{:b 1} as well

10:05 ie, I'd like the ctor to recognize that b is of type A

10:06 the goal is to define a record like a Translation, which can combine itself to another Translation

10:06 instead of cascading translations uselessly

10:08 clgv: simard: probably you shouldnt do that with defrecords in clojure

10:09 simard: clgv: probably :)

10:09 perhaps designing a Simplify protocol would be best

10:09 mdeboard: Are tehre any other general development talks by Rich Hickey in the vein of Simple Made Easy?

10:09 simard: that could walk a tree of such objects and combine them

10:10 fdaoud: rest in peace, John McCarthy

10:10 mdeboard: i.e. not Clojure specific

10:13 clgv: mdeboard: does he talk of non-clojure topics?

10:13 kzar: try-clojure.org is giving me a "504 Gateway Time-out" Nginx error

10:13 mdeboard: clgv: Simple Made Easy is brilliant

10:13 clgv: I've watched it like 4 times

10:13 clgv: gotta look that up

10:13 mdeboard: clgv: InfoQ.com

10:13 clgv: thx

10:13 mdeboard: srsly changed how I work

10:14 Watched it 4 times since Thursday

10:14 fdaoud: mdeboard: what is it about?

10:14 mdeboard: fdaoud: "Easy" vs. "Simple"

10:14 cemerick: I just realized that the migration of thread-local bindings across agent sends, futures, etc. isn't in the 1.3 changelog.

10:15 fdaoud: mdeboard: as it applies to programming in general/

10:15 ?

10:15 jcromartie: Easy vs Simple has been going through my mind all week

10:16 really brilliant stuff... makes me think about what *really* is simple

10:17 fdaoud: ok enough hype and paste the link already :)

10:17 mdeboard: fdaoud: Yes

10:17 http://www.infoq.com/presentations/Simple-Made-Easy

10:17 fdaoud: thank you, looking forward to it

10:18 mdeboard: jcromartie: I finished watching it at like 2am Thursday evening, immediately got up and refactored some stuff I've been working on

10:18 cemerick: nm, I was looking at the version of the changelog on the wiki

10:18 jcromartie: fdaoud: and pay attention!

10:18 fdaoud: watch it at lunch or something, when you have time

10:18 mdeboard: Yeah

10:19 fdaoud: ok, will do

10:19 mdeboard: Turned me into a proper fanboy :_\

10:19 fdaoud: how long is it?

10:19 mdeboard: an hour

10:19 fdaoud: wow

10:19 might have to be a 2-part series

10:19 mdeboard: it's awesome though, worth the time

10:19 fdaoud: is there a way to download it or is it stream only?

10:20 mdeboard: if you're an infoq member you can download mp3 I think

10:21 jcromartie: the slides are good though

10:21 I think

10:22 this is a really interesting article about the difference between interfaces for operation and interfaces for expression: http://blog.vivekhaldar.com/post/8950163616/gui-vs-cli-operation-vs-expression

10:23 I've been working on trying to come up with a GUI for a "programmable" application

10:23 but I'm wondering if I should just ditch that idea

10:23 and have power users write code

10:23 use a DSL to express the things that the GUI would otherwise be used to (clumsily) configure

10:24 then the actual GUI for users can focus on operation (getting the work done)

10:24 can I ask my users (internal staff) to write Clojure code? :P

10:24 simard: jcromartie: what do you use for developping GUI with clojure ?

10:24 jcromartie: simard: web apps... JS interface over HTTP APIs

10:24 Compojure back-end

10:33 I think a good API should make it easy enough for trained power users to write business rule code

10:33 simard: jcromartie: power users are rare, unless you make your DSL easy enough.

10:34 I guess it all depends on who your users are anyway.

10:35 TimMc: Don't underestimate the effectiveness of forums in hacking together working configs.

10:36 jcromartie: Have your users edit a project.clj-like file.

10:36 simard: that's true, but having to lookup forums everytime you want to do something might be considered as a problem with your software..

10:45 fdaoud: mdeboard: thanks, I logged in and downloaded the mp3

10:47 cark: where is the 1.3 version of c.c.str-utils ?

10:48 kzar: With Leiningen is there a way to add tasks, like in ruby with rake tasks. Say for example at the moment I type `lein run` to start the webserver but I wanted to make `lein cron` run a background task

10:51 zerokarmaleft: kzar: https://github.com/technomancy/leiningen/blob/stable/doc/PLUGINS.md

10:51 jcromartie: simard: in this case, we provide SaaS, and "users" range from end users that just want to get their work done and go home, customer service who need to troubleshoot problems, and client account managers that handle configuration of new and existing clients

10:52 maybe there's a middle ground: have a GUI for certain simple if/then rules, and then allow code for rules that don't fit that range of GUI expression

10:54 zerokarmaleft: kzar: https://github.com/technomancy/lein-tar/blob/master/src/leiningen/tar.clj is a pretty simple example

11:01 TimMc: let them eat parens

11:01 kzar: zerokarmaleft: Ah thanks

11:02 simard: jcromartie: I'm looking for a way to provide SaaS for some PCB drawing application but the client side should support rendering of OpenGL. I don't need a very fast FPS, updating the screen after the user interacts with it would suffice. Do you think it's realistic to do that, considering the latency of the network ?

11:02 brett_h: where did the doc and javadoc funcs/macros go in 1.3? they don't seem to resolve for me by default when they used to previously

11:03 jcromartie: simard: if you can get away with requiring up-to-date Google Chrome, you could use WebGL for the UI

11:03 that would be fun :)

11:03 simard: WebGL = JS only :S

11:03 jcromartie: JS for the rendering, yes

11:03 simard: but again it could be a really thin client GUI

11:03 jcromartie: it could

11:04 Clojure can do OpenGL just fine

11:04 simard: yes

11:04 I'm doing it right now

11:04 jcromartie: so, what's going on at the server?

11:04 is it layout or what

11:04 TimMc: brett_h: They might have moved to a REPL namespace.

11:05 simard: well, I said right now I'm doing OpenGL with clojure, but this might change to WebGL

11:05 on the server, everything else would be going on, from the undos to the Gerber output

11:05 jcromartie: ah Gerber, OK

11:05 TimMc: ,`doc ; brett_h

11:05 clojurebot: clojure.repl/doc

11:05 brett_h: TimMc: I'm very new at this, is there anything I can use to find where they may be interactively?

11:05 Ah

11:06 How would I have found that anyway? That's what I need to figure out :)

11:06 andrewclegg: numerics question (in 1.3)... what's the standard way to disambiguate when calling a java method that has different versions taking int, long, etc.?

11:06 simard: but I would prefer if every action was going on on the server, say, place new component, route this or that, but I'm afraid latency might kill the usability

11:06 andrewclegg: i.e. to avoid "More than one matching method found"

11:06 jcromartie: simard: (I'm only really really vaguely familiar with PCB stuff... I interned at a WAN equipment manufacturer)

11:06 TimMc: brett_h: There's a "changes in 1.3" page somewhere.

11:06 raek: andrewclegg: I think you are supposed to use the 'int' and 'long' functions in that case

11:07 those functions will return primitives

11:08 simard: jcromartie: there's not much to know about PCBs anyway.. as far as the basics are concerned

11:08 jcromartie: :P

11:08 andrewclegg: raek: I'm trying to call Amount.of from here http://bit.ly/tj0bb3 and I still get that even with e.g. (int 500) or (long 500)

11:09 maybe it's the enum parameter, not the numeric...

11:09 TimMc: brett_h: https://github.com/clojure/clojure/blob/master/changes.md

11:09 brett_h: TimMc: thanks so much

11:09 simard: say I write the server side PCB software in Clojure, and the thin-client in WebGL, what kind of communication channel could I use in between, and what API is there to help me doing that ?

11:09 TimMc: brett_h: I don't know where javadoc is.

11:09 ,`javadoc isn't helpful

11:09 clojurebot: sandbox/javadoc

11:09 simard: jcromartie: I could program my own TCP transaction, but I would rather not do that again

11:11 jcromartie: um, no

11:11 simard: what kind of latency do you really need?

11:11 and are you sure HTTP is too slow?

11:11 simard: jcromartie: in terms of miliseconds ? no idea, I'd have to try it

11:12 jcromartie: I mean you don't want every tick of a drag-and-drop interaction going over HTTP

11:12 cark: simard: if you're using webgl, you're either going to do http polling, http long polling or websockets

11:12 jcromartie: and if you're going WebGL you might as well use web sockets

11:12 since you're on the bleeding edge anyway

11:12 cark: trouble with websockets is bnrowser adoption

11:12 simard: jcromartie: it all depends how I manage to encode data for opengl to display

11:12 possibly some kind of incremental update

11:13 or what not

11:13 lucian: cark: as jcromartie said, webgl has shit adoption anyway. if you have webgl, you'll have websockets

11:13 cark: true

11:13 then websocket is the best option

11:13 simard: so all that remains now is to have firefox, IE and chromium all support WebGL properly

11:14 jcromartie: you can require Chrome for now

11:14 lucian: firefox is pretty good too

11:14 just forget about ie and you're good

11:14 jcromartie: Chrome is like the other end of the spectrum from IE6

11:14 andrewclegg: if anyone can tell me how to create one of these in Clojure, I'll be pathetically grateful :-) http://bit.ly/tj0bb3

11:14 jcromartie: it's too good

11:14 clgv: &(resolve 'javadoc)

11:14 lazybot: java.lang.SecurityException: You tripped the alarm! resolve is bad!

11:14 lucian: andrewclegg: wow

11:15 andrewclegg: I just get this: (Amount/of (long 500) Time/MILLISECONDS)

11:15 #<CompilerException java.lang.IllegalArgumentException: More than one matching method found: of, compiling:(NO_SOURCE_PATH:1)>

11:15 lucian: andrewclegg: you can probably do it with getclass, right?

11:15 clgv: andrewclegg: use typehints to tell the compiler what to use.

11:15 lucian: uh, genclass

11:17 TimMc: lucian: That's for class generation, not instantiation.

11:18 lucian: TimMc: ah, silly me

11:18 andrewclegg: woo, type hints did it

11:18 TimMc: andrewclegg: What finally worked?

11:18 andrewclegg: (def ^Integer timeout 500)

11:18 (Amount/of timeout (Time/valueOf "MILLISECONDS"))

11:18 #< (500, ms)>

11:19 no idea why it doesn't work with (int 500)

11:19 TimMc: andrewclegg: Does Time/MILLISECONDS not work?

11:19 Apage43: wouldn't that type-hint it as the boxed type though?

11:19 andrewclegg: TimMc: yeah, sorry, that too

11:19 Apage43: (rather, isn't that (Amount/of (Integer. 500) (Time/valueOf "MILLISECONDS")) ?

11:19 andrewclegg: (Amount/of timeout Time/MILLISECONDS)

11:19 #< (500, ms)>

11:20 Apage43: actually, yeah, that works too without the hint

11:20 (Amount/of (Integer. 500) Time/MILLISECONDS)

11:20 #< (500, ms)>

11:20 Apage43: can prolly use Long. and Double. as well

11:20 andrewclegg: I wonder if there's a way to make it work without a box/unbox pair

11:21 cos you can't hint a primitive, right?

11:21 Apage43: you can.

11:21 TimMc: You can.

11:21 Apage43: (def ^int timeout 500)

11:21 andrewclegg: that gives me this error:

11:21 java.lang.IllegalArgumentException: Unable to resolve classname: clojure.core$int@175ace6

11:22 when calling Amount/of

11:22 simard: now, if I ever get to the point of having a functional client webgl-server pcb app pair, I will need a computer to run that server onto. I'd like to avoid setting up my own server farm (!); is there a company out there that can provide such a service, that is, running one or many java JVM, with a backed up *sql database, on their cloud ?

11:22 raek: andrewclegg: is this in clojure 1.2 or 1.3?

11:22 andrewclegg: 1.3.0

11:23 (print timeout) works

11:23 but not (Amount/of timeout Time/MILLISECONDS) -- that get the exception I just posted

11:24 not a blocker as I can make it an Integer instead -- but curious behaviour

11:27 Apage43: andrewclegg: might try wrapping in a fn and type hinting the fn arg, I think it's better able to deal with type hints when you do that

11:29 TimMc: Is ^int actually appropriate?

11:29 Apage43: well not if you're hinting a fn arg

11:29 ^int hints aren't supported for fn args

11:29 only long and double

11:30 TimMc: mm

11:30 andrewclegg: ok, I can't get it to hint as an int or long at all, I get the "Unable to resolve classname: clojure.core$long@1fb06c9" kind of error

11:30 Apage43: ((fn [^long timeout] (Amount/of timeout Time/MILLISECONDS)) timeout)

11:31 andrewclegg: will try, hang on

11:31 nah, then I get "More than one matching method found" for Amount/of

11:33 Apage43: huh.

11:34 andrewclegg: I can do this: (Amount/of (Integer. 500) Time/MILLISECONDS)

11:34 but then wehn I actually run my code, I get this: ClassCastException: java.lang.Integer cannot be cast to java.lang.Lon

11:35 g

11:35 from the depths of the library I'm passing this to

11:35 this is entirely made of wtf

11:35 because I CAN'T do this: (Amount/of (Long. 500) Time/MILLISECONDS)

11:36 More than one matching method found etc.

11:43 dnolen: andrewclegg: have tried running your code in master, there were some fixes recently.

11:44 kzar: If I define a multimethod with defmethod can I then pass the multimethod around just the same as a regular function?

11:44 dnolen: s/in/against

11:44 kzar: multimethods are regular fns, yes.

11:45 andrewclegg: dnolen: haven't tried, do you know if master is published as a maven snapshot anywhere? or would I need to build and install in local repo/

11:45 ?

11:45 bpr: when I do (javadoc FooClass) the browser tries to load the url: %u

11:46 does anyone know what to poke to fix that?

11:46 dnolen: andrewclegg: I think 1.4.0-SNAPSHOT should work

11:46 bpr: i'm using emacs/clojure-swank

11:47 swank-clojure v. 1.4.0-SNAPSHOT to be specific

11:47 andrewclegg: dnolen: doesn't seem to, unless it's in a different repo

11:48 bpr: the fix seems straight forward, I'm just wondering if I should start looking in swank or in clojure.java.javadoc

11:48 andrewclegg: I'm gonna have to go back to this another time I think

11:48 dnolen: "1.4.0-master-SNAPSHOT"

11:48 wwmorgan: how should I download binary data at a URL? I tried using duck-streams/copy from a .openStream on a java.net.URL to a java.io.FileOutputStream but I only get half the file?

11:48 andrewclegg: nope :-(

11:49 dnolen: wwmorgan: duckstreams is deprecated. might want to take a look at clojure.java.io.

11:50 kzar: So I used to see vars def'd at the top of code with the asterix "ear-muffs", figured that was just idiomatic but now with 1.3 I get that warning unless I use ^:dynamic . I'm not really sure what the difference is or if I need them to be dynamic, so is it idiomatic to loose the asterixs or to add ^:dynamic ?

11:50 For example if I do (def row-limit 200) to set some arbritary limit

11:51 Apage43: kzar: Before, using the earmuffs implicity made the dynamic. That is no longer the case. You need dynamic if you want to use (binding ) to rebind the var thread-locally

11:52 dnolen: kzar: if you're not using (binding [...] ...) drop the earmuffs.

11:52 kzar: OK thanks

11:53 Apage43: incidentally, what are reccomendations for HTTP libraries? I've been using clj-http, but it doesn't behave nicely on non-success HTTP status codes

11:57 dnolen: Apage43: I prefer, https://github.com/rnewman/clj-apache-http

11:57 wastrel: i'm buying "the joy of clojure"

11:58 fdaoud: wastrel: have you read any other clojure books?

11:58 wastrel: no i sure haven't!

11:58 do you have an advice?

12:01 fdaoud: wastrel: I read Programming Clojure (Pragmatic); it's alright. A second edition is on the way. I found Practical Clojure (Apress) quite disappointing. I'm halfway through The Joy of Clojure, so far it is excellent! I also have high hopes for Clojure Programming (O'Reilly), coming out in a month or two. Finally there is also Clojure in Action (Manning) coming soon, not sure about that one.

12:02 jodaro: Apage43: here is another http lib: https://github.com/neotyk/http.async.client

12:03 wastrel: glad to hear you're endorsing my decision :]

12:03 Apage43: mostly i need it to not explode if it gets 4XX status and actually still let me at the response body/headers/whatnot

12:03 wastrel: I don't have a good background in computer science, so I didn't want just a syntax book

12:04 fdaoud: wastrel: are you just starting out with clojure/lisp?

12:06 wastrel: You could say that. I've gwritten some small scripts and done a few chapters of SICP

12:06 simard: is there a way to use partial on ctors of records ? ie.. (defrecord Rotate [angle object]), (map (partial Rotate. 90) objects)

12:06 wwmorgan: downloading binary data from a URL: I only get half the file when I do (clojure.java.io/copy (.openStream (java.net.URL url)) (java.io.File. file-name)). Why might this be?

12:10 Apage43: simard: no, not really. It'd have to do really ugly reflection

12:10 simard: huuummm...

12:11 Apage43: you'd want to (map (partial #(Rotate. %1 %2) .... oslt

12:13 jkkramer: Apage43: you can set a :throw-exceptions option to false with clj-http

12:14 cemerick: wwmorgan: worksforme. Try downloading from a different site; something screwy going on with user-agent headers?

12:14 licenser: greetings :)

12:15 wwmorgan: thanks cemerick. I'll check it out

12:17 Apage43: jkkramer: oh rocksauce, thanks

12:18 jkkramer: simard: if you're using 1.3, there's a ->Rotate constructor fn you can use to do that

12:39 jcromartie: hm

12:39 I have a big hash map

12:39 32K objects

12:39 assoc'ing something takes a long time (.100 ms)

12:39 er

12:39 wait

12:39 that's .100

12:39 not 100

12:39 DERP

12:39 mdeboard: lol

12:40 jcromartie: AWESOME :)

12:40 cemerick: it's nice when that happens

12:40 mdeboard: I definitely just ( < 10 min. ago) cited Hickey in a meeting with my mgr & UI people, arguing against "braiding" a couple of disparate modules together

12:41 Well, I didn't cite him, but I used his words.

12:41 jodaro: did they buy it?

12:43 mdeboard: yeah

12:43 I wouldn't have mentioned it if it had failed miserably :P

12:44 basically just an argument about which app's database should be responsible for maintaining groupings of items from App A for consumption by App B.

12:45 chewbranca: cemerick: hey just saw your clutch 0.3.0 thread, looks good, thanks for all the work on clutch, has been working well for me

12:45 cemerick: chewbranca: ah, so you're using the latest snapshot?

12:46 chewbranca: cemerick: using 0.2.5 right now, going through emails and just came across your 0.3.0 refactoring post

12:47 cemerick: chewbranca: OK; keep in mind there's breakage, and maybe a little more yet to come. Trying to get the API up to fighting weight, y'know?

12:47 technomancy: simard: did I hear that you are looking for a JVM hosted in the cloud? =)

12:48 chewbranca: cemerick: I'll check out 0.3.0 sometime this week and let if you if I run into any issues

12:48 cemerick: ok sounds good, changes look pretty solid to me so far

12:48 cemerick: checking out the changelog on github

12:48 bhenry: where do i start troubleshooting if sfteepee sends a blank file to the server with (put "filename.txt")

12:48 cemerick: chewbranca: You will, but they *should* be minor. All necessary to support some better abstractions I have in the pipeline.

12:48 chewbranca: cemerick: very nice

12:49 cemerick: bhenry: OT, but: sfteepee? :-D

12:49 bhenry: cemerick: https://github.com/ccollins/sfteepee/blob/master/src/sfteepee.clj

12:50 cemerick: hah

12:50 jsch is pretty evil, tho

12:51 Apage43: heh, i've used JSch with clojure before

12:51 wrote some remote monitoring tools

12:52 cemerick: JSch's implementation is *insane*, and semi-unmaintained IIRC

12:52 sshj seems to be the latest/greatest

12:52 hugod: that's what jclouds is using these days, right?

12:53 hugod: cemerick: it is

12:53 cemerick: Is there a clojure wrapper for it yet, or is it clean enough to not warrant one?

12:54 hugod: I'm near to having a version of clj-ssh with plugabble backends

12:55 so far I have mina and jsch - not hooked up sshj yet…

12:55 bhenry: hugod: can you point me to working examples of clj-ssh? i couldn't get the complex version from the readme working, but i need to have strict host key checking off

12:57 hugod: bhenry: pallet uses clj-ssh. The new version I'm working on has a much simplified api…

12:59 bhenry: cool. if i can't get something working by the time you release i'll check it out

13:09 Apage43: yeah

13:27 seancorfield: as a follow up to my frustrations with emacs last night, yes, on the mac i had a .emacs file which was why .emacs.d/init.el was not picked up

13:28 cemerick: sounds fun

13:38 theignorati: where's clojure.contrib.seq in the modular contrib?

13:40 kij: try-clojure.org is down ?

13:41 technomancy: theignorati: depends on the particular function you're looking for iirc

13:41 theignorati: indexed

13:42 technomancy: you have to use map-indexed

13:42 cemerick: see map-indexed

13:42 technomancy: indexed was deemed too slow to be promoted

13:43 if only I had learned the word "complect" when that discussion was going down. =)

13:43 ibdknox: lol

13:43 amalloy: technomancy: not just slow, but inflexible, right?

13:43 technomancy: amalloy: ISTR the objection was that it consed too much

13:44 bare indexed is simpler than map-indexed since you can map over an indexed seq and just destructure in the fn

13:44 amalloy: technomancy: yeah it will cons an awful lot for an infinite sequence :P

13:44 since it actually created a vector, not a lazy seq

13:45 technomancy: "I must not cons. Cons is the perf-killer. Cons is the little death that causes total obliteration. I will face my cons and permit it to pass over me and through me, and when it has gone past I will turn my GC to see its path. And where it has gone there will be nothing; only I will remain.

13:46 shame that's too big for a tweet.

13:46 hiredman: technomancy: sure, but map-indexed collapses that into a single "layer" of lazy-seq instead of two, and without the overhead of building a vector and pulling it apart

13:46 technomancy: amalloy: pretty sure indexed created a lazy seq of vectors

13:46 pandeiro: is it possible to reference the first element of a js array with clojurescript?

13:47 technomancy: (map vector (iterate inc 0) s) ; yup

13:47 ibdknox: pandeiro, (aget some-array 1)

13:48 technomancy: hiredman: sure; the implementation is simpler. I'm just talking about concepts exposed to the user.

13:48 Chousuke: ibdknox: shouldn't that be 0 :P

13:48 ibdknox: Chousuke, lol. yes.

13:48 pandeiro: ibdknox: Chousuke: thanks, brainfart

13:49 (refering to mine not yours ibdknox :)

13:49 amalloy: technomancy: you're right. it was deprecated before i ever started using it, and i guess i misread or misremembered the source

13:51 technomancy: no dune fans in here?

13:51 philistines.

13:51 pjstadig: technomancy: i got the reference

13:51 and quite enjoyed it

13:52 ibdknox: technomancy, I'm also sad that doesn't fit in a tweet :p

13:52 technomancy: I just finished it last night. interesting insights into tribalism and hero worship.

13:56 pjstadig: you'll probably still call me a philistine, since my only exposure to Dune was the William Hurt, SciFi channel mini-series

13:57 which i thought was actually pretty good, having no experience with the literature

13:58 technomancy: ISTR they did as good a job as you could expect trying to fit 500 pages into 2 hours.

13:58 pjstadig: i did see the 1984 Dune movie, too, which seemed like a disaster in comparison

13:58 fdaoud: technomancy: I misread tribalism for a sec there and was wondering..!! ;)

13:58 ibdknox: I really enjoyed the book

13:59 fdaoud: don't mistake that L for a D

13:59 ibdknox: much more so than any of its film adaptations

13:59 pjstadig: the miniseries was actually like 4.5 hours, but yes still not enough time

14:01 technomancy: ah, right

14:06 TimMc: technomancy: There was just some Dune discussion in here yesterday.

14:07 technomancy: and I missed it? phooey.

14:07 TimMc|flakynet: ~logs

14:07 clojurebot: logs is http://clojure-log.n01se.net/

14:07 TimMc|flakynet: :-P

14:11 technomancy: My fiancÃée is rereading âDune to. I had forgotten just how much forward plot information the reader is given!

14:12 (And WTF happened to my terminal's char encoding?)

14:12 technomancy: hah; I was wondering about that

14:12 TimMc|flakynet: s/Dune to\./Dune to me./

14:14 cemerick: "drinkup" seems to be a thoroughly modern term.

14:15 technomancy: I think github coined it

14:15 bhenry: if i use (defn- …) is the information inside available from the uberjar?

14:15 cemerick: ah-ha

14:15 technomancy: Are salesforce people going to be going along as well?

14:15 technomancy: cemerick: no, just 4 of us from heroku

14:25 mefesto: I was watching Rich's latest great talk about simple vs easy and he mentioned somewhere in the back half about using queues extensively to keep things from intertwining. Is this meant only in multithreaded use cases or no? If no, any have an example to help clear this up for me?

14:27 fliebel_: mefesto: AFAIK, it is just to loosen the connection.

14:27 No examples though.

14:27 * fliebel_ should maybe use more queues

14:28 * fliebel_ is slightly traumatized by seque

14:28 mefesto: heh

14:31 jcromartie: mefesto: he meant queues as in a decoupled place to put things that other components can check

14:32 mefesto: for anyone interested he mentions queues around ~55min mark

14:32 pdk: where can you find this

14:33 clojure site?

14:33 jcromartie: pdk: infoq

14:33 mefesto: http://www.infoq.com/presentations/Simple-Made-Easy

14:33 jcromartie: fliebel_: why is seque traumatizing?

14:34 fliebel_: jcromartie: http://dev.clojure.org/jira/browse/CLJ-776

14:35 jcromartie: ah ha

14:35 I just saw that bug today :)

14:35 because my friend was implementing a blocking async queue in C#

14:35 fliebel_: seque is thinking of a yellow lego brick.

14:35 mefesto: jcromartie: at a high level i can understand that. it's just like fliebel_ was saying about loosening the connections. i'm failing to picture an example tho

14:35 jcromartie: he had locks and wait/pulse all over the place

14:36 Cozey: hello. i'm generating a simple jar file to be run with java -jar, but i get " Invalid signature file digest for Manifest main attributes" wtf ?

14:36 jcromartie: mefesto: so say your system wants to send emails on certain events

14:36 theignorati: is there a simple way to return all elements that two vectors have in common?

14:37 jcromartie: instead of directly calling an email-sending function, you would place your message on a queue of messages to send

14:37 and then an email sending agent could pick it up

14:37 although really, agents help decouple that already

14:37 mefesto: jcromartie: ahhh i see

14:37 jcromartie: because once you send it off you don't really care and you can continue on your way

14:37 but anyway, yeah

14:38 think of units of work

14:38 anyway a queue is just a really simple interface

14:38 and that's the real win

14:38 fliebel_: jcromartie: did that friend run into seque bugs? Or was he just doing complicated queue stuff?

14:39 jcromartie: fliebel_: he was using C#

14:39 mefesto: jcromartie: thanks that cleared it up for me. :)

14:39 jcromartie: fliebel_: so I got curious and was looking into the Clojure answer

14:39 fliebel_: ah, right. So how did you end up at my bug report?

14:39 jcromartie: the second Google result for "clojure seque" is your bug report

14:40 (that's some bad PR)

14:48 fdaoud: jcromartie: I listened to some of that talk (about 20mins), it's really good.. so far the part where he rips into XP/TDD is entertaining :)

15:24 devn: I wouldn't say that he rips XP/TDD

15:26 It feels like ripping because people have gotten so comfortable recently with that being the only path to the promised land IMO

15:27 mindbender1: Clojurians, I hail!

15:27 * devn waves

15:27 mindbender1: :)

15:28 fdaoud: devn: you're right. let's just calling it poking fun.

15:28 mindbender1: Who knows the key to clojure mastery?

15:30 hiredman: the key to mastery for most things is: do it over and over again and don't be an idiot

15:30 babilen: Is there anything that would allow me to implement subcommands for a CLI tool easily? Is tools.cli the best there is?

15:31 mindbender1: hiredman: agreed. But what the best advice on how not to be an idiot?

15:32 hiredman: the easiest approach is to go on the internet and say "I am going to do X" and people will jump on you if you are being an idiot

15:33 well, jump on you or ignore you

15:33 * simard looks around

15:34 * mindbender1 looks as well

15:35 di-csuehs: Did clojure.contrib.io get refactored to other jars?

15:36 Raynes: The evolution of c.c.io is clojure.java.io. It is in Clojure itself.

15:36 mindbender1: hiredman: I believe you are trying to make a point. Please I'm intersted

15:37 di-csuehs: ah!

15:37 I shall stop attempting to recur on my own tail

15:37 hiredman: huh?

15:38 that was it, I'm done

15:38 TimMc|flakynet: mindbender1: If you have a question, ask it.

15:39 mindbender1: ok

15:40 fdaoud: mindbender1 take what hiredman said and change "internet" to "#clojure" and people will tell you nicely if you are being an idiot, and suggest a better solution.

15:40 which is really, really nice.

15:40 if you want people to jump on you, go on TSS (at least that used to be the case, now it's just mostly dead.)

15:42 hiredman: if have a problem or a question about X, then figure out what you know about X, what the implementation trades offs are of implementing X

15:42 if you

15:43 read docstrings for the functions you use, for the love of god

15:43 mindbender1: I've never done programming before!!

15:43 Yet I want to live as a programmer

15:43 hiredman: then just go watch http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/

15:44 not the be all to end all, but as good a starting point as any

15:44 mindbender1: ok

15:50 hiredman: more resources will always be appreciated here.. just in case

15:52 simard: No implementation of method: :simplify of protocol: #'cpcb.pcb/Simplify found for class: clojure.lang.LazySeq

15:52 hum.

15:53 right, so, what's the easiest way out, define simplify for LazySeq ?

15:53 can it be done ?

15:56 (extend-type clojure.lang.LazySeq Simplify (simplify [this] (doall this)))

15:56 I did this, it seems to work, but could this lead to trouble ?

15:59 srid: closure's (and clojurescript's) websocket doesn't seem to work on firefox 7. this seems to be because of prefixing (MozWebSocket). has anyone found a workaround?

16:02 zilti: I'm getting "java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer" with seesaw, how can I fix this?

16:02 babilen: I am researching how to implement a "normal" CLI tool in clojure. I found two approaches: 1. "lein run" + tools.cli and 2. bash script like leiningen + magic ;) -- Are there other libraries/ways? In particular subcommands would be great.

16:03 Raynes: Step one would be to explain what you're actually doing to get the error in the first place. We can't help you with "I has error, please help!"

16:03 ibdknox: babilen, you can make a jar executable

16:03 amalloy: ~bug report

16:03 clojurebot: A bug report has three parts: What you did; what you expected to happen; what happened instead. If any of those three are missing, it is awfully hard to help you.

16:04 Raynes: babilen: If you want it to run fast, you can use something with a persistent JVM. cake and jark both do that.

16:04 ibdknox: babilen, http://skife.org/java/unix/2011/06/20/really_executable_jars.html

16:04 Raynes: If ClojureScript isn'

16:05 t prohibitive, you can target nodejs with it and get a script with speedy startup.

16:05 Also, the apostrophe is placed strategically next to the enter key so as to ruin my life.

16:07 zilti: Raynes: I'm trying to do, for now, a quite simple seesaw application. As of now I have an empty window with a menubar with one menu with two entries. https://gist.github.com/1314069

16:07 Raynes: At me it's the $-Key

16:08 ^^

16:08 Already sent many lines ending with $

16:08 Raynes: zilti: Could you paste the stacktrace you're getting to gist.github.com?

16:08 That'd be helpful.

16:10 zilti: Oh. Yes of course

16:11 It's on there

16:17 fdaoud: jcromartie: are you there?

16:17 jcromartie: fdaoud: yes

16:18 at your service

16:18 fdaoud: jcromartie: thanks :) so I had two questions following The Talk, one of which you already answered (queues)

16:18 the second one is about removing conditionals and control flow from the code and using rules and declarative logic systems instead

16:19 Raynes: zilti: I looked over the code and don't see anything obvious sticking out. I'd ask about it here: https://groups.google.com/forum/#!forum/seesaw-clj

16:19 fdaoud: I can't picture how that would work

16:20 The Talk was totally awesome as you promised, btw, so thanks for pointing me to it

16:21 zilti: Raynes: Ok, thank you. It seems like removing the :mnemoric "fixes" it, so the problem's in there.

16:21 jcromartie: fdaoud: honestly I'm not sure about that part. declarative logic is something I've been meaning to learn

16:21 fdaoud: but as far as a "rules" engine, that might be simple enough to code up for a specific situation.... for instance, I'm working on something that I'd call a business rules engine

16:21 but I don't know if it's what Rich was talking about

16:22 but to expand on my system

16:23 the "organization" is where I draw boundaries around data in our system

16:23 and when something proposes a change to the system, the organization's set of rules is consulted

16:23 and the rules are fairly declarative

16:24 brandel: could someone give me a link to the talk (assuming there's a video), I write clinical decision support systems so rules engines are of interest to me

16:24 jcromartie: and so the rule set can reject the change or not

16:24 that's the core of it, I think

16:24 but someone please chime in if you know what Rich meant by rules

16:25 aaelony: hi, what is a good way to turn [:a :b ["blah" "old" "new"]] into [:a :b "blah" "old" "new"] ?

16:25 jcromartie: aaelony: flatten

16:25 aaelony: thx! cool...

16:25 jcromartie: ##(flatten [:a :b [:c :d]])

16:25 lazybot: ⇒ (:a :b :c :d)

16:25 jcromartie: well it's not a vector, but you can take it from there

16:25 aaelony: merci

16:25 amalloy: depends on what you want [:a :b [:c [1 2]]] to return, i guess

16:26 * amalloy tries very hard not to recommend flatten

16:26 brandel: jcromartie: are you working on a general purpose rules engine like Drools, or something domain specific?

16:26 jcromartie: brandel: domain specific

16:26 aaelony: I want a vector actually, is there a better way?

16:26 jcromartie: there's a very specific sort of change we're concerned with

16:26 aaelony: (vec (flatten ...))

16:26 brandel: I've been trying to weigh up the advantages of adopting something like Drools vs rolling our own

16:27 jcromartie: brandel: I just don't know what a "rules engine" really offers

16:27 like, what's so hard about it? what are the real implications?

16:27 aaelony: jcromartie: thanks, that is what I am thinking of... but amalloy tries hard not to recommend flatten...

16:27 brandel: in our case, we have clinical experts that aren't software developers - currently our developers have to encode the clinical knowledge which can be error prone

16:27 a rules engine allows the domain expert to maintain the logic

16:28 granted, Drools isn't exactly user friendly

16:28 amalloy: aaelony: you usually don't need flatten; it's easier to instead construct your list with the right shape to begin with

16:28 and flatten will destroy any amount of nesting you do, even levels you might "want" to keep

16:29 jcromartie: brandel: I've found that "if condition, then action" is the basic definition of a rule

16:29 amalloy: it also seems quite unlikely to me that you have a data structure that (a) needs to be flattened, and (b) needs to be a vector

16:29 aaelony: amalloy: makes sense. I'm just mining a data structure that cheshire json preferred.

16:29 brandel: jcromartie: essentially yeah

16:29 fdaoud: jcromartie: interesting. my guess is that Rich means business rules, not simple if statements. right?

16:29 jcromartie: fdaoud: well that's what I'm wondering

16:29 aaelony: amalloy: unfortunately, both (a) and (b) are true

16:29 jcromartie: what is a business rule

16:29 fdaoud: yeah

16:30 I dunno

16:30 jcromartie: in our case, if/then is pretty much sufficient

16:30 brandel: business rules (or in our case medical guidelines) usually just end up as nightmarishly nested if statement

16:30 fdaoud: I do wish I had a nicer way of composing "actions" together into a chain

16:30 with rules to determine the flow

16:31 jcromartie: but the point is that you wrap the if/then up into a single unit

16:31 it can just be a function

16:31 brandel: one advantage of drools is that it lets you express domain concepts as a DSL which makes it easier for non technical people to write the logic

16:31 jcromartie: brandel: from what I've seen, Drool's "DSL" is just XML

16:31 isn't it?

16:32 brandel: it also has unit testing built in, which imo is critical for complex logic

16:32 jcromartie: or no

16:32 fdaoud: jcromartie: in your system, how are the rules represented/stored?

16:32 joly: I'll second that Drools isn't exactly user-friendly.

16:32 jcromartie: fdaoud: right now I just have an API for defining rules in namespaces

16:33 as functions

16:33 brandel: no, it has it's own templating language I guess you could call it

16:33 jcromartie: I see

16:33 joly: Yeah, we don't use the XML interface. I'd like to use the DSL capabilities, but our domain model isn't exactly friendly

16:34 brandel: joly: which is a pity, given what it is trying to achieve.. maybe that old adage that you can't create complex systems for domain experts, you just create new kinds of programmers is true.. I think someone said that about COBOL

16:34 fdaoud: interesting

16:34 joly: brandel: sounds about right

16:35 jcromartie: if someone can write this Drools DSL, they can use a nice Clojure API

16:35 because an API in Clojure rapidly approaches a DSL

16:35 without custom parsing

16:35 macros go a looooooong way

16:35 and HOFs

16:36 joly: I'm still trying to get Clojure integrated into our code :)

16:36 brandel: joly: you just tell your boss that it's "Java", easy right? :)

16:36 jcromartie: but my rules engine basically creates a map summarizing the change, and passes it into the actual rules, and so the rules are functions that take the change map and return a new (or unchanged) change map

16:37 so the change map that comes out the other end has all of the rules effects, failure messages, informative messages, notifications (emails), etc.

16:37 brandel: jcromartie: is this something you're likely to opensource? I'd be interested in a blog post about your process at least! :)

16:37 jcromartie: sure

16:37 it's quite simple really

16:38 fdaoud: jcromartie: it sort of sounds like a small validation module I wrote.. same kind of idea, the validations are rules, really, and at the end comes out pass or fail/errors

16:39 the validations are independent and can be combined into a chain for a given type of input

16:41 jcromartie: it's a lot nicer than imperative business logic that *does* things at each step

16:41 f

16:42 for instance, actually sending emails from DB stored procedures

16:42 or only being able to raise one error at at ime

16:42 at a time

16:45 fdaoud: right

16:45 jcromartie: I hope to add a testing/debugging/stepping interface, too, so that you can test the rules without committing changes

16:45 fdaoud: say you're stuck with Java

16:45 jcromartie: at that point it's not just going to be a function

16:45 hah

16:45 fdaoud: and you have this big glob of code in a method

16:45 it does some work, then there's an if, some more work, other work in the else..

16:46 it's just plain ugly

16:46 brandel: mm, as soon as your rules become reasonably complex having tests against them is very reassuring

16:46 fdaoud: I wish there was a way to extract those "units" of work, and the if/else independently

16:46 chain the units of work together and have the rules decide which units to execute

16:47 http://commons.apache.org/chain/ is the closest I got to a possible solution

16:47 brehaut: fdaoud: its call monads

16:47 or monadplus to be more pedantic

16:48 jcromartie: fdaoud: is there any kind of concrete example you can give of this complex glob?

16:49 fdaoud: brehaut: I know 2 things about monads: 1) I heard about them through Haskell. 2) I don't understand them.

16:50 brehaut: fdaoud: maybe its time to learn ;)

16:50 fdaoud: brehaut: what is the Clojure equivalent?

16:50 jcromartie: someone said "let" is a monad

16:50 brehaut: algo.monads for 1.3

16:50 fdaoud: or Java even?

16:50 brehaut: jcromartie: it is in the identity monad, for is also a monad in the seq monad

16:50 jimduey: let is monad comprehension for the identity monad

16:50 brehaut: (using 'monad' extremely loosely)

16:51 and heres someone who can explain things more succinctly than i can ;)

16:51 jimduey: http://www.infoq.com/presentations/Monads-Made-Easy

16:51 :)

16:51 brehaut: haha

16:52 that is a good link

16:52 jcromartie: so monads are single points that combine steps

16:52 in a well-defined way

16:52 fdaoud: ok well there's the next presentation on my list

16:52 brehaut: jcromartie: yeah, they have been called 'programable semicolons'

16:52 fdaoud: but now it's time to go do something much more primitive. make fire. cook meat.

16:53 brehaut: fdaoud: thats a curious way to write a functor

16:53 fdaoud: no new Bbq() here

16:54 (bbq meat)

16:54 much better :)

16:54 brehaut: fdaoud that was a poor quality category theory joke

16:54 fdaoud: brehaut: :)

16:54 great talking to y'all, to be continued..

16:54 jcromartie: so, rules can be thought of as monads

16:54 hm

16:55 fdaoud: I'll do my homework and watch that monad presentation

16:55 jcromartie: actually I've been creating monads all along

16:55 brehaut: jcromartie: thats highly likely

16:55 fdaoud: but gotta go for now. ciao

16:55 brehaut: they are common patterns that happen to have interesting types and shared characteristics

17:00 zilti: I'd like to do this, but as of now it isn't working because defmacro evaluates the function before adding the ~x: (defmacro vk [x] `(Integer/parseInt KeyEvent/VK_~x)) I've never done macros before, but this should be possible somehow, right?

17:03 brehaut: zilti: if you are attempting to fuse ~x onto VK_ then i think you might be out of luck

17:03 you probably want to look at the . (dot) special form

17:04 zilti: hmm

17:05 Yes, it was my intention to fuse it onto VK_

17:06 dnolen: jimduey: so w/ Friedman and Byrd making an appearance, I think we have a real KanrenConf ;)

17:07 brehaut: ,(macroexpand '(Integer/parseInt 1)) ; zilti

17:07 clojurebot: (. Integer parseInt 1)

17:07 dnolen: jimduey: I started looking over the original Kanren paper this morning, it actually looks they had some nifty ideas there for controlling the size of the substitution map. Need to dig in.

17:07 jimduey: dnolen: Yeah, that's going to be awesome.

17:08 that would be great and open up more places where it could be used.

17:08 dnolen: jimduey: yes!

17:08 jimduey: that BOF session you listed would be great.

17:09 dnolen: jimduey: it would also be sweet to hear them give a description on cKanren in their own words

17:09 jimduey: I've been mulling the idea that *Kanren is a DSL for doing logic programming. And what it might have in common with other DSL's

17:10 dnolen: jimduey: that is interesting ...

17:12 Raynes: technomancy: ping

17:13 babilen: ibdknox, Raynes: Thank you (had people coming over directly after asking the question) -- All I need now is a good command line argument parses. It looks as if tools.cli is the best one that is available for clojure, or am I missing something?

17:13 llasram`: zilti: perhaps? (defmacro vk [x] (symbol (str "java.awt.event.KeyEvent/VK_" x)))

17:14 zilti: llasram`: I have (defmacro vk [x] `(Integer/parseInt (eval (str "(. KeyEvent VK_" ~x ")")))) by now but that gives me a numberformatexception

17:16 joly: zilti: llasram's approach should work

17:16 zilti: joly: Indeed it does

17:21 But why?

17:21 Ah I see.

17:22 But there's one more problem now. The result should get converted to Int using Integer/parseInt...

17:23 joly: zilti: so you could do something like `(Integer/parseInt ~(symbol (str "KeyEvent/VK_" x))))

17:23 llasram`: no no

17:23 The VK_ static members in KeyEvent *are* already ints

17:24 zilti: Obviously they aren't in Clojure

17:24 Clojure converts them to Long

17:25 So I have to cast them back into Int

17:25 llasram`: Are you sure? If you pass them to a Java method expecting an int, Clojure will cast them for you

17:26 zilti: llasram`: No, Clojure unfortunately doesn't cast them for me

17:26 brehaut: zilti: if you just want to cast a long as an int, then (int n)

17:26 llasram`: And even then, you wouldn't use parseInt. Clojure `int' will give you an explicit primitive int, and Java Integer/valueOf will give you a boxed Integer

17:28 zilti: Hmm. That's odd. I'm pretty sure it's supposed to. 1.3 numerics page: "When calling back to Java for interop, conversions to a smaller primitive type are checked for overflow, so no safety is lost."

17:28 zilti: Oh. It seems like seesaw is internally converting it to long and then passes it to java. Stupid.

17:29 llasram`: Ah

17:29 zilti: At least that's the only possibility

17:30 joly: ,(type java.awt.event.KeyEvent/VK_ENTER)

17:30 clojurebot: java.lang.Long

17:31 zilti: ,(type (int java.awt.event.KeyEvent/VK_ENTER))

17:31 clojurebot: java.lang.Long

17:31 zilti: ???

17:31 lazybot: zilti: How could that be wrong?

17:31 llasram`: zilti: Not necessarily. Because Clojure 1.3 only supports longs, applying any operations to the number you pass in will convert it to a Long again

17:31 joly: Clojure 1.3 is changing it to Long due to the numerics changes

17:32 zilti: ,(type Integer/valueOf java.awt.event.KeyEvent/VK_ENTER)

17:32 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: valueOf in class java.lang.Integer, compiling:(NO_SOURCE_PATH:0)>

17:32 joly: ,(type (Integer/valueOf java.awt.event.KeyEvent/VK_ENTER))

17:32 clojurebot: java.lang.Integer

17:34 robermann: hello, just discovered labrepl (https://github.com/relevance/labrepl). FYI I've noted that the default project.clj configuration, which requires clojure 1.3, does not work out-of-the-box. If I specify the dependency at clojure 1.2 it works.

17:35 dnolen: zilti llasram` joly that behavior is changed in master at the moment. the conversion of primitive ints to Long no longer happens.

17:35 technomancy: Raynes: pong

17:35 joly: interesting

17:36 Raynes: technomancy: How do you feel about moving your Leiningen search stuff out into a separate library? I'd like to use it in cake. I'm also offering to do all the work on it (already working on it).

17:37 llasram`: dnolen: I saw that. Pretty minor change-code wise -- it'll be interesting to see how that plays out.

17:37 zilti: dnolen: I wonder why this has been done in the first place. It's just a memory eater.

17:37 technomancy: Raynes: I was planning on that since it needs to go into clojars too

17:38 dnolen: zilti: do you mean boxing in general?

17:38 technomancy: minus the downloading and printing part of course

17:39 although apart from downloading and CLI output there's really not much to it.

17:39 it's all in clucy

17:39 Raynes: Why not keep the downloading part in the library? It's useful and general enough, I'd think.

17:40 zilti: dnolen: Well especially that Int-to-Long boxing

17:40 Did you know that yesterday the inventor of Lisp died?

17:40 Raynes: It's actually a fairly substantial portion of the code, and the part that would be the most painful to not be able to reuse.

17:41 technomancy: I guess so.

17:42 though apart from the unzip function (which arguably belongs in clojure.java.io) it's really just a mashup of io/copy to a tempfile and deciding where the files go

17:43 but I guess if you just provide it with a base home dir in which to store the indices it's pretty generla

17:43 general

17:43 Raynes: Right, that's what I did.

17:44 technomancy: Also, unrelated, but clojure-jack-in is awesome. Thank you for it.

17:44 technomancy: thanks! I'm pleased with how it turned out.

17:44 it's still a bit of a mess if your project has output upon booting like :warn-on-reflection. but now that it stashes the elisp it's a lot more friendly.

17:47 zilti: technomancy: About the clojure-mode and swank-clojure I have a question - Why isn't the stuff evaluated using C-c C-l available in the slime repl?

17:48 technomancy: zilti: probably the repl is in the wrong ns?

17:48 zilti: Oh. *facepalm*

17:50 Raynes: technomancy: When I'm done here, I'll put this in a repository and give you write access. Unless you want to make the repo and give me write access? Whichever is fine.

17:51 I've named it 'sherlock', by the way. Can change if you have a better name handy.

17:51 technomancy: not at all; I approve.

17:51 although there's some precedent with the Mac System 9 file search program.

17:52 Raynes: heh

17:52 technomancy: so it's best if you create the repo to draw off the Apple lawyers

17:52 Raynes: Gotcha. ;)

17:53 technomancy: wow, this is hilarious: http://en.wikipedia.org/wiki/File:Sherlock3.6.2.png

17:54 "You can search a lot of different things on the Internet... all through one program."

17:55 brehaut: its amazing that there was a time when that wasnt obviously the web browser

17:55 zilti: good ol' times

17:56 technomancy: hmm... actually adding deps to leiningen really complicates packaging.

17:56 because that would mean that there'd have to be a .deb for sherlock

17:57 Raynes: Oh how I despise software repositories.

17:57 technomancy: so I may end up just sticking with my bundled ns because pulling in a 3rd-party package would only save about a page worth of code.

17:57 but it will still be useful for clojars.

17:57 Raynes: Or suppositories, more liek.

17:57 airolson: lol

17:58 Raynes: technomancy: That's fine. I still have reason to do this, since I need it for cake. I'll happily maintain/keep it up-to-date with Leiningen as much as possible.

17:59 technomancy: cool. I don't think it's likely to change much given that the maven index format has been stable for aeons.

17:59 Raynes: Right.

17:59 technomancy: though there are a few weird things about the field structure it that I haven't been able to figure out

18:00 but I think that has more to do with documenting how your form queries than actually changing the functions

18:00 according to luke, the description field is indexed, I haven't been able to query against it

18:00 could be using the wrong analyzers.

18:01 so if you figure that out I would be interested in finding out what's going on there

18:05 Raynes: technomancy: These have got to be the worst keywords I've ever seen. :u, :i, :n, :d… infuriating.

18:05 technomancy: yeah... I don't know if that's intended to reduce index size or what

18:05 I'm pretty sure that's not how lucene works

18:06 once you see some examples of what's in them it's pretty clear what they're for, but it's weird.

18:06 I found Luke to be a helpful tool, despite the awkward gui.

18:07 Raynes: Thanks for the tip.

18:08 I'm figuring out what these things mean so that I can make the parsing bit a little more general.

18:10 technomancy: Surely this is the prettiest UI you've ever worked with!

18:11 technomancy: ...

18:11 Raynes: I especially like the cigarette-stain coloring.

18:20 stuartsierra: hi Stu

18:20 stuarthalloway: hi stuartsierra

18:29 patchwork: hey #clojure, what would cause my lein repl to fail? here is the stacktrace: https://gist.github.com/1314550

18:30 It must be one of my deps?

18:30 here they are: https://gist.github.com/1314554

18:31 here are my dev deps: https://gist.github.com/1314559

18:31 I just type > lein repl and everything blows up

18:31 gtrak`: why is clojure-source 1.2?

18:32 patchwork: there is something weird about lein where it uses 1.2 internally

18:32 stuartsierra: WHAT is clojure-source?

18:32 abedra: ^

18:32 patchwork: even though I am using 1.3

18:32 it is something for swank-clojure to do stacktraces?

18:33 I think

18:33 I can try taking it out

18:33 ibdknox_: take it out

18:33 technomancy: it's for the cdt debugger IIRC

18:33 patchwork: so you are thinking this is in the dev deps?

18:34 technomancy: That is it

18:34 I was messing with cdt

18:34 Hmm… same problem

18:34 technomancy: can you paste the whole project.clj?

18:36 patchwork: Aha, just figured it out

18:36 I had a :java-source-path in there that made it fail

18:36 weird

18:36 has java source handling changed recently?

18:37 technomancy: patchwork: shouldn't have. what was the value?

18:37 patchwork: :java-source-path [["src/java"]

18:37 ["test/java" :debug true]]

18:37 I have some java code in there

18:37 is there a better way to do that?

18:38 possibly putting java code somewhere besides /src and /test?

18:38 anyhow, thanks for helping.

18:38 Raynes: technomancy: Any idea that :i is? The first segment is obviously a timestamp, but I'm not sure about the rest of them. Google isn't being helpful.

18:39 It's the only one I can't figure out.

18:39 robermann: patchwork: maybe the source code is not the aligned with your library; you depends on org.clojure/clojure "1.3.0" but require the dev clojure-source "1.2.0"

18:40 patchwork: what is the estimate on lein running 1.3?

18:40 technomancy: patchwork: many months unless someone wants to step up

18:41 patchwork: technomancy: what is holding it back currently?

18:41 I could be interested

18:41 technomancy: patchwork: well, the upgrade can't happen until version 2.0 because it would break a huge # of plugins

18:41 so we need to finish 1.6.2 first

18:41 patchwork: I just upgraded my project to 1.3, it was not so bad

18:41 technomancy: then switch to using aether instead of maven-ant-tasks

18:42 patchwork: Yeah, so it is plugins using contrib, not lein proper?

18:42 technomancy: yeah

18:42 but if leiningen upgrades, it will break the plugins

18:42 patchwork: Hmm… is no one working on these plugins anymore?

18:43 technomancy: well, it doesn't matter if they're maintained or not, it's not OK to go breaking plugins in a minor point release.

18:43 patchwork: I see

18:44 is there a definitive list of lein plugins?

18:44 technomancy: if you are ok with using the master branch, the 1.3 upgrade could happen sooner

18:44 but the full release is still going to be a ways away

18:44 patchwork: Yeah I am fine with that

18:45 you have something on master?

18:46 for instance, I know I am not using any 1.2 plugins

18:46 so that would not be a block

18:46 srid: can this be simplified? -- (or (parse-foo x) (parse-bar x) (parse-baz x) ..... repeats about 15 times)

18:47 amalloy: srid: some

18:47 patchwork: srid: put all those functions in a list?

18:47 amalloy: (some #(% x) [parse-foo parse-bar....])

18:47 srid: hmm

18:49 robermann: can I query which version a repl is using, inside the repl itself?

18:50 ibdknox_: ,*clojure-version*

18:50 clojurebot: {:major 1, :minor 3, :incremental 0, :qualifier nil}

18:50 ibdknox_: robermann: ^

18:50 robermann: thanks

18:51 , (class (* 1000N 1000 1000 1000 1000 1000 1000 1000))

18:51 clojurebot: clojure.lang.BigInt

18:51 robermann: mmm

18:52 does not work in 1.2

18:52 amalloy: ,(clojure-version) ;; this too

18:52 clojurebot: "1.3.0"

18:52 robermann: ok

18:52 amalloy: robermann: 1.2 doesn't have 1000N reader format

18:53 robermann: yes, just trying some examples from labrepl

18:54 its project.clj requires clojure 1.3 but it does not start the local http server

18:54 so I was reverting my local dependency to 1.2

18:55 (but of course some example does not work) - I guess I cloned the wrong branch

18:57 seancorfield: in emacs clojure-mode, how do i always set paredit-mode when i visit a file?

18:58 amalloy: seancorfield: add a hook to clojure-mode-hook

18:58 rafl: adding to clojure-mode-hook should do. or you can use something more sophisticated such as aspect.el

18:58 amalloy: (add-hook clojure-mode-hook (lambda () (paredit-mode 1)))

18:59 seancorfield: thank you amalloy and rafl !

18:59 gtrak`: does that get saved off somewhere?

18:59 clojurebot: Pardon?

18:59 gtrak`: not you clojurebot

19:03 Raynes: seancorfield: How's the Emacsing going?

19:03 robermann: about labrepl: with 1.3 the command script\swank fails because the class clojure.lang.ILookupHost does not exist (anymore?)

19:03 seancorfield: nice... auto-paredit mode... thanx... btw, needed 'clojure-mode-hook

19:04 Raynes: amalloy: Shame on you for giving him broken code.

19:04 seancorfield: Raynes: i'm forcing myself to use only emacs for a week... i wouldn't quite say i'm enjoying it but i'm not hating it either

19:04 it is a bit frustrating tho'...

19:04 Raynes: I did that with Vim and Sublime Text 2.

19:04 seancorfield: c-x o feels like an unnatural shortcut to cycle thru windows

19:05 archaic: very easy to change that, i have

19:05 seancorfield: and sometimes i do something that completely changes my layout and it takes several keystrokes to get it all back again

19:05 archaic: what's a good binding for other-window? (and how do i change it easily?)

19:06 robermann: I'm using tabbar-ruler and tabbar packages

19:06 they give you graphical "tabbed" frames

19:06 seancorfield: hmm c-tab is not used for anything else... that would suit me...

19:07 rafl: seancorfield: i used to be annoyed by that as well. then i just got used to windows appearing and disappearing as needed and was much happier than before with manual layout setup or various extensions that help with keeping one layout or switching between multiple layouts

19:07 archaic: seancorfield: first find out what the command is called using c-h k c-x o it will be other-window

19:07 duck1123: seancorfield in 1 week: I'm never using anything other than emacs

19:08 archaic: then (global-set-key key-name 'function-name) or something similar

19:08 Arafangion: At work, I map C-w-P{h,j,k,l} to each of the windmove functions.

19:08 C-w-{h,j,k,l}, rather.

19:09 archaic: as to what I use .. S in a modal mode so you probably want something different ;)

19:10 Arafangion: seancorfield: The main thing that prevents me from using emacs, is not knowing how to modify the default indentation well (to agree with teh project team so that it's consistent), and poor support for visual studio and xcode files.

19:12 robermann: 'night

19:13 lnostdal_: stuarthalloway, look for the text "possible fixes" in that report .. it mentions "removing it" as one option, and replacing it with "1.7" as another option ( CLJ-856 )

19:13 or, actually, it says "omit the option at all" .. not "removing it" .. but yeah

19:14 seancorfield: i ended up with (global-set-key (kbd "<C-tab>") 'other-window)

19:15 my emacs experience just got a whole bunch smoother :)

19:15 Arafangion: Ugh, my fingers would hate that keyboard shortcut.

19:16 seancorfield: Arafangion: so far emacs clojure-mode indentation seems to match CCW so that works for us...

19:16 Arafangion: seancorfield: Nice. :)

19:16 seancorfield: we'll see if we run into issues when there's more of us editing the clojure code with different editors...

19:16 Arafangion: seancorfield: I'm using C#, Python, C++, and ObjC most of the time. :(

19:17 lnostdal_: i use C-tab for this too .. thumb + ring finger

19:17 Arafangion: I prefer vi-style window changes.

19:17 Hence C-w-{h,j,k,l}

19:18 More accurate, too. :)

19:18 seancorfield: Sometimes I wonder if I shoudl consider a 'code reformatter' for providing a consistent style.

19:18 archaic: i used to use something like that but found having 4 keys for 3-5 buffers way overkill

19:19 Arafangion: archaic: I frequently want to switch between two buffers without wanting to cycle through six buffers.

19:19 archaic: Also, it's the same as vim.

19:27 hiredman: we have a commit hook at work that runs the code through emacs (clojure-mode) in batch mode before letting you commit

19:27 (I have it disabled of course)

19:28 technomancy: hiredman: not so loud, dan larkin will hear!

19:28 hiredman: LET HIM HEAR!!!

19:30 Arafangion: hiredman: Could I have that script?

19:31 hiredman: should ask danlarkin, he wrote it

19:31 danlarkin: whatever it is I disclaim all responsibility

19:31 hiredman: you bastard

19:31 Arafangion: danlarkin: Could I have a copy of that script, it'd be useful. :)

19:32 hiredman: k

19:32 Arafangion: danlarkin: Client-side of course... It'd be a sick bastard who installs it server side without an option to bypass it. :)

19:32 danlarkin: I'd do that in a heartbeat

19:32 Arafangion: danlarkin: I'll wear gloves.

19:33 hiredman: and we have tests in our test suite that check for too long lines, etc

19:33 Arafangion: Nice.

19:33 Actually, I have to go to work in... 5 minutes ago.

19:33 hiredman: like living in a jail :)

19:34 Arafangion: So I'll look for your names when I'm back! :)

19:34 danlarkin: but at least the jail is clean

19:34 unlike the outside

19:34 Arafangion: I'll keep the gloves on.

19:34 Adios!

19:39 duck1123: Does anyone happen to know what I need to do in my site to use joda-time with MongoDB

19:39 I'm using Karras, but I suspect there's a wrapper-agnostic solution

19:44 I think I may have found it

19:53 stuarthalloway: nathanmarz: boxing to Integers is insane, man!

19:56 ok, that was just baiting, but I would discuss if you were around ...

20:06 amalloy: stuartsierra: that change got applied already though, right? so it's less urgent to argue about whether it's a good idea

20:06 stuartsierra: huh?

20:07 stuarthalloway: amalloy: it can still be reverted

20:07 and it should be

20:09 cark: so i can (:refere-clojure :exclude [sequence]) from a namespace, but how do i use this namespace from another namespace, without raising errors ?

20:09 in 1.3

20:10 stuarthalloway: cark: you can't, and you shouldn't. avoid :use

20:10 cark: hum ok my bad, i was redifining it a 3rd time =P

20:10 stuarthalloway: I do 98% require/as, 2% use/only

20:10 cark: stuarthalloway: well that's open to discussion

20:11 stuarthalloway: cark: that discussion was had, during design of ClojureScript

20:11 you can see where it led...

20:12 cark: you guys came to a conclusion, and i respect that

20:12 but in some cases it's cumbersome to always qualify stuff

20:13 with smallish namespaces (as i think they should be) that's no trouble at all

20:13 even tho clojure.core is all but smallish

20:13 not a very good example in that case, but necessary

20:13 stuarthalloway: cark: fair enough

20:13 pandeiro: cark: dunno if it's ghetto of me but i def a few aliases up top when there's a long qualifier i dont like

20:14 cark: i guess tules are made to be broken =)

20:14 stuarthalloway: although i find the size of the overall project to be a bigger driver than the size of the namespaces

20:14 cark: tules/rules

20:14 stuarthalloway: s/tules/rules

20:14 s/tules/rules/

20:15 cark: i often have to dive in the source while having customers on the line, so finding stuff quickly is most important

20:15 stuarthalloway: IRC bots are like those college games that depend on only a few cool kids knowing the rules

20:16 cark: s/tules/rules

20:16 i think only me could have done that, but it's too late

20:16 * scgilardi points his elbow at stu

20:16 * stuarthalloway drinks

20:16 * stuartsierra takes a drink

20:16 * redinger drinks

20:16 * abedra takes a drink

20:17 cark: anyways : my point is i'd rather have small numerous namespaces where i can find stuff real fast, than few larger namespaces

20:17 even at the cost of a larger project

20:17 hiredman: speaking of "a few cool kids knowing the rules"

20:17 stuarthalloway: cark: totally agree

20:17 stuartsierra: oops

20:17 cark: damn there are to stuarts

20:18 abedra: two even

20:18 scgilardi: cark: does use/only not work for you: like: (:use [some.ns :only [f1 f2 fred fblue]])

20:18 redinger: cark: Have you ever seen them in the same place at the same time, though?

20:18 stuarthalloway: s/to/two

20:18 stuartsierra: Two odd, from my point of view.

20:18 stuarthalloway: fuck you bot

20:18 cark: s/to/two

20:18 s=/

20:18 scgilardi: yes i do use that quite extensively

20:19 anyways thanks for the input

20:21 working on yet another parsing library... matching on any state, and trampoline based, passing continuations for error and success

20:21 rather failure and success

20:21 ninjudd: Raynes: i told you everyone loves the s/foo/bar/ functionality of lazybot. you shouldn't have turned it off

20:22 cark: parsing text is covered by other libraries already, but this parsing pattern is usefull in many other cases

20:23 but you get crazy long traces when the usefull stuff at the bottom raises an exception

20:23 nathanmarz: stuarthalloway: hey

20:23 Raynes: stuarthalloway: As ninjudd just alluded to, I disabled the automatic s/// stuff in lazybot. Figured more people hated it than liked it.

20:23 stuarthalloway: nathanmarz hi

20:23 Raynes: it was the only bot feature I ever understood :-)

20:23 nathanmarz: i'm pretty happy with the change

20:24 stuarthalloway: figured you would be, but you shouldn't be

20:24 stuartsierra: s/happy/demoralized/

20:24 * abedra takes a drink

20:24 nathanmarz: ok

20:24 hiredman: but what is the point of the feature on irc? it can't go back and edit what has been typed

20:24 nathanmarz: did something break?

20:24 stuarthalloway: the good news is that with the change to hash semantics the problem of Integer is greatly reduced

20:25 so I can live with the new boxing rules

20:25 * stuartsierra gets some popcorn, sits down to watch.

20:25 stuarthalloway: but they are strictly harder to understand

20:25 and they don't help people doing interop

20:25 ninjudd: hiredman: you know what would make it even more awesome? if clojurebot did it instead of lazybot

20:25 * ninjudd takes a drink

20:25 stuartsierra: How many damn bots are there?

20:25 hiredman: ninjudd: *eyeroll*

20:25 nathanmarz: you can only get ints via interop, right?

20:25 redinger: clojurebot: how many bots?

20:25 jcromartie: http://i.imgur.com/xblF4.gif

20:25 clojurebot: Thanks! Can I have chocolate next time

20:26 hiredman: stuartsierra: depends on how many you have on ignore

20:26 stuarthalloway: nathanmarz: now you can get Integers from other Clojure fns that end with an interop call

20:26 nathanmarz: right, which is interop

20:26 stuarthalloway: consider this line of code (make-map (foo) 1 (bar) 2)

20:27 nathanmarz: boxing ints as Longs doesn't change the fact that the interop might return you an Integer anyway

20:27 Raynes: ninjudd: He wouldn't do it at all, I imagine. Because he's so much better than amalloy and I, I guess.

20:27 nathanmarz: so you still have to worry about it in clojure land

20:27 w

20:27 stuarthalloway: nathanmarz: true, but that is easy to see

20:27 nathanmarz: why is that easier to see than "int"?

20:27 stuarthalloway: and only a few very badly designed APIs return the box types

20:27 brehaut: arrows!

20:28 stuarthalloway: the example again: (make-map (foo) 1 (bar) 2)

20:28 cark: stuarthalloway: like APIs designed with clojure 1.2 =)

20:28 stuarthalloway: if make-map makes a Clojure map, then thanks to the hash fix, we don't care about Integer / Long

20:28 if make-map makes a Java map, then I have to know what foo and bar do to know if it will work

20:29 which I can deal with by saying (make-map (long (foo)) 1 (long (bar)) 2)

20:29 nathanmarz: there's legitmate reasons to return boxed types direclty, such as if you want it to be nullable

20:29 Raynes: stuarthalloway: Precisely two bots.

20:29 stuartsierra: Raynes: that was me

20:29 stuarthalloway: nathanmarz: and a ton of those would argue against my position

20:29 Raynes: stuartsierra: You should strongly consider changing your first name to Jim.

20:30 stuarthalloway: the flip size is that boxing doesn't help you much if you have to have a specific box type

20:30 brehaut: Raynes: hsbot is not a bot‽

20:30 stuarthalloway: so you need a boxed int, and say (.foo x), knowing that foo returns an int

20:30 Raynes: brehaut: Well, vocal bots then.

20:31 stuarthalloway: but then it breaks if you add anything else to it: a math op, a simple local let...

20:31 nathanmarz: hold up, what breaks?

20:31 stuarthalloway: won't be a boxed int anymore

20:31 nathanmarz: (let [y (.foo x)] changes the type?

20:31 wouldn't y just be an Integer

20:32 stuarthalloway: Clojure doesn't use Integers

20:32 certainly (+ 1 (.foo x)) will return a long

20:32 nathanmarz: i have no problem with math ops always returning Longs

20:32 stuartsierra: Raynes: "Jim Sierra." No.

20:32 nathanmarz: they're creating brand new values

20:33 stuarthalloway: I should try the let case, haven't read what rhickey did

20:33 Raynes: stuartsierra: To be fair, Jim wouldn't help me either. There is another jim in here that would mess with my tab complete.

20:33 nathanmarz: the results of a function don't need to math the type of the inputs

20:33 like any other function

20:33 danlarkin: how about Ronaldo Sierra

20:33 stuartsierra: Raynes: I know a Sierra Stuart, but that's a girl.

20:33 Raynes: I can get on board with that.

20:33 * stuarthalloway compiling HEAD

20:33 nathanmarz: i was testing the Integer stuff, and you can definitely create Integer objects

20:33 and pass them around

20:34 you can get primitve ints too

20:34 it's just that clojure decides to box as Long if that value needs to be boxed

20:35 my view is that since integers ultimately come from interop, then if you get the value from interop and send it back to "interop land", it should have the same type

20:35 stuartsierra: but you can't get an unboxed int, even from interop

20:35 nathanmarz: let me find the code that shows how

20:36 it was on that thread

20:36 stuarthalloway: stuartsierra; you can if directly chaining two Java things

20:36 stuartsierra: hmm

20:36 nathanmarz: i was able to let -bind a primitive int

20:38 http://pastie.org/2759419

20:39 stuartsierra: Isn't that a decision made by the compiler?

20:39 nathanmarz: what do you mean?

20:39 stuartsierra: In Java the language, aren't overloaded method calls resolved by javac?

20:40 I.e., not at runtime?

20:40 duck1123: what if you hint the x?

20:40 I don't have it running

20:40 nathanmarz: i don't know

20:41 brehaut: stuartsierra: yes i think so

20:41 stuartsierra: Then in Clojure it would be the job of clojure.lang.Compiler making the same decision.

20:41 duck1123: so, I get :int for this. Is that what I'm supposed to have?

20:42 stuarthalloway: nathamarz: I don't think that is binding a primitive

20:42 compiling now in order to read the bytecode

20:42 stuartsierra: My point is simply that overloaded methods, such as nathanmarz's example, are resolved by the language compiler, not by the JVM.

20:44 * hiredman would be surprised if it isn't a primitive

20:45 hiredman: given that let supports primitive bindings, and it would take extra work to disable it for the int case, and as far as I can tell from reading clojure source, rich is not the type to go through the trouble

20:47 stuartsierra: Huh, it appears the bytecode is doing istore/iload.

20:47 stuarthalloway: reading the bytecode, I would agree with hiredman

20:48 hiredman: having looked over the git diffs I agree with myself as well

20:48 stuarthalloway: nathanmarz: I stand corrected, it is binding a primitive

20:48 duck1123: can anyone tell me what I'm doing wrong here? https://gist.github.com/1315062

20:48 nathanmarz: ok

20:48 cool

20:49 stuarthalloway: although i don't think you can tell that from the interface test

20:49 nathanmarz: yea

20:49 i see that now

20:49 amalloy: duck1123: wrong syntax for extend

20:49 stuarthalloway: hiredman: do you prefer the new (box by type) or the old (box always to long) behavior?

20:50 hiredman: hard to say, very little experience with 1.3

20:50 amalloy: (extend-type DateTime MongoMappable (to-dbo [d] (str d)))

20:50 nathanmarz: also, boxing as Integer was the behavior in clojure 1.2

20:50 stuarthalloway: hiredman: if you are reading the git diffs you are ahead of most I would think

20:50 stuartsierra: What I'm trying to figure out is WHY the compiler saves an int, and if it was intentional.

20:50 amalloy: looking at your error message, it seems like you have more problems

20:51 hiredman: I am much happy with hashing fix, I didn't realizing what the niggling feeling of unease in the back of my mind was until I saw paul's email

20:51 duck1123: amalloy: same error

20:51 nathanmarz: not sure it was a big problem for people, wasn't a problem for me

20:51 stuarthalloway: hiredman: totally agreed

20:51 amalloy: duck1123: you're :import'ing MongoMappable instead of :use'ing it, too

20:51 duck1123: that's probably it

20:51 haven't used protocols much yet

20:52 stuarthalloway: nathanmarz: the hashing fix mostly removed my reason to care about the boxing rules. I still think boxing to long is easier to reason about, but the cases where it ever matters are vanishingly small

20:52 hiredman: stuartsierra: I imagine the compiler checks the return type, sees that it is an int, and creates an int slot for it

20:52 dnolen: stuarthalloway: but even w/ the current change, you're only one step away from boxing to Long.

20:52 stuarthalloway: dnolen: yup

20:52 hiredman: HostExpr is MaybePrimitiveExpr

20:52 nathanmarz: dnolen: you mean if you do an arithmetic operation?

20:52 duck1123: (inc amalloy)

20:52 lazybot: ⇒ 17

20:53 redinger: (amalloy)

20:53 stuartsierra: But LetExpr has an explicit check for int, which it casts to double.

20:53 I mean long.

20:53 dnolen: stuarthalloway: but the current state of HEAD old behavior won't get foisted on you if you're just roundtripping some interop.

20:53 abedra: (inc abedra)

20:53 lazybot: You can't adjust your own karma.

20:53 abedra: ah ha

20:53 now I see

20:53 nice

20:53 jodaro: hmm

20:53 stuarthalloway: (/ abedra 0)

20:53 jodaro: how do karras and congomongo compare?

20:54 abedra: lol

20:54 * abedra takes a drink

20:54 dnolen: nathanmarz: from what I understand yes.

20:54 stuarthalloway: dnolen: which old behavior?

20:54 jodaro: i've played with the latter a little already

20:54 dnolen: stuarthalloway: boxing to Long right away.

20:54 duck1123: I like Karras' entities. That's why I switched

20:55 jodaro: more ORMy?

20:55 stuarthalloway: dnolen: ok, right

20:55 you can't spell wormy without ORMy

20:55 stuartsierra: ^

20:55 nathanmarz: dnolen: you're creating a new value, no reason it has to match the types of its inputs

20:55 jodaro: heh

20:55 duck1123: jodaro: yes, plus all of the collections come back as records, so I can do dispatch on them

20:55 jodaro: not easily, at least

20:55 hiredman: stuartsierra: in the loop case

20:56 jodaro: duck1123: cool, i'll have a look

20:56 stuartsierra: hiredman: Oh, now I see.

20:56 * seancorfield loves having an IRC buffer in my editor :)

20:56 jodaro: seancorfield: same!

20:56 erc

20:57 technomancy: incanter-charts depends upon clojure-json‽

20:57 ಠ_ಠ

20:57 stuarthalloway: so binding an interop in in a let keeps the int, but with a loop binding you get a long

20:57 stuartsierra: Interesting.

20:57 stuarthalloway: s/in/int

20:58 hiredman: duck1123: most likely you are pulling in the the interface generated via defprotocol using import instead of pulling the protocol using use

20:58 danlarkin: technomancy: whoever owns that project needs to delete it

20:58 hiredman: oh

20:58 late

20:58 technomancy: danlarkin: incanter also pulls in old swanks that screw everything up =(

20:58 duck1123: hiredman: thank's anyway. I'm on to all new problems. :)

20:58 hiredman: that doesn't seem like it could be intentional

20:58 stuartsierra: The int in int isn't in it for long.

20:59 duck1123: even identity kills it

20:59 dnolen: stuarthalloway: ah yeah that must be the fancy loop inference stuff if I recall? only works for long / double.

20:59 technomancy: also all the incanter examples do bare use =\

21:00 hiredman: I wonder why identity is static, but doesn't have an inline

21:00 danlarkin: technomancy: if I add you as a collaborator can you deprecate it for me? :)

21:00 stuarthalloway: technomancy: cark will fix them :-)

21:01 technomancy: danlarkin: just fixing the readme?

21:01 wait, you added me to clojure-json once upon a time

21:01 danlarkin: I don't see you there anymore

21:01 technomancy: anyway, sure

21:01 danlarkin: githubs!!!!

21:01 technomancy: people need to know!

21:02 danlarkin: added! rectify my mistake

21:02 stuarthalloway: dnolen: guess so. Anyway, since different boxes work fine as hash keys now the rest of this is really corner-case stuff

21:02 technomancy: tomorrow

21:02 stuarthalloway: I can live with either behavior

21:03 technomancy: danlarkin: though in the case of incanter that is probably not going to help

21:03 anyway, /me &

21:03 * brehaut scrambles to fix his readmes before technomancy finds them

21:03 stuartsierra: stuarthalloway: It's at Compiler.java line 5954 I think.

21:04 It calls the ASM method Type.getOpcode.

21:04 (That's in the emitter for `let`)

21:04 So at that point the Clojure compiler doesn't care what the type of a `let`-bound thing is: ASM handles it.

21:05 stuarthalloway: g'night all

21:06 stuartsierra: later dudes

21:07 cemerick: Did I miss a relevance flashmob? :-P

21:07 stuarthalloway: cemerick: mostly

21:07 ibdknox_: cemerick: it was scary. hiding was the only real option.

21:08 danlarkin: tldr: ronaldo sierra

21:10 cemerick: OK, now who's going to clean up all these broken tequila bottles.

21:10 Those relevance animals…

21:22 The conj unconference is shaping up pretty nicely!

21:23 hugod: If I'd arrived half an hour earlier, I might have found out why my locals clearing posts were being ignored, ah well

21:23 danlarkin: the disj

21:25 zerokarmaleft: no shortage of eateries within walking distance of the sheraton, that's good

21:29 hiredman: hugod: you just seem to be the only one interested

21:30 hugod: hiredman: looks that way…

21:30 hiredman: we had cdt setup at work I think, I never used it though

21:32 hugod: seeing all variables when you hit an unexpected exception or breakpoint is quite nice, imho

21:36 hiredman: it sounds neat, but the setup for it seems so brittle I'd have to stop whenever I hit an exception, figure out why it isn't working, fix it, and then get the exception to rethrow

21:36 when I could just add a println or logging

21:39 and logging is useful in production

21:40 hugod: all useful parts of the toolkit

21:50 ibdknox_: The Conj unconference?

21:52 amalloy: ibdknox_: if you didn't get an invitation it means you're not one of the cool kids

21:53 ibdknox_: damn

21:53 but I've been working so hard to become one of those

21:53 amalloy: picking all these trendy names and such

21:53 amalloy: ibdknox_: if you stop having out with ORMs maybe you can sit with us at lunch

21:53 *hanging

21:54 ibdknox_: lol

21:54 it's not really an ORM ;)

22:05 jcromartie: what's the difference between "fork/join" and (reduce (pmap ...))

22:07 napping: which fork/join?

22:07 redinger: cemerick: I sure hope someone can find space for all that Unconj stuff

22:08 cemerick: redinger: We'll make it work :-)

22:08 redinger: Guess my house is always an option...

22:09 cemerick: ibdknox_, amalloy: totally public, linked on the list :-) https://docs.google.com/spreadsheet/ccc?key=0Alim_jfrt24MdDFqZVZsNW0tamtQR2pPTHJZTkN6Y0E

22:09 * brehaut laments living on the wrong side of the planet

22:09 cemerick: redinger: heh, that'll work! :-P

22:09 jcromartie: napping: I don't know :)

22:09 amalloy: cemerick: can someone tell me what BoF means? i've suddenly seen this word like a hundred times in the past couple days while people talk about this unconference

22:10 cemerick: I'm sure we can find plenty of room in the bar, in common areas, in neighboring restaurants & bars, the courtyard, someone with a suite at the hotel…

22:10 amalloy: Birds of a Feather

22:10 used frequently in conferences

22:11 ibdknox_: amalloy: I was wondering the same thing

22:11 napping: amalloy: pick the most amusing from http://en.wikipedia.org/wiki/BoF

22:12 ibdknox_: hm, should I do one about the web? There aren't really any web talks at the conference

22:15 napping: jcromartie: In general fork/join usually follows more of a tree structure

22:16 that reduce looks serial to me

22:18 jcromartie: hm

22:22 dnolen: I like me some CoffeeScript, but boy am I glad that Clojure (and thus ClojureScript) has no support for mutable locals

22:23 simard: brehaut: what side is that ?

22:23 brehaut: the bottom side

22:23 simard: lol

22:23 brehaut: new zealand

22:24 simard: probably not the worst place around

22:24 napping: mutable locals?

22:24 dnolen: napping: locals can be mutated by functions that close over them.

22:24 napping: I've been thinking that might be fine if you don't let them escape

22:25 brehaut: simard: in general it is good, but it limits access to the conjs frinstance

22:25 napping: yeah, escape like that

22:25 brandel: brehaut: are using clojure at work? (I'm in NZ too)

22:25 brehaut: brandel: nope, not yet anyway

22:25 dnolen: napping: well JS allows that, and CoffeeScript is conservative about changing JS semantics.

22:26 brehaut: brandel: its all python at work for me; i build websites with django

22:26 dnolen: napping: I thought CoffeeScript could adopt ClojureScript's solution for closing over loop locals. but it does work because JS locals are mutable. Clojure(Script)s aren't.

22:26 simard: any of you run their own business ?

22:26 dnolen: does/doesn't

22:26 brehaut: simard: yes

22:26 brandel: I'm in Dunedin and sadly almost all the work down here is .Net

22:26 brehaut: brandel: most of the work nationwide is .net i think

22:27 brandel: C#4 and F#2+ are pretty solid though

22:27 brandel: languages are fine, it's asp.net webforms that I can't cope with

22:27 simard: C#4 ? hum, I should admit I have not touched C# for 3 years.

22:28 brehaut: brandel: aspweb forms is death by rusty spoon

22:28 simard: it is a lisp yet ?

22:28 is it*

22:28 brandel: agreed

22:28 brehaut: simard: its gaining more haskell than lisp

22:28 brandel: linq is kind of haskellish

22:28 brehaut: its a lot haskellish ;)

22:28 napping: hardly a surprise there

22:31 jcromartie: something like (defmacro papply [f & args] `(apply ~f (map deref ~(vec (for [a args] `(future ~a))))))

22:32 clojurebot: map is *LAZY*

22:32 ibdknox_: yeah, while I was at MS, there was a focus on bringing in a lot of functional idioms

22:32 brehaut: no need to yell about it clojurebot

22:32 ibdknox_: F# actually drove a lot of innovation in C# itself

22:32 brandel: clojurebot is cranky

22:32 napping: more what Erik Meijer was working on at MSR before going over to the C# side

22:32 brehaut: ibdknox_: i like to imagine a corridor with the haskell guys at one end, F# next door, then C#

22:33 ibdknox_: lol

22:33 brehaut: smart things flow down

22:33 napping: wait, guess he worked on Haskell before joining MSR

22:33 ibdknox_: we were all in one hall for the most part ;)

22:33 brehaut: ibdknox_: this makes my day

22:33 zerokarmaleft: cemerick: that document is view only now

22:34 i guess i'd be worried too if 25+ people were trying to edit it at once

22:34 dnolen: napping: it was fun to hear him talk at StrangeLoop, seems like he's a fan of nasty imperative languages these days :)

22:35 ibdknox_: dnolen: you can still do awesome things with those, you know ;)

22:35 dnolen: ibdknox_: that really was his point.

22:36 aperiodic: does recur force evaluation?

22:36 brehaut: hes done a pretty good joke burying nice functional tools into a nasty imperative language

22:36 s/joke/job/

22:36 freudian slip?

22:36 ibdknox_: it's really good to see imperative languages stealing some of the good stuff

22:36 napping: well, how much of the good stuff didn't lisp have?

22:36 ibdknox_: C#'s immutable structures kind of suck though.

22:37 brehaut: yeah

22:37 ibdknox_: which lisp?

22:37 napping: Common Lisp, for one

22:37 not exactly function

22:38 ibdknox_: Common Lisp carries the weight of evolving over such a long period of time in the hands of many different people

22:38 it's not "designed" in the sense that Clojure is

22:39 and that lack of cohesion means that instead of an intelligent mixture of paradigms it feels haphazard

22:41 dnolen: ibdknox_: sad that there's not a Racket for Common Lisp to keep things moving forward. I played around with SBCL + quicklisp today, damn I wish that was around when I tried it out in 2008.

22:43 still think CL package stuff is horrifying. Even Art of the Metaobject Protocol makes fun of it, and that was written in 1991.

22:44 makes Clojure namespaces look positively dreamy.

22:44 ibdknox_: dnolen: yeah... I think a lot of their situation is a product of their community

22:45 dnolen: the CL culture doesn't lend itself to moving very far

22:48 aperiodic: i guess the real question is: how is clojure lazy? is there an equivalent of haskell's thunk?

22:49 amalloy: aperiodic: thunks are not a haskell invention

22:49 a thunk is just "a function of no arguments"

22:50 napping: well, that and storing away the result so work is not duplicated

22:50 amalloy: napping: that's a cached thunk

22:50 aperiodic: in other words, a function with no free variables?

22:50 napping: Most of the laziness seems to be in Seq instances

22:50 amalloy: uhhh. i don't think that's the same

22:51 (fn [x] x) has no free variables

22:51 (fn [y] (+ x y)) has a free variable x

22:51 aperiodic: ah, i see the distinction

22:51 amalloy: the thing that haskell, as a lazy language, does differently is (i think) implicitly wrap all evaluation in a cached thunk

22:52 clojure has cached thunks: ##(doc delay)

22:52 lazybot: ⇒ "Macro ([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls. See also - realized?"

22:52 amalloy: and lazy sequences are similar, except they're sequence-specific

22:53 brehaut: amalloy: if we are being pedantic haskell doesnt wrap all evaluation in cached thunks or thunks; that decision is based on the results of the strictness analyzer

22:53 aperiodic: it's a sequence where the tail is wrapped in a delay?

22:53 amalloy: aperiodic: the head and the tail

22:55 aperiodic: amalloy: then why doesn't evaluating the head cause the rest of the sequence to be evaluated?

22:55 dnolen: aperiodic: why should it?

22:55 amalloy: because the tail is another lazy sequence, which as always is wrapped in a delay

22:56 dnolen: Clojure doesn't have TCO (for interop reasons) so it supports good functional tail recursive style via lazy sequences, recur, and trampolines.

22:57 aperiodic: so a function that recursively constructs a lazy seq will be evaluated lazily as a result of the laziness of the sequence?

22:58 dnolen: aperiodic: yes

22:58 aperiodic: but it still consumes stack, right?

22:58 seancorfield: question about Programming Clojure...

22:58 aperiodic: dnolen: that is, linear amounts of stack

22:58 seancorfield: the git repo project.clj refers to contrib-1.3.0-SNAPSHOT

22:58 url https://github.com/stuarthalloway/programming-clojure/blob/master/project.clj

22:59 dnolen: aperiodic: a good lazy sequence should not eat up the stack, regardless of it's size.

23:00 ,(take 10 (range 1e20)

23:00 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

23:00 dnolen: ,(take 10 (range 1e20))

23:00 clojurebot: (0 1 2 3 4 ...)

23:02 seancorfield: i tried to add the sonatype repo to lein... but it still complains it can't resolve the artifact

23:04 simard: I want to produce a list of function calls to be evaluated later by another function, what is the best strategy to do that ? a list of anonymous functions of the kind: (fn [] (call-me-later x y z)) where x y z get bound by the function "packager" ?

23:05 aperiodic: dnolen: yeah, i get that, since at any point it's only necessary to evaluate a single member while keeping the tail wrapped up in the delay, so the memory requirements for evaluating the seq are constant

23:06 seancorfield: nm, figured it out... i had a typo in my repo URL :(

23:06 aperiodic: dnolen: the part i'm fuzzy about is when using a recursive fn to construct the seq

23:07 dnolen: aperiodic: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3821

23:09 aperiodic: dnolen: awesome, that's really helpful. thanks!

23:09 dnolen: aperiodic: no problem.

23:47 brehaut: its always encouraging to hear that the (plain text with interpolations) email template you are editing is consumed at the other end by a flaky excel macro :S

23:49 simard: uhm, this is probably obvious, but, is there a function that... calls a function ?

23:49 (a function of no argument)

23:49 (xyz (fn [] (str "Hello " "World")))

23:49 alandipert: #(%)

23:50 aka (fn [x] (x))

23:50 simard: hum makes sense

23:50 thanks

23:50 technomancy: amalloy had a neat trick for doing that in an existing function

23:50 amalloy: technomancy: nah, only if you have an arg

23:50 technomancy: something less perlish

23:50 oh, that's right

23:50 deliver

23:51 (memfn invoke) is a poor substitute =)

23:53 aperiodic: you could also abuse apply

23:53 but then you have to type an empty list literal

23:55 miclorb_: I thought I understood (apply) - clearly not

23:55 apply is normally (apply <function> <sequence>) right?

23:55 aperiodic: correct

23:55 miclorb_: so if I see something like (apply func arg1 arg2 arg3) - how does that work?

23:55 arg3 is a list

23:56 amalloy: miclorb_: it's the same as (apply func (cons arg1 (cons arg2 arg3)))

23:56 aperiodic: i think it conjs the args

23:57 yeah, what amalloy said

23:57 amalloy: or, more concisely, (list* arg1 arg2 arg3)

23:57 miclorb_: in this case func takes 2 args - not sure if that confuses things more

23:57 brehaut: amalloy: points for list* :)

23:57 miclorb_: ok

23:57 seancorfield_: ,(doc list*)

23:57 clojurebot: "([args] [a args] [a b args] [a b c args] [a b c d & ...]); Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."

23:58 seancorfield_: and to think stu complained about the "half earmuff" vars in clojure.java.jdbc :)

23:59 brehaut: lol

23:59 technomancy: yeah I don't know if he was confused or what

23:59 amalloy: haha i must have missed this one

Logging service provided by n01se.net