#clojure logs

2012-05-25

00:00hiredmanbut if that proxy is the top leval it might not make a huge difference
00:00mikerait still gets called a few million times.....
00:01mikerabecause of anti-aliasing, you might have 16 calls per pixel etc.
00:09pat_thomasOpinions: should I go straight into learning Clojure, or learn Common Lisp first and then Clojure?
00:09gf3pat_thomas: They're very different
00:09gf3pat_thomas: I vote Clojure because I think you'll have more fun with it
00:09mikerahey hiredman thanks reify works well - speeded up the code a lot!!
00:10pat_thomasgf3: Does that have to mainly with the Java interop?
00:10gf3pat_thomas: Not necessarily, but it certainly helps
00:10mikeraI prefer clojure syntax a lot to Common Lisp
00:10mikeramore clean / functional
00:11mikeraThe Java iterop is a huge bonus for actually getting stuff done
00:11pat_thomasI'm just wondering because I have to learn a fair bit of Common Lisp during one of my college courses next semester, so I figured it might be worth it anyway.
00:11mikeraCommon Lisp certainly still worth learning! Clojure doesn't (yet( have anything like CLOS
00:12mikerafor example
00:12pat_thomasWhat differentiates CLOS from the ability for Clojure to use Java objects?
00:13mikeraWell CLOS is a whole object system. it's dynamic rather than static, very flexible
00:13pat_thomasInteresting
00:13mikeraso quite different from Java objects
00:13pat_thomasRight
00:14mikeraI think Clojure style though is to avoid OOP entirely
00:14brainproxypat_thomas: I'm coming to clojure from spending most of my time with javascript and coffeescript over the past couple of years
00:14mikeraCLOS will feel more familiar if you know JavaScript well I think
00:15pat_thomasI only know a little JavaScript, but I know a good deal of Java.
00:15mikerathough it's not strictly prototype-based
00:15brainproxypat_thomas: I find cloj quite refreshing, and I'm learning some java stuff along the way to be sure
00:15pat_thomasOk cool. It sounds like I should tackle both languages. At least the basic stuff should have a decent amount of overlap.
00:16mikeraYeah, all the Lispy parts are basically the same principles
00:16mikerajust slightly differnt syntax
00:16pat_thomasThat's what it seems like
00:17mikeramain differentiators for Clojure are being more functional, great concurrency and exploiting the JVM platform
00:17pat_thomasYes, which all seem to make it a more compelling language for "useful" software
00:18brainproxyin my experience so far, the toughest thing is figuring out how to get all setup properly, given a lack of background experience with java, jvm, classpath, etc.
00:18mikerayeah the setup is tough. I was lucky because I came from the Java direction....
00:18brainproxyat some point I'll probably sit down and write a blog post like ... how to get effectively get up to speed with a cloj environment if you don't have java experience
00:19mikerait depends a lot of you want to go the emacs/leiningen route of the eclipse/countercoskwise/maven route
00:19brainproxytrue
00:19pat_thomasHow would you go about setting up a machine for Clojure?
00:19brainproxyi was already doing nodejs/coffee with emacs
00:19mikeraI only really use the later because I do 50% of my work in Java
00:20brainproxyso emacs wasn't new, but swank and inferior lisp ,etc. are new to me
00:20mikeranever got the hang of emacs myself... looks awesome once you have a few years experience
00:20mikerabut I never found the time to get up the learning curve....
00:20brainproxypat_thomas: what os do you dev on?
00:20mikeraWIndows
00:20pat_thomasUbuntu
00:21brainproxypat_thomas: if you've got java installed, there's not that much to it
00:21pat_thomasYup, I have the Oracle JDK and JRE installed
00:21pat_thomasAnd the clojure jar downloaded
00:21brainproxysimple thing would be to get leiningen installed and then start playing with it, invoking repl, learning about project.clj
00:22brainproxythat's probably easier than going at raw clojure jar
00:22brainproxybut ymmv
00:22brainproxypat_thomas: what editor/ide?
00:22pat_thomasVim about 80% of the time, Sublime Text a bit, Eclipse for large Java projects
00:24brainproxygotcha, haven't tried setting up vim to do much with clojure
00:24mikeracounterclockwise plugin for Eclipse is very good if you want to do Clojure+Java in the same project
00:24brainproxymostly been using emacs and swank-clojure
00:24gf3Yay vim!
00:25pat_thomasmikera: Is that commonly done?
00:25brainproxygf3: is there a good writeup for how to setup vim to play nicely with clojure, it's repl, etc?
00:26gf3brainproxy: Yes but they all suck, vim is not good at repls
00:26brainproxygotcha
00:26gf3brainproxy: Your best bet is just to pop open a shell in vim and start a clojure repl manually
00:26gf3Which is unfortunate :(
00:27gf3brainproxy: It's totally possible to get a fancy Clojure repl session going, I've just personally never been happy with the final solution
00:27RaynesI wish sublime text 2 didn't suck so hard for lisps.
00:28pat_thomasIs it easy to set up Emacs with Clojure?
00:28gf3I wish Vico didn't suck!
00:29gf3So much promise
00:29brainproxypat_thomas: yes, it's pretty easy
00:30Rayneshttp://sublimetext.userecho.com/topic/98139-clojure-auto-indentation-is-almost-never-correct/ <-- If anyone else is interested in ST2 for Clojure, upvote the shit out of this.
00:31RaynesParedit and stuff probably wouldn't even be that difficult to add to ST2. The hard part is getting indentation and basic syntax highlighting to even work.
00:32gf3Raynes: vim-clojure does a REALLY good job of this
00:32RaynesThe syntax definition is several thousand lines of XML.
00:33mikera@pat - depends what you are doing. I do a lot of numerical code, so you often want to drop into Java for number crunching
00:33mikeraalso I'm using a lot of my own Java libraries
00:34mikeraso I'm stuck with a mix of Java+Clojure for the moment
00:52mtkoancan I scrape DOM elements with enfocus like enlive can with html/select?
00:52mtkoanor if not, is there a clojurescript lib to do that?
01:04lynaghkmtkoan: you can just drop down to (.querySelector js/document ".my > selector")
01:05McMartinOh, is js/document the whole doc?
01:06lynaghkmtkoan: also, you can extend the NodeList and HTMLCollection types with ISeqable, which lets you use all of the usual clojure collection fns. See https://github.com/lynaghk/c2/blob/master/src/cljs/c2/dom.cljs#L10
01:06lynaghkMcMartin: js/document is the native document object, yeah.
01:07McMartinSo I can just do (.getElementbyId js/document "screen")?
01:07McMartinIf I have a <div id="screen">
01:08lynaghkyep
01:08tomojmtkoan: (select "selector") ?
01:08lynaghkthe "js/" prefix gives you whatever is in the global JS namespace; same as if you typed directly into a JS console.
01:08McMartinnice, thanks
01:08McMartinOK, that makes sense
01:09McMartinnice, thanks
01:09McMartinOK, that makes sense
01:09McMartin(In case you dropped there)
01:09lynaghkMcMartin: no problem. Oh yeah. I just opened my laptop. =P
01:09McMartinheh
01:11McMartinCan you set! stuff in those globals like you can Java fields?
01:12lynaghkyep.
01:12McMartinwoohoo
01:12lynaghk(set! (.-foo js/my-obj) "val")
01:12McMartinThat's pretty much all I need for Phase 3 of my Cunning Master Plan to learn ClojureScript
01:17lynaghkMcMartin: do it = )
01:17lynaghkMcMartin: ClojureScript is a blast.
01:18McMartinPhase 1 is just about done
01:18McMartin(Which was to make a program in regular old Clojure)
01:18McMartinPhase 2 got added partway through, to automate it and play with trampolines
01:18McMartinPhase 3 is "make it a webapp"
01:21McMartinBut then I got distracted by Python Project Other People Actually Care About =(
01:49kushalcan anyone help me with webnoir ? I am trying to understand how to use noir.statues/set-page! to show a static page
02:57muhoowow, the world of security/authentication/authorization is just crawling with incidental complexity
02:58muhoowhat. a. zoo.
03:08DvyjonesHi. I'm trying to get clojure-jack-in to work in emacs, but it complains that the lein2 command doesn't exist. I have lein2 in ~/bin, and it is executable and in my PATH (I can execute it from a freshly opened shell). Any ideas on how to fix this?
03:08Dvyjones~/bin is in the exec-path
03:08clojurebot'Sea, mhuise.
03:08Dvyjones(#emacs told me to try here)
03:11amalloyDvyjones: sounds like you're using a mac?
03:11scottjDvyjones: M-: clojure-swank-command
03:11Dvyjonesamalloy: Nope, ArchLinux.
03:11amalloyhm
03:11Dvyjonesamalloy: My mac worked perfectly with this.
03:12amalloythere's some known issue where on a mac emacs (or at least some builds) ignore your PATH unless you do some special magic
03:12Dvyjonesscottj: "echo \"lein2 jack-in %s\" | $SHELL -l"
03:13scottjDvyjones: I don't have latest clojure-mode.el (lein2 supporting one), but in mine I think that means it didn't find lein in your exec-path
03:13amalloythe readme also suggests for macs (and perhaps it works for you too): On Mac OS X, Emacs sessions launched from the GUI don't always respect your configured $PATH. If Emacs can't find lein, you may need to give it some help. The quickest way is probably to add this elisp to your config:(setenv "PATH" (shell-command-to-string "echo $PATH"))
03:14Dvyjonesamalloy: ~/bin is in both $PATH and exec-path
03:14Dvyjones(The expanded version, that is)
03:14scottjDvyjones: maybe (setq clojure-swank-command "~/bin/lein2 jack-in")
03:15scottj(I don't use jack-in so these are all guesses)
03:16DvyjonesAh, now I get "jack-in" is not a task, but I can fix that.
03:16Dvyjonesscottj: Thanks :)
03:23scottjDvyjones: what shell are you using?
03:24Dvyjonesscottj: zsh
03:25scottjDvyjones: btw maybe should have been "~/bin/lein2 jack-in %s"
03:26Dvyjonesscottj: Yeah, I just changed the lein2 to ~/bin/lein2. Worked perfectly.
03:29kralnamaste
03:34sophianHi all, this is my first time in this chat. I'm having trouble with korma due to some log4j logging issue. Any help on this would be greatly appreciated!
03:41pesdhello
03:42pesdi have a problem
03:42pesdwith casting i think
03:42pesd(def line (cast javax.sound.sampled.TargetDataLine (javax.sound.sampled.AudioSystem/getLine dlinfo)
03:42pesdline should then be a targetdataline, right?
03:42pesdbut when i do (. line open af) it tells me
03:42pesd error: java.lang.IllegalArgumentException: Can't call public method of non-public class: public void com.sun.media.sound.AbstractDataLine.open(javax.sound.sampled.AudioFormat) throws javax.sound.sampled.LineUnavailableException
03:43pesdif instead of (cast) i use #^ecc. to do the casting it works
03:43pesdbut only in emacs, when i compile it it gives the same problem
03:48sophiannever mind, I found something that worked off of here: http://wiki.apache.org/logging-log4j/Log4jXmlFormat
04:12amalloysophian: glad you found a solution. next time, the proper IRC etiquette is to just ask your actual question; otherwise someone interested in helping you has to say "sure! what do you need help with?", which is a hassle especially if they turn out unable to help
04:14sophianamalloy: gotcha. thanks for the tips!
04:18_KY_Clojure.language.RT not found in my java code, what should I do?
04:18_KY_clojure.lang.RT not found in my java code, what should I do?
04:18_KY_Do I need to include some jar file?
04:20bobrywhy does clojurescript uses such an old version of closure library? any particular reason for this?
04:20bobry_KY_: can you show the code sample, which causes the error?
04:20_KY_It's in java
04:20_KY_import clojure.lang.RT;
04:21_KY_It was working just minutes ago
04:21bobryah
04:21_KY_Not it's complaining "package clojure.lang does not exist"
04:21_KY_*Now
04:24_KY_Oh, problem solved -- forgot to add jar file to project
06:08lypanovanyone know if i can use promises etc in a noir app?
06:11lypanovi'm guessing that aleph is being used in production but anyone know if noir-async is?
06:13bobryis there a reference for standard clojure protocols somewhere?
06:13bobrycan't find it in the docs :/
06:39madsyHm, I have some classes that derived from Class. I,e the API requires me to invoke functions with "SomeConcreteType.class". Is that the same as (class SomeConcreteType) in Clojure?
06:41clgvmadsy: you can just use the name of the class - it'll be resolved to the clas object
06:48lypanovbobry: i'd read the source. thats usually where i turn eventually :)
06:49bobrylypanov: yup, that's what i'm doing right now :)
06:50madsyclgv: Ah, sweet
07:01kilonwhat are advantages of clojure over python ? I am still trying to decided between clojure and python for a javascript game i want to make
07:02ivankilon: persistent data structures, protocols, macros, faster VM available, libraries with less mutable state, compiles to JavaScript
07:03ivanClojureScript is not exactly Clojure though
07:03kilonsorry i meant clojurescript , you are correct of course and thanks for the points
07:04kiloni am already a python developer and trying to figure out how much i really need the additional feature clojurescript gives to me
07:04kilonof course i am ready to learn and do my own tests
07:04kilonbut some personal opinion would not hurt either
07:06luciani like clojure, as a python developer
07:06ivanClojureScript produces output that Closure Compiler can compile with its advanced optimizations, which is very cool
07:06luciani haven't used clojure in anger, so far i've used CoffeeScript for my JS needs
07:07ivansome people used CLJS in the latest Ludum Dare
07:07luciancljs is indeed even saner than CoffeeScript
07:07lucianbut arguably harder to debug
07:11lypanovcoffee script is worse to debug.
07:11lypanovrepl in cljs makes it sane.
07:11lypanovwithout chrome and coffee script maps coffee script is hell.
07:11ivanCoffee has a REPL too, no?
07:14kilonhttp://clojurescriptone.com/index.html
07:15kilonthe repl looks cool here
07:17kilonyeah i am not considering coffeescript, i love python, I only consider clojure because i got big respect for it as a language
07:17kilonand lisp in general of course
07:18lypanovivan: nothing like what i've got with noir-cljs etc
07:21kilonwhat is noir ?
07:23kilontrying google but does not give me useful result
07:23lypanovnoir-cljs == https://github.com/ibdknox/noir-cljs
07:23lypanovnoir == http://webnoir.org
07:23kilonlol just fount it too
07:23kilonthanks lynaghk
07:24kilonlypanov:
07:24lypanovkilon: you're very experienced in js already?
07:24kilonlypanov: nope i have not coded a line of js yet, but i am learning it
07:24lypanovthen start with JS
07:24lypanovi made that mistake in past. its a bad one.
07:25lypanovuse clojure/python backend. but JS for frontend.
07:25kilonlearning js wont be a problem , but yes i will learn it
07:25lypanovJS has great advantage that there is an insane amount of code you can reuse.
07:25kilonwell python has pyjamas which compiles python to javascript like clojurescript compiles to js too
07:25kilonit also allows to mix js code with python
07:25lypanovlast time i checked out pajamas it was basically useless :)
07:26lypanovpy*
07:26kiloni assume the same happens for javascript
07:26kilonsorry i mean clojurscript
07:26lypanovyup.
07:26kilonuseless, really ? it comes always highly recomended
07:26lypanovbut then much tighter javascript than pyjamas can produce.
07:26kilonand found several blog post stating that is the second coming of christ :D
07:27lypanovi'd still heavily suggest that you start with raw javascript.
07:27kilonby tigher you mean ? readable js code ?
07:27lypanovlots of the work you'll be doing is integrating libraries.
07:27lypanovtighter meaning it generates very compact js code.
07:28kiloncan clojurescript produce human readable javascript coder like parenscript does for common lisp ?
07:28lypanovkilon: yes. but i wouldn't suggest reading it :)
07:28kilonyes that is indeed a big advantage
07:29kiloni will learn javascript , dont worry , knowning js was in my plans before finding clojure
07:29kiloni love learning programming languages
07:30dan_bif you feel like spending money, Douglas Crockford's "Javascript the good parts" is imo the canonical book
07:30BorkdudeI started using Clojure because I had to use Java more and Clojure makes me use Java and think about Java more ;)
07:30kilonyeah i hear that A LOT
07:31kilon"good parts" that is
07:31Borkdudemaybe the same for Javascript… I think the language itself is not so big… it's the way you build apps, DOM manipulation etc that comes with it
07:31Borkdudeand I think using clojurescript a lot and reading examples will give me some sense of it
07:32Borkdudelearning Java or javascript on their own would be too boring for me, clojure is what adds the extra fun to it
07:33kilonthe problem with javascript vs java is that js is actually a very good functional language
07:33kilonat least that is the vibe i am getting from reviewers
07:34ivannot really. there isn't even a repr() or proper equality
07:34dnolenkilon: JS is a good functional language?
07:34Borkdudekilon: yes, but it's also a language in which you can make a mess :)
07:34ivanArray sort sorts numbers wrong, etc. it's a minefield.
07:34dnolenkilon: I've been using it for 7 years, it's not a "good" functional language.
07:34kilonwell i have read many blog claiming js as the new lisp
07:34dnolenkilon: it's an interesting hybrid.
07:34dnolenkilon: snort
07:35kiloni am no way claiming anything
07:35BorkdudeI saw the video from Crockford on javascript and the brain
07:36Borkdudeit made me interested in the book javascript the good parts
07:36kiloni dont think any language can stop your from writting bad code
07:36kilonat least i have not meet on yet
07:37Borkdudekilon: I agree
07:37Borkdudekilon: but some languages more than others ;)
07:37dan_bI found that java quite effectively stopped me fron writing *any code at all*
07:37kilonthe only thing slowing me down in learning clojure, because i will learn it sooner or later, is how needed really is a functional language
07:37dan_bgood or bad
07:38kilonits the same question i asked myself when studying common lisp
07:38lypanovit depends on what you're doing. and what your background is.
07:38Iceland_jackkilon: Common Lisp is hardly functional...
07:38Borkdudekilon: what is the need of good abstractions
07:38lypanovjust like c++. cl can be functional. :))
07:39dan_bmap/reduce/filter/etc is stuff that every programmer should know
07:39kilonthat is , that i am not doing anything complicated as coding, nor i have huge project to work on, i rarely exceed few thousands lines
07:39BorkdudeCommon Lisp is as functional as Javascript or Python, is that safe to say? (they all lack immutability to the degree that most "pure" FP-languages have it)
07:40dan_bit's less unwieldy than javascript. python I at all
07:40kilonpython is really bad at being functional i am afraid :D
07:40dan_bs/I/I don't know/
07:40kilonI love python but truth must be told :D
07:41Iceland_jackNot being functional isn't inherently bad kilon
07:42Borkdudeah well… https://twitter.com/fakerichhickey/status/200963481565011969
07:42kilonIceland_jack: good point
07:42Iceland_jack> Metro is an internal code name for a typography-based design language created by Microsoft, originally for use in Windows Phone 7. Early uses of the Metro principles began as early as Microsoft Encarta 95 and MSN 2.0,[1][2] and later evolved into Windows Media Center and Zune.[3] Later the principles of Metro were included in Windows Phone, Microsoft's website, the Xbox 360 dashboard update, and Windows 8.[4] A key design principle of Metro is bette
07:42Iceland_jackhell..
07:43Iceland_jack*sorry, wrong channel
07:44kiloni really dont like haskell syntax, too perly for my taste
07:44kilonthough i dont dispute it might be an awesome language
07:44Borkdudekilon: I really hate the string concatenation I see sometimes all over the place in haskell code
07:44ivanthe epidemic of tab/space mixing in the Java community makes it really easy to tell which code is new
07:45lypanovobviously not using intellij then.
07:45lypanov(death to tabs!)
07:45kilonthanks for the guidness people
07:45Borkdudefor example: https://gist.github.com/2787518
07:46ivanIntelliJ might actually be part of the problem by not detecting tab/space per-file
07:47kilonwill certainly give a try to clojure and clojurescript during this weekend
07:47kilonsee you all later
07:48lypanovivan: my java experience was that eclipse users are unable to use a consistent coding style. never worked in a project without a coding style so the entire concept of "not detecting" is a bit crazy to me.
07:48ivanwell, sometimes there's multiple styles or imported code in a project
07:49lypanovanyone around using slimv rather than vimclojure? trying to figure out if i should switch.
07:55lypanovdnolen: delimited continuations hurt my brain. i'm looking for a way to execute part of a clojurescript function on one page, and then the second half on another after doing a redirect. is this at all related to delimited continuations or am i on completely the wrong track?
07:57dnolenlypanov: I don't see how that can work *client side* across page refreshes.
07:58lucianwhy not just explicitly split it in two functions?
07:59lypanovdnolen: its for a selenium like testing framework i'm writing using phantomjs. currently my code is in js and has an array of functions, each function executed on each page navigation. a cookie saves the end state. i'd like to write a macro which abstracts away "awaiting ajax response" and "redirect after clicking link".
07:59lypanovmaybe best just just have the macro produce the same array of functions.
08:00dnolenlypanov: oh so on the same page - then yes probably.
08:00dnolenlypanov: I'm waiting for clojure-tco to evolve a bit more, should be a good foundation for that kind of thing eventually.
08:01lypanovdnolen: in the case of "redirected after clicking line", not on same page. delimited is more about keeping external state but doesn't allow recreation of that state?
08:02lypanovsorry i mean internal state.
08:02tomojsince you have the phantomjs context across the redirect, why would you need continuations?
08:03tomojI mean, suppose the redirect returns a 404 - you want the test to fail, not hang, so there has to be some code in the phantomjs context (not the page context) which says "did we redirect successfully?"
08:03tomojright?
08:03clojurebotEqual Rights for Functional Objects is Baker's paper on equality and why it's impossible to define sensible equality in the presence of mutable data structures: http://www.pipeline.com/~hbaker1/ObjectIdentity.html
08:03lypanovi'm keeping state external to phantomjs so i can use feasibly the same tests in selenium to do IE screenshotting also.
08:04lypanovyes there is fallback code but its more of a "nothing happens for 10 seconds" like system.
08:06dnolenlypanov: delimited continuation means you need some place to store the fn, I don't know how that can work across page refreshes.
08:06tomojI'd wildly guess that it would be easier to write a testing api that supports both selenium and phantom, similar to capybara
08:07tomojwhich would be strictly more powerful I think, making e.g. "this url should 404" tests easy
08:07lypanovtomoj: "this should be 404" tests don't belong in this testing framework though.
08:07lypanovthis is a "run a bunch of js then take a screenshot" system.
08:08lypanovdoing it because i'm pretty much sole maintainer of app and i have to start refactoring css or i'll go crazy
08:08Borkdudehas anyone in here read "Collective Intelligence" (and translated some of the examples to Clojure?)
08:08tomojs/"this url should 404"/"they should redirect and then I'll take a screenshot"/ say
08:08tomojor whatever
08:10lypanovtomoj: at the moment i'm up to a few hundred lines of code and i'm happier playing with this than i've ever been before with one of the random testing "frameworks". part of that is that my tests are written in jquery that runs entirely in page context meaning i can write the tests in web inspector and copy and paste them into my test.js files . only thing i want now is to remove the excessive indent that callbacks are causing.
08:11lypanovtomoj: but based on conversation with dnolen now understand that i can't (de)marshal delimeted continuation state.
08:11tomojoh, you have it working across redirects already?
08:11lypanovdelimited*
08:11lypanovyes. everything works.
08:11lypanovjust that i now want to port to clojurescript and get pretty code.
08:13lypanovtomoj: (background its a rails app with clojurescript). have a web app shell which dumps screenshots to screen using web socket notifications. dumps all logging from the js running in phantomjs and logs all requests to app.
08:14lypanovtomoj: working on SPI (single page interface) and i was going crazy getting back/forward handling Right.
08:26_KY_How do I use Integer/parseInt?
08:27ivan,(Integer/parseInt "34")
08:27clojurebot34
08:35lypanovw00t. found example i can extend: https://bitbucket.org/puffnfresh/clojurescript-timeout-cps/src/1a8065fbf65a/src/puffnfresh/timeout.clj
08:39bderoomsis there absolutely no way to wait inside an agent for an other agent?
08:45beffbernardbderooms: use a promise?
08:45_KY_Lol I spelt Integer as Interger
08:47bderoomsbeffbernard: mm checking it
08:58bobrywhy doesn't clojure script support :require without :as? what if I just want to make sure the module is loaded?
09:00dnolenbobry: oversight
09:00dnolenbobry: http://dev.clojure.org/jira/browse/CLJS-272
09:02bobrydnolen: cool :)
09:09lypanovnice. wanted that too.
09:10Borkdudeusing sqlite requires no native driver/code, the sqlite jdbc driver is enough, am I right?
09:15bobryis it possible to make a relation between to protocols, for instance when methods of protocol Foo can be implemented in terms of Bar?
09:16bobryso I don't have to manually extend my type with Bar, if it already implements Foo
09:18dnolenbobry: nope
09:18dnolenbobry: the closest you're going to get is to build some component abstraction - extend-type default allows for delegation.
09:20bobryi see, thanks
09:32almostobsoleteI'm trying out clojure following the steps for compojure here: https://github.com/weavejester/compojure/wiki/Getting-Started but when I visit the server it starts (with "lein ring server") I get a NullPointerException and stack trace sent to the browser
09:32bobryokay, one more silly question -- why is '(. "foo" (symbol "substring") 1 2)' not a valid dot form, while '(. "foo" substring 1 2)' is?
09:32almostobsoleteIs there a common mistake that this might be?
09:33ivanplease pastebin the stacktrace
09:34almostobsoleteHere's the stacktracke: https://gist.github.com/2788187
09:35almostobsolete*stacktrace
09:37antares_bobry: because forms are evaluated at compile time and (symbol …) is a function call that happens at runtime
09:38ivanalmostobsolete: maybe http://stackoverflow.com/questions/7222376/clojure-compojure-hiccup-nullpointerexception
09:38ivan(no idea really, that stack trace is not great)
09:39almostobsoleteit's all just copy pasted from the tutorial, no changes
09:42S11001001bobry: because substring is the symbol substring, whereas (symbol "substring") is the list of two elements, whose first element is the symbol symbol, and second element is the string "substring"
09:43almostobsoleteDoes anyone know some starting points for playing with clojure web apps that work?
09:43almostobsoleteI think maybe the tutorial for compojure has bit-rotted :(
09:44the-kennyalmostobsolete: Start at the compojure Github page :)
09:44the-kennyNoir is hot too
09:44pandeiroalmostobsolete: i would start with cljs-template or clojurescript-one
09:44S11001001or what antares_ said
09:45pandeirocljs-template sets up a noir/cljs env and one uses a more barebones compojure
09:45almostobsoleteI'll take a look at those, the thing I was following before was: https://github.com/weavejester/compojure/wiki/Getting-Started
09:46almostobsoleteI'll try noir
09:46pandeiroalmostobsolete: if you're trying to grok how things work you can go straight to ring, too
09:47pandeiroi started with noir and worked backwards, maybe not how i would do it if i started over
09:48pandeiroie 1) build hello world with ring, 2) build hello /route with compojure 3) build hello to-do-list with noir 4) ... 5) profit!
09:48almostobsoletepandeiro: that makes a lot of sense
09:50pandeiroalmostobsolete: yeah so ignore my earlier recommendation to go straight to cljs-template and its 6 million moving parts
09:51pandeirothough it will build you a fully functional webapp that you can then modify... maybe that would be good for step 3
09:51pandeiroalthough in the spirit of the 'learn x the hard way', perhaps it's better to actually have to type all the boilerplate out?
09:52the-kennyalmostobsolete: If you want to try compojure a second time, tell us the stacktrace :)
09:52the-kennyJust a NPE isn't helpful
09:53ivan<almostobsolete> Here's the stacktracke: https://gist.github.com/2788187
09:54the-kennywhoops
10:00almostobsoletethe-kenny: Still trying, although at pandeiro's suggestion I'm now trying to just use ring
10:00almostobsoleteWhich also isn't working for me, but trying a few things before asking :)
10:02almostobsoleteOk, very simple question. I have a project with a core.clj at the top of my core.clj I have (ns almost.core) I start the repl with "lein repl" and type (use 'almost.core)
10:02almostobsoleteat this point I expected to be able to use the functions I defined with defn in core.clj
10:03almostobsoletebut instead I get:
10:03almostobsoleteCompilerException java.lang.RuntimeException: Unable to resolve symbol: handler in this context, compiling:(NO_SOURCE_PATH:0)
10:03almostobsoleteAm I being stupid? :)
10:03jedmtnmanalmostobsolete: your namespace needs to match the file structure
10:03jedmtnmanwith your current namespace, its looking for your core inside the almost dir
10:04almostobsoleteI'm running lein repl from within the "almost" dir. It also contains a project.clj
10:04pandeiroalmost > project.clj | src > almost > core.clj ?
10:04almostobsoleteI get no error when I type the (use 'almost.core) line
10:05almostobsoletealmost > project.clj
10:05jedmtnmanalmostobsolete: no thats setup right
10:05almostobsoleteis core.clj meant to be like the index file?
10:06jedmtnmanalmostobsolete: no, its more like main
10:06pandeiroalmostobsolete: i think it has no special meaning though, could be anything
10:06Chousukecore is just the convention for the main namespace
10:06Chousukemimicking clojure.core
10:08almostobsoleteso how would I use stuff from core in the repl? tutorials seem to imply that you just use (use 'almost.core) but that's not working for me
10:10almostobsoleteHere's what I'm doing right now: https://gist.github.com/2788329
10:11almostobsoleteaha! lein created a src/almost/core.clj file! That's what it must be loaded. I'd just created a core.clj in the root project directory
10:12pandeiroalmostobsolete: that's what i was trying to show with my one-dimensional dir tree above :)
10:12almostobsoletepandeiro: Makes sense now, thanks :)
10:37pandeirois there a way to use the cljs browser repl while using something like python's simple http server for serving just static resources?
10:37_KY_How to turn (a b c d) into ((1 a) (2 b) (3 c) (4 d))?
10:37S11001001_KY_: map list
10:38pandeirowhen i do it the browser console complains about a robots.txt which is just bizarre, there's no robots.txt anywhere in the code or the directory
10:38gfredericks&(map list (rest (range)) '(a b c d))
10:38lazybot⇒ ((1 a) (2 b) (3 c) (4 d))
10:38_KY_Interesting...
10:39_KY_That "map" has 3 arguments?
10:39gfredericksyep
10:39gfredericks&(doc map)
10:39lazybot⇒ "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhauste... https://www.refheap.com/paste/2869
10:39clgvmap has arbitrary many arguments ;)
10:39pandeiro,(map-indexed #(conj % %2) '(a b c d))
10:39_KY_Interesting...=)
10:39clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>
10:39pandeirooops think i wanted cons there?
10:39pandeiro,(map-indexed #(cons % %2) '(a b c d))
10:40clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>
10:40pandeiroheh ok nevermind me
10:40clgv,(map-indexed #(list % %2) '(a b c d))
10:40clojurebot((0 a) (1 b) (2 c) (3 d))
10:40gfredericks&(doc map-indexed)
10:40lazybot⇒ "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."
10:40BorkdudeMacros: "so let it be written, so let it be done"
10:41lypanovpandeiro: i don't know much about cljs browser repl but locally i use noir-cljs with rails.
10:41lypanovpandeiro: sharing same hostname by using haproxy to send requests to the right backend.
10:41S11001001,(apply map #(map inc %) (repeat (repeat 42)))
10:41clojurebotExecution Timed Out
10:41S11001001hmm
10:44Chiron_Hi all. any idea why I'm getting this error? Exception namespace 'pallet.crate.jenkins' not found after loading '/pallet/crate/jenkins' clojure.core/load-one (core.clj:5203)
10:45Chiron_(require ['pallet.crate.jenkins :as 'jenkins] :reload)
10:45pandeirolypanov: do you use just the noir.cljs.repl ns then?
10:46Chiron_clojurebo: marry me!
10:46Chiron_clojurebot: marry me!
10:46clojurebotNo entiendo
10:47almostobsoleteI'm using clojure slime in emacs. I've made changes to my project.clj, how do I reload it?
10:48pandeiroalmostobsolete: good question
10:48lypanovpandeiro: i don't use a repl in general. prefer using watcher, instant mode, and having a simple function which is executed every time code is updated.
10:48pandeiroi usually just do clojure-jack-in again
10:48pandeirolypanov: ah ok i am specifically wanting to use the repl to debug some stuff
10:49pandeiroseems really weird that something is requesting a robots.txt parameter
10:49almostobsoleteCool, seems reasonable as I guess you don't change project.clj often
10:49pandeirohttp://localhost:9000/?xpc=%7B%22cn%22%3A%22eebCOEdFWC%22%2C%22tp%22%3Anull%2C%22ppu%22%3A%22http%3A%2F%2Fpang%3A8000%2Frobots.txt%22%2C%22lpu%22%3A%22http%3A%2F%2Flocalhost%3A9000%2Frobots.txt%22%7D
10:49almostobsoleteHow about when I change any other clj file in the project? Can I just slime-compile-and-load?
10:50pandeiroalmostobsolete: probably, i usually use slime-eval-buffer or something like that and then retype (use 'whatever)
10:50pandeiromaybe slime-compile-and-load combines those
10:50pandeiro?
10:50lypanovpandeiro: whats xpc=
10:50almostobsoleteAwesome! It does seem to work :)
10:50llasramalmostobsolete, pandeiro: yah, you can. C-c C-k go!
10:50lypanovisn't that just the repl talking to the server it expects to find but finding instead your python app?
10:52lypanovpandeiro: i'm a evil printf debugger. mah momma born me dat way.
10:53_KY_,(Integer/parseInt "123")
10:53clojurebot123
10:54_KY_But I get "class not found error"
10:56_KY_Is that from Java?
10:57_KY_I'm compiling it in Java
10:58S11001001what
11:00_KY_I got a run time exception when using Integer/parseInt
11:01_KY_I exported my program as a jar
11:01lypanovare you using leiningen.
11:03_KY_Well, I use lein uberjar to create the jar, yes
11:03_KY_Then the jar is used by my java program
11:03_KY_When building the java program it complains, and then it won't run
11:04KaiSforzaJust curious, what distro and DE do most of you guys use?
11:04S11001001_KY_: so, clearly, you aren't making the class
11:04almostobsoleteI'm using wrap-resource like this (def handler (wrap-resource hello-handler "public")) but where will it actually server the files from?
11:04_KY_clojure-1.3.0
11:05almostobsoleteI've created a resources/public/test.txt file (from the project root, or maybe it should be in src?)
11:05_KY_S11001001: what class? the program works alright if I don't use Integer/parseInt
11:05_KY_The error is specifically about that function
11:06S11001001_KY_: "class not found"?
11:06uvtcKaiSforza, I don't know what most people use, but I'm using Ubuntu and Emacs 24.
11:06_KY_"java.lang.ClassNotFoundException: Integer/parseInt"
11:07S11001001_KY_: did you put an extra dot
11:07_KY_There is no dot, right?
11:07S11001001yes
11:07_KY_,(Integer/parseInt "123")
11:07clojurebot123
11:08_KY_i called it using map, so it was #Integer/parseInt
11:08S11001001no.
11:08S11001001Integer/parseInt is not a function
11:08gfredericksis there a memfn for static functions?
11:08_KY_Ohh
11:08gfredericksstatic methods*
11:08S11001001IIRC memfn is deprecated
11:08gfrederickswat
11:09Borkdudehttps://gist.github.com/2764700
11:09gfredericks&(doc memfn)
11:09lazybot⇒ "Macro ([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."
11:09S11001001_KY_: please paste actual code+actual error in future; it helps to more quickly see what is wrong
11:10S11001001there was a clojure.contrib.import-static that aliased reflective calls to clojure functions, but I guess it wasn't so great, and now it's gone
11:13TimMcS11001001: I'm maintaining a non-contrib version of that now.
11:13gfredericksS11001001: how do you know it's deprecated?
11:14KaiSforzauvtc: thanks. I'm in the process of making an archlinux based distributino specific to clojure programming (with all the stuff pre-configured/installed), and I was looking for some input on what to include in the live dvd.
11:14terom,(map #(Integer/parseInt %) ["123", "456"]) ; maybe use something like this, _KY_
11:14clojurebot(123 456)
11:14TimMcS11001001: https://github.com/baznex/imports
11:15pbostromKaiSforza: Mint/vim
11:15_KY_Yeah I did and is resolved...
11:16S11001001gfredericks: I don't remember; I heard it somewhere. Perhaps they were wrong
11:16S11001001making me wrong
11:17S11001001ah, baznex
11:17TimMc:-)
11:23goodiebo_I'm working on moving a library from clojure 1.2 to 1.3. In the 1.2 tests, we use binding to test certain vars that, under normal circumstances are not dynamic. Is there anything besides adding :dynamic to these vars that I can do?
11:23goodiebo_^^ the :dynamic stuff is really only for testing
11:24gfredericksgoodiebo_: if global binding is acceptable (like it testing) you can use with-redefs
11:24gfredericksin testing*
11:24goodiebo_gfredericks: interesting, i'll look that up thanks
11:29goodiebo_org.clojars.racoon/string sounds interesting, but what the heck is it?!
11:31bderoomsis there any vectorlike sturcture which gets O(1) access? Vectors seem to implement log32N access, but they are still the slowest part in my program. I tried java vectors but they appear even slower (because of the java interop overhead?)
11:33raekbderooms: java array lists should have O(1) random access. do you get warnings with *warn-on-reflection*?
11:33bderoomsno
11:33pandeirolypanov: it shouldn't be finding the python server if it's sending a request to localhost:9000 right?
11:34bderoomsI just changed from a map to a java array, and the procedure that does it now takes 50% of the time in my program (accodring to visualvm)
11:34raekwithout reflection there shouldn't be any interop overhead at all
11:35bderoomsmaybe that's not the problem
11:35bderoomsI'll search on
11:40timvisher_how do i extend io/copy to a new type?
11:40timvisher_do-copy is private
11:40lypanovpandeiro: sorry really no idea never used the browser repl :)
11:41pandeirolypanov: no worries, thans
11:43goodiebo_gfredericks: what is the difference between binding and with-redefs?
11:46raekgoodiebo_: with-redefs mutates the root binding of the var and binding adds a thread local binding to a var.
11:46goodiebo_raek: wow very cool
11:47goodiebo_raek: i'm not clear on how with-redefs-fn would be used though?
11:48gfrederickswith-redefs-fn is probably just the function version of with-redefs, which is a macro
11:48gfredericksno need to look at it probably
11:48stobixhi! Is there any way to get clj or lein to load faster? (Precompiling or whatnot)
11:48goodiebo_gfredericks: ahh i see
11:50timvisher_stobix: read https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md (search for `speed up launch`)
11:51pandeirostobix: http://icylisper.in/jark/index.html
11:52raekstobix: you can speed up the launch of a project by using ahead of time compilation, but that will get in the way when doing interactive development in a repl
11:52raekso it's better to only use AOT compilation when the application is finished
11:53raek(get in the way = cause redefined functions to not be recognized some times)
12:00nDuffHmm.
12:04nDuffI have a macro in which I'm trying to refer to a local var, but macroexpand keeps going to clojure.core/my-var rather my-ns/my-var.
12:05Bronsacan you post the macro?
12:07S11001001nDuff: is my-ns/my-var defined later than the macro?
12:07nDuffS11001001: no -- and this happens when I define the macro in the REPL, with my-var interactively available.
12:10nDuffBronsa, https://gist.github.com/153833c315cdde8361f4
12:11BronsanDuff try using (deref) instead of @
12:12nDuffBronsa: I have.
12:12gfredericks,(read-string "@foo")
12:12clojurebot(clojure.core/deref foo)
12:12gfredericks^ should be equivalent
12:13S11001001nDuff: #'auth-context gives?
12:13nDuff#'com.indeed.jira-releng-plugin.jira/auth-context
12:13gfredericksnDuff: when I run that in a repl I get user/auth-context
12:13Bronsayeah me too
12:14gfredericksnDuff: what is your *ns*?
12:14gfredericks(at the repl)
12:14nDuff#<Namespace com.indeed.jira-releng-plugin.jira>
12:14gfredericks*clojure-version*?
12:14nDuff{:major 1, :minor 4, :incremental 0, :qualifier nil}
12:15gfrederickssame on 1.4
12:16gfredericksnDuff: what if you just entery `auth-context at the repl?
12:16gfredericks,`auth-context
12:16clojurebotsandbox/auth-context
12:16nDuffclojure.core/auth-context
12:16gfredericksokay well at least you extracted the problem from your macro
12:17gfrederickshow about `foo-context?
12:17nDuffclojure.core/foo-context
12:17Bronsathat's weird
12:17S11001001huh, maybe your repl's reader is nsing to clojure.core
12:17S11001001#=(do *ns*) gives?
12:18nDuff#<RuntimeException java.lang.RuntimeException: Can't resolve do>
12:18S11001001ick
12:18S11001001#=(list *ns*)
12:18gfredericks#=(str *ns*)
12:18S11001001whatever
12:18gfredericksbork bork bork
12:19nDuff#=(str *ns*) => "*ns*"
12:19gfrederickswoah.
12:19TimMcS11001001: *ns* is a symbol in that context
12:19Bronsause symbol.
12:19gfredericksoh right
12:19gfredericksit did that for me too
12:19TimMc#=() only "enlivens" the call position
12:19Bronsa#=(symbol *ns*)
12:20nDuff#=(symbol *ns*) ;=> #<Namespace com.indeed.jira-releng-plugin.jira>
12:20S11001001that wouldn't do what we want
12:20gfrederickswait that's the same as just evaling *ns* then
12:20Bronsaoh, right
12:20mabesis the clojurescriptone video still a good starting point for clojurescript?
12:20mabesvideo/project
12:21dnolenmabes: not really I would just start with lein-cljsbuild
12:21Bronsa#=(vector *ns*) then?
12:21S11001001(def print-ns-dammit [] (str *ns*)) #=(com.indeed.jira-releng-plugin.jira/print-ns-dammit)
12:21mabesdnolen: cool, thanks for the direction
12:22S11001001defn, whichever
12:22gfredericksS11001001: that seems to work for me
12:25jsabeaudryI would like to show the version of my application in it, is there a way for me to access the version that is in my project file (the source isnt there as I'm running from uberjar)
12:25hiredmannDuff: euroclojure
12:25nDuffahhh.
12:26gfredericksclojeuro? cleujure?
12:26Bronsalol@cleujure
12:26gfredericksthere must be some way to take advantage of the fact that all the letters in "euro" are in "clojure"
12:26jsabeaudryclojur€
12:28jsabeaudryI am getting used to it or is lein 1.7 much faster than 1.6 at uberjaring?
12:29nDuffWell -- AOT-compiling the same code, rather than getting it in through the REPL, all works well
12:29nDuffso in the interim, I'll just be *grumble* restarting whenever I have to change the macro *grumble*.
12:31gfredericksclojure = euro + clj
12:35technoma`jsabeaudry: 1.7.1 fixed a bug regarding AOT
12:35technoma`gfredericks: bind: blown
12:36jsabeaudrytechnoma`, I'm loving it
12:37uvtc♫ "We are the three clojeuros, we are the three clo o ....... jeuros." ♫
12:37technoma`jsabeaudry: wait till you try lein2
12:39eggsby dang gfredericks
12:39TimMcjsabeaudry: clojur€ is definitely a win
12:39abedra^^
12:40TEttingertechnoma`, have you seen lein bin ? it is so clever!
12:40uvtcTimMc, Clojur€script uses Clo$ure?
12:41TEttingerhttps://github.com/Raynes/lein-bin
12:41technoma`TEttinger: is that the one that makes jars that you can run with ./foo.jar?
12:42TimMcconcatenation?
12:42TEttingerit makes .bat files that are also shell scripts :D
12:42TEttingerTimMc, yes
12:42technoma`that's wild
12:42TEttingerit is a very neat trick, it seems to work cross-platform with one file, without appearing to be a jar
12:43TEttingerand without requiring all your users to have double-click-to-open-a-jar set up correctly
12:47fil512what's the best way to change the values in a map?
12:47uvtcThe lein wiki plug-ins page doesn't list lein-bin as being up-to-date for lein2, and neither does the lein-bin readme, however, it looks like Raynes updated it back in March for lein2.
12:47TEttingeruvtc, correct, and it does work with lein2 -- i have confirmed it
12:48sjlcan anyone tell me why the group-by in this Incanter call breaks? http://paste.stevelosh.com/4fbfb702a3ec1b0007000000?clojure
12:48technoma`I think I probably added the compatibility markers to the readme after march
12:48technoma`if you could update that it would be super
12:48sjlwithout the :group-by it plots fine, with :group-by it crashes with: Don't know how to create ISeq from: java.lang.Long
12:49TEttingerfil512, is the map a ref or atom or something?
12:49TEttingeror just a {:foo "bar"}
12:49jedmtnmananyone mind helping a noob with sort-by?
12:49fil512string key, map value
12:50fil512{"foo"
12:50fil512{"foo" {
12:50fil512arrgggg
12:50fil512{"foo" {"a" 1}}
12:50TEttingerhttp://clojuredocs.org/clojure_core/clojure.core/update-in
12:50timvisher_jedmtnman: doesn't hurt to ask ;)
12:50S11001001nDuff: your repl doesn't support file reloading?
12:51fil512this laptop keyboard has a poorly placed enter key... :-/
12:51jedmtnmantimvisher_: is it best just to post a pastie?
12:51eggsbyTIL you can provide an 'else' in map lookups..
12:51timvisher_probably if the code is extended
12:51S11001001nDuff: iff your file was source-loaded, (require :reload 'module.name) should work
12:51eggsby({:a 1 :b 2} :c 3) :o
12:53fil512thanks TEtt that is exactly what I was looking for!
12:53TEttingernp fil512
12:53TEttingerI haven't used update-in yet in my noob code... i probably should...
12:54nDuffS11001001: my repl is into a remote system with no access to my local files.
12:54TEttingerjedmtnman: http://clojuredocs.org/clojure_core/clojure.core/sort-by
12:54TEttingerexamples there help any, jedmtnman?
12:54jedmtnmanTEttinger: yes, was reading there
12:54fil512so for update-in, how can I modify a bunch of nested values at once?
12:54jedmtnmanhttp://pastie.org/3967068 i'm doing something wrong and its probably my misunderstanding of comp
12:55jedmtnmanI want to sort the services based on the values of scores
12:55TEttingercomp is for function composition, right?
12:55jedmtnmanTEttinger: right
12:56timvisher_jedmtnman: it's actually returning the right thing there
12:56timvisher_you're asking it to sort-by the value for the key in scores, and it sorts ascending
12:56jedmtnmantimvisher_: ahhh right *hand palm*
12:57jedmtnmantimvisher_: I just had it in my head higher it first, bc thats the way I want them
12:57TimMcfacepalm, surely
12:57TEttingerheh
12:57jedmtnmanTimMc: lol
12:57jedmtnmanright
12:57TEttingerrev should reverse it, right?
12:58TEttingeroh, http://clojuredocs.org/clojure_core/clojure.core/reverse
12:58jedmtnmanTEttinger: yes
12:58TEttingeroh, rseq may be preferable
12:59jedmtnmandiff being lazy eval?
12:59jedmtnmanTEttinger: ^
12:59timvisher_,jedmtnman: you don't need to do reverse, you can just give sort a comparator
12:59clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: jedmtnman:>
12:59Bronsalol
12:59timvisher_lol
13:00timvisher_,(sort-by identity [3 2 1])
13:00clojurebot(1 2 3)
13:00timvisher_,(sort-by identity < [3 2 1])
13:00clojurebot(1 2 3)
13:00timvisher_,(sort-by identity > [3 2 1])
13:00clojurebot(3 2 1)
13:00timvisher_so for you you'd just need to add the `>` function into the mix
13:00jedmtnmantimvisher_: cool
13:02jedmtnmanthe gt lt operators are the only prefix operators that always trip me up (that i know).
13:03timvisher_same for me
13:03TEttingersame here...
13:04AeroNotixgt/lt prefix is the most natural for me o.O
13:04jedmtnmangfredericks: come up with a mnemonic for us
13:05AeroNotix,how are you?
13:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: how in this context, compiling:(NO_SOURCE_PATH:0)>
13:05AeroNotix,do you need fixing?
13:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: do in this context, compiling:(NO_SOURCE_PATH:0)>
13:05AeroNotix,lol
13:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: lol in this context, compiling:(NO_SOURCE_PATH:0)>
13:05timvisher_AeroNotix: now don't start that again ;)
13:05Bronsawell < is smaller at the head an bigger at the tail :)
13:05jedmtnmanBrona: good call.
13:06TEttinger,(sort-by (comp {"abc123" 2.34, "def567" 1.23} :id) > [{:name "foo", :id "def567"} {:name "bar", :id "abc123"}])
13:06clojurebot({:name "bar", :id "abc123"} {:name "foo", :id "def567"})
13:06AeroNotixSo, I've been away from Clojure for a little while. Are there any web-frameworks for it?
13:06AeroNotix,(+ 1 1)
13:06clojurebot2
13:06AeroNotixoh man, awesome
13:06timvisher_AeroNotix: seems like Noir is the new hotness
13:06TEttingerAeroNotix, Noir looks great
13:06timvisher_i'm using compojure still
13:06AeroNotixI'll check it out, thanks :)
13:06TEttingerClojureScript One looks neat if you want to use CLJS
13:06S11001001web framework, who wants that? every web project needs a custom HTTP server
13:07S11001001optimized for that app
13:07AeroNotixS11001001: You forgot about Node.js
13:07TEttingerright, every framework needs node.js, of course :P
13:07AeroNotixTEttinger: Also, ZERO front-end work without Twitter's bootstrap
13:08TEttingerAeroNotix, what does that?
13:08TEttingerCLJS1?
13:08AeroNotixTEttinger: sorry, what?
13:08TEttingeri was confused by the conversation
13:09AeroNotixNo problem :)
13:09TEttingerthe irony was getting all-encompassing
13:09TEttingeri can't tell if i am being ironically ironic sometimes
13:09AeroNotix:D
13:10TEttingeranyway, Noir is cool. very little code to get up and running, built on solid tools...
13:10TEttingerhttp://www.webnoir.org/
13:10timvisher_beware of the hairball! ;)
13:11AeroNotixTEttinger: thanks :)
13:11AeroNotixis lein/noir in the arch repo?
13:11espeedI defined a method named "get" on a record/protocol which pulls data from the DB, but "get" is a built-in method for records so evidently this causes errors about it already being defined -- is defining method names like "get" on records generally a bad idea?
13:11TEttingerAeroNotix, also, use lein2
13:12AeroNotixTEttinger: thanks again
13:12TEttingerAeroNotix, I don't think it needs to be in arch
13:12TEttingerit is a tiny script...
13:12AeroNotixTEttinger: I've not looked into what it actually is
13:12AeroNotixTEttinger: It's been about 6 months since I touched Clojure
13:12technoma`I think the version in arch is messed up
13:12timvisher_espeed: it's certainly not 'simple'
13:12TEttingerhttps://github.com/technomancy/leiningen/tree/preview/bin
13:12AeroNotixty
13:12technoma`I've had a few bug reports regarding it
13:13timvisher_if you wanted to do that you might be better off with deftype and/or pulling apart the defrecord machinery and doing it by hand
13:13timvisher_or you could just pull the data from the db using a function that returns maps and then use the `map->RecordName` function to turn it into your record
13:15espeedtimvisher: thanks -- I'll rework my design
13:20gfredericks&(for [n (range 7)] (-> n (repeat "`") ((partial apply str)) (str "foo") read-string flatten count))
13:20lazybot⇒ (0 2 8 41 221 1202 6548)
13:24stobixthanks, timvisher_, pandeiro, raek . I'll look into it!
13:31stobixAnother question: I don't think I grasp #( fully. Why isn't (#(%) 3) and ((fn [x] x) 3) doing the same thing?
13:32gtrakstobix, fixed it for you: ((fn [x] (x)))
13:32timvisher_#(%) is trying to call `3` as a function
13:32timvisher_,(#(identity %) 3)
13:32clojurebot3
13:32timvisher_may be what you were thinking of
13:33Bronsa,(identity 3)
13:33clojurebot3
13:33stobixah
13:34timvisher_is there something like macroexpand-1 for reader macros?
13:34hiredmanread-string?
13:34clojurebotread-string |is| as unsafe as eval unless *read-eval* is bound to false.
13:35timvisher_(read-string #(%))
13:35hiredmanclojurebot: fi fi fi
13:35timvisher_,(read-string "#(%)")
13:35clojurebot(fn* [p1__84#] (p1__84#))
13:35clojurebotfib is reply See #haskell
13:35timvisher_stobix: see above
13:36raekor quote
13:37raek,'#(%)
13:37clojurebot(fn* [p1__109#] (p1__109#))
13:37timvisher_raek: ah hah
13:39Bronsa,`s#
13:39clojurebots__136__auto__
13:39stobixtimvisher_: thanks.
13:42stobix,(let [ŭ #(+ 2 %)] (ŭ 3))
13:42clojurebot5
13:46TimMcClo𝑗ure
13:46TimMcHrm, no font support here.
13:47raekI think that character was damaged during encoding in your irc client
13:47raekI received a "U+FFFD REPLACEMENT CHARACTER"
13:48raekCloƷure
13:48timvisher_i saw the character fine
13:48timvisher_i think, at least ;)
13:48raekwhich one was it?
13:48TimMcU+1D459 I think
13:49TimMcraek: I fixed my terminal's Unicode settings.
13:49raekah, I'm not sure my setup handles echaracters in the astral plane correctly
13:49TimMcI had "export LC_ALL=C" from a past project.
13:50raek"U+1D459 MATHEMATICAL ITALIC SMALL L"?
13:50TimMcU+1D457 then
13:50TimMcJ
13:50raekI see :)
13:50raekhrm, I thought I had non-BMP chars working
13:51TimMcIt works in my browser and text editor.
13:51raekhow am I supposed to chat in gothic now?
13:51TimMcOh man, full-width chars do weird things in fixed-width displays...
13:53jayunit100arg irc was acting funny.
13:53TimMcHello!
13:53Bronsalol
13:53jayunit100anyone use relative paths with compojure routing ?
13:56timvisher_anyone have a fix for paredit-forward such that `"this is a test|"` -> `"this is a test"|`?
13:59timvisher_also, is there a standard way to fix the clojure-jack-in repl such that it knows about things like [] and {}?
14:02TimMctimvisher_: C-f :-P
14:02zamaterianjayunit100, i do
14:02timvisher_TimMc: lol
14:02timvisher_not exactly what I had in mind
14:02timvisher_but yes
14:02timvisher_also "
14:03timvisher_but more importantly, the behavior is pretty unexpected
14:04timvisher_("foo bar baz|") (lots) (of) (other) (sexps) (with) (no) (quotes) ("whee!") -> ("foo bar baz") (lots) (of) (other) (sexps) (with) (no) (quotes) ("|whee!")
14:06TimMcohai
14:15tdrgabi1I'm having trouble structuring my noir (first) website. do you guys have an example I could check?
14:15tdrgabi1where to put css, how to read it, how you guys generate html etc
14:15eggsbyhow can I get lein to recognize my /usr/local/lib ? https://www.refheap.com/paste/2873
14:15gf3tdrgabi1: https://github.com/ibdknox/webnoir
14:16austinhtdrgabi1: https://github.com/ibdknox/noir-example
14:16tdrgabi1thank you
14:16technomancyeggsby: :native-path describes where to extract native dependencies found in jars, not where to look for existing native code
14:17technomancyeggsby: have you tried the zeromq native jars?
14:17eggsbyI haven't, I was able to fix it by updating my ld_library_path though, apparently it wasn't listed there...
14:17eggsbynow I'm troubleshooting another issue :)
14:18technomancyeggsby: making everyone who wants to run your code put stuff in /usr/local/lib is annoying =\
14:18technomancybetter if you can make your project self-contained
14:19eggsbytechnomancy: the native zmq deps in clojars, I just add those to my lein deps?
14:19eggsbyand then they don't need to install jzmq or what?
14:19technomancyeggsby: that's how it's supposed to work. haven't tried it for myself.
14:19eggsbyI agree that having to build jzmq locally, include the built jar in lib/ and ensure they have the files in /usr/local/lib/ is a bit of a headache, I just wasn't aware of a better way
14:20technomancyeggsby: it's not very well-documented unfortunately
14:20technomancymostly because not very many projects need it
14:21eggsbyya
14:22eggsbyI'm wondering whether it's worth it to use zmq for pubsub style communication or if I should just use redis
14:22technomancyamqp is another option
14:22eggsbyrabbitmq or something?
14:22technomancyyeah, it's a lot more common on the JVM
14:22eggsbyhm
14:23jayunit100zamaterian: Hey !
14:24jayunit100Im wondering, how can we retain relative path logic when using forwarding in compojure
14:26amalloy(add-hook 'slime-repl-mode-hook (lambda () (setq lisp-indent-function 'clojure-indent-function) (set-syntax-table clojure-mode-syntax-table))) ;; timvisher_
14:28samedhiI am attempting to do a clojurescript build using lein-cljsbuild, I am getting a "ERROR: JSC_MISSING_PROVIDE_ERROR. required "jayq.util" namespace never provided at ..."
14:29samedhiHow do I add the jayq.util namespace?
14:32lynaghksamedhi: you have jayq in your projects.clj?
14:32timvisher_amalloy: lot's of promise but that doesn't seem to do the trick
14:33amalloycheck with technomancy about the implications of jack-in bootstrapping its own version of slime, then, i guess; it works for me with a manually installed slime
14:34timvisher_gotcha
14:34timvisher_thanks for the pointer
14:35timvisher_do you fix the repl technomancy?
14:36technomancyno
14:37technomancyI never write more than a line directly into a repl buffer, so indentation has never been an issue
14:37timvisher_is your workflow more typing into a buffer and then evaling forms?
14:37technomancyyeah, anything complicated goes in the file
14:38timvisher_interesting
14:38timvisher_that's not a bad idea, i suppose
14:39amalloyplus, in a source buffer you can use paredit without every dang RET sending your form to the repl
14:39amalloyhaving to remember to type C-j instead is a hassle
14:40hiredmanI just want paredit to work in the source blocks in org-mode
14:41samedhilynaghk, actually, no. I am using shorleave, which uses noir. Is there any good way to find out who is requiring jayq?
14:42samedhiI figure if somebody needs create, they would have put it in their requirements, but I will try just adding it myself.
14:42timvisher_amalloy: true, what I'm really looking for is the motion commands
14:43timvisher_i rarely type something that I really need over more than a line or two at the repl
14:43uvtcsamedhi, `lein deps :tree`
14:43timvisher_but moving around inside whatever i'm typing is annoying
14:43amalloywhich ones? C-M-f and C-M-b work already, and if you're working on small forms i can't see up/down being that useful
14:43timvisher_those specifically
14:44timvisher_for me the don't know how to skip over [ and {
14:44timvisher_yay!
14:44uvtcsamedhi, oh wait. cljs? n/m then --- that may've been gibberish.
14:45amalloytimvisher_: did you restart your repl after adding the hook i suggested? it wouldn't apply retroactively
14:45timvisher_https://gist.github.com/2789754
14:45timvisher_well, there were a number of problems with what i was doing
14:45timvisher_i don't load slime out of the gate
14:45timvisher_nor paredit
14:45timvisher_so i needed to put it in an eval-after-load form
14:46timvisher_and then the lambdas were screwed up somehow
14:46timvisher_so I needed to pull those out
14:46timvisher_but now it seems to work fine
14:46timvisher_although i think that fix-paredit-repl should no longer be necessary
14:46amalloyright, it shouldn't
14:46timvisher_considiring your clojure-mode-syntax-table dealio
14:47amalloyalso, why three lambdas in a hook, instead of a lambda with three expressions?
14:47timvisher_feels better to me? ;)
14:47lynaghksamedhi: I don't know how ready Paul is for people to be using shorleave. If it's using jayq, it should be defined somewhere in shoarleave's project.clj (or one of its dependencies) and picked up automatically
14:48Borkdudebanseljaj: maybe you should add a rationale of the linux distro and why Lambda… Leinux was way cooler ;)
14:49banseljajBorkdude: I lost access to the list here. I'll update it now. :D
14:49samedhilynaghk, uvtc, fair enough, here is my tree http://pastebin.com/qf0SME1U .
14:50samedhiI was actually fine with fetch (ibdknox) but using cljs-noir seemed to always downgrade me to clojure 1.3.0, and datomic is 1.4.0
14:50Borkdudebanseljaj: one of the reasons I would like to have it, is for example, I don't want to download eclipse, install plugins etc, only to try it out, a preconfigured beast is much easier
14:51lynaghksamedhi: yeah. I forked fetch last time I used it to drop the noir dependency
14:51Borkdudebanseljaj: actually I use eclipse, but for netbeans / intellij with preconfigured plugins and projects to try out, would be nice
14:52Borkdudebanseljaj: also a preconfigured clojurescript setup is much needed I think for people to just try it out
14:52samedhilynaghk, and so you are just running directly on ring/compojure or something?
14:52lynaghksamedhi: yep.
14:53timvisher_and then there were 3 https://gist.github.com/2789801 amalloy, technomancy
14:53lynaghkit's not something I want to support though, which is why I never made a library out of it. I'll probably use shoarleave next time it comes up.
14:53samedhilynaghk, and without noir you can use 1.4.0?
14:54banseljajBorkdude: Crap. I forgot about clojure script. :(
14:54banseljajWell, so far the distro is about 1GB
14:54uvtcBorkdude, banseljaj : I was just thinking the other day, "What's the easiest way to draw simple lines & shapes with Clojure?". Then I guessed, "oh, probably using Clojurescript and html5 canvas" or somesuch, but I haven't yet tried that. Not sure how much installing/configuring it would take to set up something like that.
14:54technomancyuvtc: I'd say quil is definitely the easiest to get started with
14:55banseljajuvtc: Once almbda is up, 0 minutes. :D
14:55kilon_aliosquil ?
14:55uvtchttps://github.com/quil/quil I presume.
14:55lynaghksamedhi: there is nothing noir specific in fetch, so yeah. It's easy to split out and just throw the same functionality together on compojure (or whatever)
14:55timvisher_most definitely + 1 for quil
14:55technomancybanseljaj: the suggestion to use nix on the mailing list is interesting; it would allow you to offer something that people could use with their current OS rather than switching to something completely new.
14:56lynaghkuvtc: Use C2 to generate SVG in Clojure or ClojureScript =)
14:56dnolenuvtc: quil is probably the easiest, though working w/ canvas from CLJS not particularly challenging.
14:56uvtctechnomancy, thanks for the heads-up about quil.
14:56uvtclynaghk, C2?
14:57kilon_aliosprocessing is the most pythonic non pythonic library out there :D
14:57lynaghkSame idea as D3.js: http://keminglabs.com/c2/
14:57banseljajtechnomancy: Yeah. That's the point.
14:57kilon_aliosthanks for the quil suggestion
14:57lynaghkuvtc: it's for working with the DOM, though. Depends if you prefer drawing with that scenegraph or rolling your own and using canvas.
14:57dnolenkilon_alios: pythonic? :) Processing is one giant regex conversion to a Java program.
14:57uvtcOh my. Here's an idea for anyone who wants it: set up a site that allows users to run clojure code to draw their own picutures.
14:58technomancybanseljaj: nix already has eclipse, leiningen, and a bunch of what you want. if you can get the rest in there and create a metapackage that pulls in the basics, that would be very slick
14:58kilon_aliosdnolen: it is, i did not know that, i only have glanced through the library, it looked to me very simple
14:58banseljajtechnomancy: I have that, but making that metapackage for every distro would be too much time
14:58uvtclike http://tryclj.com/ , but with support for simple drawing.
14:59technomancybanseljaj: well that's the thing, if you make a nix metapackage it should work everywhere nix is supported
14:59banseljajI'm thinking I can use Lambda as a general Programmer's linux. With flavors for Haskel, Ruby, Python etc.
14:59banseljajtechnomancy: Hmm.
14:59uvtclynaghk, I'm talking about a box with x,y coords in it that lets you draw lines and shapes using those x,y coordinates.
14:59technomancybanseljaj: nix co-exists with existing OS-level package managers
14:59technomancyso people don't have to ditch what they're used to
15:00Borkdudebanseljaj: technomancy who came up with this idea anyway? does that person get any credits? :P http://clojure-log.n01se.net/date/2012-05-20.html#13:32c
15:00banseljajAnd bash scripts can set up all the environments.
15:00lynaghkuvtc: if you want to draw from clojurescript immediately, you can use Himera to mess with the browser window it's running in
15:01banseljajBorkdude: Who are yoU? I don't even know you. ::P
15:01technomancybanseljaj: also possibly relevant as prior art: https://github.com/Seajure/emacs-clojure-vagrant
15:01timvisher_Borkdude: You should start a kick starter campaign ;)
15:01banseljajA kickstarter for a linux distro. :D
15:01banseljajLOL
15:01Borkdudetimvisher_: hell no, I'd rather let banseljaj do all the work for me ;)
15:02timvisher_oh well, you know, this is the year of linux on the desktop, after all
15:02Borkdudetimvisher_: how is that?
15:02nDuffagain?
15:03timvisher_Borkdude: http://en.wikipedia.org/wiki/Desktop_Linux#Year_of_Desktop_Linux
15:03uvtclynaghk, thanks for the tip about himera.
15:04kilon_aliosisnt Desktop dead ? :D
15:04Borkdudetimvisher_: actually I run linux and windows in vms now, my main os is osx since a year
15:05timvisher_i can't wait till i read some tech report about the year of linux on the cloud
15:05timvisher_completely missing the fact that most of the web is run on LAMP stacks
15:05kennethhey, so i take it there's a better way to average things than this… (-> (map (fn [e] [e 1 0]) coll) (reduce (fn [a b] (let [sum (+ (first a) (first b)) cnt (+ (second a) (second b))] [sum cnt (/ sum cnt)]))) (apply (fn [cnt sum avg] avg)))
15:05Borkdudetimvisher_: hehe
15:05banseljaj,(-> (map (fn [e] [e 1 0]) coll) (reduce (fn [a b] (let [sum (+ (first a) (first b)) cnt (+ (second a) (second b))] [sum cnt (/ sum cnt)]))) (apply (fn [cnt sum avg] avg)))
15:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: coll in this context, compiling:(NO_SOURCE_PATH:0)>
15:06Borkdudekenneth: yes, use the reducer library
15:06kenneth(also it doesn't work, but that's a different problem)
15:06timvisher_,(let [coll (take 10 (iterate inc 1))] (/ (apply + coll) (count coll))))
15:06clojurebot11/2
15:07Borkdudetimvisher_: that reminds me of the thing we get a lot with students: "why do we have to do all this java crap, I can do this in PHP in 5 minutes"
15:07kennethoh smart
15:08timvisher_lol
15:08timvisher_did i do that right?
15:08amalloyit's not actually trivial to do that with reducers, is it?
15:08timvisher_long week…
15:08Wild_CatBorkdude: I'm assuming "this" is "an SQL injection vulnerability", right? :p
15:08timvisher_amalloy: i didn't spot a way to do it immediately
15:08timvisher_hense that code
15:08amalloyyou need to either look at the collection twice (once to count and once to sum), or else reduce over a pair
15:09timvisher_i have a niggling feeling you could
15:09kennethso is (apply + coll) faster than (reduce + coll)?
15:09Borkdudeamalloy: I guess you are right, average isn't really a good function you can parallelize I guess
15:09amalloyBorkdude: no, a reducing implementation will naturally also be foldable with just a little more work
15:09timvisher_kenneth: often have i asked myself that very question
15:10Borkdudeamalloy: yes, with a little more work
15:10Borkdudekenneth: timvisher_ why would it be faster
15:10amalloy&((fn average [coll] (apply / (reduce (fn [[sum count] item] [(+ sum item) (inc count)]) [0 0] coll))) (range 10))
15:10lazybot⇒ 9/2
15:11uvtclynaghk, C2 looks very interesting for data visualization. Will keep that in-mind. Though, for simple drawing, I'll probably look into quil and/or dealing with html5 canvas.
15:11amalloythat would work as a reducer, but i think the fact that it has to allocate a new pair at every iteration makes it little faster (no faster?) than the lazy-seq approach
15:11timvisher_Borkdude: no reason. I simply think of that because they both seem to be doing the same thing. variadic functions seem to always be able to use reduce rather than apply
15:11drewrtlowrimore: regards
15:12timvisher_is it possible to apply to + with a billion arguments?
15:12tlowrimoredrewr: hey man!
15:12kilon_aliosuvtc: also this -> http://processingjs.org/
15:12timvisher_is apply really just reduce under the hood?
15:12timvisher_i've never bothered looking beyond that
15:12kilon_aliosif you are into processing that is
15:12Borkdudetimvisher_: no
15:12amalloytimvisher_: that's rubbish. lots of variadic functions don't use reduce
15:12timvisher_lol
15:12timvisher_i didn't say they did
15:13timvisher_i'm saying i've never bothered looking
15:13amalloy"I simply think of that because they both seem to be doing the same thing. variadic functions seem to always be able to use reduce rather than apply"
15:13BorkdudeWild_Cat: haha
15:13llasramtimvisher_: apply isn't reduce, but may functions (including +) which accept unbounded sequences of arguments use reduce in their impl
15:13llasrams,may,many,
15:13timvisher_amalloy: that was meant of their use not their implementation
15:14amalloytimvisher_: right, but it's rubbish in that context too
15:14timvisher_i.e. (reduce + coll) and (apply + coll) always do the same thing
15:14amalloyit's true for + and *, and not a lot else really
15:14timvisher_ah, well, i've never really thought to use it anywhere else that takes variadic arguments
15:14AimHereIsn't there a chatlog where Rich Hickey says that reduce is the better way to do it, since it's possible it gets optimized better
15:14uvtckilon_alios, thanks (for the link to processing.js).
15:14timvisher_AimHere: Google!
15:14banseljajtechnomancy: that vagrant thingie looks like what I was going for. I am sad. :(
15:14amalloyAimHere: it depends
15:15amalloyfor +, you get a teeny tiny boost using reduce
15:15technomancybanseljaj: don't be sad; there's plenty of opportunity to improve it.
15:15S11001001it's true for any monoid where append being strict is okay
15:15amalloyfor str, you get a pretty big boost using apply
15:15timvisher_What's an example of a function that you can't use reduce for but you can use apply?
15:15technomancybanseljaj: it's pretty bare-bones
15:15amalloytimvisher_: assoc, for example
15:15banseljajYes.
15:15Borkdude,(reduce print ["a" "b" "c"])
15:15clojurebota bnil c
15:15Borkdude,(apply print ["a" "b" "c"])
15:15clojurebota b c
15:15kilon_aliosuvtc: your are welcome , though there are a gazillion of similar libraries for javascript ... web dev is going nuclear lately with ios and android, and there does not seem to be a slow down
15:16banseljajAlso, what's SLIME?
15:16timvisher_well i'll be
15:16timvisher_:)
15:16AimHereSlime is a lisp mode for emacs
15:16banseljajIs it something other than clojure-mode?
15:16AimHereYes, it's like 'inferior-lisp' only much better
15:16kilon_aliosSlime is what makes emacs into an IDE
15:16timvisher_banseljaj: Please watch https://www.youtube.com/watch?v=_B_4vhsmRRI
15:16timvisher_and be amazed ;)
15:17technomancybanseljaj: clojure-mode is just static; slime connects to a running process
15:17AimHereIt has it's own repl
15:17AimHere*its
15:17timvisher_but don't take his advice of working with the cvs version
15:17banseljajOh.
15:17timvisher_just use technomancy's version
15:17banseljajso it lets you test running code?
15:17timvisher_swank-clojure
15:17timvisher_way way more than that
15:17Borkdudeat #euroclojure people saw Rich is still using inferier-lisp
15:18timvisher_https://github.com/technomancy/swank-clojure
15:18technomancyis he still on aquamacs? =(
15:18AimHereThink of it as leveraging emacs into your own little lisp machine
15:18timvisher_Rich never struck as a tool-hound :)
15:18Borkdudeinferior
15:18timvisher_struck me*
15:19nDuffBorkdude: emacs terminology -- "subprocess", roughly
15:19technomancytimvisher_: it took a lot of doing to get him off svn
15:19amalloytechnomancy: rich probably lost a bet, and is required to troll the developer community by pretending aquamacs is cool
15:19BorkdudenDuff: inferior is not to say: the lisp you are going to use now is way worse then elisp? ;)
15:19technomancyamalloy: doubtless
15:19AimHereInferior mode, not inferior lisp ;)
15:19AimHereDespite the name of the mode being 'inferior-lisp
15:20nDuffBorkdude: correct. The emacs world also refers to "inferior haskell", "inferior shell", etc.
15:20amalloyit's inferior because it's not Superior Lisp Interaction Mode for Emacs
15:20technomancyinferior just means subprocess
15:20timvisher_amalloy: troll!
15:20kilon_aliosits inferior because humans use it, superior is used only by god
15:20Borkdudeamalloy: got it
15:20technomancyin this case it applies in both senses, but that's a coincidence =)
15:20kilon_aliosor aliens
15:20nDuffBorkdude: ...err, amalloy was trolling there.
15:20timvisher_in this case (= emacs god)
15:21kilon_aliosdepending on your theory of creation of cosmos
15:21AimHerePresumably inline elisp is the egalitarian lisp mode for emacs
15:21amalloynDuff: not really. it might not be the right interpretation, but it's a reasonable one
15:21BorkdudeI guess S being superior is kind of a pun toward inferior-lisp mode?
15:21kilon_aliosgod does not use shortcuts, he is everywhere so your point is wrong
15:21nDuffamalloy: ...except that the words "inferior" and "superior" are used in the rest of the emacs world pretty much all over the place to refer to relative process-tree locations
15:22timvisher_technomancy: i always remember that his comment when asked about re-implementing clojure in clojure was: "You know that thing about when you have something that works?"
15:22timvisher_if i could learn that i think my life might be a lot cleaner
15:22timvisher_^_^
15:22uvtcThe Emacs inferior mode is just letting me connect to the same repl I get with `lein repl`, but within Emacs, correct?
15:23technomancyuvtc: yeah, it's just easier to send code straight to it w/o copy/paste
15:23AimHereWell that plus you can talk to it from other emacs buffers
15:23timvisher_uvtc: you have to configure it to do that
15:23kilon_aliostimvisher_: well after learning smalltalk, i kinda have to disagree with that point, a lot
15:23timvisher_kilon_alios: which one?
15:23uvtctimvisher, I have to configure it specifically to use the `lein repl`, right?
15:23timvisher_yep
15:23kilon_aliostimvisher_: squeak and pharo
15:23ideally_worldtimvisher_ it works ? until it doesn't? :)
15:24technomancytimvisher_, uvtc: not any more; it'll use lein repl now by default
15:24timvisher_M-x customize-group inferior-lisp inferior-lisp-program
15:24beffbernarduvtc: (setq inferior-lisp-program "lein repl")
15:24kilon_aliosthe ability to deep dive inside the language not to change it but so much to understand has been always helpful
15:24timvisher_technomancy: how'd you swing that, you tricksy magician?
15:24uvtcOk. I need to try out this "inferior mode" of which you speak.
15:24technomancytimvisher_: I bribed jochu.
15:25timvisher_of course…
15:25Borkdudetechnomancy: what uses lein repl by default?
15:25timvisher_kilon_alios: ah
15:25timvisher_point cedede
15:25timvisher_ceded*
15:26kilon_aliosthe problem is rewriting a existing language in itself is not that well... simple task
15:26technomancyBorkdude: M-x run-lisp from clojure-mode
15:26Borkdudetechnomancy: ah k
15:26kilon_aliosand certainly not absolutely necessary, i would prefer a Clojure ide written in Clojure than Clojure written in clojure
15:26Borkdudetechnomancy: so, this is easier than slime-connect, etc?
15:27timvisher_Borkdude: nothing's easier than `clojure-jack-in`
15:27timvisher_;)
15:27technomancyBorkdude: not really in most cases
15:27Borkdudetimvisher_: you have to be in a project to do that
15:27Borkdudetimvisher_: right?
15:27ideally_worldkilon_alios, reading the Java code for Clojure and there's a bunch of Clojure functions floating around in there in Java land
15:27technomancyI guess there is one step fewer and not as many moving parts
15:27timvisher_anywhere in the project space
15:27timvisher_but yeah
15:27Borkdudetimvisher_: a lot of times I just want to spin up a repl and throw things at it from emacs
15:28kilon_aliosby the way is there such a thing, a Clojure IDE (GUI) written in Clojure , free and open source ?
15:28timvisher_mmm. in that case inferior lisp ftw
15:28amalloy$google clojure clooj
15:28lazybot[arthuredelstein/clooj · GitHub] https://github.com/arthuredelstein/clooj
15:28Borkdudekilon_alios: it is called Clemacs, and you are starting tomorrow
15:28technomancythere's no reason jack-in can't work outside a project; just nobody's cared enough to implement it
15:28amalloy(inc Borkdude)
15:28lazybot⇒ 1
15:28timvisher_technomancy: I care!
15:29timvisher_but not enough to implement it…
15:29technomancyhaha; exactly
15:29AimHerekilon_alios, well seesaw is just a bunch of clojure bindings for seesaw, written in clojure and free and open source; I don't know if that counts as 'written in Clojure'
15:29kilon_aliosBorkdude: i said Clojure not common lisp
15:29AimHere*bindings for swing
15:30kilon_aliosamalloy: thanks
15:30Borkdudecljmacs then
15:30kilon_aliosclooj looks like a very good start
15:32uvtckilon_alios, Climacs == Common Lisp Emacs. Clemacs is the Clojure-based emacs-alike that you've apparently begun work on. ;)
15:32kilon_aliosoh i suppose to make it eehhh :D
15:32p_lClojmacs
15:32kilon_aliosI have not even coded a line of Clojure yet, still reading docs :D
15:33Borkdudecljpad
15:33Borkdudeneh
15:33p_lViclj
15:33kilon_aliosi am amazed how fast this language become popular
15:33BorkdudeI'm trying to run clooj
15:34BorkdudeI get a maven error, it can't find clojure 1.3.0.. huh?
15:34p_lkilon_alios: power of the internet and certain changes in environment that let alternatives to PHP/perl become available on cheap
15:34technomancyBorkdude: missing group-id?
15:35kilon_aliosi think the alternative to java and javascript seems a lot more appealing than php/perl
15:35Borkdudetechnomancy: http://twitpic.com/9p5f6i/full
15:35technomancyBorkdude: missing group-id.
15:36Borkdudetechnomancy: ic, this worked in lein1 then?
15:36p_lkilon_alios: previously, you couldn't get java either
15:36ideally_worldIs it correct to say that all Clojure functions implement IFn?
15:36kilon_aliosp_l: clojure did not work with java ?
15:36technomancyBorkdude: lein1 had a special case
15:36Borkdudewow it runs
15:36p_lkilon_alios: no, you couldn't get hosting that would let you run java on the cheap either. Or that provided a shell :)
15:37technomancyspecial cases kinda suck
15:37gfredericks,(map (partial instance? clojure.lang.IFn) [#(%) {} [] ()])
15:37kilon_aliosp_l: you mean web dev or desktop as well ?
15:37clojurebot(true true true false)
15:37Borkdudeah file -> unable to save
15:38technomancygfredericks: or just ifn
15:38gfredericks,ifn
15:38clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ifn in this context, compiling:(NO_SOURCE_PATH:0)>
15:38timvisher_anyone have any experience working with rar files from java?
15:38technomancyifn?
15:38gfredericks,ifn?
15:38clojurebot#<core$ifn_QMARK_ clojure.core$ifn_QMARK_@1a79947>
15:38gfrederickstechnomancy: you and your fancy "functions"
15:39Borkdudeit's a bit weird, highlighting works in the repl, but not in the source editor
15:39technomancyhttp://www.threadbombing.com/data/media/4/hellomrfancypants.jpg
15:39banseljaj,zero?
15:39clojurebot#<core$zero_QMARK_ clojure.core$zero_QMARK_@2c06a9>
15:39gfredericks,(map (juxt fn? ifn?) [#(%) {} [] ()])
15:39clojurebot([true true] [false true] [false true] [false false])
15:39banseljaj,(doc juxt)
15:39clojurebot"([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
15:40Borkdudetechnomancy: ok you're right, special cases sometimes confuse users also
15:41gfredericksideally_world: I don't know why not
15:41Borkdudeclooj is more of an idea than an IDE right now ;)
15:41gfredericksIDEa
15:41amalloyideally_world: yes, all functions implement IFn - that is exactly the definition of a function, in clojure
15:42Borkdudeclooj in Dutch means something like "fool around"
15:42Borkdude,(ifn? {:a 1}) ;;=> true
15:42clojurebottrue
15:43Borkdudehmm...
15:43Borkdude,(doc ifn)
15:43clojurebotCool story bro.
15:43gfredericks,(doc ifn?)
15:43clojurebot"([x]); Returns true if x implements IFn. Note that many data structures (e.g. sets and maps) implement IFn"
15:43Borkdude,nil
15:43clojurebotnil
15:43gfredericks,,,,,,,,,,,,,,,,,,,,,,:.,,,,,,,,,,,,,,,,
15:43clojurebot:.
15:44gfredericks(braille in clojure)
15:44gfredericksaka brojure
15:44TimMc/trout gfredericks
15:44Borkdudewhy do I get (doc ifn) => nil, but when I just eval "ifn" it can't resolve the symbol
15:44Borkdude(I know, without the ?)
15:44gfredericksBorkdude: doc doesn't creash if you give it something undefined
15:45gfredericksit's a macro, so it doesn't have to eval the arg
15:45gfredericks,(source doc)
15:45clojurebotSource not found
15:45Borkdudegfredericks: so it doesn't distuinghish between unresolvables and var that just don't have documentation
15:46Borkdude&(source doc)
15:46lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
15:46Borkdudewhy!!!
15:46Borkdudeoh well
15:47amalloy~def doc
15:48TimMc&(let [⠠⠓⠑⠇⠇⠕ "hi"] ⠠⠓⠑⠇⠇⠕)
15:48lazybot⇒ "hi"
15:48gfrederickshmm
15:48TimMcgfredericks: ^ No. *That* is brojure.
15:48gfredericks*** trout: Unknown command
15:49Borkdudeamalloy: that's a cool command
15:49gfredericksI couldn't figure out based on the source why it doesn't crash on (doc foo)
15:50gfredericksbut I was looking at 1.3 code I think
15:50gfredericksno 1.2
15:50Borkdudegfredericks: TimMc when I didn't read the braille thing, I thought brojure was clojure written by brogrammers
15:51amalloythat's a really old blob that clojurebot just linked to
16:14Borkdude,(doc clojure.xml/parse)
16:14clojurebotHuh?
16:14Borkdudemy REPL hangs when I tried this..
16:15Borkdudenot in an outside project repl.. nm
16:29Borkdudehttp://i.imgur.com/Mev10.jpg
16:32Borkdudeam I the only one to find function composition and the order of tunctions in comp counter-intuitive?
16:33BorkdudeI know it is how it is generally notated in calculus, Haskell, etc, but still
16:34amalloy((comp a b c) x) => (a (b (c x)))
16:34matthavenerjust use ->>
16:34matthavenerisn't it just comp with args reversed?
16:35amalloyno
16:36solussdis it the fact that clojurescript macros are really clojure macros that expand into clojurescript code the reason for the 'use-macros' declaration for ns?
16:36Borkdude(-> x a b c) instead of ((comp c b a) x)?
16:36S11001001-> works if a b c name non-function things
16:37S11001001that is, comp is the true functor map for functions, whereas -> is a syntax rewriter
16:37amalloy-> is a replacement for comp only if you're using named functions, and immediately calling the function you create
16:38dnolensolussd: pretty much
16:39Borkdudeanyway, I always have to look up the docs for comp to remember what function is applied first, but it might be just me :)
16:41Borkdudehas anyone here ever had the need to use "while" in clojure?
16:43S11001001didn't even know it existed for like first year
16:43lypanovdnolen: for me it made sense mainly because you get clojure specific context. e.g. system/getenv
16:44dnolenideally_world: the core data structures are in sunlight of Clojure in ClojureScript
16:44lypanovuntil i knew that defmacro needed to be in .clj i didn't expect it possible to use that from cljs
16:44jedmtnman1is there a better, or more idiomatic way, to do the following? http://pastie.org/3968068
16:45amalloyi used `while` recently, but it's pretty rare
16:45technomancyclojure has while?
16:45dnolenlypanov: macros are external because client oriented target like JS benefits little from hosting the compilation environment.
16:46lypanov*nod*
16:46Borkdude,(doc while)
16:46clojurebot"([test & body]); Repeatedly executes body while test expression is true. Presumes some side-effect will cause test to become false/nil. Returns nil"
16:46lypanovtechnomancy: my thoughts exactly.
16:46technomancywe should get kibit to yell at while users =)
16:48Borkdudetechnomancy: isn't (while true ..) useful for writing REPLs or do you prefer the longer (loop [] (… (recur)))
16:48technomancyBorkdude: you have the repl input changing for each recursion, so IMO loop is better
16:49lypanovdnolen: is :foreign-libs okay to be used for including .js with closure library code?
16:49TimMcThe latter allows you to carry local state.
16:49lypanovdnolen: seems to work fine but didn't expect that :)
16:49Borkdudetechnomancy: yes, I agree actually :)
16:49dnolenlypanov: that's what it's for I thought
16:49technomancyeven better, if your whole function is the loop then it's just a call to recur
16:49lypanovdnolen: aha! that explains. thx :)
16:50Borkdudeyes, I wonder if someone has ever used while in a good way in Clojure
16:51lypanovoops. ignore
16:51Borkdudeclojure 1.5, new features: while is no longer supported ;-)
16:52S11001001I wish ignore was in clojure.core
16:52uvtcjedmtnman1, that looks good to me, though I'm still pretty new to Clojure.
16:52BorkdudeS11001001: what's ignore?
16:53S11001001(constantly nil)
16:54S11001001yet we have if-not
16:54amalloy(while (not @stop) (do-stateful-work)) ;; run this on a background worker thread
16:55uvtcif-not java.util.Date., when?
17:00TimMcuvtc: I just got that. >_<
17:01uvtcTimMc, :) If not you, who?
17:10Borkdude,(time (for [some (rest [])] \ ))
17:10clojurebot"Elapsed time: 1.222 msecs"
17:10clojurebot()
17:17lypanovanyway around using clojurescript with goog.dom.query?
17:20emezeskelypanov: what do you mean "around"?
17:20lypanovas in, online :)
17:20lypanovoh
17:20lypanov"anyone around"
17:20lypanovhehe
17:21emezeskeAh, that makes more sense!
17:26fil512with update-in can I modify a bunch of nested values at once?
17:26emezeskelypanov: ^_^
17:26lypanovand https://groups.google.com/forum/#!msg/clojure-dev/TiJGSmM1gTo/4ysX_JvquLsJ
17:26lypanovbut i have no idea how to use any of this.
17:27lypanovi'm too dumb to do anything more than copy and paste from leiningen partials.
17:27amalloyfil512: sorta
17:27amalloy&(update-in {} [:a :b :c] assoc :foo 1 :bar 2)
17:27lazybot⇒ {:a {:b {:c {:bar 2, :foo 1}}}}
17:28dnolenlypanov: have you look at domina?
17:28dnolenlooked
17:28lypanovdnolen: i'm using jayq for new stuff and played with domina but i release next week and have to get existing code running.
17:29lypanovdnolen: we ran into severe production issue in IE due to "clojure.string.escape = function escape()" in very old clojurescript
17:30dnolenlypanov: what was the problem there? and which versions of IE?
17:30lypanovdnolen: twas ancient. modern don't do it. escape is a js/browser builtin. the above line overrode it.
17:30lypanovt.
17:30lypanovhuh. *stabs colloquy*
17:30dnolenlypanov: I see
17:31lypanovdnolen: anyway now on v short schedule to get code running on top of initial clojurescript release running on current.
17:31dnolenlypanov: cool public project?
17:32lypanovpreviously on rails using my forked clementine gem and built my own jars etc. but not used to the whole dep model in clojure.
17:32lypanovdnolen: libersybooking.com non open source but all production for months already
17:33RaynesMan, colloquy. Hate that thing.
17:33Rayneslypanov: Check out Textual. Excellent client that actually works like a client.
17:33lypanovRaynes: aye. hate/love relationship. use irc once every 2-3 months. no time to learn something new.
17:33RaynesAh, that makes sense.
17:34Rayneslypanov: Adium is an excellent alternative for people who don't use it very often. Not really any learning curve.
17:38lypanovstill utterly lost. anyone any clue how i can use https://oss.sonatype.org/content/groups/staging/org/clojure/google-closure-library-third-party/0.0-1376/google-closure-library-third-party-0.0-1376.jar in a clojurescript?
17:38lypanovproject*
17:43technomancymaybe if you got a better client you'd hang out more on IRC =)
17:43lypanovtechnomancy: yeah, so i'll skip that :P
17:44lypanovdnolen: afaict domino conflicts with pretty much everything else wrt version needed of goog.jar.
17:45lypanovdomina*
17:45dnolenlypanov: you mean domina requires an out of date goog.jar?
17:45lypanovyeah.
17:46lypanovi should just go for custom build. i really need positioning.js fixes that aren't even in the released version.
17:47Borkdudednolen: I'm looking at domina and I think I will certainly use this lib when I will do some clojurescript
17:47lypanovaye, its the nicest one i've seen also.
17:47lypanovnot a big fan of the whole dep on jquery thing.
17:47dnolenBorkdude: it seems pretty cool, sounds like people need to push them a bit on staying abreast of Closure.
17:48dnolenlypanov: yes, as the CLJS ecosystem matures the whole Closure compat code will pay off - dead code eliminate all the parts of the lib dep you don't actually you use.
17:48lypanov"ClojureScript release 0.0-1236 Options" now i get it!
17:48mwillhitehey there - I'm working with condp and trying to figure out what to do with an unwanted argument
17:48mwillhiteplease take a look at the following pastie: http://pastie.org/3968372
17:49lypanovso the cljs versions track the library versions.
17:49BorkdudeRaynes: tnx for the tip, will check out Textual… as I'm having some problems with colloquy
17:49mwillhiteas you can see, when a condition is met, I call a fn, but I don't want the arg that it passes in
17:49mwillhitewhat can I do?
17:49RaynesBorkdude: If you don't want to pay for it and have some experience with xcode, you can build it yourself.
17:49lypanovdnolen: *nod*. 25kb for highly customized google date picker + lots of date logic that i couldn't have even imagined writing in raw js.
17:49mwillhiteand of course as it is now, it throws an Arity error
17:49lypanovdnolen: vs 200kb for unextensible crap that jquery ui provide :)
17:50dnolenlypanov: the jquery plugin scene is abysmal
17:50lypanovdnolen: closure library is scary at first. but the right choice.
17:50lypanovdnolen: main problem is there belief in this whole "theming" concept.
17:50lypanovits like working with AWT again.
17:51amalloymwillhite: just...don't use the :>> or the anonymous function? (condp = response-type "json" (assoc ...))
17:52lypanovdnolen: other thing about the use of clojure compiler etc is that its compilation will always beat the js engines. they can never (for short page life cycle reasons) do what a up front compile process can do.
17:53lypanovemezeske: "I just pushed out lein-cljsbuild 0.1.10, with the sole change being that it depends on ClojureScript 0.0-1236. "
17:53lypanovemezeske: and again you appear :P does lein-cljsbuild do any instant code change things like noir-cljs?
17:53mwillhiteah ahaha, cool thanks amalloy
17:53dnolenlypanov: and what the ClojureScript compiler can do as well :) I'm loving warnings about simple mistakes that plague JS.
17:54lypanovdnolen: *nod*. i jumped on clojurescript before clojure itself so went the closure library via js path for pragmatic "release on time" reasons but regretting now.
17:56lypanovdnolen: any thoughts on clojurescript and FRP btw?
17:56dnolenlypanov: don't know enough about FRP, but something like RxJS for CLJS does sound interesting.
17:56lypanovi'm using knockout.js (like backbone.js etc) heavily and would love a more idiomatic clojure approach to the same issue.
17:57dnolenlypanov: yes some people seem to like knockout.js, haven't looked at it closely enough to have any opinions.
17:58lypanovdnolen: summary: rxjs best for algmic eventing work. ko.js for easy to code frontend.
17:59lypanovdnolen: i at the back of my head have the idea that things like reactive bindings relate heavily to core.logic etc thus the question :)
18:00emezeskelypanov: I don't know a whole lot about noir-cljs. lein-cljsbuild does have an auto mode, where it watches your files for changes, though
18:00dnolenlypanov: yes David Herman brought that up at JSConf.
18:00dnolenlypanov: for high level GUI programming I think that could be very interesting.
18:01BorkdudeRaynes: I don't really have any experience with xcode and I'm running into this error: The identity '3rd Party Mac Developer Application' doesn't match any valid certificate/private key pair in the default keychain
18:01lypanovdnolen: ko.js is a bit more high level. more or less you bind data objects to ui with statements such as text: binding, or style: "invisible" when binding
18:01lypanovthe actual binding process feels like core.logic to me.
18:01RaynesBorkdude: Yeah, I don't remember how I got that working. I also just went ahead and bought the thing for like 4 bucks on the app store.
18:01dnolenlypanov: interesting, I should take a closer look.
18:02lypanovwhen watching the datomic talks i couldn't help feel like i should just be binding it to my ui directly.
18:02technomancyleveraging XCode's crappiness as a revenue stream... brilliant =)
18:02lypanovespecially in a world with application level caches in browser.s
18:03Raynestechnomancy: Yeah, heh.
18:03dnolenlypanov: I know that some very interesting GUI work has been done with AOP + Datalog - perhaps all of this is related ...
18:03lypanovi need to read my joy of clojure book. its sitting on the shelf for 3 months already.
18:04TimMc&(apropos 'rotate)
18:04lazybotjava.lang.RuntimeException: Unable to resolve symbol: apropos in this context
18:04lypanovemezeske: does it push changes to browser or requires reload?
18:11wilfredhhi all
18:11wilfredhI was wondering if anyone could shed some insight on http://stackoverflow.com/questions/10740265/macro-with-anonymous-functions
18:12wilfredhwhich is just asking why you can't do: (-> 4 #(+ % 1) #(- % 1) #(+ % 1))
18:13samedhican cljs only see other cljs files? Is it possible to have cljs require/use a clj file?
18:14amalloywilfredh: there's already a lot of content on that page, and on the two nearly-identical questions linked from it. if you're still having trouble you need to ask a better question than "plz help"
18:14alexyakushevwilfredh: because -> is a macro that has this calling policy: (-> v & args), where each one from `args` is either a symbol that represents a function, or a list, which after macroexpansion would look like: (f v .....)
18:16alexyakushevwilfredh: since #() is a reader macro, it probably gets expanded first - to (fn [x] (+ x 1)) for example, which is a list. So -> simply transforms it to (fn 4 [x] (+ x 1)) which is a nonsense to pass further.
18:18metellusthe page he linked explains why it doesn't work and shows how to fix it
18:19alexyakushevI see now, thank you. But I still think it is a terrible way to do this.
18:21wilfredhamalloy: I'm sorry, I'd felt 'why' was an acceptable question but I don't visit #clojure often. It was just a behaviour counter to my expectations. I hadn't noticed the linked question -- thanks. That one has a more enlightening answer.
18:21emezeskelypanov: Ah, no, it doesn't push them
18:21emezeskelypanov: That would be a cool feature to add though, and not very hard
18:22BorkdudeRaynes: it was actually pretty easy, just turn code signing off
18:22RaynesBorkdude: Cool. :.
18:22lypanovemezeske: noir-cljs has the code, one file. quite easy.
18:24samedhiI have a clojure namespace that I want to use in clojurescript and clojure. I can obviously (use the file in clojure, but how do I (use it in a clojurescript namespace?
18:24wilfredhalexyakushev, metellus: thanks.
18:25espeedhaving to put (refer-clojure :exclude ['get]) everywhere since "get" is a core function is somewhat clunky -- is this what most people do, or is there a better way?
18:25hiredman:require :as
18:26Chiron_Hi, for a project that doesn't have project.clj . how to run lein repl? for example this https://github.com/pallet/upstart-crate I got an exception
18:26Chiron_clojurebot: come fly with me
18:26clojurebotHuh?
18:27lypanovsamedhi: i know you can use macros from clojure in clojurescript. thats all i know.
18:28fil512I've got a map of map of values and need to perform the same operation on all the end-values. Any idea?
18:29technomancy,(doc vals)
18:29clojurebot"([map]); Returns a sequence of the map's values."
18:29fil512{:a {:x 5 :y 6}, :b {:x 7 :y 8}}
18:29fil512say I wanted to inc 1 all those end values
18:29fil512{:a {:x 5, :y 6}, :b {:x 7, :y 8}}
18:30samedhilynaghk, I figure it must be possible, I thought they are basically using clojure code for the majority of functionality, it is just the edges that are connected with some sort of protocol magic, so seems that it must be possible.
18:30samedhiBut I get errors when I try to require. :/
18:30fil512values of :a, :b, :x, :y are unknown at compile time
18:31fil512they're actually strings...
18:31technomancyfil512: any level of nesting or just one?
18:31fil512just one
18:31fil512in actuality, it's host -> week -> uptime
18:32fil512I looked at update-in, but it looks like it's designed to just work on one leaf at a time
18:32fil512I need to modify all leafs
18:33technomancy,(let [m {:a {:x 5, :y 6}, :b {:x 7, :y 8}}] (zipmap (keys m) (for [m2 (vals m)] (zipmap (keys m2) (map inc (vals m2))))))
18:33clojurebot{:b {:x 8, :y 9}, :a {:x 6, :y 7}}
18:33technomancythere's a cleaner solution involving recursion, but for one level that's probably overkill
18:33fil512zipmap eh?
18:33fil512I considered that
18:33fil512it just seems kind of messy
18:34technomancyit's a bit messy; it would be better if map-vals existed
18:34fil512there's no simple way to just change all the leaf nodes?
18:34fil512ya!
18:34fil512that's what I want!
18:34fil512:-)
18:34fil512there's no sort of map-vals?
18:34technomancy(defn map-vals [m f] (zipmap (keys m) (map f (vals m))))
18:34technomancyit really should be in clojure.core, but it's not, so there you go =)
18:34fil512back to zipmap again
18:34fil512just seems sort of unclojurish to use zipmap
18:35fil512but I guess it's what we got.
18:35fil512thanks!
18:35technomancysure
18:35amalloytechnomancy: c'mon, it should take varargs so you can write (map-vals m map-vals inc)
18:36technomancyoh snap
18:36technomancyyes
18:36technomancyamalloy: may I assume useful does this already? =)
18:36Borkdudenow using Textual
18:36amalloyno, map-vals is ninjudd's function and he doesn't have as many cool ideas as i do
18:37amalloypersonally i don't like map-vals enough, philosophically, to want to improve it
18:37technomancyyou prefer the more general map-map?
18:37amalloynaw. i just like into...for
18:37amalloy(defn map-vals [m f & args] (into {} (for [[k v] m] [k (apply f v args)]))) would probably work, right?
18:38technomancyI think so
18:39amalloy&(letfn [(map-vals [m f & args] (into {} (for [[k v] m] [k (apply f v args)])))] (map-vals {:a {:x 5, :y 6}, :b {:x 7, :y 8}} map-vals inc))
18:39lazybot⇒ {:a {:y 7, :x 6}, :b {:y 9, :x 8}}
18:39amalloytechnomancy: okay, i was wrong. map-vals already does that
18:40amalloyand i added that feature myself
18:40technomancytoo clever for your own good
18:41amalloythe version in useful is *slightly* more efficient, because it uses a clojure.lang.MapEntry instead of a vector
18:47BorkdudeRaynes: what about logs in Textual?
18:47BorkdudeRaynes: it's disabled in the menu it seems
18:48RaynesBorkdude: Preferences -> Advanced -> Logs
18:48amalloytechnomancy: i also wrote knit, which is a cousin to juxt, especially useful for maps
18:48BorkdudeRaynes: ah … tnx
18:48amrkold school crt console for todays clojure louge: https://plus.google.com/113913703302067206043/posts/BhMBjS5Kaiw
18:49Borkdudeamrk I saw it on twitter, cool :)
18:49amalloy(let [m {"x" "1", "y" "2"}] (into {} (map (knit keyword #(Integer/parseInt %)) m)))
18:49technomancy,(.deref (promise) 10 java.util.concurrent.TimeUnit/MILLISECONDS)
18:49clojurebot#< MILLISECONDS>
18:50technomancysrsly?
18:50BorkdudeRaynes: so have you written a plugin of any kind to highlight clojure code in Textual?: )
18:50technomancyclojurebot: google glasstty font
18:50clojurebothttp://lmgtfy.com/?q=glasstty+font
18:50technomancyhuh, works for me
18:50RaynesBorkdude: Nope. I don't write applescript.
18:51Raynes$google glasstty font
18:51lazybot[Hacking with Style: TrueType VT220 Font] http://sensi.org/~svo/glasstty/
18:51amalloytechnomancy: the third arg is a not-found value, not a timeunit
18:51amalloyit always waits in ms whether you like it or not
18:51technomancyamalloy: ok, I was thinking of it as being parallel to .get on futures for some reason
18:51technomancyhard-coding to ms makes way more sense; I wish futures did that
18:52lypanovRaynes: good rule. i regret my wasted months learning that.
18:52technomancyor at least defaulted to them
18:52BorkdudeRaynes: ah it uses that for scripting? ok...
18:52amalloytechnomancy: so use deref instead of get for futures too
18:53Rayneslypanov: I once pretended to write some applescript in that I deleted a bunch of stuff from textual's really verbose now playing command.
18:53technomancyamalloy: but I'm so stuck in my 1.2-leaning ways
18:53lypanovRaynes: its hell.
18:53amalloytechnomancy: either way though, probably best to use deref, not .deref
18:53RaynesThe devil, even.
18:53technomancyyeah, realized that right after I pasted that
18:56talioshrm, looks like a killed my tmux ;( doh
18:59talioslooks like arbscht has bailed on joining us for #clojure-lounge today :(
19:02BorkdudeRaynes: I ready Python and Ruby scripts are also possible, haven't found out yet how though
19:02taliosahh and here is arbscht :)
19:05ibdknoxyou know what might be really interesting? a CLJS impl the emits go
19:05ibdknoxthat*
19:06Borkdudeibdknox: why specifically?
19:06ibdknoxgo routines and the potential to use the type safety as a safety net
19:07ibdknoxstartup time
19:07ibdknoxand it actually has a fairly solid base library to build off of
19:07Borkdudeibdknox: and compile to native code?
19:07ibdknoxyup
19:09ibdknoxI wonder how things would evolve if the Clojure worked on a host with extremely cheap threads
19:16dnolenibdknox: go routines don't really seem like a good fit for Clojure thought right?
19:16dnolenthough
19:16ibdknoxI don't know that I would say that
19:16ibdknoxbut I honestly have no idea
19:16dnolenibdknox: no reads
19:18ibdknoxtrue
19:18dnolenibdknox: which is a horrible fit :)
19:19dnolenibdknox: I also thought fork/join basically gives you something akin super cheap threads.
19:20ibdknoxdnolen: haven't looked into it really, so it could very well be exactly that
19:20taliossweet - webnoir/lein project using my HalBuilder library - already rocking the clojure lounge
19:21hiredmandnolen: fork/join is, from what I have seen, just an evolution of the executor framework, their aren't any magic changes to the jvm or something
19:21hiredmanit is still threadpools and tasks
19:21hiredmanjust more composable
19:21technomancywe'd have to go back to Java 1.1 or whatever to get green threads =)
19:22hiredmanugh
19:22ibdknoxI just like the idea of a platform built with concurrency in mind
19:22ibdknoxand having automatic constructs for asynchrony
19:23hiredmanhanging out in #go-nuts for a few days was enough to cure me of any interest
19:23ibdknoxlol
19:23ibdknoxwhy's that?
19:24hiredman"hey, can I use this instead of php?"
19:24ibdknoxas
19:24ibdknoxah*
19:24technomancyand they have this whole aura of "Go is the thing that makes static typing not horrible!" as if they invented inference or something.
19:25hiredmanit doesn't have the clean feeling from a functional language, or the light feeling of a dynamic language
19:25hiredmanwhich, I guess is subjective
19:25BorkdudeGo is to C what Scala is to Java?
19:25dnolenibdknox: it's not clear to me that Go offers anything over Clojure's constructs, but what do I know - I'd be interested in seeing side-by-side translations.
19:25hiredmanI think I signed up for a go workshop at strangeloop? I forget
19:26dnolenibdknox: the whole write / compile / run your programs completely disinterests me.
19:26ibdknoxdnolen: yeah, didn't think through that bit.
19:27dnolenibdknox: I downloaded it a while back all excited, but then I realized it's the standard C workflow.
19:27dnolendelete
19:27hiredmanand there isn't enough adoption of Go for it to be a nice target platform in terms of "reach"
19:28ibdknoxdnolen: heh, it kills me going back to that now
19:28ibdknoxdnolen: node and python seemed like ancient technologies to me
19:28technomancyno repl?
19:28ibdknoxdynamic evaluation of some kind
19:28hiredmanin 2012, can you believe it?
19:28dnolentechnomancy: I don't think so.
19:28hiredmaneven C# has a repl these days
19:29ibdknoxsrsly
19:29technomancyand mirah just got a repl like a week ago
19:29dnolentechnomancy: certainly wasn't one the last time I tried.
19:29technomancygeez
19:29ibdknoxI think it's more than just a repl
19:29ibdknoxpython has a repl, but its facilities for doing dynamic things are half-baked at best
19:30ibdknoxI had to do some hackery to make my flask thing in Light Table work
19:35Borkdudeclojure 2 F#: http://msdn.microsoft.com/en-us/library/dd233250.aspx
19:36BorkdudeI don't know of what use that would be though… ;)
19:42Borkdudedoes anyone know if Lisp in the Tiobe index (http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html) includes Clojure?
19:43RaynesI think it does.
19:43RaynesActually, apparently not.
19:43scottjBorkdude: says lisp #15 and clojure #77
19:43Borkdudeyes, what do they mean with "Lisp" then?
19:44scottjcommon lisp
19:44RaynesAnd scheme, I think.
19:44RaynesOr not..
19:44RaynesDamn it.
19:44RaynesI thought they said they combined those at some point.
19:44kwertiiA lot of non-Lisp programmers seem to think that Lisp == Common Lisp
19:45BorkdudeIt's not entirely clear
19:45Rayneskwertii: And it makes me want to strangle kittens.
19:45scottjBorkdude: what, if anything, the TIOBE index even means is not entirely clear
19:46Borkdudescottj: true
19:48austinhAre JDBC errors considered opaque, programmatically, or does anyone actually dispatch on their types or fields?
19:48austinhs/errors/exceptions
19:50austinhI'd like to distinguish between a duplicate key violation and other exceptions, for example.
19:51austinhBut the only difference I see is a human readable description of the error.
19:53kwertiiaustinh: They're coded with both SQLState and implementation-specific error codes (at least, they're supposed to be as per the spec; no idea whether specific implementations actually implement that)
19:54austinhkwertii: Yeah, I'm seeing the same error code of 0 for two distinct types of errors, in my case (with Postgres)
19:54kwertiiaustinh: the getSQLState method is supposed to return a standardized string error code, too
19:54hiredmaninteresting fact: jdbc drivers have a jdbcCompliant method that returns a boolean
19:55austinhkwertii: Ok, thanks, I'll look into that. I wasn't sure what that value signified.
19:55kwertiihiredman: Liar's Paradox...
19:56technomancydunno bout JDBC, but java exception class hierarchies are annoying enough that in a lot of cases people straight up ignore them
19:56technomancystringly typed
19:56austinhThe exception stuff is currently my least favorite part of Clojure.
19:56hiredmanthe lack of patronymics
19:56kwertiiaustinh: in theory, there's a set of standardized error codes called SQLState
19:57technomancyaustinh: slingshot is a nicer take on the whole exception problem
19:58austinhtechnomancy: I agree, but I don't like the idea of mixing in a second concept of exceptions, especially when there are ones I can't control, like these JDBC ones.
19:58technomancyaustinh: yeah, a new way of doing things is only valuable insofar as various parties participate in it
19:59amalloytechnomancy: 1.4 provides the building-block slingshot needs, to work without AOT/java, right? so it's a little more "blessed" now
19:59technomancyamalloy: I wouldn't say it's blessed; rich has issues with the implementation
20:00technomancythe fact that you can "throw" arbitrary objects seems a bit silly, limiting it to throwing maps only would be better
20:00technomancywhich I guess is coming soon? or is that in 1.4?
20:00amalloytechnomancy: 1.4 does that
20:00technomancyok, cool
20:01amalloyc.l.ExceptionInfo contains: public final IPersistentMap data
20:01kwertiitechnomancy: I admire Common Lisp's bidirectional condition/restart passing system. Though I admit I've never seen any non-trivial uses of it in practice.
20:01technomancyI think decoupling the exception class from the catch mechanism kinda makes sense
20:01hiredmanslingshot uses 1.4's exception stuff if it is available
20:01technomancyhiredman: oh cool
20:01hiredman(and it uses it to support throwing arbitrary objects)
20:01amalloyhiredman: it probably compiles Stone anyway ro put it in the jar, right?
20:01technomancyhiredman: so in that case slingshot is more about the fancy destructuring catch macro then?
20:01amalloyin case 1.4 turns out not to be available when it runs
20:01amalloytechnomancy: yes
20:02hiredmanyes
20:02hiredmanhttps://github.com/scgilardi/slingshot/blob/master/src/slingshot/support.clj#L22
20:02jayunit100http://en.wikibooks.org/w/index.php?title=Compojure/Core_Libraries&amp;stable=0#Route_Parameters <--- compojure tutorial needs a little bit of updating.. I added some stuff hopefully someone else can sanity check.
20:03hiredmanwikibooks is dead, let it rot
20:03technomancyI love the fact that slingshot didn't have to do anything to support destructuring exceptions
20:04amalloyjayunit100: yeah, i would never recommend anyone look at wikibooks. better to submit a pull request to the compojure wiki
20:04amalloyor...just edit it? i don't know what github's wiki permissions are like
20:04austinhI found the list of all the "sqlstate" error codes: http://www.postgresql.org/docs/8.3/static/errcodes-appendix.html
20:04austinh...but I have a hard time believing this is the route I should be going down.
20:05kwertiiaustinh: other than parsing the actual text of the error message, I think that's about the best you're going to get for the Postgres driver
20:06austinhkwertii: Right, but it smells funny, and coupled with the fact that I don't see anyone else addressing the problem this way, I'm thinking maybe I should take a different course.
20:07technomancyaustinh: you can use slingshot's fancy catch stuff to write catch clauses that match against the message with a regex IIRC
20:07austinhBut, maybe I'll give it a shot and see how it goes.
20:07austinhtechnomancy: That's interesting.
20:07kwertiiaustinh: faced with the overall opacity of JDBC exceptions you've notice, most programmers don't even bother and just throw any exception back up to the user and abort
20:08austinhkwertii: That was my assumption.
20:09kwertiiaustinh: at most you might get a retry with a new connection here and there
20:10austinhI'm new to databases, too, so I don't really know what the common idioms are.
20:11hiredmanavoid violating constraints
20:11austinhI liked the idea of trying to add a row and being able to determine why it was rejected, without having to make a check for uniqueness first.
20:16kwertiiaustinh: there's some esoteric hackery that can do that, but no nice way
20:17austinhI'm going to try this sqlstate string. I see know that the myriad of values are grouped by prefix, so maybe that'll help keep it clean and simple.
20:18austinhs/know/now
20:19kwertiiwhich is weird, since "SELECT x, or else if it doesn't already exist, INSERT x" is one of the more common operations in SQL. you'd think they'd have included something to do that in the language by now.
20:20austinhClojure's jdbc interface has update-or-insert-values, but that doesn't fit my use case.
20:20austinhhttp://clojure.github.com/java.jdbc/#clojure.java.jdbc/update-or-insert-values
20:21kwertiiaustinh: that still does 2 separate SQL statements and just glues them together at the app level. that function should be in there at the SQL level.
20:22austinhkwertii: Yeah, that's one reason (perhaps irrationally in my case) that I don't like it, eithe.
20:22kwertiior at least it should be possible to do it more concisely than this: http://stackoverflow.com/a/6722460/157510
20:23kwertiiaustinh: also, you can always *shudder* use stored procedures
20:30kwertiiAnyone know whether it's possible to use cursors and fetchsize with unmodified Korma (select)s?
20:32amalloykwertii: i'm not a database expert, but i think jdbc automatically does "chunked lazy" fetching in the background with cursors for you, so usually you don't have to fiddle with that
20:33kwertiiamalloy: Postgres default is to get all results at once - http://jdbc.postgresql.org/documentation/head/query.html#fetchsize-example
20:37ibdknoxkwertii: It's not there
20:37kwertiiibdknox: what's not where?
20:38ibdknoxkwertii: in korma there's no way to do that currently
20:38ibdknoxnever needed it since I wasn't working with gigantic datasets :(
20:38ibdknoxI actually was unaware of it haha
20:38kwertiiibdknox: ahh
20:39kwertiiit appears that clojure.java.jdbc/with-query-results returns a lazy sequence over what it gets back from the underlying JDBC, but the Postgres driver is set to grab the entire result set by default
20:40ibdknoxkwertii: korma also realizes that sequence since you can't pass it around otherwise
20:40kwertiiibdknox: it's simple enough to set the JDBC driver into chunked mode, I just can't figure out the Right Way to pass that information through Korma in a nice way
20:40ibdknoxthat lazy-seq has bitten almost everyone who uses c.j.jdbc
20:41ibdknoxkwertii: is that something you'd want to set globally or per query?
20:42kwertiiibdknox: hm. if it realizes the whole results sequence anyway, it won't matter if JDBC is fetching in chunks; it'll be forced to grab everything
20:42ibdknoxkwertii: yeah, that's what I was saying
20:43ibdknoxkwertii: you can't retain the semantics of korma with that lazy seq
20:43kwertiiibdknox: in my particular case, I'd want it per connection, though I suppose it wouldn't matter if it was for everything, since most queries will return fewer results than the chunk size
20:44kwertiiibdknox: how about a nice neat way to give up some of the Korma stuff in specific cases where you want the lazy-seq?
20:44kwertii(with-lazy-results ... )
20:44ibdknoxkwertii: sounds reasonable
20:45hiredmanyou could just use korma to generate the query string
20:45hiredmanand use clojure.java.jdbc directly
20:46kwertiihiredman: yeah, this would essentially be a convenience function to do that
21:21xeqiI was trying to use cljs for http://www.scribd.com/jobs/botrace_api. is there a way to define a non-namespaced function in cljs?
21:47emezeskexeqi: I don't know of a way. It would be trivial to write a js function that called an :export -ed cljs function though
21:53xeqiemezeske: I ended up doing (set! js/make_move make-move) and its working with :advanced
21:57emezeskexeqi: Makes sense that js/* would have to be left unmangled
21:57xeqithanks for cljsbuild btw, its working nicely for me
21:58emezeskexeqi: glad to hear it!
22:04pandeirois there a way to emulate a for x in obj loop in cljs w/o resorting to js->clj ?
22:32kwertiiibdknox: First pass at https://github.com/pjlegato/Korma/blob/feature/with-lazy-results/src/korma/db.clj#L182 , but it seems to freeze up after a few runs. Probably not releasing db connections back to the pool or something like that. Not sure if chunking is working properly apart from that, either.
22:48emacsenIs there a clojurescript contrib?
23:15emezeskeemacsen: I don't believe so. There isn't even a Clojure contrib anymore.
23:16emacsenemezeske, so what about those nice contrib functions I rely on?
23:16emezeske~contrib
23:16clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
23:16emacsenwell I mean for cljscript specifically
23:16ibdknoxit might be worth having a clojurescript version of something like useful
23:17ibdknoxbut specifically for random things related to JS
23:17ibdknoxe.g. setTimeout and the like
23:17ibdknoxI end up writing a few of those functions in every project because they don't seem to belong anywhere
23:18emacsenI'm halfway between doing the same (rewriting) and just using coffeescript for this relatively simple project
23:19emezeskeemacsen: Can you give an example of what you're missing?
23:19emacsenemezeske, the seq function position
23:20mabesemezeske: thanks a ton for lein-cljsbuild! I finally started using clojurescript today (been using clojure since 09) and your project made things very easy :)
23:20emacsenfrom clojure.contrib.seq
23:20emacsenerm positions
23:20emezeskemabes: Glad to hear it!
23:21emezeskeemacsen: I see. Does that have a clojure 1.3 home? Or is it stuck back in the 1.2 days?
23:21emacsenI'm fairly sure it's in 1.3 but I may be wrong
23:21mabesemezeske: btw, are you an emacs user? I'm trying to find the best way to start a clojurescript repl in emacs a'la clojure-jack-in/slime-connect
23:21emezeskeemacsen: Well, I mean, contrib died with 1.3, so it would have to be in a different ns
23:22emacsenemezeske, ah right
23:22emezeskemabes: No, I'm a vimster, I'll be little help :)
23:22emezeskeemacsen: I'm just curious because some things are relatively easy to port to cljs
23:22emezeskeemacsen: But it would depend a lot on the particular thing
23:23emacsenemezeske, right, I'm just trying to decide which is more important to me right now: getting my project done or improving clojurescript
23:23emezeskeemacsen: Sure. Depending on how many contrib functions you need, you could do some pasting (as horrible as that is)
23:24emacsenemezeske, yeah. we'll see how far I get I guess
23:47ivancan REPLy work well on Windows, perhaps with mintty or SSL client + some SSH server?
23:48ivanwhere "work well" must be outside of conhost, of course :)
23:49ivanmaybe not https://groups.google.com/group/leiningen/browse_thread/thread/b8a3d36ebe1b6377
23:50ivanprobably fixable
23:52scottjemezeske: did you see the guy asking yesterday about a way to tell lein-cljsbuild what namespace to build from so that he could have three artifacts from one code base?
23:53emezeskescottj: I talked to someone about something similar to that, not sure if it was the same person
23:53emezeskescottj: Basically, I think it's not a good idea to do that in general
23:56scottjemezeske: ok, mostly wanted to know if there was that functionality hidden somewhere or if it was a planned feature, guess that answers it
23:56emezeskescottj: Is that something you wanted for your project? What kind of project?
23:58scottjemezeske: nope but I thought I might end up with a situation like his. he wanted to build mobile and desktop artifacts of his app
23:58emezeskescottj: Oh! That was definitely a different person than who I talked to
23:58scottjI'll look in backlog for his name
23:59emezeskescottj: So there is a way to accomplish that if you have a good reason (which the one you mentioned might be)