#clojure log - Dec 07 2012

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

0:04 lynaghk: amalloy: no luck. Here's what I'm trying: https://www.refheap.com/paste/7370

0:05 Raynes: Yay, Kevin uses refheaps.

0:05 lynaghk: each invocation takes the same amount of time (7 seconds...)

0:05 Raynes: trying to get my money's worth =P

0:05 Raynes: And he even takes the time to set the syntax highlighting to the actual language instead of leaving it at 'Clojure'

0:05 amalloy: well at the very least you need to export those vars to the drip process

0:06 it can't see those at all, right now

0:06 Raynes: lynaghk: Man, you don't know how helpful that was.

0:06 lynaghk: amalloy: prefixing with export? No change.

0:06 amalloy: after that i think you have to look up the arcane format of the INIT variables

0:07 ISTR they're a bit weird

0:07 Raynes: I've been getting back into refheap. Going to be working on some new features soon. Important ones are paste history, markdown rendering, and a mechanism for displaying multiple pastes on one page (analogous to github's mutli-file pastes).

0:07 amalloy: but tbh i haven't looked deeply into it; you might want to just email ninjudd, who probably remembers it all

0:07 Raynes: I'll give you your money's worth. Just slowly.

0:07 ;)

0:08 And you will definitely want to *email* him, because you will never elicit a response on IRC.

0:08 lynaghk: amalloy: okay, I might try that. I'm still a bit confused as to why those things are necessary. In the wiki for, e.g., JRuby, it shows drip making: drip -cp jruby.jar org.jruby.Main -e 'puts 8 * 8' super fast

0:09 and I would have that that AOT compiling my class and calling in the exact same way would make it, fast as well.

0:10 amalloy, Raynes: I'll open up an issue on the github project. thanks for the help.

0:10 amalloy: clojure probably does a runtime require anyway if the sources are available, even if the class is AOTed

0:11 lynaghk: note that INIT_ARGS is newline-separated list of args

0:12 so it's supposed to be something like "-e\n(require\n'ccplot.samples.markdown-env)", except i don't know the right way to get newlines into a bash string

0:12 lynaghk: amalloy: I would think "-e '(+ 1 2)'" is one arg, not tow

0:13 amalloy: it's definitely two

0:13 try passing that, with quotes, to a normal java -jar invocation

0:14 (it won't work, because -e has to be a separate arg from the thing to eval)

0:15 lynaghk: amalloy: ah, that seemed to have made a difference

0:16 though it looks like I am outpacing drip's ability to spin up new JVMs---I assumed it was doing some kind of forking from a pristene copy, but that doesn't seem to be the case

0:17 amalloy: no

0:17 if you know how to do that, i'm sure ninjudd would love a pull request :P

0:17 lynaghk: heh

0:18 amalloy: but i think you lose the ability to fork(2) once you're inside the jvm

0:18 lynaghk: yeah, that's what stackoverflow is telling me.

0:19 damn, I guess I'll just have to throw a copy of Compojure into this library and have that provide fast access

0:22 bbloom: so what's the correct way to go about making tagged literals now?

0:22 i need to use `lein trampoline repl` right?

0:22 lynaghk: bbloom: how do you mean?

0:24 bbloom: lynaghk: whats the right way to add my own #bbloom [1 2 3]

0:24 Raynes: I don't think we have the technology to serialize human consciousness yet, bbloom.

0:25 lynaghk: bbloom: I register records with print-method to spit out tagged literal strings.

0:25 bbloom: Raynes: i was attempting to avoid further abuse of #foo :-)

0:25 lynaghk: bbloom: https://github.com/keminglabs/c2po-clojure/blob/master/src/clj/c2po/literals.clj

0:27 bbloom: lynaghk: not sure what i'm looking at

0:27 i know i can just set! *data-readers* but is there a proper api for that?

0:27 lynaghk: when you say making tagged literals, do you mean writing or reading from strings?

0:27 bbloom: i want to define a new tagged literal to be read in my own source files

0:28 lynaghk: bbloom: ah, I see. so you're typing it in and need it to be read

0:28 yeah, set *data-readers*

0:28 or you can add to a magic file

0:28 data_readers.clj, I believe.

0:29 bbloom: i saw mention of that, but can't find any real documentation

0:32 ChrisP: Hi everyone, wondering if there was a quick answer to this -- is there a framework that gives Websocket / SSE with long-polling fallback? Similar to Atmosphere, but lighter and... clojure-y?

0:32 bbloom: oh dur lynaghk it's documented on *data-readers*

0:32 i feel dumb for missing that

0:33 lynaghk: bbloom: nah, it took me forever to figure out the *data-readers* stuff. Clojure is not the hottest w.r.t documentation

0:33 (I am part of the problem here, of course. Learning how to use Sphinx now...)

0:34 cemerick: bbloom, lynaghk: this is the clearest official statement on them AFAIK: https://github.com/clojure/clojure/blob/master/changes.md#21-reader-literals

0:35 bbloom: cemerick: thanks

0:35 tpope: how are you determining what an expression is? ie for cpp. searching for enclosing parens? delegating to VimClojure?

0:45 k i seem to have it all working

0:46 feels kinda weird that namespace-free tags are reserved

0:46 but i guess if they weren't then tagged literals would need complete integration with require, refer, use, etc

0:46 :-/ namespaces are hard.

0:46 but oh so damn useful

0:46 Apage43: bbloom: pretty sure it sends what you would select if you type %v%

0:47 bbloom: Apage43: ah, that makes sense

0:47 Apage43: er, or not

0:47 bbloom: although, sadly, it's not sufficient for tagged literals, which i just accidentally discovered

0:47 #foo 1

0:47 gotta visual-select :Eval for that

0:48 Apage43: bbloom: or cp<motion>

0:48 cp$ for (from here to end of line)

0:48 bbloom: ah yes, you're right

0:48 actually, i think my fingers knew that

0:49 i certainly didn't, but i'm almost certain i did that several times already :-)

0:50 sshack: Okay, clojure tools for database schema migration ? What's available in Clojure?

0:50 Apage43: bbloom: mmhm, I kind of instinctively figured up cpap for doing whole defns (as long as I don't have line breaks inside the defn, of course)

0:50 cemerick: danger, will robinson!

0:50 sshack: here be dragons, re: schema migration

0:50 sshack: Okay, enlighten me.

0:51 bbloom: mmm schema migrations, the cause of and solution to all of your database problems

0:51 sshack: bbloom: I thought that was php and mysql "coders"?

0:51 cemerick: it's a nightmare in general, and in clojure-land

0:51 bbloom: sshack: heh, are you on postgres?

0:52 sshack: I am.

0:52 II've been button by mysql data bugs before.

0:52 s/button/bitten/

0:52 bbloom: sshack: hurray transactional DLL!

0:53 sshack: bbloom: No. This was back in the late 90's when mysql would just eat your data for no reason.

0:53 bbloom: I'll let cemerick comment on clojure-related database stuff, since all my SQL database experience is prior to clojure

0:53 my hurray was for postgres

0:53 sshack: cemerick: Enlighten me on the clojure way of databases.

0:53 bbloom: ahh, yes. I agree.

0:54 I got bitten by that bug tou recently. But it was in the process of exporting from mysql to postgres.

0:55 cemerick: sshack: don't ask me, really. I try to stay away from real RDBMS stuff.

0:55 I abuse postgres as a kv store sometimes, but that's the extent of it.

0:56 sshack: technomancy was deep into schema migration bits for a while, I think.

0:56 bbloom: heh

0:56 sshack: Okay, We have very different viewpoints then.

0:56 bbloom: sshack: my schema migration strategy of choice has always been a custom bag of bash and ruby

0:56 sshack: i never found a schema migration package i liked. especially not activerecord

0:56 sshack: I'm trying to bring my platform for this project down to two languages.

0:56 bbloom: but then again, i'm a well known ORM hater :-P

0:56 sshack: Mathematica, and Clojure.

0:56 bbloom: heh

0:57 cemerick: When I *did* use a database, it was with sqlalchemy. Magic and terror.

0:57 Loooong time ago. Sorta.

0:58 sshack: there are clojure libs for this, I just don't know of them

0:58 oh, right, this is one: http://budu.github.com/lobos/

0:59 There was one other that was jousting for the privilege of being hated for all time by all Clojure database programmers.

0:59 amalloy: sqleton?

0:59 sshack: So clojure programmers are a very easy going, accepting bunch, right?

1:00 cemerick: heh, quite

1:00 sshack: do you have a grand confession to make or something? ;-)

1:02 sshack: I'm a secret lover of visual basic.

1:02 bbloom: sshack: you say you only want to use mathematica and clojure, but you kinda have no choice but to use pgsql… why not just write pgsql ?

1:02 cemerick: hah, nice!

1:02 bbloom: hence my vote for cat scripts....

1:03 cat <<EOF

1:03 ….pg sql here ...

1:03 EOF

1:03 sshack: bbloom: I like tools to automate parts of my lifting for me.

1:03 bbloom: slap that in migrate.sh

1:03 cemerick: you *could* use plv8 + ClojureScript :-P

1:03 bbloom: ./migrate.sh | psql ...

1:03 sshack: actually, experience has taught me it is a requirement.

1:03 bbloom: poof works like magic

1:03 cemerick: sshack: the first code I sold was written in RealBasic, targeting windows :-D

1:04 sshack: cemerick: Nice. Pascal, technically. But first real work was c++ on iris/sco and linux (all at once)

1:04 s/iris/irix/

1:04 bbloom: we did several migrations a week and all the automation in rails annoyed the hell out of me. i replaced it all with a handful of lines of bash and everythign was more pleasant

1:04 and faster too

1:05 sshack: bbloom: Fair enough. Different folks, different strokes.

1:05 bbloom: sshack: it was still automated

1:05 it was just *simpler*

1:05 sshack: I understand.

1:05 bbloom: hit the db once with select max(version) from migrations

1:06 then do a find -newer … ./migrations

1:06 or whatever

1:06 then a for loop cat into a single psql call

1:06 and poof, fully automated migrations

1:06 be sure to set -x on your deploy scripts and everything is magic

1:07 sshack: bbloom: So you're suggesting I write my own migration tool.

1:07 bbloom: sshack: i'm suggesting migrations are much simpler than needing a tool :-)

1:07 also, i'm saying right tool for the job

1:07 i wouldn't use a big clojure library where a simple cat script would get the job done

1:08 muhoo: what's the current status of cljs in nrepl.el?

1:10 sshack: bbloom: We'll agree to disagree here. I've stepped on a few land mines before where something a bit more sophisticated than a cat script would have helped out.

1:11 bbloom: *shrug* i also prefer Makefiles over Puppet and Chef, so I understand my tastes aren't for everyone

1:11 sshack: Particularly with altering data in columns.

1:11 Have you tried scons by any chance?

1:12 bbloom: no

1:12 sshack: I switched from makefiles to scons about a decade ago. Can't stand brittle makefiles now.

1:13 It's a build system based on python code. Very nice.

1:13 bbloom: *shrug*

1:20 derrida: Do I want to be using nrepl or REPL-y as my repl in emacs?

1:20 Raynes: bbloom: Agreeing to disagree is the best thing to do when you're obviously wrong.

1:20 brehaut: nprepl is a protocol

1:20 reply is an nrepl client

1:20 derrida: hm

1:20 brehaut: reply is also the default repl for the 'lein repl' command

1:21 bbloom: Raynes: which thing am i wrong about? it's not obvious to me? :-)

1:21 Raynes: bbloom: That was a joke, sir.

1:21 derrida: for some reason my setup keeps getting confused and it knows about two different looking repls, one is REPL-y and the other is what I was calling "nrepl"

1:21 bbloom: heh, ok then

1:21 muhoo: derrida: are you using nrepl.el?

1:22 derrida: If I C-c C-z from a clj file before manually entering nrepl-interaction-mode in the file, it connects to REPL-y. If I nrepl-jack-in from the file buffer, it will create a more sparse repl that just says: "; nREPL 0.1.6-preview"

1:23 muhoo: yes, and clojure-mode

1:23 brehaut: bbloom, schema migrations arent the cause of all your database problems, only a large chunk :P

1:23 bbloom: you have to give the query optimizer some credit too

1:23 derrida: I had to strip the swank stuff out of clojure-mode to stop it from borking my slime-repl though :(

1:23 bbloom: brehaut: was a homer simpson beer reference :-)

