#clojure log - May 13 2012

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

0:09 wkmanire: thunderstorm, poweroutage, internet outage... and... I'm bakc.

0:09 back*

0:10 xeqi: I did get your link before my google... I mean, my internet stopped working. thanks.

0:13 xeqi: were you able to get your address listbox working?

0:15 technomancy: any gnome shell users want to try my plugin out?

0:15 or alternatively: any unity users want to make the switch so they can start extending their desktop in Clojure? =P

0:16 gfredericks: make the switch?

0:16 like to not-ubuntu or something?

0:19 xeqi: or choosing gnome-classic or whatever for the window manager when they log in

0:24 technomancy: gfredericks: I mean switch from unity to gnome

0:24 unity is kinda lame anyway =)

0:24 gnome shell has its issues, but I'm pretty sure there's nothing that a well-placed ClojureScript extension couldn't fix

0:25 Ubuntu defaults to Unity but it works fine with Gnome too

0:25 wkmanire: xeqi: Haven't tried yet. been getting interruped.

0:25 interrupted* bleh. I should have something working here soon.

0:34 xeqi: Got it figured out. That was definitely not was I expected, but the example was exactly what I needed. thank you!

0:35 amalloy: technomancy: i use gnome, but don't know the first thing about scripting it. what awesome powers will your plugin unleash?

0:35 wkmanire: xeqi: https://www.refheap.com/paste/2704

0:36 technomancy: amalloy: right now: you can make a panel button that shows a hello world box!

0:36 ...in CloooooojureScript!

0:36 but really the possibilities are endless

0:36 * technomancy registers gnome3zombo.com

0:36 wkmanire: technomancy: Can you do anything at gnome3zombo.com?

0:36 technomancy: wkmanire: you certainly can

0:37 wkmanire: :D

0:37 technomancy: amalloy: at the risk of blaspheming, it's kind of like Emacs. core written in C, UI written in a more friendly, dynamic language

0:37 (we'll overlook the fact that the language currently happens to be JS since JS is a handy compilation target)

0:38 basically, there are three ways to make large user-facing programs: 0) the unix way, 1) the Emacs way, and 2) the wrong way

0:38 amalloy: *laugh*

0:38 gf3: Raynes: Crap

0:38 Raynes: Thx

0:38 technomancy: 0 only works if you can get by using processes and pipes as your core abstractions

0:39 amalloy: gnome 3 means gnome has moved from 2 to 1.

0:39 xeqi: is it better than xmonad?

0:40 technomancy: xeqi: currently: not by a long shot

0:40 but the potential is way higher IMO

0:40 amalloy: oh, gnome 3? this ol' computer is still on ubuntu 10.04 and gnome 2

0:40 wkmanire: xeqi: I really tried to like xmonad... I think I ended up liking it. But I still use openbox.

0:40 xeqi: I might give xmonad another go around eventually.

0:41 gf3: Raynes: I think it may have just been slow

0:41 http://cljbin.com/paste/4faf3b19e4b0565c9e05bcfd

0:43 technomancy: xmonad is definitely a local maximum

0:44 uvtc: amalloy: I was on 10.04, upgraded, but then was not very happy with Unity, so went with Lubuntu (which is like Ubuntu, but no Gnome, nor some other large-ish apps like Evolution and OO.o).

0:44 wkmanire: I think it's because I spend about 95% of my time on linux either in a web browser or in a full-screened xemacs.

0:44 So being able to tile windows in xmonad didn't really help me with anything.

0:45 Desktop 1 gets emacs, Desktop 2 gets brower(s), Desktop 3 get's anything else etc...

0:45 technomancy: it's definitely more valuable when you have 2 displays

0:45 wkmanire: technomancy: I miss my second monitor :( I've been working on a laptop for the past 3 months.

0:52 uvtc: technomancy: What do you mean by "gnome 3 means gnome has moved from 2 to 1."?

0:58 technomancy: uvtc: it's moved from "the wrong way" (huge piles of static C) to "the Emacs way" (core in C, UI in JS)

0:59 wkmanire: technomancy: Interesting that they chose javascript.

0:59 uvtc: technomancy: Oh, I see. Thanks. Yes, wkmanire, interesting choice of language.

0:59 technomancy: wkmanire: in 2002 or so they were talking about using guile

1:00 but guile was awful in 2002

1:00 wkmanire: They're probably going to see a whole lot of new apps popping up as a result.

1:00 technomancy: wkmanire: there are tons of extensions already: https://extensions.gnome.org/

1:00 zakwilson: JS makes a lot of sense if you want to make something pupular.

1:00 wkmanire: I'm not sure if there is value in an HTML 5 app also being able to run in gnome.

1:00 technomancy: extensions are the only reason FF is still around after chrome kept cleaning its clock in performance

1:01 uvtc: I hadn't considered switching from Ubuntu + Unity to Ubuntu + "Gnome Unity".

1:01 wkmanire: Wow, there's a whole bunch of extensions.

1:01 technomancy: gnome is not unity

1:02 * uvtc needs to look up exactly what this "gnome unity" is...

1:02 technomancy: gnome shell

1:02 Raynes: wkmanire: xemacs?

1:02 technomancy: I'll write a big ol blog post about it soon hopefully

1:02 wkmanire: Are we going to be able to target gnome with clojurescript?

1:02 technomancy: wkmanire: we just did

1:02 that's what I just posted =)

1:02 uvtc: !

1:03 wkmanire: technomancy: Sweet!

1:03 oh man, I cannot wait to get started with clojurescript.

1:03 I'm almost ready.

1:03 technomancy: try it out; let me know if it works on something other than my machine =)

1:03 oh, the only thing it doesn't mention is after you generate your project you have to update project.clj with the specific :shell-version you're using

1:03 wkmanire: Raynes: emacs running on xorg as opposed to running in a terminal emulator.

1:04 Raynes: wkmanire: Oh, I thought you literally meant xemacs.

1:04 technomancy: wkmanire: xemacs is a fork of GNU emacs

1:04 I only know one person who uses it

1:04 wkmanire: I didn't realize it was a fork.

1:04 uvtc: wkmanire: `emacs -nw`?

1:04 wkmanire: uvtc: Right.

1:09 technomancy: As in cljs shell-version?

1:11 technomancy: I'm actually trying your new plugin out.

1:32 michaelr525: hello

1:34 Raynes: I'm writing Javascript!

1:34 Pinch me!

1:34 uvtc: *pinch*

1:36 Raynes: Ow!

1:48 wkmanire: Raynes: What are you writing javascript for?

1:48 Raynes: wkmanire: refheap.com

1:49 wkmanire: Need a hand?

1:49 I need a break anyway.

1:49 Raynes: Actually finished. Was just a few lines.

1:49 :)

1:49 wkmanire: ah ok.

1:49 What did you add?

1:50 Raynes: The paste box used to have a fixed height. I added a few lines to resize it based on the size of the window so that it looks good on all screen sizes.

1:50 amalloy: errors

1:51 spjt: nice site. Am I the only one that accidentally typed C-x C-e on it

1:51 * Raynes plans to add keyboard shortcuts.

1:51 wkmanire: Raynes: Ah, I saw that issue.

1:51 Raynes: Of course, not *those* keyboard shortcuts.

1:51 Light table might add those shortcuts. :p

1:51 wkmanire: vertical heights are a pain in the arse.

1:52 Raynes: This was a really super easy solution.

1:52 Don't know why I didn't do it ages ago.

1:53 wkmanire: he he, one liner. Can't beat that.

1:55 cgag: I'm using clj-http, and trying to use the cookie-store, am I making an obvious mistake with this?

