#clojure log - Sep 27 2012

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

0:28 qfr_und_qfr: casion, sweety, don't you just love sneaking in with infestors from the back and neuralling their entire tank line while you crash zerlgings, banelings and ultralisks in from 3 different directions?

0:29 arrdem: TIL #clojure plays sc2....

0:29 qfr_und_qfr: Of course.

0:29 Who doesn't?

0:30 cue balance whine of course when I did that.

0:30 arrdem: meh. if you can micro infestors that well you deserve it.

0:30 personally I'd opt for an advancing wall of mutas and lings

0:30 (it being the engage win)

0:31 qfr_und_qfr: you box them, unburrow them all and spam neural on all the tanks really.

0:31 It'smore timing it well with coming from all directions

0:32 I play random anyway and my TvZ is slightly better than my ZvT so the balance whine was unwarranted

0:32 alex_baranosky: this is the Clojure channel right?

0:32 arrdem: alex_baranosky: last time I checked...

0:32 alex_baranosky: k, just making sure Colloquoy didn't transport me to another land

0:33 Fossi: sc2 \o/

0:33 could play some randoms again

0:33 qfr_und_qfr: Mad jelly at mah neural parasite.

0:34 Underused honestly since the range nerf, you can still use it, itś just no longer the answer to everything but it definitely can be used on tanks and thors.

0:34 Fossi: then somehow i don't find the time anyway ;)

0:34 qfr_und_qfr: Or like, I often go ultrabane ZvP and your biggest enemy then are archons and being able to neural them is great

0:34 automatically stops banelings from wasting themsleves on them

0:47 john2x: noob question, how do I `use` a java package I added to dependencies by [net.sourceforge.cssparser/cssparser "0.9.7"].. (use 'net.sourceforge.cssparser/cssparser) gives a FileNotFoundException..

0:49 scottj: john2x: you import the java class you want

0:55 john2x: scottj: oh right. d'oh. thanks!

2:26 augustl: iirc that most people think records are a bad idea, but I don't remember why and can't seem to think of any reason why they are bad. Any anti-record peeps around that would care to enlighten me?

2:35 xeqi: augustl: do you mean the 'use maps where possible' crowd?

2:36 unlink: Wow I thought I missed a huge upheaval in the vogue philosophy of the programming language. Then I realized I wasn't in #haskell.

2:59 mikehoy: I'm trying to (load "test") with leiningen and I'm getting class path errors I've added export JAVA_HOME="/usr/bin/java" and export PATH="/home/USER/bin/:$PATH" to my ~/.bashrc file

3:03 xeqi: mikehoy: do you have a file named test.clj?

3:03 mikehoy: yes I do

3:04 actually the FileNotFoundException Could not locate test__init.class or test.clj on classpath: clojure.lang.RT.load (RT.java:432)

3:04 oops

3:04 bad paste

3:04 arrdem: pastebin

3:04 ~paste

3:04 clojurebot: paste is https://refheap.com/

3:05 mikehoy: do you want a paste bin of test.clj and the bashrc file?

3:05 I'm running ./lein repl

3:05 xeqi: whats the path to test.clj from your project root?

3:07 mikehoy: http://dpaste.com/806696/

3:08 kostafey: Can somebody help me with configure nrepl in emacs?

3:08 xeqi: mikehoy: you need to put test.clj in the src/ or test/ folders

3:09 mikehoy: just put it in /src no luck

3:09 lpetit: Hello there

3:11 mikehoy: xeqi: also tried /test no luck

3:11 borkdude: mikehoy who do you type ./lein instead of lein?

3:11 mikehoy: borkdude: ./lein

3:12 borkdude: why

3:12 mikehoy: borkdude: ./lein repl

3:12 borkdude: so it will execute, otherwise it does nothing

3:12 borkdude: in that case the lein script must be in the sandbox also

3:13 mikehoy: can I just mv it ?

3:13 borkdude: mikehoy better is to put it on the path

3:13 mikehoy: export lien="/path/to/lien" ?

3:14 borkdude: mikehoy it depends on what kind of shell you are using I guess, bash?

3:14 mikehoy: borkdude: yes

3:15 borkdude: mikehoy then smth like that yes

3:15 http://www.troubleshooters.com/linux/prepostpath.htm

3:15 mikehoy but then different

3:16 mikehoy for example: export PATH=$PATH:~/opt/leiningen

3:18 mikehoy in my .bashrc I have export PATH=$PATH:~/bin

3:18 and the lein script is in ~/bin

3:18 mikehoy: borkdude: ok that is what I have as well

3:18 I will try that now

3:18 then I can run lein from anywhere?

3:19 borkdude: mikehoy yes, but restart the shell first

3:19 mikehoy: source /etc/profile?

3:19 borkdude: what?

3:19 clojurebot: what is exceptions

3:24 mikehoy: borkdude: you fixed it bro, thanks.

3:25 borkdude: :-)

3:27 mikehoy: borkdude: what do I have to do to run a clj program without invoking the repl?

3:27 borkdude: mikehoy check out lein run

3:27 mikehoy: borkdude: ok

3:28 borkdude: mikehoy lein help run displays some hints

3:29 ori-l: does anyone know how to configure readline behavior for lein repl? pressing the up arrow gives me (reverse-i-search), much like ctrl+R in bash. i'd like it to scroll through the command history

3:35 borkdude: gtg

4:22 kral: namaste

5:54 augustl: xeqi: went afk, sorry. Refs protocol, yes I think so.

6:21 zoldar: does anybody working with nrepl.el experience a problem where pressing enter in repl buffer on unbalanced form causes emacs to freeze with 100% cpu usage?

6:23 clgv: zoldar: does your form block? I experienced 100% cpu load with lein+nrepl when the form blocks

6:23 zoldar: clgv: but it isn't even complete, the repl should just open a new line

6:24 clgv: zoldar: oh ok. then thats probably different

6:25 zoldar: it's a bit frustrating, because every time when this happens in the middle of work, I have to kill emacs process and start again, setup buffers, jack-in, recover contents etc...

6:32 clgv: humm nrepl.el is still young...

6:33 zoldar: but it's already widely used so I hoped that maybe I'm not alone with that issue

6:38 it happens even on a clean project after typing in a form like "(+ 1 2<enter>" ... suppose that must be something with my specific setup. Will try to dig into it later

6:40 clgv: zoldar: search in his issue tracker for a related issue and add a comment or create a new issue if there is none

6:44 zoldar: clgv: I will, when I'll isolate it better

6:45 augustl: is there a way to check which "fields" a record has?

6:46 clgv: augustl: keys

6:47 augustl: though some of them are no fields of the java object

6:47 augustl: hmm, I need to make an instance of the record to do that

6:47 so yeah, by "a record" I mean the actual record "class"

6:47 clgv: augustl: java reflection

6:48 augustl: clgv: I see

6:48 clgv: augustl: something like clojure.contrib.repl-utils/show which unfortunately ceased existence during migration

6:48 augustl: trying to find a scheme to handle the problem I'm currently having - using maps means strings being keys some times (json parse), and keywords others (mongodb query results)

6:48 clgv: but you can have a look at it to find out how it is done

6:49 augustl: seems records would be a good solution, but would like to validate that the stuff I JSON parse doesn't contain unknown keys, etc

6:49 clgv: augustl: so, what is the problem?

6:50 what is the problem with unknown keys?

6:50 augustl: clgv: the problem with strings vs. keywords is that for example a validation function will have to handle the fact that the object it validates some times uses strings for keys and some times uses keywords

6:50 depending on whether I create or update, basically

6:51 I currently clojure.walk/stringify-keys before I validate

6:51 but since my system does expect a certain set of keys to be present, not all keys you could possibly imagine, something stricter, like records, seems to make sense

6:52 clgv: augustl: you can use `select-keys` to get a map containing only the specified keys

6:52 augustl: by the way, are keywords garbage collected? The Ruby equivalent, symbols, aren't, so it's not safe to "keywordize" user input

6:53 clgv: augustl: you have to recheck but I think they are internalized

6:54 augustl: clgv: what does internalized mean?

6:55 clgv: you can check it here: clojure.lang.Keyword/intern

6:56 augustl: clgv: thanks

6:57 (inc clgv)

6:57 lazybot: ⇒ 4

6:57 augustl: eww, side effects

6:57 clgv: augustl: they are stored there in a hashmap with WeakReference

7:27 Cheiron: Hi, is it possible to install lein2 and lein on the same machine?

7:31 mpenet: Cheiron: yes, see the Upgrading page on the leiningen wiki, you end up with lein1 and lein commands

7:34 Cheiron: mpent: i installed lein 1.x with brew . i guess i have to run $ mv ~/usr/local/bin/lein ~/usr/local/bin/lein1 ?

7:34 mpenet: i installed lein 1.x with brew . i guess i have to run $ mv ~/usr/local/bin/lein ~/usr/local/bin/lein1 ?

7:34 mpenet: I wouldn't know, I am not on OSX, but probably

7:35 Cheiron: "which lein" should return its location

7:35 Cheiron: yes, i run it and posted the earlier line

7:36 so that should be fine?

7:36 mpenet: yes

8:06 lpetit: Seems like americans are still recovering from strangeloop. Nobody seems to wake up early, today :)

8:29 mpenet: Awesome overload

8:29 lpetit: mpenet: hello, and uh ?

8:30 mpenet: nevermind, trying to be funny in a language I clearly don't master

8:30 lpetit: mpenet: same here :)

9:10 clgv: hello you two

9:23 lpetit: clgv: hello

9:52 jkkramer: lpetit: hey, just posted an emacs-to-ccw report to the ccw mailing list. overall, very good experience. thanks for making ccw

9:53 casion: is there a preferred way of handling ftp connections other than using commons-net directly?

9:53 lpetit: jkkramer: I'll read it with great interest, thanks for this !

10:00 mpenet: hello clgv

10:00 clgv: now I notice that I never read the CCW ML...^^

10:02 lpetit: jkkramer: whoops, your message was awaiting moderation. I accepted it, sorry for the delay

10:04 clgv: oh, 0.10.1 is released

10:04 lpetit: clgv: indeed, forgot to mention it here

10:04 clgv: a pity I cant program anything today - gotta finish my slides first

10:04 lpetit: hopefully bug reports will stop, and I'll be able to focus on adding features :)

10:05 clgv: I'll find them bugs - I have some magic ability regarding that ;)

10:05 lpetit: clgv: I have faith in you :-P

10:06 jcromartie: Compjure time: why does (routes (some-middleware x) y z) seem to apply the middleware to y and z as well

10:07 specifically, I am adding a paging middleware to the first route in a sequence, but the rest of the routes are affected

10:07 and I don't understand why

10:07 weavejester: you around?

10:07 weavejester: jcromartie: I am indeed

10:07 jcromartie: (routes …) doesn't thread things through the handlers

10:07 right?

10:07 clojurebot: to be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks

10:08 jcromartie: weavejester: and (wrap-foo (GET …)) returns a perfectly valid handler on its own

10:08 clgv: clojurebot: botsnack