1:23 brehaut: oh true. lol

1:23 bbloom: haha but yeah brehaut you're right, that damn query optimizer

1:25 muhoo: derrida: oh, you've got slime/swank going too for another lisp? i've never tried to get those to coexist. hmm.

1:25 derrida: bbloom: I think there is something to be said for the ubiquity of Makefiles. I had to deal with a project that was using premake last week and it really hammered in for me why I will never use an obscure build system.

1:26 bbloom: derrida: the main problem with makefiles is that people try to use them to do anything other than shell out to other things based on file time stamps

1:26 people try to figure out crazy complex fancy features

1:26 derrida: muhoo: yeah, I'm a CL person that's exploring/learning clojure. they seem to coexist a heck of a lot better than they did a year ago now that nrepl is around.

1:26 bbloom: and in reality, the simplest thing to do is to run a shell script which outputs makefile gunk, and then causes re-evaluation to occur in gnu or bsd make

1:26 my make files generally have zero logic in them

1:27 and are like 10 or 20 lines

1:27 and then i have a bunch of shell scripts that do any interesting work

1:27 derrida: yeah, I agree, I've seen very clean makefiles that prove it.

1:27 bbloom: so pleasant to work with

1:28 redis, for example

1:28 muhoo: derrida: great, welcome! nrepl is the current recommended way to do emacs interation with clojure IIRC

1:28 Apage43: psh, makefiles

1:28 bbloom: antirez needs to teach a course :-)

1:28 Apage43: just write your app as a single .c file; make <name> will run $CC main.c -o main

1:29 derrida: muhoo: so, the "correct" repl that should appear is the 0.1.6 nrepl preview? not the REPL-y one?

1:29 muhoo: derrida: nrepl.el basically just talks to a running clojure process using the nrepl protocol. nrepl is editor-or-client-independent.

1:30 derrida: i have a slightly different workflow than most people, but just doing jack-in is supposed to Just Work (TM)

1:30 nrepl-jack-in

1:30 not clojure-jack-in

1:30 derrida: yeah, that's what I'm using

1:30 didn't Just Work for me though :D

1:31 seangrove: Is there a way to specify the 'g' flag in cljs using the regex literal syntax?

1:31 derrida: I'm having to manually put buffers in nrepl-interaction-mode after jacking in

1:31 which I can probably fix by adding a hook, but I'm guessing something is up since I have to do that?

1:32 muhoo: derrida: yeah, sounds like something in clojure-mode

1:32 the hook is supposed to make nrepl-minor-mode for all clojure-mode files

1:32 derrida: maybe the clojure-mode in melpa is too old or something, I'll try cloning from git

1:32 *github

1:32 muhoo: derrida: i'm using elpa, and it works

1:33 emacs 24

1:33 clojure-mode 1.11.5, nrepl 0.1.5

1:33 derrida: hmm, older nrepl than me

1:34 muhoo: yeah, i have made a few additions to it. was lazily wondering if cljs support is improved, i should just go rtfc on github

1:34 derrida: ah, yeah, looks like there's a new update from yesterday

1:36 muhoo: it may not be a bad idea to start up a fresh emacs too, without any cl/swank/slime stuff running, and try nrepl-jack-in from there

1:38 derrida: I actually did try that, behaves the same way.

1:39 muhoo: is it normal for nrepl to give you a buffer that's in the user> ns? (or should it be putting me in the ns of the project being loaded)

1:41 muhoo: yes

1:41 i always get user>

1:42 then i have some stupid macros i wrote to do what i want from there

1:42 and by stupid, i mean elisp code, because i haven't figured out how to write nrepl middleware yet

1:42 https://www.refheap.com/paste/7372

1:45 i usually do (require 'my.project.foo :reload-all) and then (in-ns 'my.project.foo)

1:45 and then i hit that hotkey again to run my elisp. it's, um, ridiculous, but it works.

1:48 heh, i love that there's a branch in nrepl.el git called "blowing-chunks"

1:54 seangrove: ,(map identity {:a 10 :b 12})

1:54 clojurebot: ([:a 10] [:b 12])

1:54 seangrove: uhg

1:54 In cljs I think that comes out as 12

1:54 But glad I'm not totally insane anyway

1:58 Need to get a clojurebot hooked up to cljs in a browser env in here

1:58 ~cljs

1:58 clojurebot: Titim gan éirí ort.

2:02 Apage43: seangrove: http://himera.herokuapp.com/index.html ?

2:02 shows the same as clojurebot in here when I punch that in

2:02 amalloy: Apage43: if it came out as 12 i'm pretty sure all of cljs would explode on itself

2:02 seangrove: Yeah, I think that's rhino

2:03 Haha

2:03 Alright, well, I've just done something wron here then

2:03 Apage43: seangrove: it executs in the browser

2:03 Try (js/alert "BLAH")

2:03 *executes

2:04 seangrove: hrm, wow

2:04 It's working properly now, same repl, same line

2:04 I'll attribute it to user error

2:36 llasram: seangrove: Hey, did you get your "M-up" -> "A" issue sorted out?

2:36 seangrove: llasram: Yes, appreciate you tip, ended up googling around for that and figuring it out

2:37 llasram: Oh, ok, cool. You'd logged off, but I figured out I'd actually ended up just teaching Emacs the new keys. How did you end up fixing it?

2:38 s,new keys,new key mappings,

2:38 seangrove: I'm using iTerm2, ended up configuring the profile to use the keys properly

2:38 llasram: Oh ok, cool

2:38 seangrove: It's a better solution over, since I think emacs isn't getting someother keys I'd like it to, and now I have a better idea why

2:38 llasram: (A phrase I apparently say a lot when I wake up at 2am)

2:38 Oh, I agree

2:39 seangrove: Heh, I'm about to pass out if I can just get this cljs-form validation bit working

2:39 Very close now...

2:41 llasram: Well best of luck

2:41 Tolstoy: Has anyone used clojure.java.jmx? I've set up a bean, and a thread to adjust the value once in a while, but console doesn't graph it.

2:42 Er, mbean, and jconsole.

2:49 borkdude: goat moaning everyone

2:52 llasram: heh

2:56 andrewmcveigh: morning.

2:56 p_l: borkdude: and yak shaving to you

3:08 borkdude: is there a kind of "powered by Clojure" logo you can use on your website when it is mainly written in Clojure?

3:16 Tolstoy: Hm. Creating a proxy / interface to use as an MXBean seems to allow jconsole to graph changes in attribute values. The dynamicMbean prevents that for some reason.

5:17 jml: is there a web page w/ release notes for clojure? (something analogous to http://docs.python.org/3/whatsnew/index.html, say)

5:18 llasram: jml: https://github.com/clojure/clojure/blob/master/changes.md

5:18 jml: llasram: thanks.

5:25 muhoo: this feels... wrong https://www.refheap.com/paste/7379

5:26 ah, maybe another situation where for is the right answer

5:27 llasram: What feels wrong about it?

5:41 hyPiRion: I'd probably do it like this

5:42 https://www.refheap.com/paste/7381

5:42 But it seems pretty much right for me

5:44 ro_st: is it possible to destructure both a seq of args and a map of optional params from the same fn args?

5:48 Mr_Bond: ro_st: should be fine if you use the sequence-functions ?

5:49 muhoo: hyPiRion: that improves it a lot. i think it's the anonymous inside map that makes me think i should bust out for.

5:49 Mr_Bond: ro_st: the zipmap function maybe?

5:58 ro_st: i've realised it's not going to solve my problem

5:58 thanks for responding, even so :-)

6:18 borkdude: so, what's the coolest static site generator in clojure nowadays?

6:23 ro_st: clojure has those?

6:23 vijaykiran: there's misaki

6:24 https://github.com/liquidz/misaki

6:24 borkdude: I added a footer to my little app: http://twitter.michielborkent.nl/

6:24 vijaykiran ah that's the one I searched for

6:25 vijaykiran: Btw, http://amsclj.nl/ is built using that

6:25 ivaraasen: borkdude: getting an error on the redirect after authing with Twitter

6:25 redirected to localhost:8080

6:26 vijaykiran: interesting clojure-toolbox.com doesn't have static-site-gen section. Someone should fix that :)

6:26 borkdude: ivaraasen hmm, shit. will have to change my apache config then

6:26 ivaraasen tnx for noticing

6:27 ivaraasen try again

6:28 ivaraasen: borkdude: works now, awesome

6:29 only thing you'll need to implement next is a selection list to unfollow en masse.

6:30 borkdude: ivaraasen yes, well, that's a bit rigorous, I would never use that ;)

6:37 ivaraasen: borkdude: select all -> defollow, and deselecting important people. I would use it, at least

6:37 dunno if the Twitter API would allow it tho

6:37 borkdude: ivaraasen it allows it, I'd have to create a new app key for it though

6:46 ivaraasen this was more a proof of concept for me, such sites already exist btw

6:53 tgoossens: i never quite understand how you dynamically typed languages in general can lead to robust code. don't you just have to do the type checks yourself.. reinventing overloading etc?

6:58 its a design decision in clojure i don't understand why it was done that way

6:59 maybe just because being a lisp?

7:00 borkdude: tgoossens more freedom

7:01 tgoossens: but that freedom comes at a cost

7:01 borkdude: tgoossens yes, but type systems have costs too

7:01 tgoossens it's an ancient old discussion

7:02 tgoossens: i'm just getting into it. clojure is my first experience with dynamically typed language

7:02 kmicu: tgoossens https://s3.amazonaws.com/github/downloads/frenchy64/papers/paper.pdf

7:02 borkdude: tgoossens it's strongly typed though, which is better than weakly typed imho

7:03 kmicu: A Practical Optional Type. System for Clojure. Ambrose Bonnaire-Sergeant.

7:03 tgoossens: borkdude: access denied link ?

7:04 borkdude: kmicu do you have experience with typed clojure?

7:05 kmicu: only read paper

7:06 borkdude: tgoossens there are other functional langs that have advanced type systems though (Haskell)

7:06 tgoossens so you could just choose what suits you

7:08 so, debian seems like a good choice for a vps… going for it then

7:12 tkoskine: Coming from Ada (with all this very strongly typed goodness), I still haven't got used to Clojure's system and I use a lot of assertions and pre/post-conditions, but it is nice to see how little effort you need to see to get even some more complex algorithm done in Clojure (good for prototyping, for example).

7:13 borkdude: solid set of unit tests help of course

7:14 but again, it's a discussion that's probably never going to end

7:14 tkoskine: Yep.

7:15 borkdude: having an optional type system (typing by demand) would be really cool, so typed clojure could maybe fulfill that role

7:15 haven't worked with it yet though

7:20 kmicu: tgoossens: you can check also http://blog.fogus.me/2010/05/25/trammel-contracts-programming-for-clojure/

7:22 fredyr: just how much do you guys feel you get bitten by the dynamic typing though?

7:23 cshell: fredyr: do you mean how much do we have runtime casting exceptions?

7:24 kmicu: per hour

7:24 ;]

7:24 or per LOC

7:24 cshell: lol

7:24 fredyr: lol

7:24 i wasn't really looking for a metric

7:24 but if you think it's a big issue not having static typing

7:25 cshell: when I was really new I had a couple problems, but that was cause I was still thinking the java way

7:25 kmicu: it's not an issue, it's a choice/tradeoff and I take it fully!

7:25 tgoossens: fredyr: never made large software projects with a dynamic language so far. My only real experiency lies with java

7:25 cshell: hickey's talk on using abstractions really helped me, so now I usually return a map or a sequence and then everythign works well

7:26 tgoossens: i figured that

7:26 kmicu: tgoossens: why not scala then?

7:26 tgoossens: in clojure for example it doesn't really matter that much because you don't invent a new type for every new piece of data you want to represent

7:26 kmicu: if you love type system so much :)

7:26 fredyr: ohmy, what did i start now :)

7:27 tgoossens: kmicu: i don't love type system so much, its just, i have no significant experience with any dynamically typed language.

7:27 cshell: it's very different when you're used to all these different types (ie java)

7:27 tgoossens: and during my student job somebody gave me some initiation to clojure

7:27 and i kept playing with it

7:28 cshell: but if you learn to use one or two types/abstractions everywhere then there's a very low chance of type problems and much higher reuse

7:28 so I wonder if it's fair to say that strong typing can reduce reusability