1:55 (set! clj-http.core/*cookie-store* (clj-http.cookies/cookie-store)

1:57 wkmanire: Dammit, whats the paredit-mode command to wrap a region in square brackets?

1:57 cgag: i have ido so i don't know exactly, but it's something like paredit-wrap-square

1:57 wkmanire: nvm, kill, bracket, yank.

1:58 amalloy: M-x paredit-wrap-square

1:58 Raynes: wkmanire: There is the function though, so it's more than one line.

1:58 amalloy: bind it to something, if you want

1:58 Raynes: amalloy: WAAAAAT

1:58 That exists?

1:58 wkmanire: amalloy: Thanks.

1:58 Raynes: Why isn't it bound to M-[?

2:00 spjt: am I the only person that can't stand paredit

2:00 Raynes: I think so, yes.

2:00 amalloy: escape characters are hard, Raynes

2:00 Raynes: I can't even write code without paredit at this point.

2:00 amalloy: M-[ is fine in a gui, but that's hard to send over ssh

2:00 Raynes: I'd kill something.

2:00 uvtc: spjt: I haven't taken the paredit-plunge yet myself.

2:00 wkmanire: Raynes: really? I guess I only saw the one line change in the diff. + editor.refresh()

2:00 Raynes: wkmanire: That's a different commit. Look at the one before it.

2:01 wkmanire: ahhh ok

2:01 spjt: For some reason I tend to write functions from the inside out, which doesn't work well with paredit

2:01 wkmanire: uvtc: it's worth it. Although sometimes I still turn it off to fix messed up parens.

2:01 Raynes: So do I, spjt.

2:01 scottj: wkmanire: if you have [ bound to paredit-open-bracket I think you can just type that if you have a region selected

2:01 Raynes: wkmanire: C-u backspace

2:02 spjt: e.g. (/ (+ 1 2) 2) with paredit, if you've written (+ 1 2) first, seems to not like putting the parens on the outside

2:02 wkmanire: scottj: bingo! awesome tip

2:02 Raynes: spjt: M-(

2:03 |(+ 1 2) <-- If your cursor is where the | is, M-( gets you ((+ 1 2))

2:03 spjt: Raynes: hehe, I think I just prefer (

2:03 Raynes: The answer to life, the universe, everything.

2:03 spjt: I'm just excited that I finally found out how to disable C-c in term mode, so now I can use emacs as my shell :)

2:04 wkmanire: spjt: I think there was an actual emacs based linux distro at some point.

2:04 It booted you directly into emacs from power on.

2:07 #clojure, makes you better at emacs.

2:08 uvtc: wkmanire: Thanks. So I've heard (that paredit is worth it). I've got a video of the talk Neale S gave on it, but haven't gotten round to really trying it out for more than 5 minutes.

2:08 scottj: spjt: yeah in that case I'm not sure paredit helps much. It's C-M-u ( / C-M-f 2 ) vs C-M-u M-( / C-M-f 2. anyone know a useful feature here?

2:09 rbxbx: uvtc: definitely need ot spend more time with it than that to start to appreciate/be productive with it. Definitely worth taking the 30-45 minutes and going through emacs tutor.

2:09 wkmanire: uvtc: I didn't know there was a video. Link?

2:09 spjt: The best thing you can do is print out the emacs reference card :)

2:09 I actually have a printed emacs manual, but it's for version 19 or so

2:09 rbxbx: uvtc: and for me at least, not using something like prelude that gives you sensible defaults you don't understand helped a lot as well... That 'blackbox' style of usage didn't work well for me.

2:09 spjt: from the last time I tried to get into it and gave up

2:10 rbxbx: predominantly have a hard time fighting my vi muscle memory more than anything else :)

2:11 uvtc: wkmanire: err... it's a 7-minute lightning talk. Hm. I think I found the link searching the ML archives ... (just a sec)

2:11 Raynes: rbxbx: I use evil-mode.

2:11 uvtc: rbxbx: "prelude"?

2:12 wkmanire: Here it is: <http://skillsmatter.com/podcast/scala/paredit-mode>

2:13 wkmanire: uvtc: Thank you!

2:13 uvtc: wkmanire: y/w :)

2:13 rbxbx: Raynes: I used evil as well, but I felt like I knew just enough emacs that evil was beginning to hurt me. Plus a handful of vim things being un/half-implemented..

2:13 Raynes: easier just to not fight it, I found ;)

2:14 uvtc: http://batsov.com/prelude/

2:14 uvtc: it seems like a good batch of settings, and I like the ease of getting up and running... but felt like there was too much going on that wasn't vanilla emacs for learning.

2:15 uvtc: rbxbx: If I use vim even for a short time, it takes me the rest of the day to stop hitting :wq to quit every app I'm in contact with. :)

2:15 rbxbx: uvtc: yeah, I had :q remapped in bash to exit for a while. /me has broken vim brain

2:16 uvtc: and then I can use vimperator and vimium in my browsers to perpetuate my bad/good habits ;)

2:17 wkmanire: I remember the first time I tried to use vim. I went to edit a text file and my knee jerk reaction was to start typing.

2:17 I've never liked VIM since then.

2:17 scottj: do vimmer's wish they'd used ; instead of : for commands since it's unshifted?

2:18 wkmanire: there's probably an option to put in insert mode by default :)

2:18 rbxbx: Hmm. I find : pretty easy to type... though the binding on ; is arugably less useful.

2:18 *shrug*

2:18 Plus you're not necessarily in command mode _that_ often.

2:19 normal mode ftw ;)

2:22 wkmanire: Raynes: Do you have an aversion to semi-colons? :P

2:24 spjt: I still go through cycles where I edit .emacs with vi and then start emacs to see if it works

2:25 rbxbx: spjt: I do that as well ;) – really ought to alias vi/vim to emacs -nw someday.

2:26 spjt: I have to ssh into servers all day that don't have emacs so I'm sort of stuck with vi anyway

2:27 rbxbx: I think it's important to at least be adequate in both...

2:29 But being in boxes you don't have control over sure must be an impedement to learning/trying things out :(

2:32 scottj: spjt: emacs-lovers use tramp in that case

2:33 spjt: I still think vi is better than emacs for quick edits, sorry :)

2:35 uvtc: spjt: If you've got a compiler available, one nice small little editor that's easy to build and use is [ne](http://ne.dsi.unimi.it/).

2:35 spjt: uvtc: I might have to ssh into 100 different servers every day, so probably not :)

2:36 rbxbx: spjt: I find having a subset of emacs readline bindings set up to work while in insert mode in vim to be helpful.

2:37 spjt: at least the big ones, ctrl+e/ctrl+a/ctrl+f/ctrl+b/etc

2:37 eggsby: you can implement vi pretty adequately in emacs, could you implement emacs in vi?

2:37 * eggsby uses vim pretty much exclusively

2:38 rbxbx: eggsby: not exactly, but there have been attempts – http://www.vim.org/scripts/script.php?script_id=300

2:39 eggsby: the issue being that VimL is something of a mindfuck if you're doing anything of reasonable complexity.

2:39 spjt: I tried to get into emacs before, but I never really kept with it until clojure, since being able to evaluate from the file you're editing is too useful.

2:40 rbxbx: spjt: fwiw slime.vim is pretty acceptable on that front... basically just run a repl inside of a named screen session and shoot code over to it...

2:40 spjt: it's not nearly as advanced, but comes pretty close in basic cases.

2:40 spjt: rbxbx: I've put too much work into my .emacs to go back :)

2:41 I wanted to learn clojure, somehow ended up learning more emacs lisp

2:41 rbxbx: spjt: and I'd not urge you to do so, but it's nice enough if you find yourself in vimland and want a lispy development cycle. (bonus! works for any language with a repl!)

2:42 eggsby: I wonder if I could set that up with tmux...

2:42 spjt: the boxes at work don't have the jvm either...

2:43 rbxbx: spjt: clojurescript running on type of python then? :p

2:44 spjt: rbxbx: is that a thing?

2:44 I think they have python 2.4 or something

2:44 rbxbx: spjt: https://github.com/halgari/clojure-py

2:44 spjt: I've totally given up on python now

2:44 ibdknox: that's not cljs

2:45 eggsby: heh, I play a lot with python and I haven't even played w/ that project

2:45 ibdknox: it's a port of JVM clojure unfortunately

2:45 rbxbx: spjt: I'd sort of doubt it being ready for a production app, but it seems to have been reasonably maintained.

2:45 ibdknox: ohhh.. Am I thinking of the one running on top of guile?

2:45 eggsby: clojure is pretty tied to the jvm, js is probably the closest it's gotten to running on another vm

2:45 ibdknox: there's a cljs impl that emits scheme

2:45 eggsby: lol

2:46 ibdknox: and soon a lua one

2:46 eggsby: js is my vm

2:46 lua-clj would rule

2:46 spjt: my main problem with python has been mostly "oh, I wrote it for this version, you have that version, so it doesn't work"

2:46 rbxbx: Can't keep up with you whacky clojure kids ;p

2:46 uvtc: ibdknox: Why "unfortunately"?

2:47 ibdknox: it's "wasted" effort

2:47 eggsby: spjt: I've never had that problem... you use virtualenvwrapper?

2:47 ibdknox: for example if they had started from CLJS we would be much closer to Clojure in Clojure

2:47 since they would've had to have solved eval and a number of other things

2:47 spjt: eggsby: I don't use anything.

2:47 ibdknox: the work would've been much more reusable for other implementations

2:47 say an LLVM one :)

2:48 wkmanire: spjt: virtualenv makes Python a lot easier to deal with for that specific problem.

2:48 spjt: is anyone working on a llvm clojure?

2:48 ibdknox: no

2:48 eggsby: has clojure had growing pains re: versioning compatibility?

2:48 ibdknox: err, not to my knowledge

2:48 eggsby: if not, do you think it will?

2:48 spjt: eggsby: not like python

2:48 uvtc: ibdknox: Thanks for your thoughts. I think clojure-py appeals to folks who like Clojure but who don't want to use the JVM for whatever reason.

2:48 ibdknox: eggsby: the 1.3 transition hurt a little

2:49 rbxbx: eggsby: I think leiningen helps a lot in that regards... if not directly solving the problem.

2:49 eggsby: like what about when java gets clojures or if the jvm gets tco

2:49 spjt: in python, everything breaks. even print doesn't work from 2 to 3

2:49 ibdknox: uvtc: yeah, that could've happened using the CLJS compiler too though :)

2:49 eggsby: errr

2:49 closures*

2:49 spjt: eggsby: it seems like that would just change the implementation

2:49 uvtc: ibdknox: Not sure I understand. You mean start with the cljs compiler and have it emit Python instead of JS?

2:49 ibdknox: uvtc: yep

2:50 uvtc: it's not unreasonable to assume that down the line JVM clojure might just be Java emitted from the CLJS compiler

2:50 might be quite a ways down the line

2:51 uvtc: ibdknox: Now might be a good time to contact the author of clojure-py about that. He's starting a pretty major rewrite at the moment, fwiu.

2:51 ibdknox: but as the CLJS stuff improves it becomes more and more appealing

2:51 spjt: I'm still not sure what cljs is for

2:51 eggsby: mmm languages written in their own langauge, so nice

2:51 uvtc: ibdknox: currently, afaik, clojure-py generates Python bytecode.

2:51 ibdknox: spjt: building awesome things

2:52 rbxbx: spjt: applications that need to target javascript?

2:52 spjt: basically every web app and some non.

2:52 ;)

2:52 ibdknox: spjt: like this: http://www.chris-granger.com/2012/02/26/connecting-to-your-creation/

2:52 spjt: rbxbx: I just started using javascript, but it's pretty weak stuff

2:52 eggsby: i've invested so much time into ~my existing javascript toolkit~ how can I abandon it

2:53 rbxbx: eggsby: uhhh. You're in the Clojure channel aren't you? Clearly you understand the value in using a powerful/sane toolchain

2:53 in spite of learning curve...

2:53 eggsby: plus if you've already taken to Clojure half the learning curve is already behind you.

2:53 spjt: ibdknox: what's he using to edit in that video?

2:54 ibdknox: he = me :)

2:54 and not sure I understand your question

2:54 eggsby: I saw a gist of using core.match for clientside validation... looked so nice

2:54 spjt: ok, you, what are you using to edit in that video? :)

2:54 ibdknox: it's a codemirror instance in the browser

2:54 spjt: you have a split screen editing on one side and making changes

2:55 ibdknox: the code's on github

2:55 if you wanna take a look

2:55 spjt: also of note: http://www.chris-granger.com/2012/04/12/light-table---a-new-ide-concept/

2:56 eggsby: ibdknox: that's a similar method to the in browser repl right?

2:56 ivan: there is no portable Python bytecode so generating it is kind of wrong; users are just lucky PyPy has the same as CPython's with a few addons

2:56 ibdknox: eggsby: sort of

2:56 eggsby: it's real-time evaluation, though the mechanism is similar, yeah

2:57 rbxbx: spjt: yeah. While javascript got a lot of things right the implementation is just awful... and the culture surrounding it. eek. Scarybad :D

2:58 eggsby: ibdknox: that's the sort of stuff that makes cljs look so exciting :)

2:58 ibdknox: :)

2:58 spjt: rbxbx: Yeah, I like it a lot more than I thought I would. I've heard so many bad things about it.

2:58 ibdknox: a practical starting point: http://www.chris-granger.com/2012/02/20/overtone-and-clojurescript/

2:59 as long as you know some about clojure

2:59 and have done a little JS before

2:59 michaelr525: ibdknox: hi, is it reasonable for 'lein run' in a webnoir project to take a few minutes to start the server?

2:59 rbxbx: Also if you're wondering how CLJS may fit into your webdev workflow the relevance crew have been working on http://clojurescriptone.com/ which is a pretty illustrative demo

2:59 ibdknox: michaelr525: minutes? that's way too long. What version of lein?

2:59 spjt: I've probably spent 10x as much time on clojure as javascript, yet I seem to know 10x more javascript.

3:00 ibdknox: spjt: what's your background?

3:00 amalloy: minutes is plausible if he's AOT compiling the whole thing transitively (that's the most common mistake i know of that would cause that)

3:00 ibdknox: ah

3:00 rbxbx: In clojure you spend cycles learning about higher levels of abstraction, in JavaScript you spend cycles learning to reconcile quirks ;)

3:00 michaelr525: ibdknox: Leiningen 1.7.1 on Java 1.6.0_23 OpenJDK 64-Bit Server VM

3:01 eggsby: hah rbxbx succinct

3:01 spjt: ibdknox: Not functional. :)

3:01 ibdknox: michaelr525: try adding ^{:skip-aot true} after :main in your project.clj

3:01 e.g. :main ^{:skip-aot true} my.ns.foo

3:02 spjt: JS is probably just similar to what you've done before. Almost all of the c-based languages are essentially the same

3:02 michaelr525: ok, let me try that

3:03 spjt: ibdknox: In C or Java, I might not always know the "best" way to do something, but I can almost always get it done. In clojure I still frequently get to a point where "I don't know how to do this, and I have no idea where to even start to find out how."

3:03 eggsby: likewise spjt, I just bug this chan when that happens :)

3:03 ibdknox: spjt: yeah, it takes a little time, but I promise it'll ultimately make you a better programmer in the long run

3:04 for many, Clojure is an eye opening experience

3:04 myself included :)

3:04 spjt: eggsby: hehe. I really try not to. Last thing I gave up on was taking a bunch of nested vectors within nested vectors and turning them into one list of vectors

3:04 eggsby: The problem is I didn't really learn anything, because I don't understand at all how it works.

3:05 Soraima: holaaa

3:05 alguien habla español

3:05 ??

3:05 lazybot: Soraima: Definitely not.

3:05 ibdknox: lol

3:05 eggsby: spjt: I recommend clojuredocs.com

3:05 Soraima: no no i am colombia

3:05 woman

3:05 eggsby: the examples clarify stuff a lot

3:05 Soraima: ???

3:05 lazybot: Soraima: Oh, absolutely.

3:05 Soraima: i am colombia woman 20 age

3:05 español

3:06 eggsby: I've found the actual (doc some-func) leaves a bit to be wanted... while they are all technically correct when you don't understand them they don't help at all

3:06 rbxbx: spjt: I find clojure better arms you to help yourself out...

3:07 If you haven't seen it, devn is working on a project that may be of interest to you https://github.com/devn/indiana

3:07 Allows you to finding (working) examples of the usage of a particular function... which can be very instructive (and fun!)

3:08 michaelr525: ibdknox: didn't seem to help, should i try to upgrade to lein 2?

3:08 ibdknox: michaelr525: you could, but I'd be surprised if that fixed it :(

3:08 rbxbx: Alright #clojure, to bed with me. It was real :)

3:09 spjt: http://pastebin.com/W2tJQfuQ This is an assignment I did for a class. I'm trying to do it in clojure, this is as far as I got: http://pastebin.com/ERNzwdgU

3:11 tomoj: spjt: maybe you want to do a direct translation, but you may want to look at https://github.com/daveray/seesaw

3:11 michaelr525: too bad there is no verbose option to see what's going on in these minutes

3:11 spjt: tomoj: I'm trying to do as much as possible by hand so I can understand what's going on

3:12 My latest problem with that is the (get-usable-canvas) function

3:12 well, that works, it returns a canvas, but (.getGraphics canvas) always returns nil.

3:14 or (.getGraphics (get-usable-canvas 512)) is what I think I was aiming for

3:14 it opens the window, but I can't get the Graphics object.

3:14 wkmanire: Raynes: Still there?

3:14 Raynes: wkmanire: Yep

3:15 wkmanire: Raynes: I'm working on the javascript for refheap.

3:15 Is there a particular reason why create.js and refheap.js are separate?

3:15 Raynes: wkmanire: Modularity.

3:16 wkmanire: I think I actually did it so I'd only have to load js for a given page on that actual page.

3:16 What are you working on?

3:16 wkmanire: Raynes: but these scripts aren't being dynamically generated and they're really small.

3:16 Raynes: *shrug*

3:16 wkmanire: It'd be better to put the scripts all together so that the browser caches them on the user's first visit.

3:17 Raynes: My problem with it is that I'm binding events to ids and stuff. If I reused those ids and classes on other pages, I'd end up with a mess.

3:17 But I'm not a JS guy. I thought this was better.

3:17 wkmanire: Ok, well I'm only looking at the scripts under resources/public/js

3:18 Raynes: Here, I forked it. Let me push refheap.js so you can see what I'm screwing with.

3:19 Raynes: I don't think I'd care if the scripts were all put in a single file again. It just 'feels' wrong, but like I said, not a JS guy so I wouldn't know how people do these things.

3:20 wkmanire: Raynes: https://github.com/wkmanire/refheap/commit/feb3bccbd77be27f6e4e7d6e04f4625a68b560b3

3:20 tomoj: we have a thing that takes the many files in the source and combines them into one file as require-able modules

3:20 there are many such things I believe

3:20 wkmanire: tomoj: requirejs?

3:20 ivan: Raynes: latency to get another script will generally be worse than the few extra KB to get it all the first time

3:20 tomoj: but for two files.. overkill :)

3:21 wkmanire: I guess that is one such thing, we use browserify right now

3:21 Raynes: ivan: Speed wasn't my concern.

3:21 wkmanire: Raynes: I'm just reading the code and playing with stuff.

3:21 Raynes: You have a lot of functions getting attached to the global scope (window)

3:21 In create.js

3:21 Raynes: wkmanire: Does that .post actually work? I could have swore I had a reason for using .ajax specifically, but I can't remember now.

3:22 spjt: hehe, I tried that seesaw thing and it doesn't compile. Oh well.

3:22 wkmanire: that aughta go into a psuedo-namespace. Javascript doesn't have real namespaces but you can cut down on collisions by using a single global object.

3:22 Raynes: yes, I tested it just now

3:23 Raynes: wkmanire: I have no idea what you just said.

3:23 wkmanire: Look at line 9 of create.js

3:23 When you declare a function like this it will get attached to the window object.

3:23 amalloy: Raynes: he suggests you use a function to "fake" a let, so you don't pollute the global namespace

3:23 wkmanire: Which is the global namespace of the browser.

3:24 Raynes: Oh, those weren't the kinds of collisions I was worried about, but sure.

3:24 wkmanire: So we almost exclusively use the "var foo = function () {...}" syntax

3:24 amalloy: (function() {var x = 1;})() // JS devs love this stuff

3:24 wkmanire: amalloy: Yep, sure do.

3:25 (function () { var x = 1;}())

3:26 ibdknox: amalloy: and by love you mean...

3:26 spjt: I hate that.

3:26 uvtc: ibdknox: ping?

3:26 wkmanire: Raynes: The only scope you get in javascript is function scope. And since there are no namespaces, collissions happen constantly. One thing I do is I wrap a function closure around all of my code so that I can gaurantee that for the scope of my module

3:26 ibdknox: uvtc: pong

3:26 wkmanire: that undefined === undefined, window === window and $ = jQuery

3:27 uvtc: ibdknox: in this thread http://groups.google.com/group/clojure-py-dev/browse_thread/thread/31e93bb179001dfa# the author mentions why translating to Python (rather than Python bytecode) is problematic.

3:27 Raynes: wkmanire: Is that what this $( function ( $, window ) { } ( jQuery, window)); crap or whatever is?

3:27 uvtc: ibdknox: "I started with that idea, but for instance, clojure supports

3:27 multi-statement lambdas and Python does not. So the compiler has to

3:27 drop to the bytecode level to support all the features it needs. "

3:27 wkmanire: Raynes: Right.

3:27 spjt: I have a webpage at work I need to keep open, and the people that made it got a little too excited with the javascript so I needed to make another script that overrides all of the javascript on the page. Only problem is I can't override anonymous functions because there's no name to overwrite.

3:27 Raynes: I have no idea what this code means at all.

3:27 ibdknox: uvtc: unless there's something I'm not thinking through, you can make the CLJS compiler emit bytecode too

3:27 wkmanire: Raynes: :)

3:28 You seem to dislike javascript.

3:28 ibdknox: who doesn't ;)

3:28 Raynes: No, I just haven't done much of anything with it and I need to understand your code if I'm ever going to work with it again.

3:28 uvtc: ibdknox: thanks.

3:28 Raynes: You might not always be around to maintain my javascript.

3:29 wkmanire: Raynes: he he, I'll explain this stuff afterwards.

3:29 ivan: uvtc: I don't think you need to generate lambdas (even though you can trick them into doing multiple expressions)

3:30 wkmanire: hopefully clojurescript will catch fire and we'll have a better option in the future.

3:30 I'd love to see <script type="text/clojurescript"> be recognized natively. Assuming that clojurescript. Or text/coffeescript for that matter.

3:30 ivan: wkmanire: that could work once the ClojureScript compiler can be compiled to JavaScript

3:31 I doubt browsers are going to start supporting clojurescript natively any time soon

3:32 wkmanire: ivan: I talk about this a lot with one of my coworkers. I just wish it were an option. I wish I could configure the browser to let any script interpreter I want handle script type X. In a sandboxed user account of course. Not unlike a shebang but with less bite.

3:33 ivan: <script type="text/javascript" src="clojurescript.js"></script>

3:33 wkmanire: The interface would be like CGI but you get handed a DOM.

3:33 ivan: (I know you want a better thing, but it's pretty hard)

3:34 I mean, a lot of V8 would have to change

3:36 wkmanire: oh, that's a very different thing if it's running outside the browser process

3:36 interesting.

3:36 wkmanire: ivan: For me, the biggest use case would be custom client apps for internal business applications.

3:36 ivan: there are some browser testing/automation frameworks that do something like what you want

3:36 possible Windmill in Python, but I forgot

3:37 possibly

3:38 wkmanire: you can connect to Chrome and tell it to run certain JS

3:38 I think there is a better API in development, but it's geared towards browser automation/testing

3:38 maybe you can take over their mailing list with your use case

3:39 wkmanire: ivan: So if a business has a large software package written in Python and they want to use it to do stuff on various client machines, then the client machine just needs a copy of the library and a web browser and they're automatically up to date + the user is still clicking the little blue E to start their day.

3:39 ivan: He he, I doubt it.

3:39 Raynes: wkmanire: ibdknox just explained your code.

3:39 It's just I didn't recognize the new on-ready stuff.

3:40 And he is also explaining why you passed that stuff in.

3:40 wkmanire: Raynes: Ahhhh, sorry, I forgot to mention.

3:41 Raynes: Also, the browserid API has been updated. I have never worked with browserID so I went onto MDN and read about the navigator.id object.

3:42 Raynes: They want you to use navigator.id.get now.

3:43 Raynes: wkmanire: Feel free to update that too.

3:43 wkmanire: What else are you going to poke around with?

3:44 wkmanire: For tonight I'm just going to clean up create.js.

3:44 Another time perhaps we can discuss combining the javascript.

3:44 I think api.js is unused correct?

3:45 Raynes: wkmanire: I'd appreciate it if you could explain the things you clean up for me too, if you've got time.

3:45 API is used.

3:45 wkmanire: No problem.

3:46 Raynes: create.js is the only significant JS I have, IIRC.

3:46 I'll do the combining part.

3:46 wkmanire: Raynes: If you'd like to pop into another channel for this, or perhaps talk to me over a messenger client that'd be fine.

3:47 Raynes: We have a #refheap channel! :D

3:47 wkmanire: Most of this stuff has nothing to do with clojure at all. I'm sort of flooding here.

3:47 Ok, I'll join that channel then.

3:52 wmealing_: lein search can take a _really_ long time, is there any tricks i could do to speed it up.

3:52 its "downloading from central repo.. maven.org"

3:52 Downloading index from central - http://repo1.maven.org/maven2 ... this may take a while... no kidding.

3:53 3 hours so far.

3:55 how big are we talking about for this download.

3:55 Raynes: Unless you're on dialup, something went wrong.

3:55 wmealing_: dsl 8 down 1 up

3:56 Mb, of course.

4:00 noncom: the lein-eclipse plugin is dated by 2 years, is it safe to go with it?

4:02 _KY_: If I use "send", the argument passed to the func is the state of the agent, not the agent, right?

4:04 wmealing_: 109k/s down for 3 hours, suspect.

4:04 _KY_: (Nevermind...)

4:18 wmealing_: Raynes, where should it be putting its files, in this circumstance ?

4:18 Raynes: ~/.lein/indices

4:18 clojurebot: I don't understand.

4:18 Raynes: You should probably stop it and try again at this point.

4:19 It's only like 70MB.

4:34 _KY_: How can I write (fn [_] 13) in # notation?

4:34 Seems to require an "identity function"

4:34 raek: _KY_: you can't

4:34 Bronsa: (,#(do 13))

4:34 ops

4:35 raek: well, you can do (constantly 13) or #(do 13)

4:35 Bronsa: ,(#(do 13))

4:35 clojurebot: 13

4:35 _KY_: I see...=)

4:35 Thanks

4:35 raek: the #() syntax requires the body to be a call form, which "13" isn't

5:19 Cozey: Hello. Why (conj {} [:a 1]) works, and (conj {} '(:a 1)) doesn't ?

5:20 `(conj {} '(:a 1))

5:20 ,(conj {} '(:a 1))

5:20 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>

5:21 mittchel: Afternoon everyone

5:26 wmealing_: my this is frustrating

5:27 Borkdude: I'd like to analyze some Clojure code with https://github.com/frenchy64/analyze - is he here?

5:30 never mind, twitter

5:38 wmealing_: technomancy, is there a chance we can get some progress bars for the "downloading from central repo" or is that outside of leiningen ?

5:39 antares_: wmealing_: it belongs to pomegranate

5:39 fliebel: Cozey: because a vector of 2 is special-cased to represent a map entry in some places. At least, that is what I think it is.

5:39 antares_: I think Aether (Maven library for dependency management) supports it

5:40 * wmealing_ nods

5:40 Cozey: mhm, so a proper way would be to (apply hash-map list-or-vector)

5:43 fliebel: Cozey: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentMap.java#L23

5:44 Cozey: Perfect, thanks!

5:44 fliebel: &(conj {:a 1} {:b 2})

5:44 lazybot: ⇒ {:b 2, :a 1}

5:45 fliebel: so if it's not a mapentry or a vector of 2, it should be a sequable thing that is a seq of map entries.

5:45 &(seq {:a 1})

5:45 lazybot: ⇒ ([:a 1])

5:46 fliebel: &(map class (seq {:a 1}))

5:46 lazybot: ⇒ (clojure.lang.MapEntry)

6:18 Cozey: thanks!

6:18 mittchel: Hey, I've got a question regarding Comp. If you have this: (let [x 4 y 1] ((comp + - -) x y)) what happens is it takes -4 and adds it with 1 so you'll have -3 as answer, but I thought it would take -4 and -1.. why is it doing +4 + -1 when you have 2x -

6:20 raek: mittchel: ((comp + - -) x y) is the same as (+ (- (- x y)))

6:21 (+ (- (- 4 1))) → (+ (- 3)) → (+ -3) → -3

6:23 mittchel: So first it calculates -4 +1 = -3 and (+(-3)) stays the same, so answer is -3

6:24 raek: no, first it calculates 4 - 1, yielding 3. then it negates 3, yielding -3, then it passes -3 to + with only one argument, which does nothing, yielding -3

6:25 ((comp f g h) x y z) is the same as writing (f (g (h x y z)))

6:26 mittchel: Yep I know it turns it around haha

6:26 raek: that is, the f and g functions only receive one argument

6:27 mittchel: there is probably a way to express your original intention in clojure code too

6:34 matessim: ibdknox, any news with light table?

6:53 mittchel: (defn max-except-first[[x & args]] (apply (max(rest args))))

6:53 When I call it like this: (max-except-first [100 78 7 9 12]) it gives me an error

6:53 Saying wrong number of args passed

6:53 its a list right

6:54 Bronsa: ,((fn [[x & args]] (apply max (rest args))) [100 78 7 9 12)

6:54 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

6:54 Bronsa: ,((fn [[x & args]] (apply max (rest args))) [100 78 7 9 12])

6:54 clojurebot: 12

6:54 Bronsa: you want (apply max (rest args))

6:55 not (apply (max (rest args)))

6:55 mittchel: darn:P

6:55 close

6:55 Bronsa: also, put a space before the args vector

6:56 (defn f [])

6:57 mittchel: Well it returns 12 which isn't correct. It should subtract the first one and give me the max of the rest (so 78)

6:57 Bronsa: well.

6:58 ,(let [[x & args] [1 2 3 4]] {:x x :args args})

6:58 clojurebot: {:x 1, :args (2 3 4)}

6:58 Bronsa: ,(let [[x & args] [100 78 7 9 12]] {:x x :args args})

6:58 clojurebot: {:x 100, :args (78 7 9 12)}

6:58 Bronsa: if you call rest on args you get (7 9 12)

6:58 so either

6:59 ,((fn [[x & args]] (apply max args)) [100 78 7 9 12])

6:59 clojurebot: 78

6:59 Bronsa: or

6:59 ,((fn [args] (apply max (rest args))) [100 78 7 9 12])

6:59 clojurebot: 78

7:00 mittchel: but what differs your last one from mine? since you call rest on args there

7:01 Bronsa: yeah i call rest

7:01 but i dont destructure

7:01 mittchel: Oh it has 1 input

7:01 Bronsa: destructuring like that you call rest once

7:01 if you call rest again, you get the vector removed of the two first items

7:02 mittchel: Ahh

7:02 and your first example includes destructerin

7:02 Bronsa: yeah

7:03 mittchel: Is that available in the documentation? I have been searching for it:/

7:03 Bronsa: what?

7:03 clojurebot: what is 2d6

7:04 Bronsa: the destructuring syntax?

7:04 http://clojure.org/special_forms it's here

7:05 check where it documents `let`

7:07 mittchel: Hmm

7:08 I don't understand the main goal of restructuring.. is it to transform certain sequential types into a vector/list of any of that kind?

7:09 Or is it like you know you'll receive a list so you can take it a part?

7:16 Cozey: mittchel: think destructuring is just for convenience, so you can take apart the structure in one line, instead of writing a (let ..) to take values from inside the structure

7:17 mittchel: cozey: thanks for the clarification

7:35 Borkdude: am I wrong or was it possible to annotate code on github before?

7:35 was this feature removed?

7:39 ah found it

7:42 wmealing_: i think it was..

7:43 * wmealing_ ponders how he broke lein

8:50 Borkdude: wmealing_: broke lein?

8:51 wmealing_: my local config, lein search never seems to return

8:51 downloads ~ 45mb, then just sits there.

8:52 it puts a file in /tmp/leinNNNnnNNnNnNnnn

8:52 then thats all i get.

8:52 "lein search ring" is such a command

8:55 Borkdude: wmealing_: sorry, I never used it

8:55 wmealing_: when it works, it rocks.

8:55 Borkdude: wmealing_: what does it do?

8:56 wmealing_: automating clojure projects without setting your hair on fire

8:56 so the story goes.

8:56 https://github.com/technomancy/leiningen

8:56 lots of plugins to make it all shiny.

8:56 Borkdude: wmealing_: I know, but I mean lein search

8:56 wmealing_: but its plenty useful even by itself

8:56 oh

8:56 finds jars for my project.. apparently

8:56 i'd like to install drools

8:56 HCumberdale: Hi ;)

8:57 Seeing strange behaviour with monger & map-reduce

8:57 xeqi: wmealing_: lein2-preview4 has a progress indicator

8:57 wmealing_: xeqi, sweeet.

8:58 xeqi: not that that will help if it's stalling somewhere else

8:58 wmealing_: yeah, but at least i'll have an idea if its doing anything

8:58 or nothing

9:00 xeqi: I usually just use search.maven.org or go to clojars.org and search there

9:02 is there something you're looking for with ring?

9:02 or was that just an example

9:02 wmealing_: that was an example

9:02 i was looking for drools fusion actually

9:03 i'm pretty new to how things work in java

9:09 Borkdude: ehm, what was the leiningen command to see the resolution of dependencies?

9:10 ah, :tree

10:39 twhume: Anyone able to help with a newbie question on lazy sequences? I'm trying to generate a breadth-first tree of the form A, B, C, AA, AB, AC, BA, BB, BC, CA, CB, CC, AAA, AAB, AAC.

10:40 _KY_: If I have a huge list in memory, I modify it to get list2, but I also keep a reference to list1 -- how can I make sure they share parts and not waste too much memory?

10:41 twhume: are you trying to generate that?

10:41 twhume: KY: yes.

10:42 So far I have (defn make-tree "" [node l depth]

10:42 (if (< (count node) depth)

10:42 (let [children (map #(str node %) alphabet)]

10:42 (lazy-cat children (mapcat #(make-tree % l depth) children) l)

10:42 )))

10:42 …which gives me ("A" "B" "AA" "AB" "AAA" "AAB" "ABA" "ABB" "BA" "BB" "BAA" "BAB" "BBA" "BBB") - close but not quite there.

10:43 _KY_: Shouldn't it be completely lazy?

10:43 fliebel: twhume: So are you "counting", generating all possible "Words"?

10:43 HCumberdale: Hi!

10:44 Is there a fn to count the occurances of a object in a map

10:44 twhume: fliebel: the count is there to set a maximum limit on the depth I go to. I'm not sure if the issue with my implementation is lack of understanding of lazy-cat or a poor implementation of the algorithm.

10:44 HCumberdale: like ("x" "y" "z" "x") => ("x" 2 "y" 1 "z" 1)

10:45 _KY_: Yes there's a library function for that...

10:45 fliebel: _KY_: I don;t think you can share parts of a linked list. You can share the end of one though.

10:45 $findfn [1 1 2] {1 2 2 1}

10:45 lazybot: [clojure.core/frequencies]

10:46 _KY_: ,(doc frequencies)

10:46 clojurebot: "([coll]); Returns a map from distinct items in coll to the number of times they appear."

10:46 wmealing_: the cdoc help is awesome.

10:46 _KY_: =)

10:47 HCumberdale: thx

10:47 _KY_: twhume: sorry I'm not that familiar with lazy sequences...

10:47 twhume: np, thanks for popping up.

10:48 fliebel: twhume: What I would do is do (range), convert to n-base numbers, and then replace the symbols you want :P

10:48 _KY_: fliebel: say if I use assoc to change part of the list... but the list may be huge...

10:48 fliebel: _KY_: assoc on a list? ##(assoc '(1 2 3) 4)

10:48 lazybot: clojure.lang.ArityException: Wrong number of args (2) passed to: core$assoc

10:49 _KY_: twhume: look in library "combinatorics", if your goal is just to do it not to learn

10:49 twhume: fliebel: heh, dirty. But I don't think that'll work for me. This is a model for the thing I *really* want to do (generating vast streams of Java byte code - don't ask!) and I don't think that'd work for the real problem.

10:49 KY: ideally I'd do both! Will have a look, thanks.

10:50 fliebel: _KY_: Vectors do share stuff, if that's what you mean. Then assoc is fine, as well as subvec

10:50 (doc subvec)

10:50 clojurebot: "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."

10:50 twhume: KY: omg, that's *exactly* what I'm looking for. Thanks!

10:51 _KY_: =)

10:52 fliebel: I have the deeply nested structure consisting of vectors of maps, recursively

10:52 fliebel: *I have a deeply nested structure consisting of vectors of maps, recursively

10:53 I want to keep references to old-structure, new-structure at the same time

10:54 twhume: KY: OK, that's clojure.math.combinatorics now - does that mean it's part of the core clojure dist?

10:54 fliebel: twhume: no, you need to ad it as a dep

10:55 tmciver: _KY_: you get that kind of sharing for free with clojure. :)

10:56 fliebel: _KY_: I'm not sure I understand what you're doing, but mostly, if you just change one itme, you'll be fine. If you're mapping, you're probably not.

10:56 HCumberdale: How to turn {"x" 2, "y" 1} into '( {:name "x" :count 2} {:name "y" :count 1} ) ?

10:56 _KY_: twhume: (:use [clojure.math.combinatorics :only [cartesian-product]])

10:56 Oops, that's my code... change it to yours =)

10:57 HCumberdale: (map #( {:name %1 :count %2} ) (ccount-tags)) << does not work,... map uses each entry and not a pair

10:57 twhume: anything in your project.clj?

10:57 (sorry, total newbie)

10:58 fliebel: (map #( {:name (key %1) :count (val %1)} ) {"x" 2, "y" 1})

10:58 &(map #( {:name (key %1) :count (val %1)} ) {"x" 2, "y" 1})

10:58 lazybot: clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap

10:58 _KY_: tmciver: thanks... that's the confirmation I was looking for... =)

10:58 fliebel: &(map (fn [[k v]]{:name k :count v} ) {"x" 2, "y" 1})

10:58 lazybot: ⇒ ({:name "x", :count 2} {:name "y", :count 1})

10:58 _KY_: twhume: hold on...

10:58 fliebel: HCumberdale: ^

10:59 _KY_: :dependencies [[org.clojure/math.combinatorics "0.0.2"]]

11:00 Try that, if you're using lein

11:01 twhume: lovely, thanks

11:03 xumingmingv: how to translate the following java code to clojure? Map<String, Integer> map1 = new HashMap<String, Integer>(); ?

11:04 tmciver: xumingmingv: no need to do initial construction; just use literal syntax: {"str1" 1 "str2" 2}

11:04 xumingmingv: map1 will need to be used in java code, clojure's map is not a HashMap in java, right?

11:06 twhume: KY: that works great. Thanks again.

11:06 tmciver: xumingmingv: clojure's map implements java.util.Map ...

11:06 xumingmingv: oh, that's wonderful, thanks twhume

11:09 fliebel: &(.put {:a 2} :b 2)

11:09 lazybot: java.lang.UnsupportedOperationException

11:09 fliebel: ah

11:11 tmciver: fliebel: oh yes, only the read-only portions.

11:13 ,(.get {:a 1} :a)

11:13 clojurebot: 1

11:27 fliebel: Is there something like Mori for Java?

11:29 gfredericks: that's an interesting idea.

11:29 would require the whole clojure jar at runtime though

11:29 the cljs case is not so kitchen-sink

11:31 $google lib-2367

11:31 lazybot: [fredericksgary/lib-2367 · GitHub] https://github.com/fredericksgary/lib-2367

11:31 gfredericks: fliebel: I think you could whip one up pretty quick with that lib ^

11:31 fliebel: gfredericks: Only because of advanced compilation, right?

11:32 gfredericks: and cljs just doesn't have as much runtime shtuff as clj does

11:32 e.g. the whole namespace infrastructure

11:33 fliebel: hm, I think the datastructures are already pretty usable as-is

11:33 gfredericks: are they?

11:34 I guess I don't know exactly how much functionality the classes have on them

11:34 I'd expect the more familiar you are with clojure the weirder that approach would feel

11:35 wouldn't that mean calling methods instead of functions? :/

11:35 fliebel: yea

11:35 (java.lang.PersistentVector. 1 2 3)

11:35 &(java.lang.PersistentVector. 1 2 3)

11:35 lazybot: java.lang.ClassNotFoundException: java.lang.PersistentVector

11:36 gfredericks: if you exported stuff you could do all the seq functions too

11:36 xeqi: &(clojure.lang.PersistentVector. 1 2 3)

11:36 lazybot: java.lang.IllegalArgumentException: No matching ctor found for class clojure.lang.PersistentVector

11:36 gfredericks: don't know if that's an insane idea or not

11:36 fliebel: &(clojure.lang.PersistentVector. 1 2 3)

11:36 lazybot: java.lang.IllegalArgumentException: No matching ctor found for class clojure.lang.PersistentVector

11:36 fliebel: hm

11:36 gfredericks: could just export clojure.core and use clojure from java :D

11:37 fliebel: What is the meaning of "Object... items"

11:37 gfredericks: oh the export thing in lib-2367 doesn't do varargs :/ that'd suck

11:37 that's java varargs

11:37 fliebel: so why does my above code not work?

11:37 gfredericks: &(clojure.lang.PersistentVector. (into-array [1 2 3]))

11:37 lazybot: java.lang.IllegalArgumentException: No matching ctor found for class clojure.lang.PersistentVector

11:38 gfredericks: I don't know.

11:38 fliebel: and why does IFn not use java varargs?

11:38 gfredericks: that I don't know either.

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

11:38 gfredericks: nor does clojurebot

11:39 fliebel: I don't see a constructor that does what you were trying to do

11:39 just factories

11:39 &(clojure.lang.PersistentVector/create 1 2 3)

11:39 lazybot: java.lang.IllegalArgumentException: No matching method: create

11:39 gfredericks: &(clojure.lang.PersistentVector/create (into-array [1 2 3]))

11:39 lazybot: ⇒ [1 2 3]

11:39 fliebel: oh, right

11:39 I skipped to much boilerplate :P

11:39 gfredericks: I think there's some low-level equivalence between java varargs and arrays

11:40 fliebel: hm

11:40 gfredericks: oh

11:40 I bet IFn doesn't use that so it can be lazy

11:40 fliebel: huh?

11:40 gfredericks: you can pass a lazy seq as the varargs to a clojure fn

11:40 wmealing_: does anyone here use lein-localrepo and if so can they give me an example of their project.clj ?

11:40 gfredericks: &(apply (fn [a b c & _xs] (+ a b c)) (range))

11:40 lazybot: ⇒ 3

11:41 espeed: How do you explicitly specify a namespace when using “apply” on a function?

11:41 gfredericks: ^ infinite arguments there

11:41 espeed: same way you specify a namespace on any symbol: foo.bar/baz

11:41 fliebel: gfredericks: that's restfn, I think. ifn is call(arg1) call(arg1 arg2) ... cal(.. args15 Object... rest)

11:41 gfredericks: fliebel: okay I don't know what I'm talking about then.

11:42 fliebel: gfredericks: neither am i, actually.

11:42 $source apply

11:42 lazybot: apply is http://is.gd/Qs77VS

11:42 fliebel: lazybot: apply is not there at all!

11:43 gfredericks: lazybot's source dohicky is broke

11:43 raek: I think a vararg method is just a method with a an array argument as its last argument and with a special attriute set

11:43 gfredericks: def apply

11:43 clojurebot: def apply

11:43 fliebel: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java#L89

11:43 gfredericks: raek: in java or clojure?

11:43 raek: gfredericks: in java

11:44 gfredericks: and a "special attribute" is some kind of reflective metadata?

11:44 raek: they are backwards compatible with methods taking arrays

11:45 it is stored in the .class data like other flags (e.g. public, private, static, final, etc)

11:45 I think it is accessible throught reflection

11:45 so if you just ignore the attribute (like clojure does) they look like array-methods

11:46 gfredericks: raek: so do you know how clojure varargs are implemented?

11:46 fliebel: aha! https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFn.java#L154

11:47 raek: well, last time I check (these things might have changed since then) IFn contained about 20 different methods

11:47 espeed: gfredericks: that doesn't seem to work if the function name is passed in as a var: (fn [func & args] (apply foo.bar/func args))

11:47 raek: each for a specifict arity and one that takes some of the arguments as an array

11:47 HCumberdale: is it possible to write clojure.string/lower-case shorter?

11:47 gfredericks: espeed: oh I see. yes this doesn't quite make sense, since func is a local, so we'd have to know more context about what makes you want to do that

11:48 espeed: See http://stackoverflow.com/questions/10572443/how-do-you-explicitly-specify-a-namespace-when-using-apply-on-a-function-in-cl

11:49 fliebel: HCumberdale: ??

11:49 lazybot: fliebel: Uh, no. Why would you even ask?

11:50 HCumberdale: like static import clojure-string to call lower-case directly?

11:50 ibdknox: (:use [clojure.string :only [lower-case]]) in your ns decl

11:50 gfredericks: espeed: it seems like in your ideal version, the caller to your graph function would not really have control over what they're passing in

11:51 that would be very odd and unexpected behavior. I think better to just let the caller do whatever they can in their own namespace to make things succinct

11:52 that could mean (:require [bulbs.neo4jserver.graph :as g]) instead of :as graph, for instance

11:52 or (:use [bulbs.neo4jserver.graph :only [graph out1]])

11:55 espeed: gfredericks: thanks -- I'll explore those options. On another note, is the graph function bad design? Someone on the mailing list said they didn't like the approach "returning

11:55 a function that takes a function and applies it over the other args."

11:56 raek: that's just a higher order function. nothing wrong with that.

11:56 gfredericks: yeah without knowing what you're doing in a lot more detail there's nothing to criticize there. But changing the HOF so that you could only pass in functions from that ns would be bad design :)

11:56 espeed: that's what I thought, but I'm just getting started with clojure so I wasn't sure

11:58 raek: in Clojure it's not as ideomatic to treat a namespace as a map as it is in languages like Python and Ruby

11:58 gfredericks: hmm. I would not have thought of ruby in those terms.

11:59 raek: is there some common example of that being done in ruby?

12:00 raek: if you only want the client to be able to use a certain set of the functions, just make a dispatch map from keywords to functions

12:00 gfredericks: hrm, actually I'm not so sure about the Ruby case...

12:01 it was a feeling I got when I programmed in Python

12:01 gfredericks: is it fair to say that it is unidiomatic in clojure to interact directly with the ns infrastructure at all?

12:01 in application code?

12:02 raek: I think of it as similar to using reflection in Java in application code

12:03 gfredericks: makes sense

12:03 raek: most cases I have heard of where people have wanted to do this could have been solved by putting functions in data structures

12:04 gfredericks: there was an exchange on the clojure-dev mailing list where hiredman mentioned that ns's are mutable, and got me wondering what would be the implications if they were instead references to immutable data structures

12:05 probably some kind of low-level performance implications :/

12:05 raek: ...for instance various kinds of callback mechanisms

12:05 gfredericks: although are namespaces generally used at runtime?

12:06 raek: if you load a namespace with only functions and constants, I guess you could eval the op level forms in one go and then make a map from it

12:06 but when you reach a macro halfway through a file, it can access the already evaled half

12:07 gfredericks: well I mean a ns could just be an atom. And interning a var means (swap! my-ns assoc symbol var) or whatever

12:07 raek: I suppose you could incrementally assoc new definitions, though

12:13 espeed: I suppose I could keep the graph.clj clean and only put the graph function def along with the desired namespaces, and then you could use :use instead of :require

12:23 brainproxy: is there syntax in clojurescript whereby when I access a js obj property, the compiled code will use square brackets + string notation instead of dot notation?

12:23 something like (.+prop myobj) instead of (.-prop myobj)

12:24 to the compiled code will have myobj['prop'] instead of myobj.prop

12:24 *so

12:50 mmarczyk: brainproxy: (aget obj "prop") should do that

14:05 amalloy: anyone here know how to use the clojure dev wiki? i want to write a summary of the current issues with creating new Reducible sources, and it's not at all clear where to put it

14:29 mye: I'm confused about what (:import ) is given and how it finds the classes. I have org.semanticweb.owlapi.apibinding but get

14:29 error: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.semanticweb.owlapi.apibinding.OWLManager

14:29 but the owl-api-3.3.jar file is in the -cp according to lein classpath

14:30 when I do ,i in the SLIME repl and tab complete it shows me clojure and swank stuff

14:30 but not owl-api stuff...

14:30 raek: mye: you should give it a full class name

14:31 (:import org.semanticweb.owlapi.apibinding.OWLManager)

14:32 also, :import does not cause the class to be loaded. the jvm does that automatically. it only provides a shorter name for the class in the ns.

14:32 mye: raek, it seems to work with a final dot ^^

14:32 https://github.com/stain/owlapi-clj/blob/master/src/owlapi_clj/core.clj

14:32 here the same is being imported but with a space

14:33 raek: yes. you can import multiple classes from one package in one go: (:import (java.util Map List))

14:33 it's a shorthand for (:import java.util.Map java.util.List)

14:34 if you don't get an error when you type org.semanticweb.owlapi.apibinding.OWLManager in the repl, then the class name is right

14:36 once that works, you should also be able to do (ns ... (:import (org.semanticweb.owlapi.apibinding OWLManager)))

14:36 evaling OWLManager in that namespace shoud not result in an error if evaling org.semanticweb.owlapi.apibinding.OWLManager did not

14:36 mye: raek, I get an error, but doing C-x C-e on the (ns )works

14:37 and compiling and loading works too from the source file

14:37 which without the dot didn't work

14:37 raek: mye: what does the code that doesn't work look like?

14:39 mye: raek, I typed org.semanticweb.owlapi.apibinding.OWLManager in the slime repl and get the class error

14:39 raek, I have no code that uses the class yet

14:40 raek: mye: also, have you restarted slime after you added the dependency?

14:40 mye: I think so several times by doing the clojure-jack-in

14:40 raek: that should be enough

14:41 mye: the thing i dont get is, shouldnt owl stuff be in ,i with tab completion

14:41 maybe the class name isn't correct after all

14:41 how do I know what is embedded int he .jar?

14:41 brainproxy: mmarczyk: that works well, thanks; more general question (researching now via google, etc.) ... is it possible to "decorate" an extern such that the closure compiler will not attempt to shorten the name of not only the extern symbol

14:41 raek: wrong class name or missing dependency would explain it

14:41 brainproxy: mmarczyk: but also any properties

14:42 raek: I think there is a lein plugin that can be used for this

14:42 mye: one way is to open it. it's just a zip file.

14:42 brainproxy: mmarczyk: i mean properties of the object referenced by the extern

14:43 raek: mye: which [group/artifact "version"] did you use?

14:44 mye: raek, good idea. So the last name is the .class file? and everything before a folder?

14:44 fliebel: What is it with Clojure development that makes it hard to contribute? I contributed to 2 programming languages in the last month, while my clojure patches just get stuck in Jira.

14:44 mye: raek, [net.sourceforge.owlapi/owlapi-api "3.3"]

14:44 raek: mye: exactly

14:45 amalloy: fliebel: jira, and a single committer who wants to be very careful thet everything that gets in is extremely well thought out

14:45 raek: mye: which repo is that one in?

14:45 mye: raek, OK there is no apibinding folder ^^

14:46 raek, you mean source code for owlapi?

14:46 raek: mye: I couldn't find that library when I searched for it in the maven repo

14:47 mye: raek, I built it with mave and did maven install and it installed it locally

14:47 it's only in clojars in an outdated version

14:47 fliebel: amalloy: That is something... Lack of deep though is one of the feelings I had when reading about Mirah and clojure-py

14:47 *thought

14:47 raek: ah, ok

14:49 mye: Java libraries are usually in the Maven repo (unless another Clojurian added it to Clojars)

14:49 mye: raek, I think I have to declare more dependencies, I just realized that the maven build has seemingly made it into many small libraries

14:53 raek, just typed the class name in the repl without error. Indeed I had to add a specific dependency in project.clj for apibinding :0

14:53 raek, thanks for helping me out

14:53 raek: mye: ok, good. no problem :)

14:57 XPherior: Whenever I do lein run in an empty core file, I get a null pointer exception. Sort of confused why that happens. https://gist.github.com/2689742

14:58 Er, not in. On*

15:00 jasonjckn: XPherior: in any case, you need a :main for lein run to work

15:00 in project clj

15:01 XPherior: Yep, my main points to the correct file, jasonjckn

15:01 jasonjckn: XPherior: and you still get that?

15:01 and if you add a defn it goes away?

15:02 file a bug report

15:02 XPherior: jasonjckn: Added my project.clj to the gist.

15:02 Wait, what do you mean a defn?

15:02 jasonjckn: you need a (defn -main [& args] ..) in your core file

15:03 XPherior: Aw balls. I knew I was missing something like that. Okay, yeah. No bug, just wasn't clear on that

15:03 jasonjckn: yah error sucked

15:04 XPherior: Maybe I'll try to put in a better error message in a pull request.

15:05 wkmanire: java.lang.Exception: lib names inside prefix lists must not contain periods

15:05

15:05 What is a prefix list?

15:05 jasonjckn: wkmanire: context?

15:05 amalloy: wkmanire: you only get one level of nesting in your import/require

15:06 (:require (foo [bar.baz ...])) isn't allowed - the bar.baz part can't have a separator

15:06 raek: wkmanire: you cannot do this: (:require (a.b c.d e.f)), you have to do this (:require a.b.c.d a.b.e.f)

15:06 amalloy: (:require (foo.bar [baz ...])) would be fine

15:07 wkmanire: I keep getting bitten by this.

15:07 How do I :require multiple modules with aliases?

15:08 I'm trying (:require [foo.bar :as something] [foo.bar2 :as somethingelse])

15:08 amalloy: that should work fine

15:08 raek: wkmanire: that one should be ok

15:09 (:require (foo [bar :as something] [bar2 :as somethingelse])) should be fine too

15:10 amalloy: jasonjckn: i think whether repeat should be Counted and Seqable probably depends on how this other stuff turns out

15:10 wkmanire: I must be messing up in a different source file. Thanks for the help.

15:10 jasonjckn: amalloy: *nods* yah i'm waiting for a resolution

15:11 amalloy: thanks for doing all the heavy lifting :)

15:11 wkmanire: Yep, I found it.

15:11 amalloy: don't tell rich, but i think my defseq macro is a cool idea, and if it's not in core i'll probably put it in useful

15:12 wkmanire: I had nested my requirements together in a single list. :require [[foo.bar :as something] [bar.foo :as somethingelse]]

15:12 jasonjckn: Yah it's certainly very useful, you're basically using macros as a form of generic programming, i can see why he doesn't like it though, just like C++ templates you get a tone of code duplication in the binary

15:13 ideally ArrayList would accept a protocol

15:13 or at least ISeq

15:14 amalloy: ArrayList really isn't the issue. the point is clojure sequences should be acceptable in any context that expects an java collection

15:14 i suppose the code duplication is an issue, but i expected him to dislike it mostly because it's a large poorly-considered addition to core

15:14 jasonjckn: right, I mean all cases analogous to ArrayList

15:15 amalloy: sure. it'd be nice if interfaces were protocols

15:16 jasonjckn: I think we're better off without reductions and clojure.core being separated completely as oppose to partially

15:17 ideally it'd be unified, but it's all or nothing in my view

15:17 otherwise you have to memorize what's where

15:19 with*

15:24 reducible-lazy-seq is a respectable solution

15:25 amalloy: yeah, it's an interesting tradeoff

15:39 mudphone: Yay, I just submitted an update to my Clojure API iPhone app!

15:39 (feedback and comments welcome)

15:39 oh, and I should say, anyone on this channel can have a free copy

15:42 Raynes: If only I had an iPhone

15:42 wkmanire: Raynes: Why do you want an iPhone?

15:43 oh

15:43 der

15:43 Raynes: Hahaha.

15:48 mudphone: ha

15:49 I would build it for Android too… but, it was a "speed project"

15:50 I might be able to see if a friend would deploy something similar on Android

15:58 mittchel: Evening!

16:00 mudphone: Morning!

16:01 Scriptor: afternoon?

16:02 wkmanire: < tomorrow!

16:06 mittchel: It's 22:05 here haha

16:07 Raynes: 15:05 or gtfo

16:07 Bronsa: 22:06 here

16:10 mudphone: 10:08

16:12 mittchel: Why is clojure that hard lol haha

16:12 mudphone: I think it's unlearning C that's hard. :)

16:13 neotyk: hello everyone

16:13 hyPiRion: Hello

16:14 mittchel: haha lol

16:15 I really need to go to bed, but I need to complete this exercise for school tomorrow for Clojure.. last one :P It's about converting an Schema program that calculates the square root into CLojure

16:15 mudphone: or, in my case, Ruby and OO

16:15 jasonjckn: mittchel: your school teaches clojure?

16:15 mittchel: Yep, my teacher is in here sometimes haha

16:15 mudphone: (def x 10); (* x x)

16:15 done

16:16 jasonjckn: mittchel: consider yourself very fortunate

16:16 mudphone: mittchel: which school?

16:16 mittchel: haha mud phone I wish it was that easy, I have to use the newton method. So basically transform this: http://mitpress.mit.edu/sicp/full-text/sicp/book/node12.html

16:16 Hogeschool Utrecht in Netherlands

16:17 neotyk: mittchel: I wished my uni would show me any lisp

16:17 mittchel: They've pushed us into JAVA for 3 years and now we got Clojure:P

16:17 mudphone: oh, square *root*

16:17 mittchel: Yea i've been trying for a while, but haven't had any success

16:17 * mudphone reading instructions more carefully in the future

16:19 mittchel: is 'guess' already available in clojure?

16:24 jasonjckn: mittchel: i'm not sure if this conforms exactly to SICP but this works https://gist.github.com/2690031

16:24 mittchel: holy crap

16:24 I actually got it

16:24 jasonjckn: :)

16:25 mittchel: Basically I just changed it to the Clojure formats

16:25 jasonjckn: let's see your code

16:27 mittchel: Let me pastebin it

16:27 http://pastebin.com/73qgq1iZ

16:27 Basically it's exactly the same

16:28 jasonjckn: cool

16:29 Bronsa: except there's no `abs` and `square` in clojure

16:29 mittchel: How come it gives me the correct output?:P

16:30 brehaut: perhaps you have the functions already defined in your repl

16:30 (like improve, which is also missing from your paste)

16:30 dreish: What do you get when you type #'abs and #'square?

16:30 mittchel: #'Week2/abs

16:30 jasonjckn: heh

16:30 Bronsa: oh

16:30 jasonjckn: he's a student

16:30 mittchel: => #'square?

16:30 CompilerException java.lang.RuntimeException: Unable to resolve var: square? in this context, compiling:(NO_SOURCE_PATH:1)

16:31 brehaut: mittchel: whats the definition of improve?

16:31 dreish: Question mark was part of my sentence, not the symbol, sorry.

16:31 So: #'square

16:31 But I'm guessing it's going to be #'Week2/square or something similar.

16:31 mittchel: Well I did copy some page from a tutorial

16:31 So if I close my repl and try it again, it shouldn't work right?

16:32 Bronsa: mittchel: http://sprunge.us/VSMf

16:32 also, comments in clojure are marked with `;` not with `//`

16:32 mittchel: Bronsa did you just translate the schema to clojure?

16:32 Bronsa: yeah

16:33 *scheme :)

16:33 mittchel: oh typo

16:33 haha

16:33 how come mine is compiling and working?

16:33 Bronsa: well, if you try it from a fresh repl it shouldnt

16:34 jasonjckn: it's fine… his teacher probably did something

16:34 mittchel: I do understand your code

16:34 Let me try a fresh one

16:34 Bronsa: also because, you are using `good-enough?` and `sqrt` from `sqrt-iter` /before/ defining them

16:34 mittchel: yep unable to resolve abs

16:34 Bronsa: so either you have to declare them or move their definition up

16:35 mittchel: Bronsa, I'm still wondering what that guess is

16:35 is that something in Clojure or?

16:36 You don't really define it

16:36 Bronsa: it's the name of an argoument

16:36 when you call (sqrt-iter 1.0 4), guess is 1.0

16:36 mittchel: Alright

16:37 What does that X do?

16:37 TEttinger: I need to pass a value from a java enum to a clojure function, but...

16:37 https://github.com/Insubstantial/insubstantial/blob/master/substance/src/main/java/org/pushingpixels/substance/api/SubstanceConstants.java

16:37 Bronsa: then you see it's not good-enough so you improve it and it becames 2.something

16:37 TEttinger: the enum is declared as a static value of a class or something weird

16:37 mittchel: aahh nice:)

16:37 BRonsa: thanks a lot

16:37 Bronsa: you continue improving it untill it is good-enough

16:37 then you return it

16:37 TEttinger: and I can't figure out anything with the . and / for static and package stuff

16:38 Bronsa: mittchel: np

16:38 mittchel: Almost can go to bed now haha

16:39 Bronsa: how cool your teacher teaches you clojure and uses SICP

16:39 TEttinger: (the specific value I need is FocusKind.NONE , but I can't treat that enum as a package, so...?)

16:39 Bronsa: you're lucky

16:40 srid`: where does avout persist values of atoms/refs? they don't seem to

16:40 exist in the zk tree. further, restarting the repl makes those values

16:40 go away. i am going to try the mongo driver.

16:46 neotyk: TEttinger: you should be able to call (.paintFocus enum)

16:47 TEttinger: neotyk, what I want to do is change the app from showing the focus as a dashed line inside buttons, to not showing any focus

16:47 but how would I import a static enum from a class?

16:47 raek: TEttinger: (:import org.pushingpixels.substance.api.SubstanceConstants$FocusKind)

16:47 TEttinger: SubstanceConstants$FocusKind/LEFT

16:48 TEttinger: dollar sign, eh? where is that documented?

16:48 Bronsa: TEttinger: it's internal JVM notation i think

16:48 neotyk: TEttinger: in java interop docs

16:49 amalloy: jasonjckn: oh yuck. LazySeq is final, so i can't just implement ReducibleLazySeq as a subclass of LazySeq

16:49 TEttinger: thanks, I looked for enum and didn't find anything

16:49 raek: TEttinger: this dollar thing is how the java compiler names nested classes

16:50 TEttinger: yay it works! thanks

16:50 raek: so what you call FocusKind actually has SubstanceConstants$FocusKind as the real class name

16:50 iwo: hi, can anyone tell me how to add a directory to the lein repl classpath?

16:51 is there an command line argument i can use when i start lein repl?

16:51 neotyk: TEttinger: it is same as SubstanceConstants.FocusKind in java

16:52 iwo: or is there a clojure function i can invoke to cause a new item to be added to the classpath while the repl is running?

16:53 mich: hello

16:55 espeed: Is there much of a performance penalty when calling a function using ns-resolve?

17:02 tomoj: when deciding between (fn [a b]) and (fn [b a]), are there important concerns besides the relative likelihoods of usage inside -> vs ->>?

17:03 I mean, is thinking of ->/->> use cases a good heuristic for deciding?

17:04 neotyk: tomoj: put more static arguments first

17:05 tomoj: more static as in less changing

17:06 tomoj: that means, if you count all the arguments ever passed in at each position, the first one should have the fewest groups and highest counts?

17:06 dnolen: do you plan to expose protocols and records in mori? I started looking at the implementation of these but can't tell yet how difficult it would be to port to js

17:07 dnolen: tomoj: wasn't planning on exposing that, there's a lot of compiler magic for that stuff to work.

17:07 neotyk: tomoj: like (fn [connection operation]), there will be many operations on single connection

17:10 the-kenny: Any chance on getting clojure.data.priority-map running in Clojurescript?

17:11 dnolen: why not add a cljs variant to the repo

17:11 tomoj: dnolen: the macros, right? or darker magic?

17:11 dnolen: ?

17:11 tomoj: protocols are subject to namespacing.

17:11 foo.prototype.clj$core$ISeq$first

17:11 tomoj: yeah, I don't see yet why it should be difficult to handle that in js

17:11 just verbose maybe

17:12 dnolen: making JS folks write that by hand doesn't make sense.

17:12 tomoj: right..

17:12 dnolen: also Mori isn't intended to attract super sophisticated devs.

17:12 the-kenny: dnolen: Hm yeah, I'll give it a try

17:12 tomoj: :)

17:12 dnolen: might as well write ClojureScript

17:12 espeed: Is there much of a performance penalty when calling a function using ns-resolve?

17:12 dnolen: it's for people who like underscore.js and want something better, or people who need sensible data structures.

17:12 the-kenny: Just hoped there was already an implementation :)

17:13 tomoj: I was planning to implement IReduce and ISeq in JS

17:13 but actually I did decide I should just write it in clojurescript

17:13 then they get two 100KB libraries..

17:14 actually

17:15 if I implement IReduce in my cljs library and they depend on it and mori, will mori's clojurescript even see my stuff?

17:15 dnolen: tomoj: nope

17:16 neotyk: dnolen: I was looking at http://dev.clojure.org/jira/browse/CLJS-204

17:17 dnolen: neotyk: yeah need IComparable and relevant implementations of it.

17:17 neotyk: dnolen: IComparable should be based on java Comparable?

17:19 dnolen: neotyk: look at how it's done in Clojure on the JVM.

17:19 tomoj: wait, "see my stuff" here just means e.g. "look up a namespaced -reduce method in the object", doesn't it?

17:20 dnolen: tomoj: yes, which advanced compilation will have completely removed.

17:21 neotyk: dnolen: for JVN, could you look at http://dev.clojure.org/jira/browse/CLJ-975

17:21 dnolen: tomoj: that said the other point of Mori is so that the library is easy to customize or extend for ClojureScript users.

17:23 neotyk: don't know anything about CLJ-975

17:23 tomoj: I don't understand - if I write a cljs library which exports functions that return instances of my deftype which implements IReduce, and they depend on this library and mori, their mori.reduce won't work with it due to advanced compilation?

17:24 dnolen: tomoj: not unless it's compiling with Mori no.

17:24 neotyk: dnolen: it was a bug reported: https://groups.google.com/forum/?fromgroups#!topic/clojure/3z3JtXhcDB0

17:24 dnolen: tomoj: or you have a custom build of Mori that doesn't go through advanced compilation.

17:25 neotyk: yes but I don't know what you want me to do - I'm usually review CLJ tickets.

17:25 I don't usually I mean.

17:26 tomoj: I see

17:27 neotyk: dnolen: roger

17:27 tomoj: so advanced-compiled mori.first(foo) doesn't look up foo.prototype.clj$core$ISeq$first

17:27 crazy

17:27 dnolen: tomoj: nope

17:27 tomoj: because it knows all the protocol implementations at compile time

17:27 dnolen: tomoj: if it did, Mori would be ~20k gzipped.

17:27 wouldn't be

17:28 tomoj: no, because advanced compilation rewrites all names.

17:28 tomoj: oh, I see

17:28 so yeah extend-type from js is doomed..

17:29 I guess then the best solution at this time would be to reexport all of mori in my library and have people use its mori :(

17:29 or just forget about js

17:29 dnolen: tomoj: similar problems exist in the JS world.

17:30 tomoj: you want some UI library but you don't want the whole thing.

17:30 tomoj: so the consumer could use a non advanced mode compiled Mori and your JS lib

17:30 tomoj: and run Closure themselves.

17:31 tomoj: I was wondering if maybe npm can be made to help with that

17:31 but it seems unlikely

17:31 dnolen: tomoj: wait you want this for Node?

17:32 tomoj: well, yeah

17:33 I hadn't realized mori was only 20K gzipped so that it was reasonable to use in the browser

17:33 dnolen: tomoj: yes

17:33 tomoj: so browser would be good too

17:33 dnolen: tomoj: so just use non-advanced mode compiled version of Mori.

17:33 arohner: are there up to date docs on lein native deps anywhere?

17:34 it seems to be built in to 1.7, but I can't figure out how to use it

17:34 dnolen: arohner: I'm suprised people are still using it. Doesn't lein have it's own thing now?

17:34 tomoj: and then for browser I can provide a build script that advance compiles mori and my lib into a min.js

17:34 arohner: dnolen: I guess? I'm trying to use the built in thing

17:34 dnolen: arohner: oh, k. Yeah don't know anything about that.

17:37 tomoj: dnolen: would need to publish mori-simple to npm and have people depend on that instead of mori, yes?

17:39 dnolen: tomoj: require("mori/simple") does that work?

17:40 tomoj: yeah

17:40 comes with some performance penalty I guess?

17:41 dnolen: tomoj: some yes since many function expressions won't get lifted.

17:42 tomoj: if some wrote a pass for the compiler to do that we could avoid relying on GClosure for that.

17:48 colors and design need work but the content is coming along http://swannodette.github.com/mori

17:55 tmciver: dnolen: FYI: that page looks good in Chrome, but in FF the text in the main content area is "on top of" the scroll bar for the naviagation frame.

17:57 dnolen: tmciver: thanks for the report. Focusing more on the content at the moment - will look into display issues when the content is more fully-fleshed out.

18:01 arohner: ok, I got passed the previous native deps problem. Now it appears my native jar is not happy unless jna.library.path is set, but lein appears to set java.library.path

18:01 frozenlock: I'm having some difficulties with seesaw. When an action is too long to execute, the java frame 'hangs'. Is there a way to make it continue to work as usual and only updates the different widgets when the data is finally available?

18:04 dreish: ,((fn ^Long [^long x ^long y] (num (+ x y))) 1 2)

18:04 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.NoSuchMethodError: clojure.lang.IFn$LLO.invokePrim(JJ)Ljava/lang/Long;>

18:05 dreish: ,((fn [^long x ^long y] (num (+ x y))) 1 2)

18:05 clojurebot: 3

18:05 dreish: Is this a known bug?

18:05 tomoj: oh, I see, (prim-seq js/arguments 0) works. was miffed there was no way to extend the protocol

18:06 I wonder why prim-seq doesn't default to 0

18:06 dnolen: tomoj: that's fixed in master

18:06 tomoj: cool

18:19 ForSpareParts: Is there a way to do inline local binds in Clojure? Similar to, say, the <- operator in Haskell's do notation?

18:20 brehaut: dnolen: with mori, you would need to implement the hashing method to use arbitrary JS objects in the value semantics right?

18:20 (ie to use a random JS object as the key in a map)

18:20 dnolen: brehaut: which is already works.

18:20 brehaut: oh right

18:21 i wonder how useful mori is with roy

18:21 dnolen: brehaut: dunno.

18:22 raek: ForSpareParts: you mean with something else than 'let'?

18:22 Raynes: ForSpareParts: Not really, no.

18:22 raek: I think by inline he means 'a way that doesn't involve nesting the code under let'.

18:22 ForSpareParts: Raynes: right.

18:22 Raynes: Basically, he is the devil and wants to corrupt us all.

18:22 ;P

18:23 ForSpareParts: SATAN

18:23 etc. etc.

18:23 I take it this would be horribly unidiomatic, then?

18:23 raek: well, you can still do (let [a (f), b (g), c (h)] (i a b c))

18:24 ForSpareParts: raek: yeah, that would work. the issue I'm having is that sometimes I don't really WANT to think about something until right before I use it

18:24 raek: which isn't too different from do a <- f; b <- g; c <- h; return i a b c

18:24 ForSpareParts: and nesting let upon let upon let feels kinda ugly

18:24 weavejester: Why would you need to nest lets?

18:24 Raynes: You shouldn't need to nest let.

18:25 weavejester: ,(let [x 1 y (+ 1 x)] y)

18:25 clojurebot: 2

18:25 weavejester: Each expression in let can refer to the expressions that come before it.

18:27 ForSpareParts: weavejester: so I get that part -- my issue with that is that sometimes it seems better, organizationally, to have the definition come right before the code that uses it

18:28 but I'm open to the idea that I'm, broadly speaking, doing it wrong

18:28 Is my real issue that I'm trying to write functions that are too big...?

18:29 tomoj: it may be helpful to see an example

18:29 weavejester: Typically your functions should only be several lines of code long.

18:29 ForSpareParts: OK.

18:29 dreish: Except when they aren't.

18:30 weavejester: dreish: Yes :)

18:30 ForSpareParts: I started wondering about this while I was working on a BST implementation.

18:30 weavejester: But as a rule of thumb it's not bad.

18:30 dreish: It's a good ideal to push toward, but not to the breaking point.

18:30 ForSpareParts: I just found that my functions were turning into these huge unreadable messes.

18:31 And I wished I could just give something a *name* and use it later (as I would in an evil imperative language ; )

18:32 dreish: The definition of defmacro in clojure/core.clj is somewhat long.

18:32 weavejester: dreish: Yes, but all the really long functions in core tend to be fairly complex macros

18:32 ForSpareParts: A BST shouldn't be that big a function, should it?

18:34 ForSpareParts: Not massive, no. But my delete is really awkward, and it just seems... I dunno, off somehow? Like I'm missing something, making it harder than it is.

18:36 weavejester: Is your code online?

18:36 ForSpareParts: I just pasted it, actually

18:36 http://pastebin.com/pHHgJBAK

18:36 it's not completely correct right now

18:36 delete can trim big chunks off the tree

18:37 dreish: Those aren't long.

18:37 They'd be even shorter if you didn't have standalone closing parens. ;-)

18:37 ForSpareParts: Ah, true. I can fix that.

18:38 raek: the nested ifs could be written using cond

18:39 ForSpareParts: raek: thanks! I had forgotten about cond -- that would probably make it more readable.

18:40 raek: in swap-delete the two lets are very similar

18:41 ForSpareParts: you think they'd be better as a separate function?

18:41 raek: maybe you could make both branches use, say, other-node instead of pred-node and succ-node

18:41 I can make a paste

18:43 dnolen: brehaut: if you have any design thoughts about http://swannodette.github.com/mori/

18:43 ForSpareParts: raek: if you could, I'd appreciate it.

18:43 dnolen: brehaut: please send them along

18:43 brehaut: dnolen: dangerous ;)

18:43 dnolen: what do you think about bright yellow?

18:44 dnolen: brehaut: was thinking about something greenish - if you want to play around feel free to fork and let me know what you come up with.

18:45 brehaut: dnolen: sorry the yellow was a poor joke. some people on the channel (raynes) dont think much of my choice of colors

18:45 tomoj: can lein cljsbuild accomodate advanced-compiling multiple cljs libraries together, using all their exports?

18:45 brehaut: dnolen: today is extremely busy, but i'll give it some thoughts

18:45 dnolen: brehaut: thx much.

18:46 tomoj: well, nevermind, it certainly can't accomodate what I want anyway

18:48 raek: ForSpareParts: https://gist.github.com/2690616

18:50 ForSpareParts: the only difference between the two branches is the value of pred-node/succ-node. pred-val/succ-val and deleted-pred/deleted-succ are calculated the same way

18:50 as well as the body of the let

18:51 I also replaces == with =. == is some special numerical operator that is rarely used.

18:52 ForSpareParts: raek: thank you!

18:52 that already looks a LOT cleaner and more readable

18:53 An unrelated question: what do you all edit with? I've been using La Clojure, but it doesn't seem to support debugging...

18:53 raek: I'm using Emacs

18:55 ForSpareParts: Are there good emacs extensions for clojure code completion, breakpoints, repl debugging, that sort of thing?

18:56 raek: yes, but I haven't used breakpoint debugging much myself (by it should be possible to do, I think)

18:56 jasonjckn: i've used breakpoints a little bit, the interface was not very good

18:56 tmciver: ForSpareParts: you can get that kind of debugging using slime/swank.

18:56 raek: the repl often works quite well as a substitute for breakpoints for simpler or purely functional code

18:57 ForSpareParts: raek: noted.

18:58 tmciver: is there a good newbie tutorial for that setup somewhere? I can kind of get around in Emacs, but I'd be lying if I said it didn't intimidate the hell out of me...

18:58 jasonjckn: print debugging is much better for loops and stuff, you get a view across time

18:58 raek: I think slime/swank has the most pain-free intergration with leiningen of all the IDEs currently

18:58 counterclockwise (the eclipse plugin) is probably the second best

18:59 ForSpareParts: yes. only look at the offical docs. period.

18:59 ForSpareParts: https://github.com/technomancy/swank-clojure

18:59 you also need this first: https://github.com/technomancy/clojure-mode

19:00 kaoD: CCW is not bad but Emacs with Clojure mode seems much powerful

19:00 raek: clojure-mode provides does highlighting and indentation (basically)

19:00 kaoD: *much more

19:00 speaking of which, I couldn't get CCW to launch my application's -main

19:00 and lein integration is awful

19:01 raek: and slime + swank gives you the ability to interact with a running clojure instance (repl + reloading code)

19:01 kaoD: which basically renders CCW useless

19:01 jasonjckn: ForSpareParts: http://clojure.bighugh.com/

19:01 ForSpareParts: CCW has a repl and reload, actually. Although for the life of me I couldn't figure out keyboard commands to switch back to the code from the repl.

19:01 jasonjckn: looks out of date

19:02 raek: don't use clojurebox

19:02 it predates leiningen

19:03 it doesn't provide a way to use external libraries or source directories (!)

19:03 it's basically just a repl

19:03 ForSpareParts: OK.

19:03 tomoj: ForSpareParts: note there is no need for blank-bst ##(assoc nil :value 3)

19:03 lazybot: ⇒ {:value 3}

19:04 tomoj: &(:left (assoc nil :value 3))

19:04 lazybot: ⇒ nil

19:04 tomoj: also (not (nil? foo)) should usually just be foo

19:04 and (if (nil? x) z y) can be (if x y z)

19:04 and (cond :else nil) is the same as (cond)

19:05 raek: tomoj: the last one was mine... :-)

19:05 tomoj: I guess it could be nice to be explicit

19:06 raek: (ok, apparently you can tell clojurebox about your libraries and source directories)

19:06 ForSpareParts: tomoj, not sure I follow: are you saying I don't need blank-bst because I could just use nested assoc statements onto a nil map?

19:07 tomoj: right, in other words (defn make-bst [val] {:value val})

19:07 raek: the setup process used to be much more complicated. now it's basically just 1) install clojure-mode in Emacs, 2) install the lein-swank or swank-clojure plugin in Leiningen, 3) start hacking with M-x clojure-jack-in

19:09 ForSpareParts: tomoj: OK. Also, are you saying that (if (:left swap-node)) is equivalent to (if (not (nil? (:left swap-node)))

19:09 ?

19:09 tomoj: the only exception is if (:left swap-node) might be false, which won't happen here

19:10 ForSpareParts: got it.

19:10 OK, I'm gonna go try to get Marmalade working and install clojure-mode! Wish me luck!

19:11 raek: you can also use (if-not x ...) instead of (if (not x) ..) as an abbreviation

19:11 ForSpareParts: Also, thanks for all your help, everyone.

19:11 raek: if you use emacs-starter-kit, you get marmalade included by default

19:12 ForSpareParts: Ah, cool. Thanks.

20:11 muhoo: is there some way to print stack traces without throwing exceptions?

20:12 sah, cool, found it (.printStackTrace (Exception. "fobbar"))

20:17 gfredericks: &(with-out-str (.printStackTrace (Exception. "fobbar")))

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

20:17 * gfredericks pops lazybot's thread bindings

20:18 kaoD: lol

20:29 wmealing_: careful, i think he likes it.

20:31 kaoD: do you like it, lazybot???

20:31 lazybot: kaoD: How could that be wrong?

20:31 kaoD: that's what I thought

20:37 gfredericks: he thinks it's bad but he likes it at the same time.

20:39 tmciver: the real question is . . . will you still respect him in the morning?

20:41 gfredericks: depends on what his thread-bindings are like by then

20:42 kaoD: I pictured that on my mind

20:44 and I can tell you for sure that you don't want to know how I picture thread-binding

20:44 s

20:44 wait a second, this channel is logged, right?

20:44 my account's been hacked

20:44 this isn't me!

20:45 gfredericks: kaoD: say some more embarrassing stuff then

20:47 elliottw: oh man, jokes in the clojure channel

20:49 gfredericks: lazybot started it

20:49 kaoD: I thought it was me, what a relief

20:49 also, couldn't anytthing more embarrasing gfredericks

20:57 oakwise: dnolen: I think core.logic is broken against clojurescript since cd7afc0 of cljs. Set => PersistentHashSet

20:58 kaoD: oh, now that I think of it

20:58 is there any plugin system ready for clojure or I gotta cook my own?

20:58 nothing fancy, something along the lines of lazybot's plugins

21:01 gfredericks: kaoD: what's something you would want to do with such a system?

21:03 kaoD: pluggable sound modules (generators and effects)

21:09 gfredericks: I specifically like the idea of hookable events

21:11 ozataman: Hi all. If I have a function producing a seq and I'd like to apply or to this resulting seq, what is the best way? simply doing (or (map ...)) doesn't work, as I think I need the contents of that list spliced into the call to or.

21:11 kaoD: apply ?

21:11 gfredericks: ozataman: since or is a macro you can't do that at runtime. there's a different function you want

21:11 ozataman: doesn't work - or is a macro, right?

21:11 * gfredericks tries to think of it

21:11 ozataman: there is an apply-macro

21:11 but doc says it's evil :)

21:11 gfredericks: yeah that sounds evil

21:12 kaoD: yeah, I always wondered, why is it evil?

21:12 gfredericks: macros are a compile-time thing, he wants to do this at runtime

21:13 (keep identity my-seq) might work

21:13 ,(doc keep)

21:13 clojurebot: "([f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects."

21:14 gfredericks: or (first (filter identity my-seq))

21:14 kaoD: why not reduce?

21:14 &(reduce #(or % %2) [true true true true])

21:14 lazybot: ⇒ true

21:15 ibdknox: you want it to stop

21:15 kaoD: &(reduce #(or % %2) [true true false true])

21:15 lazybot: ⇒ true

21:15 ozataman: yeah, I could use reduce, but then it's reinventing a simple pattern, it feels like

21:15 ibdknox: (first (filter identity ..)) is the way to go

21:15 ozataman: I come from haskell, where we can just do "or [a,b,c,d]" and you're done :-)

21:15 gfredericks: ibdknox: except for chunking :(

21:15 ozataman: oh sorry, "any [a,b,c,d]"

21:15 ibdknox: gfredericks: you can't have everything

21:15 ;)

21:15 jasonjckn: there's a blog post on 'disabling' chunking if that's what you want

21:16 ibdknox: ,(doc some)

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

21:16 ibdknox: ,(some identity [false nil 4 false])

21:16 clojurebot: 4

21:16 ibdknox: for some reason I thought some nuked its return

21:17 ozataman: great, that'd do it!

21:17 thanks guys

21:17 trying to work through some euler problems to catch up with clojure :)

21:28 wkmanire: Why is UI layout so damned hard.

21:28 wmealing_: doing it right, or doing it at all ?

21:29 wkmanire: both.

21:29 wmealing_: i hear ya buddy.

21:29 i got a minion web developer who helps out with my ui "questions"

21:29 he often tells me "you fool, do it this way, it will save you hundreds of hours"

21:29 okay.jpg

21:30 wkmanire: wmealing_: Sounds wise.

21:30 :D

21:30 wmealing_: talking to these designer people, even though they sometimes seem a bit pretentious really saved me a lot of upfront development time.

21:31 you doing swing or html or otherwise ?

21:31 wkmanire: seesaw

21:31 wmealing_: ah, be thankful you're not doing raw java swing ;)

21:31 wkmanire: It would probably be going faster if I would have taken the time to study the whole seesaw library before starting to use it.

21:31 kaoD: anyways, the problem is not user experience nor API

21:31 swing just sucks

21:32 wkmanire: Can't just weesle your way through it.

21:32 kaoD: "please swing, put this control there"

21:32 wmealing_: kaoD, nope.. nope nope

21:32 kaoD: "NO WAY!" SLAM

21:32 wmealing_: hah

21:33 wkmanire: It's almost like they wanted to avoid assuming the user has a monitor.

21:33 kaoD: Swing is ugly and mean :(

21:33 wmealing_: its probably the best they could do at the time though

21:34 kaoD: actually it's not so bad, but I think that a markup approach makes it better for the developer

21:35 since, well, you're laying out things around

21:35 * wmealing_ does like the way glade works

21:35 wkmanire: Honestly, once you get used to HTML, and once you accept its limitations, it's pretty hard to beat.

21:36 wmealing_: target the most supported "spec" don't do anything crazy and you're 90% of the way there.

21:37 kaoD: wmealing_: does Glade really work? I got tired of NetBeans layout editor since 90% of the time what you saw was not what you got

21:38 and laying out UI's in code is even more frustrating

21:38 wmealing_: kaoD, it does for the cases that I use it for, i've mainly used it for python/mono work though

21:38 wkmanire: Glade is nice.

21:38 kaoD: never worked with GTK

21:39 wmealing_: what you see in the designer is what it ends up behaving like

21:40 wkmanire: I actually asked in here about laying out frames using XML.

21:40 but it was suggested that Clojure, being itself a form of data, is sufficient.

21:40 wmealing_: it.. kind of is, i think

21:40 i'm by no means an expert on any of this tbh

21:40 just a casual hacker.

21:41 i looked at writing a dsl in clojure then thought.. its not worth it because the language is mostly there already.

21:42 kaoD: I didn't try seesaw myself, but as I see it, clojure is some kind of rich markup language

21:42 the boundaries are thin

21:42 exaggerating, of course

21:43 wkmanire: I think it would be easier to work with as XML honestly. FOr layout work.

21:43 That is probably because I'm just more familiar with that style of doing things.

21:43 pcavs: Is there an example of using clojure.core.logic.arithematic?

21:43 * wmealing_ doesn't come from a java background

21:44 wmealing_: i tried pulling in some custom jars last night from maven

21:44 scarey stuff.

21:45 was i delusional or was there clojure on the python vm ?

21:45 ivan: clojure-py

21:45 wmealing_: have you used it ?

21:45 ivan: I've confirmed that the REPL works, heh

21:45 kaoD: but isn't python a bit bulky?

21:45 wmealing_: :)

21:46 compared to jvm ?

21:46 meh

21:46 ivan: pulling in jars from maven is pretty scary

21:47 wmealing_: ivan, i'm using lein as my build tool. there was all kinds of massage that i needed to do to make it work.

21:47 i tried localrepo, but not coming form a java background, i dont know what the talk of artifacts etc mean

21:47 ivan: I build everything from source, which is not for the sane ones

21:48 wmealing_: you let lein do the build ?

21:48 hiredman: ivan: scary how?

21:48 ivan: no, I haven't gotten around to using lein to improve my life

21:48 hiredman: maven is just an http client

21:48 wmealing_: so is wget, but it doesn't talk about artifacts

21:49 ivan: hiredman: they're being pulled it over HTTP and the sigs aren't checked

21:49 in*

21:49 hiredman: ivan: but it doesn't have to

21:49 you can pull over https and point to your own server

21:50 ivan: true

21:51 wmealing_: I have some Python script that builds everything using Ant-like commands

21:51 hiredman: https is kind of ridiculous since you are just pulling publicly available zip files anyway

21:51 ivan: wmealing_: sometimes it just calls ant

21:52 wmealing_: ant is like make, right ?

21:52 ivan: yes

21:52 startling: hi! I know python and good chunks of scheme and haskell, plus bits and pieces of other languages. how should I learn clojure?

21:53 kaoD: but much more headaching

21:53 wmealing_: startling, you sound just like me

21:53 kaoD: startling: www.4clojure.com and a good book

21:53 * wmealing_ agrees

21:53 kaoD: that's pretty much what you need

21:54 startling: thanks!

21:54 kaoD: startling: and, from my own experience, mess with Emacs ASAP if you're not comfortable with it

21:55 I'm yet to find a good full-fledged IDE

21:55 they all get in my way to coding instead of making my life easier

21:56 and mess with Leiningen ASAP too

21:56 and look around GitHub for good code to learn from

21:56 wmealing_: i found misaki a good place to start

21:57 compact, clean.

21:57 kaoD: Mire is a good start too

21:57 https://github.com/technomancy/mire

21:58 its branches are step-by-step guides to coding a full app

21:58 wmealing_: nice

21:59 kaoD: apparently there's a (paid) screenscast to it

21:59 but I didn't need it to learn my first steps through it

22:01 startling: kaoD: would you recommend emacs over vim for clojure?

22:02 * wmealing_ would

22:02 wmealing_: but if you know vim, dont change.

22:02 startling: i've been meaning to learn emacs anyway. might be worth it

22:03 kaoD: startling: emacs integration is better

22:04 apparently most lispers do emacs so...

22:04 startling: yeah

22:04 kaoD: there's an Eclipse plugin, Counterclockwise, which is not too bad

22:04 but it's not too good either

22:04 cgag: it's unfortunate since vim has such better key bindings

22:04 startling: cgag: tell me about it. :(

22:05 cgag: i have a pretty decent evil set up but it's not the same

22:05 kaoD: yeah, and I like the notions of commands instead of hotkeys

22:05 *notion

22:05 tos9: vim has been fine for me

22:06 kaoD: IMHO commands are easier to remember, which leads to easier integration in your mindset

22:10 startling: tos9: when the Joy of Clojure book says the source is available, is that just source for the code they use? or the entire book?

22:10 tos9: startling: iirc just the former

22:10 ivan: that's the source for the examples

22:10 startling: ah. no wonder I couldn't find any text

22:11 tos9: if there's a good free tut these days it's probably fine

22:13 kaoD: startling: wait a second, I have a post in a forum with some links

22:13 http://www.mediavida.com/foro/9/programacion-funcional-scala-clojure-etc-446872

22:13 ignore the fact that it's in spanish

22:13 just go to the Clojure section

22:13 and click under the link below "Enlaces"

22:14 *links

22:14 startling: kaoD: lovely, thanks

22:14 kaoD: np

22:22 echo-area: TimMc: ping

22:23 TimMc: pong

22:23 kaoD: smack!

22:26 gfredericks: are small vectors stored efficiently or do they all have a length-32 array underneath?

22:26 echo-area: TimMc: I read your message. As I tried, proxy won't work even if a second function with different arity is provided and delegated to its parent class. Proxy seems using a hash-map to represent bound methods, is this the thing you mentioned as "do with proxy"?

22:29 I wanted to write my own version `proxy-call-with-super' but there seems no way to avoid the same problem this way.

22:30 So currently the only solution is to fall back to Java.

22:31 * ibdknox chuckles

22:31 ibdknox: I got my O'Reilly mention: https://twitter.com/#!/timoreilly/status/201852654182334466

22:31 cgag: awesome

22:32 ivan: &(type [])

22:32 lazybot: ⇒ clojure.lang.PersistentVector

22:32 cgag: when do we get to see that next demo?

22:32 echo-area: And thank you for paying attention to it, Tim :)

22:32 ibdknox: cgag: a weekish

22:35 ivan: gfredericks: from reading the source, I'm guessing sometimes the array is sometimes < 32; see trimmedTail

22:36 muhoo: oh dear god that's annoying. something is silently including clj-stacktrace, i have no idea what, it's not on the classpath, but it's in loadad-libs

22:37 and whatever version it is, it's not honoring {:test-color false}

22:37 hiredman: gfredericks: https://github.com/hiredman/tuples

22:38 ivan: hiredman: any reason to use this over defrecord?

22:39 should be in your performance section :)

22:40 muhoo: aha! it's ring-devel. naughty naughty....

22:43 TimMc: echo-area: Yeah, proxy is kind of terrible. I think you can do what you need with gen-class, though.

22:45 echo-area: TimMc: Is there plan for fixing proxy, BTW?

22:45 TimMc: echo-area: Going to bed now, though. (And I haven't really used gen-class's full feature-set.)

22:45 echo-area: No idea. I'll probably file a bug for it, but who knows...

22:45 echo-area: TimMc: Okay, good night

22:46 ivan: hiredman: cool. looks like records are just as slow as vectors.

22:50 ForSpareParts: Hey, has anybody here had trouble installing lein? It seems to have downloaded the standalone jar, but when I try to do anything it complains about missing dependencies

22:53 wmealing_: nope, usually just get the binary, run it.. then it doe sthe rest.

22:53 which procedure are you following

22:54 ivan: ForSpareParts: try clearing ~/.m2?

22:55 ForSpareParts: ivan: just tried that and reinstalled. no dice.

22:56 wmealing: just going off the instructions here https://github.com/technomancy/leiningen

22:57 wmealing_: ForSpareParts, by "do anything" i assume you mean a lein command like "lein new projectname" , on the command line ?

22:57 ForSpareParts: yeah

22:58 wmealing_: can you pastebin the message ?

22:58 ivan: instructions followed on a clean Ubuntu 12.04, lein new and lein repl work here

22:59 * wmealing_ did it on a f16 just hours ago

23:00 ForSpareParts: http://pastebin.com/kkmFjY6d

23:00 I have deleted that file and reinstalled, several times.

23:00 Always the same thing.

23:01 wmealing_: ah windows

23:01 ForSpareParts: yeah

23:01 wmealing_: what if you do

23:01 lein project new

23:01 lein new projectname

23:01 rather

23:01 ForSpareParts: same thing

23:02 ivan: I'm guessing you're running the preview release bin/lein?

23:02 ForSpareParts: I think so, yeah.

23:02 Would it be better to try 1.7?

23:04 ivan: I guess

23:04 ForSpareParts: alrighty.

23:07 Well, 1.7.1 works. Still have no clue why.

23:08 amalloy: ForSpareParts: technomancy would probably love some feedback about what goes wrong on windows

23:08 mye: File file = new File("/tmp/test"); How dow I translate that into clojure?

23:09 ForSpareParts: amalloy: OK. What's the best way to give feedback?

23:09 ivan: perhaps (File. "/tmp/test")

23:10 amalloy: i dunno. open a github issue? or find an existing issue that looks the same, and comment on it

23:10 brehaut: mye: (require 'clojure.java.io) (file "/tmp/test")

23:10 wmealing_: github issue is best imho

23:10 technomancy is here sometimes, but best to put it in github

23:10 brehaut: mye: not a direct translation however

23:10 ForSpareParts: affirmative, I'll do that.

23:13 uvtc: Raynes: ping?

23:15 mye: brehaut, thanks

23:15 Where should I put data files in my leiningen project folder?

23:15 kaoD: mye, direct translation: (def my-file (File. "/tmp/test"))

23:15 mye: Is there some standard directory?

23:15 kaoD: oh, ivan said it

23:16 mye: kaoD, so File. does a new?

23:16 kaoD: yup

23:16 wmealing_: mye, the . is part of the java interop

23:16 kaoD: actually you can do new

23:16 (new File "/tmp/test")

23:16 but the . shorthand is preferred

23:16 mye: I had only seen . for instance props

23:17 kaoD: instance props?

23:17 mye: (.thisIsMyMethod instance arg arg arg)

23:18 kaoD: but that's different

23:18 (.method instance args)

23:18 (Class. args)

23:18 the . is on the other said

23:18 *side

23:18 as I said, it's a shorthand for (new Class args)

23:18 mye: good now I know ^^

23:19 pushp0p: wow these clojure koans are great

23:19 what a fun way to learn a language

23:19 wmealing_: what are you up to ?

23:19 mye: can I refer to files in my project without absolute paths?

23:19 kaoD: mye: what?

23:20 you must follow the same rules as Java's classpath

23:20 wmealing_: (he may want to acccess something in ./resources, perhaps ?)

23:20 mye: http://clojuredocs.org/clojure_core/clojure.java.io/resource

23:20 something like that I'm trying to grok what this is really for

23:21 Raynes: uvtc: pong

23:21 wmealing_: (clojure.java.io/resource "something.txt")

23:21 something like that ?

23:22 amalloy: resource also lets you access "files" bundled inside your executable jar

23:23 ForSpareParts: So, I've got lein working now, but I'm getting this when I try to clojure-jack-in:http://pastebin.com/P1tFWnTe

23:23 mye: so I just manually create ./resources/ and that's it, whenever I need files local to the application I just put them in there?

23:23 ForSpareParts: er http://pastebin.com/P1tFWnTe

23:23 wmealing_: thats what i'd do

23:24 tmciver: if I create a function with literal notation, #(...), but don't reference any args, %, do I get a function of no args?

23:24 kaoD: tmciver: yes

23:24 tmciver: I get an arity exception when I call such a function with args.

23:24 kaoD: of course

23:24 wmealing_: ForSpareParts, this is windows still ?

23:24 tmciver: So I should use (constantly ...) instead.

23:24 ForSpareParts: yeah

23:25 kaoD: why would you call a function with no args with args?

23:25 mye: ForSpareParts, I had the same error yesterday and I solved it, but forgot how... :-)

23:25 wmealing_: ForSpareParts, i think $SHELL is an env variable for a shell.. like bash

23:25 tmciver: kaoD: I was hoping it would just behave like (constantly ...)

23:25 wmealing_: mye, did you install something like cygwin ?

23:26 mye: let's think, .. I tried going cygwin first but then put lein in the windows path

23:26 it calls cmdproxy.exe in the emacs folder

23:26 wmealing_: https://github.com/technomancy/swank-clojure <-- discussion there on the cygwin part

23:26 mye: which is your normal dos prompt

23:26 kaoD: tmciver: it won't work that way.. although you might be able to use %&

23:26 (to ignore it)

23:27 mye: wmealing_, no I'm running the native emacs

23:28 ForSpareParts: this is quite frustrating -- I was really hoping to hack around with swank tonight, see if I dig it, but it's been hours just trying to get it up and running...

23:28 kaoD: tmciver:

23:28 &( #(if (not (nil? %&)) 3) 1 2 3 4 5 6)

23:28 lazybot: ⇒ 3

23:28 kaoD: &( #(if (not (nil? %&)) 3) [1 2 3 4 5 6])

23:28 lazybot: ⇒ 3

23:28 mye: ForSpareParts, I spent the first day that way too

23:29 have you but the lein.bat script in your path?

23:29 ForSpareParts: Ah, that could be it.

23:30 mye: ForSpareParts, you must be able to call it in a cmd.exe

23:30 ForSpareParts: yeah, I understand

23:30 I had forgotten about that part -- I was running lein from the location where I had it stored instead of adding it to path

23:31 kaoD: in fact, tmciver

23:31 &( #(do %& 3) 1 2 3 4 5 args lol lol)

23:31 lazybot: java.lang.RuntimeException: Unable to resolve symbol: args in this context

23:31 kaoD: oops

23:31 &( #(do %& 3) 1 2 3 4 5 'args 'lol 'lol )

23:31 lazybot: ⇒ 3

23:31 kaoD: there's your constantly

23:31 ForSpareParts: before when I was having trouble with lein, I had the dir extracted from the download in my path, I removed it when I realized lein self-installs.

23:31 (and there was no point in having a C:\lein)

23:32 zcaudate: I'm looking for a good namespace tool. Two things are really bugging me..

23:32 - is there a way to list all the namespaces that could potentially be loaded?

23:32 - clojure.reflect is unreadable... is there something like dir(obj) in Python to list all the method names for java objects that is similar to ns-publics?

23:34 hiredman: ,(-> String .getMethods (map bean) (map :name))

23:34 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>

23:35 hiredman: ,(->> String .getMethods (map bean) (map :name))

23:35 clojurebot: ("hashCode" "compareTo" "compareTo" "indexOf" "indexOf" ...)

23:35 hiredman: clojurebot: jerk

23:35 clojurebot: you cut me deep, man.

23:36 ForSpareParts: OK, putting lein.bat in the path fixed that error, but now I've got a new one: http://pastebin.com/BGn28M5k

23:36 kaoD: zcaudate: in fact there was a repl-utils package under contrib which did pretty much what you want

23:36 not sure if someone still mantains it

23:37 mye: ForSpareParts, 1.4.4? I have 1.4.2

23:37 ForSpareParts: I just installed the latest thing from marmalade

23:38 xeqi: ForSpareParts: do you get the same error if you run it again?

23:38 ozataman: would reduce cause head-retention when used with take on a long lazy-seq

23:39 something like (reduce + (take 10000000 big-lazy-seq))

23:39 mye: ForSpareParts, I didn't install it with emacs, I just put in in th e plugins section of project.clj

23:40 ForSpareParts: Huh. Now I've got this: http://pastebin.com/UEEFWe7M

23:41 mye, Oh! Yeah, I did that too, but I got the description from the swank tutorial. I wonder if it's not in sync with marmalade and I have the wrong version?

23:41 zcaudate: kaoD: hmmm... do you mean this page http://richhickey.github.com/clojure-contrib/repl-utils-api.html ?

23:41 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/repl-utils-api.html and try to stop linking to rich's repo.

23:41 kaoD: hehehe

23:41 zcaudate: clojure-contrib is no longer maintained

23:42 but you might aswell copy whatever you need

23:42 brehaut: ~contrib

23:42 clojurebot: Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

23:42 kaoD: and maybe someone still maintains it in a separate library

23:42 zcaudate: kaoD: yeah... its so annoying

23:42 it should be something really simple

23:43 to add

23:43 somewhere

23:45 ForSpareParts: OK, so I killed emacs, started over, now I've got the "that's not a task" error.

23:48 technomancy: zcaudate: it sounds like you want Bultitude

23:48 clojurebot: google bultitude clojure

23:48 clojurebot: First, out of 23 results is:

23:48 Raynes/bultitude · GitHub

23:48 https://github.com/Raynes/bultitude

23:48 mye: ForSpareParts, I'd try installing it only once, maybe uninstall the marmelade version

23:49 technomancy: zcaudate: for checking all the methods on a class, slime works really well for that if you have it: C-c S-i

23:49 ForSpareParts: mye, marmalade version's the only version I've got (I think?)

23:49 zcaudate: clojurebot: nice!

23:49 clojurebot: It's greek to me.

23:49 technomancy: Frozenlock: how did you install swank?

23:49 oops

23:49 ForSpareParts: ^^

23:50 ForSpareParts: I used the emacs package manager to install clojure-mode.

23:51 Frozenlock: What's happening... awwww

23:51 technomancy: Frozenlock: sorry man. first three letters of the nick mismatch.

23:52 Frozenlock: I used to hang out with a guy called technoweenie so I know how that is =)

23:52 Frozenlock: tab's a bitch :p

23:52 (or M-/)

23:53 zcaudate: clojurebot: so if I wanna write those two functions but don't wanna make my own project... whom should I make the pull request to?

23:53 clojurebot: Anyone can hack! http://images.wikia.com/pixar/images/0/0d/Http_alliedow-files-wordpress-com_2011-01_anyone-can-cook-445x355.png

23:54 zcaudate: technomancy: =) emacs and i aren't gelling yet

23:55 member:technomancy: was looking for something quick and easy on the repl

23:55 technomancy: it's an acquired taste

23:55 I think there's something simplistic built-in

23:56 ForSpareParts: technomancy, do you have any clue what it is I've done to break your nice plugin? I'd really like to give it a shot : )

23:56 technomancy: ForSpareParts: how did you install swank?

23:57 ForSpareParts: technomancy, package manager, like I said

23:57 er

23:57 emacs package manager

23:59 technomancy: ForSpareParts: oh, you said you installed clojure-mode that way; that's different

Logging service provided by n01se.net