10:08 clojurebot: botsnack is scoobysnack

10:08 weavejester: jcromartie: If you have (routes (some-middleware x) y z), the middleware will only be applied to x

10:08 jcromartie: weavejester: that's what I thought

10:09 weavejester: But because x comes before y and z, if x does not return nil, it might mean that y and z are not evaluated

10:09 lpetit: jkkramer: your feedback on the ml in invaluable, thanks again for having taken the time to report it !

10:09 weavejester: For instance, if x returns some access-denied response if it can't find the route

10:09 jcromartie: ah, I see what the issue is

10:09 weavejester: my middleware is returning a result no matter if the route matches

10:09 I need to test it first

10:10 (when-let [resp (handler req)] ...)

10:12 clgv: lpetit: I cant find the mail on top of the list. :/

10:13 lpetit: clgv: its title is "Emacs to CCW: Experience Report"

10:13 clgv: ccw-users list right?

10:14 lpetit: right

10:15 clgv: maybe I have to be signed in

10:15 lpetit: weird

10:16 clgv: nope. it is not visible and google cant even find it when searching the group

10:16 jcromartie: I've replaced a few thousand lines of Java with 150 lines of Clojure

10:17 and I'm pretty sure I haven't lost anything

10:18 lpetit: clgv: dammit, you're right, I can't see it either, that's weird

10:18 because I received it in my inbox !

10:19 clgv: ha!

10:20 lpetit: I'll answer to it, hopefully it will resolve google group's mess

10:21 I suspect emacs lobby to have filtered this email out :-D

10:21 clgv: haha, they are everywheren! ;)

10:35 lpetit: clgv: seriously, I can only see one reason : it's in my inbox because i've received it, it's not in the google groups because it has been deleted ?

10:35 jkkramer: ^^ ?

10:35 Hodapp: interesting, "Can programming be liberated from the von Neumann style?" by Backus, circa 1978, discusses the idea of ranking the expressive power of languages

10:35 clgv: hit the wrong button when accepting? ;)

10:36 Hodapp: I'd wondered about this myself, but this paper is the first I've seen that puts any algebraic basis whatsoever to it, though it restricts it to FP languages

10:36 lpetit: clgv: no, or I wouldn't have received it myself

10:37 clgv: weird

10:37 casion: Hodapp: why would expressive power measurement be useful?

10:37 jkkramer: lpetit: odd. I definitely sent to Google Groups, not you directly. I did receive an error when trying to post, had to sign into Google, and re-submit. Then it said it would be posted once approved

10:38 lpetit: jkkramer: and I approved it, or so it seems

10:38 Hodapp: casion: Because perhaps you're interested in finding which language is the most expressive.

10:38 jkkramer: lpetit: google groups is notorious for this kind of thing. maybe it's just taking a while to show up?

10:39 lpetit: jkkramer: maybe, but since I received it myself, I'm surprised

10:39 jcromartie: how does my Content-Type header get a charset tacked on?

10:39 clgv: lpetit: maybe google is busy adding its content to all its indices ;) :P

10:39 Hodapp: casion: and because the expressive power may have implications for things such as proofs, automated or otherwise.

10:40 lpetit: clgv: :)

10:41 jkkramer: I've got a lot of questions related to your email. Do you prefer to answer here (and right now), or via email (and at your own pace)?

10:42 jkkramer: lpetit: here is fine

10:43 lpetit: jkkramer: "when importing a project …" = I don't understand what the problem was, copying gigabytes of un-versioned app data ...

10:44 jkkramer: lpetit: I had a pre-existing lein project. When I added it to Eclipse, and tried to convert to a lein config, Eclipse copied everything -- including gigabytes worth of app data -- into the bin directory

10:45 lpetit: coincidentally, I was low on hard drive space, and it brought my system to its knees

10:46 lpetit: jkkramer: ha, you mean data from java source paths, resource paths, were copied into bin/, that's it ?

10:46 clgv: eclipse has a checkmark on the import dialog that says "copy into workspace"

10:46 *checkbox

10:47 maybe that one is checked by default

10:47 jkkramer: lpetit: the data was outside the classpath, and ignored by git

10:48 clgv: I kept the same project dir on disk, which is outside the default Eclipse workspace

10:48 lpetit: jkkramer: I thought the data was in src or resources/ dir, which could have explained your problem, and your fix (to place exclusions)

10:50 jkkramer: if you can produce a step by step guide to reproduce the problem, please file a specific issue for this one, I suspect it may denote something wrong in the way leiningen support is added to an eclipse project

10:51 jkkramer: lpetit: ok, will do

10:51 lpetit: jkkramer: many thanks

10:53 "REPL: couldn't figure out how to stop/restart" : then the current Eclise way is not intuitive. What could have helped you ? An entry in the FAQ page (and the FAQ page better visible ?) An entry in the documentation on the wiki page (did you have the reflex to refer to it first ?) ? An addition / a change to the user interface ?

10:54 jkkramer: ^^

10:55 jkkramer: what was unclear ? The fact that you had to both close the REPL view and hit the red square on the console view, I guess ? Would you expect that closing the REP view would also kill the underlying jvm process?

10:58 jkkramer: lpetit: I initially expected closing the REPL view to kill the process. I didn't even know that Console was related to the REPL. I looked in the installation docs first (http://code.google.com/p/counterclockwise/wiki/Documentation#Launch_a_REPL_for_the_project)

10:59 lpetit: I tried reproducing the data-copied-to-bin issue with a minimal project without success. Will try some variations...

11:01 lpetit: jkkramer: "trailing enter" : Maybe a tiny gray cross in the upper right corner could act as an easy way to switch the preference from "visible" to "invisible" ?

11:02 jkkramer: lpetit: yeah. or (if possible) having the typed code cover the "trailing enter" text. e.g., if the code had a solid white background color

11:04 lpetit: jkkramer: alas, Eclipse's SWT's StyledText is not as powerful as Swing's text widgets. The solid white background color trick is not possible:-(

11:05 jkkramer: "Content Assist" doesn't appear to work. Is it now a solved problem? I wasn't expecting this one, to be honest.

11:06 jkkramer: lpetit: it doesn't work in the repl for me. I mean the yellowish popup with arglists, not the code-completer

11:06 lpetit: Ah

11:07 jkkramer: 0.10.1 has a bug fix for code completion when developing in mixed-team (emacs / ccw) : now the clojure-complete hacked ccw version is in its own namespace

11:07 jkkramer: oh…I'm now seeing "Cannot find declaration for symbol under cursor" now in the main editor for content assist. This has happened before. Is there some way to get a log or stacktrace for that?

11:07 lpetit: jkkramer: eclipse logs live in your workspace's .metadata/.log file, if any

11:08 jkkramer: you're aware that you need a running repl for the code completion to work, right?

11:08 jkkramer: lpetit: yup it's running

11:08 lpetit: jkkramer: ok

11:10 jkkramer: lpetit: the code completion always works. it's the yellowish popup (which I'm more interested in) that doesn't show, or shows inconsistently

11:10 lpetit: jkkramer: and it shows inconsistently in the REPL only, or also in the editor.

11:11 jkkramer: lpetit: "Context Information" according to the keys pref, bound to Shift+Ctrl+Space. Both repl and editor. Editor sometimes works, repl it never works

11:13 lpetit: jkkramer: yes, it's called "context information" in Eclipse, and "Content Assist" in Eclipse is for "autocompletion :). I can see that it indeed seems to work quite erratically. Would you please file an issue for this one as well, that's absolutely not desired behavior !

11:14 lrenn: off topic, but I know a lot of clojure folks play go, so kaya.gs just released 300 account if anyone is interested.

11:16 jkkramer: lpetit: issue created

11:16 lpetit: jkkramer: "Working with checkouts". There's a task in my todo to "address" the underlying problem of working with several projects at the same time. But the intended fix is not to use the checkouts/ directory, but rather to automatically detect, in the Eclipse workspace, all the projects which happen to be direct dependencies of other projects, and add them to other projects java build paths as "project dependencies".

11:17 jkkramer: would that cover your use case correctly?

11:17 jkrramer: re: issue thx

11:17 jkkramer: lpetit: absolutely. I don't have any particular attachment to checkouts, just want to develop multiple libs simultaneously

11:17 lpetit: jkkramer: ok

11:17 (fine ;) )

11:19 jkkramer: now, let's dig into the "Editing" section of your email :)

11:19 jkkramer: lpetit: I will say, with checkouts, I end up editing the files under checkouts dir with only the one project open. With the feature you're describing, I would have multiple projects open, yes?

11:20 lpetit: yes

11:20 jkkramer: lrenn: cool. are you the creator of kaya.gs? I hadn't heard of it

11:21 lrenn: jkkramer: no :) I'm just very excited for it and I know a few clojure folks got introduced to go via rhickey.

11:21 kryft: Wow, I didn't know rhickey played go

11:22 (Reminds me that I should start playing again)

11:22 jkkramer: I was excited when I found out he plays, and is encouraging others to. Clojure and Go are two of my favorite hobbies :)

11:22 lpetit: jkkramer: is this new fact a game changer for "workspace project dependencies instead of checkouts/" ?

11:22 lrenn: me too :)

11:23 jkkramer: lpetit: don't think so, no. I was just being lazy by not creating Eclipse projects for the checkouts yet

11:24 lpetit: jkkramer: ok

11:25 jkkramer: Tom Hickey is working on adding the last missing bits of paredit.el into paredit.clj . He already has barrage / slurpage commands on his own fork. Just waiting for him to ping me when he things it's stable enough.

11:26 jkkramer: lpetit: that's excellent to hear

11:26 lpetit: jkkramer: before digging into your editing issues, let's just check your config please: are you in strict mode, or in default mode, for the editor ?

11:27 jkkramer: lpetit: strict

11:27 lpetit: jkkramer: you can switch locally from one to another via Alt+D, or definitely change the defaults from the preferences menu

11:27 jkkramer: ok

11:28 jkkramer: I don't understand what you mean by ") and ] being interchangeable" ?

11:28 jkkramer: lpetit: in emacs, ], ), and } are interchangeable. they all close (or overwrite) whatever closing bracket your cursor is at

11:29 thinking of an example...

11:30 lpetit: yes please, because I never had the issue for myself, so an example may help understand your "workflow"

11:30 jkkramer: lpetit: e.g., (foo [bar|]) where | is the cursor. you could type ] twice to end up here: (foo [bar])|. in CCW, you end up with: (foo [bar]]) which is invalid

11:31 lpetit: jkkramer: I would argue that you could also only type ) once to end up here: (foo [bar])| in ccw

11:31 TimMc: bleh

11:31 jkkramer: (foo [bar]]|) rather

11:32 lpetit: it's possible, it's just more cognitive load to remember which type of closing bracket to use. especially when you're facing a ))])]}) type thing

11:32 TimMc: I really, really like being able to type ] repeatedly to walk to the end of whatever braces sexp I'm in.

11:33 jkkramer: (inc TimMc)

11:33 lazybot: ⇒ 16