7:28 tgoossens: it was my first experience with dynamically typed languages.

7:28 kmicu: it will be good

7:28 but do not trust me :)

7:28 tgoossens: haha

7:29 cshell: i think it is more valid to say that using less types for representing data increases reusability

7:30 cshell: tgoossens: yes, that might be something you learn once you've used both

7:30 kmicu: tgoossens: http://www.infoq.com/presentations/Code-Testing

7:30 cshell: tgoossens: cause in java we could pass around maps everywhere

7:32 tgoossens: cshell: i've been experimenting with using maps in java instead of classes

7:32 also using ImmutableMap from guava

7:33 but to get it to work i had to invent some ways to

7:33 put any type in the map

7:33 kmicu: there is not reason to be upset because of the lack of typing system

7:33 tgoossens: and then get that value out with proper casting

7:34 currently i've done it with something like this:

7:34 Map<FieldName<T>,T>

7:35 but it is probably a good way

7:35 *not a good way

7:35 borkdude: technomancy what linux do you use, just wondering

7:35 kmicu: not idiotmatic for sure

7:36 tgoossens: no but its not because it is not idiomatic it is bad

7:36 kmicu: tgoossens: why not scala? :)

7:36 borkdude: or Haskell

7:37 kmicu: Haskell@JVM?

7:37 ;]

7:37 tgoossens: never looked into it. Maybe i should. but first i'm going to continue experimentation with clojure :D

7:37 borkdude: kmicu Frege

7:37 tgoossens knowing at least one lisp is good for common programming knowledge probably, and clojure is a very nice lisp

7:38 tgoossens: and haskell i'll be seeing in next year's course (also prolog) so for now i'm exploring other languages

7:39 borkdude: I think I read sometime in a common lisp book or essay: "Lisp is the language of love", I think that's true - it makes many programmers happy. =)

7:40 fredyr: :D

7:40 i like that

7:41 kmicu: it makes me happy for sure ;]

7:44 borkdude: ah, this is it: "Lisp is the language of loveliness." http://www.dreamsongs.com/ArtOfLisp.html

7:45 by Richard P. Gabriel (foreword of Succesful Lisp)

7:45 kmicu: borkdude: thx!

7:46 Mr_Bond: the guys at the office like the "Land of lisp" book

7:47 not read it my self

8:10 borkdude: lol: http://www.youtube.com/watch?feature=player_embedded&v=cZ34RDn34Ws

8:39 yedi: when building non-trivial webapps, do you think it's a pain in the ass to use multiple kinds of dbs (depending on what fits the job) or would you recommend just sticking to one?

8:54 clgv: Does anyone know whether I can use a FileOutputStream to write header data first and after that wrap it into a DeflaterOutputStream to compress the following data? I am encountering an exception complaining about a too short ZLIB header

9:23 clojure-newb: hey guys, how do I set response encoding to UTF-8 with ring-json 0.1.2 ?

9:26 clgv: does anyone have experience with apache commons-compress related to its performance?

9:38 tgoossens: Someone should start Google plus clojure community :D

9:42 Oh nvm

9:53 bsalty: @tgoossens it would be plus Google then wouldn't it?

9:58 hyPiRion: (inc Google) is more like it

9:59 cark: rather (partial + google)

9:59 bsalty: dammit i still need to read about partial

10:00 cark: it's easy : partial application

10:00 ,((partial + 3) 5)

10:00 clojurebot: 8

10:08 borkdude: eh, someone an idea what could be wrong? https://www.refheap.com/paste/7387

10:11 eh nm.. fixed

10:11 bsalty: @borkdude maybe this is a stupid answer but looks like ning is missing from class path?

10:12 borkdude: bsalty that's right, I included a dependency indirectly before, so when I removed one dependency only then I saw this error

10:12 bsalty: ah

10:12 too much magic in inferred deps

10:41 gfredericks: is there any documentation about using a proxy with clojure.java.jdbc?

11:09 pepijndevos: How to find a good ASP dev. It seems to me the ecosystem doesn't culture good devs.

11:12 S11001001: pepijndevos: find good non-ASP dev willing to learn it

11:12 rkz: pepijndevos: look for people doing ASP in F#

11:14 S11001001: rkz: sounds right

11:14 pepijndevos: Oh yea, I heard good things about F#. F# is to C# what Scala is to Java, I imagine.

11:14 S11001001: pepijndevos: yeah

11:15 the best devs I know won't be pigeonholed into "<some language/framework> dev", pepijndevos

11:15 pepijndevos: S11001001: Yea, my initial thought was, find a polyglot.

11:22 borkdude: F# is quite nice

11:23 tpope: bbloom: right now cpp is just mapped to cpab

11:35 DaReaper5: I am still slightly confused with defn and how it returns values. How can I do an action/method call before returning an actual value?

11:35 Hodapp: DaReaper5: The same way you'd do it in any other expression.

11:36 or do you mean you need side effects or something?

11:36 tufflax: DaReaper5, I don't understand your question :p

11:37 DaReaper5: (defn take-from-q [q key] (some-method)(.take q))

11:37 i can do that

11:37 but what if i want to call some-method after the take

11:37 can i store it in a let and then return the let after

11:38 Hodapp: DaReaper5: why are you concerned with the order here?

11:38 tufflax: You can save the result of (.take q) with a let, and return it after (some-method)

11:38 DaReaper5: how do i return the let value

11:39 hodapp i am concerned because .take is a blocking action and i need to change something after it unblocks

11:39 (defn take-from-q [q key] (let [r-value (.take q)](some-method)(r-value))

11:39 ?

11:39 tufflax: You know that in both let and defn the last form is returned, right? So you can do (let [result (.take q)] (some-method) result)

11:39 DaReaper5: ok just wihtout the brackets

11:39 ok thanks

11:40 thats what I was thinking but i couldn't find any examples along those lines

11:40 Thanks tufflax

11:40 tufflax: DaReaper5, parens almost always is a call, so (r-value) would try to call r-value as a function

11:41 DaReaper5: ya

11:41 i keep forgetting that but i realized after i typed it. Force of habbit i guess

11:41 lol

11:41 tufflax: ;)

12:09 Kowboy: anyone here use the counterclockwise eclipse plugin?

12:11 joegallo: ~anybody

12:11 clojurebot: No entiendo

12:11 joegallo: ~anyone

12:11 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

12:12 Hodapp: I used to use it, until I stopped because I found it to be awful.

12:14 cemerick: Kowboy: Yeah, I use it.

12:14 seangrove: Is there let-when or something similar?

12:14 cemerick: Hodapp: not an eclipse fan? :-P

12:14 Kowboy: when I try to create a new Leiningen project, it created the project directory and then seems to "hang"

12:14 apwalk: seangrove: when-let

12:15 seangrove: apwalk: Hah, thanks

12:16 Hodapp: cemerick: Eclipse is fine. Counterclockwise just did not work right.

12:17 cemerick: Kowboy: I see a delay of ~5s while it does an initial dependency resolution, but it doesn't hang.

12:21 jml: what's the point of the discard operator in edn? https://github.com/edn-format/edn

12:28 technomancy: borkdude: hey just saw your message

12:28 I use Debian

12:28 clojurebot: anybody is anyone

12:28 clojurebot: You don't have to tell me twice.

12:28 borkdude: technomancy ok tnx, I'm thinking about using it too

12:28 technomancy: it's pretty great

12:28 especially when you add nix into the mix

12:30 borkdude: nix?

12:30 clojurebot: nix is a purely functional package manager exhibiting many similar characteristics to Clojure's persistent data structures or git commit trees: http://nixos.org/nix/

12:31 borkdude: whaa

12:31 technomancy: nix is amazing

12:33 uvtc: anybody?

12:33 clojurebot: anybody is anyone

12:34 technomancy: dang it clojurebot

12:34 how does the inference engine work again?

12:34 hiredman: that is how it works

12:34 inference may or may not happen

12:34 ~anybody

12:35 clojurebot: anybody is anyone

12:35 hiredman: ~anybody

12:35 clojurebot: anybody is anyone

12:35 hiredman: ~anybody

12:35 clojurebot: anybody is anyone

12:35 hiredman: ~anybody

12:35 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

12:35 hiredman: ~botsnack

12:35 clojurebot: Thanks! Can I have chocolate next time

12:35 metellus: ~chocolate

12:35 clojurebot: No entiendo

12:36 hiredman: if you want to reinforce an inferred fact, you need to give a botsnack with in some amount of time of the inference

12:37 ~anybody

12:37 clojurebot: anybody is anyone

12:37 hiredman: ~anybody

12:37 clojurebot: anybody is anyone

12:37 hiredman: bleh

12:37 technomancy: wait seriously?

12:37 DaReaper5: if i define a "let" and then try to return it. Does that nto work because of the lifetime of the let?

12:37 hiredman: I was going to say "since I did that, it is now more likely to show up"

12:37 technomancy: botsnacks have an effect; that's sweet

12:37 thorwil: technomancy: heard of guix https://savannah.gnu.org/projects/guix/

12:37 hiredman: ~anybody

12:37 clojurebot: anybody is anyone

12:37 hiredman: clojurebot: jerk

12:37 clojurebot: you cut me deep, man.

12:37 technomancy: thorwil: yeah... mixed feelings about it

12:37 hiredman: does "jerk" have the opposite effect?

12:38 hiredman: technomancy: no

12:38 technomancy: thorwil: I think it's a really good thing that nix package definitions are 100% declarative, and doing them in scheme loses that property

12:38 thorwil: I wish they had used racket instead of guile so they could define a subset of scheme instead of being limited to a superset

12:38 but OTOH building your own language is crazy and tooling sucks, so maybe it's a win

12:39 thorwil: technomancy: interesting points. i guess racket was out because this project is meant to be very gnu

12:39 DaReaper5: if i define a "let" and then try to return it. Does that not work because of the lifetime of the let?

12:40 technomancy: thorwil: yeah, shame when politics get in the way of technical decisions like that

12:40 guile is probably a lot smaller though

12:40 which is ironic considering racket's appeal here comes from the ability to define a smaller language

12:40 hiredman: DaReaper5: please continue repeating your nonsense question every few minutes

12:40 DaReaper5: (defn take-from-q [q] (let [q-interaction (.take q)] q-interaction ))

12:40 hiredman: np

12:41 q-interaction is null

12:41 when i know it is not because i have a println

12:41 or more specificaly take-from-q returns null

12:42 tmciver: DaReaper5: then (.take q) must be returning null

12:42 hiredman: or the code you pasted is not the code that is running

12:43 tmciver: java queues cannot hold nil (null) and take blocks until it can return an element

12:43 so it cannot return nil

12:43 tmciver: ah, right

12:59 Kowboy: cemerick, my network at work can be god aweful slow sometimes

12:59 it may just be that

12:59 but if I create the project outside of eclipse and then import it, I seem to get up and running much faster

12:59 cemerick: interesting

13:00 Kowboy: Your slow network may very well have something to do with it

13:00 Kowboy: I am behind a proxy

13:00 I will try again shortly

13:01 cemerick: I don't know much about the lein integration, but IIRC, it doesn't make any use of offline mode when it might otherwise be able to (yet?)

13:05 Kowboy: is the leiningen plugin for eclipse a separate project?

13:05 btw, I tried again and no luck

13:06 I click on finish, I see the project pop up in the project explorer, but the Leiningen project wizard is still open, and the project directory has nothing in it but a .project file

13:08 dabd: should I go for JNA or JNI for interfacing with native C code that does not require passing huge data structures but relies mostly on speed?

13:09 cemerick: Kowboy: it's a separate plugin, but has the same lead

13:09 Kowboy: I'd suggest reporting the hang to the ccw ML

13:53 nDuff: Can :type metadata be used for protocol dispatch, or do I need multimethods to take advantage of that?

13:55 technomancy: nDuff: need to use multimethods

13:55 or rather, you get to use multimethods

13:55 SegFaultAX: Is there an online resource for looking at the Java source?

13:55 I'm interested at looking at java.util.concurrent.CountDownLatch

13:56 gfredericks: jml: #_ is a reader-level comment; it is useful often.

13:57 jml: gfredericks: when would you want to use that rather than ';'?

13:57 gfredericks: jml: to comment a form rather than a line

13:57 jml: gfredericks: makes sense. thanks.

13:57 gfredericks: clojure's comment macro does a similar thing, but that wouldn't be available in edn

