#clojure logs

2011-10-25

00:00technomancysean_corfield: don't sweat the extra lisp module for now
00:00sean_corfieldok, i _do_ have clojure-mode but i expected the starter-kit stuff to provide slime or swank or whatever else i need
00:00simardis a "protocol" just a convenient way to do a "defmulti" that dispatches on the class of the object ?
00:01brehautsimard: thats a simplification of it
00:01sean_corfieldi want a repl but don't have clojure-jack-in or slime-connect or swank-whatever-it-was-that-someone-recommended
00:01simardbrehaut: what are the most striking details I'm forgetting ?
00:01brehautsimard: it provides performance and interop benefits in exchange for loosing some flexibility
00:01technomancysean_corfield: if you don't have clojure-jack-in then you must have a really old version of clojure-mode
00:02simardbrehaut: and apart from that, I was "right on" ?
00:02sean_corfieldi followed the instructions... *glare* :)
00:02brehautsimard: the other major charactistic is that protocols can have multiple methods, and multis are just a single function
00:02simardoh..
00:02technomancysean_corfield: you mentioned it's fetching from tromey.com?
00:02brehautsimard: go look at reify, it might be enlightening
00:02technomancythat would explain being way out of date if you're using that instead of marmalade
00:03sean_corfieldtechnomancy: when i started trying to install the starter-kit
00:03sean_corfieldi'm just following your starter-kit instructions
00:03technomancysean_corfield: where was tromey.com mentioned?
00:03technomancyI thought I had removed all that
00:03sean_corfieldi don't understand any of this emacs crap, which is why i'm following your instructions...
00:03brehautsimard: if you have the time and money, joy of clojure has a nice and comprehensive look at both multis and protocols et al
00:04technomancysean_corfield: yeah, I'm just trying to make sure they are accurate
00:04sean_corfieldcontacting tromey.com:80 appeared in the emacs minibuffer when i was trying to install per the instructions
00:04sean_corfieldthis is the second time i've gone thru this - it didn't work properly on os x either earlier
00:05simardbrehaut: maybe hehe :)
00:05sean_corfieldi'm stunned at how hard it was to get emacs 24 installed on ubuntu...
00:05technomancysean_corfield: even with emacs.naquadah.org?
00:05brehautsimard: its a very good book, even if you are familiar with a lot of its topics you'll learn valuable stuff
00:06sean_corfieldtechnomancy: damein cassou's ppa for the apt-get install emacs-snapshot
00:06simardit seems to enjoy good reviews on amazon
00:06sean_corfieldi recall seeing emacs.naquadah.org somewhere in my frustrating travels this evening :)
00:06technomancysean_corfield: what starter-kit instructions did you use?
00:07simardI already own "Programming Clojure", which is why I hesitate buying a second book on Clojure
00:07simardfor now
00:07sean_corfieldhttps://github.com/technomancy/emacs-starter-kit
00:07technomancythe current readme mentions naquadah and not tromey.com, so you must have found something else
00:07sean_corfieldi followed those instructions exactly
00:08sean_corfieldtromey.com was where it looked on os x
00:08sean_corfieldsomeone said i had to compile the lines in init.el and that "solved" the problem
00:08sean_corfieldso on os x i *might* have .emacs file which i can remove tomorrow
00:08sean_corfieldright now i'm focused on ubuntu
00:09sean_corfieldso... can i query what version of things i've got in, to help debug this?
00:09sean_corfieldah, clojure-mode 1.11.2 it says
00:10technomancyif you have that version of clojure-mode, then you have M-x clojure-jack-in
00:10sean_corfieldfwiw, it's definitely using marmalade on my ubuntu netbook
00:11sean_corfieldwhen i try M-x cloj... it says no match
00:13technomancywow, I have never heard of anything like that
00:13simard:)
00:13technomancyhow are you finding the version?
00:14sean_corfieldin the packages list buffer it shows the version
00:14sean_corfieldi see clojure-mode there but can't figure out how to enable clojure-ode
00:14sean_corfieldmode
00:14technomancyit's supposed to be autoloaded
00:15technomancythere's nothing for you to do
00:15technomancyyou can go in and find the file in ~/.emacs.d/elpa/clojure-mode[...]/clojure-mode.el and do M-x eval-buffer
00:15technomancyif you want to bypass the package manager
00:15sean_corfield'k
00:15technomancybut I'm totally baffled as to why the autoloads aren't happening
00:16technomancynever seen anything like that.
00:16sean_corfieldthe elpa folder doesn't seem to contain clojure-mode
00:17sean_corfieldnope... starter-kit-lisp-2.0.3 but no clojure-mode
00:17technomancysean_corfield: but the package-list buffer shows it as installed?
00:17sean_corfieldas far as i understand emacs, yes
00:18technomancywell, it's not installed
00:18technomancymaybe try M-x package-install clojure-mode again?
00:19sean_corfieldso the starter-kit-lisp is installed but clojure-mode isn't??
00:19lazybotsean_corfield: Definitely not.
00:19technomancyright
00:19technomancythe lisp module of starter kit has stuff that's generic to all lisps
00:19technomancyit doesn't depend on clojure-mode
00:19sean_corfieldhow are folks supposed to know what to install?
00:20sean_corfieldok, an explicit install of clojure-mode seemed to work... *sigh*
00:20technomancytraditionally the readme? =)
00:21semperosI 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
00:21semperos(I've not tried the starter kit myself)
00:21semperosfor Clojure dev, I should say
00:21technomancysemperos: that's what I keep trying to tell folks, but everyone else insists on convincing people to use the starter kit =)
00:21zerokarmaleftsemperos: same here
00:22sean_corfieldbut that information is not gathered in one place, is it?
00:22semperoshttps://github.com/technomancy/swank-clojure
00:22semperosthree bullets
00:22semperosInstall clojure-mode either from Marmalade or from git.
00:22semperoslein plugin install swank-clojure 1.3.3
00:22semperosFrom inside a project, invoke M-x clojure-jack-in
00:22technomancyas an overview, this covers it: http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
00:22technomancypossibly in more detail than is warranted, but it does focus on clojure-mode first
00:23sean_corfieldthat page starts out by recommending the starter-kit...
00:23technomancyyeah... I didn't write that =\
00:23sean_corfieldbut it does not make it clear what instructions cause what to be installed
00:23technomancyalso the &#*& comments are useless, but I can't delete them
00:24mintsoupIt implies, somewhat poorly, that installing clojure-mode is step 2
00:24sean_corfieldoh i hadn't even gotten to the comments
00:24sean_corfieldnow i finally have clojure-mode installed(!) i can do clojure-jack-in
00:24brehautpeople read comments anywhere in 2011?
00:24technomancycomments like that are unavoidable when you prohibit people from editing the wiki.
00:24sean_corfieldbut it couldn't find project.clj
00:24sean_corfield*sigh*
00:25mintsoupyou'll want to use https://github.com/technomancy/leiningen to create a project
00:25zerokarmaleftgood grief, these comments are complicated
00:26zerokarmaleftonly 20+ or so steps
00:26sean_corfieldi've got a leiningen project
00:26sean_corfieldi've been using leiningen for ages
00:26simardsean_corfield: open a source file for this project before running M-x clojure-jack-in
00:26semperoswhere did you execute clojure-jack-in? what was your active buffer?
00:26sean_corfieldthe only new piece of the puzzle here is ^%$$% emacs
00:26technomancyzerokarmaleft: http://www.penny-arcade.com/comic/2003/05/09
00:27sean_corfieldyeah, yeah, i figured that out now...
00:27simard:D
00:27sean_corfieldi got some error about symbol matching its value in reflection ???? and a buffer full of warnings
00:28technomancygive it a minute
00:28technomancythe first time you connect it has to byte-compile a few elisp libs
00:28sean_corfieldok, i finally found a buffer called *swank*
00:29sean_corfieldalso full of reflection warnings...
00:29technomancysean_corfield: sooooo... where do we fix the docs, then?
00:29sean_corfieldand it ends with proceed to jack in
00:29zerokarmalefttechnomancy: heh
00:29technomancyprobably start with moving the mention of the starter kit to the bottom of the getting started with emacs page?
00:29sean_corfieldtechnomancy: hard to say since i've no idea where it stopped working per the instructions
00:30sean_corfieldso at this point i have zero idea whether i have a working repl or not
00:30technomancyI think the main problem was there was too much distracting you from clojure-mode
00:31technomancythe repl buffer should be called *slime-repl clojure*
00:32sean_corfieldthe wiki should describe only what is needed to get this running
00:32mintsouptechnomancy: for me, the instructions that got me up and running the fastest was https://github.com/technomancy/swank-clojure
00:32sean_corfieldand it should be the single, recommended way to do it
00:33technomancywell, it used to be that inf-lisp was much simpler to set up than slime
00:33sean_corfieldwhat about lein swank?
00:33technomancybut maybe it's not even worth mentioning inf-lisp
00:33sean_corfieldi ran that in a terminal window so it's happily sitting there
00:34sean_corfieldbut none of the instructions i read got me closer to using that...
00:34technomancysean_corfield: that's only necessary if you want your clojure process to outlive your emacs instance
00:34mintsoupclojure-jack-in should start lein swank for you
00:34sean_corfieldthat is not explained on the wiki
00:34sean_corfieldthe wiki assumes a LOT
00:35sean_corfieldso i'm starting emacs back up
00:35sean_corfieldwhat small steps should i follow to get a repl running in my project?
00:35RaynesI really need to get jack-in working with cake.
00:35sean_corfieldi've opened my project.clj file...
00:36sean_corfieldM-x clojure-jack-in ...
00:36sean_corfieldStarting swank server...
00:36zerokarmaleftprofit?
00:36sean_corfield...waiting...
00:37sean_corfielderror in process filter: Symbol's value as variable is void: Reflection
00:37sean_corfieldand that seems to kill it
00:38sean_corfieldnow what?
00:38semperos(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)
00:40sean_corfieldthe 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
00:41technomancymarmalade was a lot more important when there were three or four elisp files involved
00:41technomancynow that it's only one it's not so terrible to do everything by hand
00:41sean_corfieldso, how do we debug this failure of clojure-jack-in?
00:42technomancyit's possible that output during startup of the process could interfere
00:42sean_corfieldwhat's that "error in process filter" about?
00:42sean_corfieldreflection warnings could cause it to fail?
00:42technomancythe lein process is supposed to emit valid elisp
00:42technomancyoh!
00:43technomancyit could be a :repl-init key or something
00:43amalloytechnomancy: i think sean_corfield has warn-on-reflection set to true
00:44sean_corfieldyes, we always run with that at world singles
00:44amalloyin which case Reflection would be the first word of the elisp that emacs doesn't like
00:44scgilardinice one, amalloy
00:44technomancyoh I guess you would get that even with bare swank regardless of the project
00:44sean_corfieldit's why i keep reporting so many reflection warnings on projects :)
00:44sean_corfieldso i set it to false, but now i can't get it to kill the existing swank process...
00:44sean_corfield*grrrr*
00:44sean_corfieldoh hallelujah!!! Connected!!!!
00:45sean_corfieldi have a REPL! the angels are singing!
00:45technomancyok, that is definitely a flat out bug
00:45sean_corfieldso i can't use warn-on-reflection???
00:45lazybotsean_corfield: How could that be wrong?
00:45technomancyadding it to the "Troubleshooting" section of the readme for now
00:45RaynesI think the sarcasm in here is getting a little strong. Maybe we should open a window?
00:46michaelr525Raynes: a buffer?
00:46mintsoupgetting emacs to work sometimes feels miraculous
00:46brehautmichaelr525: i think you mean a frame
00:47sean_corfieldRaynes: it's nearly 10pm here... i've been wrestling with emacs for about five hours so far...
00:47brehautthe problem, when you get right down with it, is shoggoths
00:47sean_corfieldthe problem is emacs :)
00:48brehautsean_corfield: and all shoggoths, emacs is corpulent, ancient, and hard to tame
00:48brehauts/and all/ and like all/
00:48technomancyand there was one bona-fide bug there at the end
00:48sean_corfieldso... now i have a repl... where's a nice, simple set of instructions on how to run code from one buffer in the repl...
00:48RaynesAfter using Vim and Sublime Text 2 for a couple of weeks, I appreciate Emacs in ways I can't really describe.
00:49mintsouphttps://github.com/technomancy/swank-clojure has a listing of commands you can run
00:49sean_corfieldyeah mintsoup but it's not really clear what each actually means
00:49RaynesOne 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.
00:49sean_corfieldi'm comparing this whole experience to CCW, btw, which is clarity itself compared to emacs
00:50brehautsean_corfield: C-c C-e evaluates the expression under/behind the insertion point
00:50mintsoupwell.. when i'm screwing around w/ stuff, i'll do something like C-c C-l to load my current file into the repl
00:50brehautwhich is a decent place to start
00:51amalloybrehaut: that's C-x C-e
00:51amalloyC-c C-e evals the current top-level form
00:51amalloy(as does C-M-x)
00:51RaynesI 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.
00:51scgilardithanks for all your patient help, phil!
00:52amalloytechnomancy: 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
00:52amalloyi encourage you to not clarify
00:53sean_corfieldin CCW, you load file into repl and then switch repl namespace, which also moves the cursor to the repl
00:53scgilardibring 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.
00:54sean_corfieldseems like in slime you have to do three commands? c-c c-l, c-c m-p and then c-c c-z?
00:54sean_corfieldyeah, i noticed i also have to confirm the namespace change with RET
00:54amalloyscgilardi: C-c C-z nicer than C-x o
00:54sean_corfieldmakes it more work than CCW
00:54scgilardiyes, didn't know about it. cool.
00:54RaynesYou could write your own command to do that.
00:54RaynesIf you really, really wanted to.
00:55semperosyou can always set switch buffer to whatever you like, I use C-'
00:57sean_corfieldin 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?
00:59sean_corfieldc-h a paredit brings up a lot of commands but doesn't seem to list keyboard shortcuts?
00:59michaelr525semperos: using right-Ctrl?
00:59semperosmichaelr525: left Ctrl (remapped to my caps lock key) plus single-quote
00:59Rayneshttp://www.emacswiki.org/emacs/PareditCheatsheet
01:00michaelr525semperos: i use this http://mumble.net/~campbell/emacs/paredit.html
01:00semperosmichaelr525: that's for paredit, I was just referring to shortening up some of the standard C-x key chords Emacs comes with...
01:00michaelr525semperos: your caps lock is your Ctrl?!
01:01sean_corfieldRaynes: gracias!
01:01michaelr525semperos: sorry the link was for sean
01:01semperosmichaelr525: helps my wrist
01:01semperosnp
01:01RaynesThat cheatsheet is my lord and savior.
01:01RaynesAmen.
01:02michaelr525semperos: so you don
01:02michaelr525't use the original left ctrl?
01:02semperosI swap the caps and left ctrl keys
01:03semperosmichaelr525: 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
01:04michaelr525semperos: you have something to map it globally?
01:04Raynesmichaelr525: Your operating system likely has a way to switch the keys.
01:05semperosmichaelr525: 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
01:05michaelr525semperos: which app?
01:06michaelr525thanks
01:06semperosmichaelr525: http://www.autohotkey.com/
01:06semperosfrom this page of the EmacsWiki: http://www.emacswiki.org/emacs/MovingTheCtrlKey#toc15
01:07michaelr52510x!
01:07semperosit lets you do custom key mappings, save them as executables, and even add them to your startup
01:07amalloysemperos: 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
01:07semperosheh
01:08semperosamalloy: I should quite infrequently online, but the occasional desire to capitalize my SQL commands does strike me :)
01:08sempeross/I should/I shout
01:09amalloysemperos: type lower-case, then C-a C-u M-u? :P
01:09semperosyou got me there
01:10michaelr525the whole concept of remapping the ctrl seems to me amazing, it's like a new world openning up
01:10michaelr525;)
01:10semperosamalloy: for any key chord that requires more than two "clusters", I just remember the elisp function name...
01:11semperosas I don't like looking down at the keyboard if possible
01:11RaynesMy hands are smarter than I am. I couldn't tell you how to spell anthropomorphism, but my hands sure can.
01:12amalloyRaynes: let's see if they're up to onomatopoeia?
01:12Raynes$dict onomatopeia
01:12lazybotRaynes: noun: common misspelling of onomatopoeia.
01:13amalloy(inc lazybot)
01:13lazybot⟹ 0
01:13RaynesClose enough.
01:13michaelr525bad hands
01:13jodaroonomatopaella
01:13sean_corfieldhmm, 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...?
01:15michaelr525semperos: do you also http://www.emacswiki.org/emacs/SwapControlAltAndCapsLock?
01:16sean_corfieldi see kill / yank but is there copy / paste equivalent? or do i have to kill / undo (switch buffer to repl) / paste?
01:16semperosmichaelr525: nope, I just swap caps and left ctrl
01:16semperosyou can "copy" with M-w, instead of killing
01:16semperosonce you've marked a region
01:17sean_corfieldah, right...
01:18devnjodaro: lol
01:18devn"onomatopaella"
01:19jodaroit's delicious
01:19devnit *sounds* delicious ;)
01:19sean_corfieldsemperos: thanx ... that works exactly how i wanted!
01:20semperossean_corfield: I'm glad at least one small sliver of your Emacs revival tonight has worked just like you wanted it to :)
01:20sean_corfieldc-m-f c-spc c-m-b m-w c-c c-z c-y
01:21amalloyseancorfield: ewww
01:21amalloyC-M-spc
01:22sean_corfieldwhich specific part does that replace?
01:22amalloythe first three
01:22jodaroRaynes: wordnik sent me a bunch of swag in the mail today
01:23sean_corfieldc-m-spc gives me containing expression ends prematurely
01:23Raynesjodaro: Really? They never offered me shit.
01:23Raynesjodaro: Wunderground is sending me swag though.
01:23jodaroRaynes: a t-shirt, some stickers, a couple notebooks and some mini sharpies
01:23jodarooh nice
01:23amalloyor replace the whole thing with C-M-x, except you wanted it to appear in the actual repl as *1 i think?
01:23jodaroi like wunderground
01:23jodarothey have good weather
01:24sean_corfieldamalloy: ok, that's more location sensitive than i realized
01:24RaynesAnd an excellent API.
01:27sean_corfieldm-w seems a weird key combo for "copy"...
01:29sean_corfieldit doesn't seem to be mentioned in the emacs tutorial...
01:49sploopHello. Has anyone in here messed with functional reactive programming (not necessarily in Clojure)?
01:50zerokarmaleftsean_corfield: C-w kills a marked region, which is mentioned in the tutorial...given that, M-w makes sense
01:56sean_corfieldzerokarmaleft: 'k that does make sense, thanx
01:57sean_corfieldit's a lot of new keyboard shortcuts to get used to
02:05archaicto 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?
02:05scottjI think you can use cua mode to get normal copy/cut/paste
02:11sean_corfieldok, just done a bunch of git stuff from emacs... feeling happier now...
02:12sean_corfieldscottj: yeah, i think i just need to get used to the emacs way (again)
02:14seancorfield_i guess i shouldnt be surprised emacs does irc too, right?
02:14archaicm-x erc
02:15archaicehehehe
02:15archaicit does
02:15archaicweb browser
02:17seancorfield_code in one buffer, a repl in another and irc in a third... i could get used to this... :)
02:19seancorfield_why is clojure.repl not loaded via clojure-jack-in?
02:20seancorfield_surprised me why doc threw an exception...
02:23amalloyclojurebot: how?
02:23clojurebotwith style and grace
02:33seancorfield_ok, editing, repl, irc, shell... check... my frustrations with emacs are beginning to wash away...
02:38lobotomyhey everyone. i started a blog: http://lobotomys.blogspot.com/
02:38lobotomyfirst post is about clojure
02:43seancorfield_lobotomy: yay, more clojure! curious as to why you didn't parse the xml to a data structure?
02:46amalloylooks more like a reduce than a trampoline, lobotomy
02:54mtmseancorfield_: 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)
02:56archaicits taking 30s to create an 800x800 matrix (of doubles) in incanter from a vector of vectors any ideas how I can improve this?
02:56iris1Is 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.
02:59scottjiris1: contrib is split up into individual packages
03:02iris1scottj: 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!
03:07seancorfield_iris1: c.c.duck-streams has been deprecated for a while...
03:07seancorfield_most of what was in that namespace has gone elsewhere tho'
03:11amalloybooks 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"
03:12scottjmost books on new languages don't have as many libraries as clojure to cover :)
03:20iris1Thank 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?
03:20lazybotNooooo, 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.
03:23amalloyhaha. dang it, lazybot, you make it sound like duck-streams are okay
03:23lobotomyamalloy, looks like reduce? do elaborate
03:24amalloylobotomy: convert the XML file into a sequence of transactions, and then reduce over that accumulating everyone's balance
03:26amalloyor accumulating a map of matching transactions, if you like
03:29amalloyiterating over a sequence of similar sub-objects to build some single larger object is the poster child for reduce
03:29seancorfield__ok, i seem to have clojure-mode and a repl etc working on my imac too now
03:29seancorfield__thank you everyone who helped!
03:31mindbender1Good Morning All
03:32lobotomyamalloy, wouldn't that require linear space though?
03:33lobotomyi mean, i am basically reducing the file as i go, just without using reduce
03:34amalloyyou're using linear space anyway
03:34amalloyif you're building a result map, it has N entries in it
03:36amalloyif you're worried about the space requirements of creating the seq of transactions, you can do that lazily too
03:36mindbender1Why 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 ?
03:37amalloy(reduce process-transaction init-state (take-while identity (repeatedly read-single-transaction)))
03:37michaelr`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
03:38michaelr`do you also have that problem?
03:43michaelr525thorwil: how do you c-p, c-n?
03:44thorwilmichaelr525: those are bound to which commands?
03:44michaelr525goto previous, next line
03:45michaelr525C-p, C-n
03:45thorwiloh. i'm guilty of using cursor keys along with pos1 and end ^_^
03:45michaelr525shhh
03:45michaelr525someone could hear you
03:46michaelr525what's pos1?
03:46michaelr525home?
03:46thorwilyes, german keyboard here and i forget it's called different
04:01Blktgood morning everyone
04:02michaelr525hello blkt
04:16Apage43j3
04:28lobotomyamalloy, hmm, you're right about the simple case, that it's basically just reduce. could be done simplerly
04:28lobotomywhat about the less trivial case with nested structure etc?
04:34lobotomythe 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
04:34lobotomyhaven't tried that with reduce, but my gut says trampoline should be more understandable for it than reduce?
05:15pyrthe clojure wiki takes forever to load from here
05:15pyrso i'm just gonna ask here: where is expt now that clojure.contrib.math is gone ?
05:19pyrmath.numeric-tower it seems
05:42konrIs there a special expression for all whitespace I can use in a regex?
05:44archaic\s*
05:44archaici guess?
05:45konrthanks!
05:46konrwith a plus, I think
05:46konr,(clojure.contrib.string/split #"\s+" "ok OK")
05:46clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.contrib.string>
05:46konr:(
05:52archaic\s+ means match 1+, \s* means match 0+
05:53archaic,(clojure.string/split "ok OK" #"\s+")
05:53clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string>
05:54archaic,(split "ok OK" #"\s+")
05:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: split in this context, compiling:(NO_SOURCE_PATH:0)>
05:55archaic,(require 'clojure.string)
05:55clojurebotnil
05:55archaic,(clojure.string/split "ok OK" #"\s+")
05:55clojurebot["ok" "OK"]
06:04kzarI 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
06:06kzar(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.)
06:12broquaintDoesn't enlive also provide fetching/parsing functions?
06:13kzarbroquaint: 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
06:17clgvkzar: enlive says it's a templating library so I guess you are missusing it
06:18kzarclgv: 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
06:20clgvkzar: well, you use a profiler to find out where all the memory is allocated and leaked
06:20clgv+can
06:20clgvmaybe you are just holding on to bindings that you actually dont need anymore
06:22kzarclgv: I've not used a profiler before for Clojure or Java (never done any Java really), is there one that's simple to use?
06:23clgvkzar: you can start with JVisualVM as it ships with the JDK
06:23clgvthere is also Yourkit Java Profiler that has 30-day trial version
06:50kzarclgv: So I've got VisualVM running, the heap space used seems to be slowly creeping up even before I run the scrape, that normal?
06:51clgvkzar: I dont know any details of your program ;)
06:52kzarclgv: 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
06:52clgvkzar: I guess starting the servlets needs some memory as well
07:06archaic 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?
07:18morphlingarchaic: do you know that ";" starts a line comment, like "//" in c++,java,..?
07:21archaicyeah, 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
07:26dnolenarchaic: comment is a simple macro, you'll have to be ok with ;
07:33kzardnolen: 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
07:33dnolenkzar: people have used it for scraping in the past and seemed happy w/ it.
07:39kzardnolen: OK thanks
07:49kzarDid clojure.contrib.profile move somewhere in 1.3?
07:50clgvkzar: you might use the old one. there is a chance it might still work
07:50kzarclgv: I get this error "Can't dynamically bind non-dynamic var: clojure.contrib.profile/*profile-data*"
07:50dnolenkzar: doesn't look like it was moved over, tho I gotta say, it's not very useful.
07:51clgvkzar: you might fix that ^{:dynamic true} on the 'def if you dare to ;)
07:51kzarWell 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
07:52clgvs/that/that with/
07:52dnolenkzar: "killing" what does that mean?
07:53kzardnolen: 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
07:53clgvkzar: go to the Sampler or Profiler tab and hit the "Memory" button for investigation ;)
07:56kzarclgv: 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
08:00dnolenkzar: 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.
08:00dnolenjava.lang.Object[] sounds like a persistent data structure growing too large.
08:01clgvkzar: oh right, JVisualVM does not have information on which methods allocated that memory
08:01clgvYourkit does
08:12iris1FTR according to http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go, "clojure.contrib.duck-streams mostly migrated to clojure.java.io"
08:33kzarclgv: Thanks I've grabbed that
08:38kzardnolen, 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
08:38kzarhread/thread/5a4b2bd7ae291cab . Thanks for the help
08:50cemerickwho here has actually used ^:const
08:53clgvcemerick: to get it relative - who here has actually used clojure 1.3 ;)
08:56michaelr525cemerick: what is ^:const good for?
09:01llasramHuh. 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?
09:05cemerickllasram: yeah, the changelog example isn't so great, IMO.
09:07llasramIs the actual effect that references to the var are derefed at compile time, and the value returned at compile time is include inline?
09:07cemerickllasram, michaelr525: yes: https://gist.github.com/1312660
09:09llasramCool. But obviously enough, haven't used it :-)
09:36simardhum is there a way to spit a record to a file and read it back ?
09:37simardie, is there a reader synthax for record objects ?
09:37cemerickyes
09:38cemerickjust use pr or pr-str on a record
09:42simardcemerick: when I read it back, it says "java.lang.Exception: No dispatch macro for: :"
09:44clgvsimard: clojure 1.3?
09:44simardI did a (duck/spit f (pr-str my-record)), then (read-string (slurp f))
09:44simardhum no
09:44simard1.2
09:44clgvthats the problem then ;)
09:44simard:)
09:44simardok
09:45cemericksimard: right, sorry, 1.3-only.
09:45raeksimard: also, use clojure.core/spit and the functions in clojure.java.io instead of duck streams
09:45clgvyou might convert it to a map and write that map. but you'll have to remember on reading that it was your defreecord
09:47simardshould I get my clojure-1.3 jar from clojars or directly from clojure.org ?
09:48raeksimard: unless you need to manage the classpath manually, it's probably easier to use one of the de facto build tools (Leiningen or Cake)
09:49simardI'm using lein
09:49raekjust replace [org.clojure/clojure "1.2.1"] with [org.clojure/clojure "1.3.0"] in your project.clj and run lein deps
09:49simardso I'm actually using the project.cl
09:49cemerick(and hope your other libraries are 1.3-compatible :-)
09:50simardI don't rely on that many libs atm, thankfully
10:05simardis 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:05simardie, I'd like the ctor to recognize that b is of type A
10:06simardthe goal is to define a record like a Translation, which can combine itself to another Translation
10:06simardinstead of cascading translations uselessly
10:08clgvsimard: probably you shouldnt do that with defrecords in clojure
10:09simardclgv: probably :)
10:09simardperhaps designing a Simplify protocol would be best
10:09mdeboardAre tehre any other general development talks by Rich Hickey in the vein of Simple Made Easy?
10:09simardthat could walk a tree of such objects and combine them
10:10fdaoudrest in peace, John McCarthy
10:10mdeboardi.e. not Clojure specific
10:13clgvmdeboard: does he talk of non-clojure topics?
10:13kzartry-clojure.org is giving me a "504 Gateway Time-out" Nginx error
10:13mdeboardclgv: Simple Made Easy is brilliant
10:13mdeboardclgv: I've watched it like 4 times
10:13clgvgotta look that up
10:13mdeboardclgv: InfoQ.com
10:13clgvthx
10:13mdeboardsrsly changed how I work
10:14mdeboardWatched it 4 times since Thursday
10:14fdaoudmdeboard: what is it about?
10:14mdeboardfdaoud: "Easy" vs. "Simple"
10:14cemerickI just realized that the migration of thread-local bindings across agent sends, futures, etc. isn't in the 1.3 changelog.
10:15fdaoudmdeboard: as it applies to programming in general/
10:15fdaoud?
10:15jcromartieEasy vs Simple has been going through my mind all week
10:16jcromartiereally brilliant stuff... makes me think about what *really* is simple
10:17fdaoudok enough hype and paste the link already :)
10:17mdeboardfdaoud: Yes
10:17mdeboardhttp://www.infoq.com/presentations/Simple-Made-Easy
10:17fdaoudthank you, looking forward to it
10:18mdeboardjcromartie: I finished watching it at like 2am Thursday evening, immediately got up and refactored some stuff I've been working on
10:18cemericknm, I was looking at the version of the changelog on the wiki
10:18jcromartiefdaoud: and pay attention!
10:18jcromartiefdaoud: watch it at lunch or something, when you have time
10:18mdeboardYeah
10:19fdaoudok, will do
10:19mdeboardTurned me into a proper fanboy :_\
10:19fdaoudhow long is it?
10:19mdeboardan hour
10:19fdaoudwow
10:19fdaoudmight have to be a 2-part series
10:19mdeboardit's awesome though, worth the time
10:19fdaoudis there a way to download it or is it stream only?
10:20mdeboardif you're an infoq member you can download mp3 I think
10:21jcromartiethe slides are good though
10:21jcromartieI think
10:22jcromartiethis 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:23jcromartieI've been working on trying to come up with a GUI for a "programmable" application
10:23jcromartiebut I'm wondering if I should just ditch that idea
10:23jcromartieand have power users write code
10:23jcromartieuse a DSL to express the things that the GUI would otherwise be used to (clumsily) configure
10:24jcromartiethen the actual GUI for users can focus on operation (getting the work done)
10:24jcromartiecan I ask my users (internal staff) to write Clojure code? :P
10:24simardjcromartie: what do you use for developping GUI with clojure ?
10:24jcromartiesimard: web apps... JS interface over HTTP APIs
10:24jcromartieCompojure back-end
10:33jcromartieI think a good API should make it easy enough for trained power users to write business rule code
10:33simardjcromartie: power users are rare, unless you make your DSL easy enough.
10:34simardI guess it all depends on who your users are anyway.
10:35TimMcDon't underestimate the effectiveness of forums in hacking together working configs.
10:36TimMcjcromartie: Have your users edit a project.clj-like file.
10:36simardthat's true, but having to lookup forums everytime you want to do something might be considered as a problem with your software..
10:45fdaoudmdeboard: thanks, I logged in and downloaded the mp3
10:47carkwhere is the 1.3 version of c.c.str-utils ?
10:48kzarWith 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:51zerokarmaleftkzar: https://github.com/technomancy/leiningen/blob/stable/doc/PLUGINS.md
10:51jcromartiesimard: 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:52jcromartiemaybe 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:54zerokarmaleftkzar: https://github.com/technomancy/lein-tar/blob/master/src/leiningen/tar.clj is a pretty simple example
11:01TimMclet them eat parens
11:01kzarzerokarmaleft: Ah thanks
11:02simardjcromartie: 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:02brett_hwhere 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:03jcromartiesimard: if you can get away with requiring up-to-date Google Chrome, you could use WebGL for the UI
11:03jcromartiethat would be fun :)
11:03simardWebGL = JS only :S
11:03jcromartieJS for the rendering, yes
11:03simardbut again it could be a really thin client GUI
11:03jcromartieit could
11:04jcromartieClojure can do OpenGL just fine
11:04simardyes
11:04simardI'm doing it right now
11:04jcromartieso, what's going on at the server?
11:04jcromartieis it layout or what
11:04TimMcbrett_h: They might have moved to a REPL namespace.
11:05simardwell, I said right now I'm doing OpenGL with clojure, but this might change to WebGL
11:05simardon the server, everything else would be going on, from the undos to the Gerber output
11:05jcromartieah Gerber, OK
11:05TimMc,`doc ; brett_h
11:05clojurebotclojure.repl/doc
11:05brett_hTimMc: I'm very new at this, is there anything I can use to find where they may be interactively?
11:05brett_hAh
11:06brett_hHow would I have found that anyway? That's what I need to figure out :)
11:06andrewcleggnumerics 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:06simardbut 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:06andrewcleggi.e. to avoid "More than one matching method found"
11:06jcromartiesimard: (I'm only really really vaguely familiar with PCB stuff... I interned at a WAN equipment manufacturer)
11:06TimMcbrett_h: There's a "changes in 1.3" page somewhere.
11:06raekandrewclegg: I think you are supposed to use the 'int' and 'long' functions in that case
11:07raekthose functions will return primitives
11:08simardjcromartie: there's not much to know about PCBs anyway.. as far as the basics are concerned
11:08jcromartie:P
11:08andrewcleggraek: 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:09andrewcleggmaybe it's the enum parameter, not the numeric...
11:09TimMcbrett_h: https://github.com/clojure/clojure/blob/master/changes.md
11:09brett_hTimMc: thanks so much
11:09simardsay 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:09TimMcbrett_h: I don't know where javadoc is.
11:09TimMc,`javadoc isn't helpful
11:09clojurebotsandbox/javadoc
11:09simardjcromartie: I could program my own TCP transaction, but I would rather not do that again
11:11jcromartieum, no
11:11jcromartiesimard: what kind of latency do you really need?
11:11jcromartieand are you sure HTTP is too slow?
11:11simardjcromartie: in terms of miliseconds ? no idea, I'd have to try it
11:12jcromartieI mean you don't want every tick of a drag-and-drop interaction going over HTTP
11:12carksimard: if you're using webgl, you're either going to do http polling, http long polling or websockets
11:12jcromartieand if you're going WebGL you might as well use web sockets
11:12jcromartiesince you're on the bleeding edge anyway
11:12carktrouble with websockets is bnrowser adoption
11:12simardjcromartie: it all depends how I manage to encode data for opengl to display
11:12simardpossibly some kind of incremental update
11:13simardor what not
11:13luciancark: as jcromartie said, webgl has shit adoption anyway. if you have webgl, you'll have websockets
11:13carktrue
11:13carkthen websocket is the best option
11:13simardso all that remains now is to have firefox, IE and chromium all support WebGL properly
11:14jcromartieyou can require Chrome for now
11:14lucianfirefox is pretty good too
11:14lucianjust forget about ie and you're good
11:14jcromartieChrome is like the other end of the spectrum from IE6
11:14andrewcleggif anyone can tell me how to create one of these in Clojure, I'll be pathetically grateful :-) http://bit.ly/tj0bb3
11:14jcromartieit's too good
11:14clgv&(resolve 'javadoc)
11:14lazybotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
11:14lucianandrewclegg: wow
11:15andrewcleggI just get this: (Amount/of (long 500) Time/MILLISECONDS)
11:15andrewclegg#<CompilerException java.lang.IllegalArgumentException: More than one matching method found: of, compiling:(NO_SOURCE_PATH:1)>
11:15lucianandrewclegg: you can probably do it with getclass, right?
11:15clgvandrewclegg: use typehints to tell the compiler what to use.
11:15lucianuh, genclass
11:17TimMclucian: That's for class generation, not instantiation.
11:18lucianTimMc: ah, silly me
11:18andrewcleggwoo, type hints did it
11:18TimMcandrewclegg: What finally worked?
11:18andrewclegg(def ^Integer timeout 500)
11:18andrewclegg(Amount/of timeout (Time/valueOf "MILLISECONDS"))
11:18andrewclegg#< (500, ms)>
11:19andrewcleggno idea why it doesn't work with (int 500)
11:19TimMcandrewclegg: Does Time/MILLISECONDS not work?
11:19Apage43wouldn't that type-hint it as the boxed type though?
11:19andrewcleggTimMc: yeah, sorry, that too
11:19Apage43(rather, isn't that (Amount/of (Integer. 500) (Time/valueOf "MILLISECONDS")) ?
11:19andrewclegg(Amount/of timeout Time/MILLISECONDS)
11:19andrewclegg#< (500, ms)>
11:20andrewcleggApage43: actually, yeah, that works too without the hint
11:20andrewclegg(Amount/of (Integer. 500) Time/MILLISECONDS)
11:20andrewclegg#< (500, ms)>
11:20Apage43can prolly use Long. and Double. as well
11:20andrewcleggI wonder if there's a way to make it work without a box/unbox pair
11:21andrewcleggcos you can't hint a primitive, right?
11:21Apage43you can.
11:21TimMcYou can.
11:21Apage43(def ^int timeout 500)
11:21andrewcleggthat gives me this error:
11:21andrewcleggjava.lang.IllegalArgumentException: Unable to resolve classname: clojure.core$int@175ace6
11:22andrewcleggwhen calling Amount/of
11:22simardnow, 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:22raekandrewclegg: is this in clojure 1.2 or 1.3?
11:22andrewclegg1.3.0
11:23andrewclegg(print timeout) works
11:23andrewcleggbut not (Amount/of timeout Time/MILLISECONDS) -- that get the exception I just posted
11:24andrewcleggnot a blocker as I can make it an Integer instead -- but curious behaviour
11:27Apage43andrewclegg: 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:29TimMcIs ^int actually appropriate?
11:29Apage43well not if you're hinting a fn arg
11:29Apage43^int hints aren't supported for fn args
11:29Apage43only long and double
11:30TimMcmm
11:30andrewcleggok, 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:30Apage43((fn [^long timeout] (Amount/of timeout Time/MILLISECONDS)) timeout)
11:31andrewcleggwill try, hang on
11:31andrewcleggnah, then I get "More than one matching method found" for Amount/of
11:33Apage43huh.
11:34andrewcleggI can do this: (Amount/of (Integer. 500) Time/MILLISECONDS)
11:34andrewcleggbut then wehn I actually run my code, I get this: ClassCastException: java.lang.Integer cannot be cast to java.lang.Lon
11:35andrewcleggg
11:35andrewcleggfrom the depths of the library I'm passing this to
11:35andrewcleggthis is entirely made of wtf
11:35andrewcleggbecause I CAN'T do this: (Amount/of (Long. 500) Time/MILLISECONDS)
11:36andrewcleggMore than one matching method found etc.
11:43dnolenandrewclegg: have tried running your code in master, there were some fixes recently.
11:44kzarIf I define a multimethod with defmethod can I then pass the multimethod around just the same as a regular function?
11:44dnolens/in/against
11:44dnolenkzar: multimethods are regular fns, yes.
11:45andrewcleggdnolen: 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:45andrewclegg?
11:45bprwhen I do (javadoc FooClass) the browser tries to load the url: %u
11:46bprdoes anyone know what to poke to fix that?
11:46dnolenandrewclegg: I think 1.4.0-SNAPSHOT should work
11:46bpri'm using emacs/clojure-swank
11:47bprswank-clojure v. 1.4.0-SNAPSHOT to be specific
11:47andrewcleggdnolen: doesn't seem to, unless it's in a different repo
11:48bprthe fix seems straight forward, I'm just wondering if I should start looking in swank or in clojure.java.javadoc
11:48andrewcleggI'm gonna have to go back to this another time I think
11:48dnolen"1.4.0-master-SNAPSHOT"
11:48wwmorganhow 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:48andrewcleggnope :-(
11:49dnolenwwmorgan: duckstreams is deprecated. might want to take a look at clojure.java.io.
11:50kzarSo 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:50kzarFor example if I do (def row-limit 200) to set some arbritary limit
11:51Apage43kzar: 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:52dnolenkzar: if you're not using (binding [...] ...) drop the earmuffs.
11:52kzarOK thanks
11:53Apage43incidentally, 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:57dnolenApage43: I prefer, https://github.com/rnewman/clj-apache-http
11:57wastreli'm buying "the joy of clojure"
11:58fdaoudwastrel: have you read any other clojure books?
11:58wastrelno i sure haven't!
11:58wastreldo you have an advice?
12:01fdaoudwastrel: 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:02jodaroApage43: here is another http lib: https://github.com/neotyk/http.async.client
12:03wastrelglad to hear you're endorsing my decision :]
12:03Apage43mostly i need it to not explode if it gets 4XX status and actually still let me at the response body/headers/whatnot
12:03wastrelI don't have a good background in computer science, so I didn't want just a syntax book
12:04fdaoudwastrel: are you just starting out with clojure/lisp?
12:06wastrelYou could say that. I've gwritten some small scripts and done a few chapters of SICP
12:06simardis there a way to use partial on ctors of records ? ie.. (defrecord Rotate [angle object]), (map (partial Rotate. 90) objects)
12:06wwmorgandownloading 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:10Apage43simard: no, not really. It'd have to do really ugly reflection
12:10simardhuuummm...
12:11Apage43you'd want to (map (partial #(Rotate. %1 %2) .... oslt
12:13jkkramerApage43: you can set a :throw-exceptions option to false with clj-http
12:14cemerickwwmorgan: worksforme. Try downloading from a different site; something screwy going on with user-agent headers?
12:14licensergreetings :)
12:15wwmorganthanks cemerick. I'll check it out
12:17Apage43jkkramer: oh rocksauce, thanks
12:18jkkramersimard: if you're using 1.3, there's a ->Rotate constructor fn you can use to do that
12:39jcromartiehm
12:39jcromartieI have a big hash map
12:39jcromartie32K objects
12:39jcromartieassoc'ing something takes a long time (.100 ms)
12:39jcromartieer
12:39jcromartiewait
12:39jcromartiethat's .100
12:39jcromartienot 100
12:39jcromartieDERP
12:39mdeboardlol
12:40jcromartieAWESOME :)
12:40cemerickit's nice when that happens
12:40mdeboardI 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:41mdeboardWell, I didn't cite him, but I used his words.
12:41jodarodid they buy it?
12:43mdeboardyeah
12:43mdeboardI wouldn't have mentioned it if it had failed miserably :P
12:44mdeboardbasically 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:45chewbrancacemerick: 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:45cemerickchewbranca: ah, so you're using the latest snapshot?
12:46chewbrancacemerick: using 0.2.5 right now, going through emails and just came across your 0.3.0 refactoring post
12:47cemerickchewbranca: 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:47technomancysimard: did I hear that you are looking for a JVM hosted in the cloud? =)
12:48chewbrancacemerick: I'll check out 0.3.0 sometime this week and let if you if I run into any issues
12:48chewbrancacemerick: ok sounds good, changes look pretty solid to me so far
12:48chewbrancacemerick: checking out the changelog on github
12:48bhenrywhere do i start troubleshooting if sfteepee sends a blank file to the server with (put "filename.txt")
12:48cemerickchewbranca: You will, but they *should* be minor. All necessary to support some better abstractions I have in the pipeline.
12:48chewbrancacemerick: very nice
12:49cemerickbhenry: OT, but: sfteepee? :-D
12:49bhenrycemerick: https://github.com/ccollins/sfteepee/blob/master/src/sfteepee.clj
12:50cemerickhah
12:50cemerickjsch is pretty evil, tho
12:51Apage43heh, i've used JSch with clojure before
12:51Apage43wrote some remote monitoring tools
12:52cemerickJSch's implementation is *insane*, and semi-unmaintained IIRC
12:52cemericksshj seems to be the latest/greatest
12:52cemerickhugod: that's what jclouds is using these days, right?
12:53hugodcemerick: it is
12:53cemerickIs there a clojure wrapper for it yet, or is it clean enough to not warrant one?
12:54hugodI'm near to having a version of clj-ssh with plugabble backends
12:55hugodso far I have mina and jsch - not hooked up sshj yet…
12:55bhenryhugod: 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:57hugodbhenry: pallet uses clj-ssh. The new version I'm working on has a much simplified api…
12:59bhenrycool. if i can't get something working by the time you release i'll check it out
13:09Apage43yeah
13:27seancorfieldas 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:28cemericksounds fun
13:38theignoratiwhere's clojure.contrib.seq in the modular contrib?
13:40kijtry-clojure.org is down ?
13:41technomancytheignorati: depends on the particular function you're looking for iirc
13:41theignoratiindexed
13:42technomancyyou have to use map-indexed
13:42cemericksee map-indexed
13:42technomancyindexed was deemed too slow to be promoted
13:43technomancyif only I had learned the word "complect" when that discussion was going down. =)
13:43ibdknoxlol
13:43amalloytechnomancy: not just slow, but inflexible, right?
13:43technomancyamalloy: ISTR the objection was that it consed too much
13:44technomancybare indexed is simpler than map-indexed since you can map over an indexed seq and just destructure in the fn
13:44amalloytechnomancy: yeah it will cons an awful lot for an infinite sequence :P
13:44amalloysince it actually created a vector, not a lazy seq
13:45technomancy"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:46technomancyshame that's too big for a tweet.
13:46hiredmantechnomancy: 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:46technomancyamalloy: pretty sure indexed created a lazy seq of vectors
13:46pandeirois it possible to reference the first element of a js array with clojurescript?
13:47technomancy(map vector (iterate inc 0) s) ; yup
13:47ibdknoxpandeiro, (aget some-array 1)
13:48technomancyhiredman: sure; the implementation is simpler. I'm just talking about concepts exposed to the user.
13:48Chousukeibdknox: shouldn't that be 0 :P
13:48ibdknoxChousuke, lol. yes.
13:48pandeiroibdknox: Chousuke: thanks, brainfart
13:49pandeiro(refering to mine not yours ibdknox :)
13:49amalloytechnomancy: you're right. it was deprecated before i ever started using it, and i guess i misread or misremembered the source
13:51technomancyno dune fans in here?
13:51technomancyphilistines.
13:51pjstadigtechnomancy: i got the reference
13:51pjstadigand quite enjoyed it
13:52ibdknoxtechnomancy, I'm also sad that doesn't fit in a tweet :p
13:52technomancyI just finished it last night. interesting insights into tribalism and hero worship.
13:56pjstadigyou'll probably still call me a philistine, since my only exposure to Dune was the William Hurt, SciFi channel mini-series
13:57pjstadigwhich i thought was actually pretty good, having no experience with the literature
13:58technomancyISTR they did as good a job as you could expect trying to fit 500 pages into 2 hours.
13:58pjstadigi did see the 1984 Dune movie, too, which seemed like a disaster in comparison
13:58fdaoudtechnomancy: I misread tribalism for a sec there and was wondering..!! ;)
13:58ibdknoxI really enjoyed the book
13:59fdaouddon't mistake that L for a D
13:59ibdknoxmuch more so than any of its film adaptations
13:59pjstadigthe miniseries was actually like 4.5 hours, but yes still not enough time
14:01technomancyah, right
14:06TimMctechnomancy: There was just some Dune discussion in here yesterday.
14:07technomancyand I missed it? phooey.
14:07TimMc|flakynet~logs
14:07clojurebotlogs is http://clojure-log.n01se.net/
14:07TimMc|flakynet:-P
14:11TimMc|flakynettechnomancy: My fiancÃée is rereading âDune to. I had forgotten just how much forward plot information the reader is given!
14:12TimMc|flakynet(And WTF happened to my terminal's char encoding?)
14:12technomancyhah; I was wondering about that
14:12TimMc|flakynet s/Dune to\./Dune to me./
14:14cemerick"drinkup" seems to be a thoroughly modern term.
14:15technomancyI think github coined it
14:15bhenryif i use (defn- …) is the information inside available from the uberjar?
14:15cemerickah-ha
14:15cemericktechnomancy: Are salesforce people going to be going along as well?
14:15technomancycemerick: no, just 4 of us from heroku
14:25mefestoI 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:27fliebel_mefesto: AFAIK, it is just to loosen the connection.
14:27fliebel_No examples though.
14:28mefestoheh
14:31jcromartiemefesto: he meant queues as in a decoupled place to put things that other components can check
14:32mefestofor anyone interested he mentions queues around ~55min mark
14:32pdkwhere can you find this
14:33pdkclojure site?
14:33jcromartiepdk: infoq
14:33mefestohttp://www.infoq.com/presentations/Simple-Made-Easy
14:33jcromartiefliebel_: why is seque traumatizing?
14:34fliebel_jcromartie: http://dev.clojure.org/jira/browse/CLJ-776
14:35jcromartieah ha
14:35jcromartieI just saw that bug today :)
14:35jcromartiebecause my friend was implementing a blocking async queue in C#
14:35fliebel_seque is thinking of a yellow lego brick.
14:35mefestojcromartie: 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:35jcromartiehe had locks and wait/pulse all over the place
14:36Cozeyhello. 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:36jcromartiemefesto: so say your system wants to send emails on certain events
14:36theignoratiis there a simple way to return all elements that two vectors have in common?
14:37jcromartieinstead of directly calling an email-sending function, you would place your message on a queue of messages to send
14:37jcromartieand then an email sending agent could pick it up
14:37jcromartiealthough really, agents help decouple that already
14:37mefestojcromartie: ahhh i see
14:37jcromartiebecause once you send it off you don't really care and you can continue on your way
14:37jcromartiebut anyway, yeah
14:38jcromartiethink of units of work
14:38jcromartieanyway a queue is just a really simple interface
14:38jcromartieand that's the real win
14:38fliebel_jcromartie: did that friend run into seque bugs? Or was he just doing complicated queue stuff?
14:39jcromartiefliebel_: he was using C#
14:39mefestojcromartie: thanks that cleared it up for me. :)
14:39jcromartiefliebel_: so I got curious and was looking into the Clojure answer
14:39fliebel_ah, right. So how did you end up at my bug report?
14:39jcromartiethe second Google result for "clojure seque" is your bug report
14:40jcromartie(that's some bad PR)
14:48fdaoudjcromartie: 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:24devnI wouldn't say that he rips XP/TDD
15:26devnIt feels like ripping because people have gotten so comfortable recently with that being the only path to the promised land IMO
15:27mindbender1Clojurians, I hail!
15:27mindbender1:)
15:28fdaouddevn: you're right. let's just calling it poking fun.
15:28mindbender1Who knows the key to clojure mastery?
15:30hiredmanthe key to mastery for most things is: do it over and over again and don't be an idiot
15:30babilenIs there anything that would allow me to implement subcommands for a CLI tool easily? Is tools.cli the best there is?
15:31mindbender1hiredman: agreed. But what the best advice on how not to be an idiot?
15:32hiredmanthe 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:33hiredmanwell, jump on you or ignore you
15:35di-csuehsDid clojure.contrib.io get refactored to other jars?
15:36RaynesThe evolution of c.c.io is clojure.java.io. It is in Clojure itself.
15:36mindbender1hiredman: I believe you are trying to make a point. Please I'm intersted
15:37di-csuehsah!
15:37di-csuehsI shall stop attempting to recur on my own tail
15:37hiredmanhuh?
15:38hiredmanthat was it, I'm done
15:38TimMc|flakynetmindbender1: If you have a question, ask it.
15:39mindbender1ok
15:40fdaoudmindbender1 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:40fdaoudwhich is really, really nice.
15:40fdaoudif 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:42hiredmanif 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:42hiredmanif you
15:43hiredmanread docstrings for the functions you use, for the love of god
15:43mindbender1I've never done programming before!!
15:43mindbender1Yet I want to live as a programmer
15:43hiredmanthen just go watch http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/
15:44hiredmannot the be all to end all, but as good a starting point as any
15:44mindbender1ok
15:50mindbender1hiredman: more resources will always be appreciated here.. just in case
15:52simardNo implementation of method: :simplify of protocol: #'cpcb.pcb/Simplify found for class: clojure.lang.LazySeq
15:52simardhum.
15:53simardright, so, what's the easiest way out, define simplify for LazySeq ?
15:53simardcan it be done ?
15:56simard(extend-type clojure.lang.LazySeq Simplify (simplify [this] (doall this)))
15:56simardI did this, it seems to work, but could this lead to trouble ?
15:59sridclosure'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:02ziltiI'm getting "java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer" with seesaw, how can I fix this?
16:02babilenI 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:03RaynesStep 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:03ibdknoxbabilen, you can make a jar executable
16:03amalloy~bug report
16:03clojurebotA 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:04Raynesbabilen: If you want it to run fast, you can use something with a persistent JVM. cake and jark both do that.
16:04ibdknoxbabilen, http://skife.org/java/unix/2011/06/20/really_executable_jars.html
16:04RaynesIf ClojureScript isn'
16:05Raynest prohibitive, you can target nodejs with it and get a script with speedy startup.
16:05RaynesAlso, the apostrophe is placed strategically next to the enter key so as to ruin my life.
16:07ziltiRaynes: 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:07ziltiRaynes: At me it's the $-Key
16:08zilti^^
16:08ziltiAlready sent many lines ending with $
16:08Rayneszilti: Could you paste the stacktrace you're getting to gist.github.com?
16:08RaynesThat'd be helpful.
16:10ziltiOh. Yes of course
16:11ziltiIt's on there
16:17fdaoudjcromartie: are you there?
16:17jcromartiefdaoud: yes
16:18jcromartieat your service
16:18fdaoudjcromartie: thanks :) so I had two questions following The Talk, one of which you already answered (queues)
16:18fdaoudthe second one is about removing conditionals and control flow from the code and using rules and declarative logic systems instead
16:19Rayneszilti: 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:19fdaoudI can't picture how that would work
16:20fdaoudThe Talk was totally awesome as you promised, btw, so thanks for pointing me to it
16:21ziltiRaynes: Ok, thank you. It seems like removing the :mnemoric "fixes" it, so the problem's in there.
16:21jcromartiefdaoud: honestly I'm not sure about that part. declarative logic is something I've been meaning to learn
16:21jcromartiefdaoud: 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:21jcromartiebut I don't know if it's what Rich was talking about
16:22jcromartiebut to expand on my system
16:23jcromartiethe "organization" is where I draw boundaries around data in our system
16:23jcromartieand when something proposes a change to the system, the organization's set of rules is consulted
16:23jcromartieand the rules are fairly declarative
16:24brandelcould 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:24jcromartieand so the rule set can reject the change or not
16:24jcromartiethat's the core of it, I think
16:24jcromartiebut someone please chime in if you know what Rich meant by rules
16:25aaelonyhi, what is a good way to turn [:a :b ["blah" "old" "new"]] into [:a :b "blah" "old" "new"] ?
16:25jcromartieaaelony: flatten
16:25aaelonythx! cool...
16:25jcromartie##(flatten [:a :b [:c :d]])
16:25lazybot⇒ (:a :b :c :d)
16:25jcromartiewell it's not a vector, but you can take it from there
16:25aaelonymerci
16:25amalloydepends on what you want [:a :b [:c [1 2]]] to return, i guess
16:26brandeljcromartie: are you working on a general purpose rules engine like Drools, or something domain specific?
16:26jcromartiebrandel: domain specific
16:26aaelonyI want a vector actually, is there a better way?
16:26jcromartiethere's a very specific sort of change we're concerned with
16:26jcromartieaaelony: (vec (flatten ...))
16:26brandelI've been trying to weigh up the advantages of adopting something like Drools vs rolling our own
16:27jcromartiebrandel: I just don't know what a "rules engine" really offers
16:27jcromartielike, what's so hard about it? what are the real implications?
16:27aaelonyjcromartie: thanks, that is what I am thinking of... but amalloy tries hard not to recommend flatten...
16:27brandelin 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:27brandela rules engine allows the domain expert to maintain the logic
16:28brandelgranted, Drools isn't exactly user friendly
16:28amalloyaaelony: you usually don't need flatten; it's easier to instead construct your list with the right shape to begin with
16:28amalloyand flatten will destroy any amount of nesting you do, even levels you might "want" to keep
16:29jcromartiebrandel: I've found that "if condition, then action" is the basic definition of a rule
16:29amalloyit 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:29aaelonyamalloy: makes sense. I'm just mining a data structure that cheshire json preferred.
16:29brandeljcromartie: essentially yeah
16:29fdaoudjcromartie: interesting. my guess is that Rich means business rules, not simple if statements. right?
16:29jcromartiefdaoud: well that's what I'm wondering
16:29aaelonyamalloy: unfortunately, both (a) and (b) are true
16:29jcromartiewhat is a business rule
16:29fdaoudyeah
16:30fdaoudI dunno
16:30jcromartiein our case, if/then is pretty much sufficient
16:30brandelbusiness rules (or in our case medical guidelines) usually just end up as nightmarishly nested if statement
16:30fdaoudI do wish I had a nicer way of composing "actions" together into a chain
16:30fdaoudwith rules to determine the flow
16:31jcromartiebut the point is that you wrap the if/then up into a single unit
16:31jcromartieit can just be a function
16:31brandelone 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:31jcromartiebrandel: from what I've seen, Drool's "DSL" is just XML
16:31jcromartieisn't it?
16:32brandelit also has unit testing built in, which imo is critical for complex logic
16:32jcromartieor no
16:32fdaoudjcromartie: in your system, how are the rules represented/stored?
16:32jolyI'll second that Drools isn't exactly user-friendly.
16:32jcromartiefdaoud: right now I just have an API for defining rules in namespaces
16:33jcromartieas functions
16:33brandelno, it has it's own templating language I guess you could call it
16:33jcromartieI see
16:33jolyYeah, we don't use the XML interface. I'd like to use the DSL capabilities, but our domain model isn't exactly friendly
16:34brandeljoly: 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:34fdaoudinteresting
16:34jolybrandel: sounds about right
16:35jcromartieif someone can write this Drools DSL, they can use a nice Clojure API
16:35jcromartiebecause an API in Clojure rapidly approaches a DSL
16:35jcromartiewithout custom parsing
16:35jcromartiemacros go a looooooong way
16:35jcromartieand HOFs
16:36jolyI'm still trying to get Clojure integrated into our code :)
16:36brandeljoly: you just tell your boss that it's "Java", easy right? :)
16:36jcromartiebut 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:37jcromartieso the change map that comes out the other end has all of the rules effects, failure messages, informative messages, notifications (emails), etc.
16:37brandeljcromartie: is this something you're likely to opensource? I'd be interested in a blog post about your process at least! :)
16:37jcromartiesure
16:37jcromartieit's quite simple really
16:38fdaoudjcromartie: 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:39fdaoudthe validations are independent and can be combined into a chain for a given type of input
16:41jcromartieit's a lot nicer than imperative business logic that *does* things at each step
16:41jcromartief
16:42jcromartiefor instance, actually sending emails from DB stored procedures
16:42jcromartieor only being able to raise one error at at ime
16:42jcromartieat a time
16:45fdaoudright
16:45jcromartieI hope to add a testing/debugging/stepping interface, too, so that you can test the rules without committing changes
16:45fdaoudsay you're stuck with Java
16:45jcromartieat that point it's not just going to be a function
16:45jcromartiehah
16:45fdaoudand you have this big glob of code in a method
16:45fdaoudit does some work, then there's an if, some more work, other work in the else..
16:46fdaoudit's just plain ugly
16:46brandelmm, as soon as your rules become reasonably complex having tests against them is very reassuring
16:46fdaoudI wish there was a way to extract those "units" of work, and the if/else independently
16:46fdaoudchain the units of work together and have the rules decide which units to execute
16:47fdaoudhttp://commons.apache.org/chain/ is the closest I got to a possible solution
16:47brehautfdaoud: its call monads
16:47brehautor monadplus to be more pedantic
16:48jcromartiefdaoud: is there any kind of concrete example you can give of this complex glob?
16:49fdaoudbrehaut: I know 2 things about monads: 1) I heard about them through Haskell. 2) I don't understand them.
16:50brehautfdaoud: maybe its time to learn ;)
16:50fdaoudbrehaut: what is the Clojure equivalent?
16:50jcromartiesomeone said "let" is a monad
16:50brehautalgo.monads for 1.3
16:50fdaoudor Java even?
16:50brehautjcromartie: it is in the identity monad, for is also a monad in the seq monad
16:50jimdueylet is monad comprehension for the identity monad
16:50brehaut(using 'monad' extremely loosely)
16:51brehautand heres someone who can explain things more succinctly than i can ;)
16:51jimdueyhttp://www.infoq.com/presentations/Monads-Made-Easy
16:51jimduey:)
16:51brehauthaha
16:52brehautthat is a good link
16:52jcromartieso monads are single points that combine steps
16:52jcromartiein a well-defined way
16:52fdaoudok well there's the next presentation on my list
16:52brehautjcromartie: yeah, they have been called 'programable semicolons'
16:52fdaoudbut now it's time to go do something much more primitive. make fire. cook meat.
16:53brehautfdaoud: thats a curious way to write a functor
16:53fdaoudno new Bbq() here
16:54fdaoud(bbq meat)
16:54fdaoudmuch better :)
16:54brehautfdaoud that was a poor quality category theory joke
16:54fdaoudbrehaut: :)
16:54fdaoudgreat talking to y'all, to be continued..
16:54jcromartieso, rules can be thought of as monads
16:54jcromartiehm
16:55fdaoudI'll do my homework and watch that monad presentation
16:55jcromartieactually I've been creating monads all along
16:55brehautjcromartie: thats highly likely
16:55fdaoudbut gotta go for now. ciao
16:55brehautthey are common patterns that happen to have interesting types and shared characteristics
17:00ziltiI'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:03brehautzilti: if you are attempting to fuse ~x onto VK_ then i think you might be out of luck
17:03brehautyou probably want to look at the . (dot) special form
17:04ziltihmm
17:05ziltiYes, it was my intention to fuse it onto VK_
17:06dnolenjimduey: so w/ Friedman and Byrd making an appearance, I think we have a real KanrenConf ;)
17:07brehaut,(macroexpand '(Integer/parseInt 1)) ; zilti
17:07clojurebot(. Integer parseInt 1)
17:07dnolenjimduey: 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:07jimdueydnolen: Yeah, that's going to be awesome.
17:08jimdueythat would be great and open up more places where it could be used.
17:08dnolenjimduey: yes!
17:08jimdueythat BOF session you listed would be great.
17:09dnolenjimduey: it would also be sweet to hear them give a description on cKanren in their own words
17:09jimdueyI'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:10dnolenjimduey: that is interesting ...
17:12Raynestechnomancy: ping
17:13babilenibdknox, 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:13llasram`zilti: perhaps? (defmacro vk [x] (symbol (str "java.awt.event.KeyEvent/VK_" x)))
17:14ziltillasram`: I have (defmacro vk [x] `(Integer/parseInt (eval (str "(. KeyEvent VK_" ~x ")")))) by now but that gives me a numberformatexception
17:16jolyzilti: llasram's approach should work
17:16ziltijoly: Indeed it does
17:21ziltiBut why?
17:21ziltiAh I see.
17:22ziltiBut there's one more problem now. The result should get converted to Int using Integer/parseInt...
17:23jolyzilti: so you could do something like `(Integer/parseInt ~(symbol (str "KeyEvent/VK_" x))))
17:23llasram`no no
17:23llasram`The VK_ static members in KeyEvent *are* already ints
17:24ziltiObviously they aren't in Clojure
17:24ziltiClojure converts them to Long
17:25ziltiSo I have to cast them back into Int
17:25llasram`Are you sure? If you pass them to a Java method expecting an int, Clojure will cast them for you
17:26ziltillasram`: No, Clojure unfortunately doesn't cast them for me
17:26brehautzilti: if you just want to cast a long as an int, then (int n)
17:26llasram`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:28llasram`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:28ziltiOh. It seems like seesaw is internally converting it to long and then passes it to java. Stupid.
17:29llasram`Ah
17:29ziltiAt least that's the only possibility
17:30joly,(type java.awt.event.KeyEvent/VK_ENTER)
17:30clojurebotjava.lang.Long
17:31zilti,(type (int java.awt.event.KeyEvent/VK_ENTER))
17:31clojurebotjava.lang.Long
17:31zilti???
17:31lazybotzilti: How could that be wrong?
17:31llasram`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:31jolyClojure 1.3 is changing it to Long due to the numerics changes
17:32zilti,(type Integer/valueOf java.awt.event.KeyEvent/VK_ENTER)
17:32clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: valueOf in class java.lang.Integer, compiling:(NO_SOURCE_PATH:0)>
17:32joly,(type (Integer/valueOf java.awt.event.KeyEvent/VK_ENTER))
17:32clojurebotjava.lang.Integer
17:34robermannhello, 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:35dnolenzilti llasram` joly that behavior is changed in master at the moment. the conversion of primitive ints to Long no longer happens.
17:35technomancyRaynes: pong
17:35jolyinteresting
17:36Raynestechnomancy: 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:37llasram`dnolen: I saw that. Pretty minor change-code wise -- it'll be interesting to see how that plays out.
17:37ziltidnolen: I wonder why this has been done in the first place. It's just a memory eater.
17:37technomancyRaynes: I was planning on that since it needs to go into clojars too
17:38dnolenzilti: do you mean boxing in general?
17:38technomancyminus the downloading and printing part of course
17:39technomancyalthough apart from downloading and CLI output there's really not much to it.
17:39technomancyit's all in clucy
17:39RaynesWhy not keep the downloading part in the library? It's useful and general enough, I'd think.
17:40ziltidnolen: Well especially that Int-to-Long boxing
17:40ziltiDid you know that yesterday the inventor of Lisp died?
17:40RaynesIt'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:41technomancyI guess so.
17:42technomancythough 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:43technomancybut I guess if you just provide it with a base home dir in which to store the indices it's pretty generla
17:43technomancygeneral
17:43RaynesRight, that's what I did.
17:44Raynestechnomancy: Also, unrelated, but clojure-jack-in is awesome. Thank you for it.
17:44technomancythanks! I'm pleased with how it turned out.
17:44technomancyit'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:47ziltitechnomancy: 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:48technomancyzilti: probably the repl is in the wrong ns?
17:48ziltiOh. *facepalm*
17:50Raynestechnomancy: 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:51RaynesI've named it 'sherlock', by the way. Can change if you have a better name handy.
17:51technomancynot at all; I approve.
17:51technomancyalthough there's some precedent with the Mac System 9 file search program.
17:52Raynesheh
17:52technomancyso it's best if you create the repo to draw off the Apple lawyers
17:52RaynesGotcha. ;)
17:53technomancywow, this is hilarious: http://en.wikipedia.org/wiki/File:Sherlock3.6.2.png
17:54technomancy"You can search a lot of different things on the Internet... all through one program."
17:55brehautits amazing that there was a time when that wasnt obviously the web browser
17:55ziltigood ol' times
17:56technomancyhmm... actually adding deps to leiningen really complicates packaging.
17:56technomancybecause that would mean that there'd have to be a .deb for sherlock
17:57RaynesOh how I despise software repositories.
17:57technomancyso 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:57technomancybut it will still be useful for clojars.
17:57RaynesOr suppositories, more liek.
17:57airolsonlol
17:58Raynestechnomancy: 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:59technomancycool. I don't think it's likely to change much given that the maven index format has been stable for aeons.
17:59RaynesRight.
17:59technomancythough there are a few weird things about the field structure it that I haven't been able to figure out
18:00technomancybut I think that has more to do with documenting how your form queries than actually changing the functions
18:00technomancyaccording to luke, the description field is indexed, I haven't been able to query against it
18:00technomancycould be using the wrong analyzers.
18:01technomancyso if you figure that out I would be interested in finding out what's going on there
18:05Raynestechnomancy: These have got to be the worst keywords I've ever seen. :u, :i, :n, :d… infuriating.
18:05technomancyyeah... I don't know if that's intended to reduce index size or what
18:05technomancyI'm pretty sure that's not how lucene works
18:06technomancyonce you see some examples of what's in them it's pretty clear what they're for, but it's weird.
18:06technomancyI found Luke to be a helpful tool, despite the awkward gui.
18:07RaynesThanks for the tip.
18:08RaynesI'm figuring out what these things mean so that I can make the parsing bit a little more general.
18:10Raynestechnomancy: Surely this is the prettiest UI you've ever worked with!
18:11technomancy...
18:11RaynesI especially like the cigarette-stain coloring.
18:20stuartsierrahi Stu
18:20stuarthallowayhi stuartsierra
18:29patchworkhey #clojure, what would cause my lein repl to fail? here is the stacktrace: https://gist.github.com/1314550
18:30patchworkIt must be one of my deps?
18:30patchworkhere they are: https://gist.github.com/1314554
18:31patchworkhere are my dev deps: https://gist.github.com/1314559
18:31patchworkI just type > lein repl and everything blows up
18:31gtrak`why is clojure-source 1.2?
18:32patchworkthere is something weird about lein where it uses 1.2 internally
18:32stuartsierraWHAT is clojure-source?
18:32abedra^
18:32patchworkeven though I am using 1.3
18:32patchworkit is something for swank-clojure to do stacktraces?
18:33patchworkI think
18:33patchworkI can try taking it out
18:33ibdknox_take it out
18:33technomancyit's for the cdt debugger IIRC
18:33patchworkso you are thinking this is in the dev deps?
18:34patchworktechnomancy: That is it
18:34patchworkI was messing with cdt
18:34patchworkHmm… same problem
18:34technomancycan you paste the whole project.clj?
18:36patchworkAha, just figured it out
18:36patchworkI had a :java-source-path in there that made it fail
18:36patchworkweird
18:36patchworkhas java source handling changed recently?
18:37technomancypatchwork: shouldn't have. what was the value?
18:37patchwork:java-source-path [["src/java"]
18:37patchwork ["test/java" :debug true]]
18:37patchworkI have some java code in there
18:37patchworkis there a better way to do that?
18:38patchworkpossibly putting java code somewhere besides /src and /test?
18:38patchworkanyhow, thanks for helping.
18:38Raynestechnomancy: 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:39RaynesIt's the only one I can't figure out.
18:39robermannpatchwork: 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:40patchworkwhat is the estimate on lein running 1.3?
18:40technomancypatchwork: many months unless someone wants to step up
18:41patchworktechnomancy: what is holding it back currently?
18:41patchworkI could be interested
18:41technomancypatchwork: well, the upgrade can't happen until version 2.0 because it would break a huge # of plugins
18:41technomancyso we need to finish 1.6.2 first
18:41patchworkI just upgraded my project to 1.3, it was not so bad
18:41technomancythen switch to using aether instead of maven-ant-tasks
18:42patchworkYeah, so it is plugins using contrib, not lein proper?
18:42technomancyyeah
18:42technomancybut if leiningen upgrades, it will break the plugins
18:42patchworkHmm… is no one working on these plugins anymore?
18:43technomancywell, it doesn't matter if they're maintained or not, it's not OK to go breaking plugins in a minor point release.
18:43patchworkI see
18:44patchworkis there a definitive list of lein plugins?
18:44technomancyif you are ok with using the master branch, the 1.3 upgrade could happen sooner
18:44technomancybut the full release is still going to be a ways away
18:44patchworkYeah I am fine with that
18:45patchworkyou have something on master?
18:46patchworkfor instance, I know I am not using any 1.2 plugins
18:46patchworkso that would not be a block
18:46sridcan this be simplified? -- (or (parse-foo x) (parse-bar x) (parse-baz x) ..... repeats about 15 times)
18:47amalloysrid: some
18:47patchworksrid: put all those functions in a list?
18:47amalloy(some #(% x) [parse-foo parse-bar....])
18:47sridhmm
18:49robermanncan I query which version a repl is using, inside the repl itself?
18:50ibdknox_,*clojure-version*
18:50clojurebot{:major 1, :minor 3, :incremental 0, :qualifier nil}
18:50ibdknox_robermann: ^
18:50robermannthanks
18:51robermann, (class (* 1000N 1000 1000 1000 1000 1000 1000 1000))
18:51clojurebotclojure.lang.BigInt
18:51robermannmmm
18:52robermanndoes not work in 1.2
18:52amalloy,(clojure-version) ;; this too
18:52clojurebot"1.3.0"
18:52robermannok
18:52amalloyrobermann: 1.2 doesn't have 1000N reader format
18:53robermannyes, just trying some examples from labrepl
18:54robermannits project.clj requires clojure 1.3 but it does not start the local http server
18:54robermannso I was reverting my local dependency to 1.2
18:55robermann(but of course some example does not work) - I guess I cloned the wrong branch
18:57seancorfieldin emacs clojure-mode, how do i always set paredit-mode when i visit a file?
18:58amalloyseancorfield: add a hook to clojure-mode-hook
18:58rafladding to clojure-mode-hook should do. or you can use something more sophisticated such as aspect.el
18:58amalloy(add-hook clojure-mode-hook (lambda () (paredit-mode 1)))
18:59seancorfieldthank you amalloy and rafl !
18:59gtrak`does that get saved off somewhere?
18:59clojurebotPardon?
18:59gtrak`not you clojurebot
19:03Raynesseancorfield: How's the Emacsing going?
19:03robermannabout labrepl: with 1.3 the command script\swank fails because the class clojure.lang.ILookupHost does not exist (anymore?)
19:03seancorfieldnice... auto-paredit mode... thanx... btw, needed 'clojure-mode-hook
19:04Raynesamalloy: Shame on you for giving him broken code.
19:04seancorfieldRaynes: 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:04seancorfieldit is a bit frustrating tho'...
19:04RaynesI did that with Vim and Sublime Text 2.
19:04seancorfieldc-x o feels like an unnatural shortcut to cycle thru windows
19:05archaicvery easy to change that, i have
19:05seancorfieldand sometimes i do something that completely changes my layout and it takes several keystrokes to get it all back again
19:05seancorfieldarchaic: what's a good binding for other-window? (and how do i change it easily?)
19:06robermannI'm using tabbar-ruler and tabbar packages
19:06robermannthey give you graphical "tabbed" frames
19:06seancorfieldhmm c-tab is not used for anything else... that would suit me...
19:07raflseancorfield: 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:07archaicseancorfield: first find out what the command is called using c-h k c-x o it will be other-window
19:07duck1123seancorfield in 1 week: I'm never using anything other than emacs
19:08archaicthen (global-set-key key-name 'function-name) or something similar
19:08ArafangionAt work, I map C-w-P{h,j,k,l} to each of the windmove functions.
19:08ArafangionC-w-{h,j,k,l}, rather.
19:09archaicas to what I use .. S in a modal mode so you probably want something different ;)
19:10Arafangionseancorfield: 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:12robermann'night
19:13lnostdal_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:13lnostdal_or, actually, it says "omit the option at all" .. not "removing it" .. but yeah
19:14seancorfieldi ended up with (global-set-key (kbd "<C-tab>") 'other-window)
19:15seancorfieldmy emacs experience just got a whole bunch smoother :)
19:15ArafangionUgh, my fingers would hate that keyboard shortcut.
19:16seancorfieldArafangion: so far emacs clojure-mode indentation seems to match CCW so that works for us...
19:16Arafangionseancorfield: Nice. :)
19:16seancorfieldwe'll see if we run into issues when there's more of us editing the clojure code with different editors...
19:16Arafangionseancorfield: I'm using C#, Python, C++, and ObjC most of the time. :(
19:17lnostdal_i use C-tab for this too .. thumb + ring finger
19:17ArafangionI prefer vi-style window changes.
19:17ArafangionHence C-w-{h,j,k,l}
19:18ArafangionMore accurate, too. :)
19:18Arafangionseancorfield: Sometimes I wonder if I shoudl consider a 'code reformatter' for providing a consistent style.
19:18archaici used to use something like that but found having 4 keys for 3-5 buffers way overkill
19:19Arafangionarchaic: I frequently want to switch between two buffers without wanting to cycle through six buffers.
19:19Arafangionarchaic: Also, it's the same as vim.
19:27hiredmanwe have a commit hook at work that runs the code through emacs (clojure-mode) in batch mode before letting you commit
19:27hiredman(I have it disabled of course)
19:28technomancyhiredman: not so loud, dan larkin will hear!
19:28hiredmanLET HIM HEAR!!!
19:30Arafangionhiredman: Could I have that script?
19:31hiredmanshould ask danlarkin, he wrote it
19:31danlarkinwhatever it is I disclaim all responsibility
19:31danlarkinhiredman: you bastard
19:31Arafangiondanlarkin: Could I have a copy of that script, it'd be useful. :)
19:32hiredmank
19:32Arafangiondanlarkin: Client-side of course... It'd be a sick bastard who installs it server side without an option to bypass it. :)
19:32danlarkinI'd do that in a heartbeat
19:32Arafangiondanlarkin: I'll wear gloves.
19:33hiredmanand we have tests in our test suite that check for too long lines, etc
19:33ArafangionNice.
19:33ArafangionActually, I have to go to work in... 5 minutes ago.
19:33hiredmanlike living in a jail :)
19:34ArafangionSo I'll look for your names when I'm back! :)
19:34danlarkinbut at least the jail is clean
19:34danlarkinunlike the outside
19:34ArafangionI'll keep the gloves on.
19:34ArafangionAdios!
19:39duck1123Does anyone happen to know what I need to do in my site to use joda-time with MongoDB
19:39duck1123I'm using Karras, but I suspect there's a wrapper-agnostic solution
19:44duck1123I think I may have found it
19:53stuarthallowaynathanmarz: boxing to Integers is insane, man!
19:56stuarthallowayok, that was just baiting, but I would discuss if you were around ...
20:06amalloystuartsierra: that change got applied already though, right? so it's less urgent to argue about whether it's a good idea
20:06stuartsierrahuh?
20:07stuarthallowayamalloy: it can still be reverted
20:07stuarthallowayand it should be
20:09carkso i can (:refere-clojure :exclude [sequence]) from a namespace, but how do i use this namespace from another namespace, without raising errors ?
20:09carkin 1.3
20:10stuarthallowaycark: you can't, and you shouldn't. avoid :use
20:10carkhum ok my bad, i was redifining it a 3rd time =P
20:10stuarthallowayI do 98% require/as, 2% use/only
20:10carkstuarthalloway: well that's open to discussion
20:11stuarthallowaycark: that discussion was had, during design of ClojureScript
20:11stuarthallowayyou can see where it led...
20:12carkyou guys came to a conclusion, and i respect that
20:12carkbut in some cases it's cumbersome to always qualify stuff
20:13carkwith smallish namespaces (as i think they should be) that's no trouble at all
20:13carkeven tho clojure.core is all but smallish
20:13carknot a very good example in that case, but necessary
20:13stuarthallowaycark: fair enough
20:13pandeirocark: 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:14carki guess tules are made to be broken =)
20:14stuarthallowayalthough i find the size of the overall project to be a bigger driver than the size of the namespaces
20:14carktules/rules
20:14stuarthalloways/tules/rules
20:14stuarthalloways/tules/rules/
20:15cark i often have to dive in the source while having customers on the line, so finding stuff quickly is most important
20:15stuarthallowayIRC bots are like those college games that depend on only a few cool kids knowing the rules
20:16carks/tules/rules
20:16carki think only me could have done that, but it's too late
20:17carkanyways : my point is i'd rather have small numerous namespaces where i can find stuff real fast, than few larger namespaces
20:17carkeven at the cost of a larger project
20:17hiredmanspeaking of "a few cool kids knowing the rules"
20:17stuarthallowaycark: totally agree
20:17stuartsierraoops
20:17carkdamn there are to stuarts
20:18abedratwo even
20:18scgilardicark: does use/only not work for you: like: (:use [some.ns :only [f1 f2 fred fblue]])
20:18redingercark: Have you ever seen them in the same place at the same time, though?
20:18stuarthalloways/to/two
20:18stuartsierraTwo odd, from my point of view.
20:18stuarthallowayfuck you bot
20:18carks/to/two
20:18carks=/
20:18carkscgilardi: yes i do use that quite extensively
20:19carkanyways thanks for the input
20:21carkworking on yet another parsing library... matching on any state, and trampoline based, passing continuations for error and success
20:21carkrather failure and success
20:21ninjuddRaynes: i told you everyone loves the s/foo/bar/ functionality of lazybot. you shouldn't have turned it off
20:22carkparsing text is covered by other libraries already, but this parsing pattern is usefull in many other cases
20:23carkbut you get crazy long traces when the usefull stuff at the bottom raises an exception
20:23nathanmarzstuarthalloway: hey
20:23Raynesstuarthalloway: As ninjudd just alluded to, I disabled the automatic s/// stuff in lazybot. Figured more people hated it than liked it.
20:23stuarthallowaynathanmarz hi
20:23stuarthallowayRaynes: it was the only bot feature I ever understood :-)
20:23nathanmarzi'm pretty happy with the change
20:24stuarthallowayfigured you would be, but you shouldn't be
20:24stuartsierras/happy/demoralized/
20:24nathanmarzok
20:24hiredmanbut what is the point of the feature on irc? it can't go back and edit what has been typed
20:24nathanmarzdid something break?
20:24stuarthalloway the good news is that with the change to hash semantics the problem of Integer is greatly reduced
20:25stuarthallowayso I can live with the new boxing rules
20:25stuarthallowaybut they are strictly harder to understand
20:25stuarthallowayand they don't help people doing interop
20:25ninjuddhiredman: you know what would make it even more awesome? if clojurebot did it instead of lazybot
20:25stuartsierraHow many damn bots are there?
20:25hiredmanninjudd: *eyeroll*
20:25nathanmarzyou can only get ints via interop, right?
20:25redingerclojurebot: how many bots?
20:25jcromartiehttp://i.imgur.com/xblF4.gif
20:25clojurebotThanks! Can I have chocolate next time
20:26hiredmanstuartsierra: depends on how many you have on ignore
20:26stuarthallowaynathanmarz: now you can get Integers from other Clojure fns that end with an interop call
20:26nathanmarzright, which is interop
20:26stuarthallowayconsider this line of code (make-map (foo) 1 (bar) 2)
20:27nathanmarzboxing ints as Longs doesn't change the fact that the interop might return you an Integer anyway
20:27Raynesninjudd: He wouldn't do it at all, I imagine. Because he's so much better than amalloy and I, I guess.
20:27nathanmarzso you still have to worry about it in clojure land
20:27nathanmarzw
20:27stuarthallowaynathanmarz: true, but that is easy to see
20:27nathanmarzwhy is that easier to see than "int"?
20:27stuarthallowayand only a few very badly designed APIs return the box types
20:27brehautarrows!
20:28stuarthallowaythe example again: (make-map (foo) 1 (bar) 2)
20:28carkstuarthalloway: like APIs designed with clojure 1.2 =)
20:28stuarthallowayif make-map makes a Clojure map, then thanks to the hash fix, we don't care about Integer / Long
20:28stuarthallowayif make-map makes a Java map, then I have to know what foo and bar do to know if it will work
20:29stuarthallowaywhich I can deal with by saying (make-map (long (foo)) 1 (long (bar)) 2)
20:29nathanmarzthere's legitmate reasons to return boxed types direclty, such as if you want it to be nullable
20:29Raynesstuarthalloway: Precisely two bots.
20:29stuartsierraRaynes: that was me
20:29stuarthallowaynathanmarz: and a ton of those would argue against my position
20:29Raynesstuartsierra: You should strongly consider changing your first name to Jim.
20:30stuarthallowaythe flip size is that boxing doesn't help you much if you have to have a specific box type
20:30brehautRaynes: hsbot is not a bot‽
20:30stuarthallowayso you need a boxed int, and say (.foo x), knowing that foo returns an int
20:30Raynesbrehaut: Well, vocal bots then.
20:31stuarthallowaybut then it breaks if you add anything else to it: a math op, a simple local let...
20:31nathanmarzhold up, what breaks?
20:31stuarthallowaywon't be a boxed int anymore
20:31nathanmarz(let [y (.foo x)] changes the type?
20:31nathanmarzwouldn't y just be an Integer
20:32stuarthallowayClojure doesn't use Integers
20:32stuarthallowaycertainly (+ 1 (.foo x)) will return a long
20:32nathanmarzi have no problem with math ops always returning Longs
20:32stuartsierraRaynes: "Jim Sierra." No.
20:32nathanmarzthey're creating brand new values
20:33stuarthallowayI should try the let case, haven't read what rhickey did
20:33Raynesstuartsierra: To be fair, Jim wouldn't help me either. There is another jim in here that would mess with my tab complete.
20:33nathanmarzthe results of a function don't need to math the type of the inputs
20:33nathanmarzlike any other function
20:33danlarkinhow about Ronaldo Sierra
20:33stuartsierraRaynes: I know a Sierra Stuart, but that's a girl.
20:33RaynesI can get on board with that.
20:33nathanmarzi was testing the Integer stuff, and you can definitely create Integer objects
20:33nathanmarzand pass them around
20:34nathanmarzyou can get primitve ints too
20:34nathanmarzit's just that clojure decides to box as Long if that value needs to be boxed
20:35nathanmarzmy 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:35stuartsierrabut you can't get an unboxed int, even from interop
20:35nathanmarzlet me find the code that shows how
20:36nathanmarzit was on that thread
20:36stuarthallowaystuartsierra; you can if directly chaining two Java things
20:36stuartsierrahmm
20:36nathanmarzi was able to let -bind a primitive int
20:38nathanmarzhttp://pastie.org/2759419
20:39stuartsierraIsn't that a decision made by the compiler?
20:39nathanmarzwhat do you mean?
20:39stuartsierraIn Java the language, aren't overloaded method calls resolved by javac?
20:40stuartsierraI.e., not at runtime?
20:40duck1123what if you hint the x?
20:40duck1123I don't have it running
20:40nathanmarzi don't know
20:41brehautstuartsierra: yes i think so
20:41stuartsierraThen in Clojure it would be the job of clojure.lang.Compiler making the same decision.
20:41duck1123so, I get :int for this. Is that what I'm supposed to have?
20:42stuarthallowaynathamarz: I don't think that is binding a primitive
20:42stuarthallowaycompiling now in order to read the bytecode
20:42stuartsierraMy point is simply that overloaded methods, such as nathanmarz's example, are resolved by the language compiler, not by the JVM.
20:45hiredmangiven 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:47stuartsierraHuh, it appears the bytecode is doing istore/iload.
20:47stuarthallowayreading the bytecode, I would agree with hiredman
20:48hiredmanhaving looked over the git diffs I agree with myself as well
20:48stuarthallowaynathanmarz: I stand corrected, it is binding a primitive
20:48duck1123can anyone tell me what I'm doing wrong here? https://gist.github.com/1315062
20:48nathanmarzok
20:48nathanmarzcool
20:49stuarthallowayalthough i don't think you can tell that from the interface test
20:49nathanmarzyea
20:49nathanmarzi see that now
20:49amalloyduck1123: wrong syntax for extend
20:49stuarthallowayhiredman: do you prefer the new (box by type) or the old (box always to long) behavior?
20:50hiredmanhard to say, very little experience with 1.3
20:50amalloy(extend-type DateTime MongoMappable (to-dbo [d] (str d)))
20:50nathanmarzalso, boxing as Integer was the behavior in clojure 1.2
20:50stuarthallowayhiredman: if you are reading the git diffs you are ahead of most I would think
20:50stuartsierraWhat I'm trying to figure out is WHY the compiler saves an int, and if it was intentional.
20:50amalloylooking at your error message, it seems like you have more problems
20:51hiredmanI 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:51duck1123amalloy: same error
20:51nathanmarznot sure it was a big problem for people, wasn't a problem for me
20:51stuarthallowayhiredman: totally agreed
20:51amalloyduck1123: you're :import'ing MongoMappable instead of :use'ing it, too
20:51duck1123that's probably it
20:51duck1123haven't used protocols much yet
20:52stuarthallowaynathanmarz: 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:52hiredmanstuartsierra: I imagine the compiler checks the return type, sees that it is an int, and creates an int slot for it
20:52dnolenstuarthalloway: but even w/ the current change, you're only one step away from boxing to Long.
20:52stuarthallowaydnolen: yup
20:52hiredmanHostExpr is MaybePrimitiveExpr
20:52nathanmarzdnolen: you mean if you do an arithmetic operation?
20:52duck1123(inc amalloy)
20:52lazybot⇒ 17
20:53redinger(amalloy)
20:53stuartsierraBut LetExpr has an explicit check for int, which it casts to double.
20:53stuartsierraI mean long.
20:53dnolenstuarthalloway: but the current state of HEAD old behavior won't get foisted on you if you're just roundtripping some interop.
20:53abedra(inc abedra)
20:53lazybotYou can't adjust your own karma.
20:53abedraah ha
20:53abedranow I see
20:53abedranice
20:53jodarohmm
20:53stuarthalloway(/ abedra 0)
20:53jodarohow do karras and congomongo compare?
20:54abedralol
20:54dnolennathanmarz: from what I understand yes.
20:54stuarthallowaydnolen: which old behavior?
20:54jodaroi've played with the latter a little already
20:54dnolenstuarthalloway: boxing to Long right away.
20:54duck1123I like Karras' entities. That's why I switched
20:55jodaromore ORMy?
20:55stuarthallowaydnolen: ok, right
20:55stuarthallowayyou can't spell wormy without ORMy
20:55stuartsierra^
20:55nathanmarzdnolen: you're creating a new value, no reason it has to match the types of its inputs
20:55jodaroheh
20:55duck1123jodaro: yes, plus all of the collections come back as records, so I can do dispatch on them
20:55jodaronot easily, at least
20:55hiredmanstuartsierra: in the loop case
20:56jodaroduck1123: cool, i'll have a look
20:56stuartsierrahiredman: Oh, now I see.
20:56jodaroseancorfield: same!
20:56jodaroerc
20:57technomancyincanter-charts depends upon clojure-json‽
20:57technomancyಠ_ಠ
20:57stuarthallowayso binding an interop in in a let keeps the int, but with a loop binding you get a long
20:57stuartsierraInteresting.
20:57stuarthalloways/in/int
20:58hiredmanduck1123: most likely you are pulling in the the interface generated via defprotocol using import instead of pulling the protocol using use
20:58danlarkintechnomancy: whoever owns that project needs to delete it
20:58hiredmanoh
20:58hiredmanlate
20:58technomancydanlarkin: incanter also pulls in old swanks that screw everything up =(
20:58duck1123hiredman: thank's anyway. I'm on to all new problems. :)
20:58hiredmanthat doesn't seem like it could be intentional
20:58stuartsierraThe int in int isn't in it for long.
20:59duck1123even identity kills it
20:59dnolenstuarthalloway: ah yeah that must be the fancy loop inference stuff if I recall? only works for long / double.
20:59technomancyalso all the incanter examples do bare use =\
21:00hiredmanI wonder why identity is static, but doesn't have an inline
21:00danlarkintechnomancy: if I add you as a collaborator can you deprecate it for me? :)
21:00stuarthallowaytechnomancy: cark will fix them :-)
21:01technomancydanlarkin: just fixing the readme?
21:01technomancywait, you added me to clojure-json once upon a time
21:01danlarkinI don't see you there anymore
21:01technomancyanyway, sure
21:01danlarkingithubs!!!!
21:01technomancypeople need to know!
21:02danlarkinadded! rectify my mistake
21:02stuarthallowaydnolen: guess so. Anyway, since different boxes work fine as hash keys now the rest of this is really corner-case stuff
21:02technomancytomorrow
21:02stuarthallowayI can live with either behavior
21:03technomancydanlarkin: though in the case of incanter that is probably not going to help
21:03technomancyanyway, /me &
21:03stuartsierrastuarthalloway: It's at Compiler.java line 5954 I think.
21:04stuartsierraIt calls the ASM method Type.getOpcode.
21:04stuartsierra(That's in the emitter for `let`)
21:04stuartsierraSo at that point the Clojure compiler doesn't care what the type of a `let`-bound thing is: ASM handles it.
21:05stuarthallowayg'night all
21:06stuartsierralater dudes
21:07cemerickDid I miss a relevance flashmob? :-P
21:07stuarthallowaycemerick: mostly
21:07ibdknox_cemerick: it was scary. hiding was the only real option.
21:08danlarkintldr: ronaldo sierra
21:10cemerickOK, now who's going to clean up all these broken tequila bottles.
21:10cemerickThose relevance animals…
21:22cemerickThe conj unconference is shaping up pretty nicely!
21:23hugodIf I'd arrived half an hour earlier, I might have found out why my locals clearing posts were being ignored, ah well
21:23danlarkinthe disj
21:25zerokarmaleftno shortage of eateries within walking distance of the sheraton, that's good
21:29hiredmanhugod: you just seem to be the only one interested
21:30hugodhiredman: looks that way…
21:30hiredmanwe had cdt setup at work I think, I never used it though
21:32hugodseeing all variables when you hit an unexpected exception or breakpoint is quite nice, imho
21:36hiredmanit 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:36hiredmanwhen I could just add a println or logging
21:39hiredmanand logging is useful in production
21:40hugodall useful parts of the toolkit
21:50ibdknox_The Conj unconference?
21:52amalloyibdknox_: if you didn't get an invitation it means you're not one of the cool kids
21:53ibdknox_damn
21:53ibdknox_but I've been working so hard to become one of those
21:53ibdknox_amalloy: picking all these trendy names and such
21:53amalloyibdknox_: if you stop having out with ORMs maybe you can sit with us at lunch
21:53amalloy*hanging
21:54ibdknox_lol
21:54ibdknox_it's not really an ORM ;)
22:05jcromartiewhat's the difference between "fork/join" and (reduce (pmap ...))
22:07nappingwhich fork/join?
22:07redingercemerick: I sure hope someone can find space for all that Unconj stuff
22:08cemerickredinger: We'll make it work :-)
22:08redingerGuess my house is always an option...
22:09cemerickibdknox_, amalloy: totally public, linked on the list :-) https://docs.google.com/spreadsheet/ccc?key=0Alim_jfrt24MdDFqZVZsNW0tamtQR2pPTHJZTkN6Y0E
22:09cemerickredinger: heh, that'll work! :-P
22:09jcromartienapping: I don't know :)
22:09amalloycemerick: 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:10cemerickI'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:10cemerickamalloy: Birds of a Feather
22:10cemerickused frequently in conferences
22:11ibdknox_amalloy: I was wondering the same thing
22:11nappingamalloy: pick the most amusing from http://en.wikipedia.org/wiki/BoF
22:12ibdknox_hm, should I do one about the web? There aren't really any web talks at the conference
22:15nappingjcromartie: In general fork/join usually follows more of a tree structure
22:16nappingthat reduce looks serial to me
22:18jcromartiehm
22:22dnolenI like me some CoffeeScript, but boy am I glad that Clojure (and thus ClojureScript) has no support for mutable locals
22:23simardbrehaut: what side is that ?
22:23brehautthe bottom side
22:23simardlol
22:23brehautnew zealand
22:24simardprobably not the worst place around
22:24nappingmutable locals?
22:24dnolennapping: locals can be mutated by functions that close over them.
22:24nappingI've been thinking that might be fine if you don't let them escape
22:25brehautsimard: in general it is good, but it limits access to the conjs frinstance
22:25nappingyeah, escape like that
22:25brandelbrehaut: are using clojure at work? (I'm in NZ too)
22:25brehautbrandel: nope, not yet anyway
22:25dnolennapping: well JS allows that, and CoffeeScript is conservative about changing JS semantics.
22:26brehautbrandel: its all python at work for me; i build websites with django
22:26dnolennapping: 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:26simardany of you run their own business ?
22:26dnolendoes/doesn't
22:26brehautsimard: yes
22:26brandelI'm in Dunedin and sadly almost all the work down here is .Net
22:26brehautbrandel: most of the work nationwide is .net i think
22:27brehautbrandel: C#4 and F#2+ are pretty solid though
22:27brandellanguages are fine, it's asp.net webforms that I can't cope with
22:27simardC#4 ? hum, I should admit I have not touched C# for 3 years.
22:28brehautbrandel: aspweb forms is death by rusty spoon
22:28simardit is a lisp yet ?
22:28simardis it*
22:28brandelagreed
22:28brehautsimard: its gaining more haskell than lisp
22:28brandellinq is kind of haskellish
22:28brehautits a lot haskellish ;)
22:28nappinghardly a surprise there
22:31nappingjcromartie: something like (defmacro papply [f & args] `(apply ~f (map deref ~(vec (for [a args] `(future ~a))))))
22:32clojurebotmap is *LAZY*
22:32ibdknox_yeah, while I was at MS, there was a focus on bringing in a lot of functional idioms
22:32brehautno need to yell about it clojurebot
22:32ibdknox_F# actually drove a lot of innovation in C# itself
22:32brandelclojurebot is cranky
22:32nappingmore what Erik Meijer was working on at MSR before going over to the C# side
22:32brehautibdknox_: i like to imagine a corridor with the haskell guys at one end, F# next door, then C#
22:33ibdknox_lol
22:33brehautsmart things flow down
22:33nappingwait, guess he worked on Haskell before joining MSR
22:33ibdknox_we were all in one hall for the most part ;)
22:33brehautibdknox_: this makes my day
22:33zerokarmaleftcemerick: that document is view only now
22:34zerokarmalefti guess i'd be worried too if 25+ people were trying to edit it at once
22:34dnolennapping: it was fun to hear him talk at StrangeLoop, seems like he's a fan of nasty imperative languages these days :)
22:35ibdknox_dnolen: you can still do awesome things with those, you know ;)
22:35dnolenibdknox_: that really was his point.
22:36aperiodicdoes recur force evaluation?
22:36brehauthes done a pretty good joke burying nice functional tools into a nasty imperative language
22:36brehauts/joke/job/
22:36brehautfreudian slip?
22:36ibdknox_it's really good to see imperative languages stealing some of the good stuff
22:36nappingwell, how much of the good stuff didn't lisp have?
22:36ibdknox_C#'s immutable structures kind of suck though.
22:37brehautyeah
22:37ibdknox_which lisp?
22:37nappingCommon Lisp, for one
22:37nappingnot exactly function
22:38ibdknox_Common Lisp carries the weight of evolving over such a long period of time in the hands of many different people
22:38ibdknox_it's not "designed" in the sense that Clojure is
22:39ibdknox_and that lack of cohesion means that instead of an intelligent mixture of paradigms it feels haphazard
22:41dnolenibdknox_: 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:43dnolenstill think CL package stuff is horrifying. Even Art of the Metaobject Protocol makes fun of it, and that was written in 1991.
22:44dnolenmakes Clojure namespaces look positively dreamy.
22:44ibdknox_dnolen: yeah... I think a lot of their situation is a product of their community
22:45ibdknox_dnolen: the CL culture doesn't lend itself to moving very far
22:48aperiodici guess the real question is: how is clojure lazy? is there an equivalent of haskell's thunk?
22:49amalloyaperiodic: thunks are not a haskell invention
22:49amalloya thunk is just "a function of no arguments"
22:50nappingwell, that and storing away the result so work is not duplicated
22:50amalloynapping: that's a cached thunk
22:50aperiodicin other words, a function with no free variables?
22:50nappingMost of the laziness seems to be in Seq instances
22:50amalloyuhhh. i don't think that's the same
22:51amalloy(fn [x] x) has no free variables
22:51amalloy(fn [y] (+ x y)) has a free variable x
22:51aperiodicah, i see the distinction
22:51amalloythe thing that haskell, as a lazy language, does differently is (i think) implicitly wrap all evaluation in a cached thunk
22:52amalloyclojure has cached thunks: ##(doc delay)
22:52lazybot⇒ "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:52amalloyand lazy sequences are similar, except they're sequence-specific
22:53brehautamalloy: 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:53aperiodicit's a sequence where the tail is wrapped in a delay?
22:53amalloyaperiodic: the head and the tail
22:55aperiodicamalloy: then why doesn't evaluating the head cause the rest of the sequence to be evaluated?
22:55dnolenaperiodic: why should it?
22:55amalloybecause the tail is another lazy sequence, which as always is wrapped in a delay
22:56dnolenClojure doesn't have TCO (for interop reasons) so it supports good functional tail recursive style via lazy sequences, recur, and trampolines.
22:57aperiodicso a function that recursively constructs a lazy seq will be evaluated lazily as a result of the laziness of the sequence?
22:58dnolenaperiodic: yes
22:58aperiodicbut it still consumes stack, right?
22:58seancorfieldquestion about Programming Clojure...
22:58aperiodicdnolen: that is, linear amounts of stack
22:58seancorfieldthe git repo project.clj refers to contrib-1.3.0-SNAPSHOT
22:58seancorfieldurl https://github.com/stuarthalloway/programming-clojure/blob/master/project.clj
22:59dnolenaperiodic: a good lazy sequence should not eat up the stack, regardless of it's size.
23:00dnolen,(take 10 (range 1e20)
23:00clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
23:00dnolen,(take 10 (range 1e20))
23:00clojurebot(0 1 2 3 4 ...)
23:02seancorfieldi tried to add the sonatype repo to lein... but it still complains it can't resolve the artifact
23:04simardI 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:05aperiodicdnolen: 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:06seancorfieldnm, figured it out... i had a typo in my repo URL :(
23:06aperiodicdnolen: the part i'm fuzzy about is when using a recursive fn to construct the seq
23:07dnolenaperiodic: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3821
23:09aperiodicdnolen: awesome, that's really helpful. thanks!
23:09dnolenaperiodic: no problem.
23:47brehautits 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:49simarduhm, this is probably obvious, but, is there a function that... calls a function ?
23:49simard(a function of no argument)
23:49simard(xyz (fn [] (str "Hello " "World")))
23:49alandipert#(%)
23:50alandipertaka (fn [x] (x))
23:50simardhum makes sense
23:50simardthanks
23:50technomancyamalloy had a neat trick for doing that in an existing function
23:50amalloytechnomancy: nah, only if you have an arg
23:50technomancysomething less perlish
23:50technomancyoh, that's right
23:50technomancydeliver
23:51technomancy(memfn invoke) is a poor substitute =)
23:53aperiodicyou could also abuse apply
23:53aperiodicbut then you have to type an empty list literal
23:55miclorb_I thought I understood (apply) - clearly not
23:55miclorb_apply is normally (apply <function> <sequence>) right?
23:55aperiodiccorrect
23:55miclorb_so if I see something like (apply func arg1 arg2 arg3) - how does that work?
23:55miclorb_arg3 is a list
23:56amalloymiclorb_: it's the same as (apply func (cons arg1 (cons arg2 arg3)))
23:56aperiodici think it conjs the args
23:57aperiodicyeah, what amalloy said
23:57amalloyor, more concisely, (list* arg1 arg2 arg3)
23:57miclorb_in this case func takes 2 args - not sure if that confuses things more
23:57brehautamalloy: points for list* :)
23:57miclorb_ok
23:57seancorfield_,(doc list*)
23:57clojurebot"([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:58seancorfield_and to think stu complained about the "half earmuff" vars in clojure.java.jdbc :)
23:59brehautlol
23:59technomancyyeah I don't know if he was confused or what
23:59amalloyhaha i must have missed this one