11:33 lpetit: jkkramer: let's revisit this once again before I give up :)

11:34 jkkramer: the current behavior in CCW is that when you type ), you jump to the next closing ), when you type ], you jump to the next closing ], when you type }, you jump to the next closing }

11:34 jkkramer: now, you have discovered a corner case when there is no "next" ] or next } or next ), and indeed then the raw char is inserted, which is undesirable.

11:34 jcromartie: so Light Table is a web app?

11:35 jkkramer: lpetit: it may be because CCW's way is unfamiliar, but I don't really find that useful. it takes me longer to figure out which type of bracket it to use than it would be to just type ] N times to get to the right place

11:35 lrenn: jcromartie: yes, but it runs locally.

11:35 jcromartie: yeah

11:36 lpetit: jkkramer: for instance, if your facing a ))])]}) type thing, with the current CCW behavior, typing just one } would bring you directly after the }, when your suggesting behavior would just bring the cursor after the next ) or ] or }, right ?

11:36 TimMc: lpetit: I guess the question is whether you want to be bug-compatible (in your view) with Emacs paredit. :-)

11:36 jkkramer: lpetit: right. technically in that case, ccw does it in fewer key strokes, but I would argue it takes me longer because I have to think harder and parse the code myself to decide what to press

11:38 lpetit: I will make a mental note to record a real-life example when I come across one. having trouble thinking up a good contrived one

11:39 lpetit: jkkramer: LOL, ok. I'm open to changing my mind. Just need more contrived example indeed :)

11:41 jcromartie: what does LightTable use to display the UI

11:41 jkkramer: lpetit: it's not a deal breaker by any means. the bigger issues are allowing invalid ] and }, and lack of slurp, which are being addressed.

11:41 lpetit: jkkramer: indeed, we agree without delay that invalid } and ] should not be inserted. Would you please file an issue for this specific topic?

11:42 lrenn: jcromartie: i believe it's html5 + clojurescript but i'm not positive.

11:42 jcromartie: yeah but I mean what is rendering it

11:42 it's some kindof embedded browser

11:42 JWebPane

11:42 maybe?

11:43 lpetit: jkkramer: please note that I'm writing an answer to your email with all the conclusions we're addressing here, so that other people can follow along.

11:43 jkkramer: lpetit: issue created

11:43 lpetit: jkkramer: you're fast. Thx :)

11:46 jcromartie: I guess I'm not sure what Light Table *is* at this point… is it for building web apps, or building "Light Table apps"

11:46 quentin_: hi! I set up a bounty on Stack Exchange Code Review for this question: http://codereview.stackexchange.com/q/8270/11227 - the guy (not me) is just asking if the code is idiomatic clojure or not, and if not, what should be changed. anybody willing to give it a try? thanks! (sorry if there's an implicit rule forbidding this)

11:46 jcromartie: because this latest video shows some interactive game inside Light Table and the code is in Clojurescript

11:46 jkkramer: jcromartie: from what I gather, it's an experiment. real-world value TBD

11:46 jcromartie: yah

11:47 casion: jcromartie: it's an IDE… that's it

11:47 lpetit: jkkramer: bbl (~30 mins.)

11:47 jcromartie: I guess I'm missing context

11:47 jkkramer: lpetit: k

11:47 metellus: jcromartie: it's for any kind of development

11:48 casion: the context is the concept behind it, but it is simply an IDE designed with some new concepts (and old concepts that are rarely implemented)

11:48 juhu_chapa: Why there is no socket library in https://github.com/clojure? Is a there standard project to do net apps?

11:50 jkkramer: juhu_chapa: I think most people use the Java APIs. or specialized libs like clj-http

11:51 jcromartie: I think the video demo is missing the context of new stuff that's a few steps ahead of the Light Table Playground that's publicly available

11:56 juhu_chapa: jkkramer: I see. Thank you.

11:57 mefesto: Hello everyone. I'm trying to use stencil in my compojure app. I'm using lein-ring for development which reloads my clojure code but the templates don't seem to get reloaded. Anyone know what could be the issue? Seems like it might be how stencil caches templates.

11:58 weavejester: mefesto: Which Ring version are you using?

11:58 mefesto: weavejester: 1.1.6

11:59 weavejester: lein-ring 0.7.5

11:59 weavejester: Then it's not an out of date Ring version

11:59 It could be that stencil uses defonce

12:00 jcromartie: I've always found code reloading to be iffy

12:00 I just compile my namespaces from SLIME

12:01 weavejester: The latest Ring versions should be better for code reloading

12:01 There were several bugs that have been fixed in that regard

12:02 I'm pretty sure there's at least one left, but it's rare and I haven't been able to pin it down

12:02 It looks like stencil doesn't use defonce

12:02 So in theory it should reset the cache when it's reloaded...

12:03 Oh, except...

12:03 Ah, because the *code* hasn't changed for stencil, it doesn't reload the namespace

12:04 wrap-reload reloads modifed files, and any files that depend on those modifed files

12:04 But the cache for stencil is defined in a file that hasn't changed, and whose code does not need to be reloaded.

12:06 mefesto: I guess I need to find a way to disable caching for development but leave it enabled otherwise

12:06 weavejester: mefesto: Have you tried using (stencil.loader/set-cache-policy cache-never) ?

12:06 mefesto: weavejester: no, i'll give that a go now

12:07 weavejester: Where cache-never is also in stencil.loader

12:08 LesZedCB: hello

12:09 weavejester: hi

12:11 mefesto: weavejester: I'm not finding that function. I'm running stencil 0.3.0

12:13 weavejester: thanks anyway for the help. i'll give it another look after lunch

12:25 lpetit: jkkramer: back

12:31 juhu_chapa: Where can I download full clojure docs?

12:33 nDuff: juhu_chapa: If you want something to read offline, I strongly suggest purchasing a book. The docs are... really not that great.

12:34 lpetit: jkkramer: "new clojure namespace" confusion. What could be done to improve the situation?

12:34 paultag: Anyone know how I can pass kwargs to clojure-py?

12:35 to native bindings in clojurepy*

12:35 nDuff: juhu_chapa: ...that said, see the gh-pages branch on github

12:36 lpetit: jkkramer: idea = always pre-populate the input area with the namespace prefix from where the wizard triggering took place, e.g. you trigger the wizard from src/foo/bar then the input comes pre-populated with "foo.bar.<customize>" and <customize> would be pre-selected so that it is automatically replaced by what the user would type?

12:38 juhu_chapa: nDuff: thank you.

12:38 paultag: all I see is https://github.com/halgari/clojure-py/blob/master/examples/flask/utils.clj#L6-10 ← and that looks god-forsaken

12:39 uvtc: paultag: if you don't get any answers here, I suggest the clojure-py ML/group. I've found them to be pretty responsive.

12:40 paultag: uvtc: ah, thanks!

12:40 hiredman: that all looks horrible

12:40 paultag: hiredman: yeah, it really does

12:40 hiredman: and I'm a day into Clojure, so that's a bit overwhelming, too

12:40 technomancy: clojure-py might be a rough place to start

12:40 hiredman: paultag: don't bother with clojure-py

12:41 paultag: I got the basics with straight clojure, and that's fine

12:41 hiredman: clojure-py is junk

12:41 paultag: but I was trying to wrap some Python I had sitting around

12:41 I figured I'd try to apply it to some $WORK data

12:41 hiredman: although I am sure others would disgree with me, they are, as per usual, wrong

12:41 paultag: :)

12:42 it gives a horrid message when you forget (ns ..)

12:42 (NoneType has no such method rstrip or so)

12:56 jkkramer: lpetit: sorry for delay, got pulled into a meeting. That sounds like a nice solution. Also nice might be an example with dashes/underscores. FWIW, this was only confusing the first time. Afterwards it was fine

12:57 lpetit: jkkramer: ok. But really normally you wouldn't have to worry about underscores here, just enter dashes, and it's converted into underscores (I hoped this one was implied by the "new namespace" name)

12:59 jkkramer: lpetit: it also would be nice if it would create directories for namespace prefixes if they don't exist already. Otherwise, it's "new directory", "new namespace", so there's a potentially-confusing mixture of files/namespaces

12:59 lpetit: … with attendant dash/underscore confusion

12:59 lpetit: jkkramer: very true. Can you add this to the issue ? I think I'll do all in one pass

13:00 jkkramer: so thanks to you, I've decided to revisit my agenda for the next thursdays, and work on resolving your feedback-related issues first :)

13:01 jkkramer: lpetit: wow thanks. glad my feedback could be useful

13:02 lpetit: jkkramer: beware, since you were in meeting, I hit Enter on my email answer, and lost among what we've already discussed here, is a request for you to open one or to more bugs.

13:02 jkkramer: Since my dashboard is only eventually made of tickets list, it would be a shame if one or two issues were lost in google group's history

13:03 jkkramer: very useful.

13:03 jkkramer, all: must go, cu

13:03 jkkramer: lpetit: see you. your work on ccw is much appreciated

14:02 mpan: Guys, have you got any particular recommendation for an introduction to the concurrency features in Clojure?

14:08 jcromartie: mpan: good question

14:13 eggsby: mpan: http://blakesmith.me/2012/05/15/understanding-clojure-concurrency-part-1.html and http://blakesmith.me/2012/05/25/understanding-clojure-concurrency-part-2.html are pretty good writeups

14:14 mpan: awesome! thanks!

14:15 eggsby: the first post is mostly concurrency 101 and not related to clojure too much, the second post goes into clojures concurrency data types/STM

14:15 sexpGirl: I need to add a "free-floating .jar and decided to use "lein localrepo" for now. I managed to add the .jar using localrepo: I got copied to ~/.m2/repository/... and doing a "lein localrepo list" I can see it listed however whenever I try to add it to project.clj and do "lein deps" it fails (Could not transfer artifact / It's possible the specified jar is not in any repository)

14:17 xeqi: sexpGirl: what is the path in ~/.m2/repository, what is the dependency vector you're using in the project.clj?

14:17 sexpGirl: now if I try to add another of the .jar listed by "lein localrepo list", it works fine. So somehow localrepo did create a local repository but "lein deps" cannot find it? (I may be getting the name wrong but I can use other jars fine, so I don't think it's a typo)

14:18 @xeqi: for example this works fine in project.clj ":dependencies [[slingshot "0.8.0"]] but this doesn't ":dependencies [[myjar "1.6.0]]"

14:19 xeqi: is the jar under ~/.m2/repository/myjar/myjar/1.6.0/myjar.jar ?

14:19 sexpGirl: and "lein localrepo list" lists several things, including "slingshot (0.8.0)" and "myjar (1.0.6)" (oops, 1.0.6 I meant above)

14:20 thorbjornDX: hey, what's the consensus (if any) on clojure-py?

14:20 sexpGirl: @xeqi: myjar is in ~/.m2/repository/myjar/myjar/1.0.6/... However... It's not "myjar.jar" but "myjar-1.0.6.jar", would that be the error?

14:21 xeqi: sexpGirl: myjar-1.0.6.jar is right, I was typing too fast

14:21 paultag: thorbjornDX: I just asked

14:21 thorbjornDX: 12:36 < hiredman> paultag: don't bother with clojure-py

14:21 thorbjornDX: 12:36 < hiredman> clojure-py is junk

14:21 sexpGirl: @xeqi: no I got it wrong on my first line ; )

14:21 @xeqi: oops nevermind, read too fast

14:21 thorbjornDX: paultag: ah, gotcha :)