13:58 ,[1 2 #_ 3 4]

13:58 clojurebot: [1 2 4]

14:01 hiredman: ,(comment 1)

14:01 clojurebot: nil

14:01 hiredman: ,(first [(comment 1)])

14:01 clojurebot: nil

14:01 hiredman: ,(first [#_1])

14:01 clojurebot: nil

14:02 hiredman: err

14:02 ,(first [(comment 1) 2])

14:02 clojurebot: nil

14:02 jmolet_: SegFaultAX: javasourcode.org ? http://javasourcecode.org/html/open-source/jdk/jdk-6u23/java/util/concurrent/CountDownLatch.java.html

14:02 hiredman: ,(first [#_1 2])

14:02 clojurebot: 2

14:02 hiredman: anyway, the comment macro is meh

14:03 SegFaultAX: jmolet_: Thanks!

14:10 gfredericks: (defmacro don't [& args])

15:24 is it unlikely to be possible to use the postgres UUID type in korma?

15:24 (insertion as a string fails)

15:24 * gfredericks didn't think to insert as a java.util.UUID

15:24 thmzlt: gfredericks: that will do it

15:25 gfredericks: HA that's fantastic

15:25 * gfredericks high-fives himself

15:25 gfredericks: thank goodness these things are immutable

15:30 technomancy: irony: ruby's UUID gem requires you to instantiate a factory before you can get any UUIDs, while Java's implementation doesn't

15:31 gfredericks: ruby has always bragged about being more object-oriented than java :)

15:32 hyPiRion: "Yay, we're more complex!"

15:32 technomancy: gfredericks: yeah, the irony there is that "more object oriented" usually means "it doesn't have primitives" which translates to "impossible to write fast numerics"

15:32 gfredericks: technomancy: the main thing it lacks is mutable numbers

15:33 I started a library to fix that

15:33 imagine being able to empty an array with my_array.length.zero!

15:35 hyPiRion: gfredericks: Well, that's convenient.

15:35 technomancy: well given that you can redefine == on an eigenclass...

15:36 gfredericks: technomancy: well fixnums don't have eigenclasses

15:36 technomancy: actually that probably only works once you leave tagged fixnums

15:36 gfredericks: I was going to define Flexnums as a separate class

15:36 but you can redefine the Fixnum math operations so that everything turns into a flexnum everywhere

15:36 technomancy: dun dun dun

15:37 gfredericks: suddenly your system is flowing with unheard of power

15:37 if your numbers don't have callbacks you're doing it wrong.

15:37 technomancy: gfredericks: did you see that one gem that defined class=

15:37 gfredericks: wat.

15:38 technomancy: I think it was from http://www.confreaks.com/videos/198-rubyconf2009-worst-ideas-ever

15:39 gfredericks: did it redefinie Object#class to go with it?

15:39 apparently you can redefine it but it doesn't have any effect :/

15:43 muhoo: does nrepl do cljs yet?

15:43 osbert: is -?> in any of the modular clojure contrib libraries?

15:43 gfredericks: incubator maybe?

15:44 osbert: thanks

15:45 cemerick: muhoo: see piggieback

15:45 tgoossens: for the record a google plus community for clojure has been created

15:45 https://plus.google.com/communities/103410768849046117338

15:46 borkdude: I hate these kinds of messages http://michielborkent.nl:8080/ <- how the hell can I see what is going wrong, it works locally

15:48 muhoo: cemerick: thanks, i'd forgotten about that

15:50 borkdude: look in your logs

15:51 borkdude: or hacks like this might work for production, https://github.com/kenrestivo/firealarm

15:51 borkdude: I'm going to try compojure next holiday ;)

15:51 muhoo: good plan

15:52 borkdude: fuck, I've been bitten by the require views inside jar thing again in Noir

15:52 sorry for the language

15:53 muhoo: one of the hardest things i've ever done is teach a programming class to grade-school kids

15:53 because, it is impossible for me to not curse when dealing with computers

15:53 it's not a semicolon, it's a "fucking semicolon". always.

15:54 seangrove: Same here, but I drink heavily too at the end of it all

15:54 borkdude: lol

15:55 seangrove: Javascript, or closure's, event listening model is baffling

15:55 tgoossens: seangrove: explain!

15:55 seangrove: "When this even happens, call a function with this name"

15:55 That's what I'd like

15:55 So I can, in the repl, update the function and test

15:56 Instead it seems to be "When this event happens, call *this* function, even though I've just given you a function reference"

15:57 bendlas`: cemerick: can you include patches and cut releases to/from incubator?

15:58 hiredman: seangrove: clojurescripts reference model is not very good

15:58 seangrove: I would try giving it something like (fn [e] (my-fun e)) instead of just my-fun

15:58 seangrove: hiredman: good idea, let me try

15:59 cemerick: bendlas: yes, why?

15:59 hiredman: which is kind of lame, and in advanced complication will even get stripped away (I think)

16:00 where as in clojure you can just do #'my-fun

16:00 cemerick: hiredman: waiting for you to build cljs vars out of atoms :-P

16:00 bendlas: cemerick: people have asked for apply-kw, so I made a patch: http://dev.clojure.org/jira/browse/CINCU-3

16:00 hiredman: cemerick: :(

16:00 seangrove: I'm kind of with it being stripped out in advanced mode, though it seems a bit dangerous

16:00 bendlas: could you take a look at it and maybe apply it?

16:01 hiredman: seangrove: advanced mode munges names of everything anyway

16:01 seangrove: so re-defining a function will not work anyway

16:01 seangrove: Yeah, not worried about redefining it once it's in advanced-mode/production

16:01 Just worried I'll do something stupid forget it, and lose a night tracking it down

16:02 hiredman: That did it, yes, thanks

16:02 Does that mean I can't do #'my-fun inc ljs?

16:02 cljs*

16:04 And is that something that can be changed in the compiler, or a fundamental limitation of the js model?

16:04 hiredman: #' is var quote, clojurescript has no vars

16:04 seangrove: Ah, ok

16:04 cemerick: bendlas: oh, I generally don't touch anything in core.incubator outside of the strint stuff I wrote originally...

16:05 ...which I need to just bust out into a separate library (again) so it can breathe free ;-)

16:06 bendlas: honestly, it's been suggested that incubator should be shuttered, as it's premise seems faulty

16:07 or, suboptimal, anyway

16:07 seangrove: cemerick: Actually, I just came across your strint stuff this morning, hoping to use it in cljs

16:07 bendlas: cemerick: I see

16:07 cemerick: seangrove: Should just work :-)

16:07 hiredman: or the name is misleading

16:08 cemerick: github.com/clojure/bag-o-stuff

16:09 now that more threading macros are in core, all that's left is dissoc-in, seqable?, new-by-name (WTF), and strint

16:09 bendlas: cemerick: isn't it supposed to be potential new clojure.core/... entries?

16:10 cemerick: bendlas: that was the theory. *maybe* dissoc-in would get in, but none of the rest would.

16:10 s/would/would or have

16:10 All of it has been sitting around for a while.

16:11 hiredman: new-by-name?

16:11 bendlas: hm, in the case of apply-kw I'd discourage its use in most cases, but it should be there for people building DSLs

16:11 cemerick: hiredman: "Constructs a Java object whose class is specified by a String."

16:11 amalloy: hiredman: presumably for (let [x 'String] (new-by-name x)) or some similar

16:12 cemerick: bendlas: maybe amalloy et al. have something similar in flatland/useful?

16:12 bendlas: so I also see it for functions that are general purpose but might be a code smell in a lot of cases.

16:12 cemerick: amalloy: which is busted on travis atm

16:13 bendlas: cemerick: good idea, I'll look that up

16:13 it's definitely one of the bigger bags-o-stuff around ;)

16:14 amalloy: cemerick: we should probably stop pretending to support 1.2, then :P

16:14 cemerick: was that some version of Clojure or something?

16:15 amalloy: cemerick: yes, flatland/useful is failing on clojure 1.2

16:16 * cemerick is going to send amalloy a framed ;-) print

16:17 * amalloy doesn't understand anything anymore

16:18 technomancy: "bag-o-stuff" <- sounds like the goal of original monolithic contrib was preserved in 1.3+

16:18 cemerick: IIRC, it was created after a bunch of stuff didn't make the first cut into new-contrib.

16:19 muhoo: doesn't python have a "from future import" feature for stuff like that?

16:19 stuff that didn't make it into the current version, but was backported, so to speak?

16:20 cemerick: It does, but future is supposed to include only things that will actually be in the stdlib eventually.

16:20 As of 1.5, nothing in core.incubator qualifies on that count AFAICT.

16:21 Raynes: amalloy, cemerick: I'll fix that in a second.

16:21 borkdude: is there an way to "force" a path and a file into existence, like writing to ~/.somename/logs.txt, even if .somename doesn't exist yet (without manually checking, etc)

16:22 technomancy: borkdude: pretty sure you need .mkdirs

16:23 muhoo: borkdude: "mkdir -p"?

16:23 borkdude: muhoo in clojure (or Java for that matter)

16:24 muhoo: borkdude: oh, then, what technoancy said

16:24 Raynes: Bahahaha

16:24 borkdude: k tnx you both

16:24 Raynes: technomancy, amalloy: I was trying to figure out why no useful tests would pass just now and realized it's because my copy of leiningen is broken because of the test selector mods I'm making. :p

16:25 Stash time.

16:25 muhoo: developer cut by own sharp edges :-)

16:26 hell, i didn't know piggieback existed, except that 4 months ago i not only knew it existed, but submitted patches to it! early alzheimer's sucks.

16:27 cemerick: muhoo: we have similar ailments :-)

16:27 borkdude: muhoo is that a joke, or real? ;)

16:35 muhoo: cemerick: i'm not sure, actually. could be normal aging, docs are still tracking that one down.

16:38 borkdude: I'm starting to like working with paredit…. finally!

16:39 Raynes: muhoo: borkdude was the one that asked you.

16:39 Which is even more cause for concern.

16:40 borkdude: lol

16:40 Raynes: I'm sorry to hear there is an actual problem. :(

16:40 borkdude: ah, wait, I didn't even took it that seriously… I read docs as documentation (wtf..)

16:42 Raynes: Oh no, not you too!

16:42 muhoo: hehe

16:44 borkdude: cemerick what do you mean?

16:45 (kidding)

16:45 Raynes: muhoo: Seriously though, hope you find out you're just stupid and that it isn't a medical issue.

16:45 muhoo: well let's just put it this way: don't eat shrimp from the gulf of mexico 6 months after a major oil spill, unless you want to risk toxic poisoning and liver (and potentially brain) damage. that's the current theory anyway, nobody really knows yet.

16:47 borkdude: muhoo sucks man, sorry to hear it's a real issue

16:47 Raynes: I like to drip my shrimp in 10W-40.

16:48 muhoo: thanks, i didn't want to get into TMI, but i figured, maybe best to just out with it

16:48 indeed, corexit makes a fine condiment.

16:49 but if i can get piggieback + browser repl working than i can at least have more opportunites to be stupid in a great language.

17:05 brondo: hello, does anyone have any experience loading a directory from resources/ in an uberjar?

17:05 hiredman: you cannot load a directory via the classloader

17:05 brondo: loading files works great, but I want to get the path to a lucene index that's in my resources folder and always get nil with (clojure.java.io/resource "indexes/")

17:05 tmarble: technomancy: I can't seem to get clj-stacktrace to work with lein2, despite the tips on https://github.com/mmcgrana/clj-stacktrace (are those instructions up-to-date)?

17:05 borkdude: I think I've seen this once, but I forgot.. is it possible to "use" one var like with use and :only, but then with require?

17:06 brondo: hiredman, thank you! is there any known way to do this?

17:06 hiredman: brondo: you cannot do that

17:07 borkdude: brondo I'm currently working around an issue exactly like that… sometimes it works great, but now it gives me problems again..

17:08 brondo: borkdude, hiredman is the normal way to do this to have an absolute reference to the directory and not try to pacakge it in the uberjar?

17:09 borkdude: there was something like "you can do everything with require (or was it use?) now", can't remember exactly what it was

17:09 hiredman: one way is to package it as a single file (zip or something) inside the jar, then pull it from the jar and extract it to tmp or something

17:09 brondo: I see

17:10 borkdude: let's put it like this: I want to require a namespace with :as, but want to use one thing from it with :only

17:10 amalloy: :refer

17:11 borkdude: amalloy :refer in require?

17:11 amalloy: yes

17:11 borkdude: amalloy does this work in clojure 1.3?

17:11 Joreji: Hey everybody, I'm trying to call clojure from java by doing: "RT.loadResourceScript("main/clojure/de/karolski/berkelium_clj/core.clj"); clojure.lang.RT.`var`("de.karolski.berkelium-clj","ensure-init").invoke();" But for some reason I get the exception: "Exception in thread "Thread-1" java.lang.IllegalStateException: Attempting to call unbound fn: #'de.karolski.berkelium_clj/ensure-init" Anyone knows what I'm doing wrong? The function ...

17:12 ... definitely exists.

17:12 amalloy: i think it's 1.4

17:12 borkdude: amalloy ok, good, because I dont see it on clojuredocs

17:15 egghead: is {:keys [field otherfield] :as whole-map} a legal destructuring?

17:15 nvm, typo in my source..

17:17 Joreji: nvm, found the error. Was missing a .core in the ns.

17:37 TEttinger: @title http://duckduckgo.com

17:37 !title http://duckduckgo.com

17:37 hm, what is lazybot's prepend?

17:38 bbloom: ,(inc 5)

17:38 clojurebot: 6

17:38 bbloom: &(inc 5)

17:38 lazybot: ⇒ 6

17:39 bbloom: or ##(identity "inline")

17:39 lazybot: ⇒ "inline"

17:40 TEttinger: &title http://duckduckgo.com

17:40 lazybot: java.lang.RuntimeException: Unable to resolve symbol: title in this context

17:40 TEttinger: no, not trying to eval

17:40 bbloom: ~lazybot

17:40 clojurebot: Huh?

17:40 TEttinger: trying to call the plugin, I have a lazybot of my own

17:40 not here

17:41 `title http://duckduckgo.com

17:41 amalloy: TEttinger: lazybot's prepend is $. iirc if you start your own instance it defaults to @

17:41 TEttinger: $title http://duckduckgo.com

17:41 lazybot: "DuckDuckGo"

17:41 TEttinger: thanks amalloy

17:41 $title https://duckduckgo.com/?q=github+lazybot

17:41 lazybot: Page has no title.

17:41 TEttinger: ah that's why

17:41 $title https://duckduckgo.com/?q=!github+lazybot

17:41 lazybot: Page has no title.

17:42 TEttinger: $title https://duckduckgo.com/?q=\!github+lazybot

17:42 lazybot: Page has no title.

17:42 TEttinger: sorry about the spam

17:42 amalloy: TEttinger: you can /msg him

17:42 TEttinger: is there a better place to test lazybot oh ok

17:43 well amalloy, maybe you can answer my question...

17:43 https://duckduckgo.com/?q=!github+lazybot should be a redirect page. how can I get the title of what it redirects to?

17:44 https://duckduckgo.com/?q=feeling+lucky+punk should also be a redirect page.

17:44 amalloy: improve the title plugin to use something smarter than slurp

17:45 TEttinger: it uses slurp-or-default right?

17:46 i mean would clj-http have something for that?

17:46 amalloy: probably

17:47 bbloom: i never know what to call "setter" functions

17:47 i much prefer foo over get-foo, but set-foo just seems wrong when talking about an immutable structure

17:48 TEttinger: could it be... as simple as slurping the slurp?

17:48 bbloom: and with-foo implies dynamic context

17:48 foo! implies mutation

17:48 foo= implies equality

17:48 (foo x new-val) is ambiguous with (foo x default-val)

17:48 names are hard.

17:50 conventions? opinions?

17:53 technomancy: update-*

17:54 bbloom: technomancy: better, but feels kinda long

17:56 tpope: so far plugin is working beautifully

17:56 tpope: awesome

17:57 bbloom: feels vim-y too, which is nice

17:57 tpope: that was a design goal

17:57 that's always a design goal

17:58 ohpauleez: bbloom: You mean it isn't a mess of over-used leader key combos? :)

17:58 Sgeo|web: What is this "disable locals clearing" about?

17:58 I see it mentioned in Compiler.java

17:58 bbloom: ohpauleez: bingo. plus it plays nice with text objects

17:58 ohpauleez: bbloom: I name setter functions the verb of the mutation, or an arrow if it's a conversion (foo->bar ...)

17:59 bbloom: ohpauleez: yeah, sometimes there isn't an obvious verb. in *many* cases i discover that anytime there isn't a verb or an obvious x->y name, then there is a better design

18:00 shortly after i asked that previous question, i realized that there was a far superior name for my use case

18:00 ohpauleez: agreed

18:00 oh, stellar

18:00 bbloom: it also changed the signature of the function and cleaned up some of my thinking

18:00 which is what clojure tends to do :-)

18:01 rlander: Hey, does anyone care to critique this for style and idiomatic usage? https://www.refheap.com/paste/7395

18:03 bbloom: rlander: you don't need to convert a character back to a string

18:03 ,(= \/ (last "some/url/")

18:03 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

18:03 bbloom: ,(= \/ (last "some/url/"))

18:03 clojurebot: true

18:04 rlander: bbloom oh, thats nice, thanks!

18:04 nDuff: It's going to be a lot slower to convert the string to a seq and back than to use (.endsWith url "/")

18:04 (or whatever the java.lang.String method is

18:04 bbloom: nDuff: premature optimization

18:05 rlander: nDuff at this point I'm just trying to write idiomatic code, but thanks for the tip

18:06 Raynes: bbloom: Common sense, I think.

18:06 Nothing wrong with .endsWith

18:06 nDuff: bbloom: There's optimization, and then there's writing code that's not needlessly slow.

18:06 Raynes: I use it all the time.

18:06 nDuff: bbloom: I'm pretty sure this is a cat-2.

18:06 Raynes: And I'm a pretty cool guy.

18:07 bbloom: as a guy doing lots of CLJS, damn you and your usage of common java-isms in core code paths! :-)

18:07 also available: regexes

18:07 nDuff: Ahh. :)

18:07 bbloom: ,(re-matches #".*/$" "some/url/")

18:07 clojurebot: "some/url/"

18:07 bbloom: ,(re-matches #".*/$" "some/url")

18:07 clojurebot: nil

18:07 bbloom: which, might be what he actually wants here:

18:07 Raynes: The day I start trying to write Clojure code that works in ClojureScript is the day I check myself into Arkham.

18:08 rlander: bbloom sorry, I don't follow

18:08 Raynes: I had a feeling you were a leader.

18:09 bbloom: rlander: clojure.string/replace allows regexes

18:10 although my knowledge of java regex expressions is apparently poor

18:11 hyPiRion: Hmm, that would also be an issue with regexes

18:11 Apage43: I need to whip out the reference most of the time

18:11 hyPiRion: and interop

18:11 bbloom: yeaaaaah java regexes != javascript regexes :-/

18:11 hyPiRion: /s/interop/other clojures on other platforms

18:11 ohpauleez: java regexes != ANY OTHER REGEX

18:11 :)

18:12 technomancy: could be worse; could be elisp regexes

18:12 bbloom: true story.

18:12 hyPiRion: could be worse, could be no regexes

18:12 Well, I'm not even sure if that's worse sometimes.

18:12 ohpauleez: haha

18:12 rlander: bbloom Ok, I see. add-slash is actually going to be a middleware that adds a missing "/' to :uri. It's not used inside any of the functions in that paste

18:12 bbloom: fun fact: there generally aren't REGexes

18:13 perl regexes are not regular

18:13 :-/

18:13 arrdem: does clojure have an equivalent to C's __file__ variable for use in macro expansion?

18:13 ohpauleez: cue the regex joke, "You have a problem and you think, 'Oh! I can solve this with regex' ..."

18:13 hyPiRion: bbloom: Do you mean the formal definition of regular expressions?

18:13 technomancy: arrdem: clojure code is usually loaded from jar files, so it's not very useful but there's *file*

18:13 arrdem: silly perl... regexes can't be recursive...

18:13 bbloom: hyPiRion: http://swtch.com/~rsc/regexp/regexp1.html

18:13 hyPiRion: and http://code.google.com/p/re2/

18:14 arrdem: technomancy: gah ofc. Been writing C for the last few months and my brains a little addled from it.

18:15 bbloom: i recall a dramatic performance bug that i fixed at google by inserting the character "2" to the code `#include "goog/whatever/re.h"`

18:15 seangrove: About to dive into goog.async.Deferred - anyone have any experience or quick high-level tips around it?

18:15 nDuff: arrdem: ...there's also reader matadata...

18:15 gah, metadata

18:16 hyPiRion: bbloom: The first one's just speedups though

18:16 The second one shows the issue better :)

18:17 bbloom: rlander: also on the idiomatic list: (if ?x ?y nil) can be (when ?x ?y)

18:17 arrdem: back in the C project I'm now running away from I had a DEBUG() macro that generated printf()s with the file and line no. that's what I'm trying to get.

18:17 bbloom: rlander: it's not common to see commas used in such short expressions like [k, v]

18:17 rlander: indentation on line 29 is weird

18:18 rlander: bbloom Honest mistake from a Pythonista [k, v]

18:19 bbloom the identation is sublimetext's fault. Just fixed it.

18:23 bbloom all fixed https://www.refheap.com/paste/7397

18:23 bbloom again, thanks for the corrections, much appreciated

18:25 Foxboron: rlander, using Sublime Text?

18:26 rlander: Foxboron yup. Not very good for clojure.

18:26 Foxboron: rlander, i did put up some snippets for Clojure with package manager.

18:26 Its lacking a REPL with the Lein version 2, but.

18:27 rlander: Foxboron: excellent for everything else.

18:27 Foxboron: I was wondering if you would like to test a Sbulime plugin i have been working on.

18:27 Basically a ClojureDoc searcher with some neat features

18:28 rlander: FoxBoron, sure. Sounds nice.

18:28 Foxboron https://github.com/Foxboron/ClojureDoc-Search ?

18:28 Foxboron: Hah, yeah :)

18:29 Also, the snippets i have pushed to Package manager should help on some of the functionality

18:29 Just hoping they will get SublimeREPL working soon :/

18:29 rlander: Foxboron I'll try it right now

18:30 Foxboron: Foxboron, snippets are at the package manager, the searcher is submitted but not accept atm

18:30 hah, i just highlighted myself :P

18:31 rlander, just come with suggestions and bug reports if you encounter them.

18:31 rlander: Foxboron, package manager has totally spoiled me.

18:31 Foxboron: haha, yeah :P

18:32 rlander: trying to remember how to manually install a package from a repo

18:32 Foxboron: rlander, download the zip, go to sublime. pref -> browse packages

18:32 Move folder to the package folder.

18:34 rlander: Foxboron, oh, right, thanks

18:34 Foxboron: np ^^

18:36 rlander: Foxboron, cmd+shift+c doesn't seem to be working

18:37 Foxboron: hmmm

18:38 rlander, Linux or OSX?

18:38 or Windows?

18:38 rlander: Foxboron osx

18:38 Foxboron: yeah umm, go to the keybidn file and change ctrl to cmd.

18:38 i forgot adding Linux and OSX keymap files.

18:38 Doing that now

18:39 keybind*

18:44 rlander: Foxboron this is awesome

18:45 Foxboron: rlander, thanks :)

18:45 flying_rhino: hello guys

18:46 Foxboron: rlander, if you get an auto-match, but still wanna see other results, you can bush esc

18:46 push*

18:46 actually, you can push back.

18:47 flying_rhino: it is possible that I am a friggin idiot, but I installed leinangen and got it to work, but can't figure out how to use anything bigger than REPL in command prompt. I can create new project but have no idea what to do with it.

18:48 Foxboron: flying_rhino, common beginner problem TBH. I had the same problem. Lets see if i can find the tutorial which sat me on the right track :D

18:48 technomancy: flying_rhino: have you read `lein help tutorial`?

18:48 rlander: Foxboron, you mean, for example, when searching for "cond" I'd push esc to see "condp" too?

18:49 Foxboron: rlander, you can use the option back, and you see other search results.

18:49 I justs did so that 100% matches gets right to the main menu.

18:49 rlander: Fonxboron push back does work, but esc doesn't

18:49 Foxboron: yeah, i was wrong.

18:49 esc works in other scenarios :)

18:50 rlander: Foxboron seriously, this is very useful

18:50 Rich_Morin: Are there any ClojureWest group discounts for Meetup groups, etc?

18:50 rlander: why is it "Insert example" and not "View examples" ?

18:51 egghead: oo reminds me, I wanna go to clj west!

18:52 Foxboron: rlander, good question, i thought it would be more reasonable. Dunno why.

18:52 nDuff: Hrm.

18:53 Foxboron: rlander, however glad you liked it. If you get any problems or find any bugs, just PM me. Been striving for a long time to find a clojure user using Sublime which would try the plugin :)

