#clojure logs

2012-09-27

00:28qfr_und_qfrcasion, sweety, don't you just love sneaking in with infestors from the back and neuralling their entire tank line while you crash zerlgings, banelings and ultralisks in from 3 different directions?
00:29arrdemTIL #clojure plays sc2....
00:29qfr_und_qfrOf course.
00:29qfr_und_qfrWho doesn't?
00:30qfr_und_qfrcue balance whine of course when I did that.
00:30arrdemmeh. if you can micro infestors that well you deserve it.
00:30arrdempersonally I'd opt for an advancing wall of mutas and lings
00:30arrdem(it being the engage win)
00:31qfr_und_qfryou box them, unburrow them all and spam neural on all the tanks really.
00:31qfr_und_qfrIt'smore timing it well with coming from all directions
00:32qfr_und_qfrI play random anyway and my TvZ is slightly better than my ZvT so the balance whine was unwarranted
00:32alex_baranoskythis is the Clojure channel right?
00:32arrdemalex_baranosky: last time I checked...
00:32alex_baranoskyk, just making sure Colloquoy didn't transport me to another land
00:33Fossisc2 \o/
00:33Fossicould play some randoms again
00:33qfr_und_qfrMad jelly at mah neural parasite.
00:34qfr_und_qfrUnderused honestly since the range nerf, you can still use it, itś just no longer the answer to everything but it definitely can be used on tanks and thors.
00:34Fossithen somehow i don't find the time anyway ;)
00:34qfr_und_qfrOr like, I often go ultrabane ZvP and your biggest enemy then are archons and being able to neural them is great
00:34qfr_und_qfrautomatically stops banelings from wasting themsleves on them
00:47john2xnoob question, how do I `use` a java package I added to dependencies by [net.sourceforge.cssparser/cssparser "0.9.7"].. (use 'net.sourceforge.cssparser/cssparser) gives a FileNotFoundException..
00:49scottjjohn2x: you import the java class you want
00:55john2xscottj: oh right. d'oh. thanks!
02:26augustliirc that most people think records are a bad idea, but I don't remember why and can't seem to think of any reason why they are bad. Any anti-record peeps around that would care to enlighten me?
02:35xeqiaugustl: do you mean the 'use maps where possible' crowd?
02:36unlinkWow I thought I missed a huge upheaval in the vogue philosophy of the programming language. Then I realized I wasn't in #haskell.
02:59mikehoyI'm trying to (load "test") with leiningen and I'm getting class path errors I've added export JAVA_HOME="/usr/bin/java" and export PATH="/home/USER/bin/:$PATH" to my ~/.bashrc file
03:03xeqimikehoy: do you have a file named test.clj?
03:03mikehoyyes I do
03:04mikehoyactually the FileNotFoundException Could not locate test__init.class or test.clj on classpath: clojure.lang.RT.load (RT.java:432)
03:04mikehoyoops
03:04mikehoybad paste
03:04arrdempastebin
03:04arrdem~paste
03:04clojurebotpaste is https://refheap.com/
03:05mikehoydo you want a paste bin of test.clj and the bashrc file?
03:05mikehoyI'm running ./lein repl
03:05xeqiwhats the path to test.clj from your project root?
03:07mikehoyhttp://dpaste.com/806696/
03:08kostafeyCan somebody help me with configure nrepl in emacs?
03:08xeqimikehoy: you need to put test.clj in the src/ or test/ folders
03:09mikehoyjust put it in /src no luck
03:09lpetitHello there
03:11mikehoyxeqi: also tried /test no luck
03:11borkdudemikehoy who do you type ./lein instead of lein?
03:11mikehoyborkdude: ./lein
03:12borkdudewhy
03:12mikehoyborkdude: ./lein repl
03:12mikehoyborkdude: so it will execute, otherwise it does nothing
03:12borkdudein that case the lein script must be in the sandbox also
03:13mikehoycan I just mv it ?
03:13borkdudemikehoy better is to put it on the path
03:13mikehoyexport lien="/path/to/lien" ?
03:14borkdudemikehoy it depends on what kind of shell you are using I guess, bash?
03:14mikehoyborkdude: yes
03:15borkdudemikehoy then smth like that yes
03:15borkdudehttp://www.troubleshooters.com/linux/prepostpath.htm
03:15borkdudemikehoy but then different
03:16borkdudemikehoy for example: export PATH=$PATH:~/opt/leiningen
03:18borkdudemikehoy in my .bashrc I have export PATH=$PATH:~/bin
03:18borkdudeand the lein script is in ~/bin
03:18mikehoyborkdude: ok that is what I have as well
03:18mikehoyI will try that now
03:18mikehoythen I can run lein from anywhere?
03:19borkdudemikehoy yes, but restart the shell first
03:19mikehoysource /etc/profile?
03:19borkdudewhat?
03:19clojurebotwhat is exceptions
03:24mikehoyborkdude: you fixed it bro, thanks.
03:25borkdude:-)
03:27mikehoyborkdude: what do I have to do to run a clj program without invoking the repl?
03:27borkdudemikehoy check out lein run
03:27mikehoyborkdude: ok
03:28borkdudemikehoy lein help run displays some hints
03:29ori-ldoes anyone know how to configure readline behavior for lein repl? pressing the up arrow gives me (reverse-i-search), much like ctrl+R in bash. i'd like it to scroll through the command history
03:35borkdudegtg
04:22kralnamaste
05:54augustlxeqi: went afk, sorry. Refs protocol, yes I think so.
06:21zoldardoes anybody working with nrepl.el experience a problem where pressing enter in repl buffer on unbalanced form causes emacs to freeze with 100% cpu usage?
06:23clgvzoldar: does your form block? I experienced 100% cpu load with lein+nrepl when the form blocks
06:23zoldarclgv: but it isn't even complete, the repl should just open a new line
06:24clgvzoldar: oh ok. then thats probably different
06:25zoldarit's a bit frustrating, because every time when this happens in the middle of work, I have to kill emacs process and start again, setup buffers, jack-in, recover contents etc...
06:32clgvhumm nrepl.el is still young...
06:33zoldarbut it's already widely used so I hoped that maybe I'm not alone with that issue
06:38zoldarit happens even on a clean project after typing in a form like "(+ 1 2<enter>" ... suppose that must be something with my specific setup. Will try to dig into it later
06:40clgvzoldar: search in his issue tracker for a related issue and add a comment or create a new issue if there is none
06:44zoldarclgv: I will, when I'll isolate it better
06:45augustlis there a way to check which "fields" a record has?
06:46clgvaugustl: keys
06:47clgvaugustl: though some of them are no fields of the java object
06:47augustlhmm, I need to make an instance of the record to do that
06:47augustlso yeah, by "a record" I mean the actual record "class"
06:47clgvaugustl: java reflection
06:48augustlclgv: I see
06:48clgvaugustl: something like clojure.contrib.repl-utils/show which unfortunately ceased existence during migration
06:48augustltrying to find a scheme to handle the problem I'm currently having - using maps means strings being keys some times (json parse), and keywords others (mongodb query results)
06:48clgvbut you can have a look at it to find out how it is done
06:49augustlseems records would be a good solution, but would like to validate that the stuff I JSON parse doesn't contain unknown keys, etc
06:49clgvaugustl: so, what is the problem?
06:50clgvwhat is the problem with unknown keys?
06:50augustlclgv: the problem with strings vs. keywords is that for example a validation function will have to handle the fact that the object it validates some times uses strings for keys and some times uses keywords
06:50augustldepending on whether I create or update, basically
06:51augustlI currently clojure.walk/stringify-keys before I validate
06:51augustlbut since my system does expect a certain set of keys to be present, not all keys you could possibly imagine, something stricter, like records, seems to make sense
06:52clgvaugustl: you can use `select-keys` to get a map containing only the specified keys
06:52augustlby the way, are keywords garbage collected? The Ruby equivalent, symbols, aren't, so it's not safe to "keywordize" user input
06:53clgvaugustl: you have to recheck but I think they are internalized
06:54augustlclgv: what does internalized mean?
06:55clgvyou can check it here: clojure.lang.Keyword/intern
06:56augustlclgv: thanks
06:57augustl(inc clgv)
06:57lazybot⇒ 4
06:57augustleww, side effects
06:57clgvaugustl: they are stored there in a hashmap with WeakReference
07:27CheironHi, is it possible to install lein2 and lein on the same machine?
07:31mpenetCheiron: yes, see the Upgrading page on the leiningen wiki, you end up with lein1 and lein commands
07:34Cheironmpent: i installed lein 1.x with brew . i guess i have to run $ mv ~/usr/local/bin/lein ~/usr/local/bin/lein1 ?
07:34Cheironmpenet: i installed lein 1.x with brew . i guess i have to run $ mv ~/usr/local/bin/lein ~/usr/local/bin/lein1 ?
07:34mpenetI wouldn't know, I am not on OSX, but probably
07:35mpenetCheiron: "which lein" should return its location
07:35Cheironyes, i run it and posted the earlier line
07:36Cheironso that should be fine?
07:36mpenetyes
08:06lpetitSeems like americans are still recovering from strangeloop. Nobody seems to wake up early, today :)
08:29mpenetAwesome overload
08:29lpetitmpenet: hello, and uh ?
08:30mpenetnevermind, trying to be funny in a language I clearly don't master
08:30lpetitmpenet: same here :)
09:10clgvhello you two
09:23lpetitclgv: hello
09:52jkkramerlpetit: hey, just posted an emacs-to-ccw report to the ccw mailing list. overall, very good experience. thanks for making ccw
09:53casionis there a preferred way of handling ftp connections other than using commons-net directly?
09:53lpetitjkkramer: I'll read it with great interest, thanks for this !
10:00mpenethello clgv
10:00clgvnow I notice that I never read the CCW ML...^^
10:02lpetitjkkramer: whoops, your message was awaiting moderation. I accepted it, sorry for the delay
10:04clgvoh, 0.10.1 is released
10:04lpetitclgv: indeed, forgot to mention it here
10:04clgva pity I cant program anything today - gotta finish my slides first
10:04lpetithopefully bug reports will stop, and I'll be able to focus on adding features :)
10:05clgvI'll find them bugs - I have some magic ability regarding that ;)
10:05lpetitclgv: I have faith in you :-P
10:06jcromartieCompjure time: why does (routes (some-middleware x) y z) seem to apply the middleware to y and z as well
10:07jcromartiespecifically, I am adding a paging middleware to the first route in a sequence, but the rest of the routes are affected
10:07jcromartieand I don't understand why
10:07jcromartieweavejester: you around?
10:07weavejesterjcromartie: I am indeed
10:07jcromartie(routes …) doesn't thread things through the handlers
10:07jcromartieright?
10:07clojurebotto be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks
10:08jcromartieweavejester: and (wrap-foo (GET …)) returns a perfectly valid handler on its own
10:08clgvclojurebot: botsnack
10:08clojurebotbotsnack is scoobysnack
10:08weavejesterjcromartie: If you have (routes (some-middleware x) y z), the middleware will only be applied to x
10:08jcromartieweavejester: that's what I thought
10:09weavejesterBut because x comes before y and z, if x does not return nil, it might mean that y and z are not evaluated
10:09lpetitjkkramer: your feedback on the ml in invaluable, thanks again for having taken the time to report it !
10:09weavejesterFor instance, if x returns some access-denied response if it can't find the route
10:09jcromartieah, I see what the issue is
10:09jcromartieweavejester: my middleware is returning a result no matter if the route matches
10:09jcromartieI need to test it first
10:10jcromartie(when-let [resp (handler req)] ...)
10:12clgvlpetit: I cant find the mail on top of the list. :/
10:13lpetitclgv: its title is "Emacs to CCW: Experience Report"
10:13clgvccw-users list right?
10:14lpetitright
10:15clgvmaybe I have to be signed in
10:15lpetitweird
10:16clgvnope. it is not visible and google cant even find it when searching the group
10:16jcromartieI've replaced a few thousand lines of Java with 150 lines of Clojure
10:17jcromartieand I'm pretty sure I haven't lost anything
10:18lpetitclgv: dammit, you're right, I can't see it either, that's weird
10:18lpetitbecause I received it in my inbox !
10:19clgvha!
10:20lpetitI'll answer to it, hopefully it will resolve google group's mess
10:21lpetitI suspect emacs lobby to have filtered this email out :-D
10:21clgvhaha, they are everywheren! ;)
10:35lpetitclgv: seriously, I can only see one reason : it's in my inbox because i've received it, it's not in the google groups because it has been deleted ?
10:35lpetitjkkramer: ^^ ?
10:35Hodappinteresting, "Can programming be liberated from the von Neumann style?" by Backus, circa 1978, discusses the idea of ranking the expressive power of languages
10:35clgvhit the wrong button when accepting? ;)
10:36HodappI'd wondered about this myself, but this paper is the first I've seen that puts any algebraic basis whatsoever to it, though it restricts it to FP languages
10:36lpetitclgv: no, or I wouldn't have received it myself
10:37clgvweird
10:37casionHodapp: why would expressive power measurement be useful?
10:37jkkramerlpetit: odd. I definitely sent to Google Groups, not you directly. I did receive an error when trying to post, had to sign into Google, and re-submit. Then it said it would be posted once approved
10:38lpetitjkkramer: and I approved it, or so it seems
10:38Hodappcasion: Because perhaps you're interested in finding which language is the most expressive.
10:38jkkramerlpetit: google groups is notorious for this kind of thing. maybe it's just taking a while to show up?
10:39lpetitjkkramer: maybe, but since I received it myself, I'm surprised
10:39jcromartiehow does my Content-Type header get a charset tacked on?
10:39clgvlpetit: maybe google is busy adding its content to all its indices ;) :P
10:39Hodappcasion: and because the expressive power may have implications for things such as proofs, automated or otherwise.
10:40lpetitclgv: :)
10:41lpetitjkkramer: I've got a lot of questions related to your email. Do you prefer to answer here (and right now), or via email (and at your own pace)?
10:42jkkramerlpetit: here is fine
10:43lpetitjkkramer: "when importing a project …" = I don't understand what the problem was, copying gigabytes of un-versioned app data ...
10:44jkkramerlpetit: I had a pre-existing lein project. When I added it to Eclipse, and tried to convert to a lein config, Eclipse copied everything -- including gigabytes worth of app data -- into the bin directory
10:45jkkramerlpetit: coincidentally, I was low on hard drive space, and it brought my system to its knees
10:46lpetitjkkramer: ha, you mean data from java source paths, resource paths, were copied into bin/, that's it ?
10:46clgveclipse has a checkmark on the import dialog that says "copy into workspace"
10:46clgv*checkbox
10:47clgvmaybe that one is checked by default
10:47jkkramerlpetit: the data was outside the classpath, and ignored by git
10:48jkkramerclgv: I kept the same project dir on disk, which is outside the default Eclipse workspace
10:48lpetitjkkramer: I thought the data was in src or resources/ dir, which could have explained your problem, and your fix (to place exclusions)
10:50lpetitjkkramer: if you can produce a step by step guide to reproduce the problem, please file a specific issue for this one, I suspect it may denote something wrong in the way leiningen support is added to an eclipse project
10:51jkkramerlpetit: ok, will do
10:51lpetitjkkramer: many thanks
10:53lpetit"REPL: couldn't figure out how to stop/restart" : then the current Eclise way is not intuitive. What could have helped you ? An entry in the FAQ page (and the FAQ page better visible ?) An entry in the documentation on the wiki page (did you have the reflex to refer to it first ?) ? An addition / a change to the user interface ?
10:54lpetitjkkramer: ^^
10:55lpetitjkkramer: what was unclear ? The fact that you had to both close the REPL view and hit the red square on the console view, I guess ? Would you expect that closing the REP view would also kill the underlying jvm process?
10:58jkkramerlpetit: I initially expected closing the REPL view to kill the process. I didn't even know that Console was related to the REPL. I looked in the installation docs first (http://code.google.com/p/counterclockwise/wiki/Documentation#Launch_a_REPL_for_the_project)
10:59jkkramerlpetit: I tried reproducing the data-copied-to-bin issue with a minimal project without success. Will try some variations...
11:01lpetitjkkramer: "trailing enter" : Maybe a tiny gray cross in the upper right corner could act as an easy way to switch the preference from "visible" to "invisible" ?
11:02jkkramerlpetit: yeah. or (if possible) having the typed code cover the "trailing enter" text. e.g., if the code had a solid white background color
11:04lpetitjkkramer: alas, Eclipse's SWT's StyledText is not as powerful as Swing's text widgets. The solid white background color trick is not possible:-(
11:05lpetitjkkramer: "Content Assist" doesn't appear to work. Is it now a solved problem? I wasn't expecting this one, to be honest.
11:06jkkramerlpetit: it doesn't work in the repl for me. I mean the yellowish popup with arglists, not the code-completer
11:06lpetitAh
11:07lpetitjkkramer: 0.10.1 has a bug fix for code completion when developing in mixed-team (emacs / ccw) : now the clojure-complete hacked ccw version is in its own namespace
11:07jkkrameroh…I'm now seeing "Cannot find declaration for symbol under cursor" now in the main editor for content assist. This has happened before. Is there some way to get a log or stacktrace for that?
11:07lpetitjkkramer: eclipse logs live in your workspace's .metadata/.log file, if any
11:08lpetitjkkramer: you're aware that you need a running repl for the code completion to work, right?
11:08jkkramerlpetit: yup it's running
11:08lpetitjkkramer: ok
11:10jkkramerlpetit: the code completion always works. it's the yellowish popup (which I'm more interested in) that doesn't show, or shows inconsistently
11:10lpetitjkkramer: and it shows inconsistently in the REPL only, or also in the editor.
11:11jkkramerlpetit: "Context Information" according to the keys pref, bound to Shift+Ctrl+Space. Both repl and editor. Editor sometimes works, repl it never works
11:13lpetitjkkramer: yes, it's called "context information" in Eclipse, and "Content Assist" in Eclipse is for "autocompletion :). I can see that it indeed seems to work quite erratically. Would you please file an issue for this one as well, that's absolutely not desired behavior !
11:14lrennoff topic, but I know a lot of clojure folks play go, so kaya.gs just released 300 account if anyone is interested.
11:16jkkramerlpetit: issue created
11:16lpetitjkkramer: "Working with checkouts". There's a task in my todo to "address" the underlying problem of working with several projects at the same time. But the intended fix is not to use the checkouts/ directory, but rather to automatically detect, in the Eclipse workspace, all the projects which happen to be direct dependencies of other projects, and add them to other projects java build paths as "project dependencies".
11:17lpetitjkkramer: would that cover your use case correctly?
11:17lpetitjkrramer: re: issue thx
11:17jkkramerlpetit: absolutely. I don't have any particular attachment to checkouts, just want to develop multiple libs simultaneously
11:17lpetitjkkramer: ok
11:17lpetit(fine ;) )
11:19lpetitjkkramer: now, let's dig into the "Editing" section of your email :)
11:19jkkramerlpetit: I will say, with checkouts, I end up editing the files under checkouts dir with only the one project open. With the feature you're describing, I would have multiple projects open, yes?
11:20lpetityes
11:20jkkramerlrenn: cool. are you the creator of kaya.gs? I hadn't heard of it
11:21lrennjkkramer: no :) I'm just very excited for it and I know a few clojure folks got introduced to go via rhickey.
11:21kryftWow, I didn't know rhickey played go
11:22kryft(Reminds me that I should start playing again)
11:22jkkramerI was excited when I found out he plays, and is encouraging others to. Clojure and Go are two of my favorite hobbies :)
11:22lpetitjkkramer: is this new fact a game changer for "workspace project dependencies instead of checkouts/" ?
11:22lrennme too :)
11:23jkkramerlpetit: don't think so, no. I was just being lazy by not creating Eclipse projects for the checkouts yet
11:24lpetitjkkramer: ok
11:25lpetitjkkramer: Tom Hickey is working on adding the last missing bits of paredit.el into paredit.clj . He already has barrage / slurpage commands on his own fork. Just waiting for him to ping me when he things it's stable enough.
11:26jkkramerlpetit: that's excellent to hear
11:26lpetitjkkramer: before digging into your editing issues, let's just check your config please: are you in strict mode, or in default mode, for the editor ?
11:27jkkramerlpetit: strict
11:27lpetitjkkramer: you can switch locally from one to another via Alt+D, or definitely change the defaults from the preferences menu
11:27lpetitjkkramer: ok
11:28lpetitjkkramer: I don't understand what you mean by ") and ] being interchangeable" ?
11:28jkkramerlpetit: in emacs, ], ), and } are interchangeable. they all close (or overwrite) whatever closing bracket your cursor is at
11:29jkkramerthinking of an example...
11:30lpetityes please, because I never had the issue for myself, so an example may help understand your "workflow"
11:30jkkramerlpetit: e.g., (foo [bar|]) where | is the cursor. you could type ] twice to end up here: (foo [bar])|. in CCW, you end up with: (foo [bar]]) which is invalid
11:31lpetitjkkramer: I would argue that you could also only type ) once to end up here: (foo [bar])| in ccw
11:31TimMcbleh
11:31jkkramer(foo [bar]]|) rather
11:32jkkramerlpetit: it's possible, it's just more cognitive load to remember which type of closing bracket to use. especially when you're facing a ))])]}) type thing
11:32TimMcI really, really like being able to type ] repeatedly to walk to the end of whatever braces sexp I'm in.
11:33jkkramer(inc TimMc)
11:33lazybot⇒ 16
11:33lpetitjkkramer: let's revisit this once again before I give up :)
11:34lpetitjkkramer: the current behavior in CCW is that when you type ), you jump to the next closing ), when you type ], you jump to the next closing ], when you type }, you jump to the next closing }
11:34lpetitjkkramer: now, you have discovered a corner case when there is no "next" ] or next } or next ), and indeed then the raw char is inserted, which is undesirable.
11:34jcromartieso Light Table is a web app?
11:35jkkramerlpetit: it may be because CCW's way is unfamiliar, but I don't really find that useful. it takes me longer to figure out which type of bracket it to use than it would be to just type ] N times to get to the right place
11:35lrennjcromartie: yes, but it runs locally.
11:35jcromartieyeah
11:36lpetitjkkramer: for instance, if your facing a ))])]}) type thing, with the current CCW behavior, typing just one } would bring you directly after the }, when your suggesting behavior would just bring the cursor after the next ) or ] or }, right ?
11:36TimMclpetit: I guess the question is whether you want to be bug-compatible (in your view) with Emacs paredit. :-)
11:36jkkramerlpetit: right. technically in that case, ccw does it in fewer key strokes, but I would argue it takes me longer because I have to think harder and parse the code myself to decide what to press
11:38jkkramerlpetit: I will make a mental note to record a real-life example when I come across one. having trouble thinking up a good contrived one
11:39lpetitjkkramer: LOL, ok. I'm open to changing my mind. Just need more contrived example indeed :)
11:41jcromartiewhat does LightTable use to display the UI
11:41jkkramerlpetit: it's not a deal breaker by any means. the bigger issues are allowing invalid ] and }, and lack of slurp, which are being addressed.
11:41lpetitjkkramer: indeed, we agree without delay that invalid } and ] should not be inserted. Would you please file an issue for this specific topic?
11:42lrennjcromartie: i believe it's html5 + clojurescript but i'm not positive.
11:42jcromartieyeah but I mean what is rendering it
11:42jcromartieit's some kindof embedded browser
11:42jcromartieJWebPane
11:42jcromartiemaybe?
11:43lpetitjkkramer: please note that I'm writing an answer to your email with all the conclusions we're addressing here, so that other people can follow along.
11:43jkkramerlpetit: issue created
11:43lpetitjkkramer: you're fast. Thx :)
11:46jcromartieI guess I'm not sure what Light Table *is* at this point… is it for building web apps, or building "Light Table apps"
11:46quentin_hi! I set up a bounty on Stack Exchange Code Review for this question: http://codereview.stackexchange.com/q/8270/11227 - the guy (not me) is just asking if the code is idiomatic clojure or not, and if not, what should be changed. anybody willing to give it a try? thanks! (sorry if there's an implicit rule forbidding this)
11:46jcromartiebecause this latest video shows some interactive game inside Light Table and the code is in Clojurescript
11:46jkkramerjcromartie: from what I gather, it's an experiment. real-world value TBD
11:46jcromartieyah
11:47casionjcromartie: it's an IDE… that's it
11:47lpetitjkkramer: bbl (~30 mins.)
11:47jcromartieI guess I'm missing context
11:47jkkramerlpetit: k
11:47metellusjcromartie: it's for any kind of development
11:48casionthe context is the concept behind it, but it is simply an IDE designed with some new concepts (and old concepts that are rarely implemented)
11:48juhu_chapaWhy there is no socket library in https://github.com/clojure? Is a there standard project to do net apps?
11:50jkkramerjuhu_chapa: I think most people use the Java APIs. or specialized libs like clj-http
11:51jcromartieI think the video demo is missing the context of new stuff that's a few steps ahead of the Light Table Playground that's publicly available
11:56juhu_chapajkkramer: I see. Thank you.
11:57mefestoHello everyone. I'm trying to use stencil in my compojure app. I'm using lein-ring for development which reloads my clojure code but the templates don't seem to get reloaded. Anyone know what could be the issue? Seems like it might be how stencil caches templates.
11:58weavejestermefesto: Which Ring version are you using?
11:58mefestoweavejester: 1.1.6
11:59mefestoweavejester: lein-ring 0.7.5
11:59weavejesterThen it's not an out of date Ring version
11:59weavejesterIt could be that stencil uses defonce
12:00jcromartieI've always found code reloading to be iffy
12:00jcromartieI just compile my namespaces from SLIME
12:01weavejesterThe latest Ring versions should be better for code reloading
12:01weavejesterThere were several bugs that have been fixed in that regard
12:02weavejesterI'm pretty sure there's at least one left, but it's rare and I haven't been able to pin it down
12:02weavejesterIt looks like stencil doesn't use defonce
12:02weavejesterSo in theory it should reset the cache when it's reloaded...
12:03weavejesterOh, except...
12:03weavejesterAh, because the *code* hasn't changed for stencil, it doesn't reload the namespace
12:04weavejesterwrap-reload reloads modifed files, and any files that depend on those modifed files
12:04weavejesterBut the cache for stencil is defined in a file that hasn't changed, and whose code does not need to be reloaded.
12:06mefestoI guess I need to find a way to disable caching for development but leave it enabled otherwise
12:06weavejestermefesto: Have you tried using (stencil.loader/set-cache-policy cache-never) ?
12:06mefestoweavejester: no, i'll give that a go now
12:07weavejesterWhere cache-never is also in stencil.loader
12:08LesZedCBhello
12:09weavejesterhi
12:11mefestoweavejester: I'm not finding that function. I'm running stencil 0.3.0
12:13mefestoweavejester: thanks anyway for the help. i'll give it another look after lunch
12:25lpetitjkkramer: back
12:31juhu_chapaWhere can I download full clojure docs?
12:33nDuffjuhu_chapa: If you want something to read offline, I strongly suggest purchasing a book. The docs are... really not that great.
12:34lpetitjkkramer: "new clojure namespace" confusion. What could be done to improve the situation?
12:34paultagAnyone know how I can pass kwargs to clojure-py?
12:35paultagto native bindings in clojurepy*
12:35nDuffjuhu_chapa: ...that said, see the gh-pages branch on github
12:36lpetitjkkramer: idea = always pre-populate the input area with the namespace prefix from where the wizard triggering took place, e.g. you trigger the wizard from src/foo/bar then the input comes pre-populated with "foo.bar.<customize>" and <customize> would be pre-selected so that it is automatically replaced by what the user would type?
12:38juhu_chapanDuff: thank you.
12:38paultagall I see is https://github.com/halgari/clojure-py/blob/master/examples/flask/utils.clj#L6-10 ← and that looks god-forsaken
12:39uvtcpaultag: if you don't get any answers here, I suggest the clojure-py ML/group. I've found them to be pretty responsive.
12:40paultaguvtc: ah, thanks!
12:40hiredmanthat all looks horrible
12:40paultaghiredman: yeah, it really does
12:40paultaghiredman: and I'm a day into Clojure, so that's a bit overwhelming, too
12:40technomancyclojure-py might be a rough place to start
12:40hiredmanpaultag: don't bother with clojure-py
12:41paultagI got the basics with straight clojure, and that's fine
12:41hiredmanclojure-py is junk
12:41paultagbut I was trying to wrap some Python I had sitting around
12:41paultagI figured I'd try to apply it to some $WORK data
12:41hiredmanalthough I am sure others would disgree with me, they are, as per usual, wrong
12:41paultag:)
12:42paultagit gives a horrid message when you forget (ns ..)
12:42paultag(NoneType has no such method rstrip or so)
12:56jkkramerlpetit: sorry for delay, got pulled into a meeting. That sounds like a nice solution. Also nice might be an example with dashes/underscores. FWIW, this was only confusing the first time. Afterwards it was fine
12:57lpetitjkkramer: ok. But really normally you wouldn't have to worry about underscores here, just enter dashes, and it's converted into underscores (I hoped this one was implied by the "new namespace" name)
12:59jkkramerlpetit: it also would be nice if it would create directories for namespace prefixes if they don't exist already. Otherwise, it's "new directory", "new namespace", so there's a potentially-confusing mixture of files/namespaces
12:59jkkramerlpetit: … with attendant dash/underscore confusion
12:59lpetitjkkramer: very true. Can you add this to the issue ? I think I'll do all in one pass
13:00lpetitjkkramer: so thanks to you, I've decided to revisit my agenda for the next thursdays, and work on resolving your feedback-related issues first :)
13:01jkkramerlpetit: wow thanks. glad my feedback could be useful
13:02lpetitjkkramer: beware, since you were in meeting, I hit Enter on my email answer, and lost among what we've already discussed here, is a request for you to open one or to more bugs.
13:02lpetitjkkramer: Since my dashboard is only eventually made of tickets list, it would be a shame if one or two issues were lost in google group's history
13:03lpetitjkkramer: very useful.
13:03lpetitjkkramer, all: must go, cu
13:03jkkramerlpetit: see you. your work on ccw is much appreciated
14:02mpanGuys, have you got any particular recommendation for an introduction to the concurrency features in Clojure?
14:08jcromartiempan: good question
14:13eggsbympan: http://blakesmith.me/2012/05/15/understanding-clojure-concurrency-part-1.html and http://blakesmith.me/2012/05/25/understanding-clojure-concurrency-part-2.html are pretty good writeups
14:14mpanawesome! thanks!
14:15eggsbythe first post is mostly concurrency 101 and not related to clojure too much, the second post goes into clojures concurrency data types/STM
14:15sexpGirlI need to add a "free-floating .jar and decided to use "lein localrepo" for now. I managed to add the .jar using localrepo: I got copied to ~/.m2/repository/... and doing a "lein localrepo list" I can see it listed however whenever I try to add it to project.clj and do "lein deps" it fails (Could not transfer artifact / It's possible the specified jar is not in any repository)
14:17xeqisexpGirl: what is the path in ~/.m2/repository, what is the dependency vector you're using in the project.clj?
14:17sexpGirlnow if I try to add another of the .jar listed by "lein localrepo list", it works fine. So somehow localrepo did create a local repository but "lein deps" cannot find it? (I may be getting the name wrong but I can use other jars fine, so I don't think it's a typo)
14:18sexpGirl@xeqi: for example this works fine in project.clj ":dependencies [[slingshot "0.8.0"]] but this doesn't ":dependencies [[myjar "1.6.0]]"
14:19xeqiis the jar under ~/.m2/repository/myjar/myjar/1.6.0/myjar.jar ?
14:19sexpGirland "lein localrepo list" lists several things, including "slingshot (0.8.0)" and "myjar (1.0.6)" (oops, 1.0.6 I meant above)
14:20thorbjornDXhey, what's the consensus (if any) on clojure-py?
14:20sexpGirl@xeqi: myjar is in ~/.m2/repository/myjar/myjar/1.0.6/... However... It's not "myjar.jar" but "myjar-1.0.6.jar", would that be the error?
14:21xeqisexpGirl: myjar-1.0.6.jar is right, I was typing too fast
14:21paultagthorbjornDX: I just asked
14:21paultagthorbjornDX: 12:36 < hiredman> paultag: don't bother with clojure-py
14:21paultagthorbjornDX: 12:36 < hiredman> clojure-py is junk
14:21sexpGirl@xeqi: no I got it wrong on my first line ; )
14:21sexpGirl@xeqi: oops nevermind, read too fast
14:21thorbjornDXpaultag: ah, gotcha :)
14:22paultagthorbjornDX: the biggest problems i've hit (less then 2 hours in) is it failes to handle a missing (ns) declr, as well as not being able to use kwargs on native bindings
14:22paultagthorbjornDX: well, it can, but you have to setattr on a function and invoke that
14:22thorbjornDXpaultag: ah, sounds messy
14:22sexpGirlone thing different inside ~/.m2/repository/ is that, say, for slingshot I have .sha1, .pom and .pom.sha1 but I don't have these for my local free floating jar
14:22paultagthorbjornDX: 12:34 < paultag> all I see is https://github.com/halgari/clojure-py/blob/master/examples/flask/utils.clj#L6-10 ← and that looks god-forsaken
14:23paultagthorbjornDX: if you find a way around that voodoo, let me know :)
14:23mpanis there a way to say: "when this goes out of scope, run cleanup on that"?
14:24thorbjornDXpaultag: I don't plan on using it right away, I just wanted to experiment w/ it since the interop could be nice (assuming it's implemented well)
14:24paultagthorbjornDX: ack on that
14:24mpani.e. explicitly release some resource when the corresponding something gets GC-ed
14:24technomancympan: GC is nondeterministic, so that ends up not working very well
14:24aperiodicmpan: "goes out of scope" and "gets garbage collected" don't have any temporal locality
14:24xeqisexpGirl: hmm, I'd expect :dependencies [[myjar "1.0.6"]] to work
14:25sexpGirl@xeqi: is there an easy way to "trace" what 'lein deps' does here?
14:26xeqinot really. can you paste the output somewhere?
14:26mpanso if I want a resource released? do it manually and explicitly?
14:26sexpGirl@xeqi: sure... First I've got another question: can lein / Maven work on a user account which has no Internet access?
14:27xeqiset `:offline true`, and it will only grab from the ~/.m2 cache
14:27aperiodicmpan: whenever i've tried anything besides that, it just lead to pain
14:27sexpGirlI mean: it seems to be working fine "offline" with all the other .jars, but not with "myjar".
14:28aperiodicmpan: you can implement closeable, do your cleanup in .close, and then use the with-open macro, which gets rid of the boilerplate
14:28mpanok thanks!
14:28mpanthank you all
14:29xeqithats cause they are found in the ~/.m2 cache, but the myjar one isn't. nothing specific to offline there
14:32sexpGirl@xeqi: I see... (preparing the paste) but... "lein localrepo list" shows myjar though
14:33xeqiI'm guessing theres a mismatch between whats in the ~/.m2 cache and the dependency vector in the project.clj, but without a project.clj or a error saying what is actually being looked for its hard to say
14:38sexpGirl@xeqi: here's the entire process: http://pastebin.com/XZxmwUun (I create the local repo, then list it, then lein deps without the dep, then add it and re 'lein deps' and there's the error message)
14:39shaungilchristso I wanted a way to work w/ datomic queries - just wondering if there is a better/simpler way of doing this https://gist.github.com/3795605
14:44sexpGirl@xeqi: could the lack of a .pom in the ~/.m2/repository/myjar/myjar/1.0.6/ be causing the issue ?
14:46xeqisexpGirl: it would cause it to go out and look for it in a repo, but I would have expected it not to care about not finding one
14:47sexpGirl@xeqi: could it be that he wouldn't care about not finding one, but that he's upset that he cannot even contact the repo? (because there's no Internet access?) [I'll check this out ASAP]
14:48sexpGirlbtw... There's no way lein / Maven would be going to automatically *upload* a private .jar in a public Internet repository right !?
14:48xeqilein shouldn't
14:49xeqilooks like theres some work being done on pom generation https://github.com/kumarshantanu/lein-localrepo/pull/3
14:49hiredmandepends what you mean by "upload" "public internet repository" and "private jar"
14:49xeqibut that it should work without it, but would produce the download messages
14:53sexpGirl@hiredman: by "private jar" I mean a .jar containing company/proprietary information that shouldn't end up on the big bad Internet ; )
14:55cvkem_clojure.core/reduce seems to return non-lazy sequences. Is this correct? If so, why is it non-lazy?
14:55chouserreduce must be non-lazy
14:56cvkem_For what reason? A lazy version would be usefull, for me at least.
14:56jkkramer_cvkem_: see reductions
14:56technomancyreduce doesn't operate in terms of seqs
14:57technomancyseqs are the only thing that can be lazy in clojure
14:57technomancyreduce can only be lazy in a language like Haskell
14:57sexpGirltechnomancy: btw thanks for clojure-mode
14:58technomancysexpGirl: oh, I didn't write that
14:59technomancyI just merge pull requests for it
14:59cvkem_Trying to understand Haskell, but haven't come far enough yet to understand why haskell can and clojure can't
14:59technomancycvkem_: all values in Haskell are lazy
15:01cvkem_technomancy, what is my best option to process an (possibly infinite) sequence, where an element on the input can produce multiple elements at the output?
15:01technomancy(apply concat (map ...)) probably?
15:03cvkem_technomancy: oke, I did not know apply was lazy. But as it is this sounds good.
15:03technomancyapply inherits the laziness of its argument
15:04cvkem_sounds logical .
15:05cvkem_technomancy: thanks
15:10sexpGirlIs it possible to have lein and be able to do "lein deps"
15:10sexpGirlsorry
15:11sexpGirlIs it possible to have lein installed (lein deps works etc.), to do nrepl-jack-in etc. *without* having Maven? Is it possible that I miss Maven on my system? (I don't find the 'mvn' command)
15:13technomancysure, mvn hasn't been needed since leiningen 1.1.0
15:14sexpGirl@technomany: but a maven.jar is needed or does lein do everything that Maven does?
15:14TimMctechnomancy: ...but if mvn is on your classpath, it gets used.
15:14sexpGirls/technomany/technomancy/
15:16sexpGirl"apt-get install maven", 145 newly installed, 261 MB of additional disk space will be used <-- geez!
15:17lpetitsexpGirl: no maven.jar is needed.
15:18sexpGirl@lpetit: ok, thanks
15:18lpetitsexpGirl: how did you install leiningen? Which version ?
15:19abaloneare there any reasons to use (take 1 ...) instead of (first ...) ?
15:21emezeskeabalone: (take 1) returns a lazy sequence, so it doesn't necessarily realize the first element
15:21emezeskeabalone: (first) returns the element itself, thus necessarily realizing it
15:21abaloneemezeske: thanks!
15:23sexpGirl@lpetit: Leiningen 2.0.0-preview10 ran the shell script which did install everything. Note that everything seems to work fine: I did create a project, I can run "lein deps" from a shell, I can "nrepj-jack-in" from Emacs etc. It's only once I start to add a free-floating .jar that I enter a world or hurt :-/
15:24lpetitsexpGirl: "add a free floating .jar". Can you explain (repeat?) how you actually added this free-floating .jar ?
15:24scriptorsexpGirl: side note, you don't have to prefix nicks with an @, also most irc clients let you autocomplete nicks by hitting tab
15:26sexpGirl@lpetit: sure, I did use "lein localrepo", here's a quick summary of what work and what doesn't: http://pastebin.com/XZxmwUun
15:26Moses_Anyone here use lein-cucumber? I've been trying to get it working for 2 days, seems a bit quirky. I wonder if I'm doing something horribly wrong.
15:27sexpGirllpetit: (oops, got the <tab> this time ; ) basically lein localrepo seems to work, it does create the ~/.m2/ repo, it does list myjar when I do "lein localrepo list" but as soon as I had the dep into project.clj "lein deps" fails (and hence my nrepl-jack-in fails)
15:30lpetitsexpGirl: having lein deps not working after a lein-localrepo call seems consistent with what the "Free-Floating Jars" section of https://github.com/technomancy/leiningen/wiki/Repeatability is saying
15:30beberleihi, could someone hint me why http://pastie.org/4831277 still produces "Exception: org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of clojure.lang.MapEntry. Use setObject() with an explicit Types value to specify the type to use." in the [(cast. ] line?
15:31lpetitsexpGirl: meaning, it's like you're out of luck if you don't publish it on the evil Internet, or an internal Nexus / Archiva server, or a private s3 bucket
15:32lpetitsexpGirl: I can imagine you can somehow add a :repositories key to your :user profile, tho I don't know what kind of undesired side effect this may have
15:34sexpGirllpetit: damn... That's where I start to question if tying "Maven-the-kitchen-sink" to the lein was really that great. I mean, sure, Maven decided it was better to not commit .jar to your (D)VCS but we've always been doing exactly that and we have 100% deterministic and reproducible builds and 0% of Maven here :(
15:36sexpGirlbut oh well... private S3 bucket it may be then (I'll still try a few other things first). One more thing to do on my TODO list ; )
15:38beberleifixed it myself
15:38lpetitsexpGirl: sorry, I think I've seen answers to this elsewhere, but don't remember. Good luck
15:40Moses_What testing engine should I be using with Clojure? I've been trying lein-cucumber, but that seems impossible to get working. Is there something else out there that's more widely accepted by the community?
15:40RaynessexpGirl: Everyone ever decided committing binaries to something like git is terrible. What happens when you change update those jars to new versions over time? With even small jars, the repository will eventually grow unreasonably large.
15:41hiredmanclojure.test is what we use at work, and it is what comes with clojure
15:41hiredmanand clojure.test tests are what lein's built in testing stuff runs
15:43Moses_Thanks hiredman, I'll just use that.
15:44sexpGirl@Raynes: it works fine for us, medium codebase, around 300KLOC. I'm just a bit bitter that Maven if forced down anyone's throat who want to do 'serious' Clojure work (not everyone agrees that Maven is great, far from it). But if it's what has been decided, then so be it and I'll learn it ; (
15:44hiredmanlein is not maven
15:44hiredmanit uses the same dependency resolution stuff, but that is it
15:46emezeskesexpGirl: Why do you commit the jars to version control, though, as opposed to just tagging your releases and having a top-level build target that recreates all of the jars?
15:46hiredmanif you have a team project, I strongly recommend setting up something like archiva over messing with lein-localrepo
15:46RaynessexpGirl: Can you paste the contents of ~/.m2/repository/myjar/myjar/1.0.6/myjar-1.0.6.pom ?
15:47hiredmando not check in jars
15:47sexpGirl@Raynes: that's the thing: there's no pom, so I'm manually creating one : )
15:47ivanjars in version control = free stabbing
15:47RaynesAlso, 300KLOC is a medium codebase? I just caught that one. Wow. I've been writing Clojure for too long. I've never even seen 300 lines of code.
15:48Raynes300k lines of code*
15:48emezeskeRaynes: I'd actually call 300k small-to-medium
15:49sexpGirl@Raynes: that is one the reason I'm learning Clojure ; )
15:49emezeskeRaynes: In the corporate world, at least
15:49RaynesIn what language?
15:49mefestoprobably java/spring/hibernate/xml hell
15:49mefestoor javaee
15:49hfaafb300k is small coming up on medium?
15:50sexpGirl@hfaafb: in Java Spring / hibernate / XML hell I'd say it's about between small and medium but closer to medium ; )
15:51Hodapphmm, let's see how many lines of C++ I have here
15:53RaynesI should write a script to count the lines of all of flatland's projects.
15:54RaynesI'd be surprised if they passed 10k together.
15:54sexpGirlfind . -iname "*clj" -exec cat {} \; | wc -l
15:54sexpGirl; )
15:54Hodappbash-4.1$ find | egrep "\.(cpp|h)$" | while read N; do cat "$N"; done | wc -l
15:54Hodapp591917
15:54RaynesI'm doubtful they'd even near it.
15:54hfaafb591k
15:54Hodapp710671 if I add in .c, .java
15:54hfaafbwhat does that program do
15:55Hodappnot much
15:55Hodappit's "Enterprise"(tm)(c)(r)
15:56Hodappand let's be honest, it's C++, so about 560K of that 591K is just there as scaffolding for the 31K
15:56RaynesHah
15:56paultagnot like java
16:00sexpGirlOK I'm making progress... I wrote a .pom and now I can nrepl-jack-in and at the REPL I can see my jar if I do, say: (println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))
16:09jcromartieif you want to count lines of code, go get cloc
16:09jcromartiehttp://cloc.sourceforge.net/
16:10jcromartieI use it all the time
16:10jcromartie:) like when comparing the initial Java version of this API to the Clojure version (1500 -> 150)
16:12Amarylthanks for the tip!
16:17aaelonywhat's an idiomatic way to take 2 structures (each is a vector of maps) and join / merge them by common key? https://www.refheap.com/paste/5342
16:18Moses_Does this sound like a lein problem? http://pastie.org/4831468
16:21jcromartie,(map merge [{:a :foo} {:a :bar}] [{:b :bat} {:b :baz}])
16:21clojurebot({:b :bat, :a :foo} {:b :baz, :a :bar})
16:21tos9aaelony: (map into s1 s2) Seems like a thing. No idea if there's something even more obvious.
16:21jcromartiemap into or map merge
16:21technomancyMoses_: which lein version is that?
16:21Raynesaaelony: (map merge s1 s2)
16:21jcromartiemerge-with for more control
16:21hiredmanMoses_: it is a problem with your user.clj
16:21Moses_Leiningen 2.0.0-preview10 on Java 1.6.0_24 OpenJDK Client VM
16:21aaelonyjcromartie & tos9 thanks, I need to learn this!
16:22xeqiMoses_: looks like a lein-cucumber problem; https://github.com/nilswloka/lein-cucumber/blob/master/project.clj requires [leiningen-core "2.0.0-preview3"] for some reason
16:22Moses_user.clj is not a part of my project =\
16:22technomancyMoses_: if you are just getting started with the language I would strongly suggest using clojure.test instead of cucumber
16:22hiredmanException in thread "main" java.lang.Exception: Too many arguments to def (user.clj:14)
16:22hiredmanthat tells you on which line to look
16:22technomancyhiredman: probably leiningen.core.user
16:22aaelonyraynes, thanks too
16:22Moses_Okie dokey, thanks everyone
16:23pandeirowhat is the equivalent to the :dev dependencies in lein2?
16:23xeqi:profiles {:dev {:dependencies ....}}
16:25pandeiroxeqi: thanks
17:01RaynesJose Valim on twitter: "@IORayne everyone here knows you! You should come next year :) and tks for talking about elixir to others !"
17:01Raynestechnomancy: I bet you spent the whole time there talking about me and how fantastic I am.
17:02technomancydude I opened up mix and I saw task chaining via the `do` task and it warmed my icy heart
17:02technomancyI think I told him to add proper alias support, but I don't think that's happened yet
17:07CheironHi, I installed clojure-vim but what do i need to know about it (i'm familiar with vi) ?
17:07aperiodicwhat is clojure-vim? pretty much everybody uses vimclojure and/or slimv
17:08Cheironyes sorry, i mean vimclojure
17:08Cheironmy bad
17:08emezeskeCheiron: ":help vimclojure"
17:09SegFaultAXIsn't running :help foo the first thing anyone does after installing something in vim?
17:09emezeskeSegFaultAX: Apparently not.
17:10Cheironi'm getting E149: Sorry, no help for vimclojure
17:10scriptorisn't there a readme?
17:10Cheironyes should be. thanks for help all
17:11SegFaultAXSounds like you either didn't install it correctly or you haven't built the helptags.
17:11thorbjornDXCheiron: how did you install it? using pathogen?
17:12Cheironno, extracting the zip and move it by hand
17:12SegFaultAXCheiron: Run helptags on it then.
17:12Cheironoki, thank you
17:13antoineB_hello
17:14SegFaultAXantoineB_: Hallo.
17:15antoineB_assuming i have a (java) function that use CharSequence[] or a ByteBuffer, can i pass to it clojure object?
17:15antoineB_in other word need i convert so seq into a java Object?
17:16antoineB_*convert a seq
17:17emezeskeantoineB_: Is this related? http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/to-array
17:18hiredmanseqs are java objects
17:18SegFaultAXClojure objects /are/ java objects.
17:19mindbender1emezeske: how can I get rid of this error: ERROR: JSC_MISSING_PROVIDE_ERROR. required "goog.dom.query" namespace never provided
17:20mindbender1I'm trying to compile domina and I'm getting the error
17:20antoineB_emezeske: i think it should do the trick
17:20antoineB_thanks
17:20emezeskemindbender1: I guess probably by providing goog.dom.query
17:20antoineB_so if seqs are java object, what they inherit from?
17:20hiredmandepends on the seq
17:21SegFaultAXantoineB_: Let me be more specific: everything in Clojure is just Java.
17:21hiredman,(supers (class ()))
17:21clojurebot#{clojure.lang.IMeta java.lang.Iterable clojure.lang.ISeq clojure.lang.IPersistentCollection java.util.Collection ...}
17:21emezeskemindbender1: What version of domina/lein-cljsbuild?
17:21hiredman,(supers (class []))
17:21clojurebot#{clojure.lang.IMeta java.lang.Iterable clojure.lang.IPersistentCollection clojure.lang.IFn java.lang.Comparable ...}
17:21emezeskemindbender1: I think if you're using the latest versions of each that should not happen
17:21hiredman,(supers (class #{}))
17:21clojurebot#{clojure.lang.IMeta java.lang.Iterable clojure.lang.IPersistentCollection clojure.lang.IFn java.util.Collection ...}
17:21antoineB_ok
17:21hiredmanetc
17:21mindbender1emezeske: ok let me make sure
17:23antoineB_thanks
17:23SegFaultAXWhy is it that I enjoy porting bits of Clojure to Lua so much?
17:24RaynesDo you also enjoy cutting yourself and bdsm?
17:24RaynesIf so, you might be a masochist.
17:24SegFaultAXRaynes: Why do you say that?
17:24ivanI hear some ClojureScript thing can emit Lua
17:24SegFaultAXRaynes: Not a fan of Lua?
17:24RaynesBecause this is #clojure and I need to be biased.
17:25RaynesPort bits of Lua to Clojure instead. More fun.
17:25SegFaultAXRaynes: There's nothing to port. I can't think of a single Lua feature that Clojure doesn't already have or support.
17:28technomancy1-based vectors?
17:28technomancythat may have been below the belt =)
17:28SegFaultAXtechnomancy: That's a misfeature of Lua.
17:29technomancydon't know if you'll find anyone disagreeing within a few netsplits of this channel
17:31jcromartieoh boy Clojure and Lua :)
17:31jcromartieI spent 6 months doing Lua full-time
17:31jcromartieI loved it before that...
17:32casionI did some renoise stuff in Lua… that's why I ended up trying clojure again. My hate of developing stuff in lua
17:32jcromartiebut this system twisted and abused it beyond belief….
17:32casionit grew to a substantial and unreasonable size
17:32SegFaultAXI not a big fan of the "Everything is a Table. Everything. (Except numbers, strings, threads, functions, userdata, booleans, and nil)
17:32SegFaultAX"
17:33jcromartieI think it's more that the only collection type is the table
17:33jcromartieif you don't count strings
17:33SegFaultAXjcromartie: Exactly.
17:34jcromartiebut I've had pleasant experiences in Lua
17:34SegFaultAXjcromartie: Js suffers from the same problem. At least it pretends to have Arrays (not really, though). Maybe it's symptomatic of all prototypical languages? I don't know.
17:35jcromartieyeah, I think I see Lua as a slightly more pure JS
17:37SegFaultAXjcromartie: I think if they added an array-type collection to Lua, I would be infinitely happy. The ugliness of the standard library because tables can be used as arrays or maps bothers me. Plus it would make functional programming in Lua a bit nicer.
17:37jcromartieiterating over different kinds of collections using the same few higher-order functions sounds familiar :)
17:38jcromartiebut yeah
17:42SegFaultAXjcromartie: Upon further reflection, I also think some sort of tuple type would be a fantastic addition. Or a collection that can actually be used as a key in a map.
17:42jcromartieyou can't use a table as a key? it's been a while
17:43SegFaultAXjcromartie: Sure you can. But the implementation uses the pointer as the key internally.
17:43SegFaultAXjcromartie: Which means to index that key, it has to be the /exact same object/.
17:43jcromartieyeah, not the value
17:45SegFaultAXjcromartie: Not having hashable tables makes sets very hard to implement.
17:45SegFaultAXjcromartie: So some other hashable collection could be introduced.
17:50gjcourtsay I do a (ns foo (:require [clojure.tool.logging :as logging]) (pringln logging))
17:50hiredmanwon't work
17:50gjcourtright, is there any way that will work?
17:50hiredman(the compiler will spit out an error)
17:51gjcourti get this ompilerException java.lang.RuntimeException: Unable to resolve symbol: logger in this context,
17:51hiredmangjcourt: how about you just ask how to do what you want to do, instead of asking how to make your half solution work
17:52gjcourtok, i want to import clojure.tools.logging into a namespace and then use functions from logging as if it were in that namespace
17:53gfredericks(ns foo (:require [clojure.tools.logging :refer [the functions I want to use]]))
17:53hiredmanare you saying you want to re-export the functions?
17:53SegFaultAXgjcourt: Also, http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
17:53SegFaultAXgjcourt: That's the best article I've found for learning how require/import/use/refer work.
17:54SegFaultAXgjcourt: Including the nice shorthand syntax that the ns form provides.
17:54gjcourtthanks for the resouces guys :]
17:57gjcourthiredman: ideally i could re-export then, yes
17:57hiredmangjcourt: is that your end goal?
17:58gjcourti would like to be able to (use 'foo) (info "hello world")
17:58gjcourtwhere foo exports the info of clojure.tools.logging after setting up log4jk
18:00hiredmanwhy?
18:00clojurebotwhy not?
18:01hiredmanwhat problem doesn that solve that using tools.logging directly doesn't?
18:01gjcourthiredman ideally i'd use http://www.paullegato.com/blog/log4j-clojure/ and the clj-logging-config library, but i need a custom appender and I'm not sure if clj-logging-config will allow me to config https://github.com/kencochrane/raven-java
18:02hiredmangjcourt: is that really an answer to my question?
18:02gjcourtexporting functions into my namespace is what it's not doing for me
18:03hiredmanyou have some code you want to run that configures the logger, and you have some code that logs
18:04Moses_Anyone know of a good example of doing model testing in clojure web apps? I'm trying to figure out how I should write my database backed model such that its easy to test.
18:04hiredmanconfiguring logging and logging are two different things, so why not have a namespace that configures logging then you load it, and then just use clojure.tools.logging directly
18:04gjcourtand ideally that would all be owned in a "logging" namespace from withing my project so that I only have to do it once
18:04gjcourthiredman i could do that
18:05gjcourtin fact it's what I'm doing, albeit not working atm because of some log4j wonkiness i don't understand, but yes
18:05hiredmangjcourt: have you considered just using log4j.properties? it is nice declarative logging config, which clj-logging-config is not
18:05gjcourti have a log4j.properties
18:05hiredmanand you need further config?
18:06gjcourthiredman: http://dl.dropbox.com/u/2110/Screenshots/0i2.png
18:06gjcourtim wondering why the appended isn't doing what it's supposed to be doing... and how i could be mis-configuring it
18:06gjcourtappender*
18:15casionis there any decent modern source of info on dealing with XML in clojure? almost everything I'm finding is out of date
18:18hyPiRioncasion: http://clojuredocs.org/clojure_core/clojure.xml
18:18hyPiRionIs that what you're after?
18:19casionhyPiRion: I've been trying to use clojure.xml and I'm not getting very far
18:19casionI need to parse, diff, mutate and write a large xml file
18:20brehautcasion: do you know about clojure.data.xml ?
18:20mindbender1emezeske: which cljsc does cljsbuild use when compiling clojurescript. Is there a place where I can get extensive documentation on how to configure the behavior and environment for cljsbuild
18:20hyPiRionooo
18:20casionbrehaut: no I do not
18:20hyPiRion(nevermind that, I'm cleaning my keyboard)
18:21brehautcasion: https://github.com/clojure/data.xml
18:21casionbrehaut: thank you!
18:21dnolenmindbender1: the cljs compiler doesn't offer much more than what lein-cljsbuild provides. but no there's not a really a good reference atm beyond the source.
18:22brehautcasion: its not a panacea, and is i think a WIP, but its better than just clojure.xml by itself. i also use data.zip with it from memory
18:22mindbender1dnolen: I especially need to let cljsbuild know that goog.dom.query was provided by goog/dojo/dom/query.js, how can I do that
18:23mindbender1I have tried passing the libs option
18:23casionbrehaut: I've been trying to mess around with data.zip, but I'm having trouble wrapping my head around mutating things once I've hit the element I need
18:24brehautcasion: im trying to find an example of using it myself
18:24brehauti also find it a wee bit of a mind bender
18:25brehautcasion: i cant claim this is a good example, but https://github.com/brehaut/necessary-evil/blob/master/src/necessary_evil/value.clj
18:25brehautcasion: looks like im using clojure.zip, clojure.xml, clojure.data.zip and clojure.data.zip.xml but not data.xml ?
18:25dnolenmindbender1: that's definitely a question for emezeske
18:26brehautcasion: so that shows how much i know sorry :(
18:26casionbrehaut: I think you're making things worse lol :)
18:26brehautyup
18:26brehautvery sorry
18:26mindbender1emezeske: come to my rescue
18:27casionbrehaut: data.xml is a good re-start for me though, I think I can work with this
18:27brehautphew. good luck
18:27casionyou know, besides rewriting a day's worth of work
18:27brehaut:/
18:28Cheironhi, vimclojure doc, section Omni completion . <C-X><C-O> i tried command-x and ctrl+x but nothing happened. what I'm missing?
18:28mindbender1cljsbuild source is actually a beast of a source
18:29brehautcasion: i dont know how they interact with data.xml but xml-> and xml1-> from data.zip.xml are really useful for walking stupid xml verbosity (such as you find in xml-rpc)
18:29emezeskemindbender1: I don't think you need to do anything special to use query.js, as long as it's on the classpath
18:29sexpGirlooooh that is so sweet: our old (fatty) internal desktop Java apps have a custom way to add jars to the classpath dynamically at runtime (don't ask me why: not my call and it's been working fine since years and years) but... The nice stuff is I can call that method from Clojure's REPL (nrepl / nrepl.el under Emacs) and all our jars are dynamically added to the classpath. Me happy : )
18:29mindbender1emezeske: how do i get it on the path is my problem.. goog third party provides it
18:30emezeskemindbender1: Use the latest domina,?
18:30mindbender1yes
18:30emezeskeThat should be all AFAIK
18:31casionbrehaut: I'm getting so confused between clojure.zip, clojure.data.zip, clojure.xml, clojure.data.zip, clojure.data.xml, clojure.data.zip.xml
18:31brehautyeah :/
18:31emezeskemindbender1: https://github.com/levand/domina/blob/master/project.clj
18:31emezeskemindbender1: Domina depends on the third-party stuff.
18:31casionI would think someone has to have figured this out in the cljs world?
18:31emezeskemindbender1: If you're having problems, I think probably you need to talk to someone who knows about domina
18:32emezeskemindbender1: You are using domina "1.0.1-SNAPSHOT" ?
18:32mindbender1emezeske: ok thanks I'll try
18:32mindbender1yes
18:32emezeskemindbender1: Oh, wait, I have a thought
18:32emezeskemindbender1: Domina has the third-party lib as a dev dependency
18:33emezeskemindbender1: Are you using the dev profile?
18:33mindbender1yes
18:33mindbender1no
18:33emezeskeTry that.
18:33TimMchyPiRion: Locking screensavers are pretty much the best thing for when you nee to clean your keyboard.
18:36casionit seems like data.zip.xml is the most reasonable option for parsing and data.xmp for writing
18:36casionxml*
18:40mindbender1emezeske: yay!
18:41mindbender1how could I not have thought about that..thanks o much
18:41emezeskemindbender1: Glad to hear you got it working. Suggestion: fix the Domina docs!
18:42emezeskeThey should definitely mention that.
18:42mindbender1emezeske: ok will do
18:47hyPiRionTimMc: I'll keep that in mind.
18:48technomancyhttps://github.com/heroku/pulse/blob/master/src/pulse/emitter.clj#L31 <- is there ever a way this would make sense?
18:48technomancy(take-last (count @some-seq) @some-seq)
18:48technomancyo_O
18:49hiredmantechnomancy: take-last, not take
18:49metellussome-seq could change between the count and the take-last
18:50metellusit's not wrapped up in a dosync
18:50technomancyhiredman: I mean if N is the size of the seq, take is take-last, right?
18:50technomancymetellus: yeah, but take here is essentially identity, which is easy to do atomically =)
18:52metellusthey do a lot more inside that let though, and it's all dependent on the value of (count @stats-buff-a)
18:53technomancysure, but if you deref the seq first, then count that, it'd be guaranteed to be consistent
18:53metellusthey also need to drop-last, but yes
18:53metellusI agree that they could and probably should do it that wya
18:53metellusway
18:54sexpGirlat the repl, is there a way to get a handle to the last object returned (from the last repl call)?
18:54sexpGirlSay I just created a JFrame and I'd like to close it, can I "get" it?
18:55hiredmanyou have *1, *2 and *3
18:55mindbender1technomancy: how can I get lein2 install task to install to local .m2 repo rather than just writing the jar to the taget dir
18:55technomancymindbender1: I don't understand
18:56sexpGirl@hiredman: thanks, works fine
18:57mindbender1technomancy: oh sorry I think that's because cljsbuild hooked into the install task so the jar was written to the target dir
18:59emezeskemindbender1: lein-cljsbuild doesn't hook into install
18:59mindbender1emezeske: it does
18:59emezeskehttps://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild.clj#L239
18:59emezeskeIt doesn't
18:59emezeskeIt might hook some other task that gets invoked during install
19:01sexpGirlso if there's *1, *2 and *3, when is an object returned by the REPL eligible for GC? (it's just out of curiosity)
19:02mindbender1when I first ran lein install in the domina root it triggered cljsbuild maybe the install task triggers the compile task
19:02emezeskeI'm pretty sure it does.
19:03emezeskeAnyway, I'm not sure what lein-cljsbuild has to do with .m2 repos or jars in target dirs
19:05mindbender1emezeske: I wanted the domina jar to be installed in my local .m2 repo
19:05mindbender1so that lein can pull it in from there
19:06emezeskeBut... what does that have to do with lein-cljsbuild ?
19:07mindbender1emezeske: nothing.. I thought it was a problem with lein to see the jar get written to the target dir
19:07emezeskeI see.
19:07mindbender1but that's because it has hands off to cljsbuild
19:08mindbender1which I suspect wrote the jar to target dir
19:08aperiodicmindbender1: lein wrote the jar to the target dir. you need to have a jar to install, so it makes it, and it has to put it somewhere before it installs it, so it goes in the target dir.
19:09mindbender1aperiodic: what happens afterwards.. do I go to the target dir and invoke lein install again
19:09aperiodicmindbender1: no. the jar has been installed. you don't need to do anything.
19:10aperiodicmindbender1: i don't know why seeing the jar in the target dir is throwing you for such a loop
19:11technomancysexpGirl: *1, *2, and *3 are all references that would prevent GC, if that's what you mean
19:12mindbender1aperiodic: because i actually thought it hadn't and maybe that I have to manually use mvn to install it
19:12aperiodicmindbender1: lein is awesome. trust it. ;)
19:12mindbender1sure
19:12aperiodicmindbender1: if you're really worried about that, though, you could just look in your ~/.m2
19:12mindbender1i did
19:12mindbender1it's there
19:21mpan,'&
19:21clojurebot&
19:21lazybotjava.lang.RuntimeException: EOF while reading
19:23mpanit's just a regular symbol, right? just that fn and the like treat it specially?
19:32holohi
19:33SrPxHow do I slice a collection? [1 2 3 4 5] to [2 3]
19:34TimMcmpan: Yes, the destructuring macro captures it. You can in fact (def & 5).
19:34TimMcSrPx: subvec on vectors if you don't mind that it keeps a reference to the original vector.
19:36TimMcsexpGirl: GC on a REPL return value can't happen until the value is a few lines back.
19:37SrPxIt keeps a reference? How?
19:38hiredmantrees
19:38holoi installed lein-heroku by putting :plugins [lein-heroku "0.1.1"] in project.clj. with lein deps it downloaded the file, but when i do `lein heroku help`, lein says: heroku is not a task. Use "lein help" to list all tasks. what's going bad?
19:40technomancyholo: that plugin is pretty old; I'd recommend using the toolbelt instead
19:40technomancythe JVM boot time is too annoying anyway
19:40technomancyfor it to be a pleasant experience
19:42TimMcSrPx: subvec just modifies the index you give it and passes it through to the underlying vector.
19:43SrPxIs it any bad? TimMc
19:43TimMcs/you give it/you give the resulting vector-like get method/
19:43FrozenlockThe google closure library offers a function to encode in base64, but accept an argument to make it 'websafe' and use an alternate alphabet. Does it mean that browsers won't accept some characters normally used in the typical base64? http://closure-library.googlecode.com/svn/docs/closure_goog_crypt_base64.js.html
19:44TimMcSrPx: It's only bad if the original vec is huge (or you do this in a big loop) and you don
19:44TimMc't let go of the subvec for a while.
19:46SrPxIs there an alternative ?
19:46SrPxHm nvm,
19:46holotechnomancy, i read a previous irc conversation with your intention to give up on this. i thought the development continued anyway, as there is a commit of about 16 days. i think besides those reasons, to have a git integrated, hands-off heroku tools installation is something desirable
19:46technomancyholo: the template is still maintained, and for the time being it's in the same repository
19:47technomancyhow do you mean git-integrated?
19:48SrPxif I have a function 'shift' that rotates a vector 1 step right, and I want to rotate it n steps right, how do I do it? (what-goes-here n (shift my-vector))
19:48holotechnomancy, i mean self contained
19:48technomancyyou mean something that can be declared in project.clj?
19:49holotechnomancy, yes, distributed as code, and then installed automatically inside the same repo
19:49technomancyyeah, there are pros and cons
19:50technomancythe major drawback is that it will always be lagging behind the canonical implementation and will only ever implement a pretty small subset of the commands
19:50SrPxwow, technomancy here ...
19:53technomancyI'm always here
19:54SrPxThat's awkward.
19:54Frozenlocktechnomancy in #clojure is like the sun's rising each morning, except it's even more certain.
19:54SrPxSuddenly I feel like I'm around the people who run the world.
19:55SrPxAnyway, what is the right way to do this, again? (dotimes [x n] (last (do-something my-vec))) I know this is too verbose, I just want to apply do-something to my vector n times and return the result
19:56aperiodic(nth (iterate do-something my-vec) n)
19:56technomancydotimes is for side-effects
19:56SrPxHmm lmgt
19:59SrPxThats fine, thanks
20:13daleI've got a map of objects from a Java library in an atom. I'm writing a function that does "find new object or create new and store it in the map." The catch is that creating the object has side-effects. What's the best way to do that? Right now I'm doing (locking the-map-of-objects ...find or create...).
20:14daleI'm not sure if it's advisable to grab the guard on a Clojure map instance? Would it be better to do something like compare-and-set the key in the map to my thread ID, and then only create and store the object if compare-and-set actually set?
20:14hiredmanlocking an immutable map is ridiculous
20:15hiredmane.g. any "change" is a new map, so your lock does nothing
20:15hiredmanso you need to lock something else
20:15daleDuh, yes, thanks.
20:15daleAs it turns out I'm actually locking the atom that contains the map, sorry.
20:16daleSo change my above comment to read "I'm not sure if it's advisable to grab the guard on an atom." I don't know if Clojure does that itself. Really I just need any object I can lock so I can serialize the operations.
20:16hiredmandale: you may consider just using the contrib cache stuff
20:17hiredmandale: https://github.com/clojure/core.cache
20:20dalehiredman: OK, thanks, reading that now.
20:21hiredman(I am assuming you are making a cache or something similar)
20:22daleIt's really not a cache. I'm working on a XMPP bot, so it's a collection of rooms the bot is in.
20:22hiredmanseems pretty straight forward
20:22hiredman(swap! a conj (get-room-name))
20:23CheironHi, what does this error mean: CompilerException java.lang.IllegalArgumentException: No matching ctor found for class
20:23hiredmanctor means constructor
20:24chouserIt means your parameter count or types are incorrect
20:24Cheironi'm trying to call SpoutConfig from clojure https://github.com/nathanmarz/storm-contrib/blob/master/storm-kafka/src/jvm/storm/kafka/SpoutConfig.java
20:25Cheironfor the first parameter I did: (java.util.ArrayList. ["localhost"]) and for the second: number-of-partitions (int 7)
20:25Cheironthe remaining three are strings
20:26dalehiredman: I've got a map of room names to MultiUserChat instances, which are objects you use to interact with the room. So my current code does (swap! rooms assoc room-name multi-user-chat-obj).
20:26hiredmandale: I would not recommend keeping mutable stateful objects inside clojure reference types
20:26hiredmanwell, maybe an agent
20:27Cheironhere is http://pastie.org/4832604
20:28hiredmandale: consider just keeping string names and recreating the muc objects as required, or keeping strings + a memoized string->muc function
20:28dalehiredman: I thought about using an agent, but that felt a bit like overkill. Plus the "asynchronicity" of that gets in the way of the API I'm trying to develop a bit. I could do that, though.
20:28aperiodicCheiron: gotta put the (int number-of-partition) in the ctor special form
20:28aperiodicCheiron: otherwise it's a long
20:29dalehiredman: Can you give me the gist of the problem with keeping some library's stateful/mutable objects in a Clojure map?
20:29Cheironaperiodic: sorry but i'm not following you, I already calling (int) on number-of-partitions
20:30aperiodicCheiron: by the time it gets to the ctor, it's a long.
20:30Cheironaperiodic: ? why?
20:31hiredmandale: functions applied to refs or atoms can be run multiple times, so something like (swap! a (fn [x] (.someMethod (:blah x)))) can result in calling .someMethod multiple times
20:31dalehiredman: A memoized string->muc function would seem to be the same thing I'm proposing, looking at the source for (memoize). It looks like it just makes an atom with a map. It also wouldn't prevent me from accidentally creating two MultiUserChat instances for the same room if two requests to join came in at the same time.
20:31hiredmandale: the clojure reference types are designed to provide indentities over values
20:32Cheironaperiodic : this (SpoutConfig. kafka-brokers (int number-of-partitions) docs-jobs-topic zk-root consumer-id) still issues the same error
20:33hiredmanCheiron: make sure the code you are looking at in github matches the version of the library you are running against
20:33aperiodicCheiron: hmm... I can't reproduce this now, but i feel like i've run into that before
20:33aperiodicCheiron: ignore me
20:35Cheironhiredman: other possible diagnoses?
20:35hiredmanCheiron: the code you are actually running (whatever version of the library you pulled in) is not the same as what is on the master branch in github
20:36hiredmanso check
20:36hiredmanman javap and dump the bytecode of the class
20:36dalehiredman: OK, I can appreciate that. However, practically speaking, I've got these muc instances I want to keep around. I guess I'm asking what the best way to interop with Java is in this case. Use of locking is just the first thing that came to mind.
20:37hiredmanthe best way is to avoid xmpp and smack if you can do it :)
20:38hiredmanstreaming xml is not a good start to anything
20:38aperiodici think i was confusing two different changes that happened with 1.3 numerics
20:38daleHeh.
20:39Cheironhiredman: that is scary :D you are right!!
20:39daleI'd actually rather be on IRC, but unfortunately I'm on XMPP. Smack is actually pretty nice looking to me so far.
20:39hiredmanlast time I messed with smack, I found that dealing with it at a very low level (below most of smack) was best
20:39daleComplete non-Clojure-ness of Smack aside.
20:39daleOK, I'll just keep my use of locking in place until something blows up on me because of it.
20:40hiredmanso I would create muc objects, which would cause smack to join the muc, then just discard the objects and deal with the packets directly
20:40daleI'm actually kind of surprised this isn't a more common issue when dealing with Java libraries, but I haven't done much with Java in a good long while I suppose.
20:40hiredmanhttps://github.com/hiredman/clojurebot/blob/master/src/hiredman/clojurebot/xmpp.clj#L71
20:41technomancyis CL-style gensym usage the only way to make a macro that has a let which spans multiple syntax-quotes?
20:41technomancyI should know this
20:41hiredmanyes
20:42technomancycool, thanks
20:42aperiodicwhat is CL-style gensym usage?
20:42mpanIs there a recommended way to reinterpret the standard "loop and modify state" operations of an imperative application in a functional style?
20:42hiredman,(let [x (gemsym)] `(let [~x 1] ~x))
20:42clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: gemsym in this context, compiling:(NO_SOURCE_PATH:0)>
20:43hiredman,(let [x (gensym)] `(let [~x 1] ~x))
20:43clojurebot(clojure.core/let [G__54 1] G__54)
20:43mpanas in, the main loop of a given application
20:43technomancyaperiodic: you don't want to know; it's a mess =)
20:43gfredericksmpan: the simplest transformation is the loop form; but probably not the most idiomatic
20:44mpanor rephrased: how do clojure applications tend to structure the core of their state and its transformations?
20:44gfredericksstate is avoided when you can do it without bending over too far backwards; 98% of the rest of the time you use an atom or two
20:46radsmpan: the book Clojure Programming has some good information on that topic
20:47mpanthanks guys!
21:00SrPxWhy this won't work? (def (symbol "x") 1)
21:00Bronsabecause def expects a symbol
21:00Bronsaand (symbol "x") wont get evaluated
21:00SrPxHow do I make a symbol from a string?
21:01Bronsadirty trick, (def #=(symbol "x") 1) but don't do that.
21:02emezeskeSrPx: (eval `(def ~(symbol "x") 1))
21:02emezeskeSrPx: I would probably never do that, though
21:02SrPxWhy?
21:02clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
21:02emezeskeSrPx: Why do you need to def something where you don't know the symbol name up front?
21:02brehautthese days the answer to why is the ram gone is frequently 'jquery'
21:03Bronsajust (defmacro (def-by-string [str & body] `(def ~(symbol str) ~@ body))
21:03Bronsa(defmacro def-by-string [str & body] `(def ~(symbol str) ~@ body))
21:04SrPxemezeske: something like that (doseq [op ["+" "-" "*" "/"]] (defn (str "vec" op) ...))
21:04SrPxto define vec+, vec- and so on (just for learning)
21:04SrPxBronsa: do you know a good macro tutorial?
21:06emezeskeSrPx: I see. A macro is definitely what you want, then.
21:07emezeskeAs an aside, I would note that * and / for vectors will have substantially different implementations than + and -, if you want to follow the mathematical semantics...
21:08SrPxNo no.
21:08emezeske:)
21:08SrPxAny recommended macro tutorial , though ?
21:09emezeskeSrPx: A last quick question: is (vec+ a b) much better than (map + a b)?
21:10SrPxemezeske: no, just for learning, really
21:10emezeskeCool.
21:11SrPxBut wait, that wont work
21:11emezeske?
21:15SrPxemezeske: nevermind, I thought it was missing a 'zip' somewhere. But if map does what zip does, then what does clojure's zip do? o.o
21:19SurlyFrogAt one point, were vars dynamic by default and now (1.4.0) you need to explicity specify ^:dynamic when you create it?
21:20aperiodicSrPx: turn things into zippers. not at all related.
21:22SrPxMight I ask what a zipper is ?
21:23aperiodicSrPx: a way of traversing and editing tree structures
21:24SrPxHmm OK. Thanks!
21:24cemerickSrPx: Known as Huet Zippers, implemented in clojure.zip
21:25SrPxI know I'm asking too much, but I've read somewhere there is a trick you can use with (require) so it brings everything to the current namespace. I can't find it because I don't know the word. What is it?
21:25casionoh, new people here…
21:25SrPx?
21:25casionwrong chat :| sorry
21:26casionwhile I'm here though I may as well ask again: I need to parse, diff/merge and write and xml file, what would be the ideal way to do about it?
21:26cemerickSrPx: You're thinking of :refer; you should generally be selective in what you refer in though: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/require
21:27casionand=an
21:28SurlyFrogSrPx: If you are at the REPL, you can also use the `use` form. That should take all public functions from the specified namespac and include them in the current namespace.
21:28SrPxcemerick: thanks
21:28SrPxSurlyFrog: Only from the REPL?
21:28SurlyFrogBut, as cemerick stated, it's not really recommended
21:28SurlyFrogbetter form to just import what you really need
21:30SurlyFrogUm, I /think/ so….I've always `ns` from code
22:05cjfriszI think tonight is a 2 beers while coding kind of night
22:05cjfriszBut two beers of victory!
22:09dnolencjfrisz: looking forward to your talk!
22:09cjfriszdnolen: Thanks! Are you speaking, as well?
22:10dnolencjfrisz: no, I passed on submitting anything this year.
22:10cjfriszdnolen: But you're going to be there, right?
22:11dnolencjfrisz: but sounds like there'll be good IU representation this year ;)
22:11dnolencjfrisz: yes
22:11cjfriszdnolen: Excellent! I've been wanting to actually meet you in person!
22:11dnolencjfrisz: the same!
22:13dnolencjfrisz: Will & Dan's prez went over very at Strange Loop.
22:13cjfriszdnolen: I heard!
22:13dnolencjfrisz: not everday you see a type inference for the simply typed lambda calc built in 10 mins.
22:13cjfriszdnolen: I haven't seen it yet
22:14clj_newb_234is CLIM the most amazing GUI that lisp ever had?
22:14clj_newb_234(I'm implementing a graphical interactive repl in clojurescript that executes on clojure, and want to know what to study)
22:49hammerso has anyone run clojurebot themselves?
22:49hammerfiddling with the source code but i can't figure out how to start the thing
22:51Sgeo_Is Catnip considered any good?
22:52hammerSgeo_: I haven't used it yet, but it looks really promising, especially with things like noir
22:52uvtcSgeo_: cats think it's pretty swell. ;)
23:29uvtcWhat is the technical difference between a special form and a macro? I see that `if` and `def` are special froms, whereas `and` and `or` are macros...
23:31eggsbya macro is a special form uvtc
23:31eggsbyspecial forms in general are things that do not follow the basic function application/value rules
23:32eggsbyi.e. if it isn't just a functions body being gradually substituted by the values of it's parameters then it can be said to be a 'special form'
23:32uvtceggsby: Sounds good. Thanks.
23:33uvtcI noticed that, in the output of `(doc ...)`, it actually spells out "Special Form" for `def` and `let`, whereas others specifically says "Macro".
23:33uvtcBut I see what you mean: all macros are special forms.
23:35eggsbyuvtc: you could say a macro is a special type of special form
23:35uvtcIt's extra special. :)
23:37eggsbyif is for building predicates, def is for assigning things for future reference, macros are for manipulating syntax trees :)
23:37SrPxhttp://lispwannabe.wordpress.com/2008/10/24/closures-in-clojure/ this is not a closure, is it ?
23:38shachafLooks like a closure to me.
23:38shachafBut what does "closure" mean? Usually when people say it they refer to an implementation detail.
23:38shachafIf you mean lexical scope, that piece of code certainly uses lexical scope.
23:39cjfriszshachaf: a closure generally refers to a function which closes over the values of its free variables
23:40cjfriszshachaf: In the fn that is returned by the function definition, x is free and closes over the value given by the argument
23:40shachafcjfrisz: I know that.
23:41cjfriszshachaf: More generally, a good non-implementational definition of a closure is "code and the value of its free variables"
23:41shachafThat seems "implementational" to me. :-)
23:41UrthwhyteQuick Q: What's the clj equivalent of mechanize+beautifulsoup?
23:41SrPxI thought a closure was a function that returned a function that could access and update variables local to that function
23:42shachafNo.
23:42cjfriszSrPx: See my definition above
23:42shachafYou're probably best off not worrying about what the word "closure" means. Lexical scope is the important concept.
23:43eggsbyUrthwhyte: you can use clj-http to scrape html, you could use enlive to parse html and select nodes
23:43eggsbyplenty of parsing options tho
23:43SrPxcjfrisz: what do you mean with closes over?
23:43eggsbySrPx: in either case, clojure *certainly* supports closures :)
23:43eggsbySrPx: https://www.refheap.com/paste/5348
23:44Urthwhyteeggsby: Would it be recommended to use clj-http over java.url? I assume it's just a wrapper?
23:44SrPxshachaf: why? I liked to use what I thought was a closure on my last language.
23:44eggsbyclj-http rules Urthwhyte
23:44eggsbyyou definitely want the ring abstraction
23:44eggsbyit makes http a pleasure to work with, java.url not so much
23:45cjfriszSrPx: Do you see how "x" is free in the body of "plusn"
23:45eggsbyenlive is kind of complex but pretty powerful, there's stuff like tagsoup and things with jquery-ish syntax as well
23:45SrPx'free'?
23:45cjfriszSrPx: The function that "plusn" returns doesn't bind "x"
23:45cjfriszSrPx: It uses the value that was passed to plusn
23:45UrthwhyteI'm a Python/Ruby convert - working with Java all summer at Google made me appreciate the JVM, but man do I hate the language :(
23:46eggsbyUrthwhyte: https://github.com/swannodette/enlive-tutorial/
23:46Urthwhyteso Clojure is geting me back to scheme roots
23:46cjfriszSrPx: In other words, it's closing over the value of "x"
23:46eggsbythis tutorial starts out by scraping hackernews
23:46UrthwhyteGoing through that right now :)
23:46eggsbynice
23:46SrPxhmm
23:46shachafcjfrisz: I'd be perfectly happy with saying that ((fn [x] (fn [y] (+ x y))) 5) = (fn [y] (+ 5 y)), for example. No free variables. :-)
23:47eggsbySrPx: you can call many different things closures
23:47cjfriszshachaf: Yes, but that argument only works in the concrete example of applying that function
23:48cjfriszWithout the application, x is still free in the body of the inner fn
23:48shachafOK, but you said that the closure is that function *with* its free variables.
23:48SrPxThat's what I thought of a closure, and it's on the definition on WIkipedia, so let's use that: def counter(): x = 0 def increment(y): nonlocal x x += y print(x) return increment
23:48SrPxHow would you implement this in clojure?
23:49cjfriszAhh, no, I said is the function with the *values* of its free variables
23:49shachafcjfrisz: Right.
23:49shachafI'm perfectly happy to say "x is free in (fn [y] (+ x y))"
23:50cjfriszshachaf: Good, because that's the right way to say it :-)
23:50shachafTalking about free variables is important.
23:51shachafTalking about lexical scope is important.
23:51cjfriszAmen
23:51shachafTalking about closures is probably not as important. :-)
23:51shachafCertainly when you're vague on all these concepts, and you're not implementing anything.
23:52cjfriszshachaf: for the most part, I agree
23:52cjfriszI think it's worth getting the idea of lexical scope and free variables down pat first
23:52cjfriszThat's certainly how all the good PL books present it: lexical scope and free varialbes, *then* closures
23:54uvtcSay, jumping in here, but just so I understand the terminology correctly: free variables are the ones which live outside of your lexical scope, but which are closed over and which you can access from inside your local scope, correct?
23:54shachafAre you defining "free variable" in terms of "closure"? :-(
23:55shachafuvtc: A use of a variable is free in an expression if it isn't bound to anything.
23:55SrPxI guess I understand all those
23:56eggsbyit's strange because in clojure we don't work with variables often
23:56uvtcshachaf: Right --- it's already set up outside the lexical scope.
23:56eggsbymostly we simply work with values
23:56shachafFor example, x isn't free in (fn [x] x), but y is free in (fn [x] y)
23:56SrPxThe python example I put in implements a counter using closure. It defines x on counter's scope and returns increment which uses that x.
23:56shachafSrPx: Stop worrying about, like, mutation, man.
23:56SrPxAnd increments it. Right? How would you do that in clojure, for illustration?
23:57shachafDon't increment things. Why would you do that?
23:57uvtceggsby: Right. No variables, per se.
23:57eggsbyin the counter example of mutating some nonlocal state, that's just something you wouldn't do in clojure, you *can*, but it'd be about as far from "idiomatic" as you could get
23:57SrPxshachaf: because it is the example ?
23:57eggsbynow, you could do it by simply redefining some symbol over and over
23:57shachafWell, it's an irrelevant example.
23:57eggsbybut I don't think that would be a particularly useful example of a closure
23:57shachafY'all're all about immutability, right?
23:58SrPxSure, will that symbol be on counter's scope?
23:59eggsbyno, it would be in the namespaces scope
23:59cemerickodd: why does (goog.getUid x) work in cljs? (goog/getUid x) also works (as I'd expect).
23:59SrPxThat's weird