14:22 paultag: thorbjornDX: the biggest problems i've hit (less then 2 hours in) is it failes to handle a missing (ns) declr, as well as not being able to use kwargs on native bindings

14:22 thorbjornDX: well, it can, but you have to setattr on a function and invoke that

14:22 thorbjornDX: paultag: ah, sounds messy

14:22 sexpGirl: one thing different inside ~/.m2/repository/ is that, say, for slingshot I have .sha1, .pom and .pom.sha1 but I don't have these for my local free floating jar

14:22 paultag: thorbjornDX: 12:34 < paultag> all I see is https://github.com/halgari/clojure-py/blob/master/examples/flask/utils.clj#L6-10 ← and that looks god-forsaken

14:23 thorbjornDX: if you find a way around that voodoo, let me know :)

14:23 mpan: is there a way to say: "when this goes out of scope, run cleanup on that"?

14:24 thorbjornDX: paultag: I don't plan on using it right away, I just wanted to experiment w/ it since the interop could be nice (assuming it's implemented well)

14:24 paultag: thorbjornDX: ack on that

14:24 mpan: i.e. explicitly release some resource when the corresponding something gets GC-ed

14:24 technomancy: mpan: GC is nondeterministic, so that ends up not working very well

14:24 aperiodic: mpan: "goes out of scope" and "gets garbage collected" don't have any temporal locality

14:24 xeqi: sexpGirl: hmm, I'd expect :dependencies [[myjar "1.0.6"]] to work

14:25 sexpGirl: @xeqi: is there an easy way to "trace" what 'lein deps' does here?

14:26 xeqi: not really. can you paste the output somewhere?

14:26 mpan: so if I want a resource released? do it manually and explicitly?

14:26 sexpGirl: @xeqi: sure... First I've got another question: can lein / Maven work on a user account which has no Internet access?

14:27 xeqi: set `:offline true`, and it will only grab from the ~/.m2 cache

14:27 aperiodic: mpan: whenever i've tried anything besides that, it just lead to pain

14:27 sexpGirl: I mean: it seems to be working fine "offline" with all the other .jars, but not with "myjar".

14:28 aperiodic: mpan: you can implement closeable, do your cleanup in .close, and then use the with-open macro, which gets rid of the boilerplate

14:28 mpan: ok thanks!

14:28 thank you all

14:29 xeqi: thats cause they are found in the ~/.m2 cache, but the myjar one isn't. nothing specific to offline there

14:32 sexpGirl: @xeqi: I see... (preparing the paste) but... "lein localrepo list" shows myjar though

14:33 xeqi: I'm guessing theres a mismatch between whats in the ~/.m2 cache and the dependency vector in the project.clj, but without a project.clj or a error saying what is actually being looked for its hard to say

14:38 sexpGirl: @xeqi: here's the entire process: http://pastebin.com/XZxmwUun (I create the local repo, then list it, then lein deps without the dep, then add it and re 'lein deps' and there's the error message)

14:39 shaungilchrist: so I wanted a way to work w/ datomic queries - just wondering if there is a better/simpler way of doing this https://gist.github.com/3795605

14:44 sexpGirl: @xeqi: could the lack of a .pom in the ~/.m2/repository/myjar/myjar/1.0.6/ be causing the issue ?

14:46 xeqi: sexpGirl: it would cause it to go out and look for it in a repo, but I would have expected it not to care about not finding one

14:47 sexpGirl: @xeqi: could it be that he wouldn't care about not finding one, but that he's upset that he cannot even contact the repo? (because there's no Internet access?) [I'll check this out ASAP]

14:48 btw... There's no way lein / Maven would be going to automatically *upload* a private .jar in a public Internet repository right !?

14:48 xeqi: lein shouldn't

14:49 looks like theres some work being done on pom generation https://github.com/kumarshantanu/lein-localrepo/pull/3

14:49 hiredman: depends what you mean by "upload" "public internet repository" and "private jar"

14:49 xeqi: but that it should work without it, but would produce the download messages

14:53 sexpGirl: @hiredman: by "private jar" I mean a .jar containing company/proprietary information that shouldn't end up on the big bad Internet ; )

14:55 cvkem_: clojure.core/reduce seems to return non-lazy sequences. Is this correct? If so, why is it non-lazy?

14:55 chouser: reduce must be non-lazy

14:56 cvkem_: For what reason? A lazy version would be usefull, for me at least.

14:56 jkkramer_: cvkem_: see reductions

14:56 technomancy: reduce doesn't operate in terms of seqs

14:57 seqs are the only thing that can be lazy in clojure

14:57 reduce can only be lazy in a language like Haskell

14:57 sexpGirl: technomancy: btw thanks for clojure-mode

14:58 technomancy: sexpGirl: oh, I didn't write that

14:59 I just merge pull requests for it

14:59 cvkem_: Trying to understand Haskell, but haven't come far enough yet to understand why haskell can and clojure can't

14:59 technomancy: cvkem_: all values in Haskell are lazy

15:01 cvkem_: technomancy, what is my best option to process an (possibly infinite) sequence, where an element on the input can produce multiple elements at the output?

15:01 technomancy: (apply concat (map ...)) probably?

15:03 cvkem_: technomancy: oke, I did not know apply was lazy. But as it is this sounds good.

15:03 technomancy: apply inherits the laziness of its argument

15:04 cvkem_: sounds logical .

15:05 technomancy: thanks

15:10 sexpGirl: Is it possible to have lein and be able to do "lein deps"

15:10 sorry