19:34 bbloom: is there a way to get nrepl to pretty print by default?

19:39 ohpauleez: bbloom: it looks like the middleware is marked TODO - but I'm not a definitive source

19:39 bbloom: ohpauleez: i'm getting so spoiled by cpw to print the value of a def

19:40 used to have to type out (pprint thevar)

19:40 ohpauleez: it's pretty stellar

19:40 tpope: I didn't even think of that

19:41 hiredman: (alter-var-root #'clojure.core/prn (constantly @#'clojure.pprint/pprint))

19:41 or something

19:42 bbloom: tpope: oh yeah, it's glorious :-)

19:43 tpope: some more feedback: i expect {} and [] to count as blocks, not just ()

19:43 tpope: reasonable

19:43 I used ab as a quick hack

19:43 with the idea that it could be swapped out later

19:44 bbloom: tpope: it's pretty effective for a quick hack

19:44 tpope: yep, which is why I haven't been in a rush to fix it

19:44 bbloom: also, i'm almost 100% convinced that cpp should be top level by default

19:44 maybe ohpauleez wants to weigh in on that too

19:44 tpope: wait, you have top level {} and []?

19:44 bbloom: no

19:44 i'm referring to our conversation from yesterday regarding eval form or eval top-level form as the default for cpp

19:45 but top level {} and [] aren't completely unheard of in my scratch files when they have sub expressions that are interesting

19:45 tpope: I mean on one hand you want cpp to see []/{}, but on the other hand you just want it to do toplevel?

19:45 bbloom: [:foo (some-complex-thing :bar)]

19:46 tpope: i want cpab to see [] and {}

19:46 tpope: well it'd have to be some other operator, since ab is a built in

19:46 bbloom: hm ok

19:46 tpope: but yeah, I agree

19:47 but for that matter, should it also grab atoms?

19:47 bbloom: if we ever meet, remind me that i owe you a beer.

19:47 tpope: will do :)

19:47 bbloom: you mean the @ outside of () ?

19:47 tpope: no I mean like symbols or strings or whatever

19:47 bbloom: hm, not sure

19:48 would have to play with it, i think

19:48 ohpauleez: bbloom: tpope: Originally I wanted top-level (paragraph), but I actually like it form, since I can toggle to top-level pretty fast

19:48 tpope: by toggle you just mean move your cursor?

19:48 (that's what I do)

19:48 ohpauleez: like I said in my ticket, I don't use f,t - so I've been banging cpp cpw cpf constantly

19:49 tpope: (yeah, hit next ")")

19:49 * ohpauleez face-palms

19:49 tpope: I was going to revisit the whole file mapping this weekend

19:50 along with the associated bug

19:50 ohpauleez: I could cpp, cpf), cpf), etc

19:50 bbloom: once i discovered `` as the intra-line equivalent of '', then (cpp`` became somewhat reasonable

19:50 still kinda long

19:50 ohpauleez: welp, I'll remap to cpr right now

19:50 tpope: :)

19:51 ohpauleez: bbloom: does my recipe above work for you?

19:51 bbloom: ohpauleez: i'm not sure i follow it

19:51 ohpauleez: tpope: Please ignore all of terrible ideas - eventually I'll find the light :)

19:52 nDuff: Is there a standard-library equivalent to (partial map-indexed (fn [x y] [x y]))?

19:52 tpope: I'm pretty good at filtering out terrible ideas :)

19:52 ohpauleez: bbloom: You start in some inner form, you cpp, you want to see what the next form is going to be, you cpf)

19:52 tpope: some might say too good

19:52 ohpauleez: tpope: I still hate how r breaks the sentence-format

19:52 bbloom: ohpauleez: the next form may span multiple lines

19:53 nDuff: ...oh.

19:53 bbloom: ohpauleez: also, that doesn't go back to the beginning of the current top level

19:53 tpope: hmm?

19:53 nDuff: *facepalm*.

19:53 ohpauleez: I need to see how f and F differ

19:53 bbloom: fX searches current line until X

19:53 tpope: you mean cpr?

19:53 bbloom: FX searches backwards

19:53 ohpauleez: ahh

19:53 bbloom: ohpauleez: you need to learn to use f and t :-)

19:54 ohpauleez: I never use them

19:54 haha

19:54 bbloom: ohpauleez: i use them constantly

19:54 ohpauleez: I just use search and %

19:54 but now I'm thinking, I'd use cpf) a lot

19:55 bbloom: f and t are crazy useful for modifications intrasymbol

19:55 ohpauleez: cs'"

19:55 I use surround for that

19:55 bbloom: eg if you have foo-bar and you're cursor is before the f, you can ct-xyz<esc> and you've got xyz-bar

19:55 antoineB: hello, does exist a parser for clojure?

19:55 ohpauleez: change-surrounding-symbol-symbol

19:56 ChongLi: antoineB: for clojure source code?

19:56 nDuff: Could I ask for some eyes on https://gist.github.com/2235a2fa03ecd57b0a7c? I'm trying to get a flat sequence of nodes from walking a tree, and that's very much not actual behavior.

19:56 antoineB: ChongLi: yes

19:56 ChongLi: antoineB: well, there's eval

19:56 what exactly are you looking to do?

19:56 ohpauleez: bbloom: ahh gotcha

19:57 I usually blast words away at that point

19:57 antoineB: ChongLi: i would like to do a little helping tool to deal with clojurescript

19:57 bbloom: when i was learning vim for real, i decided to print out a cheat sheet and to pick one key per week to learn

19:58 antoineB: ChongLi: i need to parse ns, deftype, def, defn and defprotocol

19:58 bbloom: i'd force myself to use it every time it was applicable until i had it committed to muscle memory

19:58 then i'd X the letter off my printed cheatsheet

19:58 within 3 months, i became a text editing ninja :-)

19:58 yet i still discover new stuff nearly daily!

19:58 ChongLi: antoineB: you'll want to look at the clojurescript compiler

19:58 https://github.com/clojure/clojurescript

19:59 * nDuff wonders why he isn't using tree-seq

19:59 ohpauleez: tpope: what about cpn?

19:59 namespace

20:00 tpope: ohpauleez: you could conceively push "till next search result"

20:00 ohpauleez: ah true

20:00 ChongLi: antoineB: there was a commit just a few weeks ago adding parse-ns to the compiler

20:00 https://github.com/clojure/clojurescript/commit/a27f811f046cd1ace9e4b9461181e5a5fb23b682

20:00 tpope: you need something that actually changes the buffer for the third character

20:01 ohpauleez: I never heard a good explanation of why evaluating the buffer is superior to just requiring it

20:01 cpr is perfect for "require"

20:02 ohpauleez: tpope: Oh yeah, I agree with :Require

20:02 but that's a verb

20:02 I want a noun

20:02 cp-word cp-paragraph

20:02 cp-require?

20:02 dnolen: antoineB: but what do you mean by "parse", parse into an AST?

20:02 tpope: well think of it as "requiring"

20:02 dnolen: lynaghk: ping

20:02 tpope: you're pushing a require request

20:03 a "requiring"

20:03 clojurebot: Pardon?

20:03 tpope: a "dumb bot"

20:04 ohpauleez: haha

20:04 tpope: a "requirement"

20:04 a "require dispatch"

20:04 ohpauleez: I'm going to personally map to cpa; cp-all-of-it

20:04 nice on qwert and dvorak

20:04 antoineB: dnolen: parse into something more easy to deal with (in order to extract information)

20:04 tpope: then you clobber cpab, cpap, etc

20:04 ohpauleez: damnit!

20:04 hahaha

20:04 tpope: I almost said cpA

20:04 that's perfectly available

20:04 ohpauleez: I'm for it

20:04 tpope: but not quite as nice

20:05 dnolen: antoineB: analyzer parses and produces AST which you can extract info if that's what you mean.

20:05 antoineB: but it doesn't handle full Clojure of course

20:06 ohpauleez: I'll just think of "cpr - bringing it back to life"

20:06 tpope: ha!

20:09 tufflax: what's going on here? tpope making some sort of vim plugin for clojure?

20:09 egghead: lol

20:10 bbloom: tufflax: https://github.com/tpope/vim-foreplay

20:10 tpope: made

20:10 in the shade

20:10 ohpauleez: tpope: Just a heads up, I'm getting an EOF Java Exception with cpF(

20:10 antoineB: dnolen: what i want to do is for a given namespace (bounded to a file) give a list of all function, protocol, type, definition and protocol function + their associated data like doc, arguments name etc

20:10 tpope: ohpauleez: pretty sure you've misunderstood F :/

20:10 * ohpauleez looks at the movement help

20:10 dnolen: antoineB: if you want this for ClojureScript the analyzer does that for you.

20:11 tpope: ohpauleez: that will evaluate everything from the cursor position to the previous (

20:11 antoineB: dnolen: i think a function that take a file/string and give me a clojure list could do the trick

20:11 tpope: ohpauleez: you're looking for more like F(cpp

20:11 although hcpp would work just as well

20:11 dnolen: antoineB: anayzer doesn't give you a list but it does give you a atom that holds a map of everything.

20:11 analyzer

20:15 ohpauleez: tpope: Ah yes, this makes more sense now

20:16 tomoj: bbloom: do you plan to integrate qplan with core.logic somehow? I guess core.logic won't work for doubles, so your test needs a=2b-c written thrice? but core.logic might work for grid layout? pixels??

20:16 lazybot: tomoj: Definitely not.

20:17 bbloom: tomoj: i'm not using qplan yet, so i'm not sure how it will evolve. the part written 3 times was just a test case. some higher level binding framework with explicit knowledge of linear equations could generate it

20:17 ohpauleez: bbloom: Personal question -

20:17 Where do you think you really leveled up?

20:18 between Drexel and now

20:18 because there is a stark (very good) difference

20:18 bbloom: i'm just a shitty student.

20:18 ohpauleez: (not to say I ever thought you were bad)

20:18 ahh

20:19 bbloom: happy to discuss further details privately :-P

20:19 ohpauleez: :)

20:22 tpope: I pushed cpr

20:22 tomoj: writing out equations would seem great. I don't understand yet how working manually with constraint methods would be

20:22 tpope: so you can stop trying to rename it :)

20:24 bbloom: tomoj: i'd expect not to write too many methods by hand, they are tricky to get right

20:24 even that little test case is probably horribly wrong in a larger application

20:25 tomoj: because usually you don't want to implement all the methods for a relation?

20:25 bbloom: tomoj: because you need to design your methods such that you have free variables

20:26 so you wind up with constraints being a higher-level grouping then you'd expect

20:26 consider that slider with a midpoint example

20:27 if you had three constraints: left > 0, midpoint = (left+right)/2, and right < max

20:27 then only the midpoint would be a free variable

20:27 so it wouldn't be resolvable in some cases

20:27 but moreover, it would involve the other two as outputs, so there wouldn't be a free method

20:27 it's a pretty constrained solving approach

20:28 no pun intended RE: "constrainted"

20:34 stokachu: hi ive got a question about doing some multi-site work with clojure/enlive.. my problem is I am unable to get the template to reload based on what the current server-name in the ring request is: http://stackoverflow.com/questions/13772481/clojure-enlive-multi-site

20:34 i can get the server-name based on whatever host i've setup but it seems like deftemplate will not re-request a new template page if the hostname changes