15:11 Is it possible to have lein installed (lein deps works etc.), to do nrepl-jack-in etc. *without* having Maven? Is it possible that I miss Maven on my system? (I don't find the 'mvn' command)

15:13 technomancy: sure, mvn hasn't been needed since leiningen 1.1.0

15:14 sexpGirl: @technomany: but a maven.jar is needed or does lein do everything that Maven does?

15:14 TimMc: technomancy: ...but if mvn is on your classpath, it gets used.

15:14 sexpGirl: s/technomany/technomancy/

15:16 "apt-get install maven", 145 newly installed, 261 MB of additional disk space will be used <-- geez!

15:17 lpetit: sexpGirl: no maven.jar is needed.

15:18 sexpGirl: @lpetit: ok, thanks

15:18 lpetit: sexpGirl: how did you install leiningen? Which version ?

15:19 abalone: are there any reasons to use (take 1 ...) instead of (first ...) ?

15:21 emezeske: abalone: (take 1) returns a lazy sequence, so it doesn't necessarily realize the first element

15:21 abalone: (first) returns the element itself, thus necessarily realizing it

15:21 abalone: emezeske: thanks!

15:23 sexpGirl: @lpetit: Leiningen 2.0.0-preview10 ran the shell script which did install everything. Note that everything seems to work fine: I did create a project, I can run "lein deps" from a shell, I can "nrepj-jack-in" from Emacs etc. It's only once I start to add a free-floating .jar that I enter a world or hurt :-/

15:24 lpetit: sexpGirl: "add a free floating .jar". Can you explain (repeat?) how you actually added this free-floating .jar ?

15:24 scriptor: sexpGirl: side note, you don't have to prefix nicks with an @, also most irc clients let you autocomplete nicks by hitting tab

15:26 sexpGirl: @lpetit: sure, I did use "lein localrepo", here's a quick summary of what work and what doesn't: http://pastebin.com/XZxmwUun

15:26 Moses_: Anyone here use lein-cucumber? I've been trying to get it working for 2 days, seems a bit quirky. I wonder if I'm doing something horribly wrong.

15:27 sexpGirl: lpetit: (oops, got the <tab> this time ; ) basically lein localrepo seems to work, it does create the ~/.m2/ repo, it does list myjar when I do "lein localrepo list" but as soon as I had the dep into project.clj "lein deps" fails (and hence my nrepl-jack-in fails)

15:30 lpetit: sexpGirl: having lein deps not working after a lein-localrepo call seems consistent with what the "Free-Floating Jars" section of https://github.com/technomancy/leiningen/wiki/Repeatability is saying

15:30 beberlei: hi, could someone hint me why http://pastie.org/4831277 still produces "Exception: org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of clojure.lang.MapEntry. Use setObject() with an explicit Types value to specify the type to use." in the [(cast. ] line?

15:31 lpetit: sexpGirl: meaning, it's like you're out of luck if you don't publish it on the evil Internet, or an internal Nexus / Archiva server, or a private s3 bucket

15:32 sexpGirl: I can imagine you can somehow add a :repositories key to your :user profile, tho I don't know what kind of undesired side effect this may have

15:34 sexpGirl: lpetit: damn... That's where I start to question if tying "Maven-the-kitchen-sink" to the lein was really that great. I mean, sure, Maven decided it was better to not commit .jar to your (D)VCS but we've always been doing exactly that and we have 100% deterministic and reproducible builds and 0% of Maven here :(

15:36 but oh well... private S3 bucket it may be then (I'll still try a few other things first). One more thing to do on my TODO list ; )

15:38 beberlei: fixed it myself

15:38 lpetit: sexpGirl: sorry, I think I've seen answers to this elsewhere, but don't remember. Good luck

15:40 Moses_: What testing engine should I be using with Clojure? I've been trying lein-cucumber, but that seems impossible to get working. Is there something else out there that's more widely accepted by the community?

15:40 Raynes: sexpGirl: Everyone ever decided committing binaries to something like git is terrible. What happens when you change update those jars to new versions over time? With even small jars, the repository will eventually grow unreasonably large.

15:41 hiredman: clojure.test is what we use at work, and it is what comes with clojure

15:41 and clojure.test tests are what lein's built in testing stuff runs

15:43 Moses_: Thanks hiredman, I'll just use that.

15:44 sexpGirl: @Raynes: it works fine for us, medium codebase, around 300KLOC. I'm just a bit bitter that Maven if forced down anyone's throat who want to do 'serious' Clojure work (not everyone agrees that Maven is great, far from it). But if it's what has been decided, then so be it and I'll learn it ; (

15:44 hiredman: lein is not maven

15:44 it uses the same dependency resolution stuff, but that is it

15:46 emezeske: sexpGirl: Why do you commit the jars to version control, though, as opposed to just tagging your releases and having a top-level build target that recreates all of the jars?

15:46 hiredman: if you have a team project, I strongly recommend setting up something like archiva over messing with lein-localrepo

15:46 Raynes: sexpGirl: Can you paste the contents of ~/.m2/repository/myjar/myjar/1.0.6/myjar-1.0.6.pom ?

15:47 hiredman: do not check in jars

15:47 sexpGirl: @Raynes: that's the thing: there's no pom, so I'm manually creating one : )

15:47 ivan: jars in version control = free stabbing

15:47 Raynes: Also, 300KLOC is a medium codebase? I just caught that one. Wow. I've been writing Clojure for too long. I've never even seen 300 lines of code.

15:48 300k lines of code*

15:48 emezeske: Raynes: I'd actually call 300k small-to-medium

15:49 sexpGirl: @Raynes: that is one the reason I'm learning Clojure ; )

15:49 emezeske: Raynes: In the corporate world, at least

15:49 Raynes: In what language?

15:49 mefesto: probably java/spring/hibernate/xml hell

15:49 or javaee

15:49 hfaafb: 300k is small coming up on medium?

15:50 * emezeske adds an asterisk followed by IMHO.

15:50 sexpGirl: @hfaafb: in Java Spring / hibernate / XML hell I'd say it's about between small and medium but closer to medium ; )

15:51 Hodapp: hmm, let's see how many lines of C++ I have here

15:53 Raynes: I should write a script to count the lines of all of flatland's projects.

15:54 I'd be surprised if they passed 10k together.

15:54 sexpGirl: find . -iname "*clj" -exec cat {} \; | wc -l

15:54 ; )

15:54 Hodapp: bash-4.1$ find | egrep "\.(cpp|h)$" | while read N; do cat "$N"; done | wc -l

15:54 591917

15:54 Raynes: I'm doubtful they'd even near it.

15:54 hfaafb: 591k

15:54 Hodapp: 710671 if I add in .c, .java

15:54 hfaafb: what does that program do

15:55 Hodapp: not much

15:55 it's "Enterprise"(tm)(c)(r)

15:56 and let's be honest, it's C++, so about 560K of that 591K is just there as scaffolding for the 31K

15:56 Raynes: Hah

15:56 paultag: not like java

15:56 * paultag ducks

16:00 sexpGirl: OK I'm making progress... I wrote a .pom and now I can nrepl-jack-in and at the REPL I can see my jar if I do, say: (println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))

16:09 jcromartie: if you want to count lines of code, go get cloc

16:09 http://cloc.sourceforge.net/

16:10 I use it all the time

16:10 :) like when comparing the initial Java version of this API to the Clojure version (1500 -> 150)

16:12 Amaryl: thanks for the tip!

16:17 aaelony: what's an idiomatic way to take 2 structures (each is a vector of maps) and join / merge them by common key? https://www.refheap.com/paste/5342

16:18 Moses_: Does this sound like a lein problem? http://pastie.org/4831468

16:21 jcromartie: ,(map merge [{:a :foo} {:a :bar}] [{:b :bat} {:b :baz}])

16:21 clojurebot: ({:b :bat, :a :foo} {:b :baz, :a :bar})

16:21 tos9: aaelony: (map into s1 s2) Seems like a thing. No idea if there's something even more obvious.

16:21 jcromartie: map into or map merge

16:21 technomancy: Moses_: which lein version is that?

16:21 Raynes: aaelony: (map merge s1 s2)

16:21 jcromartie: merge-with for more control

16:21 hiredman: Moses_: it is a problem with your user.clj

16:21 Moses_: Leiningen 2.0.0-preview10 on Java 1.6.0_24 OpenJDK Client VM

16:21 aaelony: jcromartie & tos9 thanks, I need to learn this!

16:22 xeqi: Moses_: looks like a lein-cucumber problem; https://github.com/nilswloka/lein-cucumber/blob/master/project.clj requires [leiningen-core "2.0.0-preview3"] for some reason

16:22 Moses_: user.clj is not a part of my project =\

16:22 technomancy: Moses_: if you are just getting started with the language I would strongly suggest using clojure.test instead of cucumber

16:22 hiredman: Exception in thread "main" java.lang.Exception: Too many arguments to def (user.clj:14)

16:22 that tells you on which line to look

16:22 technomancy: hiredman: probably leiningen.core.user

16:22 aaelony: raynes, thanks too

16:22 Moses_: Okie dokey, thanks everyone

16:23 pandeiro: what is the equivalent to the :dev dependencies in lein2?

16:23 xeqi: :profiles {:dev {:dependencies ....}}

16:25 pandeiro: xeqi: thanks

17:01 Raynes: Jose Valim on twitter: "@IORayne everyone here knows you! You should come next year :) and tks for talking about elixir to others !"

17:01 technomancy: I bet you spent the whole time there talking about me and how fantastic I am.

17:02 technomancy: dude I opened up mix and I saw task chaining via the `do` task and it warmed my icy heart

17:02 I think I told him to add proper alias support, but I don't think that's happened yet

17:07 Cheiron: Hi, I installed clojure-vim but what do i need to know about it (i'm familiar with vi) ?

17:07 aperiodic: what is clojure-vim? pretty much everybody uses vimclojure and/or slimv

17:08 Cheiron: yes sorry, i mean vimclojure

17:08 my bad

17:08 emezeske: Cheiron: ":help vimclojure"

17:09 SegFaultAX: Isn't running :help foo the first thing anyone does after installing something in vim?

17:09 emezeske: SegFaultAX: Apparently not.

17:10 Cheiron: i'm getting E149: Sorry, no help for vimclojure

17:10 scriptor: isn't there a readme?

17:10 Cheiron: yes should be. thanks for help all

17:11 SegFaultAX: Sounds like you either didn't install it correctly or you haven't built the helptags.

17:11 thorbjornDX: Cheiron: how did you install it? using pathogen?

17:12 Cheiron: no, extracting the zip and move it by hand

17:12 SegFaultAX: Cheiron: Run helptags on it then.

17:12 Cheiron: oki, thank you

17:13 antoineB_: hello

17:14 SegFaultAX: antoineB_: Hallo.

17:15 antoineB_: assuming i have a (java) function that use CharSequence[] or a ByteBuffer, can i pass to it clojure object?

17:15 in other word need i convert so seq into a java Object?

17:16 *convert a seq

17:17 emezeske: antoineB_: Is this related? http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/to-array

17:18 hiredman: seqs are java objects

17:18 SegFaultAX: Clojure objects /are/ java objects.

17:19 mindbender1: emezeske: how can I get rid of this error: ERROR: JSC_MISSING_PROVIDE_ERROR. required "goog.dom.query" namespace never provided

17:20 I'm trying to compile domina and I'm getting the error

17:20 antoineB_: emezeske: i think it should do the trick

17:20 thanks

17:20 emezeske: mindbender1: I guess probably by providing goog.dom.query

17:20 antoineB_: so if seqs are java object, what they inherit from?

17:20 hiredman: depends on the seq

17:21 SegFaultAX: antoineB_: Let me be more specific: everything in Clojure is just Java.

17:21 hiredman: ,(supers (class ()))

17:21 clojurebot: #{clojure.lang.IMeta java.lang.Iterable clojure.lang.ISeq clojure.lang.IPersistentCollection java.util.Collection ...}

17:21 emezeske: mindbender1: What version of domina/lein-cljsbuild?

17:21 hiredman: ,(supers (class []))

17:21 clojurebot: #{clojure.lang.IMeta java.lang.Iterable clojure.lang.IPersistentCollection clojure.lang.IFn java.lang.Comparable ...}

17:21 emezeske: mindbender1: I think if you're using the latest versions of each that should not happen

17:21 hiredman: ,(supers (class #{}))

17:21 clojurebot: #{clojure.lang.IMeta java.lang.Iterable clojure.lang.IPersistentCollection clojure.lang.IFn java.util.Collection ...}

17:21 antoineB_: ok

17:21 hiredman: etc

17:21 mindbender1: emezeske: ok let me make sure

17:23 antoineB_: thanks

17:23 SegFaultAX: Why is it that I enjoy porting bits of Clojure to Lua so much?

17:24 Raynes: Do you also enjoy cutting yourself and bdsm?

17:24 If so, you might be a masochist.

17:24 SegFaultAX: Raynes: Why do you say that?

17:24 ivan: I hear some ClojureScript thing can emit Lua

17:24 SegFaultAX: Raynes: Not a fan of Lua?

17:24 Raynes: Because this is #clojure and I need to be biased.

17:25 Port bits of Lua to Clojure instead. More fun.

17:25 SegFaultAX: Raynes: There's nothing to port. I can't think of a single Lua feature that Clojure doesn't already have or support.

17:28 technomancy: 1-based vectors?

17:28 that may have been below the belt =)

17:28 SegFaultAX: technomancy: That's a misfeature of Lua.

17:28 * SegFaultAX *ducks*

17:29 technomancy: don't know if you'll find anyone disagreeing within a few netsplits of this channel

17:31 jcromartie: oh boy Clojure and Lua :)

17:31 I spent 6 months doing Lua full-time

17:31 I loved it before that...

17:32 casion: I did some renoise stuff in Lua… that's why I ended up trying clojure again. My hate of developing stuff in lua

17:32 jcromartie: but this system twisted and abused it beyond belief….

17:32 casion: it grew to a substantial and unreasonable size

17:32 SegFaultAX: I not a big fan of the "Everything is a Table. Everything. (Except numbers, strings, threads, functions, userdata, booleans, and nil)

17:32 "

17:33 jcromartie: I think it's more that the only collection type is the table

17:33 if you don't count strings

17:33 SegFaultAX: jcromartie: Exactly.

17:34 jcromartie: but I've had pleasant experiences in Lua

17:34 SegFaultAX: jcromartie: Js suffers from the same problem. At least it pretends to have Arrays (not really, though). Maybe it's symptomatic of all prototypical languages? I don't know.

17:35 jcromartie: yeah, I think I see Lua as a slightly more pure JS

17:37 SegFaultAX: jcromartie: I think if they added an array-type collection to Lua, I would be infinitely happy. The ugliness of the standard library because tables can be used as arrays or maps bothers me. Plus it would make functional programming in Lua a bit nicer.

17:37 jcromartie: iterating over different kinds of collections using the same few higher-order functions sounds familiar :)

17:38 but yeah

17:42 SegFaultAX: jcromartie: Upon further reflection, I also think some sort of tuple type would be a fantastic addition. Or a collection that can actually be used as a key in a map.

17:42 jcromartie: you can't use a table as a key? it's been a while

17:43 SegFaultAX: jcromartie: Sure you can. But the implementation uses the pointer as the key internally.

17:43 jcromartie: Which means to index that key, it has to be the /exact same object/.

17:43 jcromartie: yeah, not the value

17:45 SegFaultAX: jcromartie: Not having hashable tables makes sets very hard to implement.

17:45 jcromartie: So some other hashable collection could be introduced.

17:50 gjcourt: say I do a (ns foo (:require [clojure.tool.logging :as logging]) (pringln logging))

17:50 hiredman: won't work

17:50 gjcourt: right, is there any way that will work?

17:50 hiredman: (the compiler will spit out an error)

17:51 gjcourt: i get this ompilerException java.lang.RuntimeException: Unable to resolve symbol: logger in this context,

17:51 hiredman: gjcourt: how about you just ask how to do what you want to do, instead of asking how to make your half solution work

17:52 gjcourt: ok, i want to import clojure.tools.logging into a namespace and then use functions from logging as if it were in that namespace

17:53 gfredericks: (ns foo (:require [clojure.tools.logging :refer [the functions I want to use]]))

17:53 hiredman: are you saying you want to re-export the functions?

17:53 SegFaultAX: gjcourt: Also, http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html

17:53 gjcourt: That's the best article I've found for learning how require/import/use/refer work.

17:54 gjcourt: Including the nice shorthand syntax that the ns form provides.

17:54 gjcourt: thanks for the resouces guys :]