20:36 tomoj: "left > 0" is, uh, {:inputs #{:left} :outputs #{:left} :f (fn [{:keys [left]}] (max left 1e-100))}.. or what?

20:36 er, {:left (max left 1e-100)} ofc

20:39 brehaut: stokachu: im running from memory here, but deftemplate is a macro that builds a template function and caches the html content. I think you'll need to go a bit lower level if you wish to have templates change their html content on each request

20:39 stokachu: brehaut: ah ok, it seemed like something was caching ill look through the enlive source at the other functions to see what i can find

20:40 brehaut: thanks for clearing that up

20:40 brehaut: stokachu: from memory still i think 'at' is the form used for the guts of templates and snippets

20:41 stokachu: cool i will definately start there

20:41 i saw the tutorial which mentioned using at so ill refresh my memory from that too

20:41 brehaut: you will probably want to investigate some sort of caching yourself though, based on hostname, because loading the templates isnt exactly fast

20:42 bbloom: tomoj: (min left 0)

20:42 stokachu: good point i haven't really given much thought about that, it may be wise to break up this app further and keep it hostname specific

20:43 bbloom: tpope: is there a way to interrupt an evaluation?

20:43 say, if i, stupidly wrote an infinite loop?

20:44 stokachu: im curious though, is a "cloud" type deployment with a war for each domain running under a jetty instance seem like a decent idea?

20:44 i was trying to do a umbrella approach where clients coming in would be proxied to a different template based on the url

20:45 brehaut: I have no experience with war deployment, or clouds in general

20:46 stokachu: yea me either still trying to jump on the boatr

20:48 brehaut: i dont think theres any problem with the 'umbrella' mechanism you are suggesting though

21:05 antoineB: dnolen: analyze-file is what i need, but how use it in my personal project? (i copy paste for now)

21:07 bbloom: any idea how i'd go about walking a sub tree with a zipper? looping with zip/next and zip/end? is pretty easy, but it's not obvious to me how to stop at (zip/right sub-tree-root)

21:19 tpope: bbloom: if it's using if_ruby, no :(. it times out after 16 seconds

21:23 bbloom: tpope: it seems like the request timed out, but the nrepl session got blocked

21:23 i had to restart nrepl since i didn't know how to attach to a headless session and terminate the process

21:24 tpope: after my first infinite loop, I added a 16 second timeout wrapped around the connection code

21:25 when I tried exceeding it, I got a socket error over in the nrepl, but everything seemed to work fine after that

21:25 if you're having issues, it's presumably possible to send an interrupt back to nrepl. the interface is "interruptable eval" after all

21:27 you should try with a head and see if you can reproduce

21:27 bbloom: tpope: just upgraded to master a tiny bit ago. next time i write an infinite loop ill explore

21:31 devn: howdy tpope

21:31 welcome to the party

21:34 * devn tries to catch up

21:36 ghachey: Hi, not sure if this is the best place to ask. I'm trying to get started with ClojureScript One. But one of the very first step, lein bootstrap, fails with: 'bootstrap' is not a task. See 'lein help'. I read a few places that people think this is because of an incompatibility lein (my first thought as well). I use the latest lein 2. I don't really won't to downgrade. Any suggestions where to go next? Thank you.

21:37 devn: ghachey: let me try it out... I'm on lein 2 as well, one moment...

21:38 ghachey: i have the same issue.

21:38 one second, let me see if i can figure out a way around it

21:40 ghachey: yeesh. this project looks awfully neglected. 52 issues and 5 open pull requests.

21:41 ghachey: the lein version is definitely the problem, and i dont blame you for not wanting to downgrade

21:41 tpope: you should see my repos :/

21:42 devn: tpope: :) it's a blessing and a curse, i'm sure.

21:44 ghachey: perhaps there's a fork of the project that works with lein2, it looks like a couple of people have been working on that...

21:45 flying_rhino: Foxboron: found that tutorial yet?

21:46 devn: ghachey: check out brentonashworth's other branches, speficially M003

21:46 it looks like that might work out of the box?

21:48 ghachey: try this: `git fetch origin && git branch --track M003 origin/M003 && git checkout M003 && lein repl`

21:48 ghachey: devn: thank you will check that out.

21:48 devn: at the REPL type: (go)

21:48 it worked for me.

21:49 ghachey: also, open an issue to bug brenton to merge some of this lein2 support into master :)

21:50 ghachey: devn: will do, thanks.

21:50 devn: cheers!

21:51 flying_rhino: what tutorial are you looking for?

21:51 Foxboron: flying_rhino, oh f-... totally forgot.

21:52 flying_rhino: http://debugme.wordpress.com/2012/05/30/leiningen-a-basic-tutorial/

21:52 flying_rhino: thanks

21:52 and this shows how you work with projects and stuff?

21:52 devn: tpope: by virtue of the above feedback from bbloom I'm guessing you have a repo out in public now, 'zat true?

21:53 foreplay! :D

21:54 * devn installs liberally

21:54 Foxboron: flying_rhino, pure basics. It should get you started with lein. Leiningen isnt that complicated ;)

21:54 flying_rhino: thanks again

21:54 devn: (happy clojuring)

21:55 Foxboron: flying_rhino, np. Sorry for the time, coding stuff and forgot my place in the time.

21:55 flying_rhino: Foxboron: no problem at all. I should have reminded you sooner

21:55 devn: Foxboron: he didn't forget your identity, though.

21:55 flying_rhino: I was also doing other stuff

21:55 tpope: devn: yep

21:56 how did you miss foreplay.vim?!

21:56 Foxboron: devn, and great is that :)

21:56 devn: tpope: :X I've been sick for a week, quite literally. The flu is *rough* this year.

21:58 tpope: aww

22:02 flying_rhino: Foxboron: I must say (I feel like broken record really) that while there is plenty to like about clojure I wish that mutability wasn't the dirty word it is. Functional is okay as DOMINANT paradigm, but something doesn't sit right with excluding everything else. For example how am I going to create the new sort of immutable type, (say vector that acts like db table) if I don't have acess to basic (i.e. mutable) building blocks?

22:03 I fell like building blocks I have aren't fine grained enough...

22:04 bbloom: flying_rhino: what mutable building blocks don't you have?

22:06 muhoo: any ideas how i'd convert a jodatime object to json using cheshire?

22:06 devn: flying_rhino: you *do* have access. You can do whatever you like.

22:07 flying_rhino: it's just, state is dealt with differently in clojure.

22:07 flying_rhino: maybe I can tell you what I would like to do and then you can tell me how to do it? If I am not annoying to you.

22:08 devn: flying_rhino: specifics are good. for instance: "I have (1 2 3) and I want (6 5 4)"

22:08 but more general questions are of course encouraged as well

22:10 flying_rhino: either way, clojure is not purely functional. it strongly encourages it for numerous reasons, but it doesn't prevent you from doing what you need to do. stuart halloway put it best a long time ago: "Clojure is a consenting adults language."

22:12 flying_rhino: for instance...

22:12 ,(let [x (transient [1 2 3])] (persistent! (conj! x 1)))

22:12 clojurebot: [1 2 3 1]

22:13 muhoo: hm, found it, add-encoder. sweet.

22:13 devn: flying_rhino: see http://clojure.org/transients

22:15 flying_rhino: so uh, long story short, no, you're not annoying anyone. this isn't that kind of community. no one is going to kick you out of the channel for asking questions. :)

22:15 muhoo: hmm, wait, no. add-encoder doesn't exist. gah, documentation mismatch

22:15 ok, this is why i really REALLY would love it if README.md for the version of a jar were included in the actual jar.

22:16 flying_rhino: I would like to have new data type that is similar to vector but acts more like db table. It acts like db table in that, when you remove something from the middle (or rather make cheap copy with something removed) higher numbers stay intact. if you have 5 elements and remove third, last two are still marked as 4 and 5. If you remove 5 and then add new thing, it will be marked 6. So index should act like auto increment primary key.

22:16 If this was Java I would use hash table that has numeric keys and bundle it with increment_number in a class. How do you do it in Clojure?

22:16 muhoo: because, digging up the README.md from github produces stuff having nothing to do with the particular version of the library i've actually got loaded into the repl :-/

22:16 tomoj: hmm.. conj!, end!, deliver, and fail in cljque scare me

22:17 but I rationalize their presence with "consenting adults.."

22:17 flying_rhino: devn: that, in short is what I need :)

22:17 tomoj: in q.js, the promise is a separate object from the thing which you deliver to or fail

22:18 one big reason for that is that the author wants to make a promise a safe thing to share across some kind of semitrusted (untrusted?) js boundary

22:19 but I tend to think of "the rest of my code" as semitrusted..

22:20 Raynes: I have devn and I want tomoj.

22:20 flying_rhino: devn: I hope I havent lost you :)

22:21 devn: flying_rhino: what about sorted-map?

22:21 tomoj: you want me?

22:21 devn: Raynes: im trying to golf on that as we speak

22:22 ,(require '[clojure.string :as s])

22:22 clojurebot: nil

22:22 devn: ,(s/replace "devn" #"devn" "tomoj")

22:22 clojurebot: "tomoj"

22:23 devn: err i guess you want a damned symbol back, eh Raynes? ;)

22:23 tomoj: a synchronous analogy would be that, when you block on a lazy seq, any other consumer of that lazy seq may throw an exception up to you

22:23 I think?

22:23 flying_rhino: devn: it is more about encapsulation. I would like to 'hide' the mechanism that auto-increments numbers so it is simple to use and you can't screw something up accidentally. I am just not sure how to create new data type. But yes, sorted-map or something should be used at the core of what I want.

22:27 am I talkin nonsense?

22:27 devn: nah, im just not sure the answer

22:27 i've never needed that, personally

22:29 flying_rhino: extend-type clojure.lang.IPersistentVector?

22:29 flying_rhino: i realize that is wildly vague, but it seems like it's moving closer to what you're after

22:29 flying_rhino: because the way it would work now whould be two variables one sorted-map and one integer containing next-id.

22:30 what does persistent vector do?

22:30 devn: ,(class [])

22:30 clojurebot: clojure.lang.PersistentVector

22:31 devn: ,(class (sorted-map))

22:31 clojurebot: clojure.lang.PersistentTreeMap

22:33 devn: flying_rhino: you want this type. maybe another question would be why?

22:34 flying_rhino: I want to implement Entity Systems in clojure.

22:34 there is whole blog dedicated to those.

22:34 devn: flying_rhino: clojure-games?

22:35 flying_rhino: Normaly they are mutable, but I would love to see if it is viable to create immutable Entity Systems.

22:35 yeah they are mostly for games.

22:35 devn: flying_rhino: http://www.clojure-games.org/component-entity-system

22:35 have you seen that?

22:35 flying_rhino: nope

22:36 I'll have to study that

22:36 devn: flying_rhino: hopefully that gives you a place to start?

22:37 flying_rhino: to see if it is what I meant (since there are several similar but subtly differen ES approaches). But yes it is a place to start !

22:37 thank you!

22:37 devn: flying_rhino: wish i could be of more help!

22:38 flying_rhino: https://gist.github.com/858586

22:38 that seems to be the bread and butter.

22:39 flying_rhino: boom! https://github.com/ibdknox/gambit

22:41 flying_rhino: more reading... http://stevelosh.com/blog/2012/07/caves-of-clojure-interlude-1/

22:45 flying_rhino: have to study that A LOT more but at a glance it seems to be different kind of entity systems. Ones I am interested in are purer, with more separation of code and data. These seem to bunde everything together. http://t-machine.org/index.php/category/entity-systems/

22:46 * devn reads

22:48 flying_rhino: devn: if you want to read more, start here http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/

22:49 devn: flying_rhino: thanks. interesting stuff.

22:49 flying_rhino: devn: that page isn't labeled as entity system on his blog, but is first and most importatnt

22:50 devn: flying_rhino: how familiar are you with clojure's agents, refs, and atoms?

22:50 flying_rhino: devn: basics only, at this point. But I have idea what are they for.

22:51 devn: i havent finished reading your suggestions, but the first post you linked above under the category "entity-systems" immediately made me think about refs and agents

22:52 again, that is wildly vague. it just seems to sort of "fit"

22:52 the whole idea of "identity matters"

22:52 flying_rhino: point of entity systems (the ones used in mmorpgs as described on blog) is to separate code and data

22:52 devn: you want a db-like datatype

22:52 etc.

22:53 flying_rhino: basically at one pile you ahve bunch of pseudo-tables

22:53 devn: flying_rhino: but i mean, that's sort of the fundamental draw of clojure

22:53 code *is* data

22:54 flying_rhino: these are tables are components. Entities provide identity (like that creature consists of this and that component)

22:54 systems are where code is

22:54 *these tables are components

22:54 every tick systems process components

22:54 devn: is this akin to agent-based modeling?

22:55 flying_rhino: not sure

22:55 devn: http://en.wikipedia.org/wiki/Agent-based_model

22:56 tomoj: a db-like datatype.. like datomic.Database? :)