17:57 hiredman: ideally i could re-export then, yes

17:57 hiredman: gjcourt: is that your end goal?

17:58 gjcourt: i would like to be able to (use 'foo) (info "hello world")

17:58 where foo exports the info of clojure.tools.logging after setting up log4jk

18:00 hiredman: why?

18:00 clojurebot: why not?

18:01 hiredman: what problem doesn that solve that using tools.logging directly doesn't?

18:01 gjcourt: hiredman ideally i'd use http://www.paullegato.com/blog/log4j-clojure/ and the clj-logging-config library, but i need a custom appender and I'm not sure if clj-logging-config will allow me to config https://github.com/kencochrane/raven-java

18:02 hiredman: gjcourt: is that really an answer to my question?

18:02 gjcourt: exporting functions into my namespace is what it's not doing for me

18:03 hiredman: you have some code you want to run that configures the logger, and you have some code that logs

18:04 Moses_: Anyone know of a good example of doing model testing in clojure web apps? I'm trying to figure out how I should write my database backed model such that its easy to test.

18:04 hiredman: configuring logging and logging are two different things, so why not have a namespace that configures logging then you load it, and then just use clojure.tools.logging directly

18:04 gjcourt: and ideally that would all be owned in a "logging" namespace from withing my project so that I only have to do it once

18:04 hiredman i could do that

18:05 in fact it's what I'm doing, albeit not working atm because of some log4j wonkiness i don't understand, but yes

18:05 hiredman: gjcourt: have you considered just using log4j.properties? it is nice declarative logging config, which clj-logging-config is not

18:05 gjcourt: i have a log4j.properties

18:05 hiredman: and you need further config?

18:06 gjcourt: hiredman: http://dl.dropbox.com/u/2110/Screenshots/0i2.png

18:06 im wondering why the appended isn't doing what it's supposed to be doing... and how i could be mis-configuring it

18:06 appender*

18:15 casion: is there any decent modern source of info on dealing with XML in clojure? almost everything I'm finding is out of date

18:18 hyPiRion: casion: http://clojuredocs.org/clojure_core/clojure.xml

18:18 Is that what you're after?

18:19 casion: hyPiRion: I've been trying to use clojure.xml and I'm not getting very far

18:19 I need to parse, diff, mutate and write a large xml file

18:20 brehaut: casion: do you know about clojure.data.xml ?

18:20 mindbender1: emezeske: which cljsc does cljsbuild use when compiling clojurescript. Is there a place where I can get extensive documentation on how to configure the behavior and environment for cljsbuild

18:20 hyPiRion: ooo

18:20 casion: brehaut: no I do not

18:20 hyPiRion: (nevermind that, I'm cleaning my keyboard)

18:21 brehaut: casion: https://github.com/clojure/data.xml

18:21 casion: brehaut: thank you!

18:21 dnolen: mindbender1: the cljs compiler doesn't offer much more than what lein-cljsbuild provides. but no there's not a really a good reference atm beyond the source.

18:22 brehaut: casion: its not a panacea, and is i think a WIP, but its better than just clojure.xml by itself. i also use data.zip with it from memory

18:22 mindbender1: dnolen: I especially need to let cljsbuild know that goog.dom.query was provided by goog/dojo/dom/query.js, how can I do that

18:23 I have tried passing the libs option

18:23 casion: brehaut: I've been trying to mess around with data.zip, but I'm having trouble wrapping my head around mutating things once I've hit the element I need

18:24 brehaut: casion: im trying to find an example of using it myself

18:24 i also find it a wee bit of a mind bender

18:25 casion: i cant claim this is a good example, but https://github.com/brehaut/necessary-evil/blob/master/src/necessary_evil/value.clj

18:25 casion: looks like im using clojure.zip, clojure.xml, clojure.data.zip and clojure.data.zip.xml but not data.xml ?

18:25 dnolen: mindbender1: that's definitely a question for emezeske

18:26 brehaut: casion: so that shows how much i know sorry :(

18:26 casion: brehaut: I think you're making things worse lol :)

18:26 brehaut: yup

18:26 very sorry

18:26 mindbender1: emezeske: come to my rescue

18:27 casion: brehaut: data.xml is a good re-start for me though, I think I can work with this

18:27 brehaut: phew. good luck

18:27 casion: you know, besides rewriting a day's worth of work

18:27 brehaut: :/

18:27 * casion curses xml

18:28 Cheiron: hi, vimclojure doc, section Omni completion . <C-X><C-O> i tried command-x and ctrl+x but nothing happened. what I'm missing?

18:28 mindbender1: cljsbuild source is actually a beast of a source

18:29 brehaut: casion: i dont know how they interact with data.xml but xml-> and xml1-> from data.zip.xml are really useful for walking stupid xml verbosity (such as you find in xml-rpc)

18:29 emezeske: mindbender1: I don't think you need to do anything special to use query.js, as long as it's on the classpath

18:29 sexpGirl: ooooh that is so sweet: our old (fatty) internal desktop Java apps have a custom way to add jars to the classpath dynamically at runtime (don't ask me why: not my call and it's been working fine since years and years) but... The nice stuff is I can call that method from Clojure's REPL (nrepl / nrepl.el under Emacs) and all our jars are dynamically added to the classpath. Me happy : )

18:29 mindbender1: emezeske: how do i get it on the path is my problem.. goog third party provides it

18:30 emezeske: mindbender1: Use the latest domina,?

18:30 mindbender1: yes

18:30 emezeske: That should be all AFAIK

18:31 casion: brehaut: I'm getting so confused between clojure.zip, clojure.data.zip, clojure.xml, clojure.data.zip, clojure.data.xml, clojure.data.zip.xml

18:31 brehaut: yeah :/

18:31 emezeske: mindbender1: https://github.com/levand/domina/blob/master/project.clj

18:31 mindbender1: Domina depends on the third-party stuff.

18:31 casion: I would think someone has to have figured this out in the cljs world?

18:31 emezeske: mindbender1: If you're having problems, I think probably you need to talk to someone who knows about domina

18:32 mindbender1: You are using domina "1.0.1-SNAPSHOT" ?

18:32 mindbender1: emezeske: ok thanks I'll try

18:32 yes

18:32 emezeske: mindbender1: Oh, wait, I have a thought

18:32 mindbender1: Domina has the third-party lib as a dev dependency

18:33 mindbender1: Are you using the dev profile?

18:33 mindbender1: yes

18:33 no

18:33 emezeske: Try that.

18:33 TimMc: hyPiRion: Locking screensavers are pretty much the best thing for when you nee to clean your keyboard.

18:36 casion: it seems like data.zip.xml is the most reasonable option for parsing and data.xmp for writing

18:36 xml*

18:40 mindbender1: emezeske: yay!

18:41 how could I not have thought about that..thanks o much

18:41 emezeske: mindbender1: Glad to hear you got it working. Suggestion: fix the Domina docs!

18:42 They should definitely mention that.

18:42 mindbender1: emezeske: ok will do

18:47 hyPiRion: TimMc: I'll keep that in mind.

18:48 technomancy: https://github.com/heroku/pulse/blob/master/src/pulse/emitter.clj#L31 <- is there ever a way this would make sense?

18:48 (take-last (count @some-seq) @some-seq)

18:48 o_O

18:49 hiredman: technomancy: take-last, not take

18:49 metellus: some-seq could change between the count and the take-last

18:50 it's not wrapped up in a dosync

18:50 technomancy: hiredman: I mean if N is the size of the seq, take is take-last, right?

18:50 metellus: yeah, but take here is essentially identity, which is easy to do atomically =)

18:52 metellus: they do a lot more inside that let though, and it's all dependent on the value of (count @stats-buff-a)

18:53 technomancy: sure, but if you deref the seq first, then count that, it'd be guaranteed to be consistent

18:53 metellus: they also need to drop-last, but yes

18:53 I agree that they could and probably should do it that wya

18:53 way

18:54 sexpGirl: at the repl, is there a way to get a handle to the last object returned (from the last repl call)?

18:54 Say I just created a JFrame and I'd like to close it, can I "get" it?

18:55 hiredman: you have *1, *2 and *3

18:55 mindbender1: technomancy: how can I get lein2 install task to install to local .m2 repo rather than just writing the jar to the taget dir

18:55 technomancy: mindbender1: I don't understand

18:56 sexpGirl: @hiredman: thanks, works fine

18:57 mindbender1: technomancy: oh sorry I think that's because cljsbuild hooked into the install task so the jar was written to the target dir

18:59 emezeske: mindbender1: lein-cljsbuild doesn't hook into install

18:59 mindbender1: emezeske: it does

18:59 emezeske: https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild.clj#L239

18:59 It doesn't

18:59 It might hook some other task that gets invoked during install

19:01 sexpGirl: so if there's *1, *2 and *3, when is an object returned by the REPL eligible for GC? (it's just out of curiosity)

19:02 mindbender1: when I first ran lein install in the domina root it triggered cljsbuild maybe the install task triggers the compile task

19:02 emezeske: I'm pretty sure it does.

19:03 Anyway, I'm not sure what lein-cljsbuild has to do with .m2 repos or jars in target dirs

19:05 mindbender1: emezeske: I wanted the domina jar to be installed in my local .m2 repo

19:05 so that lein can pull it in from there

19:06 emezeske: But... what does that have to do with lein-cljsbuild ?

19:07 mindbender1: emezeske: nothing.. I thought it was a problem with lein to see the jar get written to the target dir

19:07 emezeske: I see.

19:07 mindbender1: but that's because it has hands off to cljsbuild

19:08 which I suspect wrote the jar to target dir

19:08 aperiodic: mindbender1: lein wrote the jar to the target dir. you need to have a jar to install, so it makes it, and it has to put it somewhere before it installs it, so it goes in the target dir.

19:09 mindbender1: aperiodic: what happens afterwards.. do I go to the target dir and invoke lein install again

19:09 aperiodic: mindbender1: no. the jar has been installed. you don't need to do anything.

19:10 mindbender1: i don't know why seeing the jar in the target dir is throwing you for such a loop

19:11 technomancy: sexpGirl: *1, *2, and *3 are all references that would prevent GC, if that's what you mean

19:12 mindbender1: aperiodic: because i actually thought it hadn't and maybe that I have to manually use mvn to install it

19:12 aperiodic: mindbender1: lein is awesome. trust it. ;)

19:12 mindbender1: sure

19:12 aperiodic: mindbender1: if you're really worried about that, though, you could just look in your ~/.m2

19:12 mindbender1: i did

19:12 it's there

19:21 mpan: ,'&

19:21 clojurebot: &

19:21 lazybot: java.lang.RuntimeException: EOF while reading

19:23 mpan: it's just a regular symbol, right? just that fn and the like treat it specially?

19:32 holo: hi

19:33 SrPx: How do I slice a collection? [1 2 3 4 5] to [2 3]

19:34 TimMc: mpan: Yes, the destructuring macro captures it. You can in fact (def & 5).

19:34 SrPx: subvec on vectors if you don't mind that it keeps a reference to the original vector.

19:36 sexpGirl: GC on a REPL return value can't happen until the value is a few lines back.

19:37 SrPx: It keeps a reference? How?

19:38 hiredman: trees

19:38 holo: i installed lein-heroku by putting :plugins [lein-heroku "0.1.1"] in project.clj. with lein deps it downloaded the file, but when i do `lein heroku help`, lein says: heroku is not a task. Use "lein help" to list all tasks. what's going bad?

19:40 technomancy: holo: that plugin is pretty old; I'd recommend using the toolbelt instead

19:40 the JVM boot time is too annoying anyway

19:40 for it to be a pleasant experience

19:42 TimMc: SrPx: subvec just modifies the index you give it and passes it through to the underlying vector.

19:43 SrPx: Is it any bad? TimMc

19:43 TimMc: s/you give it/you give the resulting vector-like get method/

19:43 Frozenlock: The google closure library offers a function to encode in base64, but accept an argument to make it 'websafe' and use an alternate alphabet. Does it mean that browsers won't accept some characters normally used in the typical base64? http://closure-library.googlecode.com/svn/docs/closure_goog_crypt_base64.js.html

19:44 TimMc: SrPx: It's only bad if the original vec is huge (or you do this in a big loop) and you don

19:44 't let go of the subvec for a while.

19:46 SrPx: Is there an alternative ?

19:46 Hm nvm,

19:46 holo: technomancy, i read a previous irc conversation with your intention to give up on this. i thought the development continued anyway, as there is a commit of about 16 days. i think besides those reasons, to have a git integrated, hands-off heroku tools installation is something desirable

19:46 technomancy: holo: the template is still maintained, and for the time being it's in the same repository

19:47 how do you mean git-integrated?

19:48 SrPx: if I have a function 'shift' that rotates a vector 1 step right, and I want to rotate it n steps right, how do I do it? (what-goes-here n (shift my-vector))

19:48 holo: technomancy, i mean self contained

19:48 technomancy: you mean something that can be declared in project.clj?

19:49 holo: technomancy, yes, distributed as code, and then installed automatically inside the same repo

19:49 technomancy: yeah, there are pros and cons

19:50 the major drawback is that it will always be lagging behind the canonical implementation and will only ever implement a pretty small subset of the commands

19:50 SrPx: wow, technomancy here ...

19:53 technomancy: I'm always here

19:54 SrPx: That's awkward.

19:54 Frozenlock: technomancy in #clojure is like the sun's rising each morning, except it's even more certain.

19:54 SrPx: Suddenly I feel like I'm around the people who run the world.

19:55 Anyway, what is the right way to do this, again? (dotimes [x n] (last (do-something my-vec))) I know this is too verbose, I just want to apply do-something to my vector n times and return the result

19:56 aperiodic: (nth (iterate do-something my-vec) n)

19:56 technomancy: dotimes is for side-effects

19:56 SrPx: Hmm lmgt

19:59 Thats fine, thanks

20:13 dale: I've got a map of objects from a Java library in an atom. I'm writing a function that does "find new object or create new and store it in the map." The catch is that creating the object has side-effects. What's the best way to do that? Right now I'm doing (locking the-map-of-objects ...find or create...).

20:14 I'm not sure if it's advisable to grab the guard on a Clojure map instance? Would it be better to do something like compare-and-set the key in the map to my thread ID, and then only create and store the object if compare-and-set actually set?

20:14 hiredman: locking an immutable map is ridiculous

20:15 e.g. any "change" is a new map, so your lock does nothing

20:15 so you need to lock something else

20:15 dale: Duh, yes, thanks.

20:15 As it turns out I'm actually locking the atom that contains the map, sorry.

20:16 So change my above comment to read "I'm not sure if it's advisable to grab the guard on an atom." I don't know if Clojure does that itself. Really I just need any object I can lock so I can serialize the operations.

20:16 hiredman: dale: you may consider just using the contrib cache stuff

20:17 dale: https://github.com/clojure/core.cache

20:20 dale: hiredman: OK, thanks, reading that now.

20:21 hiredman: (I am assuming you are making a cache or something similar)

20:22 dale: It's really not a cache. I'm working on a XMPP bot, so it's a collection of rooms the bot is in.

20:22 hiredman: seems pretty straight forward

20:22 (swap! a conj (get-room-name))

20:23 Cheiron: Hi, what does this error mean: CompilerException java.lang.IllegalArgumentException: No matching ctor found for class

20:23 hiredman: ctor means constructor

20:24 chouser: It means your parameter count or types are incorrect

20:24 Cheiron: i'm trying to call SpoutConfig from clojure https://github.com/nathanmarz/storm-contrib/blob/master/storm-kafka/src/jvm/storm/kafka/SpoutConfig.java

20:25 for the first parameter I did: (java.util.ArrayList. ["localhost"]) and for the second: number-of-partitions (int 7)

20:25 the remaining three are strings

20:26 dale: hiredman: I've got a map of room names to MultiUserChat instances, which are objects you use to interact with the room. So my current code does (swap! rooms assoc room-name multi-user-chat-obj).

20:26 hiredman: dale: I would not recommend keeping mutable stateful objects inside clojure reference types

20:26 well, maybe an agent

20:27 Cheiron: here is http://pastie.org/4832604

20:28 hiredman: dale: consider just keeping string names and recreating the muc objects as required, or keeping strings + a memoized string->muc function

20:28 dale: hiredman: I thought about using an agent, but that felt a bit like overkill. Plus the "asynchronicity" of that gets in the way of the API I'm trying to develop a bit. I could do that, though.

20:28 aperiodic: Cheiron: gotta put the (int number-of-partition) in the ctor special form

20:28 Cheiron: otherwise it's a long

20:29 dale: hiredman: Can you give me the gist of the problem with keeping some library's stateful/mutable objects in a Clojure map?

20:29 Cheiron: aperiodic: sorry but i'm not following you, I already calling (int) on number-of-partitions

20:30 aperiodic: Cheiron: by the time it gets to the ctor, it's a long.

20:30 Cheiron: aperiodic: ? why?

20:31 hiredman: dale: functions applied to refs or atoms can be run multiple times, so something like (swap! a (fn [x] (.someMethod (:blah x)))) can result in calling .someMethod multiple times

20:31 dale: hiredman: A memoized string->muc function would seem to be the same thing I'm proposing, looking at the source for (memoize). It looks like it just makes an atom with a map. It also wouldn't prevent me from accidentally creating two MultiUserChat instances for the same room if two requests to join came in at the same time.

20:31 hiredman: dale: the clojure reference types are designed to provide indentities over values

20:32 Cheiron: aperiodic : this (SpoutConfig. kafka-brokers (int number-of-partitions) docs-jobs-topic zk-root consumer-id) still issues the same error

20:33 hiredman: Cheiron: make sure the code you are looking at in github matches the version of the library you are running against

20:33 aperiodic: Cheiron: hmm... I can't reproduce this now, but i feel like i've run into that before

20:33 Cheiron: ignore me

20:35 Cheiron: hiredman: other possible diagnoses?

20:35 hiredman: Cheiron: the code you are actually running (whatever version of the library you pulled in) is not the same as what is on the master branch in github

20:36 so check

20:36 man javap and dump the bytecode of the class

20:36 dale: hiredman: OK, I can appreciate that. However, practically speaking, I've got these muc instances I want to keep around. I guess I'm asking what the best way to interop with Java is in this case. Use of locking is just the first thing that came to mind.

20:37 hiredman: the best way is to avoid xmpp and smack if you can do it :)

20:38 streaming xml is not a good start to anything

20:38 aperiodic: i think i was confusing two different changes that happened with 1.3 numerics

20:38 dale: Heh.

20:39 Cheiron: hiredman: that is scary :D you are right!!

20:39 dale: I'd actually rather be on IRC, but unfortunately I'm on XMPP. Smack is actually pretty nice looking to me so far.

20:39 hiredman: last time I messed with smack, I found that dealing with it at a very low level (below most of smack) was best

20:39 dale: Complete non-Clojure-ness of Smack aside.

20:39 OK, I'll just keep my use of locking in place until something blows up on me because of it.

20:40 hiredman: so I would create muc objects, which would cause smack to join the muc, then just discard the objects and deal with the packets directly

20:40 dale: I'm actually kind of surprised this isn't a more common issue when dealing with Java libraries, but I haven't done much with Java in a good long while I suppose.

20:40 hiredman: https://github.com/hiredman/clojurebot/blob/master/src/hiredman/clojurebot/xmpp.clj#L71

20:41 technomancy: is CL-style gensym usage the only way to make a macro that has a let which spans multiple syntax-quotes?

20:41 I should know this

20:41 hiredman: yes

20:42 technomancy: cool, thanks

20:42 aperiodic: what is CL-style gensym usage?

20:42 mpan: Is there a recommended way to reinterpret the standard "loop and modify state" operations of an imperative application in a functional style?

20:42 hiredman: ,(let [x (gemsym)] `(let [~x 1] ~x))

20:42 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: gemsym in this context, compiling:(NO_SOURCE_PATH:0)>

20:43 hiredman: ,(let [x (gensym)] `(let [~x 1] ~x))

20:43 clojurebot: (clojure.core/let [G__54 1] G__54)

20:43 mpan: as in, the main loop of a given application

20:43 technomancy: aperiodic: you don't want to know; it's a mess =)

20:43 gfredericks: mpan: the simplest transformation is the loop form; but probably not the most idiomatic

20:44 mpan: or rephrased: how do clojure applications tend to structure the core of their state and its transformations?

20:44 gfredericks: state is avoided when you can do it without bending over too far backwards; 98% of the rest of the time you use an atom or two

20:46 rads: mpan: the book Clojure Programming has some good information on that topic

20:47 mpan: thanks guys!

21:00 SrPx: Why this won't work? (def (symbol "x") 1)

21:00 Bronsa: because def expects a symbol

21:00 and (symbol "x") wont get evaluated

21:00 SrPx: How do I make a symbol from a string?