22:57 but "mmorpg" hmm.. :/

23:03 devn: tomoj: im stargazing as well :)

23:04 i keep thinking of the ants simulation

23:04 but with added metadata

23:04 flying_rhino: basically componets are like records. Physic component would be (:x-position :y-position :x-speed :y-speed) . Health would be (:current-health :max-health :regeneration-rate) . Weapon would be (:ammo :rate-of-fire :damage :max-ammo). You get the point. Entity is solely to keep track of what components each creature in game has. It just has list of components (and each component refers to it). Systems are where actual code is. Phys

23:04 ics system graphic system, interface, ai

23:05 muhoo: cheshire is awesome. the way javascript handles floats is not awesome.

23:05 devn: the way javascript handles numerics in general: not awesome.

23:06 flying_rhino: thus is possible to compose new creature by simply entering right data, without code.

23:06 only when you want brand new behaivor you need to touch code

23:06 it is VERY data driven

23:07 devn: flying_rhino: i wish ibdknox were here...

23:07 * muhoo looks up how clojurescript handles integers/longs/etc

23:07 flying_rhino: ibknox?

23:07 devn: chris granger -- he wrote gambit and i'm guessing has some opinions or ideas about what you're discussing

23:08 muhoo: exactly :)

23:08 flying_rhino: devn: it is actually quite simple

23:08 I am not sure if doing it this way in immutable language is even a right approach

23:08 tomoj: flying_rhino: I think you should look into datomic, but it probably can't handle an mmorpg, at least not without using multiple transactors (and dealing with that somehow..)

23:08 flying_rhino: tomoj: I am not building mmorpg per se

23:09 devn: flying_rhino: it is all quite simple ceteris paribus

23:10 flying_rhino: I just want code to be (potentialy) extremely scalable and to be easy to compose new stuff. And I am aware that entity systems are great for that.

23:10 tomoj: well, if you can afford to put all your write load on one box (which is not as bad as usual with datomic, but still a problem sometimes) and have all your writes broadcast to all jvms doing queries, then I think you should definitely look into it

23:11 even if just to take ideas from it

23:11 devn: tomoj: it seems like he's not in need of that, that the regular facilities in clojure provide for what he's looking for

23:11 tomoj: that is, no durability?

23:11 dabd: I'd like to keep the largest value in the resulting list without having to invoke last which is O(n). What is the idiom?

23:11 (take-while (fn [x] (< x 72)) (map #(i/choose % 5) (range 4 72)))

23:11 i/choose is incanter.core/choose

23:12 devn: tomoj: it seems like he's describing passing around game state

23:12 tomoj: oh I missed the actual problem and only looked at the mmorpg stuff

23:12 devn: like the whole board is visible to all actors, and actors can be imbued with properties

23:13 flying_rhino: ystems should create new state (that is new copies of components) every thick

23:13 *systems

23:13 tomoj: nevermind :)

23:13 flying_rhino: and no, not every systems needs to see every component

23:15 *system

23:15 tomoj: so in the ants demo, each grid cell is a ref and each ant is an agent?

23:15 flying_rhino: I have no idea if building this in clojure is a good idea

23:15 clojurebot: Ok.

23:15 flying_rhino: AT ALL

23:16 devn: flying_rhino: nor do i. my guess? try it. :)

23:16 flying_rhino: your response to other component entity systems written using clojure are coupled

23:16 flying_rhino: we are still stuck with what datatype acts like a table :)

23:17 devn: but maybe your version of coupled doesn't fit in clojure

23:17 maybe it *isn't*

23:17 im just posing what-ifs here, not saying you're wrong

23:18 s/using clojure are coupled/using clojure is that they are coupled

23:19 bbloom: flying_rhino: "acts like a table" isn't just one datatype

23:20 flying_rhino: devn: if you mean coupling data and code, t=machine guy doesn't consider those to be 'real' entity systems http://t-machine.org/index.php/2007/11/11/entity-systems-are-the-future-of-mmog-development-part-2/

23:21 bbloom: flying_rhino: the built in data types provide various space/time guarentees for various protocol functions

23:21 you can create a compound data structure that provides indexes, etc

23:21 but none of the built ins are going tod o that for you for multiple sorts, perspectives, views etc

23:21 if you want a single sorted order preserved, you should use sorted-map or sorted-set

23:21 (most likely)

23:22 flying_rhino: bbloom: how would you build compound data type? I know how to do that with classes, but what clojure uses for that?

23:22 bbloom: you can define types with deftype

23:22 tomoj: it's somewhat likely that idiomatic clojure for doing what you want would use something pretty different from what you think you need

23:22 bbloom: however, if you're really new to clojure, i suggest avoiding defining types right away

23:23 start with getting really comfortable with the built in types

23:23 devn: defrecord

23:23 deftype, defrecord

23:23 flying_rhino: defrecord is just for structs with no behaivor. Or am I wrong?

23:23 bbloom: flying_rhino: deftype is a primitive, so to speak

23:24 defrecord is sugar which calls deftype and then adds map-like behavior to that new type it defines

23:24 you can add ADDITIONAL behavior to your record types

23:25 you most likely won't want to even use deftype if you don't need it

23:25 let's say you have a collection of people with first and last names

23:25 [{:first "Brandon" :last "Bloom"} {:first "Dev" :last "N"}]

23:26 call that rows

23:26 you can use a sorted set: (sorted-set compare-first-name rows)

23:26 and (sorted-set compare-last-name rows)

23:26 devn: (or sorted-set-by)

23:26 bbloom: yeah that

23:26 devn: ((if that's helpful to you))

23:26 bbloom: you can stick those inside a map to group them together

23:27 {:indexed-by-first-name …, :indexed-by-last-name ...}

23:27 and you can create a one-off function which lets you insert-person or remove-person

23:27 insert-person would just add an item to both sets

23:27 remove would remove it from both sets

23:27 just start with that

23:27 get used to working with those core data types

23:28 you don't need to define a new type to have two indexes

23:28 just create a small set of functions that do the operations you want

23:28 start there

23:29 if you're in a rush to deftype, then you're not thinking clojure-y enough yet :-)

23:29 flying_rhino: does that make sense?

23:30 devn: flying_rhino: i gotta agree with bbloom -- there's a lot of room (and rope) in the core datatypes. when you find the point where you actually need to use deftype, that's the point at which you start trying to build your own

23:31 bbloom: deftype when you need type dispatch

23:31 flying_rhino: I don't want two indexes. I just want that when I remove something from the middle, higher stuff has same index. If you remove from the end and add something else, it has bigger index. Like auto increment primary key. In java I would implement it with hash table and next-id integer.

23:31 devn: flying_rhino: but this isn't java

23:32 flying_rhino: but changing indexes for items is what I seek to avoid!

23:32 index must be unique for each item and must not be re-used.

23:33 okay I'll think about this stuff

23:33 I am a bit tired, it is late over here

23:33 bbloom: (let [db {:next-id 1 :rows {}}, id (:next-id db), new-row "fred"] (-> db (assoc :next-id (inc id)) (update-in [:rows] assoc id)))

23:33 ,(let [db {:next-id 1 :rows {}}, id (:next-id db), new-row "fred"] (-> db (assoc :next-id (inc id)) (update-in [:rows] assoc id)))

23:33 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$assoc>

23:33 bbloom: ,(let [db {:next-id 1 :rows {}}, id (:next-id db), new-row "fred"] (-> db (assoc :next-id (inc id)) (update-in [:rows] assoc id new-row)))

23:33 clojurebot: {:next-id 2, :rows {1 "fred"}}

23:33 bbloom: flying_rhino: there, that 1 worked

23:33 devn: :)

23:33 flying_rhino: thanks

23:34 bbloom: it's the same idea: top level map to group a next-id and a set of rows together

23:34 transform them at once

23:34 wrap the whole thing up in an atom, and you've got a mini db :-)

23:34 devn: that reminds me a bit of stupiddb

23:34 an old Licenser project

23:34 flying_rhino: thanks

23:35 devn: https://github.com/Licenser/stupiddb

23:35 flying_rhino: well a kind of stupid db is more or less what this thing is. Although bonus is that you can serialize stuff to actuall db easy.

23:35 bbloom: devn: nice.

23:36 flying_rhino: https://github.com/Licenser/stupiddb/blob/master/src/stupiddb/core.clj kinda neat

23:37 flying_rhino: also some mmorpgs use (I hear) actual DB's for backend. No idea how they take data in and out in real time games.

23:38 but that's flexibility of entity systems. You can start with pseudo-db and later switch to real one.

23:38 dOxxx: probably snapshots that are written to the disk in background

23:38 flying_rhino: and use db to serialize data in between.

23:39 when you entangle code and data, you lose that flexibility.

23:41 bbloom: you're preaching to the choir about tangling code & data in this channel :-)

23:43 devn: flying_rhino: that temporary serialization of data is exactly what stupiddb provides

23:43 flying_rhino: OOP S.U.C.K.S (well, at least as a general purpose organizational technique; it has some use for specific stuff)

23:43 devn: or, close to it

23:44 flying_rhino: (now I better come down from a soapbox before I am lynched)

23:45 *the

23:45 dOxxx: Does a hammer suck? Yes, if you're trying to put a turn a nut on a bolt with it.

23:45 :)

23:45 devn: flying_rhino: a "soapbox" is what snake oil salesman use.

23:46 you don't strike me as a snake oil salesman.

23:46 soapbox away!

23:47 flying_rhino: but really I no longer have any idea if ES (the kind I want to use) make any sense in clojure.

23:47 devn: flying_rhino: perhaps you're too concerned with up-front verification? Why don't you give it a try?

23:49 flying_rhino: maybe the kind you want to use just *looks* different in clojure.

23:49 dOxxx: The Entity System that t-machine article is about seems to be fairly independent of language.

23:49 It's more of a architectural thing.

23:50 flying_rhino: basically we are using systems to create chaep copies of components (tables) every game tick (that is every quater second)

23:50 *cheap

23:51 dOxxx: I'd think that creating copies of a non-trivial amount of data 4 times per second is going to cause you trouble no matter language you use

23:51 devn: flying_rhino: cheap "copies" over time sounds like persistent data structures to me.

23:51 dOxxx: that's an assumption

23:51 flying_rhino: dOxxx: in mutable language I would simply alter those components

23:52 here I can't alter anything.

23:52 devn: flying_rhino: that's patently false

23:52 atoms, refs, agents

23:52 alter them.

23:53 flying_rhino: I thout that here you alter stuff primarily via creating modified (cheap) copies of stuff.

23:53 *thought

23:53 devn: ,(let [my-ref (ref [])] (dosync (alter my-ref conj 1)))

23:53 clojurebot: [1]

23:53 flying_rhino: (I am new to clojure)

23:53 devn: literally (alter)

23:54 flying_rhino: no, take a deeper look at refs, agents, and atoms

23:54 i think everything you need is right there

23:54 dOxxx: basically, clojure does have mutable state

23:54 it's just mutable state that uses immutable structures

23:54 devn: (but it's done in a way that doesn't suck)

23:55 dOxxx: i.e. you have a list that you want to change. you don't modify the list itself, you replace its with a new list that contains the original and the new elements

23:55 devn: not a new list per se

23:55 a shared structure

23:55 dOxxx: yeah

23:56 flying_rhino: dOxxx: and that is called cheap copy, since it is shared structure?

23:56 dOxxx: yes since new list is constructed like (head = new item, tail = old list)

23:56 it doesn't have to make a copy of old list into the new list, it just references it. that's what makes it cheap

23:57 flying_rhino: then my description "basically we are using systems to create chaep copies of components (tables) every game tick (that is every quater second)"

23:57 is correct

23:57 I specified "cheap" copies. I know those are shared memory structures.

23:57 devn: flying_rhino: i dont think anyone is arguing

23:57 flying_rhino: but cheap copies does not immediately imply "persistent hash array mapped tries"

23:58 dOxxx: I think my point was that it may be "cheap" but it's not "free" :)

23:58 flying_rhino: dOxxx: so the question is is there too much overhead or not?

23:58 dOxxx: that's what testing is for

23:59 I actually went through something like this a few months ago

23:59 I had an algorithm for parsing a text file of a fixed format written in Scala, in an mostly imperative fashion using mutable structures.

23:59 I decided to rewrite it using immutable structures in Clojure.

Logging service provided by n01se.net