21:01 Bronsa: dirty trick, (def #=(symbol "x") 1) but don't do that.

21:02 emezeske: SrPx: (eval `(def ~(symbol "x") 1))

21:02 SrPx: I would probably never do that, though

21:02 SrPx: Why?

21:02 clojurebot: why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

21:02 emezeske: SrPx: Why do you need to def something where you don't know the symbol name up front?

21:02 brehaut: these days the answer to why is the ram gone is frequently 'jquery'

21:03 Bronsa: just (defmacro (def-by-string [str & body] `(def ~(symbol str) ~@ body))

21:03 (defmacro def-by-string [str & body] `(def ~(symbol str) ~@ body))

21:04 SrPx: emezeske: something like that (doseq [op ["+" "-" "*" "/"]] (defn (str "vec" op) ...))

21:04 to define vec+, vec- and so on (just for learning)

21:04 Bronsa: do you know a good macro tutorial?

21:06 emezeske: SrPx: I see. A macro is definitely what you want, then.

21:07 As an aside, I would note that * and / for vectors will have substantially different implementations than + and -, if you want to follow the mathematical semantics...

21:08 SrPx: No no.

21:08 emezeske: :)

21:08 SrPx: Any recommended macro tutorial , though ?

21:09 emezeske: SrPx: A last quick question: is (vec+ a b) much better than (map + a b)?

21:10 SrPx: emezeske: no, just for learning, really

21:10 emezeske: Cool.

21:11 SrPx: But wait, that wont work

21:11 emezeske: ?

21:15 SrPx: emezeske: nevermind, I thought it was missing a 'zip' somewhere. But if map does what zip does, then what does clojure's zip do? o.o

21:19 SurlyFrog: At one point, were vars dynamic by default and now (1.4.0) you need to explicity specify ^:dynamic when you create it?

21:20 aperiodic: SrPx: turn things into zippers. not at all related.

21:22 SrPx: Might I ask what a zipper is ?

21:23 aperiodic: SrPx: a way of traversing and editing tree structures

21:24 SrPx: Hmm OK. Thanks!

21:24 cemerick: SrPx: Known as Huet Zippers, implemented in clojure.zip

21:25 SrPx: I know I'm asking too much, but I've read somewhere there is a trick you can use with (require) so it brings everything to the current namespace. I can't find it because I don't know the word. What is it?

21:25 casion: oh, new people here…

21:25 SrPx: ?

21:25 casion: wrong chat :| sorry

21:26 while I'm here though I may as well ask again: I need to parse, diff/merge and write and xml file, what would be the ideal way to do about it?

21:26 cemerick: SrPx: You're thinking of :refer; you should generally be selective in what you refer in though: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/require

21:27 casion: and=an

21:28 SurlyFrog: SrPx: If you are at the REPL, you can also use the `use` form. That should take all public functions from the specified namespac and include them in the current namespace.

21:28 SrPx: cemerick: thanks

21:28 SurlyFrog: Only from the REPL?

21:28 SurlyFrog: But, as cemerick stated, it's not really recommended

21:28 better form to just import what you really need

21:30 Um, I /think/ so….I've always `ns` from code

22:05 cjfrisz: I think tonight is a 2 beers while coding kind of night

22:05 But two beers of victory!

22:09 dnolen: cjfrisz: looking forward to your talk!

22:09 cjfrisz: dnolen: Thanks! Are you speaking, as well?

22:10 dnolen: cjfrisz: no, I passed on submitting anything this year.

22:10 cjfrisz: dnolen: But you're going to be there, right?

22:11 dnolen: cjfrisz: but sounds like there'll be good IU representation this year ;)

22:11 cjfrisz: yes

22:11 cjfrisz: dnolen: Excellent! I've been wanting to actually meet you in person!

22:11 dnolen: cjfrisz: the same!

22:13 cjfrisz: Will & Dan's prez went over very at Strange Loop.

22:13 cjfrisz: dnolen: I heard!

22:13 dnolen: cjfrisz: not everday you see a type inference for the simply typed lambda calc built in 10 mins.

22:13 cjfrisz: dnolen: I haven't seen it yet

22:14 clj_newb_234: is CLIM the most amazing GUI that lisp ever had?

22:14 (I'm implementing a graphical interactive repl in clojurescript that executes on clojure, and want to know what to study)

22:49 hammer: so has anyone run clojurebot themselves?

22:49 fiddling with the source code but i can't figure out how to start the thing

22:51 Sgeo_: Is Catnip considered any good?

22:52 hammer: Sgeo_: I haven't used it yet, but it looks really promising, especially with things like noir

22:52 uvtc: Sgeo_: cats think it's pretty swell. ;)

23:29 What is the technical difference between a special form and a macro? I see that `if` and `def` are special froms, whereas `and` and `or` are macros...

23:31 eggsby: a macro is a special form uvtc

23:31 special forms in general are things that do not follow the basic function application/value rules

23:32 i.e. if it isn't just a functions body being gradually substituted by the values of it's parameters then it can be said to be a 'special form'

23:32 uvtc: eggsby: Sounds good. Thanks.

23:33 I noticed that, in the output of `(doc ...)`, it actually spells out "Special Form" for `def` and `let`, whereas others specifically says "Macro".

23:33 But I see what you mean: all macros are special forms.

23:35 eggsby: uvtc: you could say a macro is a special type of special form

23:35 uvtc: It's extra special. :)

23:37 eggsby: if is for building predicates, def is for assigning things for future reference, macros are for manipulating syntax trees :)

23:37 SrPx: http://lispwannabe.wordpress.com/2008/10/24/closures-in-clojure/ this is not a closure, is it ?

23:38 shachaf: Looks like a closure to me.

23:38 But what does "closure" mean? Usually when people say it they refer to an implementation detail.

23:38 If you mean lexical scope, that piece of code certainly uses lexical scope.

23:39 cjfrisz: shachaf: a closure generally refers to a function which closes over the values of its free variables

23:40 shachaf: In the fn that is returned by the function definition, x is free and closes over the value given by the argument

23:40 shachaf: cjfrisz: I know that.

23:41 cjfrisz: shachaf: More generally, a good non-implementational definition of a closure is "code and the value of its free variables"

23:41 shachaf: That seems "implementational" to me. :-)

23:41 Urthwhyte: Quick Q: What's the clj equivalent of mechanize+beautifulsoup?

23:41 SrPx: I thought a closure was a function that returned a function that could access and update variables local to that function

23:42 shachaf: No.

23:42 cjfrisz: SrPx: See my definition above

23:42 shachaf: You're probably best off not worrying about what the word "closure" means. Lexical scope is the important concept.

23:43 eggsby: Urthwhyte: you can use clj-http to scrape html, you could use enlive to parse html and select nodes

23:43 plenty of parsing options tho

23:43 SrPx: cjfrisz: what do you mean with closes over?

23:43 eggsby: SrPx: in either case, clojure *certainly* supports closures :)

23:43 SrPx: https://www.refheap.com/paste/5348

23:44 Urthwhyte: eggsby: Would it be recommended to use clj-http over java.url? I assume it's just a wrapper?

23:44 SrPx: shachaf: why? I liked to use what I thought was a closure on my last language.

23:44 eggsby: clj-http rules Urthwhyte

23:44 you definitely want the ring abstraction

23:44 it makes http a pleasure to work with, java.url not so much

23:45 cjfrisz: SrPx: Do you see how "x" is free in the body of "plusn"

23:45 eggsby: enlive is kind of complex but pretty powerful, there's stuff like tagsoup and things with jquery-ish syntax as well

23:45 SrPx: 'free'?

23:45 cjfrisz: SrPx: The function that "plusn" returns doesn't bind "x"

23:45 SrPx: It uses the value that was passed to plusn

23:45 Urthwhyte: I'm a Python/Ruby convert - working with Java all summer at Google made me appreciate the JVM, but man do I hate the language :(

23:46 eggsby: Urthwhyte: https://github.com/swannodette/enlive-tutorial/

23:46 Urthwhyte: so Clojure is geting me back to scheme roots

23:46 cjfrisz: SrPx: In other words, it's closing over the value of "x"

23:46 eggsby: this tutorial starts out by scraping hackernews

23:46 Urthwhyte: Going through that right now :)

23:46 eggsby: nice

23:46 SrPx: hmm

23:46 shachaf: cjfrisz: I'd be perfectly happy with saying that ((fn [x] (fn [y] (+ x y))) 5) = (fn [y] (+ 5 y)), for example. No free variables. :-)

23:47 eggsby: SrPx: you can call many different things closures

23:47 cjfrisz: shachaf: Yes, but that argument only works in the concrete example of applying that function

23:48 Without the application, x is still free in the body of the inner fn

23:48 shachaf: OK, but you said that the closure is that function *with* its free variables.

23:48 SrPx: That's what I thought of a closure, and it's on the definition on WIkipedia, so let's use that: def counter(): x = 0 def increment(y): nonlocal x x += y print(x) return increment

23:48 How would you implement this in clojure?

23:49 cjfrisz: Ahh, no, I said is the function with the *values* of its free variables

23:49 shachaf: cjfrisz: Right.

23:49 I'm perfectly happy to say "x is free in (fn [y] (+ x y))"

23:50 cjfrisz: shachaf: Good, because that's the right way to say it :-)

23:50 shachaf: Talking about free variables is important.

23:51 Talking about lexical scope is important.

23:51 cjfrisz: Amen

23:51 shachaf: Talking about closures is probably not as important. :-)

23:51 Certainly when you're vague on all these concepts, and you're not implementing anything.

23:52 cjfrisz: shachaf: for the most part, I agree

23:52 I think it's worth getting the idea of lexical scope and free variables down pat first

23:52 That's certainly how all the good PL books present it: lexical scope and free varialbes, *then* closures

23:54 uvtc: Say, jumping in here, but just so I understand the terminology correctly: free variables are the ones which live outside of your lexical scope, but which are closed over and which you can access from inside your local scope, correct?

23:54 shachaf: Are you defining "free variable" in terms of "closure"? :-(

23:55 uvtc: A use of a variable is free in an expression if it isn't bound to anything.

23:55 SrPx: I guess I understand all those

23:56 eggsby: it's strange because in clojure we don't work with variables often

23:56 uvtc: shachaf: Right --- it's already set up outside the lexical scope.

23:56 eggsby: mostly we simply work with values

23:56 shachaf: For example, x isn't free in (fn [x] x), but y is free in (fn [x] y)

23:56 SrPx: The python example I put in implements a counter using closure. It defines x on counter's scope and returns increment which uses that x.

23:56 shachaf: SrPx: Stop worrying about, like, mutation, man.

23:56 SrPx: And increments it. Right? How would you do that in clojure, for illustration?

23:57 shachaf: Don't increment things. Why would you do that?

23:57 uvtc: eggsby: Right. No variables, per se.

23:57 eggsby: in the counter example of mutating some nonlocal state, that's just something you wouldn't do in clojure, you *can*, but it'd be about as far from "idiomatic" as you could get

23:57 SrPx: shachaf: because it is the example ?

23:57 eggsby: now, you could do it by simply redefining some symbol over and over

23:57 shachaf: Well, it's an irrelevant example.

23:57 eggsby: but I don't think that would be a particularly useful example of a closure

23:57 shachaf: Y'all're all about immutability, right?

23:58 SrPx: Sure, will that symbol be on counter's scope?

23:59 eggsby: no, it would be in the namespaces scope

23:59 cemerick: odd: why does (goog.getUid x) work in cljs? (goog/getUid x) also works (as I'd expect).

23:59 SrPx: That's weird

Logging service provided by n